View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services.idgenerator;
18  
19  // Jetspeed
20  import org.apache.jetspeed.services.idgenerator.IdGeneratorService;
21  
22  // Turbine
23  import org.apache.turbine.services.TurbineServices;
24  
25  /***
26   * Static accessor for the IdGeneatorService
27   *
28   * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
29   * @version $Id: JetspeedIdGenerator.java,v 1.2 2004/02/23 03:28:57 jford Exp $
30   */
31  public abstract class JetspeedIdGenerator {
32  
33      /*** Creates new JetspeedIdGenerator */
34      public JetspeedIdGenerator() {
35      }
36  
37      /*
38       * Utility method for accessing the service 
39       * implementation
40       *
41       * @return a UniqueIdService implementation instance
42       */
43      protected static IdGeneratorService getService()
44      {
45          return (IdGeneratorService)TurbineServices
46              .getInstance().getService(IdGeneratorService.SERVICE_NAME);
47      }
48  
49      /***
50       * Generate a Unique PEID
51       *
52       * @return Unique PEID
53       */    
54      public static String getNextPeid()
55      {
56          return getService().getNextPeid();
57      }
58  
59  }