The GDCliProxyConnector wraps up the distributed object (NSDistantObject) logic, needed to connect to a registered application and give you back the root proxy. More...
#import <GDCliProxyConnector.h>
Public Member Functions | |
| (NSDistantObject *) | - getDistantObjectInApplication:withConnectionName:andLaunchAppIfNotAvailable: |
| Get an NSDistantObject from a connection name. | |
| (void) | - setDistantProtocol: |
| Set the protocol on the NSDistantObject. | |
| (NSDistantObject *) | - connectWithName: |
| [internal]. | |
Protected Attributes | |
| Protocol * | distantProtocol |
| The NSDistantObjects' protocol. | |
The GDCliProxyConnector wraps up the distributed object (NSDistantObject) logic, needed to connect to a registered application and give you back the root proxy.
This class is used inside of a commandline tool to connect to a GDCliProxy and call methods that it exposes.
Example usage:
//mytool.m: #import "GDCliProxyConnector.m" void main(int argc, char * argv[]) { NSAutoReleasePool * pool = [[NSAutoReleasePool alloc] init]; GDCliProxyConnector * connector = [[[GDCliProxyConnector alloc] init]; [connector setDistantProtocol:@protocol(MyProtocol)]; //get the distant object. this will launch the application if the //connection is not available, and keep trying to connect. //it will attempt 50 connections. NSDistantObject * proxy = [connector getDistantObjectInApplication:@"com.mycompany.MyApplication" withConnectionName:@"cliConnection" andLaunchAppIfNotAvailable:true]; //call a method on the distant object to do something //from within your application. [proxy myMethod]; [pool drain]; }
| - (NSDistantObject *) getDistantObjectInApplication: | (NSString *) | _bundleIdentifier | ||
| withConnectionName: | (NSString *) | _connectionName | ||
| andLaunchAppIfNotAvailable: | (BOOL) | _launch | ||
Get an NSDistantObject from a connection name.
If the connection is not available the application will be launched, and 50 connection attempt will be made after it's launched or the distant object will be returned if it's connected sooner.
This returns nil after all attempts to connect to the object have been exhausted.
| _bundleIdentifier | The application's bundle identifier. | |
| _connectionName | The connection name used to connect a GDCliProxy. | |
| _launch | Whether or not to launch the application if no connection can be made. |
| - (void) setDistantProtocol: | (id) | _protocol |
Set the protocol on the NSDistantObject.
| _protocol | The protocol. |