public static PortData toPortData(final PortInfo port, final Collection<Injection> injections, final URL baseUrl, final ClassLoader classLoader) throws OpenEJBException { final PortData portData = new PortData(); portData.setPortId(port.portId); if (port.serviceName != null && port.serviceName.length() != 0) { portData.setServiceName(QName.valueOf(port.serviceName)); } if (port.portName != null && port.portName.length() != 0) { portData.setPortName(QName.valueOf(port.portName)); } portData.setWsdlUrl(getWsdlURL(port.wsdlFile, baseUrl, classLoader)); portData.getHandlerChains().addAll(toHandlerChainData(port.handlerChains, classLoader)); portData.getInjections().addAll(injections); portData.setMtomEnabled(port.mtomEnabled); portData.setBindingID(port.binding); portData.setWsdlPort(port.wsdlPort); portData.setWsdlService(port.wsdlService); portData.setLocation(port.location); portData.setSecure("WS-SECURITY".equals(port.authMethod)); portData.setProperties(port.properties); return portData; }
private String autoAssignWsLocation(EnterpriseBeanInfo bean, PortData port, Map<String, String> contextData, StringTemplate template) { contextData.put("ejbDeploymentId", bean.ejbDeploymentId); contextData.put("ejbType", getEjbType(bean.type)); contextData.put("ejbClass", bean.ejbClass); contextData.put("ejbClass.simpleName", bean.ejbClass.substring(bean.ejbClass.lastIndexOf('.') + 1)); contextData.put("ejbName", bean.ejbName); contextData.put("portComponentName", port.getPortName().getLocalPart()); contextData.put("wsdlPort", port.getWsdlPort().getLocalPart()); contextData.put("wsdlService", port.getWsdlService().getLocalPart()); return template.apply(contextData); }
public String getWsdlURL() { return (port.getWsdlUrl() == null) ? null : port.getWsdlUrl().toString(); } }
/** * Set appropriate handlers for the port/service/bindings. */ protected void initHandlers() throws Exception { final PortInfoImpl portInfo = new PortInfoImpl(implInfo.getBindingType(), serviceFactory.getEndpointName(), service.getName()); handlerResolver = new HandlerResolverImpl(port.getHandlerChains(), port.getInjections(), context); final List<Handler> chain = handlerResolver.getHandlerChain(portInfo); getBinding().setHandlerChain(chain); }
String location = port.getLocation(); if (location == null) { location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate); logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Ejb(id=" + portInfo.portId + ")"); ejbAddresses.put(bean.ejbDeploymentId, address); addressesForApp(appInfo.appId).add(new EndpointInfo(address, port.getWsdlService(), beanContext.getBeanClass().getName()));
public String getServiceNamespace() { if (port.getWsdlService() != null) { return port.getWsdlService().getNamespaceURI(); } else { return null; } }
protected HttpListener createPojoWsContainer(final ClassLoader loader, final URL moduleBaseUrl, final PortData port, final String serviceId, final Class target, final Context context, final String contextRoot, final Map<String, Object> bdgs, final ServiceConfiguration serviceInfos) throws Exception { final ClassLoader classLoader = target.getClassLoader(); // todo build JaxRpcServiceInfo in assembler final JaxRpcServiceInfo serviceInfo = getJaxRpcServiceInfo(classLoader); // Build java service descriptor final JavaServiceDescBuilder javaServiceDescBuilder = new JavaServiceDescBuilder(serviceInfo, classLoader); final JavaServiceDesc serviceDesc = javaServiceDescBuilder.createServiceDesc(); // Create service final RPCProvider provider = new PojoProvider(); final SOAPService service = new SOAPService(null, provider, null); service.setServiceDescription(serviceDesc); // Set class name service.setOption("className", target.getName()); // Add Handler Chain final List<HandlerInfo> handlerInfos = createHandlerInfos(port.getHandlerChains()); final HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos); service.setOption(org.apache.axis.Constants.ATTR_HANDLERINFOCHAIN, handlerInfoChainFactory); // Create container final AxisWsContainer container = new AxisWsContainer(port.getWsdlUrl(), service, null, classLoader); wsContainers.put(serviceId, container); return container; }
@ManagedAttribute @Description("The handler list") public TabularData getHandlers() { final List<String> names = new ArrayList<String>(); final List<String> values = new ArrayList<String>(); for (final HandlerChainData handlerChainData : port.getHandlerChains()) { for (final HandlerData handlerData : handlerChainData.getHandlers()) { names.add(handlerChainData.getServiceNamePattern().toString()); values.add(handlerData.getHandlerClass().getName()); } } return LocalMBeanServer.tabularData( "handlers", "The list of handlers", names.toArray(new String[names.size()]), values.toArray(new String[values.size()])); }
@ManagedAttribute @Description("The service port QName") public String getPort() { return port.getPortName().toString(); }
if (port.getBindingID() != null) { bindingURI = JaxWsUtils.getBindingURI(port.getBindingID()); final Iterator<Injection> injections = port.getInjections().iterator(); while (injections.hasNext()) { final Injection next = injections.next(); final InjectionProcessor<Object> injectionProcessor = new InjectionProcessor<Object>(instance, port.getInjections(), null, null, unwrap(context), bindings); injectionProcessor.createInstance(); implementor = injectionProcessor.getInstance();
public QName getEndpointName() { return this.port.getWsdlPort(); }
public static final void configure(final Endpoint endpoint, final PortData port) { final Properties p = port.getProperties(); if (p != null && p.containsKey(OPENEJB_ENDPOINT_CONFIGURATOR)) { final String classname = p.getProperty(OPENEJB_ENDPOINT_CONFIGURATOR); try { final EndpointConfigurator configurator = (EndpointConfigurator) Thread.currentThread().getContextClassLoader().loadClass(classname).newInstance(); configurator.configure(endpoint, p); } catch (final Exception e) { LOGGER.error("can't configure endpoint " + endpoint + " with configurator " + classname + ", using default config", e); if (port.isSecure()) { setupWSS4JChain(endpoint, p); } } } else { if (port.isSecure()) { setupWSS4JChain(endpoint, p); } } }
@ManagedAttribute @Description("Is the service secured?") public boolean getSecured() { return port.isSecure(); }
/** * Set appropriate handlers for the port/service/bindings. */ protected void initHandlers() throws Exception { PortInfoImpl portInfo = new PortInfoImpl(implInfo.getBindingType(), serviceFactory.getEndpointName(), service.getName()); handlerResolver = new HandlerResolverImpl(port.getHandlerChains(), port.getInjections(), context); List<Handler> chain = handlerResolver.getHandlerChain(portInfo); getBinding().setHandlerChain(chain); }
String location = port.getLocation(); if (location == null) { location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate); logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Ejb(id=" + portInfo.portId + ")"); ejbAddresses.put(bean.ejbDeploymentId, address);
public String getServiceName() { if (port.getWsdlService() != null) { return port.getWsdlService().getLocalPart(); } else { return null; } }
@Override protected HttpListener createEjbWsContainer(final URL url, final PortData port, final BeanContext beanContext, final ServiceConfiguration serviceInfos) throws Exception { final ClassLoader classLoader = beanContext.getClassLoader(); // todo build JaxRpcServiceInfo in assembler final JaxRpcServiceInfo serviceInfo = getJaxRpcServiceInfo(classLoader); // Build java service descriptor final JavaServiceDescBuilder javaServiceDescBuilder = new JavaServiceDescBuilder(serviceInfo, classLoader); final JavaServiceDesc serviceDesc = javaServiceDescBuilder.createServiceDesc(); // Create service final RPCProvider provider = new EjbRpcProvider(beanContext, createHandlerInfos(port.getHandlerChains())); final SOAPService service = new SOAPService(null, provider, null); service.setServiceDescription(serviceDesc); // Set class name service.setOption("className", beanContext.getServiceEndpointInterface().getName()); serviceDesc.setImplClass(beanContext.getServiceEndpointInterface()); // Create container final AxisWsContainer container = new AxisWsContainer(port.getWsdlUrl(), service, null, classLoader); wsContainers.put(beanContext.getDeploymentID().toString(), container); return container; }
@ManagedAttribute @Description("The handler list") public TabularData getHandlers() { final List<String> names = new ArrayList<String>(); final List<String> values = new ArrayList<String>(); for (final HandlerChainData handlerChainData : port.getHandlerChains()) { for (final HandlerData handlerData : handlerChainData.getHandlers()) { names.add(handlerChainData.getServiceNamePattern().toString()); values.add(handlerData.getHandlerClass().getName()); } } return LocalMBeanServer.tabularData( "handlers", "The list of handlers", names.toArray(new String[names.size()]), values.toArray(new String[values.size()])); }
@ManagedAttribute @Description("The service port QName") public String getPort() { return port.getPortName().toString(); }
if (port.getBindingID() != null) { bindingURI = JaxWsUtils.getBindingURI(port.getBindingID()); final Iterator<Injection> injections = port.getInjections().iterator(); while (injections.hasNext()) { final Injection next = injections.next(); final InjectionProcessor<Object> injectionProcessor = new InjectionProcessor<Object>(instance, port.getInjections(), null, null, unwrap(context), bindings); injectionProcessor.createInstance(); implementor = injectionProcessor.getInstance();