001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package com.caucho.server.webbeans;
031:
032: import com.caucho.ejb.timer.EjbTimerService;
033: import com.caucho.jca.UserTransactionProxy;
034: import com.caucho.jms.JmsConnectionFactory;
035: import com.caucho.jmx.Jmx;
036: import com.caucho.webbeans.*;
037: import com.caucho.webbeans.manager.WebBeansContainer;
038: import com.caucho.server.util.ScheduledThreadPool;
039: import com.caucho.transaction.*;
040:
041: import java.util.concurrent.*;
042: import javax.ejb.*;
043: import javax.management.*;
044: import javax.transaction.*;
045: import javax.webbeans.*;
046:
047: /**
048: * Resin WebBeans producer for the main singletons.
049: */
050:
051: @Standard
052: @Singleton
053: public class ResinWebBeansProducer {
054: /**
055: * Returns the web beans container.
056: */
057: @Produces
058: @Standard
059: public Container getContainer() {
060: return WebBeansContainer.create();
061: }
062:
063: /**
064: * Returns the web beans conversation controller
065: */
066: @Produces
067: @Standard
068: public Conversation getConversation() {
069: return WebBeansContainer.create().createConversation();
070: }
071:
072: /**
073: * Returns the MBeanServer
074: */
075: @Produces
076: @Standard
077: public MBeanServer getMBeanServer() {
078: return Jmx.getGlobalMBeanServer();
079: }
080:
081: /**
082: * Returns the corba ORB
083: */
084: @Produces
085: @Standard
086: public org.omg.CORBA.ORB getORB() {
087: return new com.caucho.iiop.orb.ORBImpl();
088: }
089:
090: /**
091: * Returns the TransactionManager
092: */
093: @Produces
094: @Standard
095: public TransactionManager getTransactionManager() {
096: return TransactionManagerImpl.getInstance();
097: }
098:
099: /**
100: * Returns the UserTransaction
101: */
102: @Produces
103: @Standard
104: public UserTransaction getUserTransaction() {
105: return UserTransactionProxy.getInstance();
106: }
107:
108: /**
109: * Returns the ScheduledExecutorService
110: */
111: @Produces
112: @Standard
113: public ScheduledExecutorService getScheduledExecutorService() {
114: return ScheduledThreadPool.getLocal();
115: }
116:
117: /**
118: * Returns the javax.ejb.TimerService
119: */
120: @Produces
121: @Standard
122: public TimerService getTimerService() {
123: return EjbTimerService.getCurrent();
124: }
125: }
|