1 package org.apache.helix.participant;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.helix.messaging.handling.MessageHandlerFactory;
23 import org.apache.helix.participant.statemachine.StateModel;
24 import org.apache.helix.participant.statemachine.StateModelFactory;
25
26 /**
27 * Helix participant manager uses this class to register/remove state model factory
28 * State model factory creates state model that handles state transition messages
29 */
30 public interface StateMachineEngine extends MessageHandlerFactory
31 {
32 /**
33 * Register a default state model factory for a state model definition
34 * A state model definition could be, for example:
35 * "MasterSlave", "OnlineOffline", "LeaderStandby", etc.
36 * @param stateModelDef
37 * @param factory
38 * @return
39 */
40 public boolean registerStateModelFactory(String stateModelDef,
41 StateModelFactory<? extends StateModel> factory);
42
43 /**
44 * Register a state model factory with a name for a state model definition
45 * @param stateModelDef
46 * @param factory
47 * @param factoryName
48 * @return
49 */
50 public boolean registerStateModelFactory(String stateModelDef,
51 StateModelFactory<? extends StateModel> factory, String factoryName);
52
53 /**
54 * Remove the default state model factory for a state model definition
55 * @param stateModelDef
56 * @param factory
57 * @return
58 */
59 public boolean removeStateModelFactory(String stateModelDef,
60 StateModelFactory<? extends StateModel> factory);
61
62 /**
63 * Remove the state model factory with a name for a state model definition
64 * @param stateModelDef
65 * @param factory
66 * @param factoryName
67 * @return
68 */
69 public boolean removeStateModelFactory(String stateModelDef,
70 StateModelFactory<? extends StateModel> factory, String factoryName);
71 }