// If the verifier is in strict mode and an error/warning
// was found in the Verification process, throw a Deployment
// Exception
if( strictVerifier && !allOK )
{
throw new DeploymentException("Verification of Enterprise Beans failed, see above for error messages.");
}
}
ServiceMetaData ejbModule = new ServiceMetaData();
ejbModule.setCode(EjbModule.class.getName());
// Build an escaped JMX name including deployment shortname
ObjectName moduleObjectName = null;
try
{
moduleObjectName = this.getObjectName(unit, deployment);
}
catch(MalformedObjectNameException e)
{
throw new DeploymentException("Failed to create EJB module " + unit.getName() +
": malformed EjbModule name", e);
}
ejbModule.setObjectName(moduleObjectName);
ServiceConstructorMetaData ctor = new ServiceConstructorMetaData();
ctor.setSignature(
new String[]{VFSDeploymentUnit.class.getName(), ApplicationMetaData.class.getName()}
);
ctor.setParameters(new Object[]{unit, legacyMD});
ejbModule.setConstructor(ctor);
// set attributes
List<ServiceAttributeMetaData> attrs = new ArrayList<ServiceAttributeMetaData>();
// Transaction manager
ServiceAttributeMetaData attr = new ServiceAttributeMetaData();
attr.setName("TransactionManagerFactory");
ServiceDependencyValueMetaData dependencyValue = new ServiceDependencyValueMetaData();
dependencyValue.setDependency(getTransactionManagerServiceName());
dependencyValue.setProxyType("attribute");
attr.setValue(dependencyValue);
attrs.add(attr);
// Security management
attr = new ServiceAttributeMetaData();
attr.setName("SecurityManagement");
ServiceInjectionValueMetaData injectionValue = new ServiceInjectionValueMetaData(securityManagementName);
attr.setValue(injectionValue);
attrs.add(attr);
//Policy Registration
attr = new ServiceAttributeMetaData();
attr.setName("PolicyRegistration");
ServiceInjectionValueMetaData prInjectionValue = new ServiceInjectionValueMetaData(policyRegistrationName);
attr.setValue(prInjectionValue);
attrs.add(attr);
// Add injection of the WebServiceName
String wsName = getWebServiceName();
if (wsName != null)
{
ServiceAttributeMetaData ws = new ServiceAttributeMetaData();
ws.setName("WebServiceName");
ServiceDependencyValueMetaData wsDepends = new ServiceDependencyValueMetaData();
wsDepends.setDependency(wsName);
ws.setValue(wsDepends);
attrs.add(ws);
}
// Injection of the TimerService
ServiceAttributeMetaData tms = new ServiceAttributeMetaData();
ServiceDependencyValueMetaData tmsDepends = new ServiceDependencyValueMetaData();
tms.setName("TimerService");
tmsDepends.setDependency(timerServiceName);
tmsDepends.setProxyType("attribute");
tms.setValue(tmsDepends);
attrs.add(tms);
ejbModule.setAttributes(attrs);
List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
// CCM for CachedConnectionInterceptor dependency
// TODO: this should be injected directly to the interceptor
if( ccmServiceName != null && ccmServiceName.length() > 0 )
{
ServiceDependencyMetaData ccm = new ServiceDependencyMetaData();
ccm.setIDependOn(ccmServiceName);
dependencies.add(ccm);
}
// Add dependencies on the invoker services in use
JBossEnterpriseBeansMetaData beans = deployment.getEnterpriseBeans();
Iterator<JBossEnterpriseBeanMetaData> beansIter = beans.iterator();
HashSet<String> invokerNames = new HashSet<String>();
HashSet<String> beanDepends = new HashSet<String>();
// Process ContainerDependencyMetaData
VFSDeploymentUnit topUnit = unit.getTopLevel();
Map<String, ContainerDependencyMetaData> endpoints = (Map<String, ContainerDependencyMetaData>) topUnit.getAttachment(MappedReferenceMetaDataResolverDeployer.ENDPOINT_MAP_KEY);
if(endpoints == null)
log.warn(unit+" has no ContainerDependencyMetaData attachment");
String vfsPath = unit.getRelativePath();
ArrayList<BeanMetaData> mcBeanMD = new ArrayList<BeanMetaData>();
while( beansIter.hasNext() )
{
JBossEnterpriseBeanMetaData bmd = beansIter.next();
Set<String> depends = bmd.getDepends();
if (depends != null)
beanDepends.addAll(depends);
String configName = bmd.getConfigurationName();
ContainerConfigurationMetaData cmd = bmd.determineContainerConfiguration();
Set<String> invokers = cmd.getInvokerProxyBindingNames();
if(invokers != null)
for(String iname : invokers)
{
InvokerProxyBindingMetaData imd = deployment.getInvokerProxyBinding(iname);
if (imd == null)
throw new DeploymentException("Failed to locate invoker: "+iname);
String invokerName = imd.getInvokerMBean();
if( invokerName.equalsIgnoreCase("default") )
{
// TODO: JBAS-4306 hack to ingore the invalid default invoker-mbean
continue;