lumis.portal.serviceinstance
Class ServiceInstanceManager

Package class diagram package ServiceInstanceManager
java.lang.Object
  extended by lumis.portal.serviceinstance.ServiceInstanceManager
All Implemented Interfaces:
IConfigDeleter, IConfigKeyChecker, IServiceInstanceManager, IServiceInstanceManagerSPI

public class ServiceInstanceManager
extends Object
implements IServiceInstanceManagerSPI

Service instance manager implementation.

Since:
4.0.0

Constructor Summary
ServiceInstanceManager()
           
 
Method Summary
 String add(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstanceConfig, boolean fromDeserialization, ITransaction transaction)
           
 String add(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstanceConfig, ITransaction transaction)
          Add a service instance.
 void addOrUpdate(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstanceConfig, boolean fromDeserialization, ITransaction transaction)
           
 void addOrUpdate(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstanceConfig, ITransaction transaction)
          Add or Update a Service Instance, depending on its previous existence.
 void clearServiceInstanceCache(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Remove the object cache entries for the specificed Service Instance also clearing it's ACL cache.
 void clearServiceInstanceMemoryCache(String serviceInstanceId, ITransaction transaction)
          Clears the service instance information cached in this manager.
 void delete(SessionConfig sessionConfig, String serviceInstanceId, boolean force, ITransaction transaction)
          Delete a service instance.
 void deleteConfig(DeserializationContext deserializationContext, String configId)
           
 void deleteCustomProperties(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Deletes all service instance´s custom properties
 void deleteCustomProperty(SessionConfig sessionConfig, String serviceInstanceId, String name, ITransaction transaction)
          Deletes a service instance custom property
 String deserialize(SessionConfig sessionConfig, DeserializationConfig deserializationConfig, Node serviceInstanceNode, ITransaction transaction)
           
 void deserializeCustomProperties(SessionConfig sessionConfig, DeserializationConfig deserializationConfig, Node serviceInstanceCustomPropertiesNode, ITransaction transaction)
          Deprecated. 
 String deserializeDependency(SessionConfig sessionConfig, DeserializationConfig deserializationConfig, Node serviceInstanceDependencyNode, ITransaction transaction)
          Deserializes the given dependency
 boolean existsRestShortName(String restShortName, String serviceInstanceIdToIgnore, ITransaction transaction)
          Verify if a given name exists.
 ServiceInstanceConfig findServiceInstanceThroughChannelTree(SessionConfig sessionConfig, String channelId, String serviceId, ITransaction transaction)
          Searches for a service instance
 ServiceInstanceConfig get(String serviceInstanceId, ITransaction transaction)
          Get the configuration of the service instance.
 ServiceInstanceConfig getByRestShortName(String restShortName, ITransaction transaction)
          Get the service's instance by rest short name.
 Map<String,String> getCustomProperties(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Gets all the custom properties of a specified service instance.
 String getCustomProperty(SessionConfig sessionConfig, String serviceInstanceId, String name, ITransaction transaction)
          Returns the specified custom property.
 ServiceInstanceDependencyConfig getDependency(String serviceInstanceDependencyId, ITransaction transaction)
           
 Collection<String> getDependencyIdsByServiceInstanceId(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Returns the service instance ids that the given service instance id depends on
 Collection<String> getDependentServiceInstanceIds(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
           
 Collection<ServiceInstanceConfig> getDependentServiceInstances(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction)
          Returns the service instances that are dependent on the specified service instance.
 Collection<FileTransformation> getFileTransformations(String serviceInstanceId)
          Gets all fileTransformations using an serviceInstance´s id..
 Collection<String> getIds(SessionConfig sessionConfig, ITransaction transaction)
          Get the ids of all services instances
 Collection<String> getIdsByChannelId(SessionConfig sessionConfig, String channelId, ITransaction transaction)
          Get the ids of the services instances by passing the channel id.
 Collection<String> getIdsByChannelTree(SessionConfig sessionConfig, String rootChannelId, ITransaction transaction)
          Get the ids of the services instances of all the channel tree by passing the tree's root channel id.
 Collection<String> getIdsByServiceId(SessionConfig sessionConfig, String serviceId, ITransaction transaction)
          Get the ids of the services instances by passing the service id.
 ServiceInstanceConfig getServiceInstanceByDependency(SessionConfig sessionConfig, String serviceInstanceId, String dependencyType, ITransaction transaction)
          Get the service instance the given service instance depends on by the given dependency type.
 Collection<ServiceInstanceConfig> getServiceInstancesByDependency(SessionConfig sessionConfig, String serviceInstanceId, String dependencyType, ITransaction transaction)
          Returns the service instances the given service instance depends on by the given dependency type.
 boolean keyExists(SessionConfig sessionConfig, Object configKey, Object config, ITransaction transaction)
          Checks if configId matches an already persisted object
 void serialize(SessionConfig sessionConfig, String serviceInstanceId, OutputStream outputStream, ITransaction transaction)
           
 void serializeCustomProperties(SessionConfig sessionConfig, String serviceInstanceId, OutputStream outputStream, ITransaction transaction)
          Serializes the custom properties of a service instance into the specified outputstream.
 void serializeDependencies(SessionConfig sessionConfig, String serviceInstanceId, OutputStream outputStream, ITransaction transaction)
          Serializes the dependencies of a service instance
 void serializeFileTransformations(SessionConfig sessionConfig, String serviceInstanceId, OutputStream outputStream, ITransaction transaction)
          serialize a fileTransformation to be used in a new channel created from channel template.
 void setCustomProperties(SessionConfig sessionConfig, String serviceInstanceId, Map<String,String> propertiesTable, ITransaction transaction)
           
 void setCustomProperty(SessionConfig sessionConfig, String serviceInstanceId, String name, String value, ITransaction transaction)
          Set a custom property for the given service instance.
 void setServiceInstanceDependency(ServiceInstanceDependencyConfig serviceInstanceDependencyConfig, ITransaction transaction)
          Sets the given service instance dependency.
 void update(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstanceConfig, ITransaction transaction)
          Update a service instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceInstanceManager

public ServiceInstanceManager()
Method Detail

addOrUpdate

public void addOrUpdate(SessionConfig sessionConfig,
                        ServiceInstanceConfig serviceInstanceConfig,
                        ITransaction transaction)
                 throws ManagerException,
                        PortalException
Description copied from interface: IServiceInstanceManager
Add or Update a Service Instance, depending on its previous existence.

Specified by:
addOrUpdate in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

get

public ServiceInstanceConfig get(String serviceInstanceId,
                                 ITransaction transaction)
                          throws PortalException
Description copied from interface: IServiceInstanceManager
Get the configuration of the service instance.

Specified by:
get in interface IServiceInstanceManager
Returns:
a ServiceInstanceConfig.
Throws:
ManagerException
PortalException

existsRestShortName

public boolean existsRestShortName(String restShortName,
                                   String serviceInstanceIdToIgnore,
                                   ITransaction transaction)
                            throws PortalException
Description copied from interface: IServiceInstanceManagerSPI
Verify if a given name exists.

Specified by:
existsRestShortName in interface IServiceInstanceManagerSPI
Parameters:
restShortName - rest short name of the service instance.
serviceInstanceIdToIgnore - service instance id that will not include on the search.
transaction - transaction used to perform the query.
Returns:
true if the name exists otherwise false.
Throws:
PortalException - if any other error occurs during the process.

getByRestShortName

public ServiceInstanceConfig getByRestShortName(String restShortName,
                                                ITransaction transaction)
                                         throws PortalException
Description copied from interface: IServiceInstanceManagerSPI
Get the service's instance by rest short name.

Specified by:
getByRestShortName in interface IServiceInstanceManagerSPI
Parameters:
restShortName - rest short name of the service instance.
transaction - transaction used to perform the query.
Returns:
the serviceInstanceConfig that represents the service instance.
Throws:
PortalException - if any other error occurs during the process.

getDependency

public ServiceInstanceDependencyConfig getDependency(String serviceInstanceDependencyId,
                                                     ITransaction transaction)
                                              throws PortalException
Specified by:
getDependency in interface IServiceInstanceManager
Throws:
PortalException

findServiceInstanceThroughChannelTree

public ServiceInstanceConfig findServiceInstanceThroughChannelTree(SessionConfig sessionConfig,
                                                                   String channelId,
                                                                   String serviceId,
                                                                   ITransaction transaction)
                                                            throws PortalException
Description copied from interface: IServiceInstanceManager
Searches for a service instance

Specified by:
findServiceInstanceThroughChannelTree in interface IServiceInstanceManager
Returns:
Throws:
PortalException

add

public String add(SessionConfig sessionConfig,
                  ServiceInstanceConfig serviceInstanceConfig,
                  ITransaction transaction)
           throws PortalException
Description copied from interface: IServiceInstanceManager
Add a service instance. The isInstantiable attribute of the associated serviceConfig is simply an informative attribute. This is used by the front end. However if one calls the ServiceManager.add method the isInstantiable attribute will be ignored.

Specified by:
add in interface IServiceInstanceManager
Returns:
a String.
Throws:
ManagerException
PortalException

update

public void update(SessionConfig sessionConfig,
                   ServiceInstanceConfig serviceInstanceConfig,
                   ITransaction transaction)
            throws PortalException
Description copied from interface: IServiceInstanceManager
Update a service instance.

Specified by:
update in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

delete

public void delete(SessionConfig sessionConfig,
                   String serviceInstanceId,
                   boolean force,
                   ITransaction transaction)
            throws PortalException
Description copied from interface: IServiceInstanceManager
Delete a service instance.

Specified by:
delete in interface IServiceInstanceManager
force - TODO
Throws:
ManagerException
PortalException

getIds

public Collection<String> getIds(SessionConfig sessionConfig,
                                 ITransaction transaction)
                          throws PortalException
Description copied from interface: IServiceInstanceManager
Get the ids of all services instances

Specified by:
getIds in interface IServiceInstanceManager
Returns:
a array of Strings.
Throws:
ManagerException
PortalException

getIdsByChannelId

public Collection<String> getIdsByChannelId(SessionConfig sessionConfig,
                                            String channelId,
                                            ITransaction transaction)
                                     throws PortalException
Description copied from interface: IServiceInstanceManager
Get the ids of the services instances by passing the channel id.

Specified by:
getIdsByChannelId in interface IServiceInstanceManager
Returns:
a array of Strings.
Throws:
ManagerException
PortalException

getIdsByChannelTree

public Collection<String> getIdsByChannelTree(SessionConfig sessionConfig,
                                              String rootChannelId,
                                              ITransaction transaction)
                                       throws PortalException
Description copied from interface: IServiceInstanceManager
Get the ids of the services instances of all the channel tree by passing the tree's root channel id.

Specified by:
getIdsByChannelTree in interface IServiceInstanceManager
Returns:
a array of Strings.
Throws:
ManagerException
PortalException

getIdsByServiceId

public Collection<String> getIdsByServiceId(SessionConfig sessionConfig,
                                            String serviceId,
                                            ITransaction transaction)
                                     throws PortalException
Description copied from interface: IServiceInstanceManager
Get the ids of the services instances by passing the service id.

Specified by:
getIdsByServiceId in interface IServiceInstanceManager
Returns:
a array of Strings.
Throws:
ManagerException
PortalException

getCustomProperty

public String getCustomProperty(SessionConfig sessionConfig,
                                String serviceInstanceId,
                                String name,
                                ITransaction transaction)
                         throws PortalException
Description copied from interface: IServiceInstanceManager
Returns the specified custom property. If the property has not been set earlier, null is returned.

Specified by:
getCustomProperty in interface IServiceInstanceManager
Returns:
a String.
Throws:
ManagerException
PortalException

setCustomProperty

public void setCustomProperty(SessionConfig sessionConfig,
                              String serviceInstanceId,
                              String name,
                              String value,
                              ITransaction transaction)
                       throws PortalException
Description copied from interface: IServiceInstanceManager
Set a custom property for the given service instance. If the property has been previously set, this method replaces the previous value, else a new property is created for the service instance.

Specified by:
setCustomProperty in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

setCustomProperties

public void setCustomProperties(SessionConfig sessionConfig,
                                String serviceInstanceId,
                                Map<String,String> propertiesTable,
                                ITransaction transaction)
                         throws ManagerException,
                                PortalException
Specified by:
setCustomProperties in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

deleteCustomProperty

public void deleteCustomProperty(SessionConfig sessionConfig,
                                 String serviceInstanceId,
                                 String name,
                                 ITransaction transaction)
                          throws PortalException
Description copied from interface: IServiceInstanceManager
Deletes a service instance custom property

Specified by:
deleteCustomProperty in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

deleteCustomProperties

public void deleteCustomProperties(SessionConfig sessionConfig,
                                   String serviceInstanceId,
                                   ITransaction transaction)
                            throws PortalException
Description copied from interface: IServiceInstanceManager
Deletes all service instance´s custom properties

Specified by:
deleteCustomProperties in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

serialize

public void serialize(SessionConfig sessionConfig,
                      String serviceInstanceId,
                      OutputStream outputStream,
                      ITransaction transaction)
               throws PortalException
Specified by:
serialize in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

deserialize

public String deserialize(SessionConfig sessionConfig,
                          DeserializationConfig deserializationConfig,
                          Node serviceInstanceNode,
                          ITransaction transaction)
                   throws PortalException
Specified by:
deserialize in interface IServiceInstanceManager
Returns:
Returns a String.
Throws:
ManagerException
PortalException

getServiceInstanceByDependency

public ServiceInstanceConfig getServiceInstanceByDependency(SessionConfig sessionConfig,
                                                            String serviceInstanceId,
                                                            String dependencyType,
                                                            ITransaction transaction)
                                                     throws ManagerException,
                                                            PortalException
Description copied from interface: IServiceInstanceManager
Get the service instance the given service instance depends on by the given dependency type.

If the service instance depends on multiple service instances, any may be returned. Use IServiceInstanceManager.getServiceInstancesByDependency(SessionConfig, String, String, ITransaction) to get all of them.

Specified by:
getServiceInstanceByDependency in interface IServiceInstanceManager
Parameters:
sessionConfig - current session information
serviceInstanceId - the id of the service instance that depends on the returned service instance.
dependencyType - the type of dependency.
transaction - the transaction for persistence access.
Returns:
the service instance the given service instance depends on, or null if none was found.
Throws:
PortalException
ManagerException
See Also:
#getServiceInstancesByDependency(SessionConfig, String, String, ITransaction)}

getServiceInstancesByDependency

public Collection<ServiceInstanceConfig> getServiceInstancesByDependency(SessionConfig sessionConfig,
                                                                         String serviceInstanceId,
                                                                         String dependencyType,
                                                                         ITransaction transaction)
                                                                  throws ManagerException,
                                                                         PortalException
Description copied from interface: IServiceInstanceManager
Returns the service instances the given service instance depends on by the given dependency type.

Specified by:
getServiceInstancesByDependency in interface IServiceInstanceManager
Parameters:
sessionConfig - current session information
serviceInstanceId - the id of the service instance that depends on the returned service instances.
dependencyType - the type of dependency.
transaction - the transaction for persistence access.
Returns:
the service instances the given service instance depends on, or an empty collection if none was found.
Throws:
PortalException - if the service instances could not be obtained.
ManagerException
See Also:
IServiceInstanceManager.getServiceInstanceByDependency(SessionConfig, String, String, ITransaction)

setServiceInstanceDependency

public void setServiceInstanceDependency(ServiceInstanceDependencyConfig serviceInstanceDependencyConfig,
                                         ITransaction transaction)
                                  throws PortalException
Description copied from interface: IServiceInstanceManager
Sets the given service instance dependency. Any existing dependency from the same service instance of the same type is removed.

Specified by:
setServiceInstanceDependency in interface IServiceInstanceManager
Parameters:
serviceInstanceDependencyConfig - the information about the dependency to be set.
transaction - the transaction for persistence access.
Throws:
PortalException

serializeDependencies

public void serializeDependencies(SessionConfig sessionConfig,
                                  String serviceInstanceId,
                                  OutputStream outputStream,
                                  ITransaction transaction)
                           throws PortalException
Description copied from interface: IServiceInstanceManager
Serializes the dependencies of a service instance

Specified by:
serializeDependencies in interface IServiceInstanceManager
Throws:
PortalException

getDependencyIdsByServiceInstanceId

public Collection<String> getDependencyIdsByServiceInstanceId(SessionConfig sessionConfig,
                                                              String serviceInstanceId,
                                                              ITransaction transaction)
                                                       throws ManagerException,
                                                              PortalException
Description copied from interface: IServiceInstanceManager
Returns the service instance ids that the given service instance id depends on

Specified by:
getDependencyIdsByServiceInstanceId in interface IServiceInstanceManager
Returns:
Throws:
ManagerException
PortalException

getDependentServiceInstanceIds

public Collection<String> getDependentServiceInstanceIds(SessionConfig sessionConfig,
                                                         String serviceInstanceId,
                                                         ITransaction transaction)
                                                  throws PortalException
Specified by:
getDependentServiceInstanceIds in interface IServiceInstanceManager
Throws:
PortalException

getDependentServiceInstances

public Collection<ServiceInstanceConfig> getDependentServiceInstances(SessionConfig sessionConfig,
                                                                      String serviceInstanceId,
                                                                      ITransaction transaction)
                                                               throws PortalException
Description copied from interface: IServiceInstanceManager
Returns the service instances that are dependent on the specified service instance.

Specified by:
getDependentServiceInstances in interface IServiceInstanceManager
Parameters:
sessionConfig - the user session information.
serviceInstanceId - the id of the service instance the returned service instances depend on.
transaction - the transaction for persistence access.
Returns:
a collection with the service instances found.
Throws:
PortalException

deserializeDependency

public String deserializeDependency(SessionConfig sessionConfig,
                                    DeserializationConfig deserializationConfig,
                                    Node serviceInstanceDependencyNode,
                                    ITransaction transaction)
                             throws PortalException
Description copied from interface: IServiceInstanceManager
Deserializes the given dependency

Specified by:
deserializeDependency in interface IServiceInstanceManager
Returns:
Throws:
PortalException

getCustomProperties

public Map<String,String> getCustomProperties(SessionConfig sessionConfig,
                                              String serviceInstanceId,
                                              ITransaction transaction)
                                       throws ManagerException,
                                              PortalException
Description copied from interface: IServiceInstanceManager
Gets all the custom properties of a specified service instance. The method will return a Hashmap containing all properties names and values of a service instance by it's serviceInstanceId.

Specified by:
getCustomProperties in interface IServiceInstanceManager
Returns:
Throws:
ManagerException
PortalException

getFileTransformations

public Collection<FileTransformation> getFileTransformations(String serviceInstanceId)
                                                      throws PortalException
Gets all fileTransformations using an serviceInstance´s id..

Parameters:
serviceInstanceId - serviceInstance´s id.
Returns:
Returns a list that contains fileTrasnformations or an empety list.
Throws:
PortalException - if an error occurs during the process.
Since:
6.2.0

serializeCustomProperties

public void serializeCustomProperties(SessionConfig sessionConfig,
                                      String serviceInstanceId,
                                      OutputStream outputStream,
                                      ITransaction transaction)
                               throws ManagerException,
                                      PortalException
Description copied from interface: IServiceInstanceManager
Serializes the custom properties of a service instance into the specified outputstream.

Specified by:
serializeCustomProperties in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

deserializeCustomProperties

@Deprecated
public void deserializeCustomProperties(SessionConfig sessionConfig,
                                                   DeserializationConfig deserializationConfig,
                                                   Node serviceInstanceCustomPropertiesNode,
                                                   ITransaction transaction)
                                 throws ManagerException,
                                        PortalException
Deprecated. 

Description copied from interface: IServiceInstanceManager
Deserialize custom properties from a XML node into a service instance. The properties name and values will be read from the serviceInstanceCustomPropertiesNode and will follow the constraints stored on the DeserializationConfig. The expected scheme of the serviceInstanceCustomPropertiesNode is the same used by the {@link serializeCustomProperties) method.

Specified by:
deserializeCustomProperties in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

addOrUpdate

public void addOrUpdate(SessionConfig sessionConfig,
                        ServiceInstanceConfig serviceInstanceConfig,
                        boolean fromDeserialization,
                        ITransaction transaction)
                 throws ManagerException,
                        PortalException
Specified by:
addOrUpdate in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

add

public String add(SessionConfig sessionConfig,
                  ServiceInstanceConfig serviceInstanceConfig,
                  boolean fromDeserialization,
                  ITransaction transaction)
           throws PortalException
Specified by:
add in interface IServiceInstanceManager
Throws:
PortalException

clearServiceInstanceCache

public void clearServiceInstanceCache(SessionConfig sessionConfig,
                                      String serviceInstanceId,
                                      ITransaction transaction)
                               throws ManagerException,
                                      PortalException
Description copied from interface: IServiceInstanceManager
Remove the object cache entries for the specificed Service Instance also clearing it's ACL cache.

Specified by:
clearServiceInstanceCache in interface IServiceInstanceManager
Throws:
ManagerException
PortalException

clearServiceInstanceMemoryCache

public void clearServiceInstanceMemoryCache(String serviceInstanceId,
                                            ITransaction transaction)
                                     throws PortalException
Clears the service instance information cached in this manager. Currently this is an internal method used by ChannelManager.

Parameters:
serviceInstanceId - the service instance identifier.
transaction - the transaction for persistence access.
Throws:
PortalException
Since:
4.1.0

deleteConfig

public void deleteConfig(DeserializationContext deserializationContext,
                         String configId)
                  throws PortalException
Specified by:
deleteConfig in interface IConfigDeleter
Throws:
PortalException

keyExists

public boolean keyExists(SessionConfig sessionConfig,
                         Object configKey,
                         Object config,
                         ITransaction transaction)
Description copied from interface: IConfigKeyChecker
Checks if configId matches an already persisted object

Specified by:
keyExists in interface IConfigKeyChecker
config - Optional, allows a checker to read aditional fields to check composed keys
Returns:
true if configId matches an already persisted object

serializeFileTransformations

public void serializeFileTransformations(SessionConfig sessionConfig,
                                         String serviceInstanceId,
                                         OutputStream outputStream,
                                         ITransaction transaction)
                                  throws ManagerException,
                                         PortalException
Description copied from interface: IServiceInstanceManagerSPI
serialize a fileTransformation to be used in a new channel created from channel template.

Specified by:
serializeFileTransformations in interface IServiceInstanceManagerSPI
Parameters:
sessionConfig - user session information.
serviceInstanceId - new serviceInstance´s id
outputStream - the outputstream to serialize the data to.
transaction - transaction used to perform the query.
Throws:
ManagerException - if an error occurs during the process
PortalException - if an error occurs during the process


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.