01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.servicemix.web;
18:
19: import javax.management.MalformedObjectNameException;
20:
21: import org.apache.servicemix.web.filter.Factory;
22: import org.apache.servicemix.web.model.Endpoint;
23: import org.apache.servicemix.web.model.Registry;
24: import org.springframework.beans.factory.FactoryBean;
25: import org.springframework.jmx.support.ObjectNameManager;
26:
27: public class EndpointFactoryBean implements FactoryBean {
28:
29: private Registry registry;
30:
31: public Object getObject() throws Exception {
32: return new Factory() {
33: private String objectName;
34: private boolean showWsdl;
35:
36: public Object getBean() {
37: try {
38: Endpoint ep = registry
39: .getEndpoint(ObjectNameManager
40: .getInstance(objectName));
41: ep.setShowWsdl(showWsdl);
42: return ep;
43: } catch (MalformedObjectNameException e) {
44: return null;
45: }
46: }
47:
48: @SuppressWarnings("unused")
49: public void setObjectName(String objectName) {
50: this .objectName = objectName;
51: }
52:
53: @SuppressWarnings("unused")
54: public void setShowWsdl(boolean showWsdl) {
55: this .showWsdl = showWsdl;
56: }
57: };
58: }
59:
60: public Class getObjectType() {
61: return Factory.class;
62: }
63:
64: public boolean isSingleton() {
65: return false;
66: }
67:
68: public Registry getRegistry() {
69: return registry;
70: }
71:
72: public void setRegistry(Registry registry) {
73: this.registry = registry;
74: }
75:
76: }
|