cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Integration Arbortext Editor / Eclipse (geek warning: somewhat longish)

Newbie

Integration Arbortext Editor / Eclipse (geek warning: somewhat longish)

Hello fellow adepters,

During free moments, I have lately been conducting very basic
experiments with the ultimate goal to create an Eclipse plug-in for
Arbortext Editor development. Working name: "The Adepter's Workbench".

Such a plug-in would need to communicate with an active editor session,
asking for "introspection" (including the AOM of open documents).



The first thing I tried proved to be a dead-end, launching Eclipse
using Arbortext's JVM like so:

local arr[];

# class descriptor for the Java String array
local descr = '[Ljava/lang/String;';

local oArgv = java_array_from_acl(arr, descr)
local oEclipseMain = java_constructor('org.eclipse.core.launcher.Main');

java_instance(oEclipseMain, 'run', oArgv);

java_delete(oEclipseMain);
java_delete(oArgv);

Well... Eclipse does start, but it's so slooooooooooooooow that it's useless.
Had this worked, it would of cause had been the perfect solution. AOM would
simply be there, ready to use.



Another approach could be RMI. To start an RMI registry from Arbortext:

local exe = 'G:\local\arbortext\Editor-5.2\bin\jre\bin\rmiregistry';
local cp = 'G:\local\arbortext\Editor-5.2\application\org.adepters.workbench\classes';
local cmd = exe . ' -J-classpath -J' . cp .'&'; # note this strange syntax!
local rc = system(cmd, 1); # 1: execute in hidden window

... a simple test RMI interface in Arbortext:

package example.hello;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface Hello extends Remote {

String sayHello() throws RemoteException;
}

... a simple test RMI server in Arbortext:

package example.hello;

import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;

public class Server implements Hello {

public Server() {}

public String sayHello() {
return "Hello, world!";
}

public static void main(String args[]) {

try {
Server obj = new Server();
Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);

// Bind the remote object's stub in the registry
Registry registry = LocateRegistry.getRegistry();
registry.bind("Hello", stub);

System.err.println("Server ready");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
}
... and a small test client executed from Eclipse:

package example.hello;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class Client {

private Client() {}

public static void main(String[] args) {

String host = (args.length < 1) ? null : args[0];
try {
Registry registry = LocateRegistry.getRegistry(host);
Hello stub = (Hello) registry.lookup("Hello");
String response = stub.sayHello();
System.out.println("response: " + response);
} catch (Exception e) {
System.err.println("Client exception: " + e.toString());
e.printStackTrace();
}
}
}

I don't look forward to build RMI wrappers round the AOM classes.



Another solution *might* be to set the "javadebugport" option,
and do something clever with the Eclipse debugger. This goes way
above my level, though.



- So please: Am I crazy? Or have others played with similar thoughts?

--
Kleist IT Consulting, Karl Johan Kleist
Frankfurter Allee 45, DE-10247 Berlin

+49 30 42 01 70 91 (office)
+49 17 38 35 82 06 (mobile)

Maintainer of
Tags (2)
Announcements