jyang       2004/03/15 18:01:35

  Modified:    cornerstone/src/java/org/apache/cornerstone/framework/init
                        Cornerstone.java
  Log:
  removed get*Manager() and replace them with mini implementation manager

  PR:

  Obtained from:

  Submitted by: 

  Reviewed by:  

  CVS: ----------------------------------------------------------------------

  CVS: PR:

  CVS:   If this change addresses a PR in the problem report tracking

  CVS:   database, then enter the PR number(s) here.

  CVS: Obtained from:

  CVS:   If this change has been taken from another system, such as NCSA,

  CVS:   then name the system in this line, otherwise delete it.

  CVS: Submitted by:

  CVS:   If this code has been contributed to Apache by someone else; i.e.,

  CVS:   they sent us a patch or a new module, then include their name/email

  CVS:   address here. If this is your work then delete this line.

  CVS: Reviewed by:

  CVS:   If we are doing pre-commit code reviews and someone else has

  CVS:   reviewed your changes, include their name(s) here.

  CVS:   If you have not had it reviewed then delete this line.

  
  Revision  Changes    Path
  1.3       +26 -18    
jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/init/Cornerstone.java
  
  Index: Cornerstone.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/init/Cornerstone.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Cornerstone.java  11 Mar 2004 04:05:48 -0000      1.2
  +++ Cornerstone.java  16 Mar 2004 02:01:35 -0000      1.3
  @@ -71,18 +71,25 @@
           return _RuntimeHomeDir;
       }
   
  -    public static Object getManager(Class managerInterface)
  +    /**
  +     * This class acts as a mini implemenation manager for bootstrap classes
  +     * which are defined in Cornerstone.properties and can be overridden in
  +     * bootstrap.properties.
  +     * @param iface Interface of implementation to create
  +     * @return Implementation of the interface
  +     */
  +    public static Object getImplementation(Class iface)
        {
  -     Object manager = _ManagerMap.get(managerInterface);
  -     if (manager == null)
  +     Object implementation = _ImplementationMap.get(iface);
  +     if (implementation == null)
        {
  -             Boolean managerLoaded = (Boolean) 
_ManagerLoadedMap.get(managerInterface);
  -             if (managerLoaded == null)
  +             Boolean implementationLoaded = (Boolean) 
_ImplementationLoadedMap.get(iface);
  +             if (implementationLoaded == null)
                {
  -                     manager = loadManager(managerInterface);
  +                     implementation = loadImplementation(iface);
                }
        }
  -     return manager;
  +     return implementation;
       }
   
       protected static void readBootStrapProperties() throws InitException
  @@ -138,12 +145,12 @@
        }
       }
   
  -    protected static Object loadManager(Class managerInterface)
  +    protected static Object loadImplementation(Class implementationInterface)
       {
  -     String managerInstanceClassNameConfigName = Constant.IMPLEMENTATION + 
Constant.SLASH + managerInterface.getName() + Constant.SLASH + 
Constant.INSTANCE_CLASS_NAME;
  -     String managerClassName = 
_BootStrapProperties.getProperty(managerInstanceClassNameConfigName);
  -     _ManagerLoadedMap.put(managerInterface, Boolean.TRUE);
  -     if (managerClassName == null)
  +     String implementationClassNameConfigName = Constant.IMPLEMENTATION + 
Constant.SLASH + implementationInterface.getName() + Constant.SLASH + 
Constant.INSTANCE_CLASS_NAME;
  +     String implementationClassName = 
_BootStrapProperties.getProperty(implementationClassNameConfigName);
  +     _ImplementationLoadedMap.put(implementationInterface, Boolean.TRUE);
  +     if (implementationClassName == null)
           {
                return null;
           }
  @@ -151,13 +158,14 @@
           {    
                try
                        {
  -                             Object manager = Util.createInstance(managerClassName);
  -                             _ManagerMap.put(managerInterface, manager);
  +                     _Logger.info("loadImplementation(): implementationClassName=" 
+ implementationClassName);
  +                             Object manager = 
Util.createInstance(implementationClassName);
  +                             _ImplementationMap.put(implementationInterface, 
manager);
                                return manager;
                        }
                        catch (Exception e)
                        {
  -                 _Logger.error("failed to create manager of " + 
managerInterface.getName(), e);
  +                 _Logger.error("failed to create manager of " + 
implementationInterface.getName(), e);
                    return null;
                        }
           }
  @@ -166,8 +174,8 @@
       private static Logger _Logger = Logger.getLogger(Cornerstone.class);
       protected static String _RuntimeHomeDir = DEFAULT_CORNERSTONE_RUNTIME_HOME;
       protected static Properties _BootStrapProperties;
  -    protected static Map _ManagerMap = new HashMap();
  -    protected static Map _ManagerLoadedMap = new HashMap();
  +    protected static Map _ImplementationMap = new HashMap();
  +    protected static Map _ImplementationLoadedMap = new HashMap();
   
       // auto initialize so that even if .init() is not called, Cornerstone functions 
in a default way
       static
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to