org.eclipse.corona.collaboration
Class CollaborationEvent

java.lang.Object
  extended by org.eclipse.corona.collaboration.CollaborationEvent
All Implemented Interfaces:
java.io.Serializable, org.eclipse.core.runtime.IAdaptable, ICollaborationEvent, org.osgi.service.event.EventConstants
Direct Known Subclasses:
ProjectEvent

public class CollaborationEvent
extends java.lang.Object
implements ICollaborationEvent, org.eclipse.core.runtime.IAdaptable

Collaboration Events are a specialized OSGi Event. A Collaboration Event must be able to be serialized so that it can be shared within a distributed collaboration environment.

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable dictionary
           
 
Fields inherited from interface org.eclipse.corona.collaboration.ICollaborationEvent
ACTION_TYPE, COLLABORATION_ID, CONTEXT_NAME, CONTEXT_TYPE, CONTEXT_URI, REMOTE_URI, RESOURCE_CONTAINER_URI, RESOURCE_NAME, RESOURCE_PROPERTY_CONTACT, RESOURCE_PROPERTY_DESCRIPTION, RESOURCE_PROPERTY_OBJECTIVE, RESOURCE_PROPERTY_PROJECT_LEADER, RESOURCE_PROPERTY_START, RESOURCE_PROPERTY_STATUS, RESOURCE_PROPERTY_TYPE, RESOURCE_PROPERTY_URI, RESOURCE_PROPERTY_VALUE, RESOURCE_TYPE, RESOURCE_URI, ROUTER_ID, TOPIC_ROOT, TOPIC_SEPARATOR
 
Fields inherited from interface org.osgi.service.event.EventConstants
BUNDLE_SIGNER, BUNDLE_SYMBOLICNAME, EVENT, EVENT_FILTER, EVENT_TOPIC, EXCEPTION, EXCEPTION_CLASS, EXCEPTION_MESSAGE, EXECPTION_CLASS, MESSAGE, SERVICE, SERVICE_ID, SERVICE_OBJECTCLASS, SERVICE_PID, TIMESTAMP
 
Constructor Summary
CollaborationEvent(org.osgi.service.event.Event event)
          Construct a new Collaboration Event.
CollaborationEvent(java.lang.String ctxURI, java.lang.String ctxType, java.lang.String ctxName)
          Construct a new Collaboration Event.
CollaborationEvent(java.lang.String ctxURI, java.lang.String ctxType, java.lang.String ctxName, java.util.Dictionary properties)
          Construct a new Collaboration Event.
 
Method Summary
 void addRemoteURI(java.lang.String uri)
          Add a remote URI that this event should be routed to.
static CollaborationEvent createCollaborationEvent(org.osgi.service.event.Event osgiEvent)
          Create a Collaboration Event for an OSGi event
 void defineBundleProperties(org.osgi.framework.Bundle bundle)
          Define the event properties associated with a Bundle
 void defineExceptionProperties(java.lang.Throwable t)
          Define the event properties associated with an Exception
 void defineProperty(java.lang.String key, java.lang.Object value)
          Define a Collaboration Event property.
 void defineServiceReferenceProperties(org.osgi.framework.ServiceReference ref)
          Define the event properties associated with a service
 java.lang.String getActionType()
           
 java.lang.Object getAdapter(java.lang.Class adapter)
          Eclipse IAdaptable extension-point
 java.lang.String getCollaborationID()
          Get the ID of the artifact that is the subject of collaboration
 java.lang.String getContextName()
           
 java.lang.String getContextType()
          Get the context type specifies the type of event.
 java.lang.String getContextURI()
          Get the URI that defines the context of this event.
 org.osgi.service.event.Event getEvent()
          Get the OSGi Event that represents this Collaboration Event.
 java.lang.Object getProperty(java.lang.String name)
          Retrieves a property.
 java.lang.String getPropertyAsString(java.lang.String name)
           
 java.lang.String[] getPropertyNames()
          Returns a list of this event's property names.
 java.lang.String getTopic()
          Get the collaboration topic used to distribute this event
 java.net.URI[] listRemoteURIs(java.lang.String uriScheme)
          Get the list of remote URIs where the CollaborationEvent should be routed to.
 void setActionType(java.lang.String actionType)
           
 void setCollaborationID(java.lang.String id)
          Set the ID of the artifact that is the subject of collaboration
 java.lang.String toString()
          dump the contents of the event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dictionary

protected java.util.Hashtable dictionary
Constructor Detail

CollaborationEvent

public CollaborationEvent(org.osgi.service.event.Event event)
Construct a new Collaboration Event.

Parameters:
event - is the OSGi event to convert to a Collaboration Event

CollaborationEvent

public CollaborationEvent(java.lang.String ctxURI,
                          java.lang.String ctxType,
                          java.lang.String ctxName)
Construct a new Collaboration Event.

Parameters:
ctxURI - is URI of the collaboration context
ctxType - is the type of context that defines the collaboration scope
ctxName - is the unique name for collaborating within its CONTEXT_TYPE

CollaborationEvent

public CollaborationEvent(java.lang.String ctxURI,
                          java.lang.String ctxType,
                          java.lang.String ctxName,
                          java.util.Dictionary properties)
Construct a new Collaboration Event. All event attributes must be Serializable since a Collaboration Event could be sent to a remote Corona environment.

Parameters:
ctxURI - is URI of the collaboration context
ctxType - is the type of context that defines the collaboration scope
ctxName - is the unique name for collaborating within its CONTEXT_TYPE
Method Detail

createCollaborationEvent

public static CollaborationEvent createCollaborationEvent(org.osgi.service.event.Event osgiEvent)
Create a Collaboration Event for an OSGi event

Parameters:
osgiEvent -
Returns:

defineProperty

public void defineProperty(java.lang.String key,
                           java.lang.Object value)
Define a Collaboration Event property. Collaboration Event properties must be Serializable.

Parameters:
key - that uniquely identifies the property
value - of the property being defined

defineBundleProperties

public void defineBundleProperties(org.osgi.framework.Bundle bundle)
Define the event properties associated with a Bundle

Parameters:
bundle -

defineExceptionProperties

public void defineExceptionProperties(java.lang.Throwable t)
Define the event properties associated with an Exception

Parameters:
t -

defineServiceReferenceProperties

public void defineServiceReferenceProperties(org.osgi.framework.ServiceReference ref)
Define the event properties associated with a service

Parameters:
properties -
ref -

getEvent

public org.osgi.service.event.Event getEvent()
Get the OSGi Event that represents this Collaboration Event.

Returns:
org.osgi.service.event.Event

getProperty

public final java.lang.Object getProperty(java.lang.String name)
Retrieves a property.

Parameters:
name - the name of the property to retrieve
Returns:
The value of the property, or null if not found.

getPropertyAsString

public final java.lang.String getPropertyAsString(java.lang.String name)

getPropertyNames

public final java.lang.String[] getPropertyNames()
Returns a list of this event's property names.

Returns:
A non-empty array with one element per property.

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Eclipse IAdaptable extension-point

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Parameters:
adapter -
Returns:
See Also:
IAdaptable.getAdapter(Class)

getTopic

public java.lang.String getTopic()
Get the collaboration topic used to distribute this event

Returns:
the collaboration topic name

getCollaborationID

public java.lang.String getCollaborationID()
Get the ID of the artifact that is the subject of collaboration

Returns:
unique ID of the collaboration artifact

setCollaborationID

public void setCollaborationID(java.lang.String id)
Set the ID of the artifact that is the subject of collaboration

Parameters:
id - unique identifier

addRemoteURI

public void addRemoteURI(java.lang.String uri)
Add a remote URI that this event should be routed to.


listRemoteURIs

public java.net.URI[] listRemoteURIs(java.lang.String uriScheme)
Get the list of remote URIs where the CollaborationEvent should be routed to.

Returns:
array of URIs

getContextURI

public java.lang.String getContextURI()
Description copied from interface: ICollaborationEvent
Get the URI that defines the context of this event. This is normally the URI of the context container that generated the event.

Specified by:
getContextURI in interface ICollaborationEvent
Returns:
See Also:
ICollaborationEvent.getContextURI()

getContextType

public java.lang.String getContextType()
Description copied from interface: ICollaborationEvent
Get the context type specifies the type of event. For example, 'project'.

Specified by:
getContextType in interface ICollaborationEvent
Returns:
See Also:
ICollaborationEvent.getContextType()

getContextName

public java.lang.String getContextName()
Specified by:
getContextName in interface ICollaborationEvent
Returns:
See Also:
ICollaborationEvent.getContextName()

getActionType

public java.lang.String getActionType()
Specified by:
getActionType in interface ICollaborationEvent

setActionType

public void setActionType(java.lang.String actionType)
Specified by:
setActionType in interface ICollaborationEvent

toString

public java.lang.String toString()
dump the contents of the event

Overrides:
toString in class java.lang.Object

Copyright 2006 IBM Corporation and others.
All Rights Reserved.