The RMI interface to Application is now put into a separate RemoteApplication class.
This commit is contained in:
parent
2be26331b6
commit
50853a16c6
3 changed files with 59 additions and 21 deletions
|
@ -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>
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
54
src/helma/framework/core/RemoteApplication.java
Normal file
54
src/helma/framework/core/RemoteApplication.java
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue