Skip to content

Commit

Permalink
Added some servlet session context tests, JNDI manager test (broken),…
Browse files Browse the repository at this point in the history
… and RI/SPI changes to support JNDI binding of Manager.

git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2151 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
drallen committed Mar 23, 2009
1 parent 9499ffa commit 3e64925
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Expand Up @@ -50,4 +50,10 @@ public interface NamingContext extends Service
*/
public void bind(String name, Object value);

/**
* Unbinds an entry from JNDI.
*
* @param key The key of the object in JNDI to unbind
*/
public void unbind(String key);
}
Expand Up @@ -49,9 +49,18 @@ public void bind(String key, Object value)
{
List<String> parts = splitIntoContexts(key);
Context context = getContext();
Context nextContext = null;
for (int i = 0; i < parts.size() - 1; i++)
{
context = (Context) context.lookup(parts.get(i));
try
{
nextContext = (Context) context.lookup(parts.get(i));
}
catch (NamingException e)
{
nextContext = context.createSubcontext(parts.get(i));
}
context = nextContext;
}
context.bind(parts.get(parts.size() - 1), value);
}
Expand All @@ -61,6 +70,23 @@ public void bind(String key, Object value)
}
}

/**
* Unbinds an entry from JNDI.
*
* @param key The key of the object in JNDI to unbind
*/
public void unbind(String key)
{
try
{
getContext().unbind(key);
}
catch (NamingException e)
{
throw new ExecutionException("Cannot unbind " + key, e);
}
}

/**
* Lookup an item from JNDI
*
Expand Down
Expand Up @@ -16,5 +16,11 @@ public <T> T lookup(String name, Class<? extends T> expectedType)
// TODO Auto-generated method stub
return null;
}

public void unbind(String key)
{
// TODO Auto-generated method stub

}

}

0 comments on commit 3e64925

Please sign in to comment.