Class ProxyManagerService
- java.lang.Object
-
- org.neotropic.kuwaiba.core.configuration.proxies.ProxyManagerService
-
@Service public class ProxyManagerService extends Object
Service to manage proxies.- Author:
- Mauricio Ruiz <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ProxyManagerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
associateObjectToProxy(String objectClass, String objectId, String proxyClass, String proxyId, String userName)
Associates an inventory object to an inventory proxy.void
associateProjectToProxy(String projectClass, String projectId, String proxyClass, String proxyId, String userName)
Associates an project to an inventory proxy.String
createProxy(String proxyPoolId, String proxyClass, HashMap<String,String> attributes)
Creates an inventory proxy.String
createProxyPool(String name, String description)
Creates a proxy pool.void
deleteProxy(String proxyClass, String proxyId)
Deletes a proxy and delete its association with the related inventory objects.void
deleteProxyPool(String proxyPoolId)
Deletes a proxy pool.List<InventoryProxy>
getAllProxies()
Gets all the inventory proxies in the database.List<InventoryProxy>
getProxiesInPool(String proxyPoolId)
Gets the list of inventory proxies in a given pool.List<InventoryObjectPool>
getProxyPools()
Retrieves the list of pools of proxies.void
releaseObjectFromProxy(String objectClass, String objectId, String proxyClass, String proxyId, String userName)
Releases an inventory object from a proxy.void
releaseProjectFromProxy(String projectClass, String projectId, String proxyClass, String proxyId, String userName)
Releases a project from a proxy.void
updateProxy(String proxyClass, String proxyId, HashMap<String,String> attributes)
Updates one or many proxy attributes.void
updateProxyPool(String proxyPoolId, String attributeName, String attributeValue)
Updates an attribute of a proxy pool.
-
-
-
Method Detail
-
createProxy
public String createProxy(String proxyPoolId, String proxyClass, HashMap<String,String> attributes) throws ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Creates an inventory proxy. Inventory proxies are used to integrate third party-applications with Kuwaiba. Sometimes these applications must refer to assets managed by Kuwaiba from another perspective (financial, for example). In these applications, multiple Kuwaiba inventory assets might be represented by a single entity (e.g. a router with slots, boards and ports might just be something like "standard network device"). Proxies are used to map multiple inventory elements into a single entity. It's a sort of "impedance matching" between systems that refer to the same real world object from different perspectives.- Parameters:
proxyPoolId
- The parent pool id.proxyClass
- The proxy class. Must be subclass of GenericProxy.attributes
- The set of initial attributes. If no attribute name is specified, an empty string will be used.- Returns:
- The id of the newly created proxy.
- Throws:
ApplicationObjectNotFoundException
- If the parent pool could not be found.InvalidArgumentException
- If any of the initial attributes could not be mapped.MetadataObjectNotFoundException
- If the proxy class could not be found.
-
deleteProxy
public void deleteProxy(String proxyClass, String proxyId) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException
Deletes a proxy and delete its association with the related inventory objects. These objects will remain untouched.- Parameters:
proxyClass
- The class of the proxy.proxyId
- The id of the proxy- Throws:
ApplicationObjectNotFoundException
- If the proxy could not be found.MetadataObjectNotFoundException
- If the proxy class could not be found.
-
updateProxy
public void updateProxy(String proxyClass, String proxyId, HashMap<String,String> attributes) throws ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Updates one or many proxy attributes.- Parameters:
proxyId
- The parent pool id,proxyClass
- The class of the proxy.attributes
- The set of initial attributes. If no attribute name is specified, an empty string will be used.- Throws:
ApplicationObjectNotFoundException
- If the parent pool could not be found.InvalidArgumentException
- If any of the initial attributes could not be mapped.MetadataObjectNotFoundException
- If the proxy class could not be found.
-
createProxyPool
public String createProxyPool(String name, String description)
Creates a proxy pool.- Parameters:
name
- The name of the pool.description
- The description of the pool- Returns:
- The id of the newly created proxy.
-
updateProxyPool
public void updateProxyPool(String proxyPoolId, String attributeName, String attributeValue) throws ApplicationObjectNotFoundException, InvalidArgumentException
Updates an attribute of a proxy pool.- Parameters:
proxyPoolId
- The id of the pool to be updated.attributeName
- The name of the pool attribute to be updated. Valid values are "name" and "description"attributeValue
- The value of the attribute. Null values will be ignored.- Throws:
ApplicationObjectNotFoundException
- If the pool could not be found.InvalidArgumentException
- If an unknown attribute name is provided.
-
deleteProxyPool
public void deleteProxyPool(String proxyPoolId) throws ApplicationObjectNotFoundException
Deletes a proxy pool.- Parameters:
proxyPoolId
- The id of the pool.- Throws:
ApplicationObjectNotFoundException
- If the pool could not be found.
-
getProxyPools
public List<InventoryObjectPool> getProxyPools()
Retrieves the list of pools of proxies.- Returns:
- The available pools of inventory proxies.
-
getProxiesInPool
public List<InventoryProxy> getProxiesInPool(String proxyPoolId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Gets the list of inventory proxies in a given pool.- Parameters:
proxyPoolId
- The id of the parent pool.- Returns:
- The proxies
- Throws:
ApplicationObjectNotFoundException
- If the parent pool could not be found.InvalidArgumentException
- If the object in the database can not be mapped into an InvetoryProxy instance.
-
getAllProxies
public List<InventoryProxy> getAllProxies() throws InvalidArgumentException
Gets all the inventory proxies in the database.- Returns:
- The list of inventory proxy objects.
- Throws:
InvalidArgumentException
- If any proxy node could not be mapped into a Java object.
-
associateProjectToProxy
public void associateProjectToProxy(String projectClass, String projectId, String proxyClass, String proxyId, String userName) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Associates an project to an inventory proxy.- Parameters:
projectClass
- The class of the project.projectId
- The id of the project.proxyClass
- The class of the proxy.proxyId
- The id of the proxy.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If any of the objects can't be found.OperationNotPermittedException
- If any of the objects involved can't be connected (i.e. if it's not an inventory object).MetadataObjectNotFoundException
- If any of the classes provided can not be found.InvalidArgumentException
- If the a/bObjectId are null.ApplicationObjectNotFoundException
- If the object activity log could no be found.
-
associateObjectToProxy
public void associateObjectToProxy(String objectClass, String objectId, String proxyClass, String proxyId, String userName) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Associates an inventory object to an inventory proxy.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.proxyClass
- The class of the proxy.proxyId
- The id of the proxy.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If any of the objects can't be found.OperationNotPermittedException
- If any of the objects involved can't be connected (i.e. if it's not an inventory object).MetadataObjectNotFoundException
- If any of the classes provided can not be found.InvalidArgumentException
- If the a/bObjectId are null.ApplicationObjectNotFoundException
- If the object activity log could no be found.
-
releaseProjectFromProxy
public void releaseProjectFromProxy(String projectClass, String projectId, String proxyClass, String proxyId, String userName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Releases a project from a proxy.- Parameters:
proxyClass
- The class of the proxy.proxyId
- The id of the proxy.projectClass
- The class of the project.projectId
- The id of the project.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If the object can not be found.MetadataObjectNotFoundException
- If the class can not be found.InvalidArgumentException
- If serviceId or objectId are null.ApplicationObjectNotFoundException
- If the object activity log could no be found.
-
releaseObjectFromProxy
public void releaseObjectFromProxy(String objectClass, String objectId, String proxyClass, String proxyId, String userName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Releases an inventory object from a proxy.- Parameters:
proxyClass
- The class of the proxy.proxyId
- The id of the proxy.objectClass
- The class of the object.objectId
- The id of the object.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If the object can not be found.MetadataObjectNotFoundException
- If the class can not be found.InvalidArgumentException
- If serviceId or objectId are null.ApplicationObjectNotFoundException
- If the object activity log could no be found.
-
-