Loads the implementation class hold in {@link ExtensionWrapper#implementingClassName}

@param <T>
@param extensionWrapper
@return
182135
private <T extends Assignable> Class<T> loadExtension(ExtensionWrapper extensionWrapper) {
        return loadExtensionClass(extensionWrapper.implementingClassName);
    }
92800
@Override
    public boolean isWrapperFor(@SuppressWarnings("rawtypes") Class wrappedType) {
        if (!ServletRequest.class.isAssignableFrom(wrappedType)) {
            throw new IllegalArgumentException("Given class " +
                                               wrappedType.getName() + " not a subinterface of " +
                                               ServletRequest.class.getName());
        }

        final ServletRequest request = getHttpServletRequest();
        @SuppressWarnings("unchecked")
        final Class<? extends ServletRequest> wrappedServletType = wrappedType;

        if (wrappedServletType.isAssignableFrom(request.getClass())) {
            return true;
        } else if (request instanceof ServletRequestWrapper) {
            return ((ServletRequestWrapper) request).isWrapperFor(wrappedType);
        } else {
            return false;
        }
    }
302769
public static Metadata<Extension> loadExtension(String extensionClass, ClassLoader classloader) {
        Class<? extends Extension> serviceClass = loadClass(Extension.class, extensionClass, classloader);
        if (serviceClass == null) {
            return null;
        }
        Extension serviceInstance = prepareInstance(serviceClass);
        if (serviceInstance == null) {
            return null;
        }
        return new MetadataImpl<Extension>(serviceInstance, extensionClass);
    }
1321063
@Pure
	public static ClassLoader getContextClassLoader() throws AndroidException {
		synchronized (Android.class) {
			final ClassLoader cl = (contextClassLoader == null) ? null : contextClassLoader.get();
			if (cl != null) {
				return cl;
			}
		}
		final Object context = getContext();
		try {
			final Method method = context.getClass().getMethod("getClassLoader"); //$NON-NLS-1$
			final Object classLoader = method.invoke(context);
			final ClassLoader cl = (ClassLoader) classLoader;
			synchronized (Android.class) {
				contextClassLoader = new WeakReference<>(cl);
			}
			return cl;
		} catch (Exception e) {
			throw new AndroidException(e);
		}
	}
907207
public <T extends Assignable> String getExtensionFromExtensionMapping(final Class<T> type) {
        ExtensionWrapper extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            loadExtensionMapping(type);
        }
        extensionWrapper = extensionMappings.get(type);
        if (extensionWrapper == null) {
            throw UnknownExtensionTypeExceptionDelegator.newExceptionInstance(type);
        }
        return extensionWrapper.getProperty("extension");
    }
651531
@Override
    public final EJSWrapperCommon getWrapper() // f111627
    throws CSIException,
                    RemoteException
    {
        homeEnabled();

        // EJS Homes are stateless session beans with singleton wrappers.
        // If the wrapper has been created, and is still in the wrapper cache,
        // then just return the singleton EJSWrapperCommon.
        // Note that 'inCache' will 'touch' the wrapper in the Wrapper Cache,
        // updating the LRU data and preventing it from unregistering with
        // the ORB.                                                      d196581.1
        if (ivHomeWrappers == null ||
            !ivHomeWrappers.inCache())
        {
            ivHomeWrappers = wrapperManager.getWrapper(ivHomeId); // d156807.1
        }

        return ivHomeWrappers;
    }
337228
public IServletWrapper createServletWrapper(IServletConfig config) throws Exception
  {
    ServletWrapper wrapper = new com.ibm.ws.webcontainer.osgi.servlet.ServletWrapper(extensionContext);

    if (config == null)
      return wrapper;
    try
    {
      wrapper.initialize(config);
    }
    catch (Throwable e)
    {
      // Might be more serious....so first log
      e.printStackTrace(System.out);
    }

    return wrapper;
  }
591763
@Override
    public ClassLoader getThrowawayClassLoader() {
        ClassLoader newParent = getThrowawayVersion(getParent());
        ClassLoader[] newFollowOns = new ClassLoader[followOnClassLoaders.size()];
        for (int i = 0; i < newFollowOns.length; i++) {
            newFollowOns[i] = getThrowawayVersion(followOnClassLoaders.get(i));
        }
        return new UnifiedClassLoader(newParent, newFollowOns);
    }
1362971
public Object getWrapper() throws Exception
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.entry(tc, "getWrapper");
        }

        EJSContainer container = EJSContainer.getDefaultContainer();
        Object retObj = null;
        WrapperManager wm = container.getWrapperManager();

        // The first bytes of serialized data is a header and
        // the first byte of header identifies it as either a
        // BeanId or a WrapperId. So examine first byte to
        // determine whether it is a BeanId or a WrapperId.
        if (ivIdBytes[0] == (byte) 0xAC)
        {
            // First byte indicates it is a BeanId. Use the
            // WrapperManager to find the wrapper in wrapper cache.
            ByteArray byteArray = new ByteArray(ivIdBytes);

            if (DEBUG_ON) // d458325
            {
                if (isTraceOn && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized BeanId bytes = " + byteArray.toString());
                }
            }

            BeanId beanId = BeanId.getBeanId(byteArray, container);

            if (isTraceOn && tc.isDebugEnabled())
            {
                Tr.debug(tc, "deserialized a BeanId = " + beanId
                             + ", primary key = " + beanId.getPrimaryKey());
            }

            retObj = wm.getWrapper(beanId).getLocalObject();
        }
        else if (ivIdBytes[0] == (byte) 0xAD) // d458325
        {
            // First byte indicates it is a WrapperId that was serialized.
            // Recreate the WrapperId and use it to get BeanId, local business
            // interface name, and local business interface index.
            WrapperId wrapperId = new WrapperId(ivIdBytes);
            int index = wrapperId.ivInterfaceIndex;
            String interfaceName = wrapperId.ivInterfaceClassName;

            if (DEBUG_ON) // d458325
            {
                if (isTraceOn && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized WrapperId bytes[" + ivIdBytes.length + "] = "
                                 + wrapperId.toString());
                    Tr.debug(tc, "WrapperId.ivInterfaceIndex = " + index
                                 + ", WrapperId.ivInterfaceClassName = " + interfaceName
                                 + ", WrapperId.ivBeanIdIndex = " + wrapperId.ivBeanIdIndex);
                }
            }

            ByteArray byteArray = wrapperId.getBeanIdArray();
            BeanId beanId = BeanId.getBeanId(byteArray, container);
            BeanMetaData bmd = beanId.getBeanMetaData();

            Tr.debug(tc, "deserialized a WrapperId for BeanId = " + beanId
                         + ", primary key = " + beanId.getPrimaryKey());

            // Obtain the home and create the 'set' of wrappers for the
            // deserialized BeanId.
            EJSHome home = bmd.getHome();
            EJSWrapperCommon wc = home.internalCreateWrapper(beanId);

            // Finally, decide which proxy is needed from the set. This may
            // be for an aggregate local wrapper (all business local interfaces)
            // or it may be for a specific interface, in which case the index
            // must be verified                                          F743-34304
            if (index == EJSWrapperBase.AGGREGATE_LOCAL_INDEX)
            {
                retObj = wc.getAggregateLocalWrapper();
            }
            else
            {
                // Now verify index is still valid. If we fail over to a new server,
                // the index for the interface may be different than original server.
                // In that case, we need to determine the new index.
                Class<?>[] bInterfaces = bmd.ivBusinessLocalInterfaceClasses;
                int numberOfLocalInterfaces = bInterfaces.length;
                String wrapperInterfaceName = null;
                if (index < numberOfLocalInterfaces)
                {
                    wrapperInterfaceName = bInterfaces[index].getName();
                }

                // Is the BusinessLocalWrapper for the correct interface name?
                if ((wrapperInterfaceName == null) || (!wrapperInterfaceName.equals(interfaceName)))
                {
                    // Nope, index must be invalid, so we need to get an updated index
                    // that matches the desired interface name.
                    // Fix up the WrapperId with index that matches this server.
                    index = bmd.getRequiredLocalBusinessInterfaceIndex(interfaceName);
                }

                // Now that we have correct index, obtain the corresponding
                // proxy object.
                retObj = wc.getLocalBusinessObject(index);
            }
        }

        // Return the wrapper
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.exit(tc, "getWrapper returning: " +
                        (retObj == null ? retObj
                                        : (retObj.getClass().getName() +
                                        '@' + Integer.toHexString(retObj.hashCode()))));
        }
        return retObj;
    }
439196
@Override
    public boolean isWrapperFor(@SuppressWarnings("rawtypes") Class wrappedType) {
        if (!ServletResponse.class.isAssignableFrom(wrappedType)) {
            throw new IllegalArgumentException("Given class " +
                                               wrappedType.getName() + " not a subinterface of " +
                                               ServletResponse.class.getName());
        }

        final ServletResponse response = getHttpServletResponse();
        @SuppressWarnings("unchecked")
        final Class<? extends ServletResponse> wrappedServletType = wrappedType;

        if (wrappedServletType.isAssignableFrom(response.getClass())) {
            return true;
        } else if (response instanceof ServletResponseWrapper) {
            return ((ServletResponseWrapper) response).isWrapperFor(wrappedType);
        } else {
            return false;
        }
    }
294089
public Class<?> loadClassFrom(String name, AbstractClassLoader first) throws ClassNotFoundException {
		// try on the system one
		try { return AppClassLoader.class.getClassLoader().loadClass(name); }
		catch (ClassNotFoundException e) { /* not found. */ }
		Class<?> c = null;
		// check it is not loaded on one of the library
		for (int i = 0; i < libs.size(); i++) {
    		AbstractClassLoader cl = libs.get(i);
    		c = cl.isLoaded(name);
    		if (c != null) return c;
    	}
    	// try with the first one
    	if (first != null) {
    		try {
    			c = first.loadClassInLibrary(name);
    			if (c != null) return c;
    		} catch (FileNotFoundException e) {
    			// not found
    		} catch (IOException e) {
    			throw new ClassNotFoundException(e.getMessage());
    		}
    	}
    	// then, try on other libraries
    	for (int i = 0; i < libs.size(); i++) {
    		AbstractClassLoader cl = libs.get(i);
    		if (cl == first) continue;
    		try {
    			c = cl.loadClassInLibrary(name);
    			if (c != null) return c;
    		} catch (FileNotFoundException e) {
    			// not found
    		} catch (IOException e) {
    			throw new ClassNotFoundException(e.getMessage());
    		}
    	}
		StringBuilder msg = new StringBuilder(512);
		msg.append("Class not found: ").append(name);
		msg.append("\r\nFrom class loader: ").append(first);
		msg.append("\r\nlibraries currently registered:");
		for (int i = 0; i < libs.size(); i++)
			msg.append("\r\n - ").append(libs.get(i).toString());
		throw new ClassNotFoundException(msg.toString());
	}

	/** Load a resource. */
	@SuppressWarnings("resource")
	public IO.Readable getResourceIO(String name, byte priority) {
		if (name.length() == 0) return null;
		if (name.charAt(0) == '/') name = name.substring(1);
		IO.Readable io = null;
    	for (int i = 0; i < libs.size(); i++) {
    		AbstractClassLoader cl = libs.get(i);
   			try { io = cl.open(name, priority); }
   			catch (IOException e) { /* ignore */ }
    		if (io != null) return io;
    	}
       	// then try on the core one
        InputStream in = AppClassLoader.class.getClassLoader().getResourceAsStream(name);
        if (in == null) return null;
        return new IOFromInputStream(in, name, Threading.getUnmanagedTaskManager(), priority);
	}
570931
public org.apache.commons.configuration.Configuration getConfiguration(ConfigurationWrapper wrapper) {
		// get input streams
		List<ISource> sources = this.locate(wrapper);
		
		// create configuration combiner
		OverrideCombiner combiner = new OverrideCombiner();
		CombinedConfiguration combined = new CombinedConfiguration(combiner);
		
		// combine configurations
		for(ISource source : sources) {
			// determine mime type in order to create proper commons object
			SupportedType type = MimeGuesser.guess(source);
			
			// if the source isn't available, continue
			if(!source.available()) {
				continue;
			}
			
			InputStream stream = source.stream();
			
			// load properties based on MIME type
			// todo: update for more commons-configuration
			// supported mime types
			if(SupportedType.XML.equals(type)) {
				XMLConfiguration xmlConfiguration = new XMLConfiguration();
				try {
					xmlConfiguration.load(stream);
					combined.addConfiguration(xmlConfiguration);
				} catch(ConfigurationException e) {
					this.logger.error("An error occurred while reading XML properties: {}", e.getMessage());	
				}
			} else {
				PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();
				try {
					propertiesConfiguration.load(stream);
					combined.addConfiguration(propertiesConfiguration);
				} catch (ConfigurationException e) {
					this.logger.error("An error occurred while reading properties: {}", e.getMessage());
				}				
			}
			
			// close stream
			try {
				stream.close();
			} catch (IOException e) {
				this.logger.trace("Could not close old stream: {}", stream);
			}
			
			// leave on first loop if merge is on
			if(!wrapper.merge()) {
				break;
			}
		}		
		// return configuration
		return combined;
	}
1229031
public static <C> Class<? extends C> findImplementation(Class<? super C> restrictionClass, String value) {
    // Add all from service files (i.e. jars)
    if(!contains(restrictionClass)) {
      ELKIServiceLoader.load(restrictionClass);
      ELKIServiceScanner.load(restrictionClass);
    }
    Entry e = data.get(restrictionClass);
    int pos = -1;
    Class<?> clazz = null;
    // First, try the lookup cache:
    if(e != null) {
      for(pos = 0; pos < e.len; pos++) {
        if(e.names[pos].equals(value)) {
          break;
        }
      }
      if(pos < e.len) {
        clazz = e.clazzes[pos];
      }
      else {
        pos = -1;
      }
    }
    else {
      if(LOG.isDebugging()) {
        LOG.debug("Requested implementations for unregistered type: " + restrictionClass.getName() + " " + value);
      }
    }
    // Next, try alternative versions:
    clazz = clazz != null ? clazz : tryAlternateNames(restrictionClass, value, e);
    if(clazz == null) {
      return null;
    }

    if(!restrictionClass.isAssignableFrom(clazz)) {
      LOG.warning("Invalid entry in service file for class " + restrictionClass.getName() + ": " + value);
      clazz = FAILED_LOAD;
    }
    if(e != null) {
      if(pos < 0) {
        e.addHit(value, clazz);
      }
      else {
        assert (e.names[pos].equalsIgnoreCase(value));
        e.clazzes[pos] = clazz;
      }
    }
    if(clazz == FAILED_LOAD) {
      return null;
    }
    @SuppressWarnings("unchecked")
    Class<? extends C> ret = (Class<? extends C>) clazz.asSubclass(restrictionClass);
    return ret;
  }
92648
private static ClassLoader extensionClassLoader(final ClassLoader environment) {
    ClassLoader cl = environment;
    ClassLoader prev = null;
    while (cl != null) {
      prev = cl;
      cl = cl.getParent();
    }
    return prev;
  }
1125811
@Override
    public Class<?> loadClass(String name) throws ClassNotFoundException {
        if (name.equals(bundleName)) {
            // We're loading the base bundle. Good! Let it load.
            return super.loadClass(name);
        } else {
            // We're NOT loading the base bundle, so return null.
            return null;
        }
    }
250696
@Override
    public <T> T unwrap(Class<T> paramClass)
    {
        try
        {
            return (T) this;
        }
        catch (ClassCastException ccex)
        {
            throw new PersistenceException("Provider does not support the call for class type:[" + paramClass + "]");
        }
    }
429528
@Override
    @Trivial
    public void addClassLoader(ClassLoader classLoader) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "addClassLoader - " + classLoader);
        }

        if (classLoader instanceof ContainerClassLoader) {
            synchronized (classLoaders) {
                classLoaders.add((ContainerClassLoader) classLoader);
            }
        } else {
            throw new IllegalArgumentException("classLoader is not a ContainerClassLoader");
        }
    }