public ServerInvoker(InvokerLocator locator) { super(locator); Map params = locator.getParameters(); if(configuration != null && params != null) { configuration.putAll(locator.getParameters()); } }
private String getDataType(InvokerLocator locator) { String type = null; if(locator != null) { Map params = locator.getParameters(); if(params != null) { type = (String) params.get(InvokerLocator.DATATYPE); } } return type; }
public ServerInvoker(InvokerLocator locator, Map configuration) { super(locator, configuration); if (configuration != null) { this.configuration.putAll(configuration); } Map locatorParams = locator.getParameters(); if(locatorParams != null) { this.configuration.putAll(locator.getParameters()); } }
private String getDataType(InvokerLocator locator) { String type = null; if (locator != null) { Map params = locator.getParameters(); if (params != null) { type = (String) params.get(InvokerLocator.DATATYPE); if (type == null) { type = (String) params.get(InvokerLocator.DATATYPE_CASED); } } } return type; }
/** * This returns <code>true</code> if the given remote endpoint is from an agent. If not, <code>false</code> is * returned. * * @param locator the locator of the remote endpoint that is to be checked * * @return <code>true</code> if the locator represents an agent */ private boolean isAgent(InvokerLocator locator) { Map parameters = locator.getParameters(); if ((parameters == null) || (parameters.size() == 0)) { return false; } String rhqtype = (String) parameters.get(ServiceContainerConfigurationConstants.CONNECTOR_RHQTYPE); return ServiceContainerConfigurationConstants.RHQTYPE_AGENT.equals(rhqtype); }
/** * setup the polling based on the <tt>pollinterval</tt> locator attribute. <P> * <p/> * For example, to set the pollinterval to every 2.5 seconds, you would configure * the client invoker locator to be: * <p/> * <CODE><PRE> * soap://192.168.10.1/pollinterval=2500 * </PRE></CODE> * <p/> * The default interval if not specified is 1000, for every 1 second. You can * disable polling by setting the interval to <tt><=0</tt>. */ protected void setupPollingTimer() { Map map = this.locator.getParameters(); long delay = 1000; // default if(map != null) { String ds = (String) map.get("pollinterval"); if(ds != null) { delay = Integer.parseInt(ds); } } if(delay > 0) { this.pollTimer.scheduleAtFixedRate(poller, 2000, delay); } }
private void processParameters() { Map params = new HashMap(); if (configuration != null) params.putAll(configuration); if (locator.getParameters() != null) params.putAll(locator.getParameters()); Object param = params.get(INVOKER_DESTRUCTION_DELAY); if (param instanceof String) { try { invokerDestructionDelay = Integer.parseInt((String) param); log.debug(this + " setting invokerDestructionDelay to " + invokerDestructionDelay); } catch (NumberFormatException e) { log.error("invokerDestructionDelay parameter has invalid format: " + param); } } else if (param != null) { log.error("invokerDestructionDelay parameter must be a string in integer format: " + param); } }
private int getRegistryPort(InvokerLocator locator) { int port = RMIServerInvoker.DEFAULT_REGISTRY_PORT; // See if locator contains a specific registry port Map params = locator.getParameters(); if(params != null) { String value = (String) params.get(RMIServerInvoker.REGISTRY_PORT_KEY); if(value != null) { try { port = Integer.parseInt(value); log.debug("Using port " + port + " for rmi registry."); } catch(NumberFormatException e) { log.error("Can not set the RMIServerInvoker RMI registry to port " + value + ". This is not a valid port number."); } } } return port; }
Map param = locator.getParameters(); if(param != null)
Map params = locator.getParameters(); if(params != null) String path = locator.getPath(); Map metadata = new HashMap(); metadata.putAll(locator.getParameters());
locator.getPath(), locator.getParameters());
Map metadata = getLocator().getParameters(); if (metadata == null)
public boolean isCompatibleWith(InvokerLocator other) { if (other == null) return false; // If this or other comes from pre-2.4.0 Remoting. if (homes == null || other.homes == null) return false; boolean result1 = getProtocol().equalsIgnoreCase(other.getProtocol()) && path.equals(other.getPath()) && parameters.equals(other.getParameters()); ArrayList tempHomes = connectHomes.isEmpty() ? homes : connectHomes; boolean result2 = intersects(tempHomes, other.getConnectHomeList()) || intersects(tempHomes, other.getHomeList()); return result1 && result2; }
String protocol = savedLocator.getProtocol(); String path = savedLocator.getPath(); Map params = savedLocator.getParameters(); List homes = locator.getConnectHomeList(); Home home = null;
String protocol = savedLocator.getProtocol(); String path = savedLocator.getPath(); Map params = savedLocator.getParameters(); List homes = getConnectHomes();
/** * @see CommandExecutor#execute(Command, java.io.InputStream, java.io.OutputStream) */ public CommandResponse execute(Command command, InputStream in, OutputStream out) { IdentifyCommand identifyCommand = new IdentifyCommand(command); String our_type = null; InvokerLocator locator = null; Identification our_ident; try { // from the connector, get the locator URI and find the type parameter in that URI ConnectorMBean connector = getConnector(); locator = connector.getLocator(); Map locator_params = locator.getParameters(); our_type = (String) locator_params.get(ServiceContainerConfigurationConstants.CONNECTOR_RHQTYPE); } catch (Exception e) { return new IdentifyCommandResponse(identifyCommand, e); } if (our_type.equals(Identification.TYPE_AGENT)) { our_ident = new AgentIdentification(our_type, locator.getLocatorURI()); } else if (our_type.equals(Identification.TYPE_SERVER)) { our_ident = new ServerIdentification(our_type, locator.getLocatorURI()); } else { return new IdentifyCommandResponse(identifyCommand, new Exception(LOG .getMsgString(CommI18NResourceKeys.IDENTIFY_COMMAND_SERVICE_UNKNOWN_ENDPOINT))); } return new IdentifyCommandResponse(identifyCommand, our_ident); }
/** * @see CommandExecutor#execute(Command, java.io.InputStream, java.io.OutputStream) */ public CommandResponse execute(Command command, InputStream in, OutputStream out) { IdentifyCommand identifyCommand = new IdentifyCommand(command); String our_type = null; InvokerLocator locator = null; Identification our_ident; try { // from the connector, get the locator URI and find the type parameter in that URI ConnectorMBean connector = getConnector(); locator = connector.getLocator(); Map locator_params = locator.getParameters(); our_type = (String) locator_params.get(ServiceContainerConfigurationConstants.CONNECTOR_RHQTYPE); } catch (Exception e) { return new IdentifyCommandResponse(identifyCommand, e); } if (our_type.equals(Identification.TYPE_AGENT)) { our_ident = new AgentIdentification(our_type, locator.getLocatorURI()); } else if (our_type.equals(Identification.TYPE_SERVER)) { our_ident = new ServerIdentification(our_type, locator.getLocatorURI()); } else { return new IdentifyCommandResponse(identifyCommand, new Exception(LOG .getMsgString(CommI18NResourceKeys.IDENTIFY_COMMAND_SERVICE_UNKNOWN_ENDPOINT))); } return new IdentifyCommandResponse(identifyCommand, our_ident); }
/** * subclasses must implement this method to provide a hook to connect to the remote server, if this applies * to the specific transport. However, in some transport implementations, this may not make must difference since * the connection is not persistent among invocations, such as SOAP. In these cases, the method should * silently return without any processing. * * @throws org.jboss.remoting.ConnectionFailedException * */ protected void handleConnect() throws ConnectionFailedException { if (InvokerLocator.MULTIHOME.equals(locator.getHost())) { Home home = getUsableAddress(); if (home == null) { throw new ConnectionFailedException(this + " unable to find a usable address for: " + home); } String protocol = locator.getProtocol(); String path = locator.getPath(); Map params = locator.getParameters(); locator = new InvokerLocator(protocol, home.host, home.port, path, params); if (log.isDebugEnabled()) log.debug(this + " will use InvokerLocator " + locator); } }
/** * Called by MultiplexClientInvoker.createSocket() when it finds connection is * broken and binds virtual socket group to new bind port. * <p> * @param bindPort */ protected void resetLocator(int bindPort) { this.bindPort = bindPort; InvokerLocator newLocator = new InvokerLocator(locator.getProtocol(), locator.getHost(), bindPort, locator.getPath(), locator.getParameters()); InvokerRegistry.updateServerInvokerLocator(locator, newLocator); locator = newLocator; }
protected int assignPort() throws IOException { int port; port = PortUtil.findFreePort(locator.getHost()); // re-write locator since the port is different InvokerLocator newLocator = new InvokerLocator(locator.getProtocol(), locator.getHost(), port, locator.getPath(), locator.getParameters()); // need to update the locator key used in the invoker registry InvokerRegistry.updateServerInvokerLocator(locator, newLocator); this.locator = newLocator; return port; }