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 = applicationClient.getEjbRefMap();
// 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>();
resEnvMap.putAll(applicationClient.getResourceEnvRefMap());
resEnvMap.putAll(applicationClient.getMessageDestinationRefMap());
for (ResourceRef ref : sunApplicationClient.getResourceRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResRefName();
JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (ResourceEnvRef ref : sunApplicationClient.getResourceEnvRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResourceEnvRefName();
JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (MessageDestinationRef ref : sunApplicationClient.getMessageDestinationRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getMessageDestinationRefName();
JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
Map<String, ServiceRef> serviceRefMap = applicationClient.getServiceRefMap();
for (org.apache.openejb.jee.sun.ServiceRef ref : sunApplicationClient.getServiceRef()) {
String refName = ref.getServiceRefName();
ServiceRef serviceRef = serviceRefMap.get(refName);
if (serviceRef != null) {
Map<String,PortComponentRef> ports = new TreeMap<String,PortComponentRef>();