01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.axis2.clustering.configuration;
21:
22: import org.apache.axis2.clustering.ClusteringCommand;
23: import org.apache.axis2.context.ConfigurationContext;
24:
25: /**
26: * This class represents the 2-phase commit protocol, where an event is processed,
27: * the system is prepared to switch to a new configuration based on the processed event,
28: * and finally commits the new configuration (i.e. the system switches to the new configuration).
29: * As can be seen, this is a 3-step process.
30: */
31: public abstract class ConfigurationClusteringCommand extends
32: ClusteringCommand {
33:
34: public static final int RELOAD_CONFIGURATION = 0;
35: public static final int LOAD_SERVICE_GROUPS = 1;
36: public static final int UNLOAD_SERVICE_GROUPS = 2;
37: public static final int APPLY_SERVICE_POLICY = 3;
38: public static final int PREPARE = 4;
39: public static final int COMMIT = 5;
40: public static final int EXCEPTION = 6;
41: public static final int ROLLBACK = 7;
42:
43: /**
44: * Get the command type
45: *
46: * @return The command type
47: */
48: public abstract int getCommandType();
49:
50: /**
51: * Process the <code>event</event>. The implementer of this interface will
52: * need to cache the outcome of this processing.
53: *
54: * @param configContext
55: * @throws Exception
56: */
57: public abstract void process(ConfigurationContext configContext)
58: throws Exception;
59:
60: /**
61: * Prepare to switch to the new configuration
62: *
63: * @param configContext
64: */
65: public abstract void prepare(ConfigurationContext configContext);
66:
67: /**
68: * Commit the new configuration. i.e. switch the system to the new configuration
69: *
70: * @param configContext
71: * @throws Exception
72: */
73: public abstract void commit(ConfigurationContext configContext)
74: throws Exception;
75:
76: /**
77: * Rollback any changes carried out
78: *
79: * @param configContext
80: * @throws Exception
81: */
82: public abstract void rollback(ConfigurationContext configContext)
83: throws Exception;
84: }
|