KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jcaprops > support > PropertyTestActivationSpec


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.jcaprops.support;
23
24 import javax.management.MBeanServer JavaDoc;
25 import javax.resource.ResourceException JavaDoc;
26 import javax.resource.spi.ActivationSpec JavaDoc;
27 import javax.resource.spi.InvalidPropertyException JavaDoc;
28 import javax.resource.spi.ResourceAdapter JavaDoc;
29 import javax.resource.spi.ResourceAdapterInternalException JavaDoc;
30
31 import org.jboss.logging.Logger;
32 import org.jboss.mx.util.MBeanServerLocator;
33
34 /**
35  * A PropertyTestActivationSpec.
36  *
37  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
38  * @version $Revision: 37406 $
39  */

40 public class PropertyTestActivationSpec implements ActivationSpec JavaDoc, PropertyTestActivationSpecMBean
41 {
42    private static final Logger log = Logger.getLogger(PropertyTestActivationSpec.class);
43    
44    private String JavaDoc stringAS;
45    private Boolean JavaDoc booleanAS;
46    private Byte JavaDoc byteAS;
47    private Character JavaDoc characterAS;
48    private Short JavaDoc shortAS;
49    private Integer JavaDoc integerAS;
50    private Long JavaDoc longAS;
51    private Float JavaDoc floatAS;
52    private Double JavaDoc doubleAS;
53    
54    private PropertyTestResourceAdapter resourceAdapter;
55    
56    public String JavaDoc getStringAS()
57    {
58       return stringAS;
59    }
60    
61    public void setStringAS(String JavaDoc string)
62    {
63       this.stringAS = string;
64    }
65    
66    public Boolean JavaDoc getBooleanAS()
67    {
68       return booleanAS;
69    }
70
71    public void setBooleanAS(Boolean JavaDoc booleanAS)
72    {
73       this.booleanAS = booleanAS;
74    }
75
76    public Byte JavaDoc getByteAS()
77    {
78       return byteAS;
79    }
80
81    public void setByteAS(Byte JavaDoc byteAS)
82    {
83       this.byteAS = byteAS;
84    }
85
86    public Character JavaDoc getCharacterAS()
87    {
88       return characterAS;
89    }
90
91    public void setCharacterAS(Character JavaDoc characterAS)
92    {
93       this.characterAS = characterAS;
94    }
95
96    public Double JavaDoc getDoubleAS()
97    {
98       return doubleAS;
99    }
100
101    public void setDoubleAS(Double JavaDoc doubleAS)
102    {
103       this.doubleAS = doubleAS;
104    }
105
106    public Float JavaDoc getFloatAS()
107    {
108       return floatAS;
109    }
110
111    public void setFloatAS(Float JavaDoc floatAS)
112    {
113       this.floatAS = floatAS;
114    }
115
116    public Integer JavaDoc getIntegerAS()
117    {
118       return integerAS;
119    }
120
121    public void setIntegerAS(Integer JavaDoc integerAS)
122    {
123       this.integerAS = integerAS;
124    }
125
126    public Long JavaDoc getLongAS()
127    {
128       return longAS;
129    }
130
131    public void setLongAS(Long JavaDoc longAS)
132    {
133       this.longAS = longAS;
134    }
135
136    public Short JavaDoc getShortAS()
137    {
138       return shortAS;
139    }
140
141    public void setShortAS(Short JavaDoc shortAS)
142    {
143       this.shortAS = shortAS;
144    }
145    
146    public void validate() throws InvalidPropertyException JavaDoc
147    {
148    }
149
150    public ResourceAdapter JavaDoc getResourceAdapter()
151    {
152       return resourceAdapter;
153    }
154
155    public void setResourceAdapter(ResourceAdapter JavaDoc ra) throws ResourceException JavaDoc
156    {
157       this.resourceAdapter = (PropertyTestResourceAdapter) ra;
158    }
159
160    protected void registerMBean() throws ResourceAdapterInternalException JavaDoc
161    {
162       MBeanServer JavaDoc server = MBeanServerLocator.locateJBoss();
163       try
164       {
165          server.registerMBean(this, NAME);
166       }
167       catch (Exception JavaDoc e)
168       {
169          throw new ResourceAdapterInternalException JavaDoc(e);
170       }
171    }
172    
173    protected void unregisterMBean()
174    {
175       MBeanServer JavaDoc server = MBeanServerLocator.locateJBoss();
176       try
177       {
178          server.unregisterMBean(NAME);
179       }
180       catch (Exception JavaDoc e)
181       {
182          log.warn("Unable to unregisterMBean", e);
183       }
184    }
185 }
186
Popular Tags