當前位置: 首頁>>代碼示例>>Java>>正文


Java Binding.getObject方法代碼示例

本文整理匯總了Java中javax.naming.Binding.getObject方法的典型用法代碼示例。如果您正苦於以下問題:Java Binding.getObject方法的具體用法?Java Binding.getObject怎麽用?Java Binding.getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.naming.Binding的用法示例。


在下文中一共展示了Binding.getObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: listCollectionPaths

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List resource paths (recursively), and store all of them in the given
 * Set.
 */
private static void listCollectionPaths(Set<String> set,
        DirContext resources, String path) throws NamingException {

    Enumeration<Binding> childPaths = resources.listBindings(path);
    while (childPaths.hasMoreElements()) {
        Binding binding = childPaths.nextElement();
        String name = binding.getName();
        StringBuilder childPath = new StringBuilder(path);
        if (!"/".equals(path) && !path.endsWith("/"))
            childPath.append("/");
        childPath.append(name);
        Object object = binding.getObject();
        if (object instanceof DirContext) {
            childPath.append("/");
        }
        set.add(childPath.toString());
    }

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:24,代碼來源:ApplicationContext.java

示例2: while

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List resource paths (recursively), and store all of them in the given
 * Set.
 */
private static void listCollectionPaths
    (Set set, DirContext resources, String path)
    throws NamingException {

    Enumeration childPaths = resources.listBindings(path);
    while (childPaths.hasMoreElements()) {
        Binding binding = (Binding) childPaths.nextElement();
        String name = binding.getName();
        StringBuffer childPath = new StringBuffer(path);
        if (!"/".equals(path) && !path.endsWith("/"))
            childPath.append("/");
        childPath.append(name);
        Object object = binding.getObject();
        if (object instanceof DirContext) {
            childPath.append("/");
        }
        set.add(childPath.toString());
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:ApplicationContext.java

示例3: listPaths

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List resource paths (recursively), and store all of them in the given
 * Set.
 */
private static void listPaths(Set set, DirContext resources, String path)
    throws NamingException {

    Enumeration childPaths = resources.listBindings(path);
    while (childPaths.hasMoreElements()) {
        Binding binding = (Binding) childPaths.nextElement();
        String name = binding.getName();
        String childPath = path + "/" + name;
        set.add(childPath);
        Object object = binding.getObject();
        if (object instanceof DirContext) {
            listPaths(set, resources, childPath);
        }
    }

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:21,代碼來源:ApplicationContext.java

示例4: listCollectionPaths

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List resource paths (recursively), and store all of them in the given
 * Set.
 */
private static void listCollectionPaths(Set<String> set, DirContext resources, String path) throws NamingException {

	Enumeration<Binding> childPaths = resources.listBindings(path);
	while (childPaths.hasMoreElements()) {
		Binding binding = childPaths.nextElement();
		String name = binding.getName();
		StringBuilder childPath = new StringBuilder(path);
		if (!"/".equals(path) && !path.endsWith("/"))
			childPath.append("/");
		childPath.append(name);
		Object object = binding.getObject();
		if (object instanceof DirContext) {
			childPath.append("/");
		}
		set.add(childPath.toString());
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:23,代碼來源:ApplicationContext.java

示例5: listContext

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * Recursively exhaust the JNDI tree
 */
private static final void listContext(javax.naming.Context ctx, String indent) {
   try {
      NamingEnumeration<Binding> list = ctx.listBindings("");
      while (list.hasMore()) {
         Binding item = (Binding) list.next();
         String className = item.getClassName();
         String name = item.getName();
         log.info(indent + className + " | " + name);
         Object o = item.getObject();
         if (o instanceof javax.naming.Context) {
            listContext((javax.naming.Context) o, indent + "   ");
         }
      }
   } catch (NamingException ex) {
      log.warn("JNDI failure: ", ex);
   }
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:21,代碼來源:EESchedulerTask.java

示例6: createJndiBinding

import javax.naming.Binding; //導入方法依賴的package包/類
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);
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:26,代碼來源:JndiBinding.java

示例7: dumpBindings

import javax.naming.Binding; //導入方法依賴的package包/類
private static void dumpBindings(Context ctx, int indent) {
  try {
    NamingEnumeration<Binding> bindings = ctx.listBindings("");
    while (bindings.hasMore()) {
      Binding binding = bindings.next();

      StringBuffer blanks = new StringBuffer();
      for (int i = 0; i < indent; i++) {
        blanks.append(" ");
      }
      System.out.println(String.format("%s%s (%s)", blanks, binding.getName(), binding.getClassName()));

      Object boundObj = binding.getObject();
      if (boundObj instanceof Context) {
        dumpBindings((Context) boundObj, indent + 3);
      }
    }
  } catch (NamingException e) {
    System.out.println(e);
  }
}
 
開發者ID:thomasfischl,項目名稱:fhbay,代碼行數:22,代碼來源:DateUtil.java

示例8: printResources

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List the resources of the given context.
 */
protected void printResources(PrintWriter writer, String prefix,
                              javax.naming.Context namingContext,
                              String type, Class<?> clazz,
                              StringManager smClient) {

    try {
        NamingEnumeration<Binding> items = namingContext.listBindings("");
        while (items.hasMore()) {
            Binding item = items.next();
            if (item.getObject() instanceof javax.naming.Context) {
                printResources
                    (writer, prefix + item.getName() + "/",
                     (javax.naming.Context) item.getObject(), type, clazz,
                     smClient);
            } else {
                if ((clazz != null) &&
                    (!(clazz.isInstance(item.getObject())))) {
                    continue;
                }
                writer.print(prefix + item.getName());
                writer.print(':');
                writer.print(item.getClassName());
                // Do we want a description if available?
                writer.println();
            }
        }
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log("ManagerServlet.resources[" + type + "]", t);
        writer.println(smClient.getString("managerServlet.exception",
                t.toString()));
    }

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:38,代碼來源:ManagerServlet.java

示例9: printResources

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List the resources of the given context.
 */
protected void printResources(PrintWriter writer, String prefix,
                              javax.naming.Context namingContext,
                              String type, Class clazz) {

    try {
        NamingEnumeration items = namingContext.listBindings("");
        while (items.hasMore()) {
            Binding item = (Binding) items.next();
            if (item.getObject() instanceof javax.naming.Context) {
                printResources
                    (writer, prefix + item.getName() + "/",
                     (javax.naming.Context) item.getObject(), type, clazz);
            } else {
                if ((clazz != null) &&
                    (!(clazz.isInstance(item.getObject())))) {
                    continue;
                }
                writer.print(prefix + item.getName());
                writer.print(':');
                writer.print(item.getClassName());
                // Do we want a description if available?
                writer.println();
            }
        }
    } catch (Throwable t) {
        log("ManagerServlet.resources[" + type + "]", t);
        writer.println(sm.getString("managerServlet.exception",
                                    t.toString()));
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:35,代碼來源:ManagerServlet.java

示例10: clearContext

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * 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());
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:15,代碼來源:ContextJUnitTest.java

示例11: verifyListBindings

import javax.naming.Binding; //導入方法依賴的package包/類
private void verifyListBindings(Context c, String name, Object obj1, Object obj2)
    throws NamingException {
  boolean datasourceFoundFlg = false;
  boolean o2FoundFlg = false;
  boolean datasourceO1FoundFlg = false;
  boolean datasourceNullFoundFlg = false;

  // List bindings for the specified context
  for (NamingEnumeration en = c.listBindings(name); en.hasMore();) {
    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")) {
          // check for null object
          assertNull(b1.getObject());
          datasourceNullFoundFlg = true;
        }
      }
    } else if (b.getName().equals("sub42")) {
      assertEquals(b.getObject(), obj2);
      o2FoundFlg = true;
    }
  }
  if (!(datasourceFoundFlg && o2FoundFlg && datasourceO1FoundFlg && datasourceNullFoundFlg)) {
    fail();
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:36,代碼來源:ContextJUnitTest.java

示例12: printResources

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List the resources of the given context.
 */
protected void printResources(final PrintWriter writer, final String prefix,
                              final javax.naming.Context namingContext,
                              final String type, final Class clazz) {

  try {
    final NamingEnumeration items = namingContext.listBindings("");
    while (items.hasMore()) {
      final Binding item = (Binding) items.next();
      if (item.getObject() instanceof javax.naming.Context) {
        printResources
                (writer, prefix + item.getName() + '/',
                        (javax.naming.Context) item.getObject(), type, clazz);
      } else {
        if (clazz != null &&
                !clazz.isInstance(item.getObject())) {
          continue;
        }
        writer.print(prefix + item.getName());
        writer.print(':');
        writer.print(item.getClassName());
        // Do we want a description if available?
        writer.println();
      }
    }
  } catch (Throwable t) {
    log("ManagerServlet.resources[" + type + ']', t);
    writer.println(sm.getString("managerServlet.exception",
            t.toString()));
  }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:ManagerServlet.java

示例13: printResources

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * List the resources of the given context.
 */
protected void printResources(PrintWriter writer, String prefix, javax.naming.Context namingContext, String type,
		Class<?> clazz, StringManager smClient) {

	try {
		NamingEnumeration<Binding> items = namingContext.listBindings("");
		while (items.hasMore()) {
			Binding item = items.next();
			if (item.getObject() instanceof javax.naming.Context) {
				printResources(writer, prefix + item.getName() + "/", (javax.naming.Context) item.getObject(), type,
						clazz, smClient);
			} else {
				if ((clazz != null) && (!(clazz.isInstance(item.getObject())))) {
					continue;
				}
				writer.print(prefix + item.getName());
				writer.print(':');
				writer.print(item.getClassName());
				// Do we want a description if available?
				writer.println();
			}
		}
	} catch (Throwable t) {
		ExceptionUtils.handleThrowable(t);
		log("ManagerServlet.resources[" + type + "]", t);
		writer.println(smClient.getString("managerServlet.exception", t.toString()));
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:32,代碼來源:ManagerServlet.java

示例14: clearContext

import javax.naming.Binding; //導入方法依賴的package包/類
/**
 * Removes all entries from the specified context, including subcontexts.
 * 
 * @param context context ot 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());
  }
  
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:19,代碼來源:ContextTest.java

示例15: assertBinding

import javax.naming.Binding; //導入方法依賴的package包/類
protected void assertBinding(Binding binding) throws NamingException {
   Object object = binding.getObject();
   assertTrue("Should have got a child context but got: " + object, object instanceof Context);

   Context childContext = (Context) object;
   NamingEnumeration<Binding> iter = childContext.listBindings("");
   while (iter.hasMore()) {
      Binding destinationBinding = iter.next();
      LOG.info("Found destination: " + destinationBinding.getName());
      Object destination = destinationBinding.getObject();
      assertTrue("Should have a Destination but got: " + destination, destination instanceof Destination);
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:14,代碼來源:JNDITestSupport.java


注:本文中的javax.naming.Binding.getObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。