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.resource.deployment;
023:
024: import javax.management.ObjectName;
025: import javax.resource.spi.XATerminator;
026: import javax.resource.spi.work.WorkManager;
027:
028: import org.jboss.deployment.DeploymentException;
029: import org.jboss.deployment.DeploymentInfo;
030: import org.jboss.deployment.ObjectModelFactorySimpleSubDeployerSupport;
031: import org.jboss.xb.binding.ObjectModelFactory;
032:
033: /**
034: * A resource adapter deployer
035: *
036: * @author <a href="adrian@jboss.com">Adrian Brock</a>
037: * @version $Revision: 57189 $
038: */
039: public class RARDeployer extends
040: ObjectModelFactorySimpleSubDeployerSupport implements
041: RARDeployerMBean {
042: /** The work manager name */
043: protected ObjectName workManagerName;
044:
045: /** The work manager */
046: protected WorkManager workManager;
047:
048: /** The xa terminator */
049: protected XATerminator xaTerminator;
050:
051: /** The xa terminator name */
052: protected ObjectName xaTerminatorName;
053:
054: public RARDeployer() {
055: setEnhancedSuffixes(new String[] { "250:.rar" });
056: }
057:
058: public String getExtension() {
059: return ".rar";
060: }
061:
062: public String getMetaDataURL() {
063: return "META-INF/ra.xml";
064: }
065:
066: public String getObjectName(DeploymentInfo di)
067: throws DeploymentException {
068: String name = di.shortName;
069: di = di.parent;
070: while (di != null) {
071: name = di.shortName + "#" + name;
072: di = di.parent;
073: }
074: return "jboss.jca:service=RARDeployment,name='" + name + "'";
075: }
076:
077: public String getDeploymentClass() {
078: return RARDeployment.class.getName();
079: }
080:
081: public ObjectModelFactory getObjectModelFactory() {
082: return new ResourceAdapterObjectModelFactory();
083: }
084:
085: public ObjectName getWorkManagerName() {
086: return workManagerName;
087: }
088:
089: public void setWorkManagerName(ObjectName workManagerName) {
090: this .workManagerName = workManagerName;
091: }
092:
093: public ObjectName getXATerminatorName() {
094: return xaTerminatorName;
095: }
096:
097: public void setXATerminatorName(ObjectName xaTerminatorName) {
098: this .xaTerminatorName = xaTerminatorName;
099: }
100:
101: protected void startService() throws Exception {
102: workManager = (WorkManager) server.getAttribute(
103: workManagerName, "Instance");
104: xaTerminator = (XATerminator) server.getAttribute(
105: xaTerminatorName, "XATerminator");
106: super.startService();
107: }
108: }
|