com.cc.framework.adapter
Class FrameworkAdapterFactory

java.lang.Object
  extended bycom.cc.framework.adapter.FrameworkAdapterFactory
All Implemented Interfaces:
Factory, Singleton

public abstract class FrameworkAdapterFactory
extends java.lang.Object
implements Singleton, Factory

Factory class for Framework Adapters. An application can register a framework adapter direct by calling the registerAdapter()method or let the factory search for a matching framework adapter.

Version:
$Revision: 1.12 $
Author:
Harald Schulz

Field Summary
private static FrameworkAdapter adapter
          The cached framework adapter instance
private static org.apache.commons.logging.Log log
          Commons Logging instance.
 
Constructor Summary
private FrameworkAdapterFactory()
          Constructor
 
Method Summary
private static FrameworkAdapter createAdapter()
          Creates a new framework adapter for the current application.
static FrameworkAdapter getAdapter()
          Retrieves an adapter for the current host framework.
protected static java.lang.ClassLoader getContextClassLoader()
          Return the thread context class loader if available.
private static java.lang.Class loadClass(java.lang.String name)
          MUST KEEP THIS METHOD PRIVATE Exposing this method establishes a security violation.
static void registerAdapter(FrameworkAdapter newAdapter)
          Registers the Framework Adapter that should be used for this Application
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Commons Logging instance.


adapter

private static FrameworkAdapter adapter
The cached framework adapter instance

Constructor Detail

FrameworkAdapterFactory

private FrameworkAdapterFactory()
Constructor

Method Detail

getAdapter

public static FrameworkAdapter getAdapter()
Retrieves an adapter for the current host framework. The adapter is used to access information from the underlying host framework -> Common Controls is only a presentation framework!

Returns:
Framework adapter

registerAdapter

public static void registerAdapter(FrameworkAdapter newAdapter)
Registers the Framework Adapter that should be used for this Application

Parameters:
newAdapter - Framework Adapter

createAdapter

private static FrameworkAdapter createAdapter()
Creates a new framework adapter for the current application. The decision is made on the current classpath. It is possible to set a FrameworkAdapter by calling the registerAdapter() method in a servlets init() method()

Returns:
Framework Adapter

getContextClassLoader

protected static java.lang.ClassLoader getContextClassLoader()
                                                      throws java.lang.IllegalAccessException,
                                                             java.lang.reflect.InvocationTargetException
Return the thread context class loader if available. Otherwise return null. The thread context class loader is available for JDK 1.2 or later, if certain security conditions are met.

Returns:
ClassLoader
Throws:
java.lang.IllegalAccessException - error
java.lang.reflect.InvocationTargetException - error

loadClass

private static java.lang.Class loadClass(java.lang.String name)
                                  throws java.lang.ClassNotFoundException
MUST KEEP THIS METHOD PRIVATE

Exposing this method establishes a security violation. This method uses AccessController.doPrivileged().

Load a class, try first the thread class loader, and if it fails use the loader that loaded this class.

Parameters:
name - the class name
Returns:
Class
Throws:
java.lang.ClassNotFoundException - error
java.lang.IllegalAccessException - error
java.lang.reflect.InvocationTargetException - error


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.