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

com.sas.services.deployment
Class ServiceDeploymentImportFile

com.sas.services.deployment.ServiceDeploymentImportFile

public class ServiceDeploymentImportFile

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
ServiceDeploymentImportFile(java.io.File importFile)
          Constructs a representation of a foundation service deployment import file.
ServiceDeploymentImportFile(java.io.InputStream inputStream)
          Constructs a representation of a foundation service deployment import file by reading metadata from an input stream.
 
Method Summary
 void destroy()
          Destroys this instance.
 java.io.File getFile()
          Gets the file containing the foundation services deployment metadata that is to be imported into a SAS Metadata Repository.
 java.lang.String getMetadata()
          Gets the foundation services deployment metadata from the file.
 java.lang.String getServiceDeploymentName()
          Gets the name of the application's foundation services deployment.
static java.lang.String renameServiceDeployment(java.lang.String inputXML, java.lang.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.
 void setServiceDeploymentName(java.lang.String name)
          Sets the name of the application's foundation services deployment.
static ServiceException validateFile(java.io.File file)
          Determines whether or not the specified file contains a valid foundation services deployment.
 

Constructor Detail

ServiceDeploymentImportFile

public ServiceDeploymentImportFile(java.io.File importFile)
                            throws java.lang.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:
java.lang.IllegalArgumentException - if an invalid file is specified.

ServiceDeploymentImportFile

public ServiceDeploymentImportFile(java.io.InputStream inputStream)
                            throws java.lang.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:
java.lang.IllegalArgumentException - if unable to obtain foundation services metadata from the specified input stream.
Method Detail

getFile

public final java.io.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 java.lang.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 java.lang.String renameServiceDeployment(java.lang.String inputXML,
                                                             java.lang.String newServiceDeploymentName)
                                                      throws java.lang.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:
java.lang.IllegalArgumentException - if invalid XML or name is specified.
ServiceException - if an exception was encountered renaming the service deployment.

getServiceDeploymentName

public final java.lang.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(java.lang.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:
java.lang.IllegalArgumentException - if an invalid name is specified.

validateFile

public static final ServiceException validateFile(java.io.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.

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




Copyright © 2009 SAS Institute Inc. All Rights Reserved.