Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
WildCAT: A Generic Framework for Context-Aware Applications. Copyright (C) 2008-2009 Bull S.A.S. Copyright (C) 2008 EMN Contact: wildcat@ow2.org This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Authors: - Pierre-Charles David (initial) - Nicolas Loriant -------------------------------------------------------------------------- $Id: Context.java 403 2009-01-08 16:26:46Z loris $ --------------------------------------------------------------------------
 
 package org.ow2.wildcat;
 
 import java.util.Set;
 
 
 import  com.espertech.esper.client.UpdateListener;

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

    

Returns:
the name of the context as registered for remote connection
 
     String getName();
 
     /*
      * PULL RELATED OPERATIONS
      */

    
Attach Attribute at specified location.

Parameters:
attribute path of the Attribute
attr an Attribute
Throws:
ContextException if the attribute cannot be attached
 
     void attachAttribute(String attributeAttribute attrthrows 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
 
     void createAttribute(String attributeObject valuethrows 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
 
     void createAttribute(String attributeScope scopeObject valuethrows ContextException;

    
Detach an attribute.

Parameters:
attribute path of the attribute
Throws:
ContextException if the attribute cannot be detached
 
     void detachAttribute(String attributethrows ContextException;

    
Creates Resource along a path.

Parameters:
resource path to create
Throws:
ContextException if the resource cannot be created
 
     void createResource(String resourcethrows 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
    Resource getResource(String resourcethrows ContextException;

    
Attach Resource at specified location.

Parameters:
resource path of the Resource
res a Resource
Throws:
ContextException if the resource cannot be attached
    void attachResource(String resourceResource resthrows ContextException;

    
Detach a resource.

Parameters:
resource path of the Resource
Throws:
ContextException if the resource cannot be detached
    void detachResource(String resourcethrows 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
    void createSymlink(String linkString targetthrows 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
    Attribute getAttribute(String attributethrows 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
    Object getValue(String attributethrows 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
    Object setValue(String attributeObject valuethrows 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
    Set<Stringlist(String resourcethrows ContextException;
    /*
     * PUSH RELATED OPERATIONS
     */

    
Emit event(s).

Parameters:
events one or more event to emit
    void emitEvent(WEvent... events);

    
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
    void createPeriodicAttributePoller(String attributelong duration,
            TimeUnit unitthrows 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
    void createPeriodicAttributePoller(String attributelong duration,
            TimeUnit unitScope scopethrows ContextException;

    
Remove an attribute poller.

Parameters:
attribute the location of the attribute to poll
Throws:
ContextException if the attribute poller cannot be deleted
    void removePeriodicAttributePoller(String attributethrows ContextException;

    
Creates and starts a query.

Parameters:
query the query
Returns:
a reference to the query
    Query createQuery(String query);

    
Pause Query.

Parameters:
query query's reference
    void pauseQuery(Query query);

    
Resume Query.

Parameters:
query query's reference
    void resumeQuery(Query query);

    
Detach all listener and destroy query.

Parameters:
query the reference of the query
    void destroyQuery(Query query);

    
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
    Query registerListeners(String query, UpdateListener... listeners);

    
Attach one or more listener to a query.

Parameters:
query query reference
listeners one or more listener to attach
    void registerListeners(Query query, UpdateListener... listeners);

    
Removes one or more listeners associated with a Query.

Parameters:
query the query from which to detach
listeners the listeners to detach
    void removeListeners(Query query, UpdateListener... listeners);
    /*
     * Distribution related
     */

    
Allow the context for remote connections.

Throws:
ContextException if this context cannot be exported
    void export() throws ContextException;

    
Don't allow the context for remote connections.

Throws:
ContextException if this context cannot be unexported
    void unexport() throws ContextException;

    
Listen for events coming from the context with the given name.

Parameters:
source a context name
Returns:
true if this context listens
    boolean listen(String source);

    

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

    
Destroy this context.

Throws:
ContextException if it cannot be destroyed
    void destroy() throws ContextException;
New to GrepCode? Check out our FAQ X