use of org.apache.openejb.jee.ServiceRef in project tomee by apache.
the class GeronimoMappedName method mapReferences.
private void mapReferences(final EjbJar ejbJar) {
if (ejbJar == null) {
return;
}
for (final EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
for (final EjbRef ref : enterpriseBean.getEjbRef()) {
// remap only corba references
final String mappedName = ref.getMappedName();
if (mappedName != null && (mappedName.startsWith("jndi:corbaloc") || mappedName.startsWith("jndi:corbaname"))) {
final String refName = ref.getEjbRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
if (null == mappedName && ref.getEjbRefName().equals("ejb/MEJB")) {
ref.setMappedName("mejb/ejb/mgmt/MEJB");
}
}
for (final MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
final String refName = ref.getMessageDestinationRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
for (final PersistenceContextRef ref : enterpriseBean.getPersistenceContextRef()) {
final String refName = ref.getPersistenceContextRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
for (final PersistenceUnitRef ref : enterpriseBean.getPersistenceUnitRef()) {
final String refName = ref.getPersistenceUnitRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
for (final ResourceRef ref : enterpriseBean.getResourceRef()) {
final String refName = ref.getResRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
for (final ResourceEnvRef ref : enterpriseBean.getResourceEnvRef()) {
final String refName = ref.getResourceEnvRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
for (final ServiceRef ref : enterpriseBean.getServiceRef()) {
final String refName = ref.getServiceRefName();
ref.setMappedName(MAPPED_NAME_PREFIX + refName);
}
}
}
use of org.apache.openejb.jee.ServiceRef in project tomee by apache.
the class JndiEncInfoBuilder method buildServiceRefInfos.
private void buildServiceRefInfos(final JndiConsumer jndiConsumer, final JndiEncInfo moduleJndiEnc, final JndiEncInfo compJndiEnc) {
for (final ServiceRef ref : jndiConsumer.getServiceRef()) {
final ServiceReferenceInfo info = new ServiceReferenceInfo();
info.referenceName = ref.getName();
info.location = buildLocationInfo(ref);
info.targets.addAll(buildInjectionInfos(ref));
insert(info, appInfo.globalJndiEnc.serviceRefs, appInfo.appJndiEnc.serviceRefs, moduleJndiEnc.serviceRefs, compJndiEnc.serviceRefs);
if (SystemInstance.get().hasProperty("openejb.geronimo")) {
continue;
}
info.id = ref.getMappedName();
info.serviceQName = ref.getServiceQname();
info.serviceType = ref.getServiceInterface();
info.referenceType = ref.getServiceRefType();
info.wsdlFile = ref.getWsdlFile();
info.jaxrpcMappingFile = ref.getJaxrpcMappingFile();
info.handlerChains.addAll(ConfigurationFactory.toHandlerChainInfo(ref.getAllHandlers()));
for (final PortComponentRef portComponentRef : ref.getPortComponentRef()) {
final PortRefInfo portRefInfo = new PortRefInfo();
portRefInfo.qname = portComponentRef.getQName();
portRefInfo.serviceEndpointInterface = portComponentRef.getServiceEndpointInterface();
portRefInfo.enableMtom = portComponentRef.isEnableMtom();
portRefInfo.properties.putAll(portComponentRef.getProperties());
info.portRefs.add(portRefInfo);
}
}
}
use of org.apache.openejb.jee.ServiceRef in project tomee by apache.
the class SunConversion method convertModule.
public void convertModule(final ClientModule clientModule) {
if (clientModule == null) {
return;
}
final ApplicationClient applicationClient = clientModule.getApplicationClient();
if (applicationClient == null) {
return;
}
final SunApplicationClient sunApplicationClient = getSunApplicationClient(clientModule);
if (sunApplicationClient == null) {
return;
}
// map ejb-refs
final Map<String, org.apache.openejb.jee.EjbRef> refMap = applicationClient.getEjbRefMap();
// map ejb-ref jndi name declaration to deploymentId
for (final EjbRef ref : sunApplicationClient.getEjbRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getEjbRefName();
refName = normalize(refName);
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
final Map<String, JndiReference> resEnvMap = new TreeMap<>();
resEnvMap.putAll(applicationClient.getResourceEnvRefMap());
resEnvMap.putAll(applicationClient.getMessageDestinationRefMap());
for (final ResourceRef ref : sunApplicationClient.getResourceRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final ResourceEnvRef ref : sunApplicationClient.getResourceEnvRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResourceEnvRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final MessageDestinationRef ref : sunApplicationClient.getMessageDestinationRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getMessageDestinationRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
final Map<String, ServiceRef> serviceRefMap = applicationClient.getServiceRefMap();
for (final org.apache.openejb.jee.sun.ServiceRef ref : sunApplicationClient.getServiceRef()) {
String refName = ref.getServiceRefName();
refName = normalize(refName);
final ServiceRef serviceRef = serviceRefMap.get(refName);
if (serviceRef != null) {
final Map<String, PortComponentRef> ports = new TreeMap<>();
for (final PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
ports.put(portComponentRef.getServiceEndpointInterface(), portComponentRef);
}
for (final PortInfo portInfo : ref.getPortInfo()) {
final PortComponentRef portComponentRef = ports.get(portInfo.getServiceEndpointInterface());
if (portComponentRef != null) {
final WsdlPort wsdlPort = portInfo.getWsdlPort();
if (wsdlPort != null) {
final QName qname = new QName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalpart());
portComponentRef.setQName(qname);
}
for (final StubProperty stubProperty : portInfo.getStubProperty()) {
final String name = stubProperty.getName();
final String value = stubProperty.getValue();
portComponentRef.getProperties().setProperty(name, value);
}
}
}
final String wsdlOverride = ref.getWsdlOverride();
if (wsdlOverride != null && wsdlOverride.length() > 0) {
final String serviceId = extractServiceId(wsdlOverride);
serviceRef.setMappedName(serviceId);
}
}
}
}
use of org.apache.openejb.jee.ServiceRef in project tomee by apache.
the class SunConversion method deploy.
public AppModule deploy(final AppModule appModule) {
final SunApplication sunApplication = getSunApplication(appModule);
if (sunApplication != null) {
for (final Web web : sunApplication.getWeb()) {
final String webUri = web.getWebUri();
for (final WebModule webModule : appModule.getWebModules()) {
if (webUri.equals(webModule.getModuleId())) {
webModule.setContextRoot(web.getContextRoot());
break;
}
}
}
for (final ClientModule clientModule : appModule.getClientModules()) {
final ApplicationClient applicationClient = clientModule.getApplicationClient();
if (applicationClient == null) {
continue;
}
// map ejb-refs
final Map<String, org.apache.openejb.jee.EjbRef> refMap = applicationClient.getEjbRefMap();
// map ejb-ref jndi name declaration to deploymentId
for (final EjbRef ref : sunApplication.getEjbRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getEjbRefName();
refName = normalize(refName);
org.apache.openejb.jee.EjbRef ejbRef = refMap.get(refName);
// try to match from lookup name
for (final Map.Entry<String, org.apache.openejb.jee.EjbRef> aRef : refMap.entrySet()) {
if (refName.equals(aRef.getValue().getLookupName())) {
ejbRef = aRef.getValue();
break;
}
}
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
final Map<String, JndiReference> resEnvMap = new TreeMap<>();
resEnvMap.putAll(applicationClient.getResourceEnvRefMap());
resEnvMap.putAll(applicationClient.getMessageDestinationRefMap());
for (final ResourceRef ref : sunApplication.getResourceRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final ResourceEnvRef ref : sunApplication.getResourceEnvRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResourceEnvRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final MessageDestinationRef ref : sunApplication.getMessageDestinationRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getMessageDestinationRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final MessageDestination destination : sunApplication.getMessageDestination()) {
if (destination.getJndiName() != null) {
String name = destination.getMessageDestinationName();
name = normalize(name);
final JndiReference ref = resEnvMap.get(name);
if (ref != null) {
ref.setMappedName(destination.getJndiName());
}
}
}
final Map<String, ServiceRef> serviceRefMap = applicationClient.getServiceRefMap();
for (final org.apache.openejb.jee.sun.ServiceRef ref : sunApplication.getServiceRef()) {
String refName = ref.getServiceRefName();
refName = normalize(refName);
final ServiceRef serviceRef = serviceRefMap.get(refName);
if (serviceRef != null) {
final Map<String, PortComponentRef> ports = new TreeMap<>();
for (final PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
ports.put(portComponentRef.getServiceEndpointInterface(), portComponentRef);
}
for (final PortInfo portInfo : ref.getPortInfo()) {
final PortComponentRef portComponentRef = ports.get(portInfo.getServiceEndpointInterface());
if (portComponentRef != null) {
final WsdlPort wsdlPort = portInfo.getWsdlPort();
if (wsdlPort != null) {
final QName qname = new QName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalpart());
portComponentRef.setQName(qname);
}
for (final StubProperty stubProperty : portInfo.getStubProperty()) {
final String name = stubProperty.getName();
final String value = stubProperty.getValue();
portComponentRef.getProperties().setProperty(name, value);
}
}
}
final String wsdlOverride = ref.getWsdlOverride();
if (wsdlOverride != null && wsdlOverride.length() > 0) {
final String serviceId = extractServiceId(wsdlOverride);
serviceRef.setMappedName(serviceId);
}
}
}
}
}
for (final EjbModule ejbModule : appModule.getEjbModules()) {
convertModule(ejbModule, appModule.getCmpMappings());
}
for (final ClientModule clientModule : appModule.getClientModules()) {
convertModule(clientModule);
}
for (final WebModule webModule : appModule.getWebModules()) {
convertModule(webModule);
}
return appModule;
}
use of org.apache.openejb.jee.ServiceRef in project tomee by apache.
the class SunConversion method convertModule.
public void convertModule(final WebModule webModule) {
if (webModule == null) {
return;
}
final WebApp webApp = webModule.getWebApp();
if (webApp == null) {
return;
}
final SunWebApp sunWebApp = getSunWebApp(webModule);
if (sunWebApp == null) {
return;
}
if (sunWebApp.getContextRoot() != null) {
webModule.setContextRoot(sunWebApp.getContextRoot());
}
// map ejb-refs
final Map<String, JndiReference> refMap = new TreeMap<>();
refMap.putAll(webApp.getEjbRefMap());
refMap.putAll(webApp.getEjbLocalRefMap());
// map ejb-ref jndi name declaration to deploymentId
for (final EjbRef ref : sunWebApp.getEjbRef()) {
if (ref.getJndiName() != null) {
final String refName = ref.getEjbRefName();
JndiReference ejbRef = refMap.get(refName);
if (ejbRef == null) {
ejbRef = new org.apache.openejb.jee.EjbRef();
ejbRef.setName(refName);
refMap.put(refName, ejbRef);
webApp.getEjbRef().add((org.apache.openejb.jee.EjbRef) ejbRef);
}
ejbRef.setMappedName(ref.getJndiName());
}
}
// map resource-env-refs and message-destination-refs
final Map<String, JndiReference> resEnvMap = new TreeMap<>();
resEnvMap.putAll(webApp.getResourceRefMap());
resEnvMap.putAll(webApp.getResourceEnvRefMap());
resEnvMap.putAll(webApp.getMessageDestinationRefMap());
for (final ResourceRef ref : sunWebApp.getResourceRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final ResourceEnvRef ref : sunWebApp.getResourceEnvRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getResourceEnvRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
for (final MessageDestinationRef ref : sunWebApp.getMessageDestinationRef()) {
if (ref.getJndiName() != null) {
String refName = ref.getMessageDestinationRefName();
refName = normalize(refName);
final JndiReference resEnvRef = resEnvMap.get(refName);
if (resEnvRef != null) {
resEnvRef.setMappedName(ref.getJndiName());
}
}
}
final Map<String, ServiceRef> serviceRefMap = webApp.getServiceRefMap();
for (final org.apache.openejb.jee.sun.ServiceRef ref : sunWebApp.getServiceRef()) {
String refName = ref.getServiceRefName();
refName = normalize(refName);
final ServiceRef serviceRef = serviceRefMap.get(refName);
if (serviceRef != null) {
final Map<String, PortComponentRef> ports = new TreeMap<>();
for (final PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
ports.put(portComponentRef.getServiceEndpointInterface(), portComponentRef);
}
for (final PortInfo portInfo : ref.getPortInfo()) {
final PortComponentRef portComponentRef = ports.get(portInfo.getServiceEndpointInterface());
if (portComponentRef != null) {
final WsdlPort wsdlPort = portInfo.getWsdlPort();
if (wsdlPort != null) {
final QName qname = new QName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalpart());
portComponentRef.setQName(qname);
}
for (final StubProperty stubProperty : portInfo.getStubProperty()) {
final String name = stubProperty.getName();
final String value = stubProperty.getValue();
portComponentRef.getProperties().setProperty(name, value);
}
}
}
final String wsdlOverride = ref.getWsdlOverride();
if (wsdlOverride != null && wsdlOverride.length() > 0) {
final String serviceId = extractServiceId(wsdlOverride);
serviceRef.setMappedName(serviceId);
}
}
}
// map wsdl locations
if (webModule.getWebservices() != null) {
final Map<String, WebserviceDescription> descriptions = webModule.getWebservices().getWebserviceDescriptionMap();
for (final org.apache.openejb.jee.sun.WebserviceDescription sunDescription : sunWebApp.getWebserviceDescription()) {
final WebserviceDescription description = descriptions.get(sunDescription.getWebserviceDescriptionName());
if (description == null) {
continue;
}
final String serviceId = extractSerivceId(sunDescription.getWsdlPublishLocation(), description.getWsdlFile());
if (serviceId != null) {
description.setId(serviceId);
}
}
}
}
Aggregations