/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/**
* This is a Wrapper for {@link SerialContext}.
* This is used by {@link SerialInitContextFactory} when NamingManager is set
* up with an InitialContextFactoryBuilder. The reason for having this class
* is described below:
* When there is no builder setup, {@link InitialContext} uses a discovery
* mechanism to handle URL strings as described in
* {@link NamingManager#getURLContext(String, java.util.Hashtable)}. But,
* when a builder is set up, it by-passes this logic and delegates to whatever
* Context is returned by
* builder.createInitialContextFactory(env).getInitialContext(env).
* In our case, this results in SerialContext, which does not know how to handle
* all kinds of URL strings. So, we want to returns a WrapperSerialContext
* that delegates to appropriate URLContext whenever possible.
*
* @author Sanjeeb.Sahoo@Sun.COM
*/
{
/*
* Implementation Note:
* It extends InitialContext and overrides getURLOrDefaultInitCtx methods.
* This is a very sensitive class. Take extreme precautions while changing.
*/
// Not for public use.
throws NamingException
{
super(environment);
gotDefault = true;
}
{
// Don't bother merging with application resources or system
// properties, as that has already happened when user called
// new InitialContext. So, just store it.
}
{
return defaultInitCtx;
}
{
{
{
return ctx;
}
}
return getDefaultInitCtx();
}
{
{
{
{
return ctx;
}
}
}
return getDefaultInitCtx();
}
/**
* Return URL scheme component from this string. Returns null if there
* is no scheme.
*
* @param str
* @return
* @see javax.naming.spi.NamingManager#getURLScheme
*/
{
// Implementation is copied from
// javax.naming.spi.NamingManager#getURLScheme
{
}
return null;
}
}