### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.deployment

# Class ServiceDeployment

java.lang.Object
com.sas.services.deployment.AbstractServiceDeployment
com.sas.services.deployment.ServiceDeployment

@SASScope("ALL") @BinaryCompatibilityOnly public final class ServiceDeployment extends AbstractServiceDeployment
Utilities to manipulate a foundation services deployment.

- Application configurations for a service
  - install
  - uninstall
  - determine if a configuration is installed
- Services deployment inspection
  - get the deployment's service components
  - get the service that implements a specified interface
  - rename a service configuration consumer

Since:
  9.2
See Also:
  - `ServiceDeploymentDeleter`
  - `ServiceDeploymentExporter`
  - `ServiceDeploymentImporter`
  - `ServiceConfigInstaller`
  - `ServiceConfigUninstaller`
  - `ServiceConsumerUtil`
  - `ServiceDeployments`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServiceDeployment(com.sas.metadata.remote.SoftwareComponent softwareComponent)`
  Constructs a representation of a foundation services deployment.
  `ServiceDeployment(String repositoryName, String softwareComponentName, com.sas.metadata.remote.MdStore mdStore)`
  Constructs a representation of a foundation services deployment.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `exportServiceConfiguration(File file, com.sas.metadata.remote.ServiceComponent serviceComponent, boolean isExportingBaseConfig, List<String> appConfigNames)`
  Exports the specified configurations for a service to a UTF-8 encoded XML file.
  `void`
  `exportServiceConfigurations(File exportDirectory)`
  Exports each consumer's service configuration to a UTF-8 encoded XML file.
  `void`
  `exportServiceConfigurations(File exportDirectory, File propertiesFile)`
  Exports each consumer's service configuration to a UTF-8 encoded XML file.
  `com.sas.metadata.remote.ServiceComponent`
  `getServiceComponent(String serviceInterfaceClassName)`
  Gets the metadata object which represents the foundation service that implements the specified interface.
  `com.sas.metadata.remote.ServiceComponent`
  `getServiceComponent(String serviceGroupName, String serviceName)`
  Gets the services which are defined in the deployment.
  `Set<com.sas.metadata.remote.ServiceComponent>`
  `getServiceComponents()`
  Gets the services which are defined in the deployment.
  `static List<com.sas.metadata.remote.Property>`
  `getServiceConfigProperties(com.sas.metadata.remote.ServiceComponent serviceComponent)`
  Gets the service component's property that represents the service's configuration data.
  `com.sas.metadata.remote.Property`
  `installServiceConfig(String configName, String configDesc, File configFile, String serviceInterfaceClassName)`
  Adds an application configuration to the foundation service that implements the specified interface.
  `com.sas.metadata.remote.Property`
  `installServiceConfiguration(ServiceProfile serviceProfile, com.sas.metadata.remote.ServiceComponent serviceComponent, AbstractServiceComponentConfig newConfig, MergePolicy mergePolicy)`
  Merges a configuration into the service's specified configuration.
  `com.sas.metadata.remote.Property`
  `installServiceConfiguration(String configName, String configDesc, File configFile, com.sas.metadata.remote.ServiceComponent serviceComponent)`
  Adds an application configuration to the foundation service that represented by the specified metadata `service component`.
  `boolean`
  `installServiceConfiguration(String configName, String configDesc, File configFile, String serviceInterfaceClassName)`
  Adds an application configuration to the foundation service that implements the specified interface.
  `com.sas.metadata.remote.Property`
  `installServiceConfigurationUsingPolicy(String configName, File configFile, com.sas.metadata.remote.ServiceComponent serviceComponent, MergePolicy mergePolicy)`
  Adds an application configuration to the foundation service that represented by the specified metadata `service component`.
  `boolean`
  `isAccessibleToRemoteClients()`
  Determines whether the services deployment contains at least one service which is configured to be accessed by a client in a remote JVM.
  `boolean`
  `isConfigInstalled(String configName, com.sas.metadata.remote.ServiceComponent serviceComponent)`
  Determines whether or not the service has a configuration for the specified name.
  `boolean`
  `isConfigInstalled(String configName, String serviceInterfaceClassName)`
  Determines whether or not the deployment contains a service that implements the specified interface has a configuration for the specified name.
  `void`
  `mergeServiceConfiguration(File configFile, com.sas.metadata.remote.ServiceComponent serviceComponent, com.sas.metadata.remote.Property property)`
  Merges a configuration into the service's specified configuration.
  `Set<com.sas.metadata.remote.ServiceComponent>`
  `renameConsumer(String oldConsumerName, String newConsumerName)`
  Renames the service configuration consumer.
  `void`
  `uninstallServiceConfiguration(com.sas.metadata.remote.ServiceComponent serviceComponent, AbstractServiceComponentConfig serviceConfig, String configName)`
  Deletes the specified application configuration from the foundation service that implements the specified interface.
  `void`
  `uninstallServiceConfiguration(com.sas.metadata.remote.ServiceComponent serviceComponent, AbstractServiceComponentConfig serviceConfig, String consumerName, boolean isRemoveUnusedResources)`
  Deletes the specified application configuration from the foundation service that implements the specified interface.
  `void`
  `uninstallServiceConfiguration(AbstractServiceComponentConfig serviceConfig, String configName, String serviceInterfaceClassName, boolean isRemoveUnusedResources)`
  Deletes the specified application configuration from the foundation service that implements the specified interface.

  ### Methods inherited from class com.sas.services.deployment.AbstractServiceDeployment

  `getSearchOptions, getServiceFactory, getSoftwareComponentName, getXMLSelectProperty`

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

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

- ## Constructor Details

  - ### ServiceDeployment

    public ServiceDeployment(com.sas.metadata.remote.SoftwareComponent softwareComponent) throws ServiceException, RemoteException
    Constructs a representation of a foundation services deployment.
    Parameters:
      `softwareComponent` - SoftwareComponent which represents a foundation services deployment.
    Throws:
      `ServiceException` - if unable to query the service deployment metadata.
      `RemoteException` - if a remote object failure occurs.
    Since:
      9.2

  - ### ServiceDeployment

    public ServiceDeployment(String repositoryName, String softwareComponentName, com.sas.metadata.remote.MdStore mdStore) throws ServiceException
    Constructs a representation of a foundation services deployment.
    Parameters:
      `repositoryName` - Name of the metadata repository which contains the foundation services deployment.
      `softwareComponentName` - Name of the `SoftwareComponent` which represents a foundation services deployment.
      `mdStore` - Metadata store.
    Throws:
      `ServiceException` - if unable to query the service deployment metadata.
    Since:
      9.2

- ## Method Details

  - ### getServiceComponents

    public Set<com.sas.metadata.remote.ServiceComponent> getServiceComponents()
    Gets the services which are defined in the deployment.
    Returns:
      Collection of `ServiceComponent` metadata objects representing the services which are defined in the deployment. An empty collection will be returned if no services are defined. The collection will be non-`null`.
    Since:
      9.2

  - ### getServiceComponent

    public com.sas.metadata.remote.ServiceComponent getServiceComponent(String serviceGroupName, String serviceName) throws ServiceException
    Gets the services which are defined in the deployment.
    Parameters:
      `serviceGroupName` - Name of the group (`Tree.Name`) that contains the desired service.
      `serviceName` - Name of the desired service (`ServiceComponent.Name`) which is a member of the specified group in this services deployment.
    Returns:
      `ServiceComponent` metadata object representing the service for the specified service and group name or `null` if the specified service is not defined.
    Throws:
      `ServiceException` - if an error is encountered.
    Since:
      9.2

  - ### isAccessibleToRemoteClients

    public boolean isAccessibleToRemoteClients() throws ServiceException
    Determines whether the services deployment contains at least one service which is configured to be accessed by a client in a remote JVM.
    Returns:
      `true` if the services deployment contains at least one service which is intended to be accessed by a client in a remote JVM.
    Throws:
      `ServiceException` - if unable to determine if the services deployment contains services which are accessible by remote clients.
    Since:
      9.1.3

  - ### getServiceComponent

    public com.sas.metadata.remote.ServiceComponent getServiceComponent(String serviceInterfaceClassName) throws ServiceException
    Gets the metadata object which represents the foundation service that implements the specified interface.
    Parameters:
      `serviceInterfaceClassName` - The primary interface implemented by a foundation service.

      Service | Primary Service Interface
      --- | ---
      Authentication | com.sas.services.security.AuthenticationServiceInterface
      Discovery | com.sas.services.discovery.DiscoveryServiceInterface
      Information | com.sas.services.information.InformationServiceInterface
      Session | com.sas.services.session.SessionServiceInterface
      Stored Process | com.sas.services.storedprocess.StoredProcessServiceInterface
      User | com.sas.services.user.UserServiceInterface

    Returns:
      The metadata object which represents the foundation service that implements the specified interface or `null` if the deployment does not contain a service that implements the specified interface.
    Throws:
      `ServiceException` - if unable to determine if the service deployment contains a service that implements the specified service interface.
    Since:
      9.1.3

  - ### exportServiceConfiguration

    public void exportServiceConfiguration(File file, com.sas.metadata.remote.ServiceComponent serviceComponent, boolean isExportingBaseConfig, List<String> appConfigNames) throws ServiceException
    Exports the specified configurations for a service to a UTF-8 encoded XML file.
    Parameters:
      `file` - Destination file to which an aggregation of the specified service configurations will be written as a UTF-8 encoded file.
      `serviceComponent` - The service component whose specified configuration(s) are to be exported to a service configuration file.
      `isExportingBaseConfig` - `true` if the base service configuration should be exported. Specify `false` you only want to export a particular application configuration.
      `appConfigNames` - A list of 0..* application configuration names. Each list element must be of type `String` representing the name of an application configuration which should be exported. Only specify one name if exporting a configuration for one application and do not include the base configuration.
    Throws:
      `ServiceException` - if unable to export the service's configuration.
    Since:
      9.2

  - ### installServiceConfiguration

    public com.sas.metadata.remote.Property installServiceConfiguration(String configName, String configDesc, File configFile, com.sas.metadata.remote.ServiceComponent serviceComponent) throws ServiceException
    Adds an application configuration to the foundation service that represented by the specified metadata `service component`.

    Use this method if you know the service component whose configuration is to be updated. One must use this method if the services deployment contains more than one service that implements the service interface to designate the appropriate service.

    Parameters:
      `configName` - The name of the application which consumes the configuration that is being installed (e.g. "Information Delivery Portal").
      `configDesc` - The description parameter is not used.
      `configFile` - The file that contains a foundation services configuration which is to be added to the service definition.
      `serviceComponent` - The service component.
    Returns:
      Property representing the installed service configuration or `null` if the configuration was not installed.
    Throws:
      `ServiceException` - if unable to install the specified service configuration.
    Since:
      9.2
    See Also:
      - `installServiceConfig(String, String, File, String)`

  - ### installServiceConfigurationUsingPolicy

    public com.sas.metadata.remote.Property installServiceConfigurationUsingPolicy(String configName, File configFile, com.sas.metadata.remote.ServiceComponent serviceComponent, MergePolicy mergePolicy) throws ServiceException
    Adds an application configuration to the foundation service that represented by the specified metadata `service component`.

    Use this method if you know the service component whose configuration is to be updated. One must use this method if the services deployment contains more than one service that implements the service interface to designate the appropriate service.

    Parameters:
      `configName` - The name of the application which consumes the configuration that is being installed (e.g. "Information Delivery Portal").
      `configFile` - The file that contains a foundation services configuration which is to be added to the service definition.
      `serviceComponent` - The service component.
      `mergePolicy` - Policy which specifies how conflicts are handled when installing a configuration.
    Returns:
      Property representing the installed service configuration or `null` if the configuration was not installed.
    Throws:
      `ServiceException` - if unable to install the specified service configuration.
    Since:
      9.2
    See Also:
      - `installServiceConfig(String, String, File, String)`

  - ### installServiceConfiguration

    public boolean installServiceConfiguration(String configName, String configDesc, File configFile, String serviceInterfaceClassName) throws ServiceException
    Adds an application configuration to the foundation service that implements the specified interface.
    Specified by:
      `installServiceConfiguration` in class `AbstractServiceDeployment`
    Parameters:
      `configName` - The unique name for the application configuration (e.g. "Information Delivery Portal").
      `configDesc` - An optional description for the application configuration.
      `configFile` - The file that contains a foundation services configuration which is to be added to the service definition.
      `serviceInterfaceClassName` - The fully-qualified Java class name for the primary interface implemented by the service whose configuration is to be updated (e.g. "com.sas.services.user.UserServiceInterface").
    Returns:
      `true` if the service configuration was installed.
    Throws:
      `ServiceException` - if unable to install the configuration into the service.
    Since:
      9.2

  - ### installServiceConfig

    public com.sas.metadata.remote.Property installServiceConfig(String configName, String configDesc, File configFile, String serviceInterfaceClassName) throws ServiceException
    Adds an application configuration to the foundation service that implements the specified interface.
    Parameters:
      `configName` - The unique name for the application configuration (e.g. "Information Delivery Portal").
      `configDesc` - An optional description for the application configuration.
      `configFile` - The file that contains a foundation services configuration which is to be added to the service definition.
      `serviceInterfaceClassName` - The fully-qualified Java class name for the primary interface implemented by the service whose configuration is to be updated (e.g. "com.sas.services.user.UserServiceInterface").
    Returns:
      Service configuration property or `null`.
    Throws:
      `ServiceException` - if unable to install the specified service configuration.
    Since:
      9.2

  - ### isConfigInstalled

    public boolean isConfigInstalled(String configName, String serviceInterfaceClassName) throws ServiceException
    Determines whether or not the deployment contains a service that implements the specified interface has a configuration for the specified name.
    Parameters:
      `configName` - Name of a layered service configuration.
      `serviceInterfaceClassName` - The fully-qualified name of the service's primary interface.
    Returns:
      `true` if the named service configuration is installed.
    Throws:
      `ServiceException` - if unable to determine if the service has the specified named configuration.
    Since:
      9.2

  - ### isConfigInstalled

    public boolean isConfigInstalled(String configName, com.sas.metadata.remote.ServiceComponent serviceComponent) throws ServiceException
    Determines whether or not the service has a configuration for the specified name.
    Parameters:
      `configName` - Name of the desired configuration.
      `serviceComponent` - The service component to check for the specified configuration.
    Returns:
      `true` if the named service configuration is installed.
    Throws:
      `ServiceException` - if unable to determine if the service has the specified configuration.
    Since:
      9.2

  - ### mergeServiceConfiguration

    public void mergeServiceConfiguration(File configFile, com.sas.metadata.remote.ServiceComponent serviceComponent, com.sas.metadata.remote.Property property) throws ServiceException
    Merges a configuration into the service's specified configuration.
    Parameters:
      `configFile` - The file that contains a foundation services configuration which is to be added to the service definition.
      `serviceComponent` - The service component.
      `property` - The property representing the service configuration into which the configuration to be read from the file is to be merged.
    Throws:
      `ServiceException` - if unable to merge the specified service configuration.
    Since:
      9.1.3

  - ### installServiceConfiguration

    public com.sas.metadata.remote.Property installServiceConfiguration(ServiceProfile serviceProfile, com.sas.metadata.remote.ServiceComponent serviceComponent, AbstractServiceComponentConfig newConfig, MergePolicy mergePolicy) throws ServiceException
    Merges a configuration into the service's specified configuration.
    Parameters:
      `serviceProfile` - Service's profile.
      `serviceComponent` - The service component.
      `newConfig` - The service configuration which is to be installed into the service's configuration property.
      `mergePolicy` - Policy which specifies how conflicts are handled when installing a configuration.
    Returns:
      The Property whose TextStore was updated or `null`.
    Throws:
      `ServiceException` - if unable to merge the specified service configuration.
      `IllegalArgumentException` - if an invalid parameter is specified.
    Since:
      9.2

  - ### renameConsumer

    public Set<com.sas.metadata.remote.ServiceComponent> renameConsumer(String oldConsumerName, String newConsumerName) throws ServiceException
    Renames the service configuration consumer.
    Parameters:
      `oldConsumerName` - The name of the service configuration consumer which is to be renamed.
      `newConsumerName` - The new name of the service configuration consumer.
    Returns:
      The SAS Foundation Services which contained a `Consumer` which was renamed.
    Throws:
      `ServiceException` - if unable to rename the service configuration consumer.
    Since:
      9.2M3

  - ### getServiceConfigProperties

    public static List<com.sas.metadata.remote.Property> getServiceConfigProperties(com.sas.metadata.remote.ServiceComponent serviceComponent) throws ServiceException
    Gets the service component's property that represents the service's configuration data.
    Parameters:
      `serviceComponent` - Service component whose configuration properties are desired.
    Returns:
      List of of `Property` objects representing the service component's service's configuration or an empty list if undefined. The first property in the list corresponds to the service's configuration. Additional properties, if defined, correspond to v913 layered service configurations.
    Throws:
      `ServiceException` - if unable to query the service component's properties.

  - ### uninstallServiceConfiguration

    public void uninstallServiceConfiguration(AbstractServiceComponentConfig serviceConfig, String configName, String serviceInterfaceClassName, boolean isRemoveUnusedResources) throws ServiceException
    Deletes the specified application configuration from the foundation service that implements the specified interface.
    Parameters:
      `serviceConfig` - The service configuration from which the application's configuration should be uninstalled.
      `configName` - The name of the application configuration that is to be deleted (e.g. "Information Delivery Portal").
      `serviceInterfaceClassName` - The fully-qualified Java class name for the primary interface implemented by the service whose configuration is to be updated (e.g. "com.sas.services.user.UserServiceInterface").
      `isRemoveUnusedResources` - `true` service configuration resources should be removed if they are no longer used by any consumers.
    Throws:
      `ServiceException` - if unable to uninstall the specified service configuration.
    Since:
      9.2

  - ### uninstallServiceConfiguration

    public void uninstallServiceConfiguration(com.sas.metadata.remote.ServiceComponent serviceComponent, AbstractServiceComponentConfig serviceConfig, String configName) throws ServiceException
    Deletes the specified application configuration from the foundation service that implements the specified interface.

    Use `uninstallServiceConfiguration(ServiceComponent, AbstractServiceComponentConfig, String, boolean)` if you would like to remove service configuration resources if they are no longer used by any consumers.

    Parameters:
      `serviceComponent` - The metadata object that represents the SAS Foundation Service from which a layered service configuration is to be uninstalled.
      `serviceConfig` - Service configuration.
      `configName` - The name of the application configuration that is to be deleted (e.g. "Information Delivery Portal").
    Throws:
      `ServiceException` - if unable to uninstall the specified service configuration.
    Since:
      9.2
    See Also:
      - `uninstallServiceConfiguration(ServiceComponent, AbstractServiceComponentConfig, String, boolean)`

  - ### uninstallServiceConfiguration

    public void uninstallServiceConfiguration(com.sas.metadata.remote.ServiceComponent serviceComponent, AbstractServiceComponentConfig serviceConfig, String consumerName, boolean isRemoveUnusedResources) throws ServiceException
    Deletes the specified application configuration from the foundation service that implements the specified interface.

    The caller is responsible for persisting the updates to the metadata server.

    Parameters:
      `serviceComponent` - The metadata object that represents the SAS Foundation Service from which a layered service configuration is to be uninstalled.
      `serviceConfig` - Service configuration.
      `consumerName` - The name of the consumer whose configuration is to be removed (e.g. "Information Delivery Portal").
      `isRemoveUnusedResources` - `true` service configuration resources should be removed if they are no longer used by any consumers.
    Throws:
      `ServiceException` - if unable to uninstall the specified service configuration.
    Since:
      9.2

  - ### exportServiceConfigurations

    public void exportServiceConfigurations(File exportDirectory) throws IllegalArgumentException, ServiceException, RemoteException, com.sas.metadata.remote.MdException
    Exports each consumer's service configuration to a UTF-8 encoded XML file.
    Parameters:
      `exportDirectory` - Directory to which the service configuration files will be exported.
    Throws:
      `ServiceException`
      `IllegalArgumentException`
      `com.sas.metadata.remote.MdException`
      `RemoteException`

  - ### exportServiceConfigurations

    public void exportServiceConfigurations(File exportDirectory, File propertiesFile) throws IllegalArgumentException, ServiceException, RemoteException, com.sas.metadata.remote.MdException
    Exports each consumer's service configuration to a UTF-8 encoded XML file.
    Parameters:
      `exportDirectory` - Directory to which the service configuration files will be exported.
      `propertiesFile` - Properties file.
    Throws:
      `ServiceException`
      `IllegalArgumentException`
      `com.sas.metadata.remote.MdException`
      `RemoteException`