Class org.as2lib.io.conn.local.client.LocalClientServiceProxyFactory

org.as2lib.core.BasicClass
   +--org.as2lib.io.conn.core.client.AbstractClientServiceProxyFactory
      +--org.as2lib.io.conn.local.client.LocalClientServiceProxyFactory

Implemented Interfaces

ClientServiceProxyFactory

Description

LocalClientServiceProxyFactory acts as central provider of client service proxies.

This provision is in the simplest case just the returning of a new client service proxy. var clientFactory:LocalClientServiceProxyFactory = new LocalClientServiceProxyFactory(); var client:ClientServiceProxy = clientFactory.getClientServiceProxy("local.as2lib.org/myService");

In a more complex case this means creating a client service proxy for a specific type, mostly an interface, that is the same type of the 'remote' service. var clientFactory:LocalClientServiceProxyFactory = new LocalClientServiceProxyFactory(); var client:MyType = clientFactory.getClientServiceProxy("local.as2lib.org/myService", MyType); client.myMethod("myArg1", "myArg2");

There is sadly one flaw with the last type of usage. That is that the method cannot response directly due to the asynchronity of the call. To get a response you therefore have to pass a third argument of type MethodInvocationCallback. var clientFactory:LocalClientServiceProxyFactory = new LocalClientServiceProxyFactory(); var client:MyType = clientFactory.getClientServiceProxy("local.as2lib.org/myService", MyType); var callback:MethodInvocationCallback = new MethodInvocationCallback(); client.myMethod("myArg1", "myArg2", callback); callback.onReturn = function(returnInfo:MethodInvocationReturnInfo):Void { trace("myMethod - return value: " + returnInfo.getReturnValue()); } callback.onError = function(errorInfo:MethodInvocationErrorInfo):Void { trace("myMethod - error: " + errorInfo.getException()); }

Method Index

new LocalClientServiceProxyFactory()

getClientServiceProxyByUrl(), getClientServiceProxyByUrlAndType(), getClientServiceProxyFactory(), getTypeProxyFactory(), setClientServiceProxyFactory(), setTypeProxyFactory()

Inherited from AbstractClientServiceProxyFactory

getClientServiceProxy()

Inherited from BasicClass

toString()

Constructor Detail

LocalClientServiceProxyFactory

public function LocalClientServiceProxyFactory(Void)

Constructs a new LocalClientServiceProxyFactory instance.

Method Detail

getTypeProxyFactory

public function getTypeProxyFactory(Void):ProxyFactory

Returns the currently used type proxy factory that is used to create proxies for a specific type.

That is either the proxy factory set via setTypeProxyFactory or the default one, which is an instance of type InterfaceProxyFactory.

The default InterfaceProxyFactory can only be used to create proxies of interfaces.

Return

the currently used type proxy factory

setTypeProxyFactory

public function setTypeProxyFactory(typeServiceProxyFactory:ProxyFactory):Void

Sets the new type proxy factory that is used to create proxies for a specific type.

If you set a type proxy factory of value null, getTypeProxyFactory will return the default factory.

Parameters

getClientServiceProxyFactory

public function getClientServiceProxyFactory(Void):ClientServiceProxyFactory

Returns the client service proxy factory used to create client service proxy instances.

The returned factory is either the one set via setClientServiceProxyFactory or the default one which is an instance of SimpleClientServiceProxyFactory.

Return

the currently used client service proxy factory

setClientServiceProxyFactory

public function setClientServiceProxyFactory(clientServiceProxyFactory:ClientServiceProxyFactory):Void

Sets a new client service proxy factory used to get client service proxy instances.

If you set a new factory of value null or undefined getClientServiceProxyFactory will return the default factory.

Parameters

clientServiceProxyFactorythe new client service proxy factory

getClientServiceProxyByUrl

public function getClientServiceProxyByUrl(url:String):ClientServiceProxy

Returns a client service proxy for the service specified by the passed-in url.

You can use the returned proxy to invoke methods on the 'remote' service and to handle responses.

Parameters

urlthe url of the 'remote' service

Return

a client service proxy to invoke methods on the 'remote' service

Specified By

getClientServiceProxyByUrl() in org.as2lib.io.conn.core.client.ClientServiceProxyFactory

getClientServiceProxyByUrlAndType

public function getClientServiceProxyByUrlAndType(url:String, type:Function)

Returns a client service proxy that can be typed to the passed-in type (class or interface).

The type is therefore normally the type of the 'remote' service you wanna invoke methods on.

If type is null, an instance of type ClientServiceProxy will be returned. That means this method will then do the same as the getClientServiceProxyByUrl method.

Note that with the default configuration only interfaces can be used as type. You can edit this behavior through the setTypeProxyFactory. method.

Parameters

urlthe url of the 'remote' service
typethe type of the 'remote' service

Return

a client service proxy that can be casted to the passed-in type

Specified By

getClientServiceProxyByUrlAndType() in org.as2lib.io.conn.core.client.ClientServiceProxyFactory

Overrides

getClientServiceProxyByUrlAndType() in org.as2lib.io.conn.core.client.AbstractClientServiceProxyFactory