javax.naming.Binding.getObject()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中javax.naming.Binding.getObject()方法的一些代码示例,展示了Binding.getObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.getObject()方法的具体详情如下:
包路径:javax.naming.Binding
类名称:Binding
方法名:getObject

Binding.getObject介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

protected Object found(final ContextNode contextNode) throws NamingException {
  return contextNode.binding.getObject();
}

代码示例来源:origin: wildfly/wildfly

protected Object found(final BindingNode bindingNode) throws NamingException {
  return bindingNode.binding.getObject();
}

代码示例来源:origin: wildfly/wildfly

private void fireEvent(final ContextNode contextNode, final Name name, final Binding existingBinding, final Binding newBinding, final int type, final String changeInfo) {
  final NamingEventCoordinator coordinator = eventCoordinator;
  if (eventCoordinator != null) {
    final Context context = Context.class.cast(contextNode.binding.getObject());
    if(context instanceof EventContext) {
      coordinator.fireEvent(EventContext.class.cast(context), name, existingBinding, newBinding, type, changeInfo, NamingEventCoordinator.DEFAULT_SCOPES);
    }
  }
}

代码示例来源:origin: wildfly/wildfly

protected T foundReferenceInsteadOfContext(BindingNode bindingNode) throws NamingException {
    final Object object = bindingNode.binding.getObject();
    checkReferenceForContinuation(currentName, object);
    throw notAContextException(bindingNode.fullName);
  }
}

代码示例来源:origin: wildfly/wildfly

public static void tearDownRecursively(final Context c) throws Exception {
 for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore(); ) {
   Binding b = ne.next();
   String name = b.getName();
   Object object = b.getObject();
   if (object instanceof Context) {
    JNDIUtil.tearDownRecursively((Context) object);
   }
   c.unbind(name);
 }
}

代码示例来源:origin: wildfly/wildfly

protected List<Binding> found(final BindingNode bindingNode) throws NamingException {
    checkReferenceForContinuation(new CompositeName(), bindingNode.binding.getObject());
    throw notAContextException(targetName);
  }
}

代码示例来源:origin: wildfly/wildfly

protected List<NameClassPair> found(final BindingNode bindingNode) throws NamingException {
    checkReferenceForContinuation(new CompositeName(), bindingNode.binding.getObject());
    throw notAContextException(targetName);
  }
}

代码示例来源:origin: apache/geode

public static Map<String, String> getBindingNamesRecursively(Context ctx) throws Exception {
  Map<String, String> result = new HashMap<>();
  NamingEnumeration<Binding> enumeration = ctx.listBindings("");

  while (enumeration.hasMore()) {
   Binding binding = enumeration.next();
   String name = binding.getName();
   String separator = name.endsWith(":") ? "" : "/";
   Object o = binding.getObject();
   if (o instanceof Context) {
    Map<String, String> innerBindings = getBindingNamesRecursively((Context) o);
    innerBindings.forEach((k, v) -> result.put(name + separator + k, v));
   } else {
    result.put(name, binding.getClassName());
   }
  }

  return result;
 }
}

代码示例来源:origin: wildfly/wildfly

protected Object foundReferenceInsteadOfContext(final BindingNode bindingNode) throws NamingException {
    final Name remainingName = targetName.getSuffix(bindingNode.fullName.size());
    final Object boundObject = bindingNode.binding.getObject();
    checkReferenceForContinuation(remainingName, boundObject);
    return new ResolveResult(boundObject, remainingName);
  }
}

代码示例来源:origin: wildfly/wildfly

protected final T found(final BindingNode bindingNode) throws NamingException {
  checkReferenceForContinuation(targetName.getSuffix(bindingNode.fullName.size()), bindingNode.binding.getObject());
  throw notAContextException(targetName);
}

代码示例来源:origin: javamelody/javamelody

private static JndiBinding createJndiBinding(String path, Binding binding) {
  final String name = getBindingName(path, binding);
  final String className = binding.getClassName();
  final Object object = binding.getObject();
  final String contextPath;
  final String value;
  if (object instanceof Context
      // "javax.naming.Context".equals(className) nécessaire pour le path "comp" dans JBoss 6.0
      || "javax.naming.Context".equals(className)
      // pour jetty :
      || object instanceof Reference
          && "javax.naming.Context".equals(((Reference) object).getClassName())) {
    if (!path.isEmpty()) {
      contextPath = path + '/' + name;
    } else {
      // nécessaire pour jonas 5.1.0
      contextPath = name;
    }
    value = null;
  } else {
    contextPath = null;
    value = formatValue(object);
  }
  return new JndiBinding(name, className, contextPath, value);
}

代码示例来源:origin: apache/geode

/**
 * Removes all entries from the specified context, including subcontexts.
 *
 * @param context context to clear
 */
private void clearContext(Context context) throws NamingException {
 for (NamingEnumeration e = context.listBindings(""); e.hasMoreElements();) {
  Binding binding = (Binding) e.nextElement();
  if (binding.getObject() instanceof Context) {
   clearContext((Context) binding.getObject());
  }
  context.unbind(binding.getName());
 }
}

代码示例来源:origin: apache/geode

Binding b = (Binding) en.next();
if (b.getName().equals("datasource")) {
 assertEquals(b.getObject(), dataSourceContext);
 datasourceFoundFlg = true;
 Context nextCon = (Context) b.getObject();
 for (NamingEnumeration en1 = nextCon.listBindings(""); en1.hasMore();) {
  Binding b1 = (Binding) en1.next();
  if (b1.getName().equals("sub41")) {
   assertEquals(b1.getObject(), obj1);
   datasourceO1FoundFlg = true;
  } else if (b1.getName().equals("sub43")) {
   assertNull(b1.getObject());
   datasourceNullFoundFlg = true;
 assertEquals(b.getObject(), obj2);
 o2FoundFlg = true;

代码示例来源:origin: spring-projects/spring-framework

bindingMap.put(binding.getName(), binding);
assertTrue("Correct jdbc subcontext", bindingMap.get("jdbc").getObject() instanceof Context);
assertTrue("Correct jdbc subcontext", SimpleNamingContext.class.getName().equals(bindingMap.get("jdbc").getClassName()));
assertTrue("Correct DataSource registered", ds.equals(subBindingMap.get("myds").getObject()));
assertTrue("Correct DataSource registered", StubDataSource.class.getName().equals(subBindingMap.get("myds").getClassName()));
assertTrue("Correct DataSource registered", ds.equals(subBindingMap.get("mydsX").getObject()));
assertTrue("Correct DataSource registered", StubDataSource.class.getName().equals(subBindingMap.get("mydsX").getClassName()));
assertTrue("Correct Integer registered", i.equals(bindingMap.get("myinteger").getObject()));
assertTrue("Correct Integer registered", Integer.class.getName().equals(bindingMap.get("myinteger").getClassName()));
assertTrue("Correct String registered", s.equals(bindingMap.get("mystring").getObject()));
assertTrue("Correct String registered", String.class.getName().equals(bindingMap.get("mystring").getClassName()));

代码示例来源:origin: wildfly/wildfly

try (Marshaller marshaller = createMarshaller(mos, configuration)) {
  for (Binding binding : resultList) {
    if (binding.getObject() instanceof Context) {
      marshaller.writeByte(Protocol.P_CONTEXT);
      marshaller.writeUTF(binding.getName());

代码示例来源:origin: crashub/crash

filters == null ||
    filters.size() == 0 ||
    Utils.instanceOf(instance.getObject().getClass(), filters)) {
 if (pattern == null || pattern.matcher(fullName).find()) {
  data.add(new BindingRenderer.BindingData(fullName, instance.getClassName(), instance, verbose));
if (instance.getObject() instanceof Context) {
 data.addAll(get(filters, pattern, verbose, fullName, "", (Context) instance.getObject()));

代码示例来源:origin: apache/activemq-artemis

public static void tearDownRecursively(final Context c) throws Exception {
 for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore(); ) {
   Binding b = ne.next();
   String name = b.getName();
   Object object = b.getObject();
   if (object instanceof Context) {
    JNDIUtil.tearDownRecursively((Context) object);
   }
   c.unbind(name);
 }
}

代码示例来源:origin: org.jboss.as/jboss-as-naming

protected List<NameClassPair> found(final BindingNode bindingNode) throws NamingException {
    checkReferenceForContinuation(new CompositeName(), bindingNode.binding.getObject());
    throw notAContextException(targetName);
  }
}

代码示例来源:origin: org.ow2.joram/jndi-shared

public void resolveReferences() throws NamingException {
 for (int i = 0; i < bindings.length; i++) {
  bindings[i].setObject(
   LookupReply.resolveObject(
    bindings[i].getObject()));      
 }
}

代码示例来源:origin: org.mortbay.jetty/jetty-naming

public Object nextElement()
  {
    Binding b = (Binding)_delegate.nextElement();
    return new Binding (b.getName(), b.getClassName(), b.getObject(),true);
  }
}

相关文章