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 class
A dispatch object to help facilitate asychronous script execution (from the main thread) in a more predictable fashion. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Class
private Class
<?> private Class
<?> private Class
<?> protected static final String
The path the Cocoa-Java class files are located atprotected AEMonitor
private static final String
protected boolean
private int
Main NSAutoreleasePoolprivate Method
private Method
private Method
private Method
private Method
private String
private static final String
protected CocoaJavaBridge.RunnableDispatcher
private AEMonitor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
dispose()
Disposes system resourcesprotected final Object
executeScript
(String scriptFormat, Object[] params) Executes a new instance of NSAppleScriptprotected final Object
executeScriptWithAsync
(String scriptFormat, Object[] params) Asynchronously executes a new instance of NSAppleScriptprotected final Object
executeScriptWithNewThread
(String scriptFormat, Object[] params) Executes a new instance of NSAppleScript in a forked AEThreadprotected void
finalize()
protected boolean
Gets whether the invocation bridge is available for useprivate void
logWarning
(String message) Logs a warning message to Logger.private Object
private Object
private Object
NSAppleScript_execute
(Object NSAppleScript, Object NSMutableDictionary) private void
NSAutoreleasePool_pop
(int i) private int
private Object
NSMutableDictionary_objectForKey
(Object NSMutableDictionary, String s) protected boolean
protected boolean
showInFinder
(File path, String fileBrowserApp) Methods inherited from class com.biglybt.platform.macosx.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
- Throws:
Throwable
-
-
Method Details
-
NSAutoreleasePool_push
- Throws:
Throwable
-
NSAutoreleasePool_pop
- Throws:
Throwable
-
new_NSAppleScript
- Throws:
Throwable
-
NSAppleScript_execute
private Object NSAppleScript_execute(Object NSAppleScript, Object NSMutableDictionary) throws Throwable - Throws:
Throwable
-
new_NSMutableDictionary
- Throws:
Throwable
-
NSMutableDictionary_objectForKey
private Object NSMutableDictionary_objectForKey(Object NSMutableDictionary, String s) throws Throwable - Throws:
Throwable
-
performRecoverableFileDelete
- Overrides:
performRecoverableFileDelete
in classNativeInvocationBridge
- See Also:
-
showInFinder
- Overrides:
showInFinder
in 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:
isEnabled
in 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:
InvocationTargetException
IllegalAccessException
IllegalArgumentException
- 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:
InvocationTargetException
IllegalAccessException
IllegalArgumentException
- 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:
dispose
in classNativeInvocationBridge
-
finalize
-