001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.jcaprops.support;
023:
024: import javax.management.MBeanServer;
025: import javax.resource.ResourceException;
026: import javax.resource.spi.ActivationSpec;
027: import javax.resource.spi.InvalidPropertyException;
028: import javax.resource.spi.ResourceAdapter;
029: import javax.resource.spi.ResourceAdapterInternalException;
030:
031: import org.jboss.logging.Logger;
032: import org.jboss.mx.util.MBeanServerLocator;
033:
034: /**
035: * A PropertyTestActivationSpec.
036: *
037: * @author <a href="adrian@jboss.com">Adrian Brock</a>
038: * @version $Revision: 57211 $
039: */
040: public class PropertyTestActivationSpec implements ActivationSpec,
041: PropertyTestActivationSpecMBean {
042: private static final Logger log = Logger
043: .getLogger(PropertyTestActivationSpec.class);
044:
045: private String stringAS;
046: private Boolean booleanAS;
047: private Byte byteAS;
048: private Character characterAS;
049: private Short shortAS;
050: private Integer integerAS;
051: private Long longAS;
052: private Float floatAS;
053: private Double doubleAS;
054:
055: private PropertyTestResourceAdapter resourceAdapter;
056:
057: public String getStringAS() {
058: return stringAS;
059: }
060:
061: public void setStringAS(String string) {
062: this .stringAS = string;
063: }
064:
065: public Boolean getBooleanAS() {
066: return booleanAS;
067: }
068:
069: public void setBooleanAS(Boolean booleanAS) {
070: this .booleanAS = booleanAS;
071: }
072:
073: public Byte getByteAS() {
074: return byteAS;
075: }
076:
077: public void setByteAS(Byte byteAS) {
078: this .byteAS = byteAS;
079: }
080:
081: public Character getCharacterAS() {
082: return characterAS;
083: }
084:
085: public void setCharacterAS(Character characterAS) {
086: this .characterAS = characterAS;
087: }
088:
089: public Double getDoubleAS() {
090: return doubleAS;
091: }
092:
093: public void setDoubleAS(Double doubleAS) {
094: this .doubleAS = doubleAS;
095: }
096:
097: public Float getFloatAS() {
098: return floatAS;
099: }
100:
101: public void setFloatAS(Float floatAS) {
102: this .floatAS = floatAS;
103: }
104:
105: public Integer getIntegerAS() {
106: return integerAS;
107: }
108:
109: public void setIntegerAS(Integer integerAS) {
110: this .integerAS = integerAS;
111: }
112:
113: public Long getLongAS() {
114: return longAS;
115: }
116:
117: public void setLongAS(Long longAS) {
118: this .longAS = longAS;
119: }
120:
121: public Short getShortAS() {
122: return shortAS;
123: }
124:
125: public void setShortAS(Short shortAS) {
126: this .shortAS = shortAS;
127: }
128:
129: public void validate() throws InvalidPropertyException {
130: }
131:
132: public ResourceAdapter getResourceAdapter() {
133: return resourceAdapter;
134: }
135:
136: public void setResourceAdapter(ResourceAdapter ra)
137: throws ResourceException {
138: this .resourceAdapter = (PropertyTestResourceAdapter) ra;
139: }
140:
141: protected void registerMBean()
142: throws ResourceAdapterInternalException {
143: MBeanServer server = MBeanServerLocator.locateJBoss();
144: try {
145: server.registerMBean(this , NAME);
146: } catch (Exception e) {
147: throw new ResourceAdapterInternalException(e);
148: }
149: }
150:
151: protected void unregisterMBean() {
152: MBeanServer server = MBeanServerLocator.locateJBoss();
153: try {
154: server.unregisterMBean(NAME);
155: } catch (Exception e) {
156: log.warn("Unable to unregisterMBean", e);
157: }
158: }
159: }
|