getStateToBind(Object obj, Name name, Context nameCtx,
Hashtable<?,?> environment, Attributes attrs)
throws NamingException {
// Get list of state factories
FactoryEnumeration factories = ResourceManager.getFactories(
Context.STATE_FACTORIES, environment, nameCtx);
if (factories == null) {
// no factories to try; just return originals
return new DirStateFactory.Result(obj, attrs);
}
// Try each factory until one succeeds
StateFactory factory;
Object objanswer;
DirStateFactory.Result answer = null;
while (answer == null && factories.hasMore()) {
factory = (StateFactory)factories.next();
if (factory instanceof DirStateFactory) {
answer = ((DirStateFactory)factory).
getStateToBind(obj, name, nameCtx, environment, attrs);
} else {
objanswer =