protected ResolveResult getBaseURLContext( final Name name, final Hashtable environment )
throws NamingException
{
if( name.isEmpty() )
{
throw new InvalidNameException( "Unable to locate URLContext will empty name" );
}
final String nameString = name.get(0).toString();
int index = nameString.indexOf( ':' );
if( -1 == index )
{
final String explanation =
"Unable to build URLContext as it does not specify scheme";
throw new InvalidNameException( explanation );
}
final String scheme = nameString.substring( 0, index );
final int end = getEndIndexOfURLPart( nameString, index + 1 );
final String urlPart = nameString.substring( index + 1, end );
final String namePart = nameString.substring( end );
if( !m_scheme.equals( scheme ) )
{
final String explanation =
"Bad Scheme use to build URLContext (" +
scheme + "). " + "Expected " + m_scheme;
throw new InvalidNameException( explanation );
}
final Context context = newContext( urlPart );
return new ResolveResult( context, new CompositeName( namePart ) );