package org.jboss.resource.deployment;
import javax.management.ObjectName;
import javax.resource.spi.XATerminator;
import javax.resource.spi.work.WorkManager;
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.SimpleSubDeployerSupport;
import org.jboss.xml.binding.ObjectModelFactory;
public class RARDeployer extends SimpleSubDeployerSupport
implements RARDeployerMBean
{
protected ObjectName workManagerName;
protected WorkManager workManager;
protected XATerminator xaTerminator;
protected ObjectName xaTerminatorName;
public String getExtension()
{
return "rar";
}
public String getMetaDataURL()
{
return "META-INF/ra.xml";
}
public String getObjectName(DeploymentInfo di) throws DeploymentException
{
String name = di.shortName;
di = di.parent;
while (di != null)
{
name = di.shortName + "#" + name;
di = di.parent;
}
return "jboss.jca:service=RARDeployment,name='" + name + "'";
}
public String getDeploymentClass()
{
return RARDeployment.class.getName();
}
public ObjectModelFactory getObjectModelFactory()
{
return new ResourceAdapterObjectModelFactory();
}
public ObjectName getWorkManagerName()
{
return workManagerName;
}
public void setWorkManagerName(ObjectName workManagerName)
{
this.workManagerName = workManagerName;
}
public ObjectName getXATerminatorName()
{
return xaTerminatorName;
}
public void setXATerminatorName(ObjectName xaTerminatorName)
{
this.xaTerminatorName = xaTerminatorName;
}
protected void startService() throws Exception
{
workManager = (WorkManager) server.getAttribute(workManagerName, "Instance");
xaTerminator = (XATerminator) server.getAttribute(xaTerminatorName, "XATerminator");
super.startService();
}
}