public void deploy(DeploymentUnit unit, RARDeploymentMetaData rdmd) throws DeploymentException
{
try
{
ServiceMetaData rarDeployment = new ServiceMetaData();
String name = getObjectName(unit, rdmd);
ObjectName objectName = new ObjectName(name);
rarDeployment.setObjectName(objectName);
rarDeployment.setCode(RARDeployment.class.getName());
ServiceConstructorMetaData constructor = new ServiceConstructorMetaData();
constructor.setSignature(new String[] { RARDeploymentMetaData.class.getName() });
constructor.setParameters(new Object[] { rdmd });
rarDeployment.setConstructor(constructor);
List<ServiceAttributeMetaData> attributes = new ArrayList<ServiceAttributeMetaData>();
ServiceAttributeMetaData attribute = null;
if (workManagerName != null)
{
attribute = new ServiceAttributeMetaData();
attribute.setName("WorkManager");
attribute.setValue(new ServiceInjectionValueMetaData(workManagerName));
attributes.add(attribute);
}
if (xaTerminatorName != null)
{
attribute = new ServiceAttributeMetaData();
attribute.setName("XATerminator");
attribute.setValue(new ServiceInjectionValueMetaData(xaTerminatorName, "XATerminator"));
attributes.add(attribute);
}
if (attributes.isEmpty() == false)
rarDeployment.setAttributes(attributes);
// We will have to see how to define the set of dependencies
JBossRAMetaData jmd = rdmd.getRaXmlMetaData();
if(jmd.getDependsMetaData() != null)
{
//String dependsObjectName = jmd.getDependsMetaData().getDependsName();
List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
List<DependsMetaData> depends = jmd.getDependsMetaData();
if(!depends.isEmpty())
{
Iterator<DependsMetaData> iter = depends.iterator();
while(iter.hasNext())
{
DependsMetaData dmd = iter.next();
String dependsObjectName = dmd.getDependsName();
ServiceDependencyMetaData dependency = new ServiceDependencyMetaData();
dependency.setIDependOn(dependsObjectName);
System.out.println(unit.getSimpleName()+ " have got the dependency on ---->>>>> "+dependsObjectName);
dependencies.add(dependency);
}
}
rarDeployment.setDependencies(dependencies);
}
unit.addAttachment(ServiceMetaData.class, rarDeployment);
}
catch (Exception e)