本文整理汇总了Java中net.jini.core.discovery.LookupLocator类的典型用法代码示例。如果您正苦于以下问题:Java LookupLocator类的具体用法?Java LookupLocator怎么用?Java LookupLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LookupLocator类属于net.jini.core.discovery包,在下文中一共展示了LookupLocator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findTransactionManager
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
private TransactionManager findTransactionManager(String uri) throws IOException, ClassNotFoundException {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
// Creating service template to find transaction manager service by matching fields.
Class<?>[] classes = new Class<?>[] {net.jini.core.transaction.server.TransactionManager.class};
// Name sn = new Name("*");
ServiceTemplate tmpl = new ServiceTemplate(null, classes, new Entry[] {});
// Creating a lookup locator
LookupLocator locator = new LookupLocator(uri);
ServiceRegistrar sr = locator.getRegistrar();
TransactionManager tm = (TransactionManager) sr.lookup(tmpl);
return tm;
}
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:TransactionHelper.java
示例2: addOne
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
private void addOne(ServiceRegistrar registrar) {
LookupLocator loc;
try {
loc = registrar.getLocator();
} catch (Throwable t) {
logger.log(Level.INFO, "obtaining locator failed", t);
return;
}
String host = loc.getHost();
if (loc.getPort() != Constants.discoveryPort) {
host += ":" + loc.getPort();
}
JRadioButtonMenuItem reg =
new RegistrarMenuItem(host, registrar.getServiceID());
reg.addActionListener(wrap(new Lookup(registrar)));
if (!(registrars.getMenuComponent(0) instanceof JRadioButtonMenuItem)) {
registrars.removeAll();
}
registrars.add(reg);
}
开发者ID:apache,项目名称:river-container,代码行数:21,代码来源:Browser.java
示例3: addItems
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
protected void addItems(String[] items) {
LookupLocator[] locs = new LookupLocator[items.length];
for(int i = 0; i < items.length; i++) {
try {
locs[i] = new LookupLocator(items[i]);
} catch (MalformedURLException e) {
JOptionPane.showMessageDialog(LocatorLister.this,
"\"" + items[i] + "\": " +
e.getMessage(),
"Bad Locator",
JOptionPane.WARNING_MESSAGE);
return;
}
}
try {
((JoinAdmin) admin).addLookupLocators(locs);
} catch (Throwable t){
logger.log(Level.INFO, "adding locators failed", t);
}
}
开发者ID:apache,项目名称:river-container,代码行数:22,代码来源:ServiceEditor.java
示例4: getLL
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public LookupLocator[] getLL() throws RemoteException {
LookupLocator[] specificLocators = null;
String sls = getProperty(P_LOCATORS);
if (sls != null)
locators = SorcerUtil.tokenize(sls, ",");
try {
if (locators != null && locators.length > 0) {
specificLocators = new LookupLocator[locators.length];
for (int i = 0; i < specificLocators.length; i++) {
specificLocators[i] = new LookupLocator(locators[i]);
}
}
return specificLocators;
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:21,代码来源:ServiceCataloger.java
示例5: getAllLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
private LookupLocator[] getAllLocators(String[] locs) {
List<LookupLocator> locList = null;
LookupLocator[] allLocs = new LookupLocator[0];
if (_initialLookupLocators.length > 0) {
allLocs = _initialLookupLocators;
if (locs.length > 0) {
locList = Arrays.asList(_initialLookupLocators);
for (int i = 0; i < locs.length; i++) {
try {
locList.add(new LookupLocator(locs[i]));
} catch (MalformedURLException ex) {
_logger.error("Malformed URL for: " + locs[i] + " "
+ ex.getMessage());
}
}
allLocs = (LookupLocator[]) locList.toArray();
}
}
System.out.println("all lookup locators: " + Arrays.toString(allLocs));
return allLocs;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:ServiceBrowserUI.java
示例6: ServiceNode
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
ServiceNode(ServiceItem item){
try{
_serviceItem=item;
_atts=item.attributeSets;
if(_serviceItem.service instanceof ServiceRegistrar){
ServiceRegistrar reggie=(ServiceRegistrar)_serviceItem.service;
LookupLocator ll=reggie.getLocator();
_strValue=ll.getHost()+":"+ll.getPort();
}else{
setName();
//_serviceItem.service.toString();
}
}catch(Exception ex){
ex.printStackTrace();
_strValue=_serviceItem.service.toString();
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:20,代码来源:ServiceNode.java
示例7: getService
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
/**
* Locates a service via Unicast discovery
*
* @param lusHost
* @param serviceClass
* @param serviceName
* @return proxy or <code>null</code>
* @throws java.net.MalformedURLException
* @throws java.io.IOException
* @throws ClassNotFoundException
*/
public static Object getService(String lusHost, Class serviceClass, Class[] matchTypes,
String serviceName) throws
java.io.IOException, ClassNotFoundException {
Class[] types = new Class[] { serviceClass };
if (matchTypes != null && matchTypes.length > 0) {
operator.ParTypes allTypes = new ParTypes(serviceClass, matchTypes);
types = allTypes.parameterTypes;
}
Entry[] entry = null;
if (serviceName != null) {
entry = new Entry[] { new Name(serviceName) };
}
ServiceTemplate template = new ServiceTemplate(null, types, entry);
LookupLocator loc = new LookupLocator("jini://" + lusHost);
ServiceRegistrar reggie = loc.getRegistrar();
return reggie.lookup(template);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:34,代码来源:ProviderLocator.java
示例8: getLookupLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
/**
* Returns a list of lookup locators with the URLs defined in the SORCER
* environment
*
* @see sorcer.util.Sorcer
*
* @return a list of locators for unicast lookup discovery
*/
private LookupLocator[] getLookupLocators() {
String[] locURLs = SorcerEnv.getLookupLocators();
if (locURLs == null || locURLs.length == 0) {
return null;
}
List<LookupLocator> locators = new ArrayList<>(locURLs.length);
logger.debug("ProviderAccessor Locators: {}", Arrays.toString(locURLs));
for (String locURL : locURLs)
try {
locators.add(new LookupLocator(locURL));
} catch (Exception e) {
logger.warn("Invalid Lookup URL: {}", locURL, e);
}
if (locators.isEmpty())
return null;
return locators.toArray(new LookupLocator[locators.size()]);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:28,代码来源:ServiceAccessor.java
示例9: toString
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
private static String toString(LookupLocator[] locators) {
final String[] locatorsToString = new String[locators.length];
for (int i = 0 ; i < locators.length ; i ++) {
locatorsToString[i]=locators[i].getHost() + ":" + locators[i].getPort();
}
return toString(locatorsToString);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:8,代码来源:DisconnectedFromLookupServiceException.java
示例10: getLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public LookupLocator[] getLocators() {
LookupLocator[] result;
if (!isDynamicLocatorsEnabled()) {
result = getInitialLocators();
} else {
result = getDynamicLocators();
}
return result;
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:10,代码来源:DiscoveryService.java
示例11: getDynamicLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
/**
* @return If the service discovery manager is using initial locators
* of lookup services with dynamic locators enabled, this will return
* the currently discovered locators, otherwise, it will return the initial locators.
*/
private LookupLocator[] getDynamicLocators() {
try {
return ((DiscoveryLocatorManagement)sdm.getDiscoveryManager()).getLocators();
} catch (Exception e) {
if (logger.isWarnEnabled()) {
logger.warn("Failed retrieving dynamic locators from admin, returning initial locators", e);
}
return getInitialLocators();
}
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:16,代码来源:DiscoveryService.java
示例12: getInitialLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
private LookupLocator[] getInitialLocators() {
if (locators == null) {
String locatorsProperty = SystemInfo.singleton().lookup().locators();
if (locatorsProperty != null) {
locators = locatorsProperty;
}
}
return BootUtil.toLookupLocators(locators);
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:10,代码来源:DiscoveryService.java
示例13: getLookupLocator
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public LookupLocator getLookupLocator() {
try {
return registrar.getLocator();
} catch (RemoteException e) {
throw new AdminException("Failed to get locator", e);
}
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:8,代码来源:DefaultLookupService.java
示例14: find
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public static ServiceItem[] find(String name, Class type, long wait, String[] groups, LookupLocator[] locators) {
ServiceItem[] result;
BackwardsServiceDiscoveryManager sdm = null;
try {
sdm = new BackwardsServiceDiscoveryManager(
new LookupDiscoveryManager(groups, locators, null, ServiceConfigLoader.getConfiguration()),
new LeaseRenewalManager(),
ServiceConfigLoader.getConfiguration()
);
Entry[] attributes = null;
if (name != null) {
attributes = new Entry[]{
new Name(name)
};
}
ServiceTemplate template = new ServiceTemplate(
null,
new Class[]{type},
attributes
);
result = sdm.lookup(template, 1, 1, null, wait);
} catch (Exception e) {
// TODO add proper exception here
e.printStackTrace();
result = null;
}
if (sdm != null) {
sdm.terminate();
}
return result;
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:36,代码来源:ServiceFinder.java
示例15: getLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public LookupLocator[] getLocators() {
if (locators == null) {
String locatorsProperty = SystemInfo.singleton().lookup().locators();
if (locatorsProperty != null) {
locators = BootUtil.toLookupLocators(locatorsProperty);
}
}
return locators;
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:10,代码来源:Deploy.java
示例16: getLocators
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public LookupLocator[] getLocators() {
if (locators == null) {
String locatorsProperty = SystemInfo.singleton().lookup().locators();
if (locatorsProperty != null) {
locators = BootUtil.toLookupLocators(locatorsProperty);
}
}
return locators;
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:10,代码来源:Undeploy.java
示例17: asReplicationLookupParameters
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
/**
* @return A new {@link ReplicationLookupParameters} instance constructed of the bean's properties.
*/
public ReplicationLookupParameters asReplicationLookupParameters() {
ReplicationLookupParameters parameters = new ReplicationLookupParameters();
parameters.setLookupGroups(new String[] {lookupGroup});
if (gatewayLookups != null) {
LookupLocator[] locators = new LookupLocator[gatewayLookups.size()];
for (int i = 0; i < gatewayLookups.size(); i++) {
GatewayLookup gatewayLookup = gatewayLookups.get(i);
locators[i] = new LookupLocator(gatewayLookup.getHost(), Integer.valueOf(gatewayLookup.getDiscoveryPort()));
}
parameters.setLookupLocators(locators);
}
return parameters;
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:17,代码来源:GatewayLookupsFactoryBean.java
示例18: setGroups
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
private void setGroups(String[] groups) {
((DiscoveryLocatorManagement) disco).setLocators(new LookupLocator[0]);
try {
disco.setGroups(groups);
} catch (Throwable t) {
logger.log(Level.INFO, "setting groups failed", t);
}
resetTmpl();
}
开发者ID:apache,项目名称:river-container,代码行数:10,代码来源:Browser.java
示例19: actionPerformed
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
public void actionPerformed(ActionEvent ev) {
String list =
JOptionPane.showInputDialog(Browser.this,
"Enter host[:port] addresses");
if (list == null) {
return;
}
String[] addrs = parseList(list, false);
LookupLocator[] locs = new LookupLocator[addrs.length];
for (int i = 0; i < addrs.length; i++) {
try {
locs[i] = new ConstrainableLookupLocator(
"jini://" + addrs[i], locatorConstraints);
} catch (MalformedURLException e) {
JOptionPane.showMessageDialog(Browser.this,
"\"" + addrs[i] + "\": "
+ e.getMessage(),
"Bad Address",
JOptionPane.ERROR_MESSAGE);
return;
}
}
try {
disco.setGroups(new String[0]);
} catch (Throwable t) {
logger.log(Levels.HANDLED, "setting groups failed", t);
}
((DiscoveryLocatorManagement) disco).setLocators(locs);
resetTmpl();
}
开发者ID:apache,项目名称:river-container,代码行数:31,代码来源:Browser.java
示例20: initListModel
import net.jini.core.discovery.LookupLocator; //导入依赖的package包/类
protected void initListModel() {
if (!(admin instanceof JoinAdmin)) {
return;
}
try {
LookupLocator[] locators = ((JoinAdmin) admin).getLookupLocators();
for(int i = 0; i < locators.length; i++) {
model.addElement(locators[i]);
}
} catch (Throwable t) {
logger.log(Level.INFO, "obtaining locators failed", t);
}
}
开发者ID:apache,项目名称:river-container,代码行数:15,代码来源:ServiceEditor.java
注:本文中的net.jini.core.discovery.LookupLocator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论