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: ServerComponent.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
08:
09: package org.ozoneDB.core;
10:
11: import java.io.*;
12: import java.util.*;
13: import org.ozoneDB.*;
14: import org.ozoneDB.util.*;
15:
16: /**
17: * Base class for all componente of the ozone core.<p>
18: *
19: * ServerComponent basically provides method to start/stop the component and to
20: * check the internal state of the component. Each component has to properly
21: * call the {@link #setChanged()} method in this regard.
22: *
23: * @author <a href="http://www.softwarebuero.de/">SMB</a>
24: * @version $Revision: 1.1 $Date: 2001/12/18 10:31:30 $
25: */
26: public abstract class ServerComponent {
27:
28: protected transient Env env;
29:
30: private boolean hasChanged;
31:
32: public ServerComponent(Env env) {
33: this .env = env;
34: }
35:
36: public synchronized void setChanged() {
37: this .hasChanged = true;
38: env.storeSetup();
39: }
40:
41: public boolean hasChanged() {
42: return this .hasChanged;
43: }
44:
45: public synchronized void clearChanged() {
46: this .hasChanged = false;
47: }
48:
49: /**
50: * Start up and load the internal state from the server state properties.
51: */
52: public abstract void startup() throws Exception;
53:
54: public abstract void shutdown() throws Exception;
55:
56: /**
57: * Save the internal state in the state to the server state properties.
58: */
59: public abstract void save() throws Exception;
60:
61: }
|