01: /*
02: * Helma License Notice
03: *
04: * The contents of this file are subject to the Helma License
05: * Version 2.0 (the "License"). You may not use this file except in
06: * compliance with the License. A copy of the License is available at
07: * http://adele.helma.org/download/helma/license.txt
08: *
09: * Copyright 1998-2003 Helma Software. All Rights Reserved.
10: *
11: * $RCSfile$
12: * $Author: root $
13: * $Revision: 8604 $
14: * $Date: 2007-09-28 15:16:38 +0200 (Fre, 28 Sep 2007) $
15: */
16:
17: package helma.framework.core;
18:
19: import helma.framework.*;
20: import helma.objectmodel.db.*;
21: import java.rmi.*;
22: import java.rmi.server.*;
23: import java.util.Vector;
24:
25: /**
26: * Proxy class for Aplication that listens to requests via RMI.
27: */
28: public class RemoteApplication extends UnicastRemoteObject implements
29: IRemoteApp, IReplicationListener {
30: Application app;
31:
32: /**
33: * Creates a new RemoteApplication object.
34: *
35: * @param app ...
36: *
37: * @throws RemoteException ...
38: */
39: public RemoteApplication(Application app) throws RemoteException {
40: this .app = app;
41: }
42:
43: /**
44: * ping method to let clients know if the server is reachable
45: */
46: public void ping() {
47: // do nothing
48: }
49:
50: /**
51: * Execute a request coming in from a web client.
52: */
53: public ResponseTrans execute(RequestTrans req) {
54: return app.execute(req);
55: }
56:
57: /**
58: * Update HopObjects in this application's cache. This is used to replicate
59: * application caches in a distributed app environment
60: */
61: public void replicateCache(Vector add, Vector delete) {
62: if (!"true".equalsIgnoreCase(app
63: .getProperty("allowReplication"))) {
64: app
65: .logEvent("Rejecting cache replication event: allowReplication property is not set to true");
66: throw new RuntimeException(
67: "Replication event rejected: setup does not allow replication.");
68: }
69:
70: app.nmgr.replicateCache(add, delete);
71: }
72: }
|