当前位置: 首页>>代码示例>>Java>>正文


Java DiscoveryGroupManagement类代码示例

本文整理汇总了Java中net.jini.discovery.DiscoveryGroupManagement的典型用法代码示例。如果您正苦于以下问题:Java DiscoveryGroupManagement类的具体用法?Java DiscoveryGroupManagement怎么用?Java DiscoveryGroupManagement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DiscoveryGroupManagement类属于net.jini.discovery包,在下文中一共展示了DiscoveryGroupManagement类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLookupGroups

import net.jini.discovery.DiscoveryGroupManagement; //导入依赖的package包/类
/**
 * Returns the Jini Lookup Service groups for this environment.
 * 
 * @return an array of group names
 */
public static String[] getLookupGroups() {
       String groups = null;
       if(props!=null)
           groups = props.getProperty(P_GROUPS);
       if (groups == null || groups.length() == 0)
           return DiscoveryGroupManagement.ALL_GROUPS;
       return toArray(groups);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:14,代码来源:SorcerEnv.java

示例2: execute

import net.jini.discovery.DiscoveryGroupManagement; //导入依赖的package包/类
public void execute(String... args) throws Throwable {
	out = NetworkShell.getShellOutputStream();
	WhitespaceTokenizer myTk = NetworkShell.getShellTokenizer();
	// pass in a clone of list - command may modify it
	@SuppressWarnings("unchecked")
	ArrayList<ServiceRegistrar> registrars = new ArrayList<ServiceRegistrar>(NetworkShell
			.getRegistrars());
	int numTokens = myTk.countTokens();
	String[] groups = null; // matches all
	String next = myTk.nextToken();
	if (next.indexOf("-") != 0) {
		if (numTokens == 1) {
			if (next.indexOf(",") > 0) {
				groups = NetworkShell.toArray(next, ",");
			} else {
				groups = new String[] { next };
			}
		} else {
			String[] tg = getGroupArray(myTk, numTokens - 1);
			groups = new String[numTokens];
			groups[0] = next;
			System.arraycopy(tg, 0, groups, 1, numTokens - 1);
		}
		for (int j = 0; j < groups.length; j++) {
			if (groups[j].equalsIgnoreCase("all")) {
				groups = DiscoveryGroupManagement.ALL_GROUPS;
				break;
			}
		}
		NetworkShell.setGroups(groups);
		NetworkShell.getDisco().terminate();
		NetworkShell.getRegistrars().clear();
		DiscoCmd.selectedRegistrar = 0;
		NetworkShell.setLookupDiscovery(groups);
	} else if (next.equals("-r")) {
		int myIdx = Integer.parseInt(myTk.nextToken());
		if (numTokens == 2) {
			groups = NetworkShell.getGroups();
		} else if (numTokens > 2) {
			groups = getGroupArray(myTk, numTokens - 2);
		}
		if ((myIdx < registrars.size()) && (myIdx >= 0)) {
			ServiceRegistrar myReg = (ServiceRegistrar) registrars
					.get(myIdx);
			if (myReg != null) {
				setGroups(myReg, myIdx, groups);
			}
		}
	} else {
		out.println(COMMAND_USAGE);
	}
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:53,代码来源:ChgrpCmd.java


注:本文中的net.jini.discovery.DiscoveryGroupManagement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。