REFLEX Logo

REFLEX "RComponents" Java API extension

API Documentation The RComponent API
Version 2.21 (11/01/2002)

Download API The API is available in a JAR file suitable for using as a Java API extension (click "Save As" in your web-browser to download the file from the link above). Requires JDK1.4.

Programmers who wish to develop components using the RComponent pattern can consult the API manual above, and use the JAR API extension to develop evolvable components.

NOTE - All API methods are subject to change.

Legacy code integration with RComponents

Legacy code may be integrated within RComponents delegators via the Java Native Interface (JNI). Therefore legacy integration can be acheived by overidding the Delegation object's delegate method and calling the DLL functionality via JNI.

JNI allows legacy code in the form of dynamic link libraries (DLLs) to be used as an RComponent delegator instead of native Java methods. See the JNI tutoral for further details. The example code below shows a delegation to a method called print() within a DLL named "hello.dll".

import REFLEX.reflection.*;

import java.lang.reflect.*;

public class NativeBehaviour extends Delegation {
	// Declare the use of a legacy method
	public native void print();

	// Load the DLL containing the implementation of
	// the legacy method from the file "hello.dll"
	static {
	        System.loadLibrary("hello");
	}

	public Object delegate(Object proxy, Method m, Object[] args) {
		// Run the legacy method as a delegator for the
		// RComponent
		print();
	}

	public boolean fireNotification() { return true; }
}