View Javadoc

1   /*$Id: DatacenterCEAComponentManager.java,v 1.4 2004/11/08 23:15:38 mch Exp $
2    * Created on 12-Jul-2004
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.datacenter.service.v06;
12  
13  import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
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.manager.idgen.GloballyUniqueIdGen;
18  import org.astrogrid.applications.manager.idgen.IdGen;
19  import org.astrogrid.applications.manager.persist.ExecutionHistory;
20  import org.astrogrid.applications.manager.persist.InMemoryExecutionHistory;
21  import org.astrogrid.config.Config;
22  import org.astrogrid.config.SimpleConfig;
23  import org.astrogrid.datacenter.service.DataServer;
24  import org.picocontainer.MutablePicoContainer;
25  
26  /*** Component manager implementation that assembles a CEA server which provides a single {@link DatacetnerApplicationDescription} for the
27   * datacenter application
28   * @author Noel Winstanley nw@jb.man.ac.uk 12-Jul-2004
29   *
30   */
31  public class DatacenterCEAComponentManager extends EmptyCEAComponentManager {
32      /***
33       * Commons Logger for this class
34       */
35      private static final Log logger = LogFactory.getLog(DatacenterCEAComponentManager.class);
36  
37      /*** Construct a new DatacenterCEAComponentManager
38       *
39       */
40      public DatacenterCEAComponentManager() {
41          super();
42          final Config config = SimpleConfig.getSingleton();
43          // controller & queriers
44          EmptyCEAComponentManager.registerDefaultServices(pico);
45          // store - force in-memory
46          pico.registerComponentImplementation(ExecutionHistory.class,InMemoryExecutionHistory.class);
47          pico.registerComponentImplementation(IdGen.class,GloballyUniqueIdGen.class);
48  //        EmptyCEAComponentManager.registerDefaultPersistence(pico,config);
49          // metadata
50          EmptyCEAComponentManager.registerDefaultVOProvider(pico,config);
51          // the protocol lib
52          EmptyCEAComponentManager.registerProtocolLibrary(pico);
53          EmptyCEAComponentManager.registerStandardIndirectionProtocols(pico);
54          EmptyCEAComponentManager.registerAstrogridIndirectionProtocols(pico);
55          registerDatacenterProvider(pico,config);
56      }
57      
58      /*** key used to lookup in config the name of the datacenter application.  Must
59       * equal with the ResourceKey given in the managed applications. */
60      //public static final String DS_APP_NAME_KEY = "datacenter.cea.app.name";
61      /*** default value for {@link #DS_APP_NAME} if not set in config */
62      //public static final String DS_APP_NAME_DEFAULT = "org.astrogrid.localhost/testdsa";
63      
64      /*** register the datacenter-specific components of this cea server */
65      public static void registerDatacenterProvider(MutablePicoContainer pico, Config config) {
66          logger.info("Registering Datacenter CEA Provider");
67         
68         //the application name must match the IVORN of the CeaApplicationType Resource, that is:
69         //<authorityId>/<ResourceKey>/ceaApplication
70         final String name= config.getString("datacenter.authorityId")+"/"+config.getString("datacenter.resourceKey")+"/ceaApplication";
71         logger.info("name =" + name);
72          pico.registerComponentInstance(new DatacenterApplicationDescriptionLibrary.DatacenterMetadata() {
73              public String getName() {
74                  return name;
75              }
76          });
77          pico.registerComponentImplementation(DatacenterApplicationDescriptionLibrary.class,DatacenterApplicationDescriptionLibrary.class);
78          pico.registerComponentImplementation(DataServer.class,DataServer.class);
79          pico.registerComponentImplementation(QueuedExecutor.class,CeaQueuedExecutor.class);
80          
81          
82      }
83  }
84  
85  
86  /*
87  $Log: DatacenterCEAComponentManager.java,v $
88  Revision 1.4  2004/11/08 23:15:38  mch
89  Various fixes for SC demo, more store browser, more Vizier stuff
90  
91  Revision 1.3  2004/11/08 02:58:44  mch
92  Various fixes and better error messages
93  
94  Revision 1.2  2004/11/04 15:04:29  mch
95  Removed default cea name so we know we need to set it
96  
97  Revision 1.1  2004/09/28 15:02:13  mch
98  Merged PAL and server packages
99  
100 Revision 1.3  2004/09/17 01:27:21  nw
101 added thread management.
102 
103 Revision 1.2  2004/07/20 02:14:48  nw
104 final implementaiton of itn06 Datacenter CEA interface
105 
106 Revision 1.1  2004/07/13 17:11:09  nw
107 first draft of an itn06 CEA implementation for datacenter
108  
109 */