Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.project
Interface IMTJProject

All Known Subinterfaces:
IMidletSuiteProject

public interface IMTJProject

This interface provides the basic methods that must be available in all projects provided by MTJ.

Features of MTJ projects include:

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same. Please do not use this API without consulting with the MTJ team.

Since:
1.0
Restriction:
This class is not intended to be implemented by clients.

Method Summary
 void addMTJProjectListener(IMTJProjectListener projectListener)
          Adds the listener to the collection of listeners who will be notified when the project state changes.
 void createPackage(boolean obfuscate, boolean packageInactiveConfigs, IProgressMonitor monitor)
          Create a deployable JAR file package based on the contents available in the project.
 IJavaProject getJavaProject()
          Returns the IJavaProject on which this IMTJProject was created.
 IProject getProject()
          Returns the IProject on which this IMTJProject was created.
 MTJRuntimeList getRuntimeList()
          Return the list of runtimes that are associated to the project.
 Properties getSdkProviderMetaData(String sdkId)
          Retrieve a Properties file of vendor-specific meta data associated with the IMTJProject.
 ISignatureProperties getSignatureProperties()
          Get the ISignatureProperties associated with this project.
 void refreshClasspath(IProgressMonitor monitor)
          Refresh the classpath for this project.
 void removeMTJProjectListener(IMTJProjectListener projectListener)
          Removes the listener from the collection of listeners who will be notified when the project state changes.
 void saveMetaData()
          Save the project's metadata.
 void setSdkProviderMetaData(String sdkId, Properties metaData)
          Set a Properties file of meta data to be associated with an IMTJProject.
 void setSignatureProperties(ISignatureProperties props)
          Set the signature properties for using when signing deployable packages generated for this MTJ project.
 

Method Detail

addMTJProjectListener

void addMTJProjectListener(IMTJProjectListener projectListener)
Adds the listener to the collection of listeners who will be notified when the project state changes. The listener is notified by invoking one of methods defined in the IMTJProjectListener interface.

Parameters:
projectListener - the listener that should be notified when the project state changes.

createPackage

void createPackage(boolean obfuscate,
                   boolean packageInactiveConfigs,
                   IProgressMonitor monitor)
                   throws CoreException
Create a deployable JAR file package based on the contents available in the project.

The process of creating a deployable is described bellow:

  1. Clean the output of the specified project.
  2. Invoke the build method of the specified builders for this project.
  3. Create the package for the available configurations according the given packageInactiveConfigs flag.
  4. Notify listeners.

This method notifies all listeners after the package creation through the invocation of IMTJProjectListener.packageCreated(). Listeners wont be notified in case the package creation fails.

Parameters:
obfuscate - a boolean indicating whether to obfuscate the resulting packaged code.
packageInactiveConfigs - a boolean indicating whether to create packages for all configurations (including inactive configurations) or just for the active one.
monitor - a progress monitor, or null if progress reporting is not desired.
Throws:
CoreException

getJavaProject

IJavaProject getJavaProject()
Returns the IJavaProject on which this IMTJProject was created.

Returns:
the non-null the IJavaProject on which this IMTJProject was created.

getProject

IProject getProject()
Returns the IProject on which this IMTJProject was created.

Returns:
the non-null the IProject on which this IMTJProject was created.

getRuntimeList

MTJRuntimeList getRuntimeList()
Return the list of runtimes that are associated to the project. From the list it is possible to read each runtime and information such as the device of each runtime

Returns:
MTJRuntimeList list of MTJRuntime

getSignatureProperties

ISignatureProperties getSignatureProperties()
                                            throws CoreException
Get the ISignatureProperties associated with this project.

If the project has no specific signing settings, the signature properties available in the workspace secure preferences will be used as default.

In case the project specific signing settings were not set correctly (reading these settings from the project metadata is returning null) this method will return null.

Returns:
the currently associated ISignatureProperties for this project or null in case of invalid properties.
Throws:
CoreException - an error occur while decrypting the information available in the signature properties.

refreshClasspath

void refreshClasspath(IProgressMonitor monitor)
                      throws CoreException,
                             OperationCanceledException
Refresh the classpath for this project.

This method removes all MTJ classpath specific markers previously set on the project, refreshes the classpath based on the active configuration and forces a full rebuild.

This method notifies all listeners after the package creation through the invocation of IMTJProjectListener.classpathRefreshed(). Listeners wont be notified in case the classpath couldn't be refreshed.

Parameters:
monitor - a progress monitor, or null if progress reporting is not desired.
Throws:
CoreException - if the classpath could not be set. Reasons include:
  • The associated javaProject does not exist (JavaModelException).
  • Fails to clear all markers on the project before refreshing the classpath.
  • The classpath is being modified during resource change event notification(JavaModelException).
  • The classpath failed the validation check as defined by JavaConventions#validateClasspath(IJavaProject, IClasspathEntry[], IPath) (JavaModelException).
  • The rebuild fails.
OperationCanceledException - if the rebuild was canceled during execution.

removeMTJProjectListener

void removeMTJProjectListener(IMTJProjectListener projectListener)
Removes the listener from the collection of listeners who will be notified when the project state changes.

Parameters:
projectListener - the listener that should no longer be notified when the project state changes.

saveMetaData

void saveMetaData()
                  throws CoreException
Save the project's metadata.

Should be called after setSignatureProperties(ISignatureProperties) to persist the information set.

This method notifies all listeners after saving the metadata through the invocation of IMTJProjectListener.metaDataSaved(). Listeners won't be notified in case the metadata could not be saved.

Throws:
CoreException - if fails to save the metadata.

setSdkProviderMetaData

void setSdkProviderMetaData(String sdkId,
                            Properties metaData)
                            throws IllegalArgumentException
Set a Properties file of meta data to be associated with an IMTJProject. This meta data is arbitrary vendor-defined data that will be persisted with the project and automatically disposed when a project is deleted.

A example use case is to save project level user preferences associated with a vendor-supplied JAD editor page.

The Properties file is not cloned. The SDK provider may set the Properties files once and continue to make changes to it. Values will be persisted the next time saveMetaData() is called.

Parameters:
sdkId - Unique identifier for the SDK. If meta data associated with the ID is already set, the old meta data is replaced with the new.
metaData - A Properties file of arbitrary vendor-defined values. Passing in null is allowed and will essentially 'erase' the meta data.
Throws:
IllegalArgumentException - if sdkId is null or empty.
Since:
1.1

getSdkProviderMetaData

Properties getSdkProviderMetaData(String sdkId)
                                  throws IllegalArgumentException
Retrieve a Properties file of vendor-specific meta data associated with the IMTJProject.

Parameters:
sdkId - Unique identifier for the SDK.
Returns:
A Properties object of vendor-specific meta data, or null if no such object is associated with the SDK ID.
Throws:
IllegalArgumentException - if sdkId is null or empty.
Since:
1.1

setSignatureProperties

void setSignatureProperties(ISignatureProperties props)
Set the signature properties for using when signing deployable packages generated for this MTJ project.

This method notifies all listeners after setting the signature properties through the invocation of IMTJProjectListener.signaturePropertiesChanged(). Listeners wont be notified in case the signature properties could not be set.

Parameters:
props - the signature properties for use on signing the deployable packages.

Mobile Tools for Java
Release 1.0