KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > config > RuntimeConfig


1 /*
2  * JBoss, Home of Professional Open Source
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.config;
8
9 import org.jboss.cache.factories.NodeFactory;
10 import org.jgroups.jmx.JChannelFactoryMBean;
11
12 import javax.management.MBeanServer JavaDoc;
13 import javax.transaction.TransactionManager JavaDoc;
14
15 public class RuntimeConfig extends ConfigurationComponent
16 {
17    /**
18     * The serialVersionUID
19     */

20    private static final long serialVersionUID = 5626847485703341794L;
21
22    private transient TransactionManager JavaDoc transactionManager;
23    private transient JChannelFactoryMBean muxChannelFactory;
24    private transient MBeanServer JavaDoc mbeanServer;
25    private transient NodeFactory nodeFactory;
26
27    /**
28     * Resets the runtime to default values.
29     */

30    public void reset()
31    {
32       transactionManager = null;
33       muxChannelFactory = null;
34       mbeanServer = null;
35       nodeFactory = null;
36    }
37
38
39    public JChannelFactoryMBean getMuxChannelFactory()
40    {
41       return muxChannelFactory;
42    }
43
44    public void setMuxChannelFactory(JChannelFactoryMBean multiplexerChannelFactory)
45    {
46       testImmutability("muxChannelFactory");
47       this.muxChannelFactory = multiplexerChannelFactory;
48    }
49
50    public TransactionManager JavaDoc getTransactionManager()
51    {
52       return transactionManager;
53    }
54
55    public void setTransactionManager(TransactionManager JavaDoc transactionManager)
56    {
57       testImmutability("transactionManager");
58       this.transactionManager = transactionManager;
59    }
60
61    public MBeanServer JavaDoc getMbeanServer()
62    {
63       return mbeanServer;
64    }
65
66    public void setMbeanServer(MBeanServer JavaDoc mbeanServer)
67    {
68       testImmutability("mbeanServer");
69       this.mbeanServer = mbeanServer;
70    }
71
72    public NodeFactory getNodeFactory()
73    {
74       return nodeFactory;
75    }
76
77    public void setNodeFactory(NodeFactory nodeFactory)
78    {
79       this.nodeFactory = nodeFactory;
80    }
81
82    @Override JavaDoc
83    public boolean equals(Object JavaDoc obj)
84    {
85       if (this == obj)
86          return true;
87
88       if (obj instanceof RuntimeConfig)
89       {
90          RuntimeConfig other = (RuntimeConfig) obj;
91          return safeEquals(transactionManager, other.transactionManager)
92                  && safeEquals(muxChannelFactory, other.muxChannelFactory)
93                  && safeEquals(mbeanServer, other.mbeanServer);
94       }
95
96       return false;
97    }
98
99    @Override JavaDoc
100    public int hashCode()
101    {
102       int result = 17;
103       result = result * 29 + (transactionManager == null ? 0 : transactionManager.hashCode());
104       result = result * 29 + (muxChannelFactory == null ? 0 : muxChannelFactory.hashCode());
105       result = result * 29 + (mbeanServer == null ? 0 : mbeanServer.hashCode());
106       return result;
107    }
108 }
109
Popular Tags