View Javadoc

1   /*
2    * Copyright 2000-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.daemon.impl.util.feeddaemon;
18  
19  //jetspeed stuff
20  import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
21  import org.apache.jetspeed.services.logging.JetspeedLogger;
22  import org.apache.jetspeed.services.threadpool.ThreadPool;
23  import org.apache.jetspeed.services.Registry;
24  import org.apache.jetspeed.om.registry.PortletEntry;
25  
26  
27  /***
28  Handles taking all known Portlets and then instantiatles them all so that 
29  everything is in memory.
30  
31  @author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>
32  @version $Id: EntryInstantiator.java,v 1.16 2004/02/23 02:47:27 jford Exp $
33  */
34  public class EntryInstantiator {
35  
36      private PortletEntry[] entries = null;
37      
38      /***
39       * Static initialization of the logger for this class
40       */
41      private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(EntryInstantiator.class.getName());
42      
43      /***
44      Create a EntryInstantiator for processing.
45      */
46      public EntryInstantiator( PortletEntry[] entries ) {
47          super();
48          this.entries = entries;
49      }
50      
51      public void process() {
52  
53          if ( logger.isInfoEnabled() )
54          {
55              logger.info( "BEGIN: EntryInstantiator:  Instantiating " + 
56                    Registry.get(Registry.PORTLET).getEntryCount() + 
57                    " Portlet(s) found in the PortletRegistry" );
58          }
59          
60          for( int i = 0; i < entries.length; ++i ) {
61  
62              Instantiator inst = new Instantiator( i, entries[i] );
63              ThreadPool.process( inst );
64  
65          }
66          
67          logger.info( "END: EntryInstantiator:  Instantiating all Portlets found in the PortletRegistry" );
68          
69      }
70      
71  }
72  
73  
74  
75