Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.ide.compiler
Class Compiler

java.lang.Object
  extended by oracle.ide.compiler.Compiler

public abstract class Compiler
extends java.lang.Object

The Compiler interface provides the API to drive the actual build system.


Field Summary
static java.lang.String COMPILER_GENERATE_CLASSES_DESPITE_ERRORS
          Deprecated. The setting of compiler options is an internal process, exposed through the visual UI.
 
Constructor Summary
Compiler()
           
 
Method Summary
 boolean addBuildSystemListener(BuildSystemListener bsl)
          BuildSystemListeners should be added in a declarative way in an extension.xml file, using code such as:
 boolean addCopyListener(CopyListener cl)
          CopyListeners should be added in a declarative way in an extension.xml file, using code such as:
abstract  void cancelCompileOrClean(Context context)
          Attempt to cancel the current compile/clean if any.
abstract  boolean clean(Context context, boolean throwOnFailedDelete, java.io.OutputStream outStream, java.io.OutputStream errStream)
          Clean the context (may be workspace or project).
abstract  boolean compile(CompileArguments compileArguments)
          Compile one or more targets using the arguments defined in the CompileArguments object.
abstract  boolean compile(Context context, boolean rebuild, boolean wait)
          Deprecated. Use compile(CompileArguments) instead
abstract  boolean compile(Context context, boolean rebuild, boolean wait, boolean save)
          Deprecated. Use compile(CompileArguments) instead
abstract  boolean compile(Context context, boolean rebuild, boolean wait, java.io.OutputStream outStream, java.io.OutputStream errStream)
          Deprecated. Use compile(CompileArguments) instead
abstract  void compile(Context context, boolean rebuild, PostBuilder postBuild, boolean save)
          Deprecated. Use compile(CompileArguments) instead
static Compiler getCompiler()
          Returns the active Compiler instance.
abstract  LogPage getErrorLog()
           
abstract  LogPage getOutputLog()
          get{Output|Error}Log gets the default compiler output/error log.
abstract  boolean isBusy(Context context)
          Determine if the compiler is already busy with a compilation.
abstract  boolean lock(Context context, boolean wait)
          lock/unlock the context (may be project, workspace, file, ...) and return true if the operation was successful.
abstract  void logOutMsg(java.lang.String msg)
          logOutMsg log a message on the default compiler output log
 boolean removeBuildSystemListener(BuildSystemListener bsl)
          removeBuildSystemListener method removes a build system listener instance implementation from the build system, see BuildSystemListener for more information.
 boolean removeCopyListener(CopyListener cl)
          removeCopyListener method removes a copy listener instance implementation from the build system, see CopyListener for more information.
static void setCompiler(Compiler compiler)
          Deprecated. The compiler should be registered in a declarative way, such as:

<trigger-hooks xmlns="http://xmlns.oracle.com/ide/extension">
<triggers>
<singleton-provider-hook>
<singleton base-class="oracle.ide.compiler.Compiler"
impl-class="oracle.jdeveloper.compiler.JCompiler" />
</singleton-provider-hook>
</triggers>
</trigger-hooks>

abstract  boolean unlock(Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPILER_GENERATE_CLASSES_DESPITE_ERRORS

@Deprecated
public static final java.lang.String COMPILER_GENERATE_CLASSES_DESPITE_ERRORS
Deprecated. The setting of compiler options is an internal process, exposed through the visual UI.
The name of the context property used to instruct the compiler to generate classes despite errors. The run system uses this property if the user has specified that they want to be able to run/debug their project even if there were compiler errors. The value of the property is a Boolean. Boolean.TRUE means that the compiler should generate classes despite errors.

See Also:
Constant Field Values
Constructor Detail

Compiler

public Compiler()
Method Detail

getCompiler

public static Compiler getCompiler()
Returns the active Compiler instance.


setCompiler

@Deprecated
public static void setCompiler(Compiler compiler)
Deprecated. The compiler should be registered in a declarative way, such as:

<trigger-hooks xmlns="http://xmlns.oracle.com/ide/extension">
<triggers>
<singleton-provider-hook>
<singleton base-class="oracle.ide.compiler.Compiler"
impl-class="oracle.jdeveloper.compiler.JCompiler" />
</singleton-provider-hook>
</triggers>
</trigger-hooks>

Sets the active Compiler instance.

Parameters:
compiler - The active compiler

compile

public abstract boolean compile(CompileArguments compileArguments)
Compile one or more targets using the arguments defined in the CompileArguments object.

Parameters:
compileArguments - The arguments that define the compilation, which cannot be null.
Returns:
If CompileArguments.waitForTermination() returns true, this method will return true if the compilation succeeded without errors, false otherwise; if CompileArguments.waitForTermination() returns false, this method will return true if the compilation was successfully started, false otherwise
Throws:
java.lang.IllegalArgumentException - if compileArguments is null or if compileArguments.getContext() return null

cancelCompileOrClean

public abstract void cancelCompileOrClean(Context context)
Attempt to cancel the current compile/clean if any. The cancellation is done by interrupting the compile/clean thread if it's still alive, so there is no guarantee when/if the cancellation will actually happen

Parameters:
context - This needs to be the exact same context instance that was either passed into the compile/clean method that started the current compile/clean, or is returned by the CompileArguments instance passed into the compile method that started the current compile. This ensures that only the owner of the current compile/clean can cancel that operation.

compile

@Deprecated
public abstract boolean compile(Context context,
                                           boolean rebuild,
                                           boolean wait,
                                           java.io.OutputStream outStream,
                                           java.io.OutputStream errStream)
Deprecated. Use compile(CompileArguments) instead

compile -- compile the context (may be project, workspace, file, ...) and return true if they are no errors else false. If wait is false, the method will not wait for the compile to terminate and the return value is undefined. Output log information (verbose stuff) is logged to on specified outStream and build system errors/warnings are logged on the specified errStream.

Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
wait - -- if true, wait for compile to terminate
outStream - -- stream where to log all verbose build system messages
errStream - -- stream where to log all translators errors/warnings
Returns:
true if successful (no translator errors), else false

compile

@Deprecated
public abstract boolean compile(Context context,
                                           boolean rebuild,
                                           boolean wait)
Deprecated. Use compile(CompileArguments) instead

compile -- compile the context (may be project, workspace, file, ...) and return true if they are no errors else false. If wait is false, the method will not wait for the compile to terminate and the return value is undefined.

Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
wait - -- if true, wait for compile to terminate
Returns:
true if successful (no translator errors), else false

compile

@Deprecated
public abstract boolean compile(Context context,
                                           boolean rebuild,
                                           boolean wait,
                                           boolean save)
Deprecated. Use compile(CompileArguments) instead

compile -- compile the context (may be project, workspace, file, ...) and return true if they are no errors else false. If wait is false, the method will not wait for the compile to terminate and the return value is undefined.

Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
wait - -- if true, wait for compile to terminate
save - -- if true, will save files before compiling if the IDE setting is enabled; if false, will never save files, regardless of the IDE setting. The compile method without the save parameter will never save files.
Returns:
true if successful (no translator errors), else false

compile

@Deprecated
public abstract void compile(Context context,
                                        boolean rebuild,
                                        PostBuilder postBuild,
                                        boolean save)
Deprecated. Use compile(CompileArguments) instead

compile -- compile the context (may be project, workspace, file, ...) on a background thread and call the specified worker object once compilation is completed with build successful or not as the postBuild method input parameter.

Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
postBuild - --method postBuild will be called once the build is completed
save - -- if true, will save files before compiling if the IDE setting is enabled; if false, will never save files, regardless of the IDE setting. The compile method without the save parameter will never save files.

clean

public abstract boolean clean(Context context,
                              boolean throwOnFailedDelete,
                              java.io.OutputStream outStream,
                              java.io.OutputStream errStream)
                       throws java.io.IOException
Clean the context (may be workspace or project). Cleaning is done in an auto-safe manner, meaning the cleaning will not require any user interaction, and if anything element is unclear or ambiguous, such as trying to clean the directory 'classes', and there is no directory 'classes' but there IS a file called 'classes', the cleaning of that element is skipped.

Parameters:
context - -- workspace or project to clean
throwOnFailedDelete - -- if true, throw an IOException if delete on any file or directory fails
outStream - -- stream where to log any verbose system message; if null, stdout will be used
errStream - -- stream where to log any error/warning; if null, stderr will be used
Returns:
true if the context was cleaned, false otherwise
Throws:
java.io.IOException - if throwOnDeleteFailure is true and delete on any file or directory fails

isBusy

public abstract boolean isBusy(Context context)
Determine if the compiler is already busy with a compilation.

Parameters:
context - -- workspace, project or file
Returns:
true if the compiler is busy with a compilation, false otherwise.

lock

public abstract boolean lock(Context context,
                             boolean wait)
lock/unlock the context (may be project, workspace, file, ...) and return true if the operation was successful. If wait is false, the method will not wait for the context to be locked and return false if the context can't be lock else if wait is true, the context compilation will complete before returning true

Parameters:
context - -- workspace, project or file to lock/unlock
wait - -- if true, wait for compilation to terminate
Returns:
true if successful else false

unlock

public abstract boolean unlock(Context context)

addBuildSystemListener

public boolean addBuildSystemListener(BuildSystemListener bsl)
BuildSystemListeners should be added in a declarative way in an extension.xml file, using code such as:

<ide-buildsystem-hook xmlns="http://xmlns.oracle.com/ide/extension">
<buildsystem-listener class-name="oracle.jdevimpl.listener.MyListener" >
<tech-scope>
<and>
<key>Java</key>
<key>Ant</key>
</and>
</tech-scope>
</buildsystem-listener>
</ide-buildsystem-hook>

addBuildSystemListener method adds a build system listener instance implementation to the build system, see BuildSystemListener for more information.

Parameters:
bsl - build system listener to add
Returns:
true if properly added, false if the specified bsl had already been added before, or cannot be added

removeBuildSystemListener

public boolean removeBuildSystemListener(BuildSystemListener bsl)
removeBuildSystemListener method removes a build system listener instance implementation from the build system, see BuildSystemListener for more information.

Parameters:
bsl - build system listener to remove
Returns:
true if properly removed, false if the specified bsl is not found

addCopyListener

public boolean addCopyListener(CopyListener cl)
CopyListeners should be added in a declarative way in an extension.xml file, using code such as:

<ide-buildsystem-hook xmlns="http://xmlns.oracle.com/ide/extension">
<copy-listener class-name="oracle.jdevimpl.listener.MyListener" >
<tech-scope>
<or>
<key>Java</key>
</or>
</tech-scope>
</copy-listener>
</ide-buildsystem-hook>

addCopyListener method adds a copy listener instance implementation to the build system, see CopyListener for more information.

Parameters:
cl - copy listener to add
Returns:
true if properly added, false if the specified cl had already been added before, or cannot be added

removeCopyListener

public boolean removeCopyListener(CopyListener cl)
removeCopyListener method removes a copy listener instance implementation from the build system, see CopyListener for more information.

Parameters:
cl - copy listener to remove
Returns:
true if properly removed, false if the specified cl is not found

getOutputLog

public abstract LogPage getOutputLog()
get{Output|Error}Log gets the default compiler output/error log.

Returns:
the default LogPage

getErrorLog

public abstract LogPage getErrorLog()

logOutMsg

public abstract void logOutMsg(java.lang.String msg)
logOutMsg log a message on the default compiler output log

Parameters:
msg - -- msg to print on the log

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.