public void convertModule(ClientModule clientModule) {
if (clientModule == null) {
return;
}
ApplicationClient applicationClient = clientModule.getApplicationClient();
if (applicationClient == null) {
return;
}
SunApplicationClient sunApplicationClient = getSunApplicationClient(clientModule);
if (sunApplicationClient == null) {
return;
}
// map ejb-refs
Map<String,org.apache.openejb.jee.EjbRef> refMap = new TreeMap<String,org.apache.openejb.jee.EjbRef>();
for (org.apache.openejb.jee.EjbRef ejbRef : applicationClient.getEjbRef()) {
refMap.put(ejbRef.getEjbRefName(), ejbRef);
}
// map ejb-ref jndi name declaration to deploymentId
for (EjbRef ref : sunApplicationClient.getEjbRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getEjbRefName();
org.apache.openejb.jee.EjbRef ejbRef = refMap.get(refName);
if (ejbRef == null) {
ejbRef = new org.apache.openejb.jee.EjbRef();
ejbRef.setEjbRefName(refName);
refMap.put(refName, ejbRef);
applicationClient.getEjbRef().add(ejbRef);
}
ejbRef.setMappedName(ref.getJndiName());
}
}
// map resource-env-refs and message-destination-refs
Map<String,JndiReference> resEnvMap = new TreeMap<String,JndiReference>();
for (JndiReference envRef : applicationClient.getResourceEnvRef()) {
resEnvMap.put(envRef.getName(), envRef);
}
for (JndiReference envRef : applicationClient.getMessageDestinationRef()) {
resEnvMap.put(envRef.getName(), envRef);
}
for (ResourceRef ref : sunApplicationClient.getResourceRef()) {
if (ref.getJndiName() != null) {