Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.model.project.impl
Class MidletSuiteProject

java.lang.Object
  extended by org.eclipse.mtj.core.model.project.impl.MidletSuiteProject
All Implemented Interfaces:
IMidletSuiteProject

public class MidletSuiteProject
extends Object
implements IMidletSuiteProject

Implementation of the IMidletSuiteProject interface providing access to MIDlet suite specific information.

Note: This class/interface is part of an interim API that is still under development and expected to change before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken as the API evolves.


Field Summary
static String CLASSES_DIRECTORY
          The verified sub-directory for classes
static String LIBS_DIRECTORY
          The verified sub-directory for libraries
 
Fields inherited from interface org.eclipse.mtj.core.model.project.IMidletSuiteProject
APPLICATION_DESCRIPTOR_NAME
 
Constructor Summary
MidletSuiteProject(IJavaProject javaProject)
          Private constructor for singleton instances of the class.
 
Method Summary
 void addMidletSuiteProjectListener(IMidletSuiteProjectListener listener)
           
static boolean containsJavaMEClasspathContainer(IJavaProject javaProject)
          Return a boolean indicating whether the project contains the JavaME classpath container.
 void createPackage(IProgressMonitor monitor, boolean obfuscate, boolean packageInactiveConfigs)
          Create a deployed JAR file package for this MIDlet suite project.
 ApplicationDescriptor getApplicationDescriptor()
          Return an ApplicationDescriptor instance wrapped around the Application Descriptor (JAD) file for this MIDlet suite.
 IFile getApplicationDescriptorFile()
          Return the Application Descriptor file
 File[] getClasspath(IProgressMonitor monitor)
          Return the classpath for this project.
 Configurations getConfigurations()
          Return Configurations of the project.
static String getDefaultJadFileName(IProject project)
          Return the default JAD file name for the specified project.
 IDevice getDevice()
          Return the device referenced by this project.
 String getJadFileName()
          Return the file holding the JAD file.
 String getJarFilename()
          Return the name to use for the JAR file.
 IJavaProject getJavaProject()
          Return the underlying java project.
 MetaData getMetaData()
          Return the metadata for this MIDlet suite.
 IProject getProject()
          Return the underlying project instance.
 ISignatureProperties getSignatureProperties()
          Get the ISignatureProperties associated with this MIDlet suite
 String getTempKeyPassword()
           
 String getTempKeystorePassword()
           
 IFolder getVerifiedClassesOutputFolder(IProgressMonitor monitor)
          Get the IFolder into which verified classes should be written.
 IFolder getVerifiedLibrariesOutputFolder(IProgressMonitor monitor)
          Get the IFolder into which verified libraries should be written.
 IFolder getVerifiedOutputFolder(IProgressMonitor monitor)
          Get the IFolder into which verified classes should be written.
 boolean isDeployedJarUpToDate()
          Return a boolean indicating whether the project's deployed jar file exists and is up to date compared with the code contained within the jar.
 boolean isPreprocessedProject()
          Return a boolean indicating whether the underlying project is a preprocessed project.
 PreverificationError[] preverify(IResource[] toVerify, IFolder outputFolder, IProgressMonitor monitor)
          Preverify the specified resources.
 PreverificationError[] preverifyJarFile(File jarFile, IFolder outputFolder, IProgressMonitor monitor)
          Launch the preverification process on the specified jar file.
 void removeMidletSuiteProjectListener(IMidletSuiteProjectListener listener)
           
 void saveMetaData()
          Save the MIDlet suite metadata.
 void setDeployedJarFileUpToDate(boolean upToDate)
          Set the flag indicating whether or not the deployed jar file for this MIDlet suite project is currently up to date.
 void setDevice(IDevice device, IProgressMonitor monitor)
          Set the device being used by this project.
 void setEnabledSymbolDefinitionSet(SymbolDefinitionSet set)
          Set the symbol definition set that is enabled for this project.
 void setJadFileName(String jadFileName)
           
 void setSignatureProperties(ISignatureProperties props)
          Set the ISignatureProperties to use for this MIDlet suite
 void setTempKeyPassword(String pass)
           
 void setTempKeystorePassword(String pass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSES_DIRECTORY

public static final String CLASSES_DIRECTORY
The verified sub-directory for classes

See Also:
Constant Field Values

LIBS_DIRECTORY

public static final String LIBS_DIRECTORY
The verified sub-directory for libraries

See Also:
Constant Field Values
Constructor Detail

MidletSuiteProject

public MidletSuiteProject(IJavaProject javaProject)
Private constructor for singleton instances of the class.

Method Detail

containsJavaMEClasspathContainer

public static boolean containsJavaMEClasspathContainer(IJavaProject javaProject)
                                                throws JavaModelException
Return a boolean indicating whether the project contains the JavaME classpath container.

Parameters:
javaProject - the project to be tested
Returns:
whether the project has the J2ME classpath container
Throws:
JavaModelException

getDefaultJadFileName

public static String getDefaultJadFileName(IProject project)
Return the default JAD file name for the specified project.

Parameters:
project -
Returns:

addMidletSuiteProjectListener

public void addMidletSuiteProjectListener(IMidletSuiteProjectListener listener)
Specified by:
addMidletSuiteProjectListener in interface IMidletSuiteProject

createPackage

public void createPackage(IProgressMonitor monitor,
                          boolean obfuscate,
                          boolean packageInactiveConfigs)
                   throws CoreException
Description copied from interface: IMidletSuiteProject
Create a deployed JAR file package for this MIDlet suite project.

Specified by:
createPackage in interface IMidletSuiteProject
Parameters:
monitor - progress monitor
obfuscate - a boolean indicating whether to obfuscate the resulting packaged code.
packageInactiveConfigs - - a boolean indicating whether to package all configurations (including inactive configurations) or just package active configuration.
Throws:
CoreException

getApplicationDescriptor

public ApplicationDescriptor getApplicationDescriptor()
Description copied from interface: IMidletSuiteProject
Return an ApplicationDescriptor instance wrapped around the Application Descriptor (JAD) file for this MIDlet suite.

Specified by:
getApplicationDescriptor in interface IMidletSuiteProject
Returns:
the suite's application descriptor

getApplicationDescriptorFile

public IFile getApplicationDescriptorFile()
Return the Application Descriptor file

Specified by:
getApplicationDescriptorFile in interface IMidletSuiteProject
Returns:
the Application Descriptor file

getClasspath

public File[] getClasspath(IProgressMonitor monitor)
                    throws CoreException
Description copied from interface: IMidletSuiteProject
Return the classpath for this project. This classpath does not include the entries for the J2ME libraries.

Specified by:
getClasspath in interface IMidletSuiteProject
Returns:
Throws:
CoreException

getConfigurations

public Configurations getConfigurations()
Description copied from interface: IMidletSuiteProject
Return Configurations of the project.

Specified by:
getConfigurations in interface IMidletSuiteProject
Returns:

getDevice

public IDevice getDevice()
Return the device referenced by this project.

Specified by:
getDevice in interface IMidletSuiteProject
Returns:

getJadFileName

public String getJadFileName()
Description copied from interface: IMidletSuiteProject
Return the file holding the JAD file. There is a chance that this file may not actually exist if the user moved the file without using the refactoring functionality.

Specified by:
getJadFileName in interface IMidletSuiteProject
Returns:
the java application descriptor file

getJarFilename

public String getJarFilename()
Description copied from interface: IMidletSuiteProject
Return the name to use for the JAR file.

Specified by:
getJarFilename in interface IMidletSuiteProject
Returns:
the jar file name

getJavaProject

public IJavaProject getJavaProject()
Description copied from interface: IMidletSuiteProject
Return the underlying java project.

Specified by:
getJavaProject in interface IMidletSuiteProject
Returns:
the underlying java project

getMetaData

public MetaData getMetaData()
Return the metadata for this MIDlet suite.
NOTE: This method is not considered part of the API and is only available to aid the implementation.

Returns:
the metadata.

getProject

public IProject getProject()
Description copied from interface: IMidletSuiteProject
Return the underlying project instance.

Specified by:
getProject in interface IMidletSuiteProject
Returns:
the underlying project

getSignatureProperties

public ISignatureProperties getSignatureProperties()
                                            throws CoreException
Description copied from interface: IMidletSuiteProject
Get the ISignatureProperties associated with this MIDlet suite

Specified by:
getSignatureProperties in interface IMidletSuiteProject
Returns:
the currently associated ISignatureProperties
Throws:
CoreException

getTempKeyPassword

public String getTempKeyPassword()
Specified by:
getTempKeyPassword in interface IMidletSuiteProject

getTempKeystorePassword

public String getTempKeystorePassword()
Specified by:
getTempKeystorePassword in interface IMidletSuiteProject

getVerifiedClassesOutputFolder

public IFolder getVerifiedClassesOutputFolder(IProgressMonitor monitor)
                                       throws CoreException
Description copied from interface: IMidletSuiteProject
Get the IFolder into which verified classes should be written.

Specified by:
getVerifiedClassesOutputFolder in interface IMidletSuiteProject
Parameters:
monitor - progress monitor
Returns:
the verified classes output folder
Throws:
CoreException

getVerifiedLibrariesOutputFolder

public IFolder getVerifiedLibrariesOutputFolder(IProgressMonitor monitor)
                                         throws CoreException
Description copied from interface: IMidletSuiteProject
Get the IFolder into which verified libraries should be written.

Specified by:
getVerifiedLibrariesOutputFolder in interface IMidletSuiteProject
Parameters:
monitor - progress monitor
Returns:
the verified libraries output folder
Throws:
CoreException

getVerifiedOutputFolder

public IFolder getVerifiedOutputFolder(IProgressMonitor monitor)
                                throws CoreException
Description copied from interface: IMidletSuiteProject
Get the IFolder into which verified classes should be written.

Specified by:
getVerifiedOutputFolder in interface IMidletSuiteProject
Parameters:
monitor - progress monitor
Returns:
the verified root output folder
Throws:
CoreException

isDeployedJarUpToDate

public boolean isDeployedJarUpToDate()
                              throws CoreException
Description copied from interface: IMidletSuiteProject
Return a boolean indicating whether the project's deployed jar file exists and is up to date compared with the code contained within the jar.

Specified by:
isDeployedJarUpToDate in interface IMidletSuiteProject
Returns:
whether the deployed jar file is currently up to date.
Throws:
CoreException - if there is a problem retrieving the information.

isPreprocessedProject

public boolean isPreprocessedProject()
                              throws CoreException
Return a boolean indicating whether the underlying project is a preprocessed project.

Returns:
Throws:
CoreException

preverify

public PreverificationError[] preverify(IResource[] toVerify,
                                        IFolder outputFolder,
                                        IProgressMonitor monitor)
                                 throws CoreException,
                                        IOException,
                                        PreverifierNotFoundException
Description copied from interface: IMidletSuiteProject
Preverify the specified resources. Return the map of class names with preverification errors mapped to the error that was caused.

Specified by:
preverify in interface IMidletSuiteProject
Parameters:
toVerify - the resources to be preverified
outputFolder - the folder into which the output will be written
monitor - progress monitor
Returns:
An array of errors found during preverification.
Throws:
CoreException
IOException
PreverifierNotFoundException

preverifyJarFile

public PreverificationError[] preverifyJarFile(File jarFile,
                                               IFolder outputFolder,
                                               IProgressMonitor monitor)
                                        throws CoreException,
                                               IOException,
                                               PreverifierNotFoundException
Description copied from interface: IMidletSuiteProject
Launch the preverification process on the specified jar file.

Specified by:
preverifyJarFile in interface IMidletSuiteProject
Parameters:
jarFile - The jar file to be preverified.
outputFolder - The folder into which the output is to be placed.
monitor - Progress monitor
Returns:
An array of errors found during preverification.
Throws:
CoreException
IOException
PreverifierNotFoundException

removeMidletSuiteProjectListener

public void removeMidletSuiteProjectListener(IMidletSuiteProjectListener listener)
Specified by:
removeMidletSuiteProjectListener in interface IMidletSuiteProject

saveMetaData

public void saveMetaData()
                  throws CoreException
Description copied from interface: IMidletSuiteProject
Save the MIDlet suite metadata. Should be called after setPlatformDefinition or setSignatureProperties are called to persist the information set.

Specified by:
saveMetaData in interface IMidletSuiteProject
Throws:
CoreException

setDeployedJarFileUpToDate

public void setDeployedJarFileUpToDate(boolean upToDate)
                                throws CoreException
Description copied from interface: IMidletSuiteProject
Set the flag indicating whether or not the deployed jar file for this MIDlet suite project is currently up to date.

Specified by:
setDeployedJarFileUpToDate in interface IMidletSuiteProject
Parameters:
upToDate - whether the deployed jar file is up to date.
Throws:
CoreException - if there is a problem setting the information.

setDevice

public void setDevice(IDevice device,
                      IProgressMonitor monitor)
               throws CoreException
Description copied from interface: IMidletSuiteProject
Set the device being used by this project.

Specified by:
setDevice in interface IMidletSuiteProject
Throws:
CoreException

setEnabledSymbolDefinitionSet

public void setEnabledSymbolDefinitionSet(SymbolDefinitionSet set)
                                   throws CoreException,
                                          PersistenceException
Description copied from interface: IMidletSuiteProject
Set the symbol definition set that is enabled for this project.

Specified by:
setEnabledSymbolDefinitionSet in interface IMidletSuiteProject
Parameters:
set - the set to be enabled
Throws:
CoreException
PersistenceException

setJadFileName

public void setJadFileName(String jadFileName)
Specified by:
setJadFileName in interface IMidletSuiteProject

setSignatureProperties

public void setSignatureProperties(ISignatureProperties props)
Description copied from interface: IMidletSuiteProject
Set the ISignatureProperties to use for this MIDlet suite

Specified by:
setSignatureProperties in interface IMidletSuiteProject

setTempKeyPassword

public void setTempKeyPassword(String pass)
Specified by:
setTempKeyPassword in interface IMidletSuiteProject

setTempKeystorePassword

public void setTempKeystorePassword(String pass)
Specified by:
setTempKeystorePassword in interface IMidletSuiteProject

Mobile Tools for Java
Release 1.0