View Javadoc

1   /*$Id: HttpApplicationCEAComponentManager.java,v 1.2 2004/11/27 13:20:03 pah Exp $
2    * Created on Jul 24, 2004 or thereabouts
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10   **/
11  package org.astrogrid.applications.http;
12  
13  
14  import org.apache.commons.logging.Log;
15  import org.apache.commons.logging.LogFactory;
16  import org.astrogrid.applications.component.EmptyCEAComponentManager;
17  import org.astrogrid.applications.description.BaseApplicationDescriptionLibrary;
18  import org.astrogrid.applications.http.HttpApplicationDescriptionLibrary;
19  import org.astrogrid.applications.http.registry.RegistryQuerier;
20  import org.astrogrid.applications.http.registry.RegistryQuerierImpl;
21  import org.astrogrid.config.Config;
22  import org.astrogrid.config.SimpleConfig;
23  import org.picocontainer.MutablePicoContainer;
24  
25  /***
26   * Component manager that assembles a standalone HttpApplication CEA server.
27   * 
28   * @author jdt
29   * @TODO Tidy up superfluous stuff
30   */
31  public class HttpApplicationCEAComponentManager extends EmptyCEAComponentManager {
32  	/***
33  	 * Logger for this class
34  	 */
35  	private static final Log logger = LogFactory
36  			.getLog(HttpApplicationCEAComponentManager.class);
37  
38   
39      /***
40       * Construct a new HttpApplicationCEAComponentManager, with all necessary
41       * components registered
42       * <p />
43       * registers the HttpApplication provider, plus all the standard services
44       * defined in {@link EmptyCEAComponentManager}
45       */
46      public HttpApplicationCEAComponentManager() {
47      	super();
48      	logger.info("HttpApplicationCEAComponentManager() - registering components");
49         
50          final Config config = SimpleConfig.getSingleton();
51          // controller & queriers
52          EmptyCEAComponentManager.registerDefaultServices(pico);
53          // store
54          EmptyCEAComponentManager.registerDefaultPersistence(pico, config);
55          // metadata
56          EmptyCEAComponentManager.registerDefaultVOProvider(pico, config);
57          
58          //registry uploader
59          EmptyCEAComponentManager.registerDefaultRegistryUploader(pico);
60  
61          // the protocol lib
62          EmptyCEAComponentManager.registerProtocolLibrary(pico);
63          EmptyCEAComponentManager.registerStandardIndirectionProtocols(pico);
64          EmptyCEAComponentManager.registerAstrogridIndirectionProtocols(pico);
65          // now hook in our own implementation
66          registerHttpApplicationProvider(pico, config);
67          logger.info("HttpApplicationCEAComponentManager() - done");
68      }
69  
70      /***
71       * just register the components specific to the HttpApplications provider,
72       * but none of the generic components
73       * 
74       * @see {@link #COMMUNITY_KEY}
75       */
76      public static final void registerHttpApplicationProvider(MutablePicoContainer pico, final Config config) {
77  		if (logger.isDebugEnabled()) {
78  			logger.debug("registerHttpApplicationProvider(MutablePicoContainer, Config) - start");
79  		}
80  
81          pico.registerComponentImplementation(HttpApplicationDescriptionLibrary.class,
82                  HttpApplicationDescriptionLibrary.class);
83          pico.registerComponentImplementation(RegistryQuerier.class, RegistryQuerierImpl.class);
84  
85  		if (logger.isDebugEnabled()) {
86  			logger.debug("registerHttpApplicationProvider(MutablePicoContainer, Config) - end");
87  		}
88      }
89  }
90  
91  /*
92   * $Log: HttpApplicationCEAComponentManager.java,v $
93   * Revision 1.2  2004/11/27 13:20:03  pah
94   * result of merge of pah_cea_bz561 branch
95   *
96   * Revision 1.1.34.1  2004/11/09 09:21:16  pah
97   * initial attempt to rationalise authorityID use & self registering
98   *
99   * Revision 1.1  2004/09/02 10:19:17  jdt
100  * Moved to a more sensible package (from org.astrogrid.applications.component)
101  *
102  * Revision 1.4  2004/09/01 15:42:26  jdt
103  * Merged in Case 3
104  *  
105  */