KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > servicemix > wsn > spring > RegisterPublisherFactoryBean


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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.wsn.spring;
18
19 import org.apache.servicemix.wsn.client.AbstractWSAClient;
20 import org.oasis_open.docs.wsn.b_2.TopicExpressionType;
21 import org.oasis_open.docs.wsn.br_2.RegisterPublisher;
22 import org.springframework.beans.factory.FactoryBean;
23
24 /**
25  *
26  * @author gnodet
27  * @version $Revision: 376451 $
28  * @org.apache.xbean.XBean element="register-publisher"
29  */

30 public class RegisterPublisherFactoryBean implements FactoryBean {
31
32     private String JavaDoc publisher;
33     private String JavaDoc topic;
34     private boolean demand;
35     
36     /**
37      * @return Returns the demand.
38      */

39     public boolean isDemand() {
40         return demand;
41     }
42
43     /**
44      * @param demand The demand to set.
45      */

46     public void setDemand(boolean demand) {
47         this.demand = demand;
48     }
49
50     /**
51      * @return Returns the publisher.
52      */

53     public String JavaDoc getPublisher() {
54         return publisher;
55     }
56
57     /**
58      * @param publisher The publisher to set.
59      */

60     public void setPublisher(String JavaDoc publisher) {
61         this.publisher = publisher;
62     }
63
64     /**
65      * @return Returns the topic.
66      */

67     public String JavaDoc getTopic() {
68         return topic;
69     }
70
71     /**
72      * @param topic The topic to set.
73      */

74     public void setTopic(String JavaDoc topic) {
75         this.topic = topic;
76     }
77
78     /* (non-Javadoc)
79      * @see org.springframework.beans.factory.FactoryBean#getObject()
80      */

81     public Object JavaDoc getObject() throws Exception JavaDoc {
82         RegisterPublisher registerPublisher = new RegisterPublisher();
83         registerPublisher.setPublisherReference(AbstractWSAClient.createWSA(publisher));
84         if (topic != null) {
85             TopicExpressionType topicExp = new TopicExpressionType();
86             topicExp.getContent().add(topic);
87             registerPublisher.getTopic().add(topicExp);
88         }
89         registerPublisher.setDemand(new Boolean JavaDoc(demand));
90         return registerPublisher;
91     }
92
93     /* (non-Javadoc)
94      * @see org.springframework.beans.factory.FactoryBean#getObjectType()
95      */

96     public Class JavaDoc getObjectType() {
97         return RegisterPublisher.class;
98     }
99
100     /* (non-Javadoc)
101      * @see org.springframework.beans.factory.FactoryBean#isSingleton()
102      */

103     public boolean isSingleton() {
104         return false;
105     }
106
107 }
108
Popular Tags