taylor      2004/02/20 23:24:50

  Modified:    components/jetspeed maven.xml
               portal/src/java/org/apache/jetspeed/om/page/psml
                        AbstractBaseElement.java
               portal/src/java/org/apache/jetspeed/services/page/impl
                        AbstractPageManagerService.java
                        CastorXmlPageManagerService.java
                        DatabasePageManagerService.java
               portal/src/webapp/WEB-INF/assembly jetspeed.groovy
               portal/src/webapp/WEB-INF/conf jetspeed.properties
  Added:       components/jetspeed/src/java/org/apache/jetspeed/idgenerator
                        IdGenerator.java JetspeedIdGenerator.java
               components/jetspeed/src/test/org/apache/jetspeed/idgenerator
                        TestIdGenerator.java
               components/jetspeed/test/assembly TestIdGenerator.groovy
  Removed:     portal/src/test/org/apache/jetspeed/services/idgenerator
                        TestIdGenerator.java
  Log:
  converted idgenerator to component
  
  Revision  Changes    Path
  1.3       +1 -1      jakarta-jetspeed-2/components/jetspeed/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/jetspeed/maven.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- maven.xml 21 Feb 2004 06:11:23 -0000      1.2
  +++ maven.xml 21 Feb 2004 07:24:50 -0000      1.3
  @@ -4,7 +4,7 @@
            xmlns:reactor="reactor">
   
     <!-- Target of maven test:single test -->
  -  <property name='testcase' 
value='org.apache.jetspeed.rewriter.TestRewriterController'/> 
  +  <property name='testcase' 
value='org.apache.jetspeed.idgenerator.TestIdGenerator'/> 
     
      <goal name="deployJar">
        <attainGoal name="jar:install"/>
  
  
  
  1.1                  
jakarta-jetspeed-2/components/jetspeed/src/java/org/apache/jetspeed/idgenerator/IdGenerator.java
  
  Index: IdGenerator.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 [EMAIL PROTECTED]
   *
   * 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.jetspeed.idgenerator;
  
  
  /**
   * This service handles the generation of unique identifiers
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
   * @version $Id: IdGenerator.java,v 1.1 2004/02/21 07:24:50 taylor Exp $
   */
  public interface IdGenerator
  {
      /**
       * Generate a Unique Portlet Entity ID
       *
       * @return Unique Portlet Entity ID
       */    
      public String getNextPeid();
      
  }
  
  
  
  
  1.1                  
jakarta-jetspeed-2/components/jetspeed/src/java/org/apache/jetspeed/idgenerator/JetspeedIdGenerator.java
  
  Index: JetspeedIdGenerator.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 [EMAIL PROTECTED]
   *
   * 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.jetspeed.idgenerator;
  
  
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.picocontainer.Startable;
  
  /**
   * Simple implementation of the IdGeneratorService.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: JetspeedIdGenerator.java,v 1.1 2004/02/21 07:24:50 taylor Exp $
   */
  public class JetspeedIdGenerator implements IdGenerator, Startable
  {
      private final static Log log = LogFactory.getLog(JetspeedIdGenerator.class);
  
      // default configuration values
      private final static long DEFAULT_CONFIG_COUNTER_START = 0x10000;
      private final static String DEFAULT_CONFIG_PEID_PREFIX = "P-";
      private final static String DEFAULT_CONFIG_PEID_SUFFIX = "";
  
      // configuration parameters
      private String peidPrefix = null;
      private String peidSuffix = null;
      protected long idCounter;
  
      public JetspeedIdGenerator()
      {
          this.idCounter = DEFAULT_CONFIG_COUNTER_START;
          this.peidPrefix = DEFAULT_CONFIG_PEID_PREFIX;
          this.peidSuffix = DEFAULT_CONFIG_PEID_SUFFIX;         
      }
  
      public JetspeedIdGenerator(long counterStart)
      {
          this.idCounter = counterStart;
          this.peidPrefix = DEFAULT_CONFIG_PEID_PREFIX;
          this.peidSuffix = DEFAULT_CONFIG_PEID_SUFFIX; 
      }
  
      public JetspeedIdGenerator(long counterStart, String prefix, String suffix)
      {
          this.idCounter = counterStart;
          this.peidPrefix = prefix;
          this.peidSuffix = suffix; 
      }
      
      public void start() 
      {
          log.info( "Start JetspeedIdGenerator");        
       }
  
      public void stop() 
      {
          log.info( "Shutdown for JetspeedIdGenerator called. idCounter = "
               + idCounter + " (" + Long.toHexString(idCounter) + ")" ); 
      }
  
      /**
       * Generate a Unique PEID
       * @return Unique PEID
       */
      public String getNextPeid()
      {
          long newid;
  
          synchronized(JetspeedIdGenerator.class)
          {
              newid = idCounter++;
          }
          
          return peidPrefix + Long.toHexString(System.currentTimeMillis()) + "-" 
                 + Long.toHexString(newid) + peidSuffix;
      }
      
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/components/jetspeed/src/test/org/apache/jetspeed/idgenerator/TestIdGenerator.java
  
  Index: TestIdGenerator.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 [EMAIL PROTECTED]
   *
   * 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.jetspeed.idgenerator;
  
  // Java imports
  import java.util.HashMap;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.jetspeed.components.ComponentAssemblyTestCase;
  
  /**
   * TestIdGenerator
   *
   * @author <a href="[EMAIL PROTECTED]">Paul Spencer</a>
   * @version $Id: TestIdGenerator.java,v 1.1 2004/02/21 07:24:50 taylor Exp $
   */
  public class TestIdGenerator extends ComponentAssemblyTestCase
  {
      
      private static int ID_TEST_TRIES = 10000;
      
      /**
       * Defines the testcase name for JUnit.
       *
       * @param name the testcase's name.
       */
      public TestIdGenerator(String name) 
      {
          super( name );
      }
      
      public String getBaseProject()
      {
          return "components/jetspeed";
      }
      
      /**
       * Start the tests.
       *
       * @param args the arguments. Not used
       */
      public static void main(String args[]) 
      {
          junit.awtui.TestRunner.main( new String[] { TestIdGenerator.class.getName() 
} );
      }
   
      /**
       * Creates the test suite.
       *
       * @return a test suite (<code>TestSuite</code>) that includes all methods
       *         starting with "test"
       */
      public static Test suite() 
      {
          // All methods starting with "test" will be executed in the test suite.
          return new TestSuite( TestIdGenerator.class );
      }
      
      /**
       * Simple test that verify the PEID are unique.  This test will generate
       * <CODE>ID_TEST_TRIES<CODE> PEIDs.  It will test for a NULL PEID.
       *
       * Granted, passing this test does <B>not</B> guarantee that a duplicate
       * PEID will not be generated.
       *
       * @throws Exception
       */
      public void testVerifyUniquePeid() throws Exception
      {
          IdGenerator generator = 
(IdGenerator)componentManager.getComponent("IdGenerator");
          assertNotNull("idgenerator is null", generator);            
   
          HashMap generatedIds = new HashMap( ID_TEST_TRIES + 1);
          String  newId;
          
          // Add a NULL  to verify a NULL is not being generated.
          generatedIds.put(null, null);
          
          for (int counter = 1; counter <= ID_TEST_TRIES; counter++)
          {
              newId = generator.getNextPeid();
              assertTrue( "PEID already generated. PEID = " + newId, 
!generatedIds.containsKey(newId));
              generatedIds.put(newId, null);
          }
      }
  
      /**
       * Simple test that verify the PEIDs are increasing. Although this is not a 
       * requirement of the IdGenerator, it is recommended
       *
       * @throws Exception
       */
      public void testVerifyIncreasingPeid() throws Exception
      {
          IdGenerator generator = 
(IdGenerator)componentManager.getComponent("IdGenerator");
          assertNotNull("idgenerator service is null", generator);            
          
          String  newId;
          String  lastId = null;
          
          for (int counter = 1; counter <= ID_TEST_TRIES; counter++)
          {
              newId = generator.getNextPeid();
              if (lastId == null)
              {
                  lastId = newId;
                  continue;
              }
              assertTrue( "PEID is not greater then last generated PEID. PEID = " + 
newId, (lastId.compareTo(newId)<0));
              lastId = newId;
          }
      }
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/components/jetspeed/test/assembly/TestIdGenerator.groovy
  
  Index: TestIdGenerator.groovy
  ===================================================================
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.apache.jetspeed.idgenerator.JetspeedIdGenerator
  
  // create the root container
  container = new DefaultPicoContainer()
  
  //
  // ID Generator
  //
  Long counterStart = 65536
  peidPrefix = "P-"
  peidSuffix = ""
  container.registerComponentInstance("IdGenerator", new 
JetspeedIdGenerator(counterStart, peidPrefix, peidSuffix))
  
  return container
  
  
  
  
  1.3       +7 -3      
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java
  
  Index: AbstractBaseElement.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractBaseElement.java  20 Nov 2003 19:02:23 -0000      1.2
  +++ AbstractBaseElement.java  21 Feb 2004 07:24:50 -0000      1.3
  @@ -54,7 +54,8 @@
   
   package org.apache.jetspeed.om.page.psml;
   
  -import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
  +import org.apache.jetspeed.Jetspeed;
  +import org.apache.jetspeed.idgenerator.IdGenerator;
   
   /**
    *
  @@ -75,7 +76,10 @@
       {
           if (this.id==null)
           {
  -            this.id = JetspeedIdGenerator.getNextPeid();
  +            // FIXME: not sure how yet, but this shouldn't be here
  +            // components should have their dependencies wired on construction
  +            IdGenerator generator = 
(IdGenerator)Jetspeed.getComponentManager().getComponent("IdGenerator");
  +            this.id = generator.getNextPeid();
           }
           return this.id;
       }
  
  
  
  1.2       +12 -6     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/page/impl/AbstractPageManagerService.java
  
  Index: AbstractPageManagerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/page/impl/AbstractPageManagerService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractPageManagerService.java   20 Nov 2003 19:02:24 -0000      1.1
  +++ AbstractPageManagerService.java   21 Feb 2004 07:24:50 -0000      1.2
  @@ -53,13 +53,14 @@
    */
   package org.apache.jetspeed.services.page.impl;
   
  +import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.cps.BaseCommonService;
   import org.apache.jetspeed.cps.CPSInitializationException;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.om.page.Property;
  -import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
   import org.apache.jetspeed.services.page.PageManagerService;
  +import org.apache.jetspeed.idgenerator.IdGenerator;
   
   /**
    * AbstractPageManagerService
  @@ -74,6 +75,7 @@
       protected Class fragmentClass = null;
       protected Class pageClass = null;
       protected Class propertyClass = null;
  +    protected IdGenerator generator = null;
       
       /* (non-Javadoc)
        * @see org.apache.fulcrum.Service#init()
  @@ -82,7 +84,11 @@
       {
           pageClass = loadModelClass("page.impl");
           fragmentClass = loadModelClass("fragment.impl");
  -        propertyClass = loadModelClass("property.impl"); 
  +        propertyClass = loadModelClass("property.impl");
  +        
  +        // TODO: get the IdGenerator during construction (i'll be getting to this 
next)
  +        IdGenerator generator = 
(IdGenerator)Jetspeed.getComponentManager().getComponent("IdGenerator");
  +         
       }
       
       /* (non-Javadoc)
  @@ -95,11 +101,11 @@
           {
               // factory create the page
               page = (Page)createObject(this.pageClass);            
  -            page.setId(JetspeedIdGenerator.getNextPeid());
  +            page.setId(generator.getNextPeid());
               
               // create the default fragment
               Fragment fragment = (Fragment)createObject(this.fragmentClass);
  -            fragment.setId(JetspeedIdGenerator.getNextPeid());
  +            fragment.setId(generator.getNextPeid());
               fragment.setType(Fragment.LAYOUT);
               page.setRootFragment(fragment);            
           }
  @@ -120,7 +126,7 @@
           try
           {
               fragment = (Fragment)createObject(this.fragmentClass);
  -            fragment.setId(JetspeedIdGenerator.getNextPeid());
  +            fragment.setId(generator.getNextPeid());
               fragment.setType(Fragment.LAYOUT);
               
           }
  
  
  
  1.7       +2 -3      
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/page/impl/CastorXmlPageManagerService.java
  
  Index: CastorXmlPageManagerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/page/impl/CastorXmlPageManagerService.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CastorXmlPageManagerService.java  4 Dec 2003 04:50:19 -0000       1.6
  +++ CastorXmlPageManagerService.java  21 Feb 2004 07:24:50 -0000      1.7
  @@ -73,7 +73,6 @@
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.profiler.ProfileLocator;
  -import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
   import org.apache.jetspeed.services.page.PageManagerService;
   import org.apache.xml.serialize.OutputFormat;
   import org.apache.xml.serialize.Serializer;
  @@ -340,7 +339,7 @@
   
           if (id == null)
           {
  -            page.setId(JetspeedIdGenerator.getNextPeid());
  +            page.setId(generator.getNextPeid());
               id = page.getId();
               log.warn("Page with no Id, created new Id : " + id);
           }
  
  
  
  1.5       +2 -3      
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/page/impl/DatabasePageManagerService.java
  
  Index: DatabasePageManagerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/page/impl/DatabasePageManagerService.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DatabasePageManagerService.java   4 Dec 2003 04:50:19 -0000       1.4
  +++ DatabasePageManagerService.java   21 Feb 2004 07:24:50 -0000      1.5
  @@ -67,7 +67,6 @@
   import org.apache.jetspeed.persistence.PersistencePlugin;
   import org.apache.jetspeed.persistence.PersistenceService;
   import org.apache.jetspeed.profiler.ProfileLocator;
  -import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
   import org.apache.jetspeed.services.page.PageManagerService;
   import org.apache.jetspeed.services.page.PageNotRemovedException;
   import org.apache.jetspeed.services.page.PageNotUpdatedException;
  @@ -163,7 +162,7 @@
   
           if (id == null)
           {
  -            page.setId(JetspeedIdGenerator.getNextPeid());
  +            page.setId(generator.getNextPeid());
               id = page.getId();
               log.warn("Page with no Id, created new Id : " + id);
           }
  
  
  
  1.2       +10 -2     
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy
  
  Index: jetspeed.groovy
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jetspeed.groovy   21 Feb 2004 03:51:34 -0000      1.1
  +++ jetspeed.groovy   21 Feb 2004 07:24:50 -0000      1.2
  @@ -1,6 +1,7 @@
   import org.picocontainer.defaults.DefaultPicoContainer
   import org.apache.jetspeed.locator.JetspeedTemplateLocator
   import org.apache.jetspeed.components.ComponentAssemblyTestCase
  +import org.apache.jetspeed.idgenerator.JetspeedIdGenerator
   import org.apache.jetspeed.Jetspeed
   
   applicationRoot = Jetspeed.getRealPath("/")
  @@ -9,10 +10,17 @@
   container = new DefaultPicoContainer()
   
   //
  -// Template Locator component assembly JetspeedTemplateLocator.class.toString()
  +// Template Locator component assembly
   //
  -
   roots = [ applicationRoot + "/WEB-INF/templates" ]
   container.registerComponentInstance("TemplateLocator", new 
JetspeedTemplateLocator(roots))
  +
  +//
  +// ID Generator
  +//
  +Long counterStart = 65536
  +peidPrefix = "P-"
  +peidSuffix = ""
  +container.registerComponentInstance("IdGenerator", new 
JetspeedIdGenerator(counterStart, peidPrefix, peidSuffix))
   
   return container
  
  
  
  1.34      +1 -15     
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties
  
  Index: jetspeed.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- jetspeed.properties       21 Feb 2004 04:02:06 -0000      1.33
  +++ jetspeed.properties       21 Feb 2004 07:24:50 -0000      1.34
  @@ -119,20 +119,6 @@
   
services.PortletRenderer.classname=org.apache.jetspeed.aggregator.impl.PortletRendererImpl
   
services.PortletAggregator.classname=org.apache.jetspeed.aggregator.PortletAggregator
   
  -# -------------------------------------------------------------------
  -#  I D  G E N E R A T O R
  -# -------------------------------------------------------------------
  
-services.IdGenerator.classname=org.apache.jetspeed.services.idgenerator.JetspeedIdGeneratorService
  -# counter.start - Initial value of conter as a base 10 integer.  
JetspeedIdGenerator 
  -#                 will return the HEX representation of the value so 160 = a0.
  -#                 Default = 65536 (HEX representation = 1000)
  -services.IdGenerator.counter.start=65536
  -# peid.prefix   - Prefix of PEID. Default = P-
  -services.IdGenerator.peid.prefix=P-
  -# peid.suffix   - Suffix of PEID. Default = (nothing)
  -services.IdGenerator.peid.suffix=
  -services.IdGenerator.earlyInit = true
  -
   # --------------------------------------------------------------------------
   # JNDI Support Service (Only needed if the current container does not support JNDI)
   #---------------------------------------------------------------------------
  
  
  

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

Reply via email to