com.metamatrix.common.vdb.api
Class VDBArchive

java.lang.Object
  extended by com.metamatrix.common.vdb.api.VDBArchive
All Implemented Interfaces:
MetadataSource

public class VDBArchive
extends java.lang.Object
implements MetadataSource

Latest incarnation of the VDBContext, specifically for weeding out dependencies on the vdb.edit; So do put in Modeler dependencies here.


Field Summary
static java.lang.String CACHED
           
static java.lang.String USE_CONNECTOR_METADATA
           
 
Constructor Summary
VDBArchive(java.io.File vdb)
          Build a VDB archive from the given zip file.
VDBArchive(java.io.InputStream vdbStream)
          Build VDB archive from given stream.
 
Method Summary
 boolean cacheConnectorMetadata()
          Whether to cache connector metadata
 void close()
          Close the VDBArchive and do the cleanup.
 BasicVDBDefn getConfigurationDef()
          Get the parsed object for the Configuration.def file.
 java.util.Set<java.lang.String> getConnectorMetadataModelNames()
          Get the list of model names that will provide metadata
 char[] getDataRoles()
          Get the Data roles file if one is defined
 java.io.File getDeployDirectory()
           
 java.util.Set<java.lang.String> getEntries()
          Return all files known by this metadata source
 java.io.File getFile(java.lang.String path)
          Returns the file for the given path, which must exist in the entry set
 ModelInfo getModelInfo(java.lang.String name)
          Get the model with the given name.
 java.lang.String getName()
           
 short getStatus()
           
 java.lang.String[] getVDBValidityErrors()
          Returns errors, otherwise null for no validity errors.
 java.lang.String getVersion()
           
 boolean isVisible(java.lang.String pathInVdb)
           
static VDBArchive loadVDB(java.net.URL vdbURL, java.io.File deployDirectory)
           
static BasicVDBDefn readFromDef(java.io.InputStream defStream)
          Load the VDB from DEF file.
 void saveFile(java.io.InputStream is, java.lang.String path)
          Save the stream to given path.
 void setName(java.lang.String name)
           
 void setStatus(short status)
           
 java.lang.String toString()
           
 void updateConfigurationDef(BasicVDBDefn vdbDef)
          Update the Configuration.def file, with supplied DEF object.
 void updateRoles(char[] roles)
          Update/Add the data roles file in the archive.
 void write(java.io.OutputStream out)
          Write the VDBArchive to the given output stream
static byte[] writeToByteArray(VDBArchive vdb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USE_CONNECTOR_METADATA

public static java.lang.String USE_CONNECTOR_METADATA

CACHED

public static java.lang.String CACHED
Constructor Detail

VDBArchive

public VDBArchive(java.io.InputStream vdbStream)
           throws java.io.IOException
Build VDB archive from given stream. Note that any updates on the archive object will reflect in the temporary file that this object manipulates.

Parameters:
vdbStream -
Throws:
java.io.IOException

VDBArchive

public VDBArchive(java.io.File vdb)
           throws java.io.IOException
Build a VDB archive from the given zip file.

Parameters:
vdb -
Throws:
java.io.IOException
Method Detail

loadVDB

public static VDBArchive loadVDB(java.net.URL vdbURL,
                                 java.io.File deployDirectory)
                          throws java.io.IOException
Throws:
java.io.IOException

getConnectorMetadataModelNames

public java.util.Set<java.lang.String> getConnectorMetadataModelNames()
Description copied from interface: MetadataSource
Get the list of model names that will provide metadata

Specified by:
getConnectorMetadataModelNames in interface MetadataSource
Returns:

cacheConnectorMetadata

public boolean cacheConnectorMetadata()
Description copied from interface: MetadataSource
Whether to cache connector metadata

Specified by:
cacheConnectorMetadata in interface MetadataSource
Returns:

saveFile

public void saveFile(java.io.InputStream is,
                     java.lang.String path)
              throws java.io.IOException
Description copied from interface: MetadataSource
Save the stream to given path.

Specified by:
saveFile in interface MetadataSource
Throws:
java.io.IOException

getDeployDirectory

public java.io.File getDeployDirectory()

readFromDef

public static BasicVDBDefn readFromDef(java.io.InputStream defStream)
                                throws java.io.IOException
Load the VDB from DEF file. The name of the VDB Archive is taken from the DEF contents. If the VDB file exists it will be loaded.

Parameters:
defStream - - DEF file Stream;
Returns:
VDBDefn
Throws:
java.io.IOException

updateConfigurationDef

public void updateConfigurationDef(BasicVDBDefn vdbDef)
                            throws java.io.IOException
Update the Configuration.def file, with supplied DEF object.

Parameters:
vdbDef -
Throws:
java.io.IOException

updateRoles

public void updateRoles(char[] roles)
                 throws java.io.IOException
Update/Add the data roles file in the archive.

Parameters:
roles - - contents of the roles file
Throws:
java.io.IOException

close

public void close()
Close the VDBArchive and do the cleanup. Once this call is made archive is no longer usable.


getConfigurationDef

public BasicVDBDefn getConfigurationDef()
Get the parsed object for the Configuration.def file.

Returns:
null if the ConfigurationInfo.def file not found in the archive

getDataRoles

public char[] getDataRoles()
Get the Data roles file if one is defined

Returns:
null is no data roles file is found in the archive.

getVDBValidityErrors

public java.lang.String[] getVDBValidityErrors()
Returns errors, otherwise null for no validity errors.

Returns:

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Write the VDBArchive to the given output stream

Parameters:
out -
Throws:
java.io.IOException

getName

public java.lang.String getName()
Specified by:
getName in interface MetadataSource

setName

public void setName(java.lang.String name)

getVersion

public java.lang.String getVersion()

getStatus

public short getStatus()

setStatus

public void setStatus(short status)

getEntries

public java.util.Set<java.lang.String> getEntries()
Description copied from interface: MetadataSource
Return all files known by this metadata source

Specified by:
getEntries in interface MetadataSource
Returns:

isVisible

public boolean isVisible(java.lang.String pathInVdb)

writeToByteArray

public static byte[] writeToByteArray(VDBArchive vdb)
                               throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getFile

public java.io.File getFile(java.lang.String path)
Description copied from interface: MetadataSource
Returns the file for the given path, which must exist in the entry set

Specified by:
getFile in interface MetadataSource
Returns:

getModelInfo

public ModelInfo getModelInfo(java.lang.String name)
Description copied from interface: MetadataSource
Get the model with the given name.

Specified by:
getModelInfo in interface MetadataSource
Returns:


Copyright © 2009. All Rights Reserved.