org.terracotta.management.registry
Class AbstractManagementProvider<T>

java.lang.Object
  extended by org.terracotta.management.registry.AbstractManagementProvider<T>
All Implemented Interfaces:
ManagementProvider<T>
Direct Known Subclasses:
AbstractActionManagementProvider

public abstract class AbstractManagementProvider<T>
extends Object
implements ManagementProvider<T>

Author:
Mathieu Carbou

Field Summary
protected  Queue<ExposedObject<T>> managedObjects
           
 
Constructor Summary
AbstractManagementProvider(Class<? extends T> managedType)
           
 
Method Summary
protected  CapabilityContext buildCapabilityContext()
           
protected  String buildCapabilityName()
           
<V> V
callAction(Context context, String methodName, Class<V> returnType, Parameter... parameters)
          Call an action, if the provider supports this.
 void callAction(Context context, String methodName, Parameter... parameters)
          Call an action, if the provider supports this.
 void close()
          Closes the management provider.
 Map<String,Statistic<?,?>> collectStatistics(Context context, Collection<String> statisticNames, long since)
          Collect statistics, if the provider supports this.
protected  void dispose(ExposedObject<T> exposedObject)
           
protected  ExposedObject<T> findExposedObject(Context context)
           
 CapabilityContext getCapabilityContext()
          Get the context that the provided capabilities need to run.
 String getCapabilityName()
           
 Collection<Descriptor> getDescriptors()
          Get the set of capability descriptors the current provider provides.
 Class<? extends T> getManagedType()
          The class of managed objects.
 void register(T managedObject)
          Register an object for management in the current provider.
 boolean supports(Context context)
          Check wheter this management provider supports the given context
 void unregister(T managedObject)
          Unregister a managed object from the current provider.
protected abstract  ExposedObject<T> wrap(T managedObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.terracotta.management.registry.ManagementProvider
getCapability
 

Field Detail

managedObjects

protected final Queue<ExposedObject<T>> managedObjects
Constructor Detail

AbstractManagementProvider

public AbstractManagementProvider(Class<? extends T> managedType)
Method Detail

getManagedType

public final Class<? extends T> getManagedType()
Description copied from interface: ManagementProvider
The class of managed objects.

Specified by:
getManagedType in interface ManagementProvider<T>
Returns:
a class.

getCapabilityName

public final String getCapabilityName()
Specified by:
getCapabilityName in interface ManagementProvider<T>
Returns:
The name of this capability

getCapabilityContext

public final CapabilityContext getCapabilityContext()
Description copied from interface: ManagementProvider
Get the context that the provided capabilities need to run.

Specified by:
getCapabilityContext in interface ManagementProvider<T>
Returns:
the context requirements.

register

public final void register(T managedObject)
Description copied from interface: ManagementProvider
Register an object for management in the current provider.

Specified by:
register in interface ManagementProvider<T>
Parameters:
managedObject - the object to manage.

unregister

public final void unregister(T managedObject)
Description copied from interface: ManagementProvider
Unregister a managed object from the current provider.

Specified by:
unregister in interface ManagementProvider<T>
Parameters:
managedObject - the managed object.

close

public final void close()
Description copied from interface: ManagementProvider
Closes the management provider.

Specified by:
close in interface ManagementProvider<T>

supports

public final boolean supports(Context context)
Description copied from interface: ManagementProvider
Check wheter this management provider supports the given context

Specified by:
supports in interface ManagementProvider<T>
Parameters:
context - The management context
Returns:
true if the context is supported by this management provider

collectStatistics

public Map<String,Statistic<?,?>> collectStatistics(Context context,
                                                    Collection<String> statisticNames,
                                                    long since)
Description copied from interface: ManagementProvider
Collect statistics, if the provider supports this.

Specified by:
collectStatistics in interface ManagementProvider<T>
Parameters:
context - the context.
statisticNames - the statistic names to collect.
since - The unix time in ms from where to return the statistics for statistics based on samples.
Returns:
the statistic map, the key being the statistic namesø.

callAction

public final void callAction(Context context,
                             String methodName,
                             Parameter... parameters)
Description copied from interface: ManagementProvider
Call an action, if the provider supports this.

Specified by:
callAction in interface ManagementProvider<T>
Parameters:
context - the context.
methodName - the method name.
parameters - the action method's parameters (objects and class names)

callAction

public <V> V callAction(Context context,
                        String methodName,
                        Class<V> returnType,
                        Parameter... parameters)
Description copied from interface: ManagementProvider
Call an action, if the provider supports this.

Specified by:
callAction in interface ManagementProvider<T>
Type Parameters:
V - the expected response type
Parameters:
context - the context.
methodName - the method name.
returnType - The expected return type
parameters - the action method's parameters (objects and class names)
Returns:
the action's return value.

getDescriptors

public Collection<Descriptor> getDescriptors()
Description copied from interface: ManagementProvider
Get the set of capability descriptors the current provider provides.

Specified by:
getDescriptors in interface ManagementProvider<T>
Returns:
the set of capability descriptors.

buildCapabilityName

protected String buildCapabilityName()

buildCapabilityContext

protected CapabilityContext buildCapabilityContext()

dispose

protected void dispose(ExposedObject<T> exposedObject)

wrap

protected abstract ExposedObject<T> wrap(T managedObject)

findExposedObject

protected final ExposedObject<T> findExposedObject(Context context)


Copyright © 2016. All Rights Reserved.