Java 8 NameParser - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NameParser class.

This code example shows how to use the following methods:parse
        } 
        catch (NameNotFoundException e)
        { 
            //expected 
        } 
        Name name = parser.parse("a");
        name.addAll(parser.parse("b/c/d"));
        NamingUtil.bind(ic, name.toString(), "333");
        assertNotNull(ic.lookup("a"));
        assertNotNull(ic.lookup("a/b"));
        assertNotNull(ic.lookup("a/b/c"));
        Context c = (Context)ic.lookup("a/b/c");
        o = c.lookup("d");
        assertNotNull(o); 
        assertEquals("333", (String)o);
        assertEquals("333", ic.lookup(name));
        ic.destroySubcontext("a");
        try 
        { 
            ic.lookup("a");

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
        } 
        catch (NameNotFoundException e)
        { 
            //expected 
        } 
        Name name = parser.parse("a");
        name.addAll(parser.parse("b/c/d"));
        NamingUtil.bind(ic, name.toString(), "333");
        assertNotNull(ic.lookup("a"));
        assertNotNull(ic.lookup("a/b"));
        assertNotNull(ic.lookup("a/b/c"));
        Context c = (Context)ic.lookup("a/b/c");
        o = c.lookup("d");
        assertNotNull(o);
        assertEquals("333", (String)o);        
        assertEquals("333", ic.lookup(name));
        ic.destroySubcontext("a");
         
        name = parser.parse("");
        name.add("x");

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
        assertEquals(props, sessionProps);
        assertTrue (session.getDebug());
 
        Context foo = icontext.createSubcontext("foo");
        NameParser parser = icontext.getNameParser("");
        Name objectNameInNamespace = parser.parse(icontext.getNameInNamespace());
        objectNameInNamespace.addAll(parser.parse("mail/Session"));
 
        NamingUtil.bind(foo, "mail/Session", new LinkRef(objectNameInNamespace.toString()));
 
        Object o = foo.lookup("mail/Session");
        assertNotNull(o); 
        Session fooSession = (Session)o;
        assertEquals(props, fooSession.getProperties());
        assertTrue(fooSession.getDebug());
 
        icontext.destroySubcontext("mail");
        icontext.destroySubcontext("foo");
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
This code example shows how to use the following methods:parse
        namingEntryName.addAll(0, prefix);
        _namingEntryNameString = namingEntryName.toString();
        NamingUtil.bind(ic, _namingEntryNameString, this);
                 
        //bind the object as well 
        Name objectName = parser.parse(getJndiName());
        objectName.addAll(0, prefix);
        _objectNameString = objectName.toString();
        NamingUtil.bind(ic, _objectNameString, object);
    }  
     
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
    public static Object lookup(Object scope, String jndiName) throws NamingExceptionName scopeName = getNameForScope(scope);
        InitialContext ic = new InitialContext();
        NameParser parser = ic.getNameParser("");
        scopeName.addAll(parser.parse(jndiName));
        return ic.lookup(scopeName);
    } 
 
    /** 
     * Get all NameEntries of a certain type in the given naming 
     * environment scope (server-wide names or context-specific names) 
     * 
     * @param scope 
     * @param clazz the type of the entry 
     * @return all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names) 
     * @throws NamingException 
     */ 
    public static List<Object> lookupNamingEntries (Object scope, Class<?> clazz)
    throws NamingException
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
     
    if (result.startsWith(ns)) {
      ns = "";
    } 
     
    return parser.parse(ns + result);
  } 
 
  public String composeName(String name, String prefix) throws NamingExceptionString result = prefix + "/" + name;
   
    String ns = ARIES_SERVICES;
     
    if (result.startsWith(ns)) {
      ns = "";
    } 
     
    parser.parse(ns + result);
     
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
		this.ctx.bind(this.tempDir.getAbsolutePath() + "/test", ds);
	} 
 
	private DataSource lookupDatasourceInJNDI(String jndiName) throws Exception {
		NameParser nameParser = this.ctx.getNameParser("");
		Name datasourceName = nameParser.parse(this.tempDir.getAbsolutePath()
				+ jndiName);
		Object obj = this.ctx.lookup(datasourceName);
		DataSource boundDs = null;
 
		if (obj instanceof DataSource) {
			boundDs = (DataSource) obj;
		} else if (obj instanceof Reference) {
			// 
			// For some reason, this comes back as a Reference 
			// instance under CruiseControl !? 
			// 
			Reference objAsRef = (Reference) obj;
			ObjectFactory factory = (ObjectFactory) Class.forName(
					objAsRef.getFactoryClassName()).newInstance();
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
  private static void bindImpl(Context context, String name,
                               Object obj, String fullName)
    throws NamingExceptionNameParser parser = context.getNameParser("");
    Name parsedName = parser.parse(name);
 
    if (parsedName.size() == 1) {
      Object value = null; 
 
      try { 
        if (context instanceof ContextImpl)
          value = ((ContextImpl) context).lookupLink(name);
        else 
          value = context.lookupLink(name);
      } catch (NameNotFoundException e) {
      } 
       
      context.rebind(name, obj);
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:parse
        namingEntryName.addAll(0, prefix);
        namingEntryNameString = namingEntryName.toString();
        NamingUtil.bind(ic, namingEntryNameString, this);
                 
        //bind the object as well 
        Name objectName = parser.parse(getJndiName());
        objectName.addAll(0, prefix);
        objectNameString = objectName.toString();
        NamingUtil.bind(ic, objectNameString, objectToBind);
    }  
     
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 NameParser Methods: