KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > function > FunctionMaker


1 /*
2  * Copyright 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 package org.apache.juddi.function;
17
18 import java.util.HashMap JavaDoc;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.apache.juddi.datatype.request.AddPublisherAssertions;
23 import org.apache.juddi.datatype.request.DeleteBinding;
24 import org.apache.juddi.datatype.request.DeleteBusiness;
25 import org.apache.juddi.datatype.request.DeletePublisher;
26 import org.apache.juddi.datatype.request.DeletePublisherAssertions;
27 import org.apache.juddi.datatype.request.DeleteService;
28 import org.apache.juddi.datatype.request.DeleteSubscription;
29 import org.apache.juddi.datatype.request.DeleteTModel;
30 import org.apache.juddi.datatype.request.DiscardAuthToken;
31 import org.apache.juddi.datatype.request.FindBinding;
32 import org.apache.juddi.datatype.request.FindBusiness;
33 import org.apache.juddi.datatype.request.FindPublisher;
34 import org.apache.juddi.datatype.request.FindRelatedBusinesses;
35 import org.apache.juddi.datatype.request.FindService;
36 import org.apache.juddi.datatype.request.FindTModel;
37 import org.apache.juddi.datatype.request.GetAssertionStatusReport;
38 import org.apache.juddi.datatype.request.GetAuthToken;
39 import org.apache.juddi.datatype.request.GetBindingDetail;
40 import org.apache.juddi.datatype.request.GetBusinessDetail;
41 import org.apache.juddi.datatype.request.GetBusinessDetailExt;
42 import org.apache.juddi.datatype.request.GetPublisherAssertions;
43 import org.apache.juddi.datatype.request.GetPublisherDetail;
44 import org.apache.juddi.datatype.request.GetRegisteredInfo;
45 import org.apache.juddi.datatype.request.GetRegistryInfo;
46 import org.apache.juddi.datatype.request.GetServiceDetail;
47 import org.apache.juddi.datatype.request.GetSubscriptionResults;
48 import org.apache.juddi.datatype.request.GetSubscriptions;
49 import org.apache.juddi.datatype.request.GetTModelDetail;
50 import org.apache.juddi.datatype.request.SaveBinding;
51 import org.apache.juddi.datatype.request.SaveBusiness;
52 import org.apache.juddi.datatype.request.SavePublisher;
53 import org.apache.juddi.datatype.request.SaveService;
54 import org.apache.juddi.datatype.request.SaveSubscription;
55 import org.apache.juddi.datatype.request.SaveTModel;
56 import org.apache.juddi.datatype.request.SetPublisherAssertions;
57 import org.apache.juddi.datatype.request.ValidateValues;
58 import org.apache.juddi.registry.RegistryEngine;
59
60 /**
61  * Holds a static HashMap linking the string representation of operations to
62  * instantances of the appropriate maker class (BusinessDetail to
63  * BusinessDetailHandler). Returns a reference to an instance of a maker object.
64  * HandlerMaker follows the Singleton pattern (GoF p.127). Use getInstance
65  * instead of the 'new' operator to get an instance of this class.
66  *
67  * @author Steve Viens (sviens@apache.org)
68  */

69 public class FunctionMaker
70 {
71   // private reference to the logger
72
private static Log log = LogFactory.getLog(FunctionMaker.class);
73
74   // table of shared Function instances
75
private HashMap JavaDoc functions = null;
76
77   /**
78    *
79    */

80   public FunctionMaker(RegistryEngine registry)
81   {
82     functions = new HashMap JavaDoc();
83     IFunction function = null;
84     
85     function = new AddPublisherAssertionsFunction(registry);
86     functions.put(AddPublisherAssertions.class.getName(),function);
87
88     function = new DeleteBindingFunction(registry);
89     functions.put(DeleteBinding.class.getName(),function);
90
91     function = new DeleteBusinessFunction(registry);
92     functions.put(DeleteBusiness.class.getName(),function);
93
94     function = new DeletePublisherAssertionsFunction(registry);
95     functions.put(DeletePublisherAssertions.class.getName(),function);
96
97     function = new DeletePublisherFunction(registry);
98     functions.put(DeletePublisher.class.getName(),function);
99
100     function = new DeleteServiceFunction(registry);
101     functions.put(DeleteService.class.getName(),function);
102
103     function = new DeleteSubscriptionFunction(registry);
104     functions.put(DeleteSubscription.class.getName(),function);
105     
106     function = new DeleteTModelFunction(registry);
107     functions.put(DeleteTModel.class.getName(),function);
108
109     function = new DiscardAuthTokenFunction(registry);
110     functions.put(DiscardAuthToken.class.getName(),function);
111
112     function = new FindBindingFunction(registry);
113     functions.put(FindBinding.class.getName(),function);
114
115     function = new FindBusinessFunction(registry);
116     functions.put(FindBusiness.class.getName(),function);
117
118     function = new FindPublisherFunction(registry);
119     functions.put(FindPublisher.class.getName(),function);
120
121     function = new FindRelatedBusinessesFunction(registry);
122     functions.put(FindRelatedBusinesses.class.getName(),function);
123
124     function = new FindServiceFunction(registry);
125     functions.put(FindService.class.getName(),function);
126
127     function = new FindTModelFunction(registry);
128     functions.put(FindTModel.class.getName(),function);
129
130     function = new GetAssertionStatusReportFunction(registry);
131     functions.put(GetAssertionStatusReport.class.getName(),function);
132
133     function = new GetAuthTokenFunction(registry);
134     functions.put(GetAuthToken.class.getName(),function);
135
136     function = new GetBindingDetailFunction(registry);
137     functions.put(GetBindingDetail.class.getName(),function);
138
139     function = new GetBusinessDetailFunction(registry);
140     functions.put(GetBusinessDetail.class.getName(),function);
141
142     function = new GetBusinessDetailExtFunction(registry);
143     functions.put(GetBusinessDetailExt.class.getName(),function);
144
145     function = new GetPublisherAssertionsFunction(registry);
146     functions.put(GetPublisherAssertions.class.getName(),function);
147
148     function = new GetPublisherDetailFunction(registry);
149     functions.put(GetPublisherDetail.class.getName(),function);
150
151     function = new GetRegisteredInfoFunction(registry);
152     functions.put(GetRegisteredInfo.class.getName(),function);
153
154     function = new GetRegisteryInfoFunction(registry);
155     functions.put(GetRegistryInfo.class.getName(),function);
156
157     function = new GetServiceDetailFunction(registry);
158     functions.put(GetServiceDetail.class.getName(),function);
159
160     function = new GetSubscriptionResultsFunction(registry);
161     functions.put(GetSubscriptionResults.class.getName(),function);
162     
163     function = new GetSubscriptionsFunction(registry);
164     functions.put(GetSubscriptions.class.getName(),function);
165     
166     function = new GetTModelDetailFunction(registry);
167     functions.put(GetTModelDetail.class.getName(),function);
168
169     function = new SaveBindingFunction(registry);
170     functions.put(SaveBinding.class.getName(),function);
171
172     function = new SaveBusinessFunction(registry);
173     functions.put(SaveBusiness.class.getName(),function);
174
175     function = new SavePublisherFunction(registry);
176     functions.put(SavePublisher.class.getName(),function);
177
178     function = new SaveServiceFunction(registry);
179     functions.put(SaveService.class.getName(),function);
180     
181     function = new SaveSubscriptionFunction(registry);
182     functions.put(SaveSubscription.class.getName(),function);
183
184     function = new SaveTModelFunction(registry);
185     functions.put(SaveTModel.class.getName(),function);
186
187     function = new SetPublisherAssertionsFunction(registry);
188     functions.put(SetPublisherAssertions.class.getName(),function);
189
190     function = new ValidateValuesFunction(registry);
191     functions.put(ValidateValues.class.getName(),function);
192   }
193
194   /**
195    *
196    */

197   public final IFunction lookup(String JavaDoc className)
198   {
199     IFunction function = (IFunction)functions.get(className);
200     if (function == null)
201       log.error("can't find function for class name \"" + className + "\"");
202
203     return function;
204   }
205 }
Popular Tags