public Reference lookup(Document xml) { return registry.lookup(xml); }
public Map<String, ?> getProperties(Endpoint service) { return registry.getProperties(service); }
public void unregister(Endpoint endpoint, Map<String, ?> properties) { ServiceRegistration reg = registrations.remove(endpoint); if (reg == null && endpoint instanceof InternalEndpoint) { reg = registrations.remove(((InternalEndpoint) endpoint).getEndpoint()); } if (reg != null) { reg.unregister(); } else { logger.warn("Unregistration failed: the endpoint was not found in registry: " + endpoint + " (" + properties + ")"); registry.unregister(endpoint, properties); } }
public ServiceEndpoint getEndpoint(QName serviceName, String endpointName) { Map<String, Object> props = new HashMap<String, Object>(); props.put(Endpoint.SERVICE_NAME, serviceName.toString()); props.put(Endpoint.ENDPOINT_NAME, endpointName); props.put(INTERNAL_ENDPOINT, Boolean.TRUE.toString()); List<Endpoint> endpoints = getNmr().getEndpointRegistry().query(props); if (endpoints.isEmpty()) { return null; } Map<String, ?> p = getNmr().getEndpointRegistry().getProperties(endpoints.get(0)); return new ServiceEndpointImpl(p); }
protected Object doExecute() throws Exception { System.out.println("Endpoints"); System.out.println("---------"); ServiceReference reference = getBundleContext().getServiceReference(NMR.class.getName()); if (reference != null) { NMR nmr = (NMR)getBundleContext().getService(reference); if (nmr != null) { Set<Endpoint> endpoints = nmr.getEndpointRegistry().getServices(); for (Endpoint endpoint : endpoints) { String name = (String)nmr.getEndpointRegistry().getProperties(endpoint).get(Endpoint.NAME); System.out.println(name); } } } System.out.println(); return null; } }
public void activate() { nmr.getEndpointRegistry().register(this, properties); }
public List<Endpoint> query(Map<String, ?> properties) { return registry.query(properties); }
public Set<Endpoint> getServices() { return registry.getServices(); } }
public ComponentContextImpl(ComponentRegistryImpl componentRegistry, ComponentWrapper component, Map<String,?> properties) { super(componentRegistry); this.component = component; this.properties = properties; this.queue = new ArrayBlockingQueue<Exchange>(DEFAULT_QUEUE_CAPACITY); this.componentEndpoint = new EndpointImpl(properties); this.componentEndpoint.setQueue(queue); this.componentRegistry.getNmr().getEndpointRegistry().register(componentEndpoint, properties); this.dc = new DeliveryChannelImpl(this, componentEndpoint.getChannel(), queue); this.name = (String) properties.get(ComponentRegistry.NAME); this.workspaceRoot = new File(System.getProperty("karaf.base"), System.getProperty("jbi.cache", "data/jbi/") + name + "/workspace"); this.workspaceRoot.mkdirs(); this.installRoot = new File(System.getProperty("karaf.base"), System.getProperty("jbi.cache", "data/jbi/") + name + "/install"); this.installRoot.mkdirs(); }
protected List<Endpoint> doQueryEndpoints(Map<String, Object> props, boolean external) { if (props == null) { props = new HashMap<String, Object>(); } props.put(external ? EXTERNAL_ENDPOINT : INTERNAL_ENDPOINT, Boolean.TRUE.toString()); List<Endpoint> endpoints = getNmr().getEndpointRegistry().query(props); return endpoints; }
public Reference lookup(Map<String, ?> properties) { return registry.lookup(properties); }
public void deactivate() { nmr.getEndpointRegistry().unregister(this, properties); }
protected ServiceEndpoint getServiceEndpoint(Endpoint endpoint) { if (endpoint instanceof InternalEndpoint) { endpoint = ((InternalEndpoint) endpoint).getEndpoint(); } if (endpoint instanceof ServiceEndpoint) { ServiceEndpoint se = (ServiceEndpoint) endpoint; if (se.getServiceName() != null && se.getEndpointName() != null) { return se; } } else { Map<String, ?> epProps = getNmr().getEndpointRegistry().getProperties(endpoint); QName serviceName = getServiceQNameFromProperties(epProps); String endpointName = epProps.get(Endpoint.ENDPOINT_NAME) != null ? (String) epProps.get(Endpoint.ENDPOINT_NAME) : null; if (serviceName != null && endpointName != null) { return new ServiceEndpointImpl(epProps); } } return null; }
componentRegistry.getNmr().getEndpointRegistry().register(endpoint, props); } catch (TransformerException e) { throw new JBIException(e);
protected Channel getChannelToUse(InternalExchange exchange) { Channel channelToUse = channel; if (exchange.getSource() == null) { // We need to look up the channel corresponding to the sender endpoint try { String sender = (String) exchange.getProperty(SENDER_ENDPOINT); if (sender != null) { int idx = sender.lastIndexOf(':'); String svc = sender.substring(0, idx); String ep = sender.substring(idx + 1); Map<String, Object> props = ServiceHelper.createMap(Endpoint.SERVICE_NAME, svc, Endpoint.ENDPOINT_NAME, ep); // TODO: we may be using the wrong channel if both an internal endpoint and an external endpoint // have been registered with the same svc / ep name List<Endpoint> eps = channel.getNMR().getEndpointRegistry().query(props); if (eps != null && eps.size() == 1) { channelToUse = ((InternalEndpoint) eps.get(0)).getChannel(); } } } catch (Throwable t) { // Ignore } } else { channelToUse = exchange.getSource().getChannel(); } return channelToUse; }
public Reference lookup(String filter) { return registry.lookup(filter); }
public void destroy() { try { dc.close(); } catch (MessagingException e) { logger.warn("Error when closing the delivery channel", e); } componentRegistry.getNmr().getEndpointRegistry().unregister(componentEndpoint, properties); }
Map<String, ?> props = context.getNmr().getEndpointRegistry().getProperties(ep); String strSvcName = (String) props.get(Endpoint.SERVICE_NAME); QName serviceName = (strSvcName != null && strSvcName.length() > 0) ? QName.valueOf(strSvcName) : DEFAULT_SERVICE_NAME;
componentRegistry.getNmr().getEndpointRegistry().register(endpoint, props); return endpoint; } catch (TransformerException e) {
public Object getObject() throws Exception { if (reference == null) { Map<String, Object> props = new HashMap<String, Object>(); if (name != null) { props.put(Endpoint.NAME, name); } if (itf != null) { props.put(Endpoint.INTERFACE_NAME, itf.toString()); } if (service != null) { props.put(Endpoint.SERVICE_NAME, service.toString()); if (endpoint != null) { props.put(Endpoint.ENDPOINT_NAME, endpoint); } } reference = nmr.getEndpointRegistry().lookup(props); } return reference; }