📄 abstractnamespace.java
字号:
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.excalibur.naming;
import java.util.Hashtable;
import javax.naming.NameParser;
import javax.naming.Name;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import javax.naming.spi.ObjectFactory;
import javax.naming.spi.StateFactory;
/**
* This is the class to extend that provides
* basic facilities for Namespace management.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @version $Revision: 1.2 $
*/
public abstract class AbstractNamespace
implements Namespace
{
protected ObjectFactory[] m_objectFactorySet;
protected StateFactory[] m_stateFactorySet;
public Object getStateToBind( final Object object,
final Name name,
final Context parent,
final Hashtable environment )
throws NamingException
{
//for thread safety so that member variable can be updated
//at any time
final StateFactory[] stateFactorySet = m_stateFactorySet;
for( int i = 0; i < stateFactorySet.length; i++ )
{
final Object result =
stateFactorySet[ i ].getStateToBind( object, name, parent, environment );
if( null != result )
{
return result;
}
}
return object;
}
public Object getObjectInstance( final Object object,
final Name name,
final Context parent,
final Hashtable environment )
throws Exception
{
//for thread safety so that member variable can be updated
//at any time
final ObjectFactory[] objectFactorySet = m_objectFactorySet;
for( int i = 0; i < objectFactorySet.length; i++ )
{
final Object result =
objectFactorySet[ i ].getObjectInstance( object, name, parent, environment );
if( null != result )
{
return result;
}
}
return object;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -