public synchronized void deactivateEndpoint(Endpoint endpoint) throws Exception { OdeService svc = _activeOdeServices.get(endpoint); if (svc != null) { _serviceEprMap.remove(svc); svc.deactivate(); if (svc.getCount() < 1) { _activeOdeServices.remove(endpoint); } } }
public synchronized MyEndpointReference activateEndpoint(QName pid, Endpoint endpoint) throws Exception { if (__log.isDebugEnabled()) { __log.debug("Activate endpoint: " + endpoint); } OdeService service = _activeOdeServices.get(endpoint); if (service == null) service = new OdeService(this, endpoint); try { ProcessConf pc = _store.getProcessConfiguration(pid); InputStream is = pc.getCBPInputStream(); OProcess compiledProcess = null; try { Serializer ofh = new Serializer(is); compiledProcess = ofh.readOProcess(); } finally { is.close(); } QName portType = null; for (Map.Entry<String, Endpoint> provide : pc.getProvideEndpoints().entrySet()) { if (provide.getValue().equals(endpoint)) { OPartnerLink plink = compiledProcess.getPartnerLink(provide.getKey()); portType = plink.myRolePortType.getQName(); break; } } if (portType == null) { if (__log.isDebugEnabled()) { __log.debug("Could not find PortType for endpoint"); } } else { Definition def = pc.getDefinitionForService(endpoint.serviceName); if (def == null) { __log.debug("Could not find definition for service: " + endpoint.serviceName); } else { def = new WSDLFlattener(def).getDefinition(portType); Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def); addEndpointDoc(endpoint.serviceName, doc); } } } catch (Exception e) { __log.warn("Exception during endpoint activation", e); } MyEndpointReference myepr = new MyEndpointReference(service); service.activate(); _activeOdeServices.put(endpoint, service); _serviceEprMap.put(service, myepr); return myepr; }