01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.cluster;
18:
19: /**
20: * Node Manager Interface
21: *
22: * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
23: * @version
24: */
25: public interface NodeManager {
26:
27: public static final int INVALID_NODE_REQUEST = -1;
28: public static final int NODE_SAVED = 0;
29: public static final int NODE_OUTDATED = 1;
30: public static final int NODE_NEW = 2;
31:
32: /**
33: * Returns the current "knowledge" about a given node (i.e. the portlet application).
34: * If the contextName doesn't exist NODE_NEW is returned.
35: * An id requested newer than what is stored is indicated by NODE_OUTDATED.
36: * @param id
37: * @param contextName
38: * @return
39: */
40: public int checkNode(Long id, String contextName);
41:
42: /**
43: * Add a new node or update the id of an existing one...(i.e. the portlet application) to the local info
44: * @param id
45: * @param contextName
46: * @throws Exception
47: */
48: public void addNode(Long id, String contextName) throws Exception;
49:
50: /**
51: * return the number of currently stored nodes
52: * @return
53: */
54: public int getNumberOfNodes();
55:
56: /**
57: * Remove a node
58: * @param id
59: * @param contextName
60: * @throws Exception
61: */
62: public void removeNode(String contextName) throws Exception;
63:
64: }
|