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

Package com.sas.services.deployment

# Class ServiceDeploymentImportFile

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

@SASScope("ALL") @BinaryCompatibilityOnly public class ServiceDeploymentImportFile extends Object
This class represents a foundation services deployment file that was `exported` from a SAS Metadata foundation repository. The Foundation Services Manager plug-in to the SAS Management Console provides the capability to export a services deployment.

The services deployment file is a UTF-8 encoded XML that contains SAS metadata describing an application's foundation services deployment. This file may be later `imported` into a SAS Metadata Repository.

The name of the service deployment may be changed by designating a new name using `setServiceDeploymentName(String name)`. This capability can be used to rename a foundation services deployment (SoftwareComponent.Name) that is being imported into a SAS Metadata repository.

Usage Example: Create a file that can be imported
     import java.io.File;

     ...

     // specify the file containing the foundation services deployment
     // metadata created using the Foundation Services Manager plug-in
     // and the fully qualified SAS Metadata Repository ID.
     ServiceDeploymentImportFile serviceDeploymentImportFile =
       new ServiceDeploymentImportFile(new File(filePath));

     // rename the foundation services deployment (i.e. the SoftwareComponent.Name)
     // if desired
     String newName = "My Services Deployment";
     serviceDeploymentImportFile.setServiceDeploymentName(newName);

     // use the service deployment import file to import
     // the deployment into a SAS Metadata Repository using
     // the ServiceDeploymentImporter
     ...

Since:
  1.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServiceDeploymentImportFile(File importFile)`
  Constructs a representation of a foundation service deployment import file.
  `ServiceDeploymentImportFile(InputStream inputStream)`
  Constructs a representation of a foundation service deployment import file by reading metadata from an input stream.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `destroy()`
  Destroys this instance.
  `final File`
  `getFile()`
  Gets the file containing the foundation services deployment metadata that is to be imported into a SAS Metadata Repository.
  `final String`
  `getMetadata()`
  Gets the foundation services deployment metadata from the file.
  `final String`
  `getServiceDeploymentName()`
  Gets the name of the application's foundation services deployment.
  `static final String`
  `renameServiceDeployment(String inputXML, String newServiceDeploymentName)`
  Takes a string representing an application's foundation services deployment metadata and updates the name of the `SoftwareComponent` to the newly specified name.
  `final void`
  `setServiceDeploymentName(String name)`
  Sets the name of the application's foundation services deployment.
  `static final ServiceException`
  `validateFile(File file)`
  Determines whether or not the specified file contains a valid foundation services deployment.

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

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

- ## Constructor Details

  - ### ServiceDeploymentImportFile

    public ServiceDeploymentImportFile(File importFile) throws IllegalArgumentException
    Constructs a representation of a foundation service deployment import file.
    Parameters:
      `importFile` - File containing a foundation service deployment that can be imported into a SAS Metadata Repository.
    Throws:
      `IllegalArgumentException` - if an invalid file is specified.

  - ### ServiceDeploymentImportFile

    public ServiceDeploymentImportFile(InputStream inputStream) throws IllegalArgumentException
    Constructs a representation of a foundation service deployment import file by reading metadata from an input stream.
    Parameters:
      `inputStream` - Input stream from which foundation service deployment metadata is to be read for import into a SAS Metadata Repository. The input stream will be closed once its been read.
    Throws:
      `IllegalArgumentException` - if unable to obtain foundation services metadata from the specified input stream.

- ## Method Details

  - ### getFile

    public final File getFile()
    Gets the file containing the foundation services deployment metadata that is to be imported into a SAS Metadata Repository.
    Returns:
      File containing a foundation services deployment exported from a SAS Metadata Repository using the Foundation Services Manager plug-in.

  - ### destroy

    public void destroy()
    Destroys this instance. If a temporary file has been created it will be deleted. Once this method has been called this instance should not be used anymore.

  - ### getMetadata

    public final String getMetadata() throws ServiceDeploymentImportException
    Gets the foundation services deployment metadata from the file.
    Returns:
      Foundation services deployment metadata read from the file or `null` if no data was defined.
    Throws:
      `ServiceDeploymentImportException` - if unable to read an application's foundation services deployment metadata from the specified XML formatted import file.

  - ### renameServiceDeployment

    public static final String renameServiceDeployment(String inputXML, String newServiceDeploymentName) throws IllegalArgumentException, ServiceException
    Takes a string representing an application's foundation services deployment metadata and updates the name of the `SoftwareComponent` to the newly specified name.
    Parameters:
      `inputXML` - XML representing a foundation services deployment.
      `newServiceDeploymentName` - The new name for the foundation services deployment. The name must be no more than 60 characters long.
    Returns:
      XML representing the foundation services deployment that has been updated to use the new service deployment name.
    Throws:
      `IllegalArgumentException` - if invalid XML or name is specified.
      `ServiceException` - if an exception was encountered renaming the service deployment.

  - ### getServiceDeploymentName

    public final String getServiceDeploymentName()
    Gets the name of the application's foundation services deployment.
    Returns:
      The application's foundation services deployment name or `null` if one is not defined. The name is obtained from the `SoftwareComponent.Name` attribute.

  - ### setServiceDeploymentName

    public final void setServiceDeploymentName(String name)
    Sets the name of the application's foundation services deployment.

    This method updates an in-memory copy of the metadata read from the file and can be used to change the name of the deployment that is to be imported into a SAS Metadata Repository.

    Parameters:
      `name` - The application's foundation services deployment name.
    Throws:
      `IllegalArgumentException` - if an invalid name is specified.

  - ### validateFile

    public static final ServiceException validateFile(File file)
    Determines whether or not the specified file contains a valid foundation services deployment.
    Parameters:
      `file` - File to validate. A valid file is one that was created by the Foundation Services Manager.
    Returns:
      ServiceException if the file is invalid.