org.openoffice.ide.eclipse.core.model
Class UnoPackage

java.lang.Object
  extended by org.openoffice.ide.eclipse.core.model.UnoPackage

public class UnoPackage
extends java.lang.Object

This class represents a UNO package and should be used to create a UNO package.

In the same way than ant jar target does, the UNO package is defined by an output file and a root directory. All the file that will be added to the package will have to be contained in this directory or one of its children.

Author:
cedricbosdo

Field Summary
static java.lang.String OXT
           
static java.lang.String UNOPKG
           
static java.lang.String ZIP
           
 
Constructor Summary
UnoPackage(java.io.File pOut, java.io.File pDir)
          Create a new package object.
 
Method Summary
 void addBasicLibraryFile(java.io.File pDir)
          Add a basic library to the package.
 void addComponentFile(java.io.File pFile, java.lang.String pType)
          Add a uno component file, for example a jar, shared library or python file containing the uno implementation.
 void addComponentFile(java.io.File pFile, java.lang.String pType, java.lang.String pPlatform)
          Add a uno component file, for example a jar, shared library or python file containing the uno implementation.
 void addConfigurationDataFile(java.io.File pFile)
          Add an xcu configuration to the package.
 void addConfigurationSchemaFile(java.io.File pFile)
          Add an xcs configuration to the package.
 void addContent(java.io.File pContent)
          Add a file or directory to the package.
 void addDialogLibraryFile(java.io.File pDir)
          Add a dialog library to the package.
 void addOtherFile(java.io.File pFile)
          Adds a file or directory to the package but do not include it in the manifest.
 void addPackageDescription(java.io.File pDescriptionFile, java.util.Locale pLocale)
          Add a localized description of the package.
 void addTypelibraryFile(java.io.File pFile, java.lang.String pType)
          Add a type library to the package.
 java.io.File close()
          Writes the package on the disk and cleans up the data.
 void dispose()
          Cleans up the data structure.
static java.util.List<org.eclipse.core.resources.IResource> getContainedFile(org.eclipse.core.resources.IProject pPrj)
          Get the list of the files contained in the minimal UNO package.
 java.util.List<java.io.File> getContainedFiles()
           
static boolean isContainedInPackage(org.eclipse.core.resources.IResource pRes)
          Checks if the resource is contained in the UNO package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZIP

public static final java.lang.String ZIP
See Also:
Constant Field Values

UNOPKG

public static final java.lang.String UNOPKG
See Also:
Constant Field Values

OXT

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

UnoPackage

public UnoPackage(java.io.File pOut,
                  java.io.File pDir)
Create a new package object.

The extension has be one of the following. The default extension is ZIP. If the extension is invalid or missing, the file will be renamed in .zip.

Parameters:
pOut - the file of the package.
pDir - the root directory of the package content.
Method Detail

dispose

public void dispose()
Cleans up the data structure. There is no need to call this method if the package has been closed using close()


addContent

public void addContent(java.io.File pContent)
Add a file or directory to the package.

This method doesn't know about the different languages contributions to the manifest.xml file.

Parameters:
pContent - the file or folder to add

addComponentFile

public void addComponentFile(java.io.File pFile,
                             java.lang.String pType)
Add a uno component file, for example a jar, shared library or python file containing the uno implementation. The type of the file defines the language and should be given as defined in the OOo Developer's Guide, like Java, native, Python.

Parameters:
pFile - the file to add to the package
pType - the type of the file to add.
See Also:
for platform support

addComponentFile

public void addComponentFile(java.io.File pFile,
                             java.lang.String pType,
                             java.lang.String pPlatform)
Add a uno component file, for example a jar, shared library or python file containing the uno implementation.

The type of the file defines the language and should be given as defined in the OOo Developer's Guide, like Java, native, Python.

Parameters:
pFile - the file to add to the package
pType - the type of the file to add.
pPlatform - optional parameter to use only with native type. Please refer to the OOo Developer's Guide for more information.

addTypelibraryFile

public void addTypelibraryFile(java.io.File pFile,
                               java.lang.String pType)
Add a type library to the package.

Note that by some strange way, a jar dependency can be added in the package as a type library like RDB files.

Parameters:
pFile - the file to add
pType - the type of the file as specified in the OOo Developer's Guide

addBasicLibraryFile

public void addBasicLibraryFile(java.io.File pDir)
Add a basic library to the package.

Even if this method may not be used, it is possible.

Parameters:
pDir - the directory of the basic library.

addDialogLibraryFile

public void addDialogLibraryFile(java.io.File pDir)
Add a dialog library to the package.

Even if this method may not be used, it is possible.

Parameters:
pDir - the directory of the dialog library.

addConfigurationDataFile

public void addConfigurationDataFile(java.io.File pFile)
Add an xcu configuration to the package.

Parameters:
pFile - the xcu file to add

addConfigurationSchemaFile

public void addConfigurationSchemaFile(java.io.File pFile)
Add an xcs configuration to the package.

Parameters:
pFile - the xcs file to add

addPackageDescription

public void addPackageDescription(java.io.File pDescriptionFile,
                                  java.util.Locale pLocale)
Add a localized description of the package.

Parameters:
pDescriptionFile - the file containing the description for that locale
pLocale - the locale of the description. Can be null.

addOtherFile

public void addOtherFile(java.io.File pFile)
Adds a file or directory to the package but do not include it in the manifest.

This could be used for example for images.

Parameters:
pFile - the file or directory to add.

close

public java.io.File close()
Writes the package on the disk and cleans up the data. The UnoPackage instance cannot be used after this operation: it should unreferenced.

Returns:
the file of the package or null if nothing happened.

getContainedFiles

public java.util.List<java.io.File> getContainedFiles()
Returns:
a list of the files that are already queued for addition to the package.

isContainedInPackage

public static boolean isContainedInPackage(org.eclipse.core.resources.IResource pRes)
Checks if the resource is contained in the UNO package.

Parameters:
pRes - the resource to check
Returns:
true if the resource is contained in the package

getContainedFile

public static java.util.List<org.eclipse.core.resources.IResource> getContainedFile(org.eclipse.core.resources.IProject pPrj)
Get the list of the files contained in the minimal UNO package.

Parameters:
pPrj - the project for which to get the minimal resources
Returns:
the list of files