/** * Instantiate Service Locator client. After successful instantiation * establish a connection to the Service Locator server. This method will be * called if property locatorClient is null. For this purpose was defined * additional properties to instantiate ServiceLocatorImpl. * * @throws InterruptedException * @throws ServiceLocatorException */ public void initLocator() throws InterruptedException, ServiceLocatorException { if (locatorClient == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Instantiate locatorClient client for Locator Server " + locatorEndpoints + "..."); } ServiceLocatorImpl client = new ServiceLocatorImpl(); client.setLocatorEndpoints(locatorEndpoints); client.setConnectionTimeout(connectionTimeout); client.setSessionTimeout(sessionTimeout); if (null != authenticationName) client.setName(authenticationName); if (null != authenticationPassword) client.setPassword(authenticationPassword); locatorClient = client; locatorClient.connect(); } }
public void exec(OutputStream outputStream) throws InterruptedException, ServiceLocatorException { this.out = new PrintStream(outputStream); sl.connect(); printServices(); sl.disconnect(); }
public ServiceLocatorMain() { backend = new ZKBackend(); sl = new ServiceLocatorImpl(); sl.setBackend(backend); }
/** * Instantiate Service Locator client. After successful instantiation * establish a connection to the Service Locator server. This method will be * called if property locatorClient is null. For this purpose was defined * additional properties to instantiate ServiceLocatorImpl. * * @throws InterruptedException * @throws ServiceLocatorException */ public void initLocator() throws InterruptedException, ServiceLocatorException { if (locatorClient == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Instantiate locatorClient client for Locator Server " + locatorEndpoints + "..."); } ServiceLocatorImpl client = new ServiceLocatorImpl(); client.setLocatorEndpoints(locatorEndpoints); client.setConnectionTimeout(connectionTimeout); client.setSessionTimeout(sessionTimeout); locatorClient = client; locatorClient.connect(); } }
ServiceLocator locator = new ServiceLocatorImpl(); ... locator.executeService(someMap);
@Override public synchronized void unregister(Endpoint epProvider) throws ServiceLocatorException, InterruptedException { QName serviceName = epProvider.getServiceName(); String endpoint = epProvider.getAddress(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Unregistering endpoint " + endpoint + " for service " + serviceName + "..."); } long lastTimeStarted = -1; long lastTimeStopped = System.currentTimeMillis(); RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); if (endpointNode.exists()) { byte[] oldContent = endpointNode.getContent(); SLEndpoint oldEndpoint = transformer.toSLEndpoint(serviceName, oldContent, false); lastTimeStarted = oldEndpoint.getLastTimeStarted(); endpointNode.setOffline(); byte[] content = createContent(epProvider, lastTimeStarted, lastTimeStopped); endpointNode.setContent(content); } }
public ServiceLocatorMain() { backend = new ZKBackend(); sl = new ServiceLocatorImpl(); sl.setBackend(backend); }
@Override public synchronized void unregister(Endpoint epProvider) throws ServiceLocatorException, InterruptedException { QName serviceName = epProvider.getServiceName(); String endpoint = epProvider.getAddress(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Unregistering endpoint " + endpoint + " for service " + serviceName + "..."); } long lastTimeStarted = -1; long lastTimeStopped = System.currentTimeMillis(); RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); if (endpointNode.exists()) { byte[] oldContent = endpointNode.getContent(); SLEndpoint oldEndpoint = transformer.toSLEndpoint(serviceName, oldContent, false); lastTimeStarted = oldEndpoint.getLastTimeStarted(); endpointNode.setOffline(); byte[] content = createContent(epProvider, lastTimeStarted, lastTimeStopped); endpointNode.setContent(content); } }
@Override public synchronized void register(Endpoint epProvider, boolean persistent) throws ServiceLocatorException, InterruptedException { QName serviceName = epProvider.getServiceName(); String endpoint = epProvider.getAddress(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Registering endpoint " + endpoint + " for service " + serviceName + "..."); } long lastTimeStarted = System.currentTimeMillis(); long lastTimeStopped = -1; RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); serviceNode.ensureExists(); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); if (endpointNode.exists()) { byte[] content = endpointNode.getContent(); SLEndpoint oldEndpoint = transformer.toSLEndpoint(serviceName, content, false); lastTimeStopped = oldEndpoint.getLastTimeStopped(); } byte[] content = createContent(epProvider, lastTimeStarted, lastTimeStopped); endpointNode.ensureExists(content); endpointNode.setLive(persistent); }
public void exec(OutputStream outputStream) throws InterruptedException, ServiceLocatorException { this.out = new PrintStream(outputStream); sl.connect(); printServices(); sl.disconnect(); }
@Override public synchronized void register(Endpoint epProvider, boolean persistent) throws ServiceLocatorException, InterruptedException { QName serviceName = epProvider.getServiceName(); String endpoint = epProvider.getAddress(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Registering endpoint " + endpoint + " for service " + serviceName + "..."); } long lastTimeStarted = System.currentTimeMillis(); long lastTimeStopped = -1; RootNode rootNode = getBackend().connect(); ServiceNode serviceNode = rootNode.getServiceNode(serviceName); serviceNode.ensureExists(); EndpointNode endpointNode = serviceNode.getEndPoint(endpoint); if (endpointNode.exists()) { byte[] content = endpointNode.getContent(); SLEndpoint oldEndpoint = transformer.toSLEndpoint(serviceName, content, false); lastTimeStopped = oldEndpoint.getLastTimeStopped(); } byte[] content = createContent(epProvider, lastTimeStarted, lastTimeStopped); endpointNode.ensureExists(content); endpointNode.setLive(persistent); }