01: /**********************************************************************
02: Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15: Contributors:
16: ...
17: **********************************************************************/package org.jpox.store;
18:
19: import org.jpox.util.Localiser;
20:
21: /**
22: * Abstract representation of an autostart mechanism.
23: * @version $Revision: 1.1 $
24: */
25: public abstract class AbstractAutoStartMechanism implements
26: AutoStartMechanism {
27: /** Localisation of messages */
28: protected static final Localiser LOCALISER = Localiser
29: .getInstance("org.jpox.store.Localisation");
30:
31: /** AutoStart "mode" */
32: protected String mode;
33:
34: /** Flag whether the starter is open. */
35: protected boolean open = false;
36:
37: /**
38: * Constructor.
39: */
40: public AbstractAutoStartMechanism() {
41: super ();
42: }
43:
44: /**
45: * Accessor for the mode of operation
46: * @return The mode of operation
47: */
48: public String getMode() {
49: return mode;
50: }
51:
52: /**
53: * Mutator for the mode of operation
54: * @param mode The mode of operation
55: */
56: public void setMode(String mode) {
57: this .mode = mode;
58: }
59:
60: /**
61: * Starts a transaction for writting (add/delete) classes to the auto start mechanism.
62: * Simply sets the open flag to true.
63: */
64: public void open() {
65: open = true;
66: }
67:
68: /**
69: * Whether it's open for writing (add/delete) classes to the auto start mechanism
70: * @return whether this is open for writing
71: */
72: public boolean isOpen() {
73: return open;
74: }
75:
76: /**
77: * Closes a transaction for writing (add/delete) classes to the auto start mechanism.
78: * Set the open flag to false.
79: */
80: public void close() {
81: open = false;
82: }
83: }
|