@Test public void testLookup() throws NamingException { JndiDTO data=jndiFacade.lookup("string"); assertEquals("string", data.getSimpleName()); assertEquals("string", data.getFullName()); assertEquals("java.lang.String", data.getTypeNames()[0]); data=jndiFacade.lookup("subcontext"); assertEquals("subcontext", data.getSimpleName()); assertEquals("subcontext", data.getFullName()); assertEquals("javax.naming.Context", data.getTypeNames()[0]); data=jndiFacade.lookup("subcontext/boolean"); assertEquals("boolean", data.getSimpleName()); assertEquals("subcontext/boolean", data.getFullName()); assertEquals("java.lang.Boolean", data.getTypeNames()[0]); assertNull(jndiFacade.lookup("null")); data=jndiFacade.lookup(null); assertEquals("", data.getSimpleName()); assertEquals("", data.getFullName()); assertEquals("javax.naming.Context", data.getTypeNames()[0]); }
@Override public JndiDTO lookup(final String name) throws NamingException { return execute(new ContextCallback<JndiDTO>() { @Override public JndiDTO doInJndi(Context context) throws NamingException { String fullName=fixName(name); String simpleName; Object object; if (fullName.isEmpty()) { object = context; simpleName = ""; } else { object=context.lookup(fullName); simpleName=null; } if (object==null) { return null; } return createData(context, fullName, simpleName, object.getClass().getName(), object); } }); }
JndiFacade extends MBeanSupport implements JndiFacadeMXBean { @Override public JndiDTO lookup(final String name) throws NamingException { return execute(new ContextCallback<JndiDTO>() { @Override public JndiDTO doInJndi(Context context) throws NamingException { String fullName=fixName(name); String simpleName; Object object; if (fullName.isEmpty()) { object = context; simpleName = ""; } else { object=context.lookup(fullName); simpleName=null; } if (object==null) { return null; } return createData(context, fullName, simpleName, object.getClass().getName(), object); } }); } }
JndiFacade extends MBeanSupport implements JndiFacadeMXBean { @Override public JndiDTO lookup(final String name) throws NamingException { return execute(new ContextCallback<JndiDTO>() { @Override public JndiDTO doInJndi(Context context) throws NamingException { String fullName=fixName(name); String simpleName; Object object; if (fullName.isEmpty()) { object = context; simpleName = ""; } else { object=context.lookup(fullName); simpleName=null; } if (object==null) { return null; } return createData(context, fullName, simpleName, object.getClass().getName(), object); } }); } JndiFacade(); }
JndiFacade extends MBeanSupport implements JndiFacadeMXBean { @Override public JndiDTO lookup(final String name) throws NamingException { return execute(new ContextCallback<JndiDTO>() { @Override public JndiDTO doInJndi(Context context) throws NamingException { String fullName=fixName(name); String simpleName; Object object; if (fullName.isEmpty()) { object = context; simpleName = ""; } else { object=context.lookup(fullName); simpleName=null; } if (object==null) { return null; } return createData(context, fullName, simpleName, object.getClass().getName(), object); } }); } JndiFacade(); final void addDataTypes(Collection<Class>  aDataTypes); final void addDataTypes(Class... aDataTypes); final void addDataTypes(String... aDataTypeNames); @Override JndiDTO[] list(final String name); @Override JndiDTO lookup(final String name); @Override JndiDTO[] getData(); @Override String getContextName(); void setContextName(String contextName); Hashtable<String, ?> getEnvironment(); void setEnvironment(Hashtable<String, ?> environment); }
JndiFacade extends MBeanSupport implements JndiFacadeMXBean { @Override public JndiDTO lookup(final String name) throws NamingException { return execute(new ContextCallback<JndiDTO>() { @Override public JndiDTO doInJndi(Context context) throws NamingException { String fullName=fixName(name); String simpleName; Object object; if (fullName.isEmpty()) { object = context; simpleName = ""; } else { object=context.lookup(fullName); simpleName=null; } if (object==null) { return null; } return createData(context, fullName, simpleName, object.getClass().getName(), object); } }); } JndiFacade(); final void addDataTypes(Collection<Class>  aDataTypes); final void addDataTypes(Class... aDataTypes); final void addDataTypes(String... aDataTypeNames); @Override JndiDTO[] list(final String name); @Override JndiDTO lookup(final String name); @Override JndiDTO[] getData(); @Override String getContextName(); void setContextName(String contextName); Hashtable<String, ?> getEnvironment(); void setEnvironment(Hashtable<String, ?> environment);  }