Source Code Cross Referenced for PublisherImpl.java in  » Collaboration » JacORB » org » jacorb » dds » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » JacORB » org.jacorb.dds 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  DDS (Data Distribution Service) for JacORB
003:         *
004:         * Copyright (C) 2005  , Ahmed yehdih <ahmed.yehdih@gmail.com>, fouad
005:         * allaoui <fouad.allaoui@gmail.com>, Didier Donsez (didier.donsez@ieee.org)
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Library General Public License
009:         * as published by the Free Software Foundation; either version 2
010:         * of the License, or (at your option) any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         * GNU Library General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Library General Public 
018:         * License along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
020:         * 02111-1307, USA.
021:         *
022:         * Coontact: Ahmed yehdih <ahmed.yehdih@gmail.com>, fouad allaoui
023:         * <fouad.allaoui@gmail.com>, Didier Donsez (didier.donsez@ieee.org)
024:         * Contributor(s)
025:         *
026:         **/
027:        package org.jacorb.dds;
028:
029:        import java.lang.reflect.Method;
030:        import java.util.Iterator;
031:        import java.util.Vector;
032:
033:        import org.omg.dds.DataWriter;
034:        import org.omg.dds.DataWriterListener;
035:        import org.omg.dds.DataWriterQos;
036:        import org.omg.dds.DataWriterQosHolder;
037:        import org.omg.dds.DomainParticipant;
038:        import org.omg.dds.Publisher;
039:        import org.omg.dds.PublisherListener;
040:        import org.omg.dds.PublisherPOA;
041:        import org.omg.dds.PublisherQos;
042:        import org.omg.dds.PublisherQosHolder;
043:        import org.omg.dds.RETCODE_OK;
044:        import org.omg.dds.RETCODE_PRECONDITION_NOT_MET;
045:        import org.omg.dds.StatusCondition;
046:        import org.omg.dds.Topic;
047:        import org.omg.dds.TopicQos;
048:        import org.omg.PortableServer.Servant;
049:
050:        /**
051:         * A Publisher is the object responsible for the actual dissemination of publications.
052:         * The Publisher acts on the behalf of one or several DataWriter objects that belong to 
053:         * it. When it is informed of a change to the data associated with one of its DataWriter
054:         * objects, it decides when it is appropriate to actually send the data-update message. 
055:         * In making this decision, it considers any extra information that goes with the data
056:         * (timestamp, writer, etc.) as well as the QoS of the Publisher and the DataWriter.
057:         */
058:        public class PublisherImpl extends PublisherPOA {
059:
060:            private org.omg.CORBA.ORB orb;
061:            private org.omg.PortableServer.POA poa;
062:            private Vector Vector_DataWriter;
063:            private PublisherQos qos;
064:            private DomainParticipant DP_Parent;
065:            private DataWriterQos Default_DataWriterqos;
066:            //put  message of publisher  in channel event 
067:            private Supplier Sup;
068:            private PublisherListener listner;
069:
070:            public PublisherImpl(PublisherQos qos, PublisherListener listner,
071:                    DomainParticipant DP) {
072:                this .qos = qos;
073:                this .listner = listner;
074:                Vector_DataWriter = new Vector();
075:                this .DP_Parent = DP;
076:            }
077:
078:            /**
079:             * @param a_topic
080:             * @param qos
081:             * @param a_listener
082:             * @return
083:             */
084:            public DataWriter create_datawriter(Topic a_topic,
085:                    DataWriterQos qos, DataWriterListener a_listener) {
086:
087:                DataWriter DW = null;
088:                Servant impl;
089:
090:                try {
091:                    Class type = Class.forName(a_topic.get_type_name()
092:                            + "DataWriterImpl");
093:                    Class typehelper = Class.forName(a_topic.get_type_name()
094:                            + "DataWriterHelper");
095:                    Class type_param_constructor[] = new Class[6];
096:                    Object valu_param_constructor[] = new Object[6];
097:                    type_param_constructor[0] = DataWriterQos.class;
098:                    type_param_constructor[1] = DataWriterListener.class;
099:                    type_param_constructor[2] = Publisher.class;
100:                    type_param_constructor[3] = Topic.class;
101:                    type_param_constructor[4] = org.omg.CORBA.ORB.class;
102:                    type_param_constructor[5] = org.omg.PortableServer.POA.class;
103:                    valu_param_constructor[0] = qos;
104:                    valu_param_constructor[1] = a_listener;
105:                    valu_param_constructor[2] = this ._this ();
106:                    valu_param_constructor[3] = a_topic;
107:                    valu_param_constructor[4] = orb;
108:                    valu_param_constructor[5] = poa;
109:                    impl = (Servant) type
110:                            .getConstructor(type_param_constructor)
111:                            .newInstance(valu_param_constructor);
112:
113:                    org.omg.CORBA.Object oref = poa.servant_to_reference(impl);
114:                    Class type_param_narrow[] = new Class[1];
115:                    org.omg.CORBA.Object valu_param_narrow[] = new org.omg.CORBA.Object[1];
116:                    valu_param_narrow[0] = oref;
117:                    type_param_narrow[0] = Class
118:                            .forName("org.omg.CORBA.Object");
119:                    Method Narrow = typehelper.getMethod("narrow",
120:                            type_param_narrow);
121:                    DW = (DataWriter) Narrow.invoke(null, valu_param_narrow);
122:                    add(DW);
123:                } catch (Exception e) {
124:
125:                    System.out.println(e);
126:                    e.printStackTrace();
127:                }
128:
129:                return DW;
130:            }
131:
132:            /**
133:             * @param a_datawriter
134:             * @return
135:             */
136:            public int delete_datawriter(DataWriter a_datawriter) {
137:
138:                if (_this () == a_datawriter.get_publisher()) {
139:                    remove(a_datawriter);
140:                    return RETCODE_OK.value;
141:                } else
142:                    return RETCODE_PRECONDITION_NOT_MET.value;
143:            }
144:
145:            /**
146:             * @param topic_name
147:             * @return
148:             */
149:            public DataWriter lookup_datawriter(String topic_name) {
150:                Iterator It = Vector_DataWriter.iterator();
151:                DataWriter temp;
152:                while (It.hasNext()) {
153:                    temp = (DataWriter) It.next();
154:                    if (temp.get_topic().get_name().equals(topic_name))
155:                        return temp;
156:                }
157:                return null;
158:            }
159:
160:            /**
161:             * Not Implemented
162:             * @return
163:             */
164:            public int delete_contained_entities() {
165:                return 0;
166:            }
167:
168:            /**
169:             * @param qos
170:             * @return
171:             */
172:            public int set_qos(PublisherQos qos) {
173:                this .qos = qos;
174:
175:                return RETCODE_OK.value;
176:            }
177:
178:            /**
179:             * @param qos
180:             */
181:            public void get_qos(PublisherQosHolder qos) {
182:                qos.value = this .qos;
183:            }
184:
185:            /**
186:             * @param a_listener
187:             * @param mask
188:             * @return
189:             */
190:            public int set_listener(PublisherListener a_listener, int mask) {
191:                this .listner = a_listener;
192:                return RETCODE_OK.value;
193:            }
194:
195:            /**
196:             * @return
197:             */
198:            public PublisherListener get_listener() {
199:                return listner;
200:            }
201:
202:            /**
203:             * Not Implemented
204:             * @return
205:             */
206:            public int suspend_publications() {
207:                return 0;
208:            }
209:
210:            /**
211:             * Not Implemented
212:             * @return
213:             */
214:            public int resume_publications() {
215:                return 0;
216:            }
217:
218:            /**
219:             * Not Implemented
220:             * @return
221:             */
222:            public int begin_coherent_changes() {
223:                return 0;
224:            }
225:
226:            /**
227:             * Not Implemented
228:             * @return
229:             */
230:            public int end_coherent_changes() {
231:                return 0;
232:            }
233:
234:            /**
235:             * @return
236:             */
237:            public DomainParticipant get_participant() {
238:                return DP_Parent;
239:            }
240:
241:            /**
242:             * @param qos
243:             * @return
244:             */
245:            public int set_default_datawriter_qos(DataWriterQos qos) {
246:                this .Default_DataWriterqos = qos;
247:                return RETCODE_OK.value;
248:            }
249:
250:            /**
251:             * @param qos
252:             */
253:            public void get_default_datawriter_qos(DataWriterQosHolder qos) {
254:                qos.value = this .Default_DataWriterqos;
255:            }
256:
257:            /**
258:             * @param a_datawriter_qos
259:             * @param a_topic_qos
260:             * @return
261:             */
262:            public int copy_from_topic_qos(
263:                    DataWriterQosHolder a_datawriter_qos, TopicQos a_topic_qos) {
264:
265:                a_datawriter_qos.value.deadline = a_topic_qos.deadline;
266:                a_datawriter_qos.value.destination_order = a_topic_qos.destination_order;
267:                a_datawriter_qos.value.durability = a_topic_qos.durability;
268:                a_datawriter_qos.value.history = a_topic_qos.history;
269:                a_datawriter_qos.value.latency_budget = a_topic_qos.latency_budget;
270:                a_datawriter_qos.value.liveliness = a_topic_qos.liveliness;
271:                a_datawriter_qos.value.reliability = a_topic_qos.reliability;
272:                a_datawriter_qos.value.resource_limits = a_topic_qos.resource_limits;
273:
274:                return RETCODE_OK.value;
275:            }
276:
277:            /**
278:             * Not Implemented
279:             * @return
280:             */
281:            public int enable() {
282:                return 0;
283:            }
284:
285:            /**
286:             * Not Implemented
287:             * @return
288:             */
289:            public StatusCondition get_statuscondition() {
290:                return null;
291:            }
292:
293:            /**
294:             * Not Implemented
295:             * @return
296:             */
297:            public int get_status_changes() {
298:                return 0;
299:            }
300:
301:            /**
302:             * @param orb The orb to set.
303:             */
304:            public void setORB(org.omg.CORBA.ORB orb) {
305:                this .orb = orb;
306:            }
307:
308:            /**
309:             * @param poa The poa to set.
310:             */
311:            public void setPOA(org.omg.PortableServer.POA poa) {
312:                this .poa = poa;
313:            }
314:
315:            /**
316:             * @return Returns the vector_DataWriter.
317:             */
318:            public Vector getVector_DataWriter() {
319:                return Vector_DataWriter;
320:            }
321:
322:            /**
323:             * @param arg0
324:             * @return
325:             */
326:            public boolean add(Object arg0) {
327:                return Vector_DataWriter.add(arg0);
328:            }
329:
330:            /**
331:             * @param arg0
332:             * @return
333:             */
334:            public boolean remove(Object arg0) {
335:                return Vector_DataWriter.remove(arg0);
336:            }
337:
338:            /**
339:             * @return
340:             */
341:            public boolean isDeletable() {
342:                return getVector_DataWriter().isEmpty();
343:            }
344:
345:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.