Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.model.preverifier.impl
Class StandardPreverifier

java.lang.Object
  extended by org.eclipse.mtj.core.model.preverifier.impl.StandardPreverifier
All Implemented Interfaces:
IPreverifier, IPersistable

public class StandardPreverifier
extends Object
implements IPreverifier

A standard preverifier implementation. This preverifier requires the pre-verification binary and the available CLDC parameters to be specified. Once created, the preverifier may be stored and retrieved using the standard persistence mechanism.


Field Summary
 
Fields inherited from interface org.eclipse.mtj.core.model.preverifier.IPreverifier
BUILD_ARG_PREVERIFY_CLASSES, BUILD_ARG_PREVERIFY_LIBS, BUILD_ARG_PREVERIFY_TARGET, PREVERIFY_TARGET_PROJECT
 
Constructor Summary
StandardPreverifier()
           
 
Method Summary
static String extractClassName(IJavaProject javaProject, IResource resource)
          Extract the class name from the specified IResource within the specified java project.
static IPath extractResourcePath(IJavaProject javaProject, IResource resource)
          Extract the class path from the specified IResource within the specified java project.
protected  String[] getCLDCConfigurationParameters(IMidletSuiteProject midletProject)
          Return the parameters to be used for controlling the CLDC pre-verification.
 StandardPreverifierParameters getParameters()
           
 File getPreverifierExecutable()
           
protected  void handleErrorReceived(String text, List<PreverificationError> errorList)
          Handle the arrival of text on the error stream.
protected  boolean isCLDC1_0(Version configVersion)
          Return a boolean indicating whether the specified configuration is a 1.0 CLDC config.
 void loadUsing(IPersistenceProvider persistenceProvider)
          Load the state of this object using the specified persistence state information.
 PreverificationError[] preverify(IMidletSuiteProject midletProject, IResource[] toVerify, IFolder outputFolder, IProgressMonitor monitor)
          Launch the preverification process on the specified resources.
 PreverificationError[] preverifyJarFile(IMidletSuiteProject midletProject, File jarFile, IFolder outputFolder, IProgressMonitor monitor)
          Launch the preverification process on the specified jar file.
protected  PreverificationError[] runPreverifier(String[] commandLine, String[] environment, IProgressMonitor monitor)
          Run the preverifier program and capture the errors that occurred during pre-verification.
 void setParameters(StandardPreverifierParameters parameters)
           
 void setPreverifierExecutable(File preverifierExecutable)
           
 void storeUsing(IPersistenceProvider persistenceProvider)
          Save the state of this object using the specified persistence state information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardPreverifier

public StandardPreverifier()
Method Detail

extractClassName

public static String extractClassName(IJavaProject javaProject,
                                      IResource resource)
                               throws JavaModelException
Extract the class name from the specified IResource within the specified java project.

Parameters:
javaProject - the java project to provide the relative name
resource - the resource to extract a class name
Returns:
the class name or null if the resource name cannot be converted for some reason.
Throws:
JavaModelException

extractResourcePath

public static IPath extractResourcePath(IJavaProject javaProject,
                                        IResource resource)
                                 throws JavaModelException
Extract the class path from the specified IResource within the specified java project.

Parameters:
javaProject -
resource -
Returns:
the extracted resource path
Throws:
JavaModelException

loadUsing

public void loadUsing(IPersistenceProvider persistenceProvider)
               throws PersistenceException
Description copied from interface: IPersistable
Load the state of this object using the specified persistence state information.

Specified by:
loadUsing in interface IPersistable
Throws:
PersistenceException
See Also:
IPersistable.loadUsing(org.eclipse.mtj.core.persistence.IPersistenceProvider)

preverify

public PreverificationError[] preverify(IMidletSuiteProject midletProject,
                                        IResource[] toVerify,
                                        IFolder outputFolder,
                                        IProgressMonitor monitor)
                                 throws CoreException,
                                        IOException
Description copied from interface: IPreverifier
Launch the preverification process on the specified resources.

Specified by:
preverify in interface IPreverifier
Parameters:
midletProject - The project in which the resources to be pre-verified reside.
toVerify - The resources to be pre-verified.
outputFolder - The folder into which the output is to be placed.
monitor - Progress monitor
Returns:
An array of preverification error instances.
Throws:
CoreException
IOException
See Also:
org.eclipse.mtj.core.model.preverifier.IPreverifier#preverify(org.eclipse.mtj.core.model.project.IMidletSuiteProject, org.eclipse.core.resources.IResource[], org.eclipse.core.resources.IFolder, org.eclipse.core.runtime.IProgressMonitor)

preverifyJarFile

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

Specified by:
preverifyJarFile in interface IPreverifier
Parameters:
midletProject - The project in which the resources to be pre-verified reside.
jarFile - The jar file to be pre-verified.
outputFolder - The folder into which the output is to be placed.
monitor - Progress monitor
Returns:
An array of preverification error instances.
Throws:
CoreException
IOException
See Also:
org.eclipse.mtj.core.model.preverifier.IPreverifier#preverifyJarFile(org.eclipse.mtj.core.model.project.IMidletSuiteProject, java.io.File, org.eclipse.core.resources.IFolder, org.eclipse.core.runtime.IProgressMonitor)

getParameters

public StandardPreverifierParameters getParameters()
Returns:
Returns the parameters.

getPreverifierExecutable

public File getPreverifierExecutable()
Returns:
Returns the preverifierExecutable.

setParameters

public void setParameters(StandardPreverifierParameters parameters)
Parameters:
parameters - The parameters to set.

setPreverifierExecutable

public void setPreverifierExecutable(File preverifierExecutable)
Parameters:
preverifierExecutable - The preverifierExecutable to set.

storeUsing

public void storeUsing(IPersistenceProvider persistenceProvider)
                throws PersistenceException
Description copied from interface: IPersistable
Save the state of this object using the specified persistence state information.

Specified by:
storeUsing in interface IPersistable
Throws:
PersistenceException
See Also:
IPersistable.storeUsing(org.eclipse.mtj.core.persistence.IPersistenceProvider)

getCLDCConfigurationParameters

protected String[] getCLDCConfigurationParameters(IMidletSuiteProject midletProject)
                                           throws CoreException
Return the parameters to be used for controlling the CLDC pre-verification.

Parameters:
midletProject -
Returns:
Throws:
CoreException - if an error occurs working with the MIDlet project.

isCLDC1_0

protected boolean isCLDC1_0(Version configVersion)
Return a boolean indicating whether the specified configuration is a 1.0 CLDC config.

Parameters:
configSpec -
Returns:

runPreverifier

protected PreverificationError[] runPreverifier(String[] commandLine,
                                                String[] environment,
                                                IProgressMonitor monitor)
                                         throws CoreException
Run the preverifier program and capture the errors that occurred during pre-verification.

Parameters:
commandLine -
environment -
Throws:
CoreException

handleErrorReceived

protected void handleErrorReceived(String text,
                                   List<PreverificationError> errorList)
Handle the arrival of text on the error stream.

Parameters:
text -
errorList -

Mobile Tools for Java
Release 1.0