Source Code Cross Referenced for PersonArticleManagerODMGBean.java in  » Database-ORM » db-ojb » org » apache » ojb » ejb » odmg » 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 » Database ORM » db ojb » org.apache.ojb.ejb.odmg 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.ejb.odmg;
002:
003:        /* Copyright 2004-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        import javax.ejb.CreateException;
019:        import javax.ejb.EJBException;
020:        import javax.ejb.SessionBean;
021:        import javax.naming.Context;
022:        import javax.naming.InitialContext;
023:        import javax.naming.NamingException;
024:        import java.util.ArrayList;
025:        import java.util.List;
026:
027:        import org.apache.ojb.broker.util.logging.Logger;
028:        import org.apache.ojb.broker.util.logging.LoggerFactory;
029:        import org.apache.ojb.ejb.SessionBeanImpl;
030:
031:        /**
032:         * Simple example bean do nested bean calls,
033:         * using {@link org.apache.ojb.ejb.odmg.PersonManagerODMGBean}
034:         * and {@link org.apache.ojb.ejb.odmg.ArticleManagerODMGBean}
035:         * within some test methods.
036:         *
037:         * @ejb:bean
038:         * 			type="Stateless"
039:         * 			name="PersonArticleManagerODMGBean"
040:         * 			jndi-name="org.apache.ojb.ejb.odmg.PersonArticleManagerODMGBean"
041:         * 			local-jndi-name="org.apache.ojb.ejb.odmg.PersonArticleManagerODMGBeanLocal"
042:         * 			view-type="both"
043:         * 			transaction-type="Container"
044:         *
045:         * @ejb:interface
046:         * 		remote-class="org.apache.ojb.ejb.odmg.PersonArticleManagerODMGRemote"
047:         * 		local-class="org.apache.ojb.ejb.odmg.PersonArticleManagerODMGLocal"
048:         * 		extends="javax.ejb.EJBObject"
049:         *
050:         * @ejb:home
051:         * 		remote-class="org.apache.ojb.ejb.odmg.PersonArticleManagerODMGHome"
052:         * 		local-class="org.apache.ojb.ejb.odmg.PersonArticleManagerODMGLocalHome"
053:         * 		extends="javax.ejb.EJBHome"
054:         *
055:         * @ejb:transaction
056:         * 		type="Required"
057:         *
058:         * @ejb:ejb-ref
059:         *      ejb-name="PersonManagerODMGBean"
060:         *      view-type="local"
061:         *      ref-name="ejb/ojb/odmg/PersonManager"
062:         *
063:         * @ejb:ejb-ref
064:         *      ejb-name="ArticleManagerODMGBean"
065:         *      view-type="local"
066:         *      ref-name="ejb/ojb/odmg/ArticleManager"
067:         *
068:         *
069:         * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
070:         * @version $Id: PersonArticleManagerODMGBean.java,v 1.4.2.2 2005/12/21 22:21:39 tomdz Exp $
071:         */
072:        public class PersonArticleManagerODMGBean extends SessionBeanImpl
073:                implements  SessionBean {
074:            private static final String PERSON_MANAGER_EJB_REF_NAME = "java:comp/env/ejb/ojb/odmg/PersonManager";
075:            private static final String ARTICLE_MANAGER_EJB_REF_NAME = "java:comp/env/ejb/ojb/odmg/ArticleManager";
076:
077:            private Logger log = LoggerFactory
078:                    .getLogger(PersonArticleManagerODMGBean.class);
079:
080:            private ArticleManagerODMGLocal am;
081:            private PersonManagerODMGLocal pm;
082:
083:            public PersonArticleManagerODMGBean() {
084:            }
085:
086:            public void ejbCreate() {
087:
088:            }
089:
090:            /**
091:             * @ejb:interface-method
092:             */
093:            public List storeArticles(List articles) {
094:                return new ArrayList(getArticleManager()
095:                        .storeArticles(articles));
096:            }
097:
098:            /**
099:             * @ejb:interface-method
100:             */
101:            public void deleteArticles(List articles) {
102:                getArticleManager().deleteArticles(articles);
103:            }
104:
105:            /**
106:             * @ejb:interface-method
107:             */
108:            public List storePersons(List persons) {
109:                return new ArrayList(getPersonManager().storePersons(persons));
110:            }
111:
112:            /**
113:             * @ejb:interface-method
114:             */
115:            public void deletePersons(List persons) {
116:                getPersonManager().deletePersons(persons);
117:            }
118:
119:            /**
120:             * @ejb:interface-method
121:             */
122:            public int articleCount() {
123:                return getArticleManager().countArticles();
124:            }
125:
126:            /**
127:             * @ejb:interface-method
128:             */
129:            public int personCount() {
130:                return getPersonManager().countPersons();
131:            }
132:
133:            private ArticleManagerODMGLocal getArticleManager() {
134:                if (am == null) {
135:                    Context context = null;
136:                    try {
137:                        context = new InitialContext();
138:                        am = ((ArticleManagerODMGLocalHome) context
139:                                .lookup(ARTICLE_MANAGER_EJB_REF_NAME)).create();
140:                        log.info("** Found bean: " + am);
141:                        return am;
142:                    } catch (NamingException e) {
143:                        log.error("Lookup using ejb-ref "
144:                                + ARTICLE_MANAGER_EJB_REF_NAME + " failed", e);
145:                        throw new EJBException(e);
146:                    } catch (CreateException e) {
147:                        log.error("Creation of ArticleManager failed", e);
148:                        throw new EJBException(e);
149:                    }
150:                }
151:                return am;
152:            }
153:
154:            private PersonManagerODMGLocal getPersonManager() {
155:                if (pm == null) {
156:                    Context context = null;
157:                    try {
158:                        context = new InitialContext();
159:                        pm = ((PersonManagerODMGLocalHome) context
160:                                .lookup(PERSON_MANAGER_EJB_REF_NAME)).create();
161:                        log.info("** Found bean: " + pm);
162:                        return pm;
163:                    } catch (NamingException e) {
164:                        log.error("Lookup using ejb-ref "
165:                                + PERSON_MANAGER_EJB_REF_NAME + " failed", e);
166:                        throw new EJBException(e);
167:                    } catch (CreateException e) {
168:                        log.error("Creation of PersonManager failed", e);
169:                        throw new EJBException(e);
170:                    }
171:                }
172:                return pm;
173:            }
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.