01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Core License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: DbCommand.java,v 1.4 2002/06/25 11:34:38 mediumnet Exp $
08:
09: package org.ozoneDB.core.DbRemote;
10:
11: import java.io.*;
12: import org.ozoneDB.DxLib.DxObject;
13: import org.ozoneDB.core.*;
14: import org.ozoneDB.util.*;
15:
16: /**
17: * This is the base class for command that can be send to an ozone server.
18: *
19: *
20: * @author <a href="http://www.softwarebuero.de/">SMB</a>
21: * @version $Revision: 1.4 $Date: 2002/06/25 11:34:38 $
22: */
23: public abstract class DbCommand extends DxObject {
24:
25: /**
26: * Environment of this object. Will be set by InvokeServer.
27: */
28: public transient Env env;
29:
30: /**
31: * Result of the command. This will only be used on the server side.
32: */
33: public transient Object result;
34:
35: /**
36: The database client proxy object gate which proxy objects leaving the database must be signed on.
37: This field is valid during the call of {@link #perform}.
38: */
39: protected transient ProxyObjectGate proxyObjectGate;
40:
41: public DbCommand() {
42: }
43:
44: /**
45: * Perform whatever has to be done for this command. This method is called
46: * within a transaction, within a thread. The result of the command goes in
47: * the result member.
48: */
49: public abstract void perform(Transaction ta) throws Exception;
50:
51: public String toString() {
52: return "[" + this .getClass().getName() + "]";
53: }
54:
55: public void setProxyObjectGate(ProxyObjectGate proxyObjectGate) {
56: this .proxyObjectGate = proxyObjectGate;
57: }
58:
59: /**
60: Returns database client proxy object gate which proxy objects leaving the database must be signed on.
61: The return value is valid during the call of {@link #perform}.
62: */
63: protected ProxyObjectGate getProxyObjectGate() {
64: return proxyObjectGate;
65: }
66:
67: /**
68: Returns wether a result should be sent to the client.
69: */
70: public boolean shouldResultBeSentToClient() {
71: return true;
72: }
73: }
|