KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > dm > ddf > ConNode


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package sync4j.framework.core.dm.ddf;
20
21 import java.util.Map JavaDoc;
22
23 import org.apache.commons.collections.map.ListOrderedMap;
24
25
26 /**
27  * Corresponds to the <Con> interior node in the management tree
28  *
29  * @author Stefano Nichele @ Funambol
30  *
31  * @version $Id: ConNode.java,v 1.1 2005/05/16 17:32:55 nichele Exp $
32  */

33 public class ConNode implements java.io.Serializable JavaDoc {
34
35     // --------------------------------------------------------------- Constants
36

37
38     // ------------------------------------------------------------ Private data
39

40     private Map JavaDoc connections;
41
42     // ------------------------------------------------------------ Constructors
43
/** For serialization purposes */
44     public ConNode() {
45         this.connections = new ListOrderedMap();
46     }
47
48      /**
49       * Creates a new ConNode object with the given <code>Connection</code> and the given name
50       *
51       * @param con the connection node
52       * @param connectionName the connection name
53       */

54      public ConNode(final Connection con, final String JavaDoc connectionName) {
55          this();
56          this.connections.put(connectionName, con);
57      }
58
59      // ---------------------------------------------------------- Public methods
60

61      /**
62       * Add new connection
63       * @param connection the connection to add
64       * @param connectionName the name of the connection to add
65       */

66      public void addConnection(final Connection connection, final String JavaDoc connectionName) {
67          this.connections.put(connectionName, connection);
68      }
69
70      /**
71       * Gets the connectiont with the given name
72       *
73       * @param connection the name of the connection
74       * @return the connection with the given name.<br/><code>null</code> if not exists.
75       */

76      public Connection getConnection(final String JavaDoc connectionName) {
77          return (Connection)this.connections.get(connectionName);
78      }
79
80      /**
81       * Gets the connections
82       *
83       * @return the connections
84       */

85      public Map JavaDoc getConnections() {
86          return connections;
87      }
88
89      /**
90       * Sets the connections
91       *
92       * @param the connections
93       */

94
95      public void setConnections(Map JavaDoc connections) {
96          this.connections = connections;
97      }
98
99  }
Popular Tags