1 /*$Id: DatacenterCEAComponentManager.java,v 1.10 2006/03/22 09:56:14 kea 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.dataservice.service.cea;
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.contracts.Configuration;
18 import org.astrogrid.applications.manager.BaseConfiguration;
19 import org.astrogrid.applications.manager.idgen.GloballyUniqueIdGen;
20 import org.astrogrid.applications.manager.idgen.IdGen;
21 import org.astrogrid.applications.manager.persist.ExecutionHistory;
22 import org.astrogrid.applications.manager.persist.InMemoryExecutionHistory;
23 import org.astrogrid.config.Config;
24 import org.astrogrid.config.SimpleConfig;
25 import org.astrogrid.dataservice.service.DataServer;
26 import org.picocontainer.MutablePicoContainer;
27
28 /*** Component manager implementation that assembles a CEA server which provides a single {@link DatacetnerApplicationDescription} for the
29 * datacenter application
30 * @author Noel Winstanley nw@jb.man.ac.uk 12-Jul-2004
31 *
32 */
33 public class DatacenterCEAComponentManager extends EmptyCEAComponentManager {
34 /***
35 * Commons Logger for this class
36 */
37 private static final Log logger = LogFactory.getLog(DatacenterCEAComponentManager.class);
38
39 /*** Construct a new DatacenterCEAComponentManager
40 * @TOFIX : are the default implementations of various new interfaces
41 * adequate here? Ask Paul.
42 */
43 public DatacenterCEAComponentManager() {
44 super();
45 final Config config = SimpleConfig.getSingleton();
46 // controller & queriers
47 //CLQ bug 1359 relace the following line with registerDefaultServices(pico); to accomodate changed cea class.
48 //EmptyCEAComponentManager.registerDefaultServices(pico);
49 registerDefaultServices(pico);
50
51 // Force the CEC to keep its job receords in memory. This replaces
52 // the more-common call to registerDefaultPersistence() which sets
53 // file-based persistence of records. Given the recent rearrangement
54 // of confiiguration in the base CEC, it may now be reasonable to go
55 // back to file-based persistence. -- GTR 2006-01-30
56 pico.unregisterComponent(ExecutionHistory.class);
57 pico.registerComponentImplementation(ExecutionHistory.class,InMemoryExecutionHistory.class);
58 pico.unregisterComponent(IdGen.class);
59 pico.registerComponentImplementation(IdGen.class,GloballyUniqueIdGen.class);
60
61 EmptyCEAComponentManager.registerDefaultVOProvider(pico);
62
63 // the protocol lib
64 // KEA NOTE : These are now registered in
65 // EmptyCEAComponentManager.registerDefaultServices
66 // Must remove them here or pico gets upset about duplicate calls
67 //EmptyCEAComponentManager.registerProtocolLibrary(pico);
68 //EmptyCEAComponentManager.registerStandardIndirectionProtocols(pico);
69 //EmptyCEAComponentManager.registerAstrogridIndirectionProtocols(pico);
70
71 // Added by KEA to fix broken unit test after CEA changes.
72 // TOFIX: are the default implementations adequate here?
73 //DefaultQueryServicesregister
74
75 // need input from Paul.
76 //
77 registerDatacenterProvider(pico,config);
78 }
79
80 /*** key used to lookup in config the name of the datacenter application. Must
81 * equal with the ResourceKey given in the managed applications. */
82 //public static final String DS_APP_NAME_KEY = "datacenter.cea.app.name";
83 /*** default value for {@link #DS_APP_NAME} if not set in config */
84 //public static final String DS_APP_NAME_DEFAULT = "org.astrogrid.localhost/testdsa";
85
86 /*** register the datacenter-specific components of this cea server */
87 public static void registerDatacenterProvider(MutablePicoContainer pico, Config config) {
88 logger.info("Registering Datacenter CEA Provider");
89
90 //the application name must match the IVORN of the CeaApplicationType Resource, that is:
91 //<authorityId>/<ResourceKey>/ceaApplication
92 final String name= config.getString("datacenter.authorityId")+"/"+config.getString("datacenter.resourceKey")+"/ceaApplication";
93 logger.info("name =" + name);
94 pico.registerComponentInstance(new DatacenterApplicationDescriptionLibrary.DatacenterMetadata() {
95 public String getName() {
96 return name;
97 }
98 });
99 pico.registerComponentImplementation(DatacenterApplicationDescriptionLibrary.class,DatacenterApplicationDescriptionLibrary.class);
100 pico.registerComponentImplementation(DataServer.class,DataServer.class);
101 pico.registerComponentImplementation(QueuedExecutor.class,CeaQueuedExecutor.class);
102 pico.registerComponentImplementation(Configuration.class, BaseConfiguration.class);
103 }
104 }
105
106
107 /*
108 $Log: DatacenterCEAComponentManager.java,v $
109 Revision 1.10 2006/03/22 09:56:14 kea
110 Bugfix.
111
112 Revision 1.9 2006/03/21 17:20:37 clq2
113 missed out bits
114
115 Revision 1.5.10.2 2006/03/21 16:43:20 gtr
116 *** empty log message ***
117
118 Revision 1.5.10.1 2006/01/30 11:25:18 gtr
119 I changed the call to registerDefaultServices() to the modern form (doesn't take an org.astrogrid.config.Config argument) and removed Noel's fix of registerDummyControlService() which isn't needed with the revised CEA.
120
121 Revision 1.5 2006/01/10 14:13:13 nw
122 added dumy implementation of missinig service
123
124 Revision 1.4 2005/12/07 15:55:21 clq2
125 KEA-PAL-1471
126
127 Revision 1.3.4.1 2005/11/25 16:06:08 kea
128 Fixes for incorrect registry xml (fixing namespace prefixes, namespaces) - see bug 1450
129
130 Revision 1.3 2005/11/21 12:54:18 clq2
131 DSA_KEA_1451
132
133 Revision 1.2.10.1 2005/11/15 15:34:45 kea
134 Removed duplicate calls to protocol registration stuff (now occurring
135 in base class and pico didn't like duplication).
136 NOTE: This class is currently broken according to unit tests.
137
138 Revision 1.2 2005/09/07 08:54:42 clq2
139 changes for cea static method changing
140
141 Revision 1.1.1.1 2005/02/17 18:37:35 mch
142 Initial checkin
143
144 Revision 1.1.1.1 2005/02/16 17:11:24 mch
145 Initial checkin
146
147 Revision 1.4 2004/11/08 23:15:38 mch
148 Various fixes for SC demo, more store browser, more Vizier stuff
149
150 Revision 1.3 2004/11/08 02:58:44 mch
151 Various fixes and better error messages
152
153 Revision 1.2 2004/11/04 15:04:29 mch
154 Removed default cea name so we know we need to set it
155
156 Revision 1.1 2004/09/28 15:02:13 mch
157 Merged PAL and server packages
158
159 Revision 1.3 2004/09/17 01:27:21 nw
160 added thread management.
161
162 Revision 1.2 2004/07/20 02:14:48 nw
163 final implementaiton of itn06 Datacenter CEA interface
164
165 Revision 1.1 2004/07/13 17:11:09 nw
166 first draft of an itn06 CEA implementation for datacenter
167
168 */