com.ibm.rational.rpe.api.docspec
Class DocumentSpecificationBuilder

java.lang.Object
  extended by com.ibm.rational.rpe.api.docspec.DocumentSpecificationBuilder

public class DocumentSpecificationBuilder
extends java.lang.Object

Utility class for constructing and altering Document Specifications and Document Templates.


Field Summary
static java.lang.String DSX_EXTENSION
           
 
Constructor Summary
DocumentSpecificationBuilder()
           
 
Method Summary
 RPEOutput addOutput(RPEDocumentSpecification docspec, java.lang.String type, java.lang.String driver)
          Adds the specified output type to the document specification.
 RPEDocumentSpecification create(java.lang.String configFile)
          Creates an empty Document Specification.
 RPEDocumentSpecification create(java.lang.String configFile, java.util.List<java.lang.String> templatesFile)
          Creates a new Document Specification using a list of Document Templates.
 RPETemplate createRuntimeTemplate(java.lang.String configFile, com.ibm.rational.rpe.common.template.model.Template template, java.lang.String path, Credential credential)
           
 Feature getConfigurationForDatasource(java.lang.String configPath, java.lang.String type)
          Builds the configuration feature for the given data source type.
 com.ibm.rational.rpe.common.utils.IURIResolver getURIResolver()
           
 com.ibm.rational.rpe.api.docspec.RPEConfiguration load(java.lang.String configPath)
          Loads a configuration file.
 RPEDocumentSpecification load(java.lang.String configPath, java.lang.String docSpecPath)
          Loads a Document Specification from the specified path.
 RPEDocumentSpecification load(java.lang.String configPath, java.lang.String docSpecPath, boolean strict)
           
 RPEDocumentSpecification load(java.lang.String configPath, java.lang.String docSpecPath, java.lang.String srcDocSpecPath, boolean strict)
           
 RPETemplate loadTemplate(java.lang.String configFile, java.lang.String templPath)
           
 RPETemplate loadTemplate(java.lang.String configFile, java.lang.String baseURI, java.lang.String templateURI, Credential credential)
          Loads a Document Template from the given path.
 RPEDocumentSpecification makeDocSpec(java.lang.String defFile)
          Creates a Document Specification from a definition file.
 java.io.File packDocumentSpecification(RPEDocumentSpecification docSpec, boolean includeDynamicReferences, java.lang.String docSpecName)
          Creates a zip archive with the Document Specification, the Document Templates it refers and all the stylesheets used.
 RPETemplate replaceTemplate(RPEDocumentSpecification docSpec, RPETemplate oldTemplate, java.lang.String newTemplatePath, Credential credential, java.lang.String configFile)
          For a given Document Specification, this method replaces an existing Document Template with a new one.
 RPETemplate replaceTemplate(RPEDocumentSpecification docSpec, java.lang.String oldTemplatePath, java.lang.String newTemplatePath, Credential credential, java.lang.String configFile)
           
 RPETemplate replaceTemplate(RPEDocumentSpecification docSpec, java.lang.String oldTemplatePath, java.lang.String newTemplatePath, java.lang.String configFile)
          For a given Document Specification, this method replaces an existing Document Template with a new one.
 void save(RPEDocumentSpecification docSpec, java.lang.String fileName)
          Saves a Document Specification to a file.
 void setURIResolver(com.ibm.rational.rpe.common.utils.IURIResolver uriResolver)
           
 void stripCredentials(RPEDocumentSpecification docSpec)
          For the given Document Specification, this method removes any usernames or passwords it contains for templates, stylesheets and data sources.
 void syncDocumentSpecification(RPEDocumentSpecification docSpec, java.lang.String configFile)
          Synchronizes a Document Specification with its Document Templates by adding/removing Data Sources and Variables
 void syncDocumentSpecification(RPEDocumentSpecification docSpec, java.lang.String configFile, boolean strict)
           
 RPEDocumentSpecification unpackDocumentSpecification(java.net.URI file)
          Builds a Document Specification from the provided file.
 void updateProperties(com.ibm.rational.rpe.api.docspec.RPEDocumentElement docSpecElement, com.ibm.rational.rpe.api.docspec.RPEDocumentElement templateElement, java.util.List<java.lang.String> properties)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DSX_EXTENSION

public static final java.lang.String DSX_EXTENSION
See Also:
Constant Field Values
Constructor Detail

DocumentSpecificationBuilder

public DocumentSpecificationBuilder()
Method Detail

packDocumentSpecification

public java.io.File packDocumentSpecification(RPEDocumentSpecification docSpec,
                                              boolean includeDynamicReferences,
                                              java.lang.String docSpecName)
                                       throws RPEException
Creates a zip archive with the Document Specification, the Document Templates it refers and all the stylesheets used.

Parameters:
docSpec- - the Document Specification
includeDynamicReferences - - if true all dynamically referenced templates will be downloaded and included in the archive
docSpecName - - the name to use for the new docspec. if null a name will be generated bases on the current name of the docspec. If the archive is created for an RPE 1.2 WebService the name must be docSpec.dsx This parameter will be deprecated.
Returns:
the File object representation of the archive created from the Document Specification resources
Throws:
RPEException

unpackDocumentSpecification

public RPEDocumentSpecification unpackDocumentSpecification(java.net.URI file)
                                                     throws RPEException
Builds a Document Specification from the provided file.

Parameters:
file - this parameter is an URI which can represent:
  • a Document Specification
  • a zip file containing a Document Specification and related files
  • a zip file containing a definitions file
Returns:
a Document Specification object
Throws:
RPEException

updateProperties

public void updateProperties(com.ibm.rational.rpe.api.docspec.RPEDocumentElement docSpecElement,
                             com.ibm.rational.rpe.api.docspec.RPEDocumentElement templateElement,
                             java.util.List<java.lang.String> properties)

syncDocumentSpecification

public void syncDocumentSpecification(RPEDocumentSpecification docSpec,
                                      java.lang.String configFile,
                                      boolean strict)
                               throws RPEException
Throws:
RPEException

syncDocumentSpecification

public void syncDocumentSpecification(RPEDocumentSpecification docSpec,
                                      java.lang.String configFile)
                               throws RPEException
Synchronizes a Document Specification with its Document Templates by adding/removing Data Sources and Variables

Parameters:
docSpec - the Document Specification
configFile - the path to rpeconfig.xml
Throws:
RPEException - added in 1.2 to indicate synch errors ( only on strict mode)

replaceTemplate

public RPETemplate replaceTemplate(RPEDocumentSpecification docSpec,
                                   RPETemplate oldTemplate,
                                   java.lang.String newTemplatePath,
                                   Credential credential,
                                   java.lang.String configFile)
                            throws RPEException
For a given Document Specification, this method replaces an existing Document Template with a new one.

Parameters:
docSpec - the Document Specification object
oldTemplate - the existing Document Template object
newTemplatePath - the path to the Document Template file which will replace the existing one
configFile - the path to rpeconfig.xml
Throws:
RPEException

replaceTemplate

public RPETemplate replaceTemplate(RPEDocumentSpecification docSpec,
                                   java.lang.String oldTemplatePath,
                                   java.lang.String newTemplatePath,
                                   Credential credential,
                                   java.lang.String configFile)
                            throws RPEException
Throws:
RPEException

replaceTemplate

public RPETemplate replaceTemplate(RPEDocumentSpecification docSpec,
                                   java.lang.String oldTemplatePath,
                                   java.lang.String newTemplatePath,
                                   java.lang.String configFile)
                            throws RPEException
For a given Document Specification, this method replaces an existing Document Template with a new one.

Parameters:
docSpec - the Document Specification object
oldTemplatePath - the path to the existing Document Template file
newTemplatePath - the path to the Document Template file which will replace the existing one
configFile - the path to rpeconfig.xml
Throws:
RPEException

loadTemplate

public RPETemplate loadTemplate(java.lang.String configFile,
                                java.lang.String templPath)
                         throws RPEException
Throws:
RPEException

loadTemplate

public RPETemplate loadTemplate(java.lang.String configFile,
                                java.lang.String baseURI,
                                java.lang.String templateURI,
                                Credential credential)
                         throws RPEException
Loads a Document Template from the given path.

Parameters:
configFile - the path to rpeconfig.xml
templPath - the path to the Document Template file
Returns:
a RPETemplate object
Throws:
RPEException

createRuntimeTemplate

public RPETemplate createRuntimeTemplate(java.lang.String configFile,
                                         com.ibm.rational.rpe.common.template.model.Template template,
                                         java.lang.String path,
                                         Credential credential)
                                  throws RPEException
Throws:
RPEException

create

public RPEDocumentSpecification create(java.lang.String configFile)
                                throws RPEException
Creates an empty Document Specification.

Parameters:
configFile - the path to the rpeconfig.xml configuration file
Returns:
a Document Specification
Throws:
RPEException

create

public RPEDocumentSpecification create(java.lang.String configFile,
                                       java.util.List<java.lang.String> templatesFile)
                                throws RPEException
Creates a new Document Specification using a list of Document Templates.

Parameters:
configFile - the path to the rpeconfig.xml configuration file
templatesFile - a List of paths to Document Templates
Returns:
the Document Specification object loaded from the specified path
Throws:
RPEException

makeDocSpec

public RPEDocumentSpecification makeDocSpec(java.lang.String defFile)
                                     throws RPEException
Creates a Document Specification from a definition file. Only works with local files.

Parameters:
defFile - the path to a definition file
Returns:
the newly created RPEDocumentSpecification
Throws:
RPEException

load

public com.ibm.rational.rpe.api.docspec.RPEConfiguration load(java.lang.String configPath)
                                                       throws RPEException
Loads a configuration file. Should not be used directly.

Parameters:
configPath - the path to rpeconfig.xml
Returns:
the RPEConfiguration representation of the configuration file
Throws:
RPEException

load

public RPEDocumentSpecification load(java.lang.String configPath,
                                     java.lang.String docSpecPath,
                                     boolean strict)
                              throws RPEException
Throws:
RPEException

load

public RPEDocumentSpecification load(java.lang.String configPath,
                                     java.lang.String docSpecPath)
                              throws RPEException
Loads a Document Specification from the specified path.

Parameters:
configPath - the path to the rpeconfig.xml configuration file
docSpecPath - the path to the Document Specification
Returns:
the Document Specification object loaded from the specified path
Throws:
RPEException

load

public RPEDocumentSpecification load(java.lang.String configPath,
                                     java.lang.String docSpecPath,
                                     java.lang.String srcDocSpecPath,
                                     boolean strict)
                              throws RPEException
Throws:
RPEException

save

public void save(RPEDocumentSpecification docSpec,
                 java.lang.String fileName)
          throws RPEException
Saves a Document Specification to a file.

Parameters:
docSpec - a Document Specification object
fileName - the path to the destination file
Throws:
RPEException

stripCredentials

public void stripCredentials(RPEDocumentSpecification docSpec)
                      throws RPEException
For the given Document Specification, this method removes any usernames or passwords it contains for templates, stylesheets and data sources.

Parameters:
docSpec - a Document Specification object
Throws:
RPEException

getConfigurationForDatasource

public Feature getConfigurationForDatasource(java.lang.String configPath,
                                             java.lang.String type)
                                      throws RPEException
Builds the configuration feature for the given data source type. Should not be used directly.

Parameters:
configPath - the path to rpeconfig.xml
type - the data source type
Returns:
the configuration
Throws:
RPEException

addOutput

public RPEOutput addOutput(RPEDocumentSpecification docspec,
                           java.lang.String type,
                           java.lang.String driver)
                    throws RPEException
Adds the specified output type to the document specification. The output type must be in the list of supported Output Types If the driver is null the first driver for the output type

Parameters:
docspec -
Throws:
RPEException

setURIResolver

public void setURIResolver(com.ibm.rational.rpe.common.utils.IURIResolver uriResolver)

getURIResolver

public com.ibm.rational.rpe.common.utils.IURIResolver getURIResolver()