本文整理汇总了Java中net.jini.core.entry.Entry类的典型用法代码示例。如果您正苦于以下问题:Java Entry类的具体用法?Java Entry怎么用?Java Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entry类属于net.jini.core.entry包,在下文中一共展示了Entry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findTransactionManager
import net.jini.core.entry.Entry; //导入依赖的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: initialize
import net.jini.core.entry.Entry; //导入依赖的package包/类
/**
* Override initialize to perform additional initialization
*/
@Override
public void initialize(ServiceBeanContext context) throws Exception {
/* Initialize super class */
super.initialize(context);
/* Get the JMX Service URL */
Entry jmxEntry = JMXUtilities.createJMXConnectionAttribute(context.getServiceElement().getName());
if (jmxEntry!= null)
addAttribute(jmxEntry);
if (quiesceDetails != null) {
if (quiesceDetails.getStatus().equals(QuiesceState.QUIESCED)) {
QuiesceStateChangedEvent event = new QuiesceStateChangedEvent(quiesceDetails.getStatus() , quiesceDetails.getToken(), quiesceDetails.getDescription());
informQuiesceToListeners(event);
}
}
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:23,代码来源:PUServiceBeanImpl.java
示例3: getSelectedUIDescriptor
import net.jini.core.entry.Entry; //导入依赖的package包/类
private UIDescriptor getSelectedUIDescriptor() {
if (!(new ServiceListItem(item)).isUI()) {
return null;
}
Entry[] attrs = item.attributeSets;
if ((attrs != null) && (attrs.length != 0)) {
for (int i = 0; i < attrs.length; i++) {
if (attrs[i] instanceof UIDescriptor) {
UIDescriptor desc = (UIDescriptor) attrs[i];
if (!"javax.swing".equals(desc.toolkit)) {
continue;
}
return desc;
}
}
}
return null;
}
开发者ID:apache,项目名称:river-container,代码行数:21,代码来源:Browser.java
示例4: getEntryArray
import net.jini.core.entry.Entry; //导入依赖的package包/类
protected Entry[] getEntryArray() {
try{
ServiceMatches matches = registrar.lookup(new ServiceTemplate(item.serviceID,
new Class[] { item.service.getClass() },
new Entry[] {}),
10);
if(matches.totalMatches != 1)
Browser.logger.log(Level.INFO, "unexpected lookup matches: {0}",
new Integer(matches.totalMatches));
else
return matches.items[0].attributeSets;
} catch (Throwable t) {
Browser.logger.log(Level.INFO, "lookup failed", t);
}
return null;
}
开发者ID:apache,项目名称:river-container,代码行数:17,代码来源:ServiceBrowser.java
示例5: initTree
import net.jini.core.entry.Entry; //导入依赖的package包/类
protected void initTree() {
Entry[] entries = getEntryArray();
if(entries == null)
entries = new Entry[0];
for(int i = 0; i < entries.length; i++){
// check controllability
boolean nodeControllable = false;
if(isControllable && ! (entries[i] instanceof net.jini.lookup.entry.ServiceControlled)) {
nodeControllable = true;
}
ObjectNode node = new ObjectNode(entries[i], nodeControllable);
root.add(node);
try {
recursiveObjectTree(node);
} catch(IllegalAccessException e){
Browser.logger.log(Level.INFO, "entry access failed", e);
}
}
}
开发者ID:apache,项目名称:river-container,代码行数:22,代码来源:EntryTreePanel.java
示例6: cloneEntry
import net.jini.core.entry.Entry; //导入依赖的package包/类
private Entry cloneEntry(Entry attr) {
try {
Class realClass = attr.getClass();
Entry template = (Entry) realClass.newInstance();
Field[] f = realClass.getFields();
for(int i = 0; i < f.length; i++) {
if(! usableField(f[i]))
continue;
f[i].set(template, f[i].get(attr));
}
return template;
} catch (Throwable t) {
logger.log(Level.INFO, "duplicating entry failed", t);
}
return null;
}
开发者ID:apache,项目名称:river-container,代码行数:19,代码来源:ServiceEditor.java
示例7: getProviderList
import net.jini.core.entry.Entry; //导入依赖的package包/类
/**
* Returns the list of available providers in this catalog.
*
* @return
* @throws RemoteException
*/
@Override
public String[] getProviderList() throws RemoteException {
List<ServiceItem> items = cinfo.getAllServiceItems();
List<String> names = new ArrayList<String>();
for (ServiceItem si : items) {
Entry[] attributes = si.attributeSets;
for (Entry a : attributes) {
if (a instanceof Name) {
names.add(((Name) a).name);
break;
}
}
}
return names.toArray(new String[names.size()]);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:23,代码来源:ServiceCataloger.java
示例8: toString
import net.jini.core.entry.Entry; //导入依赖的package包/类
public String toString() {
StringBuilder sb = new StringBuilder();
List<ServiceItem> sItems;
for(Map.Entry<InterfaceList, List<ServiceItem>> entry : interfaceListMap.entrySet()){
sItems = entry.getValue();
sb.append("\n");
if (sItems != null && sItems.size() > 0
&& sItems.get(0) != null) {
if (sItems.get(0).attributeSets[0] instanceof Name)
sb.append(((Name) (sItems.get(0).attributeSets[0])).name);
else
sb.append(sItems.get(0).attributeSets[0]);
for (int i = 1; i < sItems.size(); i++) {
if (sItems.get(i).attributeSets[0] instanceof Name)
sb.append(",").append(((Name) (sItems.get(i).attributeSets[0])).name);
else
sb.append(",").append(sItems.get(i).attributeSets[0]);
}
sb.append("==>\n");
sb.append(entry.getKey());
}
}
return sb.toString();
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:26,代码来源:ServiceCataloger.java
示例9: listCommands
import net.jini.core.entry.Entry; //导入依赖的package包/类
private void listCommands() {
shellOutput
.println("You can manage the environment and interact with the service network using the following commands:");
StringBuilder buffer = new StringBuilder();
for (Map.Entry<String, ShellCmd> e : commandTable.entrySet()) {
buffer.append("\n\t" + e.getKey());
if (e.getKey().length() > 5)
buffer.append(": \t" + e.getValue().getUsage(e.getKey()));
else
buffer.append(": \t\t" + e.getValue().getUsage(e.getKey()));
}
shellOutput.println(buffer.toString());
shellOutput
.println("\nFor help on any of these commands fiType 'help [<command>]'."
+ "\nTo leave this program fiType 'quit'");
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:17,代码来源:NetworkShell.java
示例10: printLookupAttributes
import net.jini.core.entry.Entry; //导入依赖的package包/类
static public void printLookupAttributes(Entry[] attributeSets)
throws IOException, ClassNotFoundException {
if (attributeSets.length > 0) {
PrintStream out = NetworkShell.getShellOutputStream();
out.println("Lookup attributes:");
for (int k = 0; k < attributeSets.length; k++) {
if (attributeSets[k] instanceof UIDescriptor) {
out.println(" "
// + attributeSets[k].getClass()
// + "UIDescriptor: "
+ ((UIDescriptor) attributeSets[k]).factory
.get());
} else if (attributeSets[k] instanceof SorcerServiceInfo) {
printSorcerServiceInfo((SorcerServiceInfo) attributeSets[k]);
} else {
if (attributeSets[k] instanceof AbstractEntry) {
out.println(" "
+ toShortString((AbstractEntry) attributeSets[k]));
} else {
out.println(" " + attributeSets[k]);
}
}
}
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:26,代码来源:NetworkShell.java
示例11: takeAll
import net.jini.core.entry.Entry; //导入依赖的package包/类
private void takeAll() {
if (selectedSpace >= 0) {
javaSpace = (JavaSpace05) spaces[0].service;
} else {
out.print("no Space selected");
return;
}
ExertionEnvelop ee = new ExertionEnvelop();
for (Entry e : instanceList) {
ee.exertionID = ((ExertionEnvelop) e).exertionID;
try {
javaSpace.take(ee, null, JavaSpace.NO_WAIT);
} catch (Exception ex) {
ex.printStackTrace();
}
}
instanceList.clear();
selectedExertion = -1;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:20,代码来源:SpaceCmd.java
示例12: describeService
import net.jini.core.entry.Entry; //导入依赖的package包/类
static private void describeService(int index, String msg) throws IOException,
ClassNotFoundException {
out.println(ansi().render("@|blue ---------" + (msg != null ? " " + msg : "")
+ "|@ @|bold,blue SERVICE # " +index + "|@ @|blue ---------|@"));
out.println(ansi().render("ID: @|white " + serviceItems.get(index).serviceID + "|@"));
printServiceName(serviceItems.get(index));
Class myCls = serviceItems.get(index).service.getClass();
out.println("Proxy class: " + myCls);
Class[] allIntf = myCls.getInterfaces();
out.println("Interfaces: ");
//Class[] allIntf = myCls.printAllInterfaces();
for (int k = 0; k < allIntf.length; k++)
out.println(" " + allIntf[k].getName());
printCodebaseURL(serviceItems.get(index));
Entry[] attributeSets = serviceItems.get(index).attributeSets;
if (attributeSets != null && attributeSets.length > 0) {
NetworkShell.printLookupAttributes(attributeSets);
// for (int i = 0; i < attributeSets.length - 1; i++) {
// out.println(" - " + attributeSets[i]);
// }
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:23,代码来源:LookupCmd.java
示例13: getService
import net.jini.core.entry.Entry; //导入依赖的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
示例14: getService
import net.jini.core.entry.Entry; //导入依赖的package包/类
@Override
public <T> T getService(final String serviceName, Class<T> serviceType) {
T proxy = null;
String name = overrideName(serviceName, serviceType);
int tryNo = 0;
while (tryNo < LUS_REPEAT) {
logger.info("trying to get service: {}: {}; attempt: {}...", serviceType, name, tryNo);
try {
tryNo++;
proxy = getService(serviceType, new Entry[] { new Name(name) }, null);
if (proxy != null)
break;
Thread.sleep(WAIT_FOR);
} catch (Exception e) {
logger.error("Failed trying to get {} {}", name, serviceType.getName(), e);
}
}
logger.info("got LUS service [fiType={} name={}]: {}", serviceType.getName(), name, proxy);
return proxy;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:23,代码来源:ServiceAccessor.java
示例15: checkNullName
import net.jini.core.entry.Entry; //导入依赖的package包/类
private void checkNullName(ServiceTemplate template) {
if (template.attributeSetTemplates == null)
return;
for (Entry attr : template.attributeSetTemplates) {
if (attr instanceof Name) {
Name name = (Name) attr;
if (ANY.equals(name.name)) {
name.name = null;
logger.warn("Requested service with name '*'", new IllegalArgumentException());
}
} else if (attr instanceof SorcerServiceInfo) {
SorcerServiceInfo info = (SorcerServiceInfo) attr;
if (ANY.equals(info.providerName)) {
info.providerName = null;
logger.warn("Requested service with name '*'", new IllegalArgumentException());
}
}
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:20,代码来源:ServiceAccessor.java
示例16: run
import net.jini.core.entry.Entry; //导入依赖的package包/类
public void run() {
try {
while (running.get()) {
Thread.sleep(ProviderDelegate.KEEP_ALIVE_TIME);
// remove inactive sessions
Iterator<Map.Entry<Uuid, ServiceSession>> si = sessions.entrySet().iterator();
while (si.hasNext()) {
Map.Entry<Uuid, ServiceSession> se = si.next();
ProviderSession ss = (ProviderSession)se.getValue();
long now = System.currentTimeMillis();
if (now - ss.getLastAccessedTime() > ss.getMaxInactiveInterval() * 1000) {
si.remove();
}
}
}
} catch (Exception doNothing) {
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:20,代码来源:ServiceProvider.java
示例17: getEntryClassSet
import net.jini.core.entry.Entry; //导入依赖的package包/类
private HashSet getEntryClassSet() {
HashSet eset = getEntryClasses();
if (showSupertypes.getState()) {
HashSet sset = new HashSet();
for (Iterator iter = eset.iterator(); iter.hasNext();) {
Class type = (Class) iter.next();
if (Entry.class.isAssignableFrom(type.getSuperclass())) {
// add superclass recursively
addEntryClass(type.getSuperclass(), sset);
}
}
for (Iterator iter = sset.iterator(); iter.hasNext();)
eset.add((Class) iter.next());
}
return eset;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:19,代码来源:AttributePanel.java
示例18: addTemplate
import net.jini.core.entry.Entry; //导入依赖的package包/类
private void addTemplate(Class clazz, int depth, int[] indices,
Field[] fields, ArrayList[] vlists, HashSet tmplSet)
throws IllegalAccessException, InstantiationException {
for (int i = 0; i < vlists[depth].size(); i++) {
indices[depth] = i;
if (depth == (indices.length - 1)) {
Entry entry = (Entry) clazz.newInstance();
for (int j = 0; j < indices.length; j++)
fields[j].set(entry, vlists[j].get(indices[j]));
tmplSet.add(entry);
} else {
addTemplate(clazz, depth + 1, indices, fields, vlists,
tmplSet);
}
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:18,代码来源:AttributePanel.java
示例19: getFieldValueSet
import net.jini.core.entry.Entry; //导入依赖的package包/类
private HashSet getFieldValueSet(Entry entry, String fieldName) {
// use providers attributes
HashSet vset = new HashSet();
Class type = entry.getClass();
for (int i = 0; i < attributes.length; i++) {
try {
Field field = attributes[i].getClass().getField(fieldName);
Object value = field.get(attributes[i]);
if (value != null) {
vset.add(value);
}
} catch (Exception e) {
// ignore
}
}
return vset;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:18,代码来源:AttributePanel.java
示例20: Task
import net.jini.core.entry.Entry; //导入依赖的package包/类
Task(JavaSpaceEndpoint endpoint, Processor processor, JavaSpace javaSpace,
TransactionHelper transactionHelper, long transactionTimeout, int verb, String templateId) throws Exception {
this.endpoint = endpoint;
this.processor = processor;
this.javaSpace = javaSpace;
this.transactionHelper = transactionHelper;
this.transactionTimeout = transactionTimeout;
this.verb = verb;
if (templateId != null) {
Entry tmpl = (Entry) this.endpoint.getCamelContext().getRegistry().lookupByName(templateId);
template = javaSpace.snapshot(tmpl);
} else {
this.template = javaSpace.snapshot(new InEntry());
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:JavaSpaceConsumer.java
注:本文中的net.jini.core.entry.Entry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论