public static Endpoint getEndpoint(DestinationFactory df, String uri) throws IOException, EndpointNotFoundException { int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } EndpointInfo ei = new EndpointInfo(); ei.setAddress(uri); Destination d = df.getDestination(ei); if (d.getMessageObserver() == null) { // TODO is this the right Mule exception? throw new EndpointNotFoundException(uri); } MessageObserver mo = d.getMessageObserver(); if (!(mo instanceof ChainInitiationObserver)) { throw new EndpointNotFoundException(uri); } ChainInitiationObserver co = (ChainInitiationObserver) mo; return co.getEndpoint(); } }
public static Endpoint getEndpoint(DestinationFactory df, String uri) throws IOException, EndpointNotFoundException { int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } EndpointInfo ei = new EndpointInfo(); ei.setAddress(uri); Destination d = df.getDestination(ei); if (d.getMessageObserver() == null) { // TODO is this the right Mule exception? throw new EndpointNotFoundException(uri); } MessageObserver mo = d.getMessageObserver(); if (!(mo instanceof ChainInitiationObserver)) { throw new EndpointNotFoundException(uri); } ChainInitiationObserver co = (ChainInitiationObserver) mo; return co.getEndpoint(); }
@Override protected Client createClient() throws CreateException, Exception { String uri = getAddress(); int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } // remove username/password idx = uri.indexOf('@'); int slashIdx = uri.indexOf("//"); if (idx != -1 && slashIdx != -1) { uri = uri.substring(0, slashIdx + 2) + uri.substring(idx + 1); } EndpointInfo ei = new EndpointInfo(); ei.setAddress(uri); DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); DestinationFactory df = dfm.getDestinationFactoryForUri(uri); if (df == null) { throw new Exception("Could not find a destination factory for uri " + uri); } Destination dest = df.getDestination(ei); MessageObserver mo = dest.getMessageObserver(); if (mo instanceof ChainInitiationObserver) { ChainInitiationObserver cMo = (ChainInitiationObserver) mo; Endpoint cxfEP = cMo.getEndpoint(); return new ClientImpl(getBus(), cxfEP); } else { throw new Exception("Could not create client! No Server was found directly on the endpoint: " + uri); } }
public void stop() { if (stopped) { return; } LOG.fine("Server is stopping."); if (slcMgr != null) { slcMgr.stopServer(this); } MessageObserver mo = getDestination().getMessageObserver(); if (mo instanceof MultipleEndpointObserver) { ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint); if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { getDestination().setMessageObserver(null); } } else { getDestination().setMessageObserver(null); } stopped = true; }
MessageObserver mo = dest.getMessageObserver(); if (mo instanceof ChainInitiationObserver)
public void stop() { if (stopped) { return; } LOG.fine("Server is stopping."); if (slcMgr != null) { slcMgr.stopServer(this); } MessageObserver mo = getDestination().getMessageObserver(); if (mo instanceof MultipleEndpointObserver) { ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint); if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { getDestination().setMessageObserver(null); } } else { getDestination().setMessageObserver(null); } stopped = true; }
public void stop() { if (stopped) { return; } LOG.fine("Server is stopping."); for (Closeable c : endpoint.getCleanupHooks()) { try { c.close(); } catch (IOException e) { //ignore } } if (slcMgr != null) { slcMgr.stopServer(this); } MessageObserver mo = getDestination().getMessageObserver(); if (mo instanceof MultipleEndpointObserver) { ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint); if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { getDestination().setMessageObserver(null); } } else { getDestination().setMessageObserver(null); } stopped = true; }
public void stop() { if (stopped) { return; } LOG.fine("Server is stopping."); for (Closeable c : endpoint.getCleanupHooks()) { try { c.close(); } catch (IOException e) { //ignore } } if (slcMgr != null) { slcMgr.stopServer(this); } MessageObserver mo = getDestination().getMessageObserver(); if (mo instanceof MultipleEndpointObserver) { ((MultipleEndpointObserver)mo).getEndpoints().remove(endpoint); if (((MultipleEndpointObserver)mo).getEndpoints().isEmpty()) { getDestination().setMessageObserver(null); } } else { getDestination().setMessageObserver(null); } stopped = true; }
public void addListener(Destination d, Endpoint e) { synchronized (d) { if (d.getMessageObserver() != null) { throw new ServiceConstructionException(new Message("ALREADY_RUNNING", LOG, e.getEndpointInfo().getAddress())); } super.addListener(d, e); } }
public void addListener(Destination d, Endpoint e) { synchronized (d) { if (d.getMessageObserver() != null) { throw new ServiceConstructionException(new Message("ALREADY_RUNNING", LOG, e.getEndpointInfo().getAddress())); } super.addListener(d, e); } }
@Override public synchronized void addListener(Destination d, Endpoint e) { synchronized (d) { MessageObserver mo = d.getMessageObserver(); if (d.getAddress() != null && d.getAddress().getAddress() != null
@Override public synchronized void addListener(Destination d, Endpoint e) { synchronized (d) { MessageObserver mo = d.getMessageObserver(); if (d.getAddress() != null && d.getAddress().getAddress() != null
d.getMessageObserver().onMessage(m);
destination.getMessageObserver().onMessage(inMessage); } finally { BusFactory.setThreadDefaultBus(null);
destination.getMessageObserver().onMessage(inMessage); } finally { BusFactory.setThreadDefaultBus(null);
protected void run() { setBus(BusFactory.getDefaultBus()); getBus().getInInterceptors().add(new LoggingInInterceptor()); String address = "http://localhost:" + PORT + "/SoapContext/SoapPort"; Object implementor1 = new GreeterImplMixedStyle(" version1"); EndpointImpl ep1 = (EndpointImpl) Endpoint.publish(address, implementor1); ep1.getServer().getEndpoint().put("version", "1"); ep1.getServer().getEndpoint().put("allow-multiplex-endpoint", Boolean.TRUE); //Register a MediatorInInterceptor on this dummy service Object implementor2 = new GreeterImplMixedStyle(" version2"); EndpointImpl ep2 = (EndpointImpl) Endpoint.publish(address, implementor2); ep2.getServer().getEndpoint().put("version", "2"); MultipleEndpointObserver meo = (MultipleEndpointObserver) ep1.getServer().getDestination().getMessageObserver(); meo.getRoutingInterceptors().clear(); meo.getRoutingInterceptors().add(new MediatorInInterceptor()); }