Package apple.foundation
Class NSXPCConnection
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.foundation.NSXPCConnection
-
- All Implemented Interfaces:
NSXPCProxyCreating,NSObject
public class NSXPCConnection extends NSObject implements NSXPCProxyCreating
This object is the main configuration mechanism for the communication between two processes. Each NSXPCConnection instance has a private serial queue. This queue is used when sending messages to reply handlers, interruption handlers, and invalidation handlers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNSXPCConnection.Block_interruptionHandler_retstatic interfaceNSXPCConnection.Block_invalidationHandler_retstatic interfaceNSXPCConnection.Block_scheduleSendBarrierBlockstatic interfaceNSXPCConnection.Block_setInterruptionHandlerstatic interfaceNSXPCConnection.Block_setInvalidationHandler-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
Nested classes/interfaces inherited from interface apple.foundation.protocol.NSXPCProxyCreating
NSXPCProxyCreating.Block_remoteObjectProxyWithErrorHandler, NSXPCProxyCreating.Block_synchronousRemoteObjectProxyWithErrorHandler
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNSXPCConnection(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static NSXPCConnectionalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)intauditSessionIdentifier()These attributes describe the security attributes of the connection.static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static NSXPCConnectioncurrentConnection()Get the current connection, in the context of a call to a method on your exported object.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()inteffectiveGroupIdentifier()inteffectiveUserIdentifier()NSXPCListenerEndpointendpoint()NSXPCInterfaceexportedInterface()The interface that describes messages that are allowed to be received by the exported object on this connection.java.lang.ObjectexportedObject()Set an exported object for the connection.static longhash_static()NSXPCConnectioninit()NSXPCConnectioninitWithListenerEndpoint(NSXPCListenerEndpoint endpoint)Initialize an NSXPCConnection that will connect to an NSXPCListener (identified by its NSXPCListenerEndpoint).static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)NSXPCConnection.Block_interruptionHandler_retinterruptionHandler()The interruption handler will be called if the remote process exits or crashes.voidinvalidate()Invalidate the connection.NSXPCConnection.Block_invalidationHandler_retinvalidationHandler()The invalidation handler will be called if the connection can not be formed or the connection has terminated and may not be re-established.static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)static java.lang.Objectnew_objc()intprocessIdentifier()NSXPCInterfaceremoteObjectInterface()The interface that describes messages that are allowed to be received by object that has been "imported" to this connection (exported from the other side).java.lang.ObjectremoteObjectProxy()Returns a proxy object with no error handling block.java.lang.ObjectremoteObjectProxyWithErrorHandler(NSXPCProxyCreating.Block_remoteObjectProxyWithErrorHandler handler)Returns a proxy object which will invoke the error handling block if an error occurs on the connection.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidresume()All connections start suspended.voidscheduleSendBarrierBlock(NSXPCConnection.Block_scheduleSendBarrierBlock block)Add a barrier block to be executed on the connection.java.lang.StringserviceName()voidsetExportedInterface(NSXPCInterface value)The interface that describes messages that are allowed to be received by the exported object on this connection.voidsetExportedObject(java.lang.Object value)Set an exported object for the connection.voidsetInterruptionHandler(NSXPCConnection.Block_setInterruptionHandler value)The interruption handler will be called if the remote process exits or crashes.voidsetInvalidationHandler(NSXPCConnection.Block_setInvalidationHandler value)The invalidation handler will be called if the connection can not be formed or the connection has terminated and may not be re-established.voidsetRemoteObjectInterface(NSXPCInterface value)The interface that describes messages that are allowed to be received by object that has been "imported" to this connection (exported from the other side).static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()voidsuspend()Suspend the connection.java.lang.ObjectsynchronousRemoteObjectProxyWithErrorHandler(NSXPCProxyCreating.Block_synchronousRemoteObjectProxyWithErrorHandler handler)Make a synchronous IPC call instead of the default async behavior.static longversion_static()-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static NSXPCConnection alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
auditSessionIdentifier
public int auditSessionIdentifier()
These attributes describe the security attributes of the connection. They may be used by the listener delegate to accept or reject connections.
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
effectiveGroupIdentifier
public int effectiveGroupIdentifier()
-
effectiveUserIdentifier
public int effectiveUserIdentifier()
-
endpoint
public NSXPCListenerEndpoint endpoint()
-
exportedInterface
public NSXPCInterface exportedInterface()
The interface that describes messages that are allowed to be received by the exported object on this connection. This value is required if a exported object is set.
-
exportedObject
public java.lang.Object exportedObject()
Set an exported object for the connection. Messages sent to the remoteObjectProxy from the other side of the connection will be dispatched to this object. Messages delivered to exported objects are serialized and sent on a non-main queue. The receiver is responsible for handling the messages on a different queue or thread if it is required.
-
hash_static
public static long hash_static()
-
init
public NSXPCConnection init()
-
initWithListenerEndpoint
public NSXPCConnection initWithListenerEndpoint(NSXPCListenerEndpoint endpoint)
Initialize an NSXPCConnection that will connect to an NSXPCListener (identified by its NSXPCListenerEndpoint).
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
interruptionHandler
public NSXPCConnection.Block_interruptionHandler_ret interruptionHandler()
The interruption handler will be called if the remote process exits or crashes. It may be possible to re-establish the connection by simply sending another message. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. The interruptionHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
-
invalidate
public void invalidate()
Invalidate the connection. All outstanding error handling blocks and invalidation blocks will be called on the message handling queue. The connection must be invalidated before it is deallocated. After a connection is invalidated, no more messages may be sent or received.
-
invalidationHandler
public NSXPCConnection.Block_invalidationHandler_ret invalidationHandler()
The invalidation handler will be called if the connection can not be formed or the connection has terminated and may not be re-established. The invalidation handler will also be called if a connection created with an NSXPCListenerEndpoint is invalidated from the remote side, or if the NSXPCListener used to create that endpoint is invalidated. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. You may not send messages over the connection from within an invalidation handler block. The invalidationHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
keyPathsForValuesAffectingValueForKey
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
new_objc
public static java.lang.Object new_objc()
-
processIdentifier
public int processIdentifier()
-
remoteObjectInterface
public NSXPCInterface remoteObjectInterface()
The interface that describes messages that are allowed to be received by object that has been "imported" to this connection (exported from the other side). This value is required if messages are sent over this connection.
-
remoteObjectProxy
public java.lang.Object remoteObjectProxy()
Description copied from interface:NSXPCProxyCreatingReturns a proxy object with no error handling block. Messages sent to the proxy object will be sent over the wire to the other side of the connection. All messages must be 'oneway void' return type. Control may be returned to the caller before the message is sent. This proxy object will conform with the NSXPCProxyCreating protocol.- Specified by:
remoteObjectProxyin interfaceNSXPCProxyCreating
-
remoteObjectProxyWithErrorHandler
public java.lang.Object remoteObjectProxyWithErrorHandler(NSXPCProxyCreating.Block_remoteObjectProxyWithErrorHandler handler)
Description copied from interface:NSXPCProxyCreatingReturns a proxy object which will invoke the error handling block if an error occurs on the connection. If the message sent to the proxy has a reply handler, then either the error handler or the reply handler will be called exactly once. This proxy object will also conform with the NSXPCProxyCreating protocol.- Specified by:
remoteObjectProxyWithErrorHandlerin interfaceNSXPCProxyCreating
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
resume
public void resume()
All connections start suspended. You must resume them before they will start processing received messages or sending messages through the remoteObjectProxy. Note: Calling resume does not immediately launch the XPC service. The service will be started on demand when the first message is sent. However, if the name specified when creating the connection is determined to be invalid, your invalidation handler will be called immediately (and asynchronously) after calling resume.
-
serviceName
public java.lang.String serviceName()
-
setExportedInterface
public void setExportedInterface(NSXPCInterface value)
The interface that describes messages that are allowed to be received by the exported object on this connection. This value is required if a exported object is set.
-
setExportedObject
public void setExportedObject(java.lang.Object value)
Set an exported object for the connection. Messages sent to the remoteObjectProxy from the other side of the connection will be dispatched to this object. Messages delivered to exported objects are serialized and sent on a non-main queue. The receiver is responsible for handling the messages on a different queue or thread if it is required.
-
setInterruptionHandler
public void setInterruptionHandler(NSXPCConnection.Block_setInterruptionHandler value)
The interruption handler will be called if the remote process exits or crashes. It may be possible to re-establish the connection by simply sending another message. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. The interruptionHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
-
setInvalidationHandler
public void setInvalidationHandler(NSXPCConnection.Block_setInvalidationHandler value)
The invalidation handler will be called if the connection can not be formed or the connection has terminated and may not be re-established. The invalidation handler will also be called if a connection created with an NSXPCListenerEndpoint is invalidated from the remote side, or if the NSXPCListener used to create that endpoint is invalidated. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. You may not send messages over the connection from within an invalidation handler block. The invalidationHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
-
setRemoteObjectInterface
public void setRemoteObjectInterface(NSXPCInterface value)
The interface that describes messages that are allowed to be received by object that has been "imported" to this connection (exported from the other side). This value is required if messages are sent over this connection.
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
suspend
public void suspend()
Suspend the connection. Suspends must be balanced with resumes before the connection may be invalidated.
-
synchronousRemoteObjectProxyWithErrorHandler
public java.lang.Object synchronousRemoteObjectProxyWithErrorHandler(NSXPCProxyCreating.Block_synchronousRemoteObjectProxyWithErrorHandler handler)
Description copied from interface:NSXPCProxyCreatingMake a synchronous IPC call instead of the default async behavior. The error handler block and reply block will be invoked on the calling thread before the message to the proxy returns, instead of on the queue for the connection.- Specified by:
synchronousRemoteObjectProxyWithErrorHandlerin interfaceNSXPCProxyCreating
-
version_static
public static long version_static()
-
currentConnection
public static NSXPCConnection currentConnection()
Get the current connection, in the context of a call to a method on your exported object. Useful for determining 'who called this'.
-
scheduleSendBarrierBlock
public void scheduleSendBarrierBlock(NSXPCConnection.Block_scheduleSendBarrierBlock block)
Add a barrier block to be executed on the connection. This barrier block will run after any outstanding sends have completed. Note: This does not guarantee that messages will be received by the remote process by the time the block is invoked. If you need to ensure receipt of a message by the remote process, waiting for a reply to come back is the best option.
-
-