org.ogf.graap.wsag.server.persistence.impl
Class WSAG4JPersistenceFacade

java.lang.Object
  extended by org.ogf.graap.wsag.server.persistence.impl.WSAG4JPersistenceFacade
All Implemented Interfaces:
IEngineComponent, IAgreementFactoryHome

public class WSAG4JPersistenceFacade
extends Object
implements IAgreementFactoryHome

This class serves as a facade for multiple wsag4j engine instances that are deployed in a server. Since multiple multiple wsag4j engine instances can be deployed in a server this facade allows to list, save and remove agreement factories via the IAgreementFactoryHome interface as there would be only one engine instance.

Author:
owaeld

Field Summary
protected  List<PersistentAgreementFactory> factoriesOL
          An ordered list with the available agreement factories.
protected  Map<String,PersistentAgreementFactory> persistentFactories
          A map that contains the available persistent agreement factory which are identified by their factory id.
 
Constructor Summary
WSAG4JPersistenceFacade(WSAG4JEngineConfigurationType[] config)
          Creates a new facade for the given engine configurations.
 
Method Summary
 PersistentAgreementFactory find(String factoryId)
          looks up a factory with the given id.
 WSAG4JEngineConfigurationType getEngineConfiguration()
          returns the configuration of the wsag4j engine
 void initialize()
           
 PersistentAgreementFactory[] list()
          Lists all agreement factories.
 void remove(String factoryId)
          Removes the factory with the given ID.
 void save()
          Saves all factories.
 void saveAgreementFactories(PersistentAgreementFactory[] factories)
           
 void setEngineConfiguration(WSAG4JEngineConfigurationType configs)
          sets the configuration of the wsag4j engine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

persistentFactories

protected Map<String,PersistentAgreementFactory> persistentFactories
A map that contains the available persistent agreement factory which are identified by their factory id.


factoriesOL

protected List<PersistentAgreementFactory> factoriesOL
An ordered list with the available agreement factories. The factories are stored in the order they were retrieved from the persistence layer.

Constructor Detail

WSAG4JPersistenceFacade

public WSAG4JPersistenceFacade(WSAG4JEngineConfigurationType[] config)
Creates a new facade for the given engine configurations.

Parameters:
config - the configurations of the available WSAG4J engines
Method Detail

initialize

public void initialize()
Description copied from interface: IEngineComponent

Specified by:
initialize in interface IEngineComponent
See Also:
IEngineComponent.initialize()

find

public PersistentAgreementFactory find(String factoryId)
                                throws Exception
looks up a factory with the given id.

Specified by:
find in interface IAgreementFactoryHome
Parameters:
factoryId - the id of the factory to find
Returns:
the factory
Throws:
Exception - an error occurred while looking up the factory.
See Also:
IAgreementFactoryHome.find(String)

list

public PersistentAgreementFactory[] list()
                                  throws Exception
Description copied from interface: IAgreementFactoryHome
Lists all agreement factories.

Specified by:
list in interface IAgreementFactoryHome
Returns:
all available persistent factories
Throws:
Exception - indicates an error while generating the factory list
See Also:
IAgreementFactoryHome.list()

remove

public void remove(String factoryId)
            throws Exception
Description copied from interface: IAgreementFactoryHome
Removes the factory with the given ID.

Specified by:
remove in interface IAgreementFactoryHome
Parameters:
factoryId - removes the factory with the given id from the persistence layer
Throws:
Exception - an error occurred while removing the factory
See Also:
IAgreementFactoryHome.remove(java.lang.String)

save

public void save()
          throws Exception
Saves all factories.

Throws:
Exception - indicates an error while saving the factories

setEngineConfiguration

public void setEngineConfiguration(WSAG4JEngineConfigurationType configs)
Description copied from interface: IEngineComponent
sets the configuration of the wsag4j engine

Specified by:
setEngineConfiguration in interface IEngineComponent
Parameters:
configs - the engine configuration to set
See Also:
IEngineComponent.setEngineConfiguration(org.ogf.graap.wsag4j.types.configuration.WSAG4JEngineConfigurationType)

getEngineConfiguration

public WSAG4JEngineConfigurationType getEngineConfiguration()
Description copied from interface: IEngineComponent
returns the configuration of the wsag4j engine

Specified by:
getEngineConfiguration in interface IEngineComponent
Returns:
the engine configuration
See Also:
IEngineComponent.getEngineConfiguration()

saveAgreementFactories

public void saveAgreementFactories(PersistentAgreementFactory[] factories)
                            throws Exception
Specified by:
saveAgreementFactories in interface IAgreementFactoryHome
Parameters:
factories - the factories to save
Throws:
Exception - indicates an error while saving the factories
See Also:
IAgreementFactoryHome.saveAgreementFactories(org.ogf.graap.wsag.server.persistence.PersistentAgreementFactory[])


Copyright © 2008-2012 Fraunhofer Institute SCAI. All Rights Reserved.