org.omegahat.Interfaces.NativeInterface
Class MetaForeignReference

java.lang.Object
  |
  +--org.omegahat.Interfaces.NativeInterface.MetaForeignReference
All Implemented Interfaces:
org.omegahat.Environment.Language.Evaluable

public class MetaForeignReference
extends java.lang.Object
implements org.omegahat.Environment.Language.Evaluable

An abstract class that implements the basic functionality for converting a foreign reference (i.e. an object exported from R or S) to an appropriate Java object. This contains information identifying the R/S object and the target Java class. If the class does not exist (or is not likely to) the object can be initialized with the names of classes and interfaces which a dynamically generated class should extend and implement, respectively The foreign reference is then converted to an instance of this class so that it can be used appropriately. This new instance implements its methods via calls back to the foreign system and methods for the specified remote object. This is used as a transfer agent between the foreign system and Omegahat/Java. The foreign system creates an object of this class via C routines and then passes this object to the Omegahat system as an argument in a method call.


Field Summary
protected  java.lang.String name
           
protected  java.lang.String targetClass
          Name of the class which we will use as the class of the Java object used to represent the remote reference.
 
Constructor Summary
MetaForeignReference(java.lang.String id)
           
MetaForeignReference(java.lang.String id, java.lang.String targetType)
          Assumes the class identified by targetType already exists, or can be generated by extending a known base class.
MetaForeignReference(java.lang.String id, java.lang.String className, java.lang.String[] baseTypes)
           
MetaForeignReference(java.lang.String id, java.lang.String targetType, java.lang.String[] baseTypes, org.omegahat.Environment.Interpreter.Evaluator evaluator)
          Eagerly generate a new class named targetType that implements the methods of the specified interfaces in baseTypes.
 
Method Summary
 java.lang.Class defineClass(java.lang.String targetType, java.lang.String[] baseTypes, org.omegahat.Environment.Interpreter.Evaluator context)
           
 java.lang.Object eval(org.omegahat.Environment.Interpreter.Evaluator evaluator)
           
 java.lang.Object eval(java.lang.Object[] args, org.omegahat.Environment.Interpreter.Evaluator evaluator)
           
 java.lang.String getName()
          Accessor for name field
 java.lang.String getTargetClass()
          Accessor for targetClass field
 java.lang.String setName(java.lang.String value)
          Accessor for name field
 java.lang.String setTargetClass(java.lang.String value)
          Accessor for setting targetClass field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

targetClass

protected java.lang.String targetClass
Name of the class which we will use as the class of the Java object used to represent the remote reference. This is either implicitly determined if a new class is generated or explicitly provided by the foreign caller when the user wants to control the
Constructor Detail

MetaForeignReference

public MetaForeignReference(java.lang.String id)

MetaForeignReference

public MetaForeignReference(java.lang.String id,
                            java.lang.String targetType)
Assumes the class identified by targetType already exists, or can be generated by extending a known base class. This is an unusual circumstance.

MetaForeignReference

public MetaForeignReference(java.lang.String id,
                            java.lang.String targetType,
                            java.lang.String[] baseTypes,
                            org.omegahat.Environment.Interpreter.Evaluator evaluator)
                     throws java.lang.ClassNotFoundException
Eagerly generate a new class named targetType that implements the methods of the specified interfaces in baseTypes.
Parameters:
id - identifier of the object in the foreign system.
targetType - name of the new Java class to generate based on the base interfaces specified in baseTypes.
baseTypes - names of interfaces and classes which a dynamically generated class should implement.

MetaForeignReference

public MetaForeignReference(java.lang.String id,
                            java.lang.String className,
                            java.lang.String[] baseTypes)
                     throws java.lang.ClassNotFoundException
Method Detail

defineClass

public java.lang.Class defineClass(java.lang.String targetType,
                                   java.lang.String[] baseTypes,
                                   org.omegahat.Environment.Interpreter.Evaluator context)
                            throws java.lang.ClassNotFoundException

eval

public java.lang.Object eval(org.omegahat.Environment.Interpreter.Evaluator evaluator)
                      throws java.lang.Throwable
Specified by:
eval in interface org.omegahat.Environment.Language.Evaluable

eval

public java.lang.Object eval(java.lang.Object[] args,
                             org.omegahat.Environment.Interpreter.Evaluator evaluator)
                      throws java.lang.Throwable
Specified by:
eval in interface org.omegahat.Environment.Language.Evaluable

getName

public java.lang.String getName()
Accessor for name field

setName

public java.lang.String setName(java.lang.String value)
Accessor for name field

getTargetClass

public java.lang.String getTargetClass()
Accessor for targetClass field

setTargetClass

public java.lang.String setTargetClass(java.lang.String value)
Accessor for setting targetClass field