public void removeEndpoint(Endpoint endpoint) { map.remove(endpoint.getURI()); logger.info("Remove endpoint - " + endpoint); }
public void addEndpoint(Endpoint endpoint) { map.put(endpoint.getURI(), endpoint); logger.info("Add endpoint - " + endpoint); }
public void updateEndpoint(String uri, Endpoint endpoint) { Endpoint oldEndpoint = getEndpoint(uri); if (oldEndpoint == null) { throw new IllegalArgumentException("Endpoint is not found: " + uri); } map.put(endpoint.getURI(), endpoint); }
public List<Endpoint> findEndpoint(EndpointReference endpointReference) { logger.fine("Find endpoint for reference - " + endpointReference); if (endpointReference.getReference() != null) { Endpoint targetEndpoint = endpointReference.getTargetEndpoint(); String uri = targetEndpoint.getURI(); // [rfeng] This is a workaround to deal with the case that the endpoint URI doesn't have the // service name to avoid confusion between structural URIs and service URIs if (uri.indexOf('#') == -1) { uri = uri + "#service()"; } return findEndpoint(uri); } return new ArrayList<Endpoint>(); }
public List<Endpoint> findEndpoint(EndpointReference endpointReference) { logger.fine("Find endpoint for reference - " + endpointReference); if (endpointReference.getReference() != null) { Endpoint targetEndpoint = endpointReference.getTargetEndpoint(); String uri = targetEndpoint.getURI(); // [rfeng] This is a workaround to deal with the case that the endpoint URI doesn't have the // service name to avoid confusion between structural URIs and service URIs if (uri.indexOf('#') == -1) { uri = uri + "#service()"; } return findEndpoint(uri); } return new ArrayList<Endpoint>(); }
protected String getContext() { if (subject instanceof Endpoint) { Endpoint endpoint = (Endpoint)subject; return endpoint.getURI(); } else if (subject instanceof EndpointReference) { EndpointReference endpointReference = (EndpointReference)subject; return endpointReference.getURI(); } else if (subject instanceof Component) { Component component = (Component)subject; return component.getURI(); } return null; }
protected String getContext() { if (subject instanceof Endpoint) { Endpoint endpoint = (Endpoint)subject; return endpoint.getURI(); } else if (subject instanceof EndpointReference) { EndpointReference endpointReference = (EndpointReference)subject; return endpointReference.getURI(); } else if (subject instanceof Component) { Component component = (Component)subject; return component.getURI(); } return null; }
private String getContext() { if (subject instanceof Endpoint) { Endpoint endpoint = (Endpoint)subject; return endpoint.getURI(); } else if (subject instanceof EndpointReference) { EndpointReference endpointReference = (EndpointReference)subject; return endpointReference.getURI(); } else if (subject instanceof Component) { Component component = (Component)subject; return component.getURI(); } return null; }
public synchronized void removeEndpoint(Endpoint endpoint) { endpoints.remove(endpoint); endpointRemoved(endpoint); if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { String uri = null; Binding b = endpoint.getBinding(); if (b != null) { uri = b.getURI(); if (uri != null && uri.startsWith("/")) { uri = uri.substring(1); } } String msg = "Remove endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - "+uri); if (quietLogging) { logger.fine(msg); } else { logger.info(msg); } } }
public synchronized void addEndpoint(Endpoint endpoint) { endpoints.add(endpoint); for (EndpointListener listener : listeners) { listener.endpointAdded(endpoint); } if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { String uri = null; Binding b = endpoint.getBinding(); if (b != null) { uri = b.getURI(); if (uri != null && uri.startsWith("/")) { uri = uri.substring(1); } } String msg = "Add endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - " + uri); if (quietLogging) { logger.fine(msg); } else { logger.info(msg); } } }
MapEntry entry = map.getInternal(endpoint.getURI());
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * ASM_5021: where a <reference/> of a <component/> has @autowire=true * and where the <reference/> has a <binding/> child element which * declares a single target service, the reference is wired only to * the single service identified by the <wire/> element */ private void setSingleAutoWireTarget(ComponentReference reference) { if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) { String uri = reference.getBindings().get(0).getURI(); if (uri != null) { if (uri.indexOf('/') > -1) { // TODO: must be a way to avoid this fiddling int i = uri.indexOf('/'); String c = uri.substring(0, i); String s = uri.substring(i + 1); uri = c + "#service(" + s + ")"; } for (EndpointReference er : reference.getEndpointReferences()) { if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) { reference.getEndpointReferences().clear(); reference.getEndpointReferences().add(er); return; } } } } }
/** * Checks to see if the registry has been updated since the reference was last matched * * @return true is the registry has changed */ public boolean isOutOfDate(DomainRegistry domainRegistry, EndpointReference endpointReference) { Endpoint te = endpointReference.getTargetEndpoint(); if (te != null && !te.isUnresolved() && te.getURI() != null && endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING) { return domainRegistry.isOutOfDate(endpointReference); } return false; }
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }
/** * Sends message back to the browser client and reports connection status to * the runtime. * * @param msg * message to send to the browser * @return the connection status */ @Override public Message invoke(final Message msg) { String sessionId = (String) msg.getHeaders().get(Constants.RELATES_TO); Broadcaster broadcaster = CometSessionManager.get(sessionId); Message response = new MessageImpl(); if (broadcaster == null) { response.setBody(Status.CLIENT_DISCONNECTED); } else { String callbackMethod = msg.getTo().getURI(); Object[] body = msg.getBody(); broadcaster.broadcast(callbackMethod + "($.secureEvalJSON('" + JSONUtil.encodeResponse(body[0]) + "'))"); response.setBody(Status.OK); } return response; }