/** * @param protocolName a name of protocol * @return the set of references on server connected to this server * @throws IllegalArgumentException if the given protocol name doesn't exist * @throws UnsupportedOperationException if the used manager is at client-side */ public Set<String> getServerRefsForProtocol(final String protocolName) throws IllegalArgumentException, UnsupportedOperationException { if(!(clusterViewManager instanceof ServerClusterViewManager)) { LOGGER.error("Clients cannot call this method"); throw new UnsupportedOperationException("Clients cannot call this method"); } Set<ServerId> serverRefs; try { serverRefs = ((ServerClusterViewManager) clusterViewManager).getServerRefs(protocolName); } catch (ProtocolNotFoundException e) { throw new IllegalArgumentException("Protocol not found: " + protocolName + "\n" + e.getMessage()); } Set<String> result = new HashSet<String>(); for(ServerId serverRef : serverRefs) { result.add(serverRef.getProviderURL()); } return result; }
@Override protected void initServerConfig(final String initialContextFactoryName, final ServerId serverId, final Context context) throws ServerClusterViewManagerException { registerPath(serverId.getProtocol(), getServerConfigPath(serverId)); super.initServerConfig(initialContextFactoryName, serverId, context); }
/** * @param domainName * domain name * @return names of CMI server */ public final Set<String> getServerNames(final String domainName) { Set<String> serverNames = new HashSet<String>(); for (String objectName : getObjectNames()) { try { for (CMIReference cmiRef : getCMIReferences(objectName)) { ServerId serverId = (ServerId) cmiRef.getServerRef(); if (serverId.getDomainName().equals(domainName)) { serverNames.add(serverId.getServerName()); } } } catch (ObjectNotFoundException e) { // Not an error! } } return serverNames; }
public Void execute() throws Exception { String protocol = serverRef.getProtocol(); String providerURL = serverRef.getProviderURL(); InetAddress newInetAddress = serverRef.getInetAddress(); try { if (NetworkInterface.getByInetAddress(newInetAddress) == null) {
try { registryId = new ServerId(MBeanUtils.getMBeanDomainName(), MBeanUtils.getMBeanServerName(), protocol, localRegistry); } catch (MalformedURLException e) {
/** * @return domain names */ public final Set<String> getDomainNames() { Set<String> domainNames = new HashSet<String>(); for (String objectName : getObjectNames()) { try { for (CMIReference cmiRef : getCMIReferences(objectName)) { domainNames.add(((ServerId) cmiRef.getServerRef()) .getDomainName()); } } catch (ObjectNotFoundException e) { // Not an error! } } return domainNames; }
/** * @param serverName * a server name * @return references on registries of the given server */ public final Set<ServerId> getRefsOnRegistries(final String serverName) { Set<ServerId> serverRefs = new HashSet<ServerId>(); for (String objectName : getObjectNames()) { try { for (CMIReference cmiRef : getCMIReferences(objectName)) { ServerId serverId = (ServerId) cmiRef.getServerRef(); if (serverId.getServerName().equals(serverName)) { serverRefs.add(serverId); } } } catch (ObjectNotFoundException e) { // Not an error! } } return serverRefs; }
new ServerId(MBeanUtils.getMBeanDomainName(), MBeanUtils.getMBeanServerName(), protocol, localRegistry); } catch (MalformedURLException e) { try { registryId = new ServerId(MBeanUtils.getMBeanDomainName(), MBeanUtils.getMBeanServerName(), protocol, localRegistry); } catch (MalformedURLException e) {
this.localContext = getRealContext(localRegistry.getProviderURL(), initialContextFactoryName); } else { this.localContext = null;