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


001:        package org.jacorb.notification.servant;
002:
003:        /*
004:         *        JacORB - a free Java ORB
005:         *
006:         *   Copyright (C) 1999-2003 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:
024:        import java.util.List;
025:
026:        import org.apache.avalon.framework.configuration.Configuration;
027:        import org.jacorb.notification.MessageFactory;
028:        import org.jacorb.notification.OfferManager;
029:        import org.jacorb.notification.SubscriptionManager;
030:        import org.jacorb.notification.container.CORBAObjectComponentAdapter;
031:        import org.jacorb.notification.interfaces.Disposable;
032:        import org.jacorb.notification.interfaces.FilterStageSource;
033:        import org.jacorb.notification.interfaces.MessageConsumer;
034:        import org.jacorb.notification.util.CollectionsWrapper;
035:        import org.omg.CORBA.BAD_PARAM;
036:        import org.omg.CORBA.IntHolder;
037:        import org.omg.CORBA.ORB;
038:        import org.omg.CORBA.UNKNOWN;
039:        import org.omg.CosEventChannelAdmin.ProxyPullConsumer;
040:        import org.omg.CosEventChannelAdmin.ProxyPushConsumer;
041:        import org.omg.CosNotification.EventType;
042:        import org.omg.CosNotifyChannelAdmin.AdminLimitExceeded;
043:        import org.omg.CosNotifyChannelAdmin.ClientType;
044:        import org.omg.CosNotifyChannelAdmin.ProxyConsumer;
045:        import org.omg.CosNotifyChannelAdmin.ProxyConsumerHelper;
046:        import org.omg.CosNotifyChannelAdmin.ProxyNotFound;
047:        import org.omg.CosNotifyChannelAdmin.SupplierAdmin;
048:        import org.omg.CosNotifyChannelAdmin.SupplierAdminHelper;
049:        import org.omg.CosNotifyChannelAdmin.SupplierAdminOperations;
050:        import org.omg.CosNotifyChannelAdmin.SupplierAdminPOATie;
051:        import org.omg.CosNotifyComm.InvalidEventType;
052:        import org.omg.PortableServer.POA;
053:        import org.omg.PortableServer.Servant;
054:        import org.picocontainer.MutablePicoContainer;
055:        import org.picocontainer.defaults.CachingComponentAdapter;
056:
057:        /**
058:         * @jmx.mbean extends = "AbstractAdminMBean"
059:         * @jboss.xmbean
060:         * 
061:         * @author Alphonse Bendt
062:         * @version $Id: SupplierAdminImpl.java,v 1.10 2006/01/12 22:34:54 alphonse.bendt Exp $
063:         */
064:
065:        public class SupplierAdminImpl extends AbstractSupplierAdmin implements 
066:                SupplierAdminOperations, Disposable, SupplierAdminImplMBean {
067:            private FilterStageSource subsequentFilterStagesSource_;
068:
069:            private final SupplierAdmin this CorbaRef_;
070:
071:            // //////////////////////////////////////
072:
073:            public SupplierAdminImpl(IEventChannel channelServant, ORB orb,
074:                    POA poa, Configuration config,
075:                    MessageFactory messageFactory, OfferManager offerManager,
076:                    SubscriptionManager subscriptionManager) {
077:                super (channelServant, orb, poa, config, messageFactory,
078:                        offerManager, subscriptionManager);
079:
080:                this CorbaRef_ = SupplierAdminHelper.narrow(activate());
081:
082:                container_.registerComponent(new CachingComponentAdapter(
083:                        new CORBAObjectComponentAdapter(SupplierAdmin.class,
084:                                this CorbaRef_)));
085:
086:                registerDisposable(new Disposable() {
087:                    public void dispose() {
088:                        container_.unregisterComponent(SupplierAdmin.class);
089:                    }
090:                });
091:            }
092:
093:            public Servant newServant() {
094:                return new SupplierAdminPOATie(this );
095:            }
096:
097:            public void offer_change(EventType[] added, EventType[] removed)
098:                    throws InvalidEventType {
099:                offerManager_.offer_change(added, removed);
100:            }
101:
102:            /**
103:             * access the ids of all PullConsumers (NotifyStyle)
104:             */
105:            public int[] pull_consumers() {
106:                return get_all_notify_proxies(pullServants_, modifyProxiesLock_);
107:            }
108:
109:            /**
110:             * access the ids of all PushConsumers (NotifyStyle)
111:             */
112:            public int[] push_consumers() {
113:                return get_all_notify_proxies(pushServants_, modifyProxiesLock_);
114:            }
115:
116:            public ProxyConsumer obtain_notification_pull_consumer(
117:                    ClientType clientType, IntHolder intHolder)
118:                    throws AdminLimitExceeded {
119:                fireCreateProxyRequestEvent();
120:
121:                try {
122:                    AbstractProxy _servant = obtain_notification_pull_consumer_servant(clientType);
123:
124:                    intHolder.value = _servant.getID().intValue();
125:
126:                    return ProxyConsumerHelper.narrow(_servant.activate());
127:                } catch (Exception e) {
128:                    logger_
129:                            .fatalError(
130:                                    "obtain_notification_pull_consumer: unexpected error",
131:                                    e);
132:
133:                    throw new UNKNOWN();
134:                }
135:            }
136:
137:            private AbstractProxy obtain_notification_pull_consumer_servant(
138:                    ClientType clientType) throws Exception {
139:                AbstractProxy _servant = newProxyPullConsumer(clientType);
140:
141:                configureInterFilterGroupOperator(_servant);
142:
143:                configureQoS(_servant);
144:
145:                addProxyToMap(_servant, pullServants_, modifyProxiesLock_);
146:
147:                return _servant;
148:            }
149:
150:            public ProxyConsumer get_proxy_consumer(int id)
151:                    throws ProxyNotFound {
152:                return ProxyConsumerHelper.narrow(getProxy(id).activate());
153:            }
154:
155:            public ProxyConsumer obtain_notification_push_consumer(
156:                    ClientType clienttype, IntHolder intHolder)
157:                    throws AdminLimitExceeded {
158:                // may throws AdminLimitExceeded
159:                fireCreateProxyRequestEvent();
160:
161:                try {
162:                    AbstractProxy _servant = obtain_notification_push_consumer_servant(clienttype);
163:
164:                    intHolder.value = _servant.getID().intValue();
165:
166:                    return ProxyConsumerHelper.narrow(_servant.activate());
167:                } catch (Exception e) {
168:                    logger_
169:                            .fatalError(
170:                                    "obtain_notification_push_consumer: unexpected error",
171:                                    e);
172:
173:                    throw new UNKNOWN();
174:                }
175:            }
176:
177:            private AbstractProxy obtain_notification_push_consumer_servant(
178:                    ClientType clientType) throws Exception {
179:                final AbstractProxy _servant = newProxyPushConsumer(clientType);
180:
181:                configureInterFilterGroupOperator(_servant);
182:
183:                configureQoS(_servant);
184:
185:                addProxyToMap(_servant, pushServants_, modifyProxiesLock_);
186:
187:                return _servant;
188:            }
189:
190:            /**
191:             * get a ProxyPushConsumer (EventService Style)
192:             */
193:            public ProxyPushConsumer obtain_push_consumer() {
194:                try {
195:                    MutablePicoContainer _container = newContainerForEventStyleProxy();
196:
197:                    _container.registerComponentImplementation(
198:                            AbstractProxyConsumer.class,
199:                            ECProxyPushConsumerImpl.class);
200:
201:                    AbstractProxyConsumer _servant = (AbstractProxyConsumer) _container
202:                            .getComponentInstanceOfType(AbstractProxyConsumer.class);
203:
204:                    _servant.setSubsequentDestinations(CollectionsWrapper
205:                            .singletonList(this ));
206:
207:                    configureQoS(_servant);
208:
209:                    addProxyToMap(_servant, pushServants_, modifyProxiesLock_);
210:
211:                    return org.omg.CosEventChannelAdmin.ProxyPushConsumerHelper
212:                            .narrow(_servant.activate());
213:                } catch (Exception e) {
214:                    logger_.fatalError(
215:                            "obtain_push_consumer: unexpected error", e);
216:
217:                    throw new UNKNOWN();
218:                }
219:            }
220:
221:            /**
222:             * get a ProxyPullConsumer (EventService Style)
223:             */
224:            public ProxyPullConsumer obtain_pull_consumer() {
225:                try {
226:                    MutablePicoContainer _container = newContainerForEventStyleProxy();
227:
228:                    _container.registerComponentImplementation(
229:                            AbstractProxyConsumer.class,
230:                            ECProxyPullConsumerImpl.class);
231:
232:                    AbstractProxyConsumer _servant = (AbstractProxyConsumer) _container
233:                            .getComponentInstanceOfType(AbstractProxyConsumer.class);
234:
235:                    _servant.setSubsequentDestinations(CollectionsWrapper
236:                            .singletonList(this ));
237:
238:                    configureQoS(_servant);
239:
240:                    addProxyToMap(_servant, pushServants_, modifyProxiesLock_);
241:
242:                    return org.omg.CosEventChannelAdmin.ProxyPullConsumerHelper
243:                            .narrow(_servant.activate());
244:                } catch (Exception e) {
245:                    logger_.fatalError(
246:                            "obtain_pull_consumer: unexpected error", e);
247:
248:                    throw new UNKNOWN();
249:                }
250:            }
251:
252:            // //////////////////////////////////////
253:
254:            public List getSubsequentFilterStages() {
255:                return subsequentFilterStagesSource_
256:                        .getSubsequentFilterStages();
257:            }
258:
259:            public void setSubsequentFilterStageSource(FilterStageSource source) {
260:                subsequentFilterStagesSource_ = source;
261:            }
262:
263:            /**
264:             * SupplierAdmin does not ever have a MessageConsumer.
265:             */
266:            public MessageConsumer getMessageConsumer() {
267:                throw new UnsupportedOperationException();
268:            }
269:
270:            /**
271:             * SupplierAdmin does not ever have a MessageConsumer.
272:             */
273:            public boolean hasMessageConsumer() {
274:                return false;
275:            }
276:
277:            public boolean hasInterFilterGroupOperatorOR() {
278:                return false;
279:            }
280:
281:            /**
282:             * factory method to create new ProxyPullConsumerServants.
283:             */
284:            AbstractProxy newProxyPullConsumer(ClientType clientType) {
285:                final AbstractProxyConsumer _servant;
286:
287:                final Class _clazz;
288:
289:                switch (clientType.value()) {
290:                case ClientType._ANY_EVENT:
291:                    _clazz = ProxyPullConsumerImpl.class;
292:                    break;
293:                case ClientType._STRUCTURED_EVENT:
294:                    _clazz = StructuredProxyPullConsumerImpl.class;
295:                    break;
296:                case ClientType._SEQUENCE_EVENT:
297:                    _clazz = SequenceProxyPullConsumerImpl.class;
298:                    break;
299:                default:
300:                    throw new BAD_PARAM("Invalid ClientType: ClientType."
301:                            + clientType.value());
302:                }
303:
304:                final MutablePicoContainer _containerForProxy = newContainerForNotifyStyleProxy();
305:
306:                _containerForProxy.registerComponentImplementation(
307:                        AbstractProxyConsumer.class, _clazz);
308:
309:                _servant = (AbstractProxyConsumer) _containerForProxy
310:                        .getComponentInstanceOfType(AbstractProxyConsumer.class);
311:
312:                _servant.setSubsequentDestinations(CollectionsWrapper
313:                        .singletonList(this ));
314:
315:                return _servant;
316:            }
317:
318:            /**
319:             * factory method to create new ProxyPushConsumerServants.
320:             */
321:            private AbstractProxy newProxyPushConsumer(ClientType clientType) {
322:                final AbstractProxyConsumer _servant;
323:                final Class _proxyClazz;
324:
325:                switch (clientType.value()) {
326:                case ClientType._ANY_EVENT:
327:                    _proxyClazz = ProxyPushConsumerImpl.class;
328:                    break;
329:                case ClientType._STRUCTURED_EVENT:
330:                    _proxyClazz = StructuredProxyPushConsumerImpl.class;
331:                    break;
332:                case ClientType._SEQUENCE_EVENT:
333:                    _proxyClazz = SequenceProxyPushConsumerImpl.class;
334:                    break;
335:                default:
336:                    throw new BAD_PARAM("Invalid ClientType: ClientType."
337:                            + clientType.value());
338:                }
339:
340:                final MutablePicoContainer _containerForProxy = newContainerForNotifyStyleProxy();
341:
342:                _containerForProxy.registerComponentImplementation(
343:                        AbstractProxyConsumer.class, _proxyClazz);
344:
345:                _servant = (AbstractProxyConsumer) _containerForProxy
346:                        .getComponentInstanceOfType(AbstractProxyConsumer.class);
347:
348:                _servant.setSubsequentDestinations(CollectionsWrapper
349:                        .singletonList(this ));
350:
351:                return _servant;
352:            }
353:
354:            public String getMBeanType() {
355:                return "SupplierAdmin";
356:            }
357:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.