Source Code Cross Referenced for ProxyPushSupplierImpl.java in  » Collaboration » JacORB » org » jacorb » events » 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.events 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jacorb.events;
002:
003:        /*
004:         *        JacORB - a free Java ORB
005:         *
006:         *   Copyright (C) 1997-2004 Gerald Brose.
007:         *
008:         *   This library is free software; you can redistribute it and/or
009:         *   modify it under the terms of the GNU Library General Public
010:         *   License as published by the Free Software Foundation; either
011:         *   version 2 of the License, or (at your option) any later version.
012:         *
013:         *   This library is distributed in the hope that it will be useful,
014:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         *   Library General Public License for more details.
017:         *
018:         *   You should have received a copy of the GNU Library General Public
019:         *   License along with this library; if not, write to the Free
020:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         */
022:
023:        import org.omg.CosEventComm.*;
024:        import org.omg.CosEventChannelAdmin.*;
025:        import org.omg.CORBA.*;
026:        import org.omg.PortableServer.*;
027:        import org.jacorb.orb.*;
028:
029:        /**
030:         * Implementation of COSEventChannelAdmin interface; ProxyPushSupplier.
031:         * This defines connect_push_consumer() and disconnect_push_supplier().  Helper
032:         * method will push a method to the registered consumer.
033:         *
034:         * 2002/23/08 JFC OMG EventService Specification 1.1 page 2-7 states:
035:         *      "Registration is a two step process.  An event-generating application
036:         *      first obtains a proxy consumer from a channel, then 'connects' to the
037:         *      proxy consumer by providing it with a supplier.  ...  The reason for
038:         *      the two step registration process..."
039:         *    Modifications to support the above have been made as well as to support
040:         *    section 2.1.5 "Disconnection Behavior" on page 2-4.
041:         *
042:         * @author Jeff Carlson, Joerg v. Frantzius, Rainer Lischetzki, Gerald Brose
043:         * @version $Id: ProxyPushSupplierImpl.java,v 1.8 2004/05/06 12:39:58 nicolas Exp $
044:         */
045:        public class ProxyPushSupplierImpl extends
046:                org.omg.CosEventChannelAdmin.ProxyPushSupplierPOA {
047:            private EventChannelImpl myEventChannel;
048:            private PushConsumer myPushConsumer;
049:            private org.omg.PortableServer.POA myPoa;
050:            private boolean connected;
051:
052:            /**
053:             * Constructor - to be called by EventChannel
054:             */
055:            protected ProxyPushSupplierImpl(EventChannelImpl ec,
056:                    org.omg.CORBA.ORB orb, org.omg.PortableServer.POA poa) {
057:                myEventChannel = ec;
058:                myPoa = poa;
059:                connected = false;
060:                _this _object(orb);
061:            }
062:
063:            /**
064:             * fuers ProxyPushSupplier Interface.
065:             * As stated by the EventService specification 1.1 section 2.3.7:
066:             * "If a ProxyPushSupplier is already connected to a PushConsumer, then the
067:             *  AlreadyConnected exception is raised."
068:             *  and
069:             * "Implementations shall raise the CORBA standard BAD_PARAM exception if
070:             *  a nil object reference is passed to the connect_push_consumer."
071:             */
072:            public void connect_push_consumer(PushConsumer pushConsumer)
073:                    throws org.omg.CosEventChannelAdmin.AlreadyConnected,
074:                    org.omg.CORBA.BAD_PARAM {
075:                if (connected) {
076:                    throw new org.omg.CosEventChannelAdmin.AlreadyConnected();
077:                }
078:                if (pushConsumer == null) {
079:                    throw new org.omg.CORBA.BAD_PARAM();
080:                }
081:
082:                myPushConsumer = pushConsumer;
083:                connected = true;
084:            }
085:
086:            /**
087:             * fuers PushSupplier Interface
088:             * See EventService v 1.1 specification section 2.1.2.
089:             *   'disconnect_push_supplier terminates the event communication; it releases
090:             *   resources used at the supplier to support event communication.  Calling
091:             *   this causes the implementation to call disconnect_push_consumer operation
092:             *   on the corresponding PushSupplier interface (if that iterface is known).'
093:             * See EventService v 1.1 specification section 2.1.5.  This method should
094:             *   adhere to the spec as it a) causes a call to the corresponding disconnect
095:             *   on the connected supplier, b) 'If a consumer or supplier has received a
096:             *   disconnect call and subsequently receives another disconnect call, it
097:             *   shall raise a CORBA::OBJECT_NOT_EXIST exception.
098:             */
099:            public void disconnect_push_supplier() {
100:                if (connected) {
101:                    if (myPushConsumer != null) {
102:                        myPushConsumer.disconnect_push_consumer();
103:                        myPushConsumer = null;
104:                    }
105:                    connected = false;
106:                } else {
107:                    throw new OBJECT_NOT_EXIST();
108:                }
109:            }
110:
111:            /**
112:             * Methoden, die von unserem EventChannel aufgerufen werden
113:             */
114:            protected void push_to_consumer(org.omg.CORBA.Any event) {
115:                if (connected) {
116:                    try {
117:                        myPushConsumer.push(event);
118:                    } catch (Disconnected e) {
119:                        connected = false;
120:                    }
121:                }
122:            }
123:
124:            /**
125:             * Override this method from the Servant baseclass.  Fintan Bolton
126:             * in his book "Pure CORBA" suggests that you override this method to
127:             * avoid the risk that a servant object (like this one) could be
128:             * activated by the <b>wrong</b> POA object.
129:             */
130:            public org.omg.PortableServer.POA _default_POA() {
131:                return myPoa;
132:            }
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.