The RMI interface to Application is now put into a separate RemoteApplication class.

This commit is contained in:
hns 2002-09-26 16:43:46 +00:00
parent 2be26331b6
commit 50853a16c6
3 changed files with 59 additions and 21 deletions

View file

@ -92,7 +92,7 @@
optimize="${optimize}">
<classpath refid="build.class.path" />
</javac>
<rmic classname="helma.framework.core.Application" base="${build.classes}"/>
<rmic classname="helma.framework.core.RemoteApplication" base="${build.classes}"/>
</target>

View file

@ -27,9 +27,7 @@ import java.rmi.server.*;
* requests from the Web server or XML-RPC port and dispatches them to
* the evaluators.
*/
public final class Application
extends UnicastRemoteObject
implements IRemoteApp, IPathElement, IReplicatedApp, Runnable {
public final class Application implements IPathElement, Runnable {
// the name of this application
private String name;
@ -424,8 +422,8 @@ public final class Application
}
/**
* Execute a request coming in from a web client.
*/
* Execute a request coming in from a web client.
*/
public ResponseTrans execute (RequestTrans req) {
requestCount += 1;
@ -453,7 +451,7 @@ public final class Application
// check if the properties file has been updated
updateProperties ();
// get evaluator and invoke
// get evaluator and invoke
ev = getEvaluator ();
res = ev.invoke (req, session);
}
@ -485,20 +483,6 @@ public final class Application
}
/**
* Update HopObjects in this application's cache. This is used to replicate
* application caches in a distributed app environment
*/
public void replicateCache (Vector add, Vector delete) {
if (!"true".equalsIgnoreCase (props.getProperty ("allowReplication")))
return;
nmgr.replicateCache (add, delete);
}
public void ping () {
// do nothing
}
/**
* Reset the application's object cache, causing all objects to be refetched from
* the database.

View file

@ -0,0 +1,54 @@
// RemoteApplication.java
// Copyright (c) Hannes Wallnöfer 2002
package helma.framework.core;
import helma.framework.*;
import helma.objectmodel.db.*;
import java.rmi.*;
import java.rmi.server.*;
import java.util.Vector;
/**
* Proxy class for Aplication that listens to requests via RMI.
*/
public class RemoteApplication
extends UnicastRemoteObject
implements IRemoteApp, IReplicationListener {
Application app;
public RemoteApplication (Application app) throws RemoteException {
this.app = app;
}
/**
* ping method to let clients know if the server is reachable
*/
public void ping () {
// do nothing
}
/**
* Execute a request coming in from a web client.
*/
public ResponseTrans execute (RequestTrans req) {
return app.execute (req);
}
/**
* Update HopObjects in this application's cache. This is used to replicate
* application caches in a distributed app environment
*/
public void replicateCache (Vector add, Vector delete) {
if (!"true".equalsIgnoreCase (app.getProperty ("allowReplication"))) {
app.logEvent ("Rejecting cache replication event: allowReplication property is not set to true");
throw new RuntimeException ("Replication event rejected: setup does not allow replication.");
}
app.nmgr.replicateCache (add, delete);
}
}