Class CocoaJavaBridge
Performs PlatformManager tasks using Cocoa-Java (FoundationKit only)
For now, operations are performed using NSAppleScript, rather than using NSWorkspace. This is still significantly faster than calling the cmd-line osascript.
- Version:
- 2.1 Apr 2, 2005
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA dispatch object to help facilitate asychronous script execution (from the main thread) in a more predictable fashion. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Classprivate Class<?> private Class<?> private Class<?> protected static final StringThe path the Cocoa-Java class files are located atprotected AEMonitorprivate static final Stringprotected booleanprivate intMain NSAutoreleasePoolprivate Methodprivate Methodprivate Methodprivate Methodprivate Methodprivate Stringprivate static final Stringprotected CocoaJavaBridge.RunnableDispatcherprivate AEMonitor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddispose()Disposes system resourcesprotected final ObjectexecuteScript(String scriptFormat, Object[] params) Executes a new instance of NSAppleScriptprotected final ObjectexecuteScriptWithAsync(String scriptFormat, Object[] params) Asynchronously executes a new instance of NSAppleScriptprotected final ObjectexecuteScriptWithNewThread(String scriptFormat, Object[] params) Executes a new instance of NSAppleScript in a forked AEThreadprotected voidfinalize()protected booleanGets whether the invocation bridge is available for useprivate voidlogWarning(String message) Logs a warning message to Logger.private Objectprivate Objectprivate ObjectNSAppleScript_execute(Object NSAppleScript, Object NSMutableDictionary) private voidNSAutoreleasePool_pop(int i) private intprivate ObjectNSMutableDictionary_objectForKey(Object NSMutableDictionary, String s) protected booleanprotected booleanshowInFinder(File path, String fileBrowserApp) Methods inherited from class NativeInvocationBridge
hasSharedInstance, sharedInstance
-
Field Details
-
CLASS_PATH
The path the Cocoa-Java class files are located at- See Also:
-
REVEAL_SCRIPT_FORMAT
- See Also:
-
DEL_SCRIPT_FORMAT
- See Also:
-
mainPool
private int mainPoolMain NSAutoreleasePool -
classMon
-
scriptMon
-
isDisposed
protected boolean isDisposed -
scriptDispatcher
-
claNSAppleEventDescriptor
-
claNSAutoreleasePool
-
methPush
-
methPop
-
methNSAppleEventDescriptor_descriptorWithBoolean
-
claNSAppleScript
-
claNSMutableDictionary
-
methNSAppleScript_execute
-
NSAppleScript_AppleScriptErrorMessage
-
methNSMutableDictionary_objectForKey
-
-
Constructor Details
-
CocoaJavaBridge
-
-
Method Details
-
NSAutoreleasePool_push
-
NSAutoreleasePool_pop
-
new_NSAppleScript
-
NSAppleScript_execute
-
new_NSMutableDictionary
-
NSMutableDictionary_objectForKey
-
performRecoverableFileDelete
- Overrides:
performRecoverableFileDeletein classNativeInvocationBridge- See Also:
-
showInFinder
- Overrides:
showInFinderin classNativeInvocationBridge- See Also:
-
isEnabled
protected boolean isEnabled()Gets whether the invocation bridge is available for use
This method is used to anticipate scenarios such as where the bridge will fail due to missing classpaths
- Specified by:
isEnabledin classNativeInvocationBridge
-
executeScript
Executes a new instance of NSAppleScript
The method is wrapped in an autorelease pool and an AEMonitor. If there are no format parameters, MessageFormat is not used to parse the format string, and the format string will be treated as the source itself.
- Throws:
Throwable- See Also:
-
executeScriptWithNewThread
protected final Object executeScriptWithNewThread(String scriptFormat, Object[] params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Executes a new instance of NSAppleScript in a forked AEThread
This method always returns a "true" event descriptor. Callbacks are currently unsupported , so in the event of an error, the logger is autuomatically notified.
The thread's runSupport method is wrapped in an autorelease pool. If there are no format parameters, MessageFormat is not used to parse the format string, and the format string will be treated as the source itself.
- Returns:
- NSAppleEventDescriptor.descriptorWithBoolean(true)
- Throws:
InvocationTargetExceptionIllegalAccessExceptionIllegalArgumentException- See Also:
-
executeScriptWithAsync
protected final Object executeScriptWithAsync(String scriptFormat, Object[] params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException Asynchronously executes a new instance of NSAppleScript
This method always returns a "true" event descriptor. Callbacks are currently unsupported , so in the event of an error, the logger is autuomatically notified.
The thread's runSupport method is wrapped in an autorelease pool. If there are no format parameters, MessageFormat is not used to parse the format string, and the format string will be treated as the source itself.
- Returns:
- NSAppleEventDescriptor.descriptorWithBoolean(true)
- Throws:
InvocationTargetExceptionIllegalAccessExceptionIllegalArgumentException- See Also:
-
logWarning
Logs a warning message to Logger. The class monitor is used.- Parameters:
message- A warning message
-
dispose
protected void dispose()Disposes system resources- Overrides:
disposein classNativeInvocationBridge
-
finalize
-