org.ow2.wildcat
Interface Context


public interface Context

Public interface through which users perform push/pull operation on context data.


Method Summary
 void attachAttribute(String attribute, Attribute attr)
          Attach Attribute at specified location.
 void attachResource(String resource, Resource res)
          Attach Resource at specified location.
 void createAttribute(String attribute, Object value)
          Creates a new global POJO attribute.
 void createAttribute(String attribute, WEventInterface.Scope scope, Object value)
          Creates a new POJO attribute and set the scope for the events generated when setting the value.
 void createPeriodicAttributePoller(String attribute, long duration, TimeUnit unit)
          Periodically creates an AttributeChangedEvent where old and new values are equal.
 void createPeriodicAttributePoller(String attribute, long duration, TimeUnit unit, WEventInterface.Scope scope)
          Periodically creates an AttributeChangedEvent where old and new values are equal.
 Query createQuery(String query)
          Creates and starts a query.
 void createResource(String resource)
          Creates Resource along a path.
 void createSymlink(String link, String target)
          Creates and attach a Symlink.
 void destroy()
          Destroy this context.
 void destroyQuery(Query query)
          Detach all listener and destroy query.
 void detachAttribute(String attribute)
          Detach an attribute.
 void detachResource(String resource)
          Detach a resource.
 void emitEvent(WEvent... events)
          Emit event(s).
 void export()
          Allow the context for remote connections.
 Attribute getAttribute(String attribute)
          Return the attribute at specified location.
 String getName()
           
 Resource getResource(String resource)
          Return the resource at specified location.
 Object getValue(String attribute)
          Fetch attribute value.
 boolean isRemoteContextAvailable(String context)
           
 Set<String> list(String resource)
          List resources and attributes.
 boolean listen(String source)
          Listen for events coming from the context with the given name.
 void pauseQuery(Query query)
          Pause Query.
 void registerActions(Query query, WAction... actions)
          Register one or more actions to be executed when an event corresponding to the query is triggered
 Query registerActions(String query, WAction... actions)
          Register one or more actions to be executed when an event corresponding to the query is triggered
 void registerListeners(Query query, com.espertech.esper.client.UpdateListener... listeners)
          Attach one or more listener to a query.
 Query registerListeners(String query, com.espertech.esper.client.UpdateListener... listeners)
          Creates and starts a query and register one or more listener.
 void removeActions(Query query, WAction... actions)
          Remove one or more action associated with a Query.
 void removeListeners(Query query, com.espertech.esper.client.UpdateListener... listeners)
          Removes one or more listeners associated with a Query.
 void removePeriodicAttributePoller(String attribute)
          Remove an attribute poller.
 void resumeQuery(Query query)
          Resume Query.
 Object setValue(String attribute, Object value)
          Set Attribute's value.
 void unexport()
          Don't allow the context for remote connections.
 

Method Detail

getName

String getName()
Returns:
the name of the context as registered for remote connection

attachAttribute

void attachAttribute(String attribute,
                     Attribute attr)
                     throws ContextException
Attach Attribute at specified location.

Parameters:
attribute - path of the Attribute
attr - an Attribute
Throws:
ContextException - if the attribute cannot be attached

createAttribute

void createAttribute(String attribute,
                     Object value)
                     throws ContextException
Creates a new global POJO attribute.

Parameters:
attribute - path of the attribute
value - initial value of the attribute
Throws:
ContextException - if the attribute cannot be created

createAttribute

void createAttribute(String attribute,
                     WEventInterface.Scope scope,
                     Object value)
                     throws ContextException
Creates a new POJO attribute and set the scope for the events generated when setting the value.

Parameters:
attribute - path of the attribute
value - initial value of the attribute
scope - scope of the events generated when setting the value
Throws:
ContextException - if the attribute cannot be created

detachAttribute

void detachAttribute(String attribute)
                     throws ContextException
Detach an attribute.

Parameters:
attribute - path of the attribute
Throws:
ContextException - if the attribute cannot be detached

createResource

void createResource(String resource)
                    throws ContextException
Creates Resource along a path.

Parameters:
resource - path to create
Throws:
ContextException - if the resource cannot be created

getResource

Resource getResource(String resource)
                     throws ContextException
Return the resource at specified location.

Parameters:
resource - path of the Resource
Returns:
the resource at specified location
Throws:
ContextException - if the resource cannot be returned

attachResource

void attachResource(String resource,
                    Resource res)
                    throws ContextException
Attach Resource at specified location.

Parameters:
resource - path of the Resource
res - a Resource
Throws:
ContextException - if the resource cannot be attached

detachResource

void detachResource(String resource)
                    throws ContextException
Detach a resource.

Parameters:
resource - path of the Resource
Throws:
ContextException - if the resource cannot be detached

createSymlink

void createSymlink(String link,
                   String target)
                   throws ContextException
Creates and attach a Symlink.

Parameters:
link - attach point
target - target path of the symbolic link
Throws:
ContextException - if the Symlink cannot be created

getAttribute

Attribute getAttribute(String attribute)
                       throws ContextException
Return the attribute at specified location.

Parameters:
attribute - the path of the attribute
Returns:
an attribute
Throws:
ContextException - if the attribute cannot be retrieved

getValue

Object getValue(String attribute)
                throws ContextException
Fetch attribute value.

Parameters:
attribute - the path of the attribute
Returns:
the value of the attribute, or null if attribute does not exist
Throws:
ContextException - if the attribute cannot be accessed

setValue

Object setValue(String attribute,
                Object value)
                throws ContextException
Set Attribute's value.

Parameters:
attribute - path of the Attribute
value - new value of the Attribute
Returns:
previous value of the Attribute
Throws:
ContextException - if the attribute cannot be accessed

list

Set<String> list(String resource)
                 throws ContextException
List resources and attributes.

Parameters:
resource - the resource to inspect
Returns:
A set of String, attribute's names preceded with '#'
Throws:
ContextException - if the resource cannot be accessed

emitEvent

void emitEvent(WEvent... events)
Emit event(s).

Parameters:
events - one or more event to emit

createPeriodicAttributePoller

void createPeriodicAttributePoller(String attribute,
                                   long duration,
                                   TimeUnit unit)
                                   throws ContextException
Periodically creates an AttributeChangedEvent where old and new values are equal. Events have a global scope.

Parameters:
attribute - the location of the attribute to poll
duration - the period
unit - the period unit
Throws:
ContextException - if the attribute poller cannot be created

createPeriodicAttributePoller

void createPeriodicAttributePoller(String attribute,
                                   long duration,
                                   TimeUnit unit,
                                   WEventInterface.Scope scope)
                                   throws ContextException
Periodically creates an AttributeChangedEvent where old and new values are equal.

Parameters:
attribute - the location of the attribute to poll
duration - the period
unit - the period unit
scope - the scope of the generated events
Throws:
ContextException - if the attribute poller cannot be created

removePeriodicAttributePoller

void removePeriodicAttributePoller(String attribute)
                                   throws ContextException
Remove an attribute poller.

Parameters:
attribute - the location of the attribute to poll
Throws:
ContextException - if the attribute poller cannot be deleted

createQuery

Query createQuery(String query)
Creates and starts a query.

Parameters:
query - the query
Returns:
a reference to the query

pauseQuery

void pauseQuery(Query query)
Pause Query.

Parameters:
query - query's reference

resumeQuery

void resumeQuery(Query query)
Resume Query.

Parameters:
query - query's reference

destroyQuery

void destroyQuery(Query query)
Detach all listener and destroy query.

Parameters:
query - the reference of the query

registerListeners

Query registerListeners(String query,
                        com.espertech.esper.client.UpdateListener... listeners)
Creates and starts a query and register one or more listener.

Parameters:
query - the query
listeners - 0 or more listeners
Returns:
a reference to the query

registerListeners

void registerListeners(Query query,
                       com.espertech.esper.client.UpdateListener... listeners)
Attach one or more listener to a query.

Parameters:
query - query reference
listeners - one or more listener to attach

removeListeners

void removeListeners(Query query,
                     com.espertech.esper.client.UpdateListener... listeners)
Removes one or more listeners associated with a Query.

Parameters:
query - the query from which to detach
listeners - the listeners to detach

registerActions

void registerActions(Query query,
                     WAction... actions)
Register one or more actions to be executed when an event corresponding to the query is triggered

Parameters:
query - the query to listen to
actions - actions to perform when an event is triggered

registerActions

Query registerActions(String query,
                      WAction... actions)
Register one or more actions to be executed when an event corresponding to the query is triggered

Parameters:
query - the query to listen to
actions - actions to perform when an event is triggered

removeActions

void removeActions(Query query,
                   WAction... actions)
Remove one or more action associated with a Query.

Parameters:
query - the query from which to remove the associated actions
actions - actions to remove

export

void export()
            throws ContextException
Allow the context for remote connections.

Throws:
ContextException - if this context cannot be exported

unexport

void unexport()
              throws ContextException
Don't allow the context for remote connections.

Throws:
ContextException - if this context cannot be unexported

listen

boolean listen(String source)
Listen for events coming from the context with the given name.

Parameters:
source - a context name
Returns:
true if this context listens

isRemoteContextAvailable

boolean isRemoteContextAvailable(String context)
Parameters:
context - a context name
Returns:
true if a remote context with the given name is available

destroy

void destroy()
             throws ContextException
Destroy this context.

Throws:
ContextException - if it cannot be destroyed


Copyright © 2010 OW2 Consortium. All Rights Reserved.