diff --git a/build/build.xml b/build/build.xml index d02c7d3c..0234bd47 100644 --- a/build/build.xml +++ b/build/build.xml @@ -92,7 +92,7 @@ optimize="${optimize}"> - + diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index 6394011c..f063a5ed 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -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. diff --git a/src/helma/framework/core/RemoteApplication.java b/src/helma/framework/core/RemoteApplication.java new file mode 100644 index 00000000..f854b4d0 --- /dev/null +++ b/src/helma/framework/core/RemoteApplication.java @@ -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); + } +}