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

Package com.sas.services.deployment

# Class ServiceDeploymentDeleter

java.lang.Object
com.sas.services.deployment.ServiceDeploymentDeleter

@SASScope("ALL") @BinaryCompatibilityOnly public final class ServiceDeploymentDeleter extends Object
Utility used to delete a SAS Foundation Services deployment from a SAS Metadata Repository.

Usage Example: Delete SAS Foundation Services Deployment
     import com.sas.metadata.remote.SoftwareComponent;
     import com.sas.services.ServiceException;
     import com.sas.services.deployment.ServiceDeploymentDeleter;

     void deleteServiceDeployment (
        SoftwareComponent softwareComponent serviceDeployment)
        throws ServiceException {

        ServiceDeploymentDeleter deleter =
          new ServiceDeploymentDeleter(serviceDeployment);
        deleter.delete();

     }

Since:
  9.2

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServiceDeploymentDeleter(com.sas.metadata.remote.SoftwareComponent softwareComponent)`
  Constructs an instance of a utility that can be used to delete a SAS Foundation Services deployment.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `addDeletionTemplates(Map<String,String> deletionTemplateMap)`
  Adds deletion templates necessary to delete the following: service component named services localized resources properties (Property) property's stored configuration (TextStore)
  `void`
  `delete()`
  Delete this metadata `ServiceComponent` representing a foundation service.
  `static void`
  `deleteDeployment(String[] args)`
  Main method for an application which is used to delete a SAS Foundation Services deployment from a SAS Metadata Repository.
  `protected void`
  `deleteMetadataObjects(List<com.sas.metadata.remote.CMetadata> deletedObjects)`
  Deletes the metadata objects specified in the list.
  `protected static final void`
  `deleteProperties(com.sas.metadata.remote.Root root, List<com.sas.metadata.remote.CMetadata> deletedObjects)`
  Removes properties from the metadata object by collecting the Property, its owning PropertyType, and its stored configuration Text eligible for deletion.
  `protected static final void`
  `deleteProperty(com.sas.metadata.remote.Property property, List<com.sas.metadata.remote.CMetadata> deletedObjects)`
  Removes properties from the metadata object by collecting the Property, its owning PropertyType, and its stored configuration Text eligible for deletion.
  `static void`
  `deleteServiceDeployment(com.sas.metadata.remote.MdStore mdStore, String repositoryName, String serviceDeploymentName)`
  Deletes the SAS Foundation Services deployment from the metadata server.
  `static void`
  `deleteServiceDeploymentForID(com.sas.metadata.remote.MdStore mdStore, String repositoryName, String serviceDeploymentID)`
  Deletes the SAS Foundation Services deployment from the metadata server which matches the specified FQID (`SoftwareComponent.Id`).
  `protected static final String`
  `getDeleteTemplateDeployedComponent()`
  Gets a deletion template for a DeployedComponent.
  `protected static final String`
  `getDeleteTemplateEvent()`
  Gets a deletion template for an Event.
  `protected static final String`
  `getDeleteTemplateLocalizedResource()`
  Gets a deletion template for a localized resource.
  `protected static final String`
  `getDeleteTemplateNamedService()`
  Gets a deletion template for a named service.
  `protected static final String`
  `getDeleteTemplateProperty()`
  Gets a deletion template for a DeployedComponent.
  `protected static final String`
  `getDeleteTemplateTextStore()`
  Gets a deletion template for a DeployedComponent.
  `protected final com.sas.metadata.remote.Root`
  `getRoot()`
  Gets the metadata object which is to be deleted.
  `static void`
  `main(String[] args)`
  Main method for an application which is used to delete a SAS Foundation Services deployment from a SAS Metadata Repository.
  `protected void`
  `verifyIsOKToDelete()`
  Verify whether or not it is OK to delete the metadata object.

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

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

- ## Constructor Details

  - ### ServiceDeploymentDeleter

    public ServiceDeploymentDeleter(com.sas.metadata.remote.SoftwareComponent softwareComponent)
    Constructs an instance of a utility that can be used to delete a SAS Foundation Services deployment.
    Parameters:
      `softwareComponent` - The SAS Foundation Services deployment that is to be deleted.
    Throws:
      `IllegalArgumentException` - if an invalid service deployment is specified.
    Since:
      9.2

- ## Method Details

  - ### addDeletionTemplates

    protected void addDeletionTemplates(Map<String,String> deletionTemplateMap) throws ServiceException
    Adds deletion templates necessary to delete the following:
    - service component
    - named services
    - localized resources
    - properties (Property)
    - property's stored configuration (TextStore)
    Parameters:
      `deletionTemplateMap` - Map keyed by a deletion template to a deletion template.
    Throws:
      `ServiceException` - if an exception occurred while attempting to delete the foundation services deployment.

  - ### deleteMetadataObjects

    protected void deleteMetadataObjects(List<com.sas.metadata.remote.CMetadata> deletedObjects) throws ServiceException
    Deletes the metadata objects specified in the list. A sub-class should collect the necessary metadata objects which need to be deleted and then call this method to execute the deletion.
    Parameters:
      `deletedObjects` - Metadata objects to be deleted.
    Throws:
      `ServiceException` - if an exception occurred while attempting to delete the foundation services deployment.

  - ### main

    public static void main(String[] args)
    Main method for an application which is used to delete a SAS Foundation Services deployment from a SAS Metadata Repository.

    SAS Foundation Service Command Line Options
    SAS Foundation Services
    Option | Description
    --- | ---
    `-serviceDeploymentName` | Name of the SAS Foundation Services deployment (SoftwareComponent.Name) whose metadata is to be deleted from the SAS Metadata Server to a file
    `-serviceDeploymentID` | FQID of the SAS Foundation Services deployment (SoftwareComponent.Id) whose metadata is to be deleted from the SAS Metadata Server to a file

    ## Metadata Server

    One must specify the SAS Metadata Server and the desired connection approach.

    Parameters:
      `args` - Command line arguments specifying the metadata server, the name of the services deployment to be deleted.
      - -metaserver <server>
      - -metaport <port>
      - -metarepository <repository>
      - -serviceDeploymentID <serviceDeploymentID> | -serviceDeploymentName <serviceDeploymentName>
      - Connection
        - using a Login Credential
          - -metauser <userID>
          - -metapass <password> | -password_on_stdin true (and specify -metapass via stdin)
        - using SSPI
          - -secpackagelist <secpackagelist>
          - -metaspn <spn> (optional)

      One may optionally specify whether an option prompt is presented by specifying the command line option `-isPrompting <true|false>`

    Since:
      9.2

  - ### deleteDeployment

    public static void deleteDeployment(String[] args) throws ServiceException
    Main method for an application which is used to delete a SAS Foundation Services deployment from a SAS Metadata Repository.

    SAS Foundation Service Command Line Options
    SAS Foundation Services
    Option | Description
    --- | ---
    `-serviceDeploymentName` | Name of the SAS Foundation Services deployment (SoftwareComponent.Name) whose metadata is to be deleted from the SAS Metadata Server to a file
    `-serviceDeploymentID` | FQID of the SAS Foundation Services deployment (SoftwareComponent.Id) whose metadata is to be deleted from the SAS Metadata Server to a file

    ## Metadata Server

    One must specify the SAS Metadata Server and the desired connection approach.

    Parameters:
      `args` - Command line arguments specifying the metadata server and either the ID or name of the services deployment to be deleted.
      - -metaserver <server>
      - -metaport <port>
      - -metarepository <repository>
      - -serviceDeploymentName <serviceDeploymentID> | -serviceDeploymentName <serviceDeploymentName>
      - Connection
        - using a Login Credential
          - -metauser <userID>
          - -metapass <password> | -password_on_stdin true (and specify -metapass via stdin)
        - using SSPI
          - -secpackagelist <secpackagelist>
          - -metaspn <spn> (optional)

      One may optionally specify whether an option prompt is presented by specifying the command line option `-isPrompting <true|false>`

    Throws:
      `ServiceException` - if unable to delete the deployment.
    Since:
      9.2

  - ### deleteServiceDeployment

    public static void deleteServiceDeployment(com.sas.metadata.remote.MdStore mdStore, String repositoryName, String serviceDeploymentName) throws ServiceException
    Deletes the SAS Foundation Services deployment from the metadata server.
    Parameters:
      `mdStore` - Metadata store whose factory has a connection to the metadata server.
      `repositoryName` - The name of the metadata repository that contains the SAS Foundation Services deployment that is to be deleted.
      `serviceDeploymentName` - The name of the SAS Foundation Services deployment that is to be deleted from the SAS Metadata Server.
    Throws:
      `ServiceException` - if an exception is encountered.
    Since:
      9.2

  - ### deleteServiceDeploymentForID

    public static void deleteServiceDeploymentForID(com.sas.metadata.remote.MdStore mdStore, String repositoryName, String serviceDeploymentID) throws ServiceException
    Deletes the SAS Foundation Services deployment from the metadata server which matches the specified FQID (`SoftwareComponent.Id`).
    Parameters:
      `mdStore` - Metadata store whose factory has a connection to the metadata server.
      `repositoryName` - The name of the metadata repository that contains the SAS Foundation Services deployment that is to be deleted.
      `serviceDeploymentID` - The FQID (`SoftwareComponent.Id`) of the SAS Foundation Services deployment that is to be deleted from the SAS Metadata Server.
    Throws:
      `ServiceException` - if an exception is encountered.
    Since:
      9.3

  - ### getDeleteTemplateDeployedComponent

    protected static final String getDeleteTemplateDeployedComponent()
    Gets a deletion template for a DeployedComponent.
    Returns:
      Deletion template for a deployed component.

  - ### getDeleteTemplateEvent

    protected static final String getDeleteTemplateEvent()
    Gets a deletion template for an Event.
    Returns:
      Deletion template for an event.

  - ### getDeleteTemplateLocalizedResource

    protected static final String getDeleteTemplateLocalizedResource()
    Gets a deletion template for a localized resource.
    Returns:
      Deletion template for a localized resource.

  - ### getDeleteTemplateNamedService

    protected static final String getDeleteTemplateNamedService()
    Gets a deletion template for a named service.
    Returns:
      Deletion template for a named service.

  - ### getDeleteTemplateTextStore

    protected static final String getDeleteTemplateTextStore()
    Gets a deletion template for a DeployedComponent.
    Returns:
      Deletion template for a deployed component.

  - ### getDeleteTemplateProperty

    protected static final String getDeleteTemplateProperty()
    Gets a deletion template for a DeployedComponent.
    Returns:
      Deletion template for a deployed component.

  - ### delete

    public void delete() throws DependentServicesException, ServiceException
    Delete this metadata `ServiceComponent` representing a foundation service. Note that no other services must depend upon this service or else this deletion request will be rejected.
    Throws:
      `DependentServicesException` - if the request to delete the service was denied because another service depends upon the service being deleted.
      `ServiceException` - if unable to delete the service.

  - ### verifyIsOKToDelete

    protected void verifyIsOKToDelete() throws ServiceException
    Verify whether or not it is OK to delete the metadata object. A sub-class should override this method to provide necessary deletion verification logic.
    Throws:
      `ServiceException` - if it is not OK to delete the metadata object.

  - ### deleteProperties

    protected static final void deleteProperties(com.sas.metadata.remote.Root root, List<com.sas.metadata.remote.CMetadata> deletedObjects) throws com.sas.metadata.remote.MdException
    Removes properties from the metadata object by collecting the Property, its owning PropertyType, and its stored configuration Text eligible for deletion.
    Parameters:
      `root` - The metadata object whose properties are to be cleared.
      `deletedObjects` - List of `CMetadata` objects which are to be deleted. This list will be updated with objects which should be deleted.
    Throws:
      `com.sas.metadata.remote.MdException` - if unable to determine which objects need to be deleted.

  - ### deleteProperty

    protected static final void deleteProperty(com.sas.metadata.remote.Property property, List<com.sas.metadata.remote.CMetadata> deletedObjects) throws com.sas.metadata.remote.MdException
    Removes properties from the metadata object by collecting the Property, its owning PropertyType, and its stored configuration Text eligible for deletion.
    Parameters:
      `property` - A metadata property which is to be deleted.
      `deletedObjects` - List of `CMetadata` objects which are to be deleted. This list will be updated with objects which should be deleted.
    Throws:
      `com.sas.metadata.remote.MdException` - if unable to determine which objects need to be deleted.

  - ### getRoot

    protected final com.sas.metadata.remote.Root getRoot()
    Gets the metadata object which is to be deleted.
    Returns:
      Metadata object.