org.wso2.carbon.registry.core
Class Aspect

java.lang.Object
  extended by org.wso2.carbon.registry.core.Aspect

public abstract class Aspect
extends java.lang.Object

Aspects are using to associate custom behaviors with resources; Aspects differ form handlers, in that handlers are automatically applied to a resource, whereas, aspects are needed to be invoked manually through user action (e.g. by clicking a button in the user interface).


Field Summary
static java.lang.String AVAILABLE_ASPECTS
           
 
Constructor Summary
Aspect()
           
 
Method Summary
abstract  void associate(Resource resource, Registry registry)
          Associate a new Resource with this aspect.
abstract  void dissociate(RequestContext context)
          Remove this Aspect from the referenced resource.
abstract  java.lang.String[] getAvailableActions(RequestContext context)
          Get a list of available actions for the resource in the RequestContext, taking into account current state, user, etc.
abstract  void invoke(RequestContext context, java.lang.String action)
          Do something - action names are aspect-specific, and it's up to the implementation to decide if a given action is allowed, and what to do if so.
 void invoke(RequestContext context, java.lang.String action, java.util.Map<java.lang.String,java.lang.String> parameters)
          Do something - action names are aspect-specific, and it's up to the implementation to decide if a given action is allowed, and what to do if so.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVAILABLE_ASPECTS

public static final java.lang.String AVAILABLE_ASPECTS
See Also:
Constant Field Values
Constructor Detail

Aspect

public Aspect()
Method Detail

associate

public abstract void associate(Resource resource,
                               Registry registry)
                        throws RegistryException
Associate a new Resource with this aspect. This could set custom properties, create sub-directories, etc. If this throws an Exception, the association has FAILED.

Parameters:
resource - Resource which we want to change the state
registry - Current registry instance
Throws:
RegistryException - If the condition is not met or some thing is wrong

invoke

public abstract void invoke(RequestContext context,
                            java.lang.String action)
                     throws RegistryException
Do something - action names are aspect-specific, and it's up to the implementation to decide if a given action is allowed, and what to do if so. Action invocations can (and often do) have persistent side-effects in the Registry.

Parameters:
context - the RequestContext containing all the state about this request
action - action to perform
Throws:
RegistryException - If the condition is not met or some thing is wrong

invoke

public void invoke(RequestContext context,
                   java.lang.String action,
                   java.util.Map<java.lang.String,java.lang.String> parameters)
            throws RegistryException
Do something - action names are aspect-specific, and it's up to the implementation to decide if a given action is allowed, and what to do if so. Action invocations can (and often do) have persistent side-effects in the Registry.

Parameters:
context - the RequestContext containing all the state about this request
action - action to perform
parameters - parameters to be used for the operation
Throws:
RegistryException - If the condition is not met or some thing is wrong

getAvailableActions

public abstract java.lang.String[] getAvailableActions(RequestContext context)
Get a list of available actions for the resource in the RequestContext, taking into account current state, user, etc.

Parameters:
context - the RequestContext containing info about the Resource, Registry, User, etc.
Returns:
a String[] of the names of valid actions for this aspect on the specified resource

dissociate

public abstract void dissociate(RequestContext context)
Remove this Aspect from the referenced resource.

Parameters:
context - the RequestContext containing all the state about this request


Copyright © 2011 WSO2 Inc. All Rights Reserved.