org.wso2.carbon.governance.api.services

## Class ServiceManager

- java.lang.Object
- - org.wso2.carbon.governance.api.services.ServiceManager

-     public class ServiceManager
      extends Object

  This provides the management functionality for service artifacts stored on the registry.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `ServiceManager(org.wso2.carbon.registry.core.Registry registry)` Constructor accepting an instance of the registry to use.
    `protected` | `ServiceManager(org.wso2.carbon.registry.core.Registry registry, String mediaType)` Constructor accepting an instance of the registry, and also details on the type of manager.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addService(Service service)` Adds the given service artifact to the registry.
    `Service[]` | `findServices(ServiceFilter criteria)` Finds all service artifacts matching the given filter criteria.
    `String[]` | `getAllServiceIds()` Finds all identifiers of the service artifacts on the registry.
    `String[]` | `getAllServicePaths()` Finds all the service path and used to list services
    `Service[]` | `getAllServices()` Finds all service artifacts on the registry.
    `Service[]` | `getAllServicesByLifecycle(String lcName)` Retrieve all Services which associated with the given lifecycle
    `Service[]` | `getAllServicesByLifecycleStatus(String lcName, String lcState)` Retrieve all Services which associated with the given lifecycle in the given lifecycle state
    `Service` | `getService(String serviceId)` Fetches the given service artifact on the registry.
    `Service` | `newService(org.apache.axiom.om.OMElement content)` Creates a new service artifact from the given content.
    `Service` | `newService(QName qName)` Creates a new service artifact from the given qualified name.
    `void` | `removeService(String serviceId)` Removes the given service artifact from the registry.
    `void` | `updateService(Service service)` Updates the given service artifact on the registry.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ServiceManager

          public ServiceManager(org.wso2.carbon.registry.core.Registry registry)
                         throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Constructor accepting an instance of the registry to use.
      Parameters:
        `registry` - the instance of the registry.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### ServiceManager

          protected ServiceManager(org.wso2.carbon.registry.core.Registry registry,
                                   String mediaType)
                            throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Constructor accepting an instance of the registry, and also details on the type of manager.
      Parameters:
        `registry` - the instance of the registry.
        `mediaType` - the media type of resources being saved or fetched.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

  - ### Method Detail

    - #### newService

          public Service newService(QName qName)
                             throws GovernanceException

      Creates a new service artifact from the given qualified name.
      Parameters:
        `qName` - the qualified name of this service.
      Returns:
        the artifact added.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### newService

          public Service newService(org.apache.axiom.om.OMElement content)
                             throws GovernanceException

      Creates a new service artifact from the given content.
      Parameters:
        `content` - the service content.
      Returns:
        the artifact added.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### addService

          public void addService(Service service)
                          throws GovernanceException

      Adds the given service artifact to the registry. Please do not use this method to update an existing artifact use the update method instead. If this method is used to update an existing artifact, all existing properties (such as lifecycle details) will be removed from the existing artifact.
      Parameters:
        `service` - the service artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### updateService

          public void updateService(Service service)
                             throws GovernanceException

      Updates the given service artifact on the registry.
      Parameters:
        `service` - the service artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getService

          public Service getService(String serviceId)
                             throws GovernanceException

      Fetches the given service artifact on the registry.
      Parameters:
        `serviceId` - the identifier of the service artifact.
      Returns:
        the service artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### removeService

          public void removeService(String serviceId)
                             throws GovernanceException

      Removes the given service artifact from the registry.
      Parameters:
        `serviceId` - the identifier of the service artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### findServices

          public Service[] findServices(ServiceFilter criteria)
                                 throws GovernanceException

      Finds all service artifacts matching the given filter criteria.
      Parameters:
        `criteria` - the filter criteria to be matched.
      Returns:
        the service artifacts that match.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllServicePaths

          public String[] getAllServicePaths()
                                      throws GovernanceException

      Finds all the service path and used to list services
      Returns:
        all the service paths
      Throws:
        `GovernanceException` - if the operation failed

    - #### getAllServices

          public Service[] getAllServices()
                                   throws GovernanceException

      Finds all service artifacts on the registry.
      Returns:
        all service artifacts on the registry.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllServiceIds

          public String[] getAllServiceIds()
                                    throws GovernanceException

      Finds all identifiers of the service artifacts on the registry.
      Returns:
        an array of identifiers of the service artifacts.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllServicesByLifecycle

          public Service[] getAllServicesByLifecycle(String lcName)
                                              throws GovernanceException

      Retrieve all Services which associated with the given lifecycle
      Parameters:
        `lcName` - Name of the lifecycle
      Returns:
        Service array
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllServicesByLifecycleStatus

          public Service[] getAllServicesByLifecycleStatus(String lcName,
                                                           String lcState)
                                                    throws GovernanceException

      Retrieve all Services which associated with the given lifecycle in the given lifecycle state
      Parameters:
        `lcName` - Name of the lifecycle
        `lcState` - Name of the current lifecycle state
      Returns:
        Service array
      Throws:
        `GovernanceException` - if the operation failed.

Copyright © 2017 WSO2. All Rights Reserved.