KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > ServerComponent


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: ServerComponent.java,v 1.3 2002/09/18 06:54:15 per_nyfelt Exp $
8

9 package org.ozoneDB.core;
10
11
12 /**
13  * Base class for all componente of the ozone core.<p>
14  *
15  * ServerComponent basically provides method to start/stop the component and to
16  * check the internal state of the component. Each component has to properly
17  * call the {@link #setChanged()} method in this regard.
18  *
19  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
20  * @version $Revision: 1.3 $Date: 2002/09/18 06:54:15 $
21  */

22 public abstract class ServerComponent {
23
24     protected transient Env env;
25
26     private boolean hasChanged;
27
28
29     public ServerComponent( Env env ) {
30         this.env = env;
31     }
32
33
34     public synchronized void setChanged() {
35         this.hasChanged = true;
36         env.storeSetup();
37     }
38
39
40     public boolean hasChanged() {
41         return this.hasChanged;
42     }
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 JavaDoc;
53
54     public abstract void shutdown() throws Exception JavaDoc;
55
56
57     /**
58      * Save the internal state in the state to the server state properties.
59      */

60     public abstract void save() throws Exception JavaDoc;
61
62 }
63
64
Popular Tags