mandala.rami
Class Framework

java.lang.Object
  extended bymandala.rami.Framework

public abstract class Framework
extends java.lang.Object

This class is the starting point in RAMI.

This class helps the end-user to

Getting a total transparent asynchronous proxy on an object is provided by the getTotalTransparentAsynchronousProxy(Object) method:

   MyInterface object = myLibrary.getOneMyInterfaceInstance();
   MyInterface proxy = (MyInterface) 
       Framework.getTotalTransparentAsynchronousProxy(object);

   Result result = proxy.myMethod(); // Total-transparent asynchronous call

   doSomethingElse();   // Concurrent execution with 'myMethod()'

   result.method(); // Wait-by-necessity mechanism
   
Whereas this mechanism seems to be the easiest one, it has some problems and constraints. See the limitations for details.

The prefered way to deal with asynchronous method invocation is using semi transparent asynchronous proxies.

Getting a semi transparent asynchronous proxy on an object is provided by the getSemiTransparentAsynchronousProxy(Object) method:

   myPackage.MyClass object = myLibrary.getOneMyClassInstance();
   jaya.myPackage.MyClass proxy = (jaya.myPackage.MyClass) 
       Framework.getSemiTransparentAsynchronousProxy(object);

   FutureClient future = proxy.rami_myMethod(); // Semi-transparent asynchronous call

   doSomethingElse();   // Concurrent execution with 'myMethod()'

   Result result;
   try{
       result = future.waitForResult();
   }catch(Throwable t) {
       // An exception occured during the execution of 'myMethod()'
       result = handleException(t);
   }

    result.method(); // Use the result 
   

Note that you must have compiled a semi-transparent proxy using the JayaCompiler. See mandala.rami.transparency.semi for details.

To Customize the creation of asynchronous references, you use the setFactory(Framework.Factory) method and specify the factory to be used such as in the following code:

   Framework.setFactory(new Framework.Factory() {
        AsynchronousReference getInstance(Object object) {
            return SpecialAsynchronousReference.getInstance(object);
        };
   

The default factory used is an instance of ARFactory instance.

Version:
1.0
Author:
eipi

Nested Class Summary
static interface Framework.Factory
          The Factory used to instanciate AsynchronousReference implementation.
 
Field Summary
static Syslog syslog
           
 
Constructor Summary
Framework()
           
 
Method Summary
static Framework.Factory getFactory()
          Gets the Factory currently used to create AsynchronousReference implementation.
static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object)
          Equivalent to getSemiTransparentAsynchronousProxy(object, Framework.getFactory()).
static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object, java.lang.Class proxyClass)
          Equivalent to getSemiTransparentAsynchronousProxy(object, class, Framework.getFactory()).
static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object, java.lang.Class proxyClass, Framework.Factory factory)
          Returns a semi-transparent asynchronous proxy on the specified object.
static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object, Framework.Factory factory)
          Returns a semi-transparent asynchronous proxy on the specified object.
static java.lang.Object getTotalTransparentAsynchronousProxy(java.lang.Object object)
          Equivalent to getTotalTransparentAsynchronousProxy(object, getFactory()).
static java.lang.Object getTotalTransparentAsynchronousProxy(java.lang.Object object, Framework.Factory factory)
          Returns a total-transparent asynchronous proxy on the specified object.
static void setFactory(Framework.Factory factory)
          Sets the Factory to use to create new AsynchronousReference implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

syslog

public static Syslog syslog
Constructor Detail

Framework

public Framework()
Method Detail

setFactory

public static void setFactory(Framework.Factory factory)

Sets the Factory to use to create new AsynchronousReference implementation.

Parameters:
factory - a Factory value

getFactory

public static Framework.Factory getFactory()

Gets the Factory currently used to create AsynchronousReference implementation.

Returns:
a Factory value

getSemiTransparentAsynchronousProxy

public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object)

Equivalent to getSemiTransparentAsynchronousProxy(object, Framework.getFactory()).


getSemiTransparentAsynchronousProxy

public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object,
                                                                                   Framework.Factory factory)

Returns a semi-transparent asynchronous proxy on the specified object.

It the object class is not a public class, then the proxy returned is the jaya proxy of its first public superclass.

The factory specified is used if a proxy has not yet been created.

Parameters:
object - the object to get a semi-transparent asynchronous proxy on
factory - the Factory to use to create an AsynchronousReference on the given object
Returns:
the semi-transparent asynchronous proxy on the given object
See Also:
Framework.Factory, AsynchronousReference

getSemiTransparentAsynchronousProxy

public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object,
                                                                                   java.lang.Class proxyClass)

Equivalent to getSemiTransparentAsynchronousProxy(object, class, Framework.getFactory()).


getSemiTransparentAsynchronousProxy

public static SemiTransparentAsynchronousProxy getSemiTransparentAsynchronousProxy(java.lang.Object object,
                                                                                   java.lang.Class proxyClass,
                                                                                   Framework.Factory factory)

Returns a semi-transparent asynchronous proxy on the specified object.

The proxy returned is an instance of the class specified on the specified object.

The factory specified is used if a proxy has not yet been created.

Parameters:
object - the object to get a semi-transparent asynchronous proxy on
proxyClass - the class to use as the jaya semi transparent asynchronous proxy
factory - the Factory to use to create an AsynchronousReference on the given object
Returns:
the semi-transparent asynchronous proxy on the given object
See Also:
Framework.Factory, AsynchronousReference

getTotalTransparentAsynchronousProxy

public static java.lang.Object getTotalTransparentAsynchronousProxy(java.lang.Object object)

Equivalent to getTotalTransparentAsynchronousProxy(object, getFactory()).


getTotalTransparentAsynchronousProxy

public static java.lang.Object getTotalTransparentAsynchronousProxy(java.lang.Object object,
                                                                    Framework.Factory factory)

Returns a total-transparent asynchronous proxy on the specified object.

Parameters:
object - the object to get a total-transparent asynchronous proxy on
factory - the Factory to use when creating the associated AsynchronousReference
Returns:
the total-transparent asynchronous proxy on the given object
See Also:
Framework.Factory, AsynchronousReference


Mandala help mailing list