Class AbstractArtifactDescriptor<S extends AbstractServiceDescriptor<?>>
java.lang.Object
de.iip_ecosphere.platform.services.AbstractArtifactDescriptor<S>
- Type Parameters:
S- the service descriptor type
- All Implemented Interfaces:
ArtifactDescriptor
public class AbstractArtifactDescriptor<S extends AbstractServiceDescriptor<?>>
extends Object
implements ArtifactDescriptor
Basic re-usable implementation of
ArtifactDescriptor.- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddService(S service) Adds a service.createMapping(List<S> services) Creates a id-descriptor mapping for the givenservices.intDecreases the usage count and returns the new count.getId()Returns the unique id of the artifact.getName()Returns the name of the artifact.Returns a service descriptor for a server.Collection<? extends S> Returns the server specifications as services provided by the artifact.getService(String serviceId) Returns a service descriptor.Returns the ids of all services provided by the artifact.Collection<? extends S> Returns the services provided by the artifact independent of their state.getUri()Returns the canonical URI the artifact was loaded from.intReturns the usage count.intIncreases the usage count and returns the new count.
-
Field Details
-
id
-
name
-
uri
-
usageCount
private int usageCount -
services
-
servers
-
-
Constructor Details
-
AbstractArtifactDescriptor
protected AbstractArtifactDescriptor(String id, String name, URI uri, List<S> services, List<S> servers) Creates an artifact descriptor.- Parameters:
id- the artifact idname- the (file) nameuri- the URI the artifact was loaded fromservices- the contained servicesservers- the container servers
-
-
Method Details
-
getUsageCount
public int getUsageCount()Description copied from interface:ArtifactDescriptorReturns the usage count.- Specified by:
getUsageCountin interfaceArtifactDescriptor- Returns:
- the usage count
-
increaseUsageCount
public int increaseUsageCount()Description copied from interface:ArtifactDescriptorIncreases the usage count and returns the new count. Without calling this method, the usage count of this instance is initially0.- Specified by:
increaseUsageCountin interfaceArtifactDescriptor- Returns:
- the new value,
-
decreaseUsageCount
public int decreaseUsageCount()Description copied from interface:ArtifactDescriptorDecreases the usage count and returns the new count.- Specified by:
decreaseUsageCountin interfaceArtifactDescriptor- Returns:
- the new value,
-
createMapping
Creates a id-descriptor mapping for the givenservices.- Parameters:
services- the services- Returns:
- the mapping
-
getId
Description copied from interface:ArtifactDescriptorReturns the unique id of the artifact.- Specified by:
getIdin interfaceArtifactDescriptor- Returns:
- the artifact id
-
getName
Description copied from interface:ArtifactDescriptorReturns the name of the artifact.- Specified by:
getNamein interfaceArtifactDescriptor- Returns:
- the name, may be the file name
-
getUri
Description copied from interface:ArtifactDescriptorReturns the canonical URI the artifact was loaded from.- Specified by:
getUriin interfaceArtifactDescriptor- Returns:
- the canonical URI
-
getServiceIds
Description copied from interface:ArtifactDescriptorReturns the ids of all services provided by the artifact.- Specified by:
getServiceIdsin interfaceArtifactDescriptor- Returns:
- the ids
-
getServices
Description copied from interface:ArtifactDescriptorReturns the services provided by the artifact independent of their state.- Specified by:
getServicesin interfaceArtifactDescriptor- Returns:
- the service descriptors
-
getServers
Description copied from interface:ArtifactDescriptorReturns the server specifications as services provided by the artifact.- Specified by:
getServersin interfaceArtifactDescriptor- Returns:
- the service descriptors
-
getService
Description copied from interface:ArtifactDescriptorReturns a service descriptor.- Specified by:
getServicein interfaceArtifactDescriptor- Parameters:
serviceId- the id of the service- Returns:
- the related service descriptor or null if the service is not provided by this artifact
-
getServer
Description copied from interface:ArtifactDescriptorReturns a service descriptor for a server.- Specified by:
getServerin interfaceArtifactDescriptor- Parameters:
serverId- the id of the server- Returns:
- the related service descriptor or null if the server is not provided by this artifact
-
addService
Adds a service.- Parameters:
service- the service to be added
-