com.ibm.adt.ovf.model.utility
Class PackageExporter

java.lang.Object
  extended by com.ibm.adt.ovf.model.utility.PackageExporter

public class PackageExporter
extends java.lang.Object


Constructor Summary
PackageExporter(EnvelopeType envelope, java.lang.String packageName, java.io.File baseLocalRef, java.io.File baseFile, java.io.File directory, boolean isOVA, boolean allowOverwrite, boolean hasDigests, java.security.PrivateKey privateKey, java.security.cert.Certificate certificate, int bufferSize, IProgressMonitor progressMonitor)
          This utility class exports an OVF package.
PackageExporter(EnvelopeType envelope, java.lang.String packageName, java.io.File baseLocalRef, java.io.File baseFile, java.io.File directory, boolean isOVA, boolean allowOverwrite, boolean hasDigests, java.security.PrivateKey privateKey, java.security.cert.Certificate certificate, IProgressMonitor progressMonitor)
          This utility class exports an OVF package.
 
Method Summary
static java.lang.String computePackageFilename(EnvelopeType envelope)
           
static java.lang.String computePackageName(EnvelopeType envelope)
           
 void export()
          Export the OVF package
 void initSign(java.security.PrivateKey key, java.security.cert.Certificate cert)
           
 void setFileResolver(IFileResolver fileResolver)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageExporter

public PackageExporter(EnvelopeType envelope,
                       java.lang.String packageName,
                       java.io.File baseLocalRef,
                       java.io.File baseFile,
                       java.io.File directory,
                       boolean isOVA,
                       boolean allowOverwrite,
                       boolean hasDigests,
                       java.security.PrivateKey privateKey,
                       java.security.cert.Certificate certificate,
                       IProgressMonitor progressMonitor)
This utility class exports an OVF package. Package signing is indicated by the privateKay and certificate parameters, both of which must be null or non-null. If non-null, the hasDigests parameter must be set to true.

Parameters:
envelope - the OVF envelope to be exported
packageName - the OVF package name to be used. If null, the package name will be derived from the envelope filename
baseLocalRef - if not null, the envelope's local references are relative to this directory
baseFile - a file to be used in resolving relative URIs in the descriptor. Typically, this would be the .ovf file
directory - the output directory where either the package files or the .ova file will be created
isOVA - if true, the output will be a .ova archive file. If false, the output will be individual files in the output directory
allowOverwrite - if true, overwriting existing files is allowed.
hasDigests - if true, a manifest file will be generated in the package with digests according to the OVF specification
privateKey - to be used to sign the package
certificate - to be used to sign the package
progressMonitor - if not null, provides progress monitoring

PackageExporter

public PackageExporter(EnvelopeType envelope,
                       java.lang.String packageName,
                       java.io.File baseLocalRef,
                       java.io.File baseFile,
                       java.io.File directory,
                       boolean isOVA,
                       boolean allowOverwrite,
                       boolean hasDigests,
                       java.security.PrivateKey privateKey,
                       java.security.cert.Certificate certificate,
                       int bufferSize,
                       IProgressMonitor progressMonitor)
This utility class exports an OVF package. Package signing is indicated by the privateKay and certificate parameters, both of which must be null or non-null. If non-null, the hasDigests parameter must be set to true.

Parameters:
envelope - the OVF envelope to be exported
packageName - the OVF package name to be used. If null, the package name will be derived from the envelope filename
baseLocalRef - if not null, the envelope's local references are relative to this directory
baseFile - a file to be used in resolving relative URIs in the descriptor. Typically, this would be the .ovf file
directory - the output directory where either the package files or the .ova file will be created
isOVA - if true, the output will be a .ova archive file. If false, the output will be individual files in the output directory
allowOverwrite - if true, overwriting existing files is allowed.
hasDigests - if true, a manifest file will be generated in the package with digests according to the OVF specification
privateKey - to be used to sign the package
certificate - to be used to sign the package
bufferSize - the size of buffer for input and output operations (default is 1M)
progressMonitor - if not null, provides progress monitoring
Method Detail

initSign

public void initSign(java.security.PrivateKey key,
                     java.security.cert.Certificate cert)

setFileResolver

public void setFileResolver(IFileResolver fileResolver)

export

public void export()
            throws java.lang.Exception
Export the OVF package

Throws:
java.lang.Exception - for I/O errors, security errors, also including overwrite violations
See Also:
OverwriteNotAllowedException

computePackageName

public static java.lang.String computePackageName(EnvelopeType envelope)

computePackageFilename

public static java.lang.String computePackageFilename(EnvelopeType envelope)


© Copyright 2008 IBM Corp. 2008 All Rights Reserved