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 Details

  • 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 id
      name - the (file) name
      uri - the URI the artifact was loaded from
      services - the contained services
      servers - the container servers
  • Method Details

    • getUsageCount

      public int getUsageCount()
      Description copied from interface: ArtifactDescriptor
      Returns the usage count.
      Specified by:
      getUsageCount in interface ArtifactDescriptor
      Returns:
      the usage count
    • increaseUsageCount

      public int increaseUsageCount()
      Description copied from interface: ArtifactDescriptor
      Increases the usage count and returns the new count. Without calling this method, the usage count of this instance is initially 0.
      Specified by:
      increaseUsageCount in interface ArtifactDescriptor
      Returns:
      the new value,
    • decreaseUsageCount

      public int decreaseUsageCount()
      Description copied from interface: ArtifactDescriptor
      Decreases the usage count and returns the new count.
      Specified by:
      decreaseUsageCount in interface ArtifactDescriptor
      Returns:
      the new value,
    • createMapping

      protected Map<String,S> createMapping(List<S> services)
      Creates a id-descriptor mapping for the given services.
      Parameters:
      services - the services
      Returns:
      the mapping
    • getId

      public String getId()
      Description copied from interface: ArtifactDescriptor
      Returns the unique id of the artifact.
      Specified by:
      getId in interface ArtifactDescriptor
      Returns:
      the artifact id
    • getName

      public String getName()
      Description copied from interface: ArtifactDescriptor
      Returns the name of the artifact.
      Specified by:
      getName in interface ArtifactDescriptor
      Returns:
      the name, may be the file name
    • getUri

      public URI getUri()
      Description copied from interface: ArtifactDescriptor
      Returns the canonical URI the artifact was loaded from.
      Specified by:
      getUri in interface ArtifactDescriptor
      Returns:
      the canonical URI
    • getServiceIds

      public Set<String> getServiceIds()
      Description copied from interface: ArtifactDescriptor
      Returns the ids of all services provided by the artifact.
      Specified by:
      getServiceIds in interface ArtifactDescriptor
      Returns:
      the ids
    • getServices

      public Collection<? extends S> getServices()
      Description copied from interface: ArtifactDescriptor
      Returns the services provided by the artifact independent of their state.
      Specified by:
      getServices in interface ArtifactDescriptor
      Returns:
      the service descriptors
    • getServers

      public Collection<? extends S> getServers()
      Description copied from interface: ArtifactDescriptor
      Returns the server specifications as services provided by the artifact.
      Specified by:
      getServers in interface ArtifactDescriptor
      Returns:
      the service descriptors
    • getService

      public S getService(String serviceId)
      Description copied from interface: ArtifactDescriptor
      Returns a service descriptor.
      Specified by:
      getService in interface ArtifactDescriptor
      Parameters:
      serviceId - the id of the service
      Returns:
      the related service descriptor or null if the service is not provided by this artifact
    • getServer

      public S getServer(String serverId)
      Description copied from interface: ArtifactDescriptor
      Returns a service descriptor for a server.
      Specified by:
      getServer in interface ArtifactDescriptor
      Parameters:
      serverId - the id of the server
      Returns:
      the related service descriptor or null if the server is not provided by this artifact
    • addService

      protected void addService(S service)
      Adds a service.
      Parameters:
      service - the service to be added