com.metamatrix.common.vdb.api
Class VDBArchive

java.lang.Object
  extended by com.metamatrix.common.vdb.api.VDBArchive

public class VDBArchive
extends java.lang.Object

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


Constructor Summary
VDBArchive(java.io.File vdbFile)
          Build the VDBArchive from a supplied file.
VDBArchive(java.io.InputStream vdbStream)
          Build VDB archive from given stream.
 
Method Summary
 void close()
          Close the VDBArchive and do the cleanup.
 BasicVDBDefn getConfigurationDef()
          Get the parsed object for the Configuration.def file.
 char[] getDataRoles()
          Get the Data roles file if one is defined
 java.util.Set<java.lang.String> getEntries()
           
 java.io.InputStream getInputStream()
          Get the stream object for the VDB.
 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 BasicVDBDefn readFromDef(java.io.InputStream defStream)
          Load the VDB from DEF file.
 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
 

Constructor Detail

VDBArchive

public VDBArchive(java.io.File vdbFile)
           throws java.io.IOException
Build the VDBArchive from a supplied file. Note that any updates on the archive object will reflect in the supplied file.

Parameters:
vdbFile -
Throws:
java.io.IOException

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. To get the modified archive use the getVDBStream to stream and save.

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

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.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get the stream object for the VDB. This object is only valid when the archive is still open. Once closed this stream becomes invalid.

Returns:
stream for the VDB contents.
Throws:
java.io.IOException

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()

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()

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


Copyright © 2009. All Rights Reserved.