View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      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  
28  	public static final int INVALID_NODE_REQUEST = -1;
29  	public static final int NODE_SAVED = 0;
30  	public static final int NODE_OUTDATED = 1;
31  	public static final int NODE_NEW = 2;
32  
33  	/***
34  	 * Returns the current "knowledge" about a given node (i.e. the portlet application).
35  	 * If the contextName doesn't exist NODE_NEW is returned.
36  	 * An id requested newer than what is stored is indicated by NODE_OUTDATED. 
37  	 * @param id
38  	 * @param contextName
39  	 * @return
40  	 */
41  	public int checkNode(Long id, String contextName);
42  
43  	/***
44  	 * Add a new node or update the id of an existing one...(i.e. the portlet application) to the local info
45  	 * @param id
46  	 * @param contextName
47  	 * @throws Exception
48  	 */
49  	public void addNode(Long id, String contextName) throws Exception;
50  
51  	/***
52  	 * return the number of currently stored nodes
53  	 * @return
54  	 */
55  	public int getNumberOfNodes();
56  
57  	/***
58  	 * Remove a node
59  	 * @param id
60  	 * @param contextName
61  	 * @throws Exception
62  	 */
63  	public void removeNode(String contextName) throws Exception;
64  
65  }