Package org.hcjf.layers
Class Layer
- java.lang.Object
-
- org.hcjf.layers.Layer
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler,LayerInterface
- Direct Known Subclasses:
BaseFunctionLayer,CloudOrchestrator.SystemCloudNodeReadableImplementation,CloudOrchestrator.SystemCloudServiceReadableImplementation,CrudLayer,DefaultLocaleLayer,DistributedLayer,FormUrlEncodedDecoder,HttpPackage.ChunkedDecoderLayer,KubernetesJobResource,KubernetesSpyResource,Layers.SystemLayerReadableImplementation,Layers.SystemResourceReadableImplementation,MultipartFormDataDecoder,ParameterizedQuery.ParameterizedQueryBsonCustomBuilderLayer,PluginLayer,PropertiesFileLocaleLayer,QueryBsonBuilderLayer
public abstract class Layer extends java.lang.Object implements LayerInterface
All the layer implementation extends this class, and this class is a proxy between the layer client and implementation.- Author:
- javaito
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLayer.AccessThis class represents the access resume of the layer.static classLayer.LayerAgentstatic interfaceLayer.LayerAgentMBean
-
Method Summary
Modifier and Type Method Description protected Layer.AccesscheckAccess()This method must be override to add restrictions over particular implementations of the layers.java.util.Set<java.lang.String>getAliases()Return the string set with all the aliases for this implementation.java.lang.StringgetImplName()Return the layer implementation name.protected <L extends LayerInterface>
LgetLayer(java.lang.Class<? extends L> layerClass, java.lang.String implName)Delegation method to get some layer implementation.LayerProxygetProxy()Return the layer proxy of the layer or null by default.protected ServiceSessiongetSession()Return the session associated to the execution thread.protected java.lang.ObjectgetTarget()This method return the invocation target.java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)This method intercepts the call to layer implementation and save some information about the thread behavior.booleanisOverwritable()This method return true if the layer instance is overwritable for other instance whit the same name.booleanisPlugin()Returns true if the layer implementations is a instanceof plugin or false in the otherwise.booleanisStateful()Return if the layer is stateful or not.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hcjf.layers.LayerInterface
getRegex, isDistributed
-
-
-
-
Constructor Detail
-
Layer
public Layer(java.lang.String implName, boolean stateful)This is the end point for all the layers constructor.- Parameters:
implName- Implementation name.stateful- Stateful status.
-
Layer
public Layer(java.lang.String implName)
-
Layer
public Layer(boolean stateful)
-
Layer
public Layer()
-
-
Method Detail
-
getImplName
public java.lang.String getImplName()
Return the layer implementation name.- Specified by:
getImplNamein interfaceLayerInterface- Returns:
- Layer implementation name.
-
isStateful
public final boolean isStateful()
Return if the layer is stateful or not.- Specified by:
isStatefulin interfaceLayerInterface- Returns:
- Stateful
-
isPlugin
public final boolean isPlugin()
Returns true if the layer implementations is a instanceof plugin or false in the otherwise.- Specified by:
isPluginin interfaceLayerInterface- Returns:
- Plugin status.
-
getAliases
public java.util.Set<java.lang.String> getAliases()
Return the string set with all the aliases for this implementation.- Returns:
- Aliases for this implementation.
-
isOverwritable
public boolean isOverwritable()
This method return true if the layer instance is overwritable for other instance whit the same name.- Returns:
- True if the layer is overwritable or false in the otherwise.
-
checkAccess
protected Layer.Access checkAccess()
This method must be override to add restrictions over particular implementations of the layers.- Returns:
- Access object.
-
getLayer
protected final <L extends LayerInterface> L getLayer(java.lang.Class<? extends L> layerClass, java.lang.String implName)
Delegation method to get some layer implementation.- Type Parameters:
L- Expected layer implementation class.- Parameters:
layerClass- Layer implementation class.implName- Layer implementation name.- Returns:
- Layer implementation.
-
getProxy
public LayerProxy getProxy()
Return the layer proxy of the layer or null by default.- Returns:
- Layer proxy instance.
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.ThrowableThis method intercepts the call to layer implementation and save some information about the thread behavior.- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Parameters:
proxy- Object to be called.method- Method to be called.args- Method to invoke the method.- Returns:
- Return the value returned for the proxy method.
- Throws:
java.lang.Throwable- Throw all the generated exceptions.
-
getTarget
protected java.lang.Object getTarget()
This method return the invocation target.- Returns:
- Invocation target.
-
getSession
protected final ServiceSession getSession()
Return the session associated to the execution thread.- Returns:
- Service session.
-
-