org.apache.muse.ws.resource.sg.impl
Class SimpleServiceGroup

java.lang.Object
  extended by org.apache.muse.core.AbstractCapability
      extended by org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
          extended by org.apache.muse.ws.resource.sg.impl.SimpleServiceGroup
All Implemented Interfaces:
Capability, Initialization, InitializationParameters, ResourceManagerListener, Shutdown, ServiceGroup, WsResourceCapability

public class SimpleServiceGroup
extends AbstractWsResourceCapability
implements ServiceGroup, ResourceManagerListener

SimpleServiceGroup is Muse's default implementation of the WS-RF ServiceGroup capability. It provides SOAP-level access to the entries it contains and lifecycle management for the Entry resources. Users that wish to make entry creation available to remote clients should combine this capability with the ServiceGroupRegistration capability.

Author:
Dan Jemiolo (danj)

Field Summary
 
Fields inherited from interface org.apache.muse.ws.resource.sg.ServiceGroup
PROPERTIES
 
Constructor Summary
SimpleServiceGroup()
           
 
Method Summary
 WsResource addEntry(EndpointReference memberEPR, Element content, Date termination)
          Creates a new Entry resource and adds it to Muse's ResourceManager and the ServiceGroup's WS-RP container.
 WsResource addEntry(EndpointReference memberEPR, WsResource entry)
          Adds the EPR/resource mapping to the implementation's collection of service group entries.
protected  WsResource createEntry(EndpointReference epr, Element content, Date termination)
           
protected  MembershipContentRule[] createMembershipContentRules()
          This implementation returns an empty array (no content rules, no restrictions on membership).
 void deleteProperty(QName property)
           
 QName[] getContentElements()
           
 WsResource[] getEntry()
           
 WsResource getEntry(EndpointReference memberEPR)
           
protected  String getEntryContextPath()
           
protected  Element[] getEntryElements()
           
 MembershipContentRule[] getMembershipContentRule()
           
 Element[] getProperty(QName property)
           
 QName[] getPropertyNames()
          Concrete capability classes that define properties MUST override this method and provide the names of the properties.
 void initialize()
          

AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties.
 void insertProperty(QName property, Element[] values)
           
 boolean isMatch(EndpointReference epr)
           
 void removeEntry(WsResource entry)
           
 void resourceAdded(EndpointReference epr, Resource resource)
           
 void resourceRemoved(EndpointReference epr)
           
 void setMembershipContentRule(MembershipContentRule[] mcr)
           
 void shutdown()
           
 void updateProperty(QName property, Element[] values)
           
 
Methods inherited from class org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
createGettersAndSetters, deleteProperty, getGetter, getPropertyElements, getSetter, getWsResource, insertProperty, invokeMethod, setResource, updateProperty
 
Methods inherited from class org.apache.muse.core.AbstractCapability
getActions, getCapabilityURI, getEnvironment, getInitializationParameter, getInitializationParameters, getLog, getMessageHandler, getPersistence, getResource, hasBeenInitialized, hasBeenShutdown, initializeCompleted, prepareShutdown, setCapabilityURI, setEnvironment, setInitializationParameters, setLog, setMessageHandler, setMessageHandlers, setPersistence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.muse.ws.resource.WsResourceCapability
getWsResource
 
Methods inherited from interface org.apache.muse.core.Capability
getActions, getCapabilityURI, getEnvironment, getLog, getMessageHandler, getPersistence, getResource, initializeCompleted, prepareShutdown, setCapabilityURI, setEnvironment, setLog, setMessageHandlers, setPersistence, setResource
 
Methods inherited from interface org.apache.muse.core.Initialization
hasBeenInitialized
 
Methods inherited from interface org.apache.muse.core.InitializationParameters
getInitializationParameter, getInitializationParameters, setInitializationParameters
 
Methods inherited from interface org.apache.muse.core.Shutdown
hasBeenShutdown
 

Constructor Detail

SimpleServiceGroup

public SimpleServiceGroup()
Method Detail

addEntry

public WsResource addEntry(EndpointReference memberEPR,
                           Element content,
                           Date termination)
                    throws AddRefusedFault,
                           BaseFault
Description copied from interface: ServiceGroup
Creates a new Entry resource and adds it to Muse's ResourceManager and the ServiceGroup's WS-RP container.

Specified by:
addEntry in interface ServiceGroup
Parameters:
memberEPR - The EPR of the resource that the Entry will represent.
termination - The initial termination time for the Entry. This may be null if the Entry is not scheduled for destruction.
Returns:
The newly-created (and stored) Entry resource.
Throws:
AddRefusedFault
BaseFault

addEntry

public WsResource addEntry(EndpointReference memberEPR,
                           WsResource entry)
Description copied from interface: ServiceGroup
Adds the EPR/resource mapping to the implementation's collection of service group entries.

Specified by:
addEntry in interface ServiceGroup
Parameters:
memberEPR - The EPR of the service group entry.
entry - The resource that represents the service group entry.
Returns:
The same resource provided as a second parameter.

createEntry

protected WsResource createEntry(EndpointReference epr,
                                 Element content,
                                 Date termination)
                          throws AddRefusedFault,
                                 ResourceInitializationFault,
                                 BaseFault
Throws:
AddRefusedFault
ResourceInitializationFault
BaseFault

createMembershipContentRules

protected MembershipContentRule[] createMembershipContentRules()
This implementation returns an empty array (no content rules, no restrictions on membership).


getContentElements

public QName[] getContentElements()
Specified by:
getContentElements in interface ServiceGroup
Returns:
All of the content elements in the group's membership content rules.

getEntry

public WsResource[] getEntry()
Specified by:
getEntry in interface ServiceGroup

getEntry

public WsResource getEntry(EndpointReference memberEPR)
Specified by:
getEntry in interface ServiceGroup
Returns:
The entry resource associated with the given EPR, or null if no such resource exists.

getEntryContextPath

protected String getEntryContextPath()

getEntryElements

protected Element[] getEntryElements()

getMembershipContentRule

public MembershipContentRule[] getMembershipContentRule()
Specified by:
getMembershipContentRule in interface ServiceGroup

getProperty

public Element[] getProperty(QName property)
                      throws BaseFault
Overrides:
getProperty in class AbstractWsResourceCapability
Throws:
BaseFault

getPropertyNames

public QName[] getPropertyNames()
Concrete capability classes that define properties MUST override this method and provide the names of the properties.

Overrides:
getPropertyNames in class AbstractWsResourceCapability
Returns:
The names of the resource properties defined by this capability.

initialize

public void initialize()
                throws SoapFault
Description copied from class: AbstractWsResourceCapability


AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties. It then registers itself with the resource's WSRP collection so that read and write requests for its properties are delegated to it.

Specified by:
initialize in interface Initialization
Overrides:
initialize in class AbstractWsResourceCapability
Throws:
SoapFault

isMatch

public boolean isMatch(EndpointReference epr)
Specified by:
isMatch in interface ServiceGroup
Parameters:
epr - The EPR for the resource against which all the service group's membership content rules should be evaluated.
Returns:
True if the given resource's WS-RP document matches all of the service group's membership rules and can be safely added to the service group.

removeEntry

public void removeEntry(WsResource entry)
Specified by:
removeEntry in interface ServiceGroup

resourceAdded

public void resourceAdded(EndpointReference epr,
                          Resource resource)
                   throws SoapFault
Specified by:
resourceAdded in interface ResourceManagerListener
Parameters:
epr - The unique EPR that is being associated with the new resource. This value should always be used over Resource.getEndpointReference() because some applications may choose to map multiple EPRs to the same resource instance, and thus getEndpointReference() will not provide an accurate value.
resource - The resource instance being associated with the given EPR.
Throws:
SoapFault

resourceRemoved

public void resourceRemoved(EndpointReference epr)
Specified by:
resourceRemoved in interface ResourceManagerListener
Parameters:
epr - The unique EPR of the resource that has been destroyed - the Resource object is not provided because it would most likely be in an inconsistent state. At this point, the resource has already been 'destroyed'.

setMembershipContentRule

public void setMembershipContentRule(MembershipContentRule[] mcr)
Specified by:
setMembershipContentRule in interface ServiceGroup

shutdown

public void shutdown()
              throws SoapFault
Specified by:
shutdown in interface Shutdown
Overrides:
shutdown in class AbstractCapability
Throws:
SoapFault

deleteProperty

public void deleteProperty(QName property)
                    throws BaseFault
Throws:
BaseFault

insertProperty

public void insertProperty(QName property,
                           Element[] values)
                    throws BaseFault
Throws:
BaseFault

updateProperty

public void updateProperty(QName property,
                           Element[] values)
                    throws BaseFault
Throws:
BaseFault


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.