portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/logging InMemoryLogFactory.properties
Date Tue, 02 Dec 2003 17:45:13 GMT
weaver      2003/12/02 09:45:13

  Added:       cornerstone/src/java/org/apache/cornerstone/framework/registry/factory
                        PropertiesRegistryEntryFactory.java
                        PropertiesRegistryFactory.java
                        OverwritablePropertiesRegistryFactory.java
               cornerstone/src/resources/org/apache/cornerstone/framework/implementation
                        BaseImplementationManager.properties
               cornerstone/src/java/org/apache/cornerstone/framework/persistence/datasource
                        BaseDataSource.java
               cornerstone/src/java/org/apache/cornerstone/framework/api/core
                        IObject.java
               cornerstone/src/resources/org/apache/cornerstone/framework/pubsub
                        BasePubSubManager.properties
               cornerstone/src/java/org/apache/cornerstone/framework/persistence/factory
                        BasePersistentObjectMapFactory.properties
                        BasePersistentObjectSetFactory.properties
                        BasePersistentObjectListFactory.properties
               cornerstone/src/java/org/apache/cornerstone/framework/singleton
                        BaseSingletonManager.java
               cornerstone/src/java/org/apache/cornerstone/framework/api/singleton
                        ISingletonManager.java
               cornerstone/src/java/org/apache/cornerstone/framework/registry
                        OverwritableRegistry.java
               cornerstone/src/resources/org/apache/cornerstone/framework/sysman
                        ModelMBeanDescriptorBuilder.properties
                        ModelMBeanInfoBuilderFactory.properties
                        ModelMBeanDescriptorBuilderFactory.properties
               cornerstone/src/resources/org/apache/cornerstone/framework/bean/helper
                        BeanHelper.properties
               cornerstone/src/resources/org/apache/cornerstone/framework/registry/factory
                        PropertiesRegistryFactory.properties
                        PropertiesRegistryEntryFactory.properties
               cornerstone/src/java/org/apache/cornerstone/framework/api/persistence/factory
                        IPersistenceFactory.java
               cornerstone/src/java/org/apache/cornerstone/framework/api/implementation
                        ImplementationException.java
                        IImplementationManager.java
               cornerstone/src/resources/org/apache/cornerstone/framework/service
                        BaseServiceManager.properties
               cornerstone/src/resources/org/apache/cornerstone/framework/persistence/connection
                        BaseConnectionManager.properties
               cornerstone/src/java/org/apache/cornerstone/framework/api/persistence/connection
                        ConnectionException.java
               cornerstone/src/java/org/apache/cornerstone/framework/implementation
                        BaseImplementationManager.java
               cornerstone/src/java/org/apache/cornerstone/framework/factory/ioc
                        InversionOfControlFactory.java
               cornerstone/src/java/org/apache/cornerstone/framework/api/persistence/datasource
                        IDataSource.java
               cornerstone/src/java/org/apache/cornerstone/framework/init
                        InitException.java Cornerstone.java
               cornerstone/src/java/org/apache/cornerstone/framework/service
                        BaseServiceManager.java
               cornerstone/src/java/org/apache/cornerstone/framework/service/controller
                        SequenceServiceController.java
               cornerstone/src/resources/org/apache/cornerstone/framework/registry
                        BaseRegistry.properties
               cornerstone/src/resources/org/apache/cornerstone/framework/logging
                        InMemoryLogFactory.properties
  Log:
  cornerstone update
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/registry/factory/PropertiesRegistryEntryFactory.java
  
  Index: PropertiesRegistryEntryFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.registry.factory;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.util.Properties;
  import org.apache.cornerstone.framework.api.factory.CreationException;
  import org.apache.cornerstone.framework.api.registry.IRegistryEntry;
  import org.apache.cornerstone.framework.factory.BaseFactory;
  import org.apache.cornerstone.framework.registry.BaseRegistryEntry;
  import org.apache.log4j.Logger;
  
  public class PropertiesRegistryEntryFactory extends BaseFactory
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static PropertiesRegistryEntryFactory getSingleton()
      {
          return _Singleton;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cornerstone.framework.factory.BaseFactory#createInstance()
       */
      public Object createInstance() throws CreationException
      {
      	throw new CreationException("please use the other signature that uses a File");
      }
  
      /**
       * Creates a RegistryEntry object
       * @return Object as RegistryEntry
       */
      public Object createInstance(Object file) throws CreationException
      {
          File registryEntryFile = (File) file;
          FileInputStream fis = null;
          try
          {
              Properties registryProperties = new Properties();
              fis = new FileInputStream(registryEntryFile);
              registryProperties.load(fis);
              IRegistryEntry registryEntry = new BaseRegistryEntry(registryProperties);
              return registryEntry;
          }
          catch(IOException e)
          {
              String message = "failed to read registry entry file '" + registryEntryFile.getAbsolutePath() + "'";
              _Logger.error(message, e);
              throw new CreationException(message, e);
          }
          finally
          {
          	if (fis != null)
              {   
  				try
  				{
  					fis.close();
  				}
  				catch (IOException e1)
  				{
                      _Logger.error("failed to close registry entry file '" + registryEntryFile.getAbsolutePath() + "'");
  				}
              }
          }
      }
      
      private static Logger _Logger = Logger.getLogger(PropertiesRegistryEntryFactory.class);
      private static PropertiesRegistryEntryFactory _Singleton = new PropertiesRegistryEntryFactory();
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/registry/factory/PropertiesRegistryFactory.java
  
  Index: PropertiesRegistryFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.registry.factory;
  
  import java.io.File;
  import java.util.List;
  import java.util.Set;
  import java.util.HashSet;
  import org.apache.cornerstone.framework.api.factory.CreationException;
  import org.apache.cornerstone.framework.api.registry.IRegistry;
  import org.apache.cornerstone.framework.api.registry.IRegistryEntry;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.factory.BaseFactory;
  import org.apache.cornerstone.framework.registry.BaseRegistry;
  import org.apache.cornerstone.framework.util.Util;
  import org.apache.log4j.Logger;
  
  public class PropertiesRegistryFactory extends BaseFactory
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String SHORT_HAND = "shortHand";
      public static final String META_SHORT_HAND = Constant.META + Constant.DOT + SHORT_HAND + Constant.DASH;
      public static final String REG_DIR_NAME = "registry";
      public static final String REG_FILE_EXTENSION = ".reg.properties";
  
      public static final String CONFIG_FILE_NAMES_TO_SKIP = "fileNamesToSkip";
  
      public static PropertiesRegistryFactory getSingleton()
      {
          return _Singleton;
      }
  
      public Object createInstance() throws CreationException
      {
          throw new CreationException("please use the other signature to pass in registryParentPath");
      }        
  
      public Object createInstance(Object registryParentPath) throws CreationException
      {
          String registryPath = registryParentPath + File.separator + REG_DIR_NAME;        
                  
          // create the Registry
          IRegistry registry = BaseRegistry.getSingleton();
  
          // for every file in this path added to the 
          // registry as RegistryEntry
          //
          File registryDir = new File(registryPath);
          File[] domains = registryDir.listFiles();
          if (domains != null)
          {
              PropertiesRegistryEntryFactory registryEntryFactory = PropertiesRegistryEntryFactory.getSingleton();
              for ( int k = 0; k < domains.length; k++ )
              {
                  String domainName = domains[k].getName();
                  if (skipFile(domainName)) continue;
  
                  if ( domains[k].isDirectory() )
                  {
                      File domainDir = new File(domains[k].getAbsolutePath());
                      File[] interfaces = domainDir.listFiles();
                      for ( int i = 0; i < interfaces.length; i++ )
                      {
                          String interfaceName = interfaces[i].getName();
                          if (skipFile(interfaceName)) continue;
  
                          if ( interfaces[i].isDirectory() )
                          {
                              File[] implementations = interfaces[i].listFiles();
                              for (int j = 0; j < implementations.length; j++)
                              {
                              	IRegistryEntry registryEntry = (IRegistryEntry)registryEntryFactory.createInstance(implementations[j]);
                                  String implementationName = implementations[j].getName();
                              	String registryEntryName =
                                      implementationName.startsWith(Constant.DOT) ?
  									"" :
                                      implementationName.substring(0, implementationName.indexOf(REG_FILE_EXTENSION));
                              	registry.register(domainName, interfaceName, registryEntryName, registryEntry);
                              }
                          }
                          else if (interfaceName.startsWith(META_SHORT_HAND))
                          {
                              String nameValuePair = interfaceName.substring(META_SHORT_HAND.length());
                              int dash = nameValuePair.indexOf(Constant.DASH);
                              if (dash > 0)
                              {
                                  String alias = nameValuePair.substring(0, dash);
                                  String fullName = nameValuePair.substring(dash + 1);
                                  registry.setInterfaceShortHand(domainName, alias, fullName);
                              }
                          }
                          else
                          {
                          	_Logger.info("Unrecognized file '" + interfaces[i].getName() + "' found in registry '" + registryPath + "'; ignored");
                          }
                      }
                  }
                  else
                  {
                      _Logger.info("Unrecognized file '" + domains[k].getName() + "' found in registry '" + registryPath + "'; ignored");
                  }
              }
          }
  
          return registry;
      }
  
      protected PropertiesRegistryFactory()
      {
          super();
          String names = getConfigProperty(CONFIG_FILE_NAMES_TO_SKIP);
          List nameList = Util.convertStringsToList(names);
          _setOfFileNamesToSkip = new HashSet();
          _setOfFileNamesToSkip.addAll(nameList);
      }
  
      protected boolean skipFile(String fileName)
      {
          if (_setOfFileNamesToSkip != null)
          {
              return _setOfFileNamesToSkip.contains(fileName);
          }
          else
          {
              return false;
          }
      }
  
      private static Logger _Logger = Logger.getLogger(PropertiesRegistryFactory.class);
      private static PropertiesRegistryFactory _Singleton = new PropertiesRegistryFactory();
      protected Set _setOfFileNamesToSkip;
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/registry/factory/OverwritablePropertiesRegistryFactory.java
  
  Index: OverwritablePropertiesRegistryFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.registry.factory;
  
  import java.io.File;
  import org.apache.cornerstone.framework.api.factory.CreationException;
  import org.apache.cornerstone.framework.factory.BaseFactory;
  
  public class OverwritablePropertiesRegistryFactory extends BaseFactory
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String REG_DIR_NAME = "registry";
  
  	/* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.factory.IFactory#createInstance()
  	 */
  	public Object createInstance() throws CreationException
  	{
          throw new CreationException("please use the other signature to pass in registryParentPath");
      }        
  
      public Object createInstance(Object registryParentPath) throws CreationException
      {
          String registryPath = registryParentPath + File.separator + REG_DIR_NAME;        
          return null;
      }
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/implementation/BaseImplementationManager.properties
  
  Index: BaseImplementationManager.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/persistence/datasource/BaseDataSource.java
  
  Index: BaseDataSource.java
  ===================================================================
  package org.apache.cornerstone.framework.persistence.datasource;
  
  import org.apache.cornerstone.framework.api.persistence.datasource.IDataSource;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.core.BaseObject;
  
  public class BaseDataSource extends BaseObject implements IDataSource
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String DRIVER_CLASS_NAME = Constant.DRIVER + Constant.DOT + Constant.CLASS_NAME;
      public static final String CONNECTION_URL = Constant.CONNECTION + Constant.DOT + Constant.URL;
      public static final String CONNECTION_USER_NAME = Constant.CONNECTION + Constant.DOT + "userName";
      public static final String CONNECTION_PASSWORD = Constant.CONNECTION + Constant.DOT + "password";
  
      public static final String CONFIG_PARAMS =
          DRIVER_CLASS_NAME
          + Constant.COMMA + CONNECTION_URL
          + Constant.COMMA + CONNECTION_USER_NAME
          + Constant.COMMA + CONNECTION_PASSWORD;
  
  	/* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.persistence.datasource.IDataSource#getDriverClassName()
  	 */
  	public String getDriverClassName()
  	{
  		return _config.getProperty(DRIVER_CLASS_NAME);
  	}
  
      /* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.persistence.datasource.IDataSource#getConnectionUrl()
  	 */
  	public String getConnectionUrl()
  	{
  		return _config.getProperty(CONNECTION_URL);
  	}
  
      /* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.persistence.datasource.IDataSource#getUserName()
  	 */
  	public String getConnectionUserName()
  	{
  		return _config.getProperty(CONNECTION_USER_NAME);
  	}
  
      /* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.persistence.datasource.IDataSource#getPassword()
  	 */
  	public String getConnectionPassword()
  	{
          return _config.getProperty(CONNECTION_PASSWORD);
  	}
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/core/IObject.java
  
  Index: IObject.java
  ===================================================================
  package org.apache.cornerstone.framework.api.core;
  
  public interface IObject
  {
  	public static final String REVISION = "$Revision: 1.1 $";
  
  	public void init();
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/pubsub/BasePubSubManager.properties
  
  Index: BasePubSubManager.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/persistence/factory/BasePersistentObjectMapFactory.properties
  
  Index: BasePersistentObjectMapFactory.properties
  ===================================================================
  collection.instance.className=java.util.HashMap
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/persistence/factory/BasePersistentObjectSetFactory.properties
  
  Index: BasePersistentObjectSetFactory.properties
  ===================================================================
  collection.instance.className=java.util.HashSet
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/persistence/factory/BasePersistentObjectListFactory.properties
  
  Index: BasePersistentObjectListFactory.properties
  ===================================================================
  collection.instance.className=java.util.ArrayList
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/singleton/BaseSingletonManager.java
  
  Index: BaseSingletonManager.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.singleton;
  
  import java.util.HashMap;
  import java.util.Map;
  import org.apache.cornerstone.framework.api.singleton.ISingletonManager;
  import org.apache.cornerstone.framework.util.Util;
  import org.apache.log4j.Logger;
  
  /**
  Manager for all singleton instances.
  */
  
  public class BaseSingletonManager implements ISingletonManager
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static BaseSingletonManager getSingleton()
      {
      	return _Singleton;
      }
  
      /**
       * Retrieves the singleton instance of a class.
       * @param className
       * @return singleton instance of class className.
       */
      public Object getSingleton(String className)
      {
          try
          {
              // make sure class is loaded first
              Object s = _singletonMap.get(className);
              if (s == null)
              {
                  s = Util.createInstance(className);
                  addSingleton(s);
              }
              return s;
          }
          catch (Exception e)
          {
              _Logger.error("failed to create singleton for class " + className, e);
              return null;
          }
      }
  
      protected BaseSingletonManager()
      {
      	addSingleton(this);
      }
  
      /**
       * Registers a singleton instance with this manager.
       * @param singleton
       */
      protected void addSingleton(Object singleton)
      {
          _singletonMap.put(singleton.getClass().getName(), singleton);
          if (_Logger.isInfoEnabled())
          {
              _Logger.info(singleton + " added");
          }
      }
  
      private static Logger _Logger = Logger.getLogger(BaseSingletonManager.class);
      private static BaseSingletonManager _Singleton = new BaseSingletonManager();
      protected Map _singletonMap = new HashMap();
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/singleton/ISingletonManager.java
  
  Index: ISingletonManager.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.api.singleton;
  
  public interface ISingletonManager
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public Object getSingleton(String className);
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/registry/OverwritableRegistry.java
  
  Index: OverwritableRegistry.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.registry;
  
  import java.util.Set;
  
  import org.apache.cornerstone.framework.api.registry.IRegistry;
  import org.apache.cornerstone.framework.api.registry.IRegistryEntry;
  
  public class OverwritableRegistry extends BaseRegistry
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static IRegistry getSingleton()
      {
      	return _Singleton;
      }
  
      public void init()
      {
          _parent = null;
      }
  
      public void setParent(IRegistry overwrittenRegistry)
      {
      	_parent = overwrittenRegistry;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cornerstone.framework.api.registry.IRegistry#getRegistryEntry(java.lang.String, java.lang.String, java.lang.String)
       */
      public IRegistryEntry getEntry(String domainName, String interfaceName, String entryName)
      {
          IRegistryEntry localEntry = super.getEntry(domainName, interfaceName, entryName);
          if (localEntry == null)
              return _parent.getEntry(domainName, interfaceName, entryName);
          else
              return localEntry;
      }
  
      /* (non-Javadoc)
       * @see org.apache.cornerstone.framework.api.registry.IRegistry#getRegistryEntryNameSet(java.lang.String, java.lang.String)
       */
      public Set getEntryNameSet(String domainName, String interfaceName)
      {
          Set localEntryNameSet = super.getEntryNameSet(domainName, interfaceName);
          Set parentEntryNameSet = _parent.getEntryNameSet(domainName, interfaceName);
          Set entryNameSet = localEntryNameSet;
          entryNameSet.addAll(parentEntryNameSet);
          return entryNameSet;
      }
  
      private static OverwritableRegistry _Singleton = new OverwritableRegistry();
      protected IRegistry _parent;    // the registry overwritten by this registry
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/sysman/ModelMBeanDescriptorBuilder.properties
  
  Index: ModelMBeanDescriptorBuilder.properties
  ===================================================================
  _.instance.isSignleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/sysman/ModelMBeanInfoBuilderFactory.properties
  
  Index: ModelMBeanInfoBuilderFactory.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/sysman/ModelMBeanDescriptorBuilderFactory.properties
  
  Index: ModelMBeanDescriptorBuilderFactory.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/bean/helper/BeanHelper.properties
  
  Index: BeanHelper.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/registry/factory/PropertiesRegistryFactory.properties
  
  Index: PropertiesRegistryFactory.properties
  ===================================================================
  _.instance.isSingleton=true
  fileNamesToSkip=CVS,.cvsignore
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/registry/factory/PropertiesRegistryEntryFactory.properties
  
  Index: PropertiesRegistryEntryFactory.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/persistence/factory/IPersistenceFactory.java
  
  Index: IPersistenceFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.api.persistence.factory;
  
  import org.apache.cornerstone.framework.api.factory.IFactory;
  
  public interface IPersistenceFactory extends IFactory
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String CTX_QUERY_NAME = "queryName";
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/implementation/ImplementationException.java
  
  Index: ImplementationException.java
  ===================================================================
  package org.apache.cornerstone.framework.api.implementation;
  
  import org.apache.cornerstone.framework.api.core.BaseException;
  
  public class ImplementationException extends BaseException
  {
  	public static final String REVISION = "$Revision: 1.1 $";
  
  	/**
  	 * @param msg
  	 */
  	public ImplementationException(String msg)
  	{
  		super(msg);
  	}
  
  	/**
  	 * @param cause
  	 */
  	public ImplementationException(Throwable cause)
  	{
  		super(cause);
  	}
  
  	/**
  	 * @param msg
  	 * @param cause
  	 */
  	public ImplementationException(String msg, Throwable cause)
  	{
  		super(msg, cause);
  	}
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/implementation/IImplementationManager.java
  
  Index: IImplementationManager.java
  ===================================================================
  package org.apache.cornerstone.framework.api.implementation;
  
  public interface IImplementationManager
  {
  	public static final String REVISION = "$Revision: 1.1 $";
  
  	public Object createImplementation(String interfaceName) throws ImplementationException;
  	public Object createImplementation(Class interfaceClass) throws ImplementationException;
  	public Object createImplementation(String interfaceName, String variantName) throws ImplementationException;
  	public Object createImplementation(Class interfaceClass, String variantName) throws ImplementationException;
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/service/BaseServiceManager.properties
  
  Index: BaseServiceManager.properties
  ===================================================================
  _.instance.isSingleton=true
  serviceRegistry.domainName=implementation
  serviceRegistry.interfaceName=cornerstone.service
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/persistence/connection/BaseConnectionManager.properties
  
  Index: BaseConnectionManager.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/persistence/connection/ConnectionException.java
  
  Index: ConnectionException.java
  ===================================================================
  package org.apache.cornerstone.framework.api.persistence.connection;
  
  import org.apache.cornerstone.framework.api.core.BaseException;
  
  public class ConnectionException extends BaseException
  {
      public static final String REVISION = "$Revision: 1.1 $";
      
  	/**
  	 * @param msg
  	 */
  	public ConnectionException(String msg)
  	{
  		super(msg);
  	}
  
  	/**
  	 * @param cause
  	 */
  	public ConnectionException(Throwable cause)
  	{
  		super(cause);
  	}
  
      /**
  	 * @param msg
  	 * @param cause
  	 */
  	public ConnectionException(String msg, Throwable cause)
  	{
  		super(msg, cause);
  	}
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/implementation/BaseImplementationManager.java
  
  Index: BaseImplementationManager.java
  ===================================================================
  package org.apache.cornerstone.framework.implementation;
  
  import java.util.*;
  import org.apache.cornerstone.framework.api.config.IConfigurable;
  import org.apache.cornerstone.framework.api.factory.IFactory;
  import org.apache.cornerstone.framework.api.implementation.IImplementationManager;
  import org.apache.cornerstone.framework.api.implementation.ImplementationException;
  import org.apache.cornerstone.framework.api.registry.IRegistry;
  import org.apache.cornerstone.framework.api.registry.IRegistryEntry;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.core.BaseObject;
  import org.apache.cornerstone.framework.init.Cornerstone;
  import org.apache.cornerstone.framework.util.Util;
  import org.apache.log4j.Logger;
  
  public class BaseImplementationManager extends BaseObject implements IImplementationManager
  {
  	public static final String REVISION = "$Revision: 1.1 $";
  
  	public static final String REGISTRY_DOMAIN_NAME = Constant.IMPLEMENTATION;
      public static final String META = "_";
      public static final String META_DOT = META + ".";
      public static final String IS_SINGLETON = "isSingleton";    // per virtual class singleton
  
  	public static final String CONFIG_META_INSTANCE_CLASS_NAME = META_DOT + Constant.INSTANCE_CLASS_NAME;
      public static final String CONFIG_META_FACTORY_CLASS_NAME = META_DOT + Constant.FACTORY_CLASS_NAME;
      public static final String CONFIG_META_PARENT_NAME = META_DOT + Constant.PARENT_NAME;
      public static final String CONFIG_INSTANCE_IS_SINGLETON = Constant.INSTANCE + Constant.DOT + IS_SINGLETON;
  
  	public static BaseImplementationManager getSingleton()
  	{
  		return _Singleton;
  	}
  
      /* (non-Javadoc)
       * @see org.apache.cornerstone.framework.api.core.IObject#init()
       */
      public void init()
      {
          super.init();
          _implementationMap = new HashMap();
          _registry = Cornerstone.getRegistry();
      }
  
  	/* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.implementation.IImplementationManager#getImplementation(java.lang.String)
  	 */
  	public Object createImplementation(String interfaceName) throws ImplementationException
  	{
  		return createImplementationInternal(interfaceName, "");
  	}
  
  	/* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.implementation.IImplementationManager#getImplementation(java.lang.Class)
  	 */
  	public Object createImplementation(Class interfaceClass) throws ImplementationException
  	{
  		return createImplementation(interfaceClass.getName());
  	}
  
  	/* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.implementation.IImplementationManager#getImplementation(java.lang.String, java.lang.String)
  	 */
  	public Object createImplementation(String interfaceName, String variantName) throws ImplementationException
  	{
  		return createImplementationInternal(interfaceName, variantName);
  	}
  
  	/* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.implementation.IImplementationManager#getImplementation(java.lang.Class, java.lang.String)
  	 */
  	public Object createImplementation(Class interfaceClass, String variantName) throws ImplementationException
  	{
  		return createImplementation(interfaceClass.getName(), variantName);
  	}
  
      protected Object createImplementationInternal(String interfaceName, String variantName) throws ImplementationException
      {
          IRegistryEntry entry = _registry.getEntry(REGISTRY_DOMAIN_NAME, interfaceName, variantName);
          if (entry == null)
          {
              String message = "registry entry '" + REGISTRY_DOMAIN_NAME + Constant.SLASH + interfaceName + Constant.SLASH + variantName + "' undefined";
              _Logger.error(message);
              throw new ImplementationException(message);
          }
  
          Properties entryProperties = entry.getProperties();
          Properties metaProperties = Util.getPropertiesOfPrefix(entryProperties, META_DOT);
  
          Object implementation;
          String configImplementationIsSingleton = metaProperties.getProperty(CONFIG_INSTANCE_IS_SINGLETON);
          boolean implementationIsSingleton = new Boolean(configImplementationIsSingleton).booleanValue();
          if (implementationIsSingleton)
          {
              String key = getImplemenationMapKey(interfaceName, variantName);
              implementation = _implementationMap.get(key);
              if (implementation == null)
              {
                  implementation = createImplementationInternalAccordingToMetaProperties(interfaceName, variantName, metaProperties, entryProperties);
                  _implementationMap.put(key, implementation);    // TODO: lock
              }
              else
              {
              	if (_Logger.isDebugEnabled()) _Logger.debug("singleton of '" +key + "' already created");
              }
          }
          else
          {
          	implementation = createImplementationInternalAccordingToMetaProperties(interfaceName, variantName, metaProperties, entryProperties);
          }
  
          return implementation;
      }
  
      protected Object createImplementationInternalAccordingToMetaProperties(
          String interfaceName,
          String variantName,
          Properties metaProperties,
          Properties instanceConfig
      )
          throws ImplementationException
      {
          String instanceClassName = metaProperties.getProperty(Constant.INSTANCE_CLASS_NAME);
          if (instanceClassName != null)
          {
              // "_.instance.className" is specified, create a new instance using default constructor
              try
              {
              	Class implementationClass = Class.forName(instanceClassName);
                  Object implementation = implementationClass.newInstance();
                  overwriteConfig(implementation, instanceConfig);
                  return implementation;
              }
              catch (Exception e)
              {
                  throw new ImplementationException("failed to create instance of class '" + instanceClassName + "'", e);
              }
          }
  
          String factoryClassName = metaProperties.getProperty(Constant.FACTORY_CLASS_NAME);
          if (factoryClassName != null)
          {
              // "_.factory.className" is specified, create a new instance using factory
              try
              {
                  IFactory factory = (IFactory) Cornerstone.getSingletonManager().getSingleton(factoryClassName);
                  Object implementation = factory.createInstance();
                  overwriteConfig(implementation, instanceConfig);
                  return implementation;
              }
              catch (Exception e)
              {
                  throw new ImplementationException("failed to create instance with factory class '" + factoryClassName + "'", e);
              }
          }
  
          String parentName = metaProperties.getProperty(Constant.PARENT_NAME);
          if (parentName != null)
          {
              // "_.parent.name" is specified, create a new instance using parent
              try
              {
                  Object implementation = createImplementation(interfaceName, parentName);
                  overwriteConfig(implementation, instanceConfig);
                  return implementation;
              }
              catch (Exception e)
              {
                  throw new ImplementationException("failed to create instance using parent '" + parentName + "'", e);
              }
          }
  
          throw new ImplementationException(
              "registry entry '" + REGISTRY_DOMAIN_NAME + Constant.SLASH + interfaceName + Constant.SLASH + variantName +
          	"' has no '" + CONFIG_META_INSTANCE_CLASS_NAME +
          	"' or '" + CONFIG_META_FACTORY_CLASS_NAME +
          	"' or '" + CONFIG_META_PARENT_NAME +
          	"' defined"
          );
      }
  
      /**
  	 * @param interfaceName
  	 * @param variantName
  	 * @return
  	 */
  	protected String getImplemenationMapKey(String interfaceName, String variantName)
  	{
  		return interfaceName + Constant.SLASH + variantName;
  	}
  
  	protected void overwriteConfig(Object object, Properties config)
      {
      	if (object instanceof IConfigurable)
          {
      		IConfigurable configurable = (IConfigurable) object;
              configurable.overwriteConfig(config);
          }
      }
  
      private static Logger _Logger = Logger.getLogger(BaseImplementationManager.class);
      private static BaseImplementationManager _Singleton = new BaseImplementationManager();
      protected Map _implementationMap;
  	protected IRegistry _registry = Cornerstone.getRegistry();
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/factory/ioc/InversionOfControlFactory.java
  
  Index: InversionOfControlFactory.java
  ===================================================================
  package org.apache.cornerstone.framework.factory.ioc;
  
  import java.beans.PropertyDescriptor;
  import java.util.Enumeration;
  import org.apache.commons.beanutils.PropertyUtils;
  import org.apache.cornerstone.framework.api.factory.CreationException;
  import org.apache.cornerstone.framework.api.factory.IFactory;
  import org.apache.cornerstone.framework.api.implementation.ImplementationException;
  import org.apache.cornerstone.framework.bean.helper.BeanHelper;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.factory.BaseFactory;
  import org.apache.cornerstone.framework.init.Cornerstone;
  
  /**
   * 
   * Sample config: MyFactory.properties
   * product.instance.className=MyA1
   * product.property.b.instance.className=MyB2
   * product.property.c.factory.className=MyC1Factory 
   * product.property.x.parent.name=myObj1            ### will look under property's interface type
   * product.property.y.factory.parent.name=yFactory  ### will look under cornerstone.factory
   */
  
  public class InversionOfControlFactory extends BaseFactory
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String VALUE = "value";
  
      public static final String CONFIG_PRODUCT_INSTANCE_CLASS_NAME = Constant.PRODUCT_DOT + Constant.INSTANCE_CLASS_NAME;
      public static final String CONFIG_PRODUCT_PROPERTY_DOT = Constant.PRODUCT_DOT + Constant.PROPERTY_DOT;
  
      /* (non-Javadoc)
  	 * @see org.apache.cornerstone.framework.api.factory.IFactory#createInstance()
  	 */
  	public Object createInstance() throws CreationException
  	{
          // create product instance
          String productInstanceClassName = _config.getProperty(CONFIG_PRODUCT_INSTANCE_CLASS_NAME);
          if (productInstanceClassName == null)
              throw new CreationException("config '" + CONFIG_PRODUCT_INSTANCE_CLASS_NAME + "' missing");
          Object product = createInstanceByClassName(productInstanceClassName);
  
          // set properties
          for (Enumeration e = _config.keys(); e.hasMoreElements();)
          {
          	String configName = (String) e.nextElement();
              if (configName.startsWith(CONFIG_PRODUCT_PROPERTY_DOT))
              {
                  String propertyConfigName = configName.substring(CONFIG_PRODUCT_PROPERTY_DOT.length());
                  int dot = propertyConfigName.indexOf(Constant.DOT);
                  String propertyName = propertyConfigName.substring(0, dot);
                  String instanceSpecName = propertyConfigName.substring(dot + 1);
                  String instanceSpecValue = _config.getProperty(configName);
                  Object propertyValue = createProperty(product, propertyName, instanceSpecName, instanceSpecValue);
                  BeanHelper.getSingleton().setProperty(product, propertyName, propertyValue);
              }
          }
  
          return product;
  	}
  
      protected Object createProperty(
          Object product,
          String propertyName,
          String instanceSpecName,
          String instanceSpecValue
      )
          throws CreationException
      {
      	if (Constant.INSTANCE_CLASS_NAME.equals(instanceSpecName))
          {
              Object propertyValue = createInstanceByClassName(instanceSpecValue);
              return propertyValue;
          }
          else if (Constant.FACTORY_CLASS_NAME.equals(instanceSpecName))
          {
              Object propertyValue = createInstanceByFactoryClassName(instanceSpecValue);
              return propertyValue;
          }
          else if (Constant.PARENT_NAME.equals(instanceSpecName))
          {
              Object propertyValue = createInstanceByParentName(product, propertyName, instanceSpecValue);
              return propertyValue;
          }
          else if (VALUE.equals(instanceSpecName))
          {
          	return instanceSpecValue;
          }
          else
          {
          	throw new CreationException(
          		"instanceSpecName '" + instanceSpecName + "' of property '" +
                  propertyName + "' not understood;" +
          		"allowed: '" + Constant.INSTANCE_CLASS_NAME +
          		"' and '" + Constant.FACTORY_CLASS_NAME +
          		"' and '" + Constant.PARENT_NAME +
          		"'"
              );
          }
      }
  
      protected Object createInstanceByClassName(String className) throws CreationException
      {
          try
          {
              Object instance = Class.forName(className).newInstance();
              return instance;
          }
          catch (Exception e)
          {
              throw new CreationException("failed to create instance of class '" + className + "'", e);
          }
      }
  
      protected Object createInstanceByFactoryClassName(String factoryClassName) throws CreationException
      {
      	IFactory factory = (IFactory) Cornerstone.getSingletonManager().getSingleton(factoryClassName);
          if (factory == null)
              throw new CreationException("singleton of class '" + factoryClassName + "' not found");
          Object product = factory.createInstance();
          return product;
      }
  
      protected Object createInstanceByParentName(Object product, String propertyName, String parentName) throws CreationException
      {
          try
          {
              PropertyDescriptor pd = PropertyUtils.getPropertyDescriptor(product, propertyName);
              Class interfaceType = pd.getPropertyType();
              if (!interfaceType.isInterface())
                  throw new CreationException("property '" + propertyName + "' of class '" + product.getClass().getName() + "' should be an interface type");
              Object propertyValue = Cornerstone.getImplementationManager().createImplementation(interfaceType, parentName);
              return propertyValue;
          }
          catch (ImplementationException ie)
          {
              throw new CreationException(ie.getCause());
          }
          catch (Exception e)
          {
              throw new CreationException(e);
          }
      }
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/api/persistence/datasource/IDataSource.java
  
  Index: IDataSource.java
  ===================================================================
  package org.apache.cornerstone.framework.api.persistence.datasource;
  
  public interface IDataSource
  {
      public static final String REVISION = "$Revision: 1.1 $";
      
      public String getDriverClassName();
      public String getConnectionUrl();
      public String getConnectionUserName();
      public String getConnectionPassword();
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/init/InitException.java
  
  Index: InitException.java
  ===================================================================
  package org.apache.cornerstone.framework.init;
  
  import org.apache.cornerstone.framework.api.core.BaseException;
  
  public class InitException extends BaseException
  {
  	public static final String REVISION = "$Revision: 1.1 $";
      
      /**
       * @param msg
       */
      public InitException(String msg)
      {
          super(msg);
      }
  
      /**
       * @param cause
       */
      public InitException(Throwable cause)
      {
          super(cause);
      }
  
      /**
       * @param msg
       * @param cause
       */
      public InitException(String msg, Throwable cause)
      {
          super(msg, cause);
      }
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/init/Cornerstone.java
  
  Index: Cornerstone.java
  ===================================================================
  package org.apache.cornerstone.framework.init;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.util.Properties;
  import org.apache.cornerstone.framework.api.action.IActionManager;
  import org.apache.cornerstone.framework.api.factory.CreationException;
  import org.apache.cornerstone.framework.api.factory.IFactory;
  import org.apache.cornerstone.framework.api.implementation.IImplementationManager;
  import org.apache.cornerstone.framework.api.registry.IRegistry;
  import org.apache.cornerstone.framework.api.service.IServiceManager;
  import org.apache.cornerstone.framework.api.singleton.ISingletonManager;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.util.Util;
  import org.apache.log4j.Logger;
  
  public class Cornerstone
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String CORNERSTONE_RUNTIME_HOME = "CORNERSTONE_RUNTIME_HOME";
      public static final String DEFAULT_CORNERSTONE_RUNTIME_HOME = "./";
      public static final String BOOTSTRAP_CONFIG_FILE_NAME = "bootstrap.properties";
  
      public static final String CONFIG_SINGLETON_MANAGER_INSTANCE_CLASS_NAME = Constant.IMPLEMENTATION + Constant.SLASH + ISingletonManager.class.getName() + Constant.SLASH + Constant.INSTANCE_CLASS_NAME;
      public static final String CONFIG_REGISTRY_FACTORY_CLASS_NAME = Constant.IMPLEMENTATION + Constant.SLASH + IRegistry.class.getName() + Constant.SLASH + Constant.FACTORY_CLASS_NAME;
      public static final String CONFIG_IMPLEMENTATION_MANAGER_INSTANCE_CLASS_NAME = Constant.IMPLEMENTATION + Constant.SLASH + IImplementationManager.class.getName() + Constant.SLASH + Constant.INSTANCE_CLASS_NAME;
      public static final String CONFIG_SERVICE_MANAGER_INSTANCE_CLASS_NAME = Constant.IMPLEMENTATION + Constant.SLASH + IServiceManager.class.getName() + Constant.SLASH + Constant.INSTANCE_CLASS_NAME;
      public static final String CONFIG_ACTION_MANAGER_INSTANCE_CLASS_NAME = Constant.IMPLEMENTATION + Constant.SLASH + IActionManager.class.getName() + Constant.SLASH + Constant.INSTANCE_CLASS_NAME;
  
      /**
       * Initializes the Cornerstone Framework.
       * Gets Cornerstone runtime home directory from system property <code>CORNERSTONE_RUNTIME_HOME</code>.
       * If it doesn't exist, the default value of "./" (current directory) is used.
       * @throws InitException
       */
      public static void init() throws InitException
      {
      	String runtimeHomeDir = System.getProperty(
      		CORNERSTONE_RUNTIME_HOME,
              DEFAULT_CORNERSTONE_RUNTIME_HOME
          );
          init(runtimeHomeDir);
      }
  
      /**
       * Initialized the Cornerstone Framework with the runtime home directory passed in.
       * @param runtimeHomeDir Cornerstone Framework runtime home directoy, where bootstrap
       * configuration files and registry are to be found.
       * @throws InitException
       */
      public static void init(String runtimeHomeDir) throws InitException
      {
      	_RuntimeHomeDir = runtimeHomeDir;
      	if (_Logger.isInfoEnabled())
      		_Logger.info(CORNERSTONE_RUNTIME_HOME + "='" + _RuntimeHomeDir + "'");
  
          readBootStrapProperties();
          initSingletonManager();
          initRegistry();
          initImplementationManager();
          initServiceManager();
          initActionManager();
      }
  
      public static String getRuntimeHome()
      {
          return _RuntimeHomeDir;
      }
  
      public static ISingletonManager getSingletonManager()
      {
      	return _singletonManager;
      }
  
      public static IRegistry getRegistry()
      {
      	return _Registry;
      }
  
      public static IImplementationManager getImplementationManager()
      {
      	return _implementationManager;
      }
  
      public static IServiceManager getServiceManager()
      {
      	return _serviceManager;
      }
  
      public static IActionManager getActionManager()
      {
      	return _actionManager;
      }
  
      protected static void readBootStrapProperties() throws InitException
      {
          String bootStrapFilePath = _RuntimeHomeDir + File.separator + BOOTSTRAP_CONFIG_FILE_NAME;
          FileInputStream fis;
          try
          {
              fis = new FileInputStream(bootStrapFilePath);
              _BootStrapProperties = new Properties();
              _BootStrapProperties.load(fis);
          }
          catch (Exception e)
          {
              throw new InitException(e);
          }
      }
  
      protected static void initSingletonManager() throws InitException
      {
          String singletonManagerClassName = _BootStrapProperties.getProperty(CONFIG_SINGLETON_MANAGER_INSTANCE_CLASS_NAME);
          if (singletonManagerClassName == null)
          {
              String bootStrapFilePath = _RuntimeHomeDir + File.pathSeparator + BOOTSTRAP_CONFIG_FILE_NAME;
              throw new InitException("'" + CONFIG_SINGLETON_MANAGER_INSTANCE_CLASS_NAME + "' undefined in '" + bootStrapFilePath + "'");
          }
          try
  		{
  			_singletonManager = (ISingletonManager) Util.createInstance(singletonManagerClassName);
  		}
  		catch (Exception e)
  		{
              throw new InitException("failed to create singleton manager", e);
  		}
      }
  
      protected static void initRegistry() throws InitException
      {
      	String registryFactoryClassName = _BootStrapProperties.getProperty(CONFIG_REGISTRY_FACTORY_CLASS_NAME);
          if (registryFactoryClassName == null)
          {
              String bootStrapFilePath = _RuntimeHomeDir + File.pathSeparator + BOOTSTRAP_CONFIG_FILE_NAME;
              throw new InitException("'" + CONFIG_REGISTRY_FACTORY_CLASS_NAME + "' undefined in '" + bootStrapFilePath + "'");
          }
          IFactory registryFactory = (IFactory) getSingletonManager().getSingleton(registryFactoryClassName);
          try
  		{
  			_Registry = (IRegistry) registryFactory.createInstance(_RuntimeHomeDir);
  		}
  		catch (CreationException ce)
  		{
  			throw new InitException("failed to create registry instance", ce.getCause());
  		}
      }
  
      protected static void initImplementationManager() throws InitException
      {
          String implementationManagerClassName = _BootStrapProperties.getProperty(CONFIG_IMPLEMENTATION_MANAGER_INSTANCE_CLASS_NAME);
          if (implementationManagerClassName == null)
          {
              String bootStrapFilePath = _RuntimeHomeDir + File.pathSeparator + BOOTSTRAP_CONFIG_FILE_NAME;
              throw new InitException("'" + CONFIG_IMPLEMENTATION_MANAGER_INSTANCE_CLASS_NAME + "' undefined in '" + bootStrapFilePath + "'");
          }
          _implementationManager = (IImplementationManager) getSingletonManager().getSingleton(implementationManagerClassName);
      }
  
      protected static void initServiceManager() throws InitException
      {
          String serviceManagerClassName = _BootStrapProperties.getProperty(CONFIG_SERVICE_MANAGER_INSTANCE_CLASS_NAME);
          if (serviceManagerClassName == null)
          {
              String bootStrapFilePath = _RuntimeHomeDir + File.pathSeparator + BOOTSTRAP_CONFIG_FILE_NAME;
              throw new InitException("'" + CONFIG_SERVICE_MANAGER_INSTANCE_CLASS_NAME + "' undefined in '" + bootStrapFilePath + "'");
          }
          _serviceManager = (IServiceManager) getSingletonManager().getSingleton(serviceManagerClassName);
      }
  
      protected static void initActionManager() throws InitException
      {
          String actionManagerClassName = _BootStrapProperties.getProperty(CONFIG_ACTION_MANAGER_INSTANCE_CLASS_NAME);
          if (actionManagerClassName == null)
          {
              String bootStrapFilePath = _RuntimeHomeDir + File.pathSeparator + BOOTSTRAP_CONFIG_FILE_NAME;
              throw new InitException("'" + CONFIG_ACTION_MANAGER_INSTANCE_CLASS_NAME + "' undefined in '" + bootStrapFilePath + "'");
          }
          _actionManager = (IActionManager) getSingletonManager().getSingleton(actionManagerClassName);
      }
  
      private static Logger _Logger = Logger.getLogger(Cornerstone.class);
      protected static String _RuntimeHomeDir = DEFAULT_CORNERSTONE_RUNTIME_HOME;
      protected static Properties _BootStrapProperties;
  
      protected static ISingletonManager _singletonManager;
      protected static IRegistry _Registry;
      protected static IImplementationManager _implementationManager;
      protected static IServiceManager _serviceManager;
      protected static IActionManager _actionManager;
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/service/BaseServiceManager.java
  
  Index: BaseServiceManager.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.service;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  import java.util.Set;
  import org.apache.cornerstone.framework.api.implementation.ImplementationException;
  import org.apache.cornerstone.framework.api.registry.IRegistry;
  import org.apache.cornerstone.framework.api.service.IService;
  import org.apache.cornerstone.framework.api.service.IServiceDescriptor;
  import org.apache.cornerstone.framework.api.service.IServiceManager;
  import org.apache.cornerstone.framework.api.service.InvalidServiceException;
  import org.apache.cornerstone.framework.api.service.ServiceException;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.core.BaseObject;
  import org.apache.cornerstone.framework.init.Cornerstone;
  import org.apache.log4j.Logger;
  
  /**
  Factory for getting all service instances.
  */
  
  public class BaseServiceManager extends BaseObject implements IServiceManager
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String SERVICE_REGISTRY = "serviceRegistry";
      public static final String SERVICE_REGISTRY_DOT = SERVICE_REGISTRY + Constant.DOT;
      public static final String CONFIG_SERVICE_REGISTRY_FACTORY_CLASS_NAME =  SERVICE_REGISTRY_DOT+ Constant.FACTORY_CLASS_NAME;
      public static final String CONFIG_SERVICE_REGISTRY_DOMAIN_NAME = SERVICE_REGISTRY_DOT + "domainName";
      public static final String CONFIG_SERVICE_REGISTRY_INTERFACE_NAME = SERVICE_REGISTRY_DOT + "interfaceName";
  
      public static final String META_DOT = Constant.META + Constant.DOT;
      public static final String CONFIG_META_INSTANCE_CLASS_NAME = META_DOT + Constant.INSTANCE_CLASS_NAME;
      public static final String CONFIG_META_FACTORY_CLASS_NAME = META_DOT + Constant.FACTORY_CLASS_NAME;
      public static final String CONFIG_META_NAME = META_DOT + Constant.PARENT_NAME; 
  
      /**
       * Object configuration metadata
       */
      public static final String CONFIG_PARAMS =
  		CONFIG_SERVICE_REGISTRY_DOMAIN_NAME + "," +
  		CONFIG_SERVICE_REGISTRY_FACTORY_CLASS_NAME + "," +
  		CONFIG_META_INSTANCE_CLASS_NAME + "," +
  		CONFIG_META_FACTORY_CLASS_NAME + "," +
  		CONFIG_META_NAME;
  
  	private static Logger _Logger = Logger.getLogger(BaseServiceManager.class);
  
      public static BaseServiceManager getSingleton()
      {
          return _Singleton;
      }
  
  	public void init()
  	{
  		super.init();
  		_registry = Cornerstone.getRegistry();
  		_serviceDomainName = getConfigProperty(CONFIG_SERVICE_REGISTRY_DOMAIN_NAME);
  		_serviceInterfaceName = getConfigProperty(CONFIG_SERVICE_REGISTRY_INTERFACE_NAME);
  		initServices();    
  	}
  
      public IService createServiceByName(String logicalName)
          throws ServiceException
      {
          if (!_inInit)
          {
              IServiceDescriptor sd = (IServiceDescriptor) _serviceDescriptorMap.get(logicalName);
  
              if (sd == null)
              {
                  throw new ServiceException("service '" + logicalName + "' not found in registry");
              }
  
              if (!sd.isValid())
              {
                  throw new ServiceException("service '" + logicalName + "' not valid");
              }
          }
  
  		try
  		{
  			IService service = (IService) Cornerstone.getImplementationManager().createImplementation(IService.class, logicalName);
              service.setName(logicalName);   // overwrite class name with logical name
      		return service;
  		}
  		catch (ImplementationException ie)
  		{
  			throw new ServiceException(ie.getCause());
  		}
      }
  
      public boolean serviceInitialized(String serviceName)
      {
      	return _serviceDescriptorMap.containsKey(serviceName);
      }
  
  	protected BaseServiceManager()
  	{
  		init();
  	}
  
      protected void initServices()
      {
          Set serviceNameSet = _registry.getEntryNameSet(_serviceDomainName, _serviceInterfaceName);
          _inInit = true;
          _serviceDescriptorMap = new HashMap();
          for (Iterator itr = serviceNameSet.iterator(); itr.hasNext();)
          {
              String serviceName = (String) itr.next();
              initService(serviceName);
          }
          _inInit = false;
      }
  
      protected void initService(String serviceName)
      {
      	if (serviceInitialized(serviceName)) return;
  
  		IService service = null;
  		IServiceDescriptor sd = null;
  
  		try
  		{
  			service = createServiceByName(serviceName);
  			sd = service.getDescriptor();
  			_serviceDescriptorMap.put(serviceName, sd);
  			_Logger.info("service '" + serviceName + "' init OK");                
  		}
  		catch(InvalidServiceException ise)
  		{
  			_Logger.error("service '" + serviceName + "' init failed: invalid", ise);
  			sd = new ServiceDescriptor();
  			sd.setValid(false);
  			_serviceDescriptorMap.put(serviceName, sd);
  		}
  		catch(ServiceException se)
  		{
  			_Logger.error("failed to get service '" + serviceName + "'", se.getCause());
  		}
      }
  
  	protected static BaseServiceManager _Singleton = new BaseServiceManager();
      protected IRegistry _registry;
      protected Map _serviceDescriptorMap;
      protected boolean _inInit;
      protected String _serviceDomainName;
      protected String _serviceInterfaceName;
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/service/controller/SequenceServiceController.java
  
  Index: SequenceServiceController.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cornerstone.framework.service.controller;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import org.apache.cornerstone.framework.api.context.IContext;
  import org.apache.cornerstone.framework.api.service.IService;
  import org.apache.cornerstone.framework.api.service.IServiceDescriptor;
  import org.apache.cornerstone.framework.api.service.ServiceException;
  import org.apache.cornerstone.framework.constant.Constant;
  import org.apache.cornerstone.framework.init.Cornerstone;
  import org.apache.cornerstone.framework.util.Util;
  import org.apache.log4j.Logger;
  
  /**
  Service controller that invokes its services in sequence.
  */
  
  public class SequenceServiceController extends BaseServiceController
  {
      public static final String REVISION = "$Revision: 1.1 $";
  
      public static final String CONFIG_SEQUENCE = "sequence";
  
      /**
       * Invokes all my services in sequence.
       * @param context context object that has all input and output parameters.
       * @return value of service.
       * @exception ServiceException
       */
      protected Object invokeMiddle(IContext context) throws ServiceException
      {
          List serviceList = getServiceList();
          Object result = null;
  
          if (serviceList != null)
          {
              for (int i = 0; i < serviceList.size(); i++)
              {
                  IService service = (IService) serviceList.get(i);
                  result = service.invoke(context);
  
                  IServiceDescriptor sd = service.getDescriptor();
                  String outputName = sd.getOutputName();
                  context.setValue(outputName, result);
              }
          }
  
          return result;
      }
  
      /**
       * Gets list of service instances.
       * @return list of service instances.
       * @throws ServiceException
       */
      protected List getServiceList() throws ServiceException
      {
          if (_serviceList == null)
          {
              _serviceList = new ArrayList();
              String serviceListString =
                  getConfigProperty(CONFIG_SEQUENCE);
              List serviceNameList =
                  Util.convertStringsToList(serviceListString);
              for (int i = 0; i < serviceNameList.size(); i++)
              {
                  String sequenceElemetnName = (String) serviceNameList.get(i);
                  String serviceLogicalName = getConfigProperty(CONFIG_SEQUENCE, sequenceElemetnName, Constant.PARENT_NAME);
                  _serviceList.add(Cornerstone.getServiceManager().createServiceByName(serviceLogicalName));
              }
          }
  
          return _serviceList;
      }
  
      protected List _serviceList = null;
      private static Logger _Logger = Logger.getLogger(SequenceServiceController.class);
  }
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/registry/BaseRegistry.properties
  
  Index: BaseRegistry.properties
  ===================================================================
  _.instance.isSingleton=true
  
  
  
  1.1                  jakarta-jetspeed-2/cornerstone/src/resources/org/apache/cornerstone/framework/logging/InMemoryLogFactory.properties
  
  Index: InMemoryLogFactory.properties
  ===================================================================
  _.instance.isSingleton=true
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message