Source Code Cross Referenced for MDBSimpleEntryEnv.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » tests » common » ejbs » mdb » containermanaged » simpleentry » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.simpleentry 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: MDBSimpleEntryEnv.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.simpleentry;
025:
026:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.ON_MESSAGE;
027:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_INJECTION_FIELD;
028:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_INJECTION_METHOD;
029:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_RESOURCES_DECLARATION;
030:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.ANNOTATION_RESOURCE_DECLARATION;
031:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.OVERRIDE_INJECTION_FIELD;
032:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.OVERRIDE_INJECTION_METHOD;
033:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.XML_INJECTION_FIELD;
034:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.XML_INJECTION_METHOD;
035:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.XML_RESOURCE_DECLARATION;
036:        import static org.ow2.easybeans.tests.common.helper.ContextHelper.checkSimpleEntry;
037:
038:        import javax.annotation.Resource;
039:        import javax.annotation.Resources;
040:        import javax.ejb.ActivationConfigProperty;
041:        import javax.ejb.MessageDriven;
042:        import javax.ejb.MessageDrivenContext;
043:        import javax.jms.Message;
044:        import javax.jms.MessageListener;
045:
046:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertOperation;
047:        import org.ow2.easybeans.tests.common.jms.JMSManager;
048:        import org.ow2.util.log.Log;
049:        import org.ow2.util.log.LogFactory;
050:
051:        /**
052:         * This bean is used to test the simple entries in the environement. Operations:
053:         * <li>Declaration using annotation.</li> <li>Declaration using XML.</li>
054:         * <li>Injection in a field using annotation.</li> <li>Injection in a method
055:         * using annotation.</li> <li>Injection in a field using XML.</li> <li>Injection
056:         * in a method using XML.</li> <li>Override an injection in a field with a
057:         * XML.</li><li>Override an injection in a method with a
058:         * XML.</li>
059:         * @author Eduardo Studzinski Estima de Castro
060:         * @author Gisele Pinheiro Souza
061:         */
062:        @MessageDriven(messageListenerInterface=MessageListener.class,activationConfig={@ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),@ActivationConfigProperty(propertyName="destination",propertyValue=JMSManager.DEFAULT_QUEUE),@ActivationConfigProperty(propertyName="messageSelector",propertyValue="TYPE = 'org.ow2.easybeans.tests." + "common.ejbs.mdb.containermanaged.simpleentry.MDBSimpleEntryEnv'")})
063:        @Resources({@Resource(name="simple/strDeclaration00",type=java.lang.String.class)})
064:        @Resource(name="simple/strDeclaration01",type=java.lang.String.class)
065:        public class MDBSimpleEntryEnv extends BaseInsertOperation {
066:
067:            /**
068:             * Message type.
069:             */
070:            public static final String MESSAGE_TYPE = "org.ow2.easybeans.tests.common.ejbs.mdb."
071:                    + "containermanaged.simpleentry.MDBSimpleEntryEnv";
072:
073:            /**
074:             * Logger.
075:             */
076:            private static Log logger = LogFactory
077:                    .getLog(MDBSimpleEntryEnv.class);
078:
079:            /**
080:             * Field.
081:             */
082:            private String strMethodInjection;
083:
084:            /**
085:             * The value must be injected by the container.
086:             */
087:            @Resource(name="simple/strFieldInjection")
088:            private String strFieldInjection;
089:
090:            /**
091:             * The value must be injected by the container using the XML value.
092:             */
093:            private String strXMLFieldInjection;
094:
095:            /**
096:             * The value must be injected by the container using the XML value.
097:             */
098:            private String strXMLMethodInjection;
099:
100:            /**
101:             * The value must be injected by the container using the XML value (Override
102:             * test).
103:             */
104:            @Resource(name="simple/strOverrideField")
105:            private String strOverrideFieldInjection;
106:
107:            /**
108:             * The value must be injected by the container using the XML value (Override
109:             * test).
110:             */
111:            private String strOverrideMethodInjection;
112:
113:            /**
114:             * The value must be injected by the container.
115:             * @param value information value
116:             */
117:            @SuppressWarnings("unused")
118:            @Resource(name="simple/strMethodInjection")
119:            private void setMethodInjection(final String value) {
120:                strMethodInjection = value;
121:            }
122:
123:            /**
124:             * The value must be injected by the container.
125:             * @param value information value
126:             */
127:            @SuppressWarnings("unused")
128:            private void setXMLMethodInjection(final String value) {
129:                strXMLMethodInjection = value;
130:            }
131:
132:            /**
133:             * The value must be injected by the container.
134:             * @param value information value
135:             */
136:            @SuppressWarnings("unused")
137:            @Resource(name="simple/strOverrideMethod")
138:            private void setOverrideMethodInjection(final String value) {
139:                strOverrideMethodInjection = value;
140:            }
141:
142:            /**
143:             * Context.
144:             */
145:            @Resource
146:            private MessageDrivenContext ctx;
147:
148:            /**
149:             * Tests declaration and injection.
150:             * @param message msg
151:             */
152:            public void onMessage(final Message message) {
153:
154:                //Declaration using annotation.
155:                try {
156:                    checkSimpleEntry(ctx, "simple/strDeclaration00",
157:                            "strDeclaration00");
158:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
159:                            MDBSimpleEntryEnv.class,
160:                            ANNOTATION_RESOURCES_DECLARATION);
161:                    logger.debug("{0} is working properly.",
162:                            ANNOTATION_RESOURCES_DECLARATION.toString());
163:                } catch (Exception e) {
164:                    logger.debug("Error checking {0}: {1}",
165:                            ANNOTATION_RESOURCES_DECLARATION.toString(), e
166:                                    .getMessage());
167:                }
168:                try {
169:                    checkSimpleEntry(ctx, "simple/strDeclaration01",
170:                            "strDeclaration01");
171:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
172:                            MDBSimpleEntryEnv.class,
173:                            ANNOTATION_RESOURCE_DECLARATION);
174:                    logger.debug("{0} is working properly.",
175:                            ANNOTATION_RESOURCE_DECLARATION.toString());
176:                } catch (Exception e) {
177:                    logger.debug("Error checking {0}: {1}",
178:                            ANNOTATION_RESOURCE_DECLARATION.toString(), e
179:                                    .getMessage());
180:                }
181:
182:                //Declaration using XML.
183:                try {
184:                    checkSimpleEntry(ctx, "simple/strXMLDeclaration",
185:                            "strXMLDeclaration00");
186:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
187:                            MDBSimpleEntryEnv.class, XML_RESOURCE_DECLARATION);
188:                    logger.debug("{0} is working properly.",
189:                            XML_RESOURCE_DECLARATION.toString());
190:                } catch (Exception e) {
191:                    logger
192:                            .debug("Error checking {0}: {1}",
193:                                    XML_RESOURCE_DECLARATION.toString(), e
194:                                            .getMessage());
195:                }
196:
197:                //Injection in a field using annotation.
198:                try {
199:
200:                    checkSimpleEntry(ctx, "simple/strFieldInjection",
201:                            strFieldInjection, "strFieldInjection00");
202:                    super 
203:                            .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
204:                                    MDBSimpleEntryEnv.class,
205:                                    ANNOTATION_INJECTION_FIELD);
206:                    logger.debug("{0} is working properly.",
207:                            ANNOTATION_INJECTION_FIELD.toString());
208:                } catch (Exception e) {
209:                    logger.debug("Error checking {0}: {1}",
210:                            ANNOTATION_INJECTION_FIELD.toString(), e
211:                                    .getMessage());
212:                }
213:
214:                //Injection in a method using annotation.
215:                try {
216:                    checkSimpleEntry(ctx, "simple/strMethodInjection",
217:                            strMethodInjection, "strMethodInjection00");
218:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
219:                            MDBSimpleEntryEnv.class,
220:                            ANNOTATION_INJECTION_METHOD);
221:                    logger.debug("{0} is working properly.",
222:                            ANNOTATION_INJECTION_METHOD.toString());
223:                } catch (Exception e) {
224:                    logger.debug("Error checking {0}: {1}",
225:                            ANNOTATION_INJECTION_METHOD.toString(), e
226:                                    .getMessage());
227:                }
228:
229:                //Injection in a field using XML.
230:                try {
231:                    checkSimpleEntry(ctx, "simple/strXMLFieldInjection",
232:                            strXMLFieldInjection, "strXMLFieldInjection00");
233:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
234:                            MDBSimpleEntryEnv.class, XML_INJECTION_FIELD);
235:                    logger.debug("{0} is working properly.",
236:                            XML_INJECTION_FIELD.toString());
237:                } catch (Exception e) {
238:                    logger.debug("Error checking {0}: {1}", XML_INJECTION_FIELD
239:                            .toString(), e.getMessage());
240:                }
241:
242:                //Injection in a method using XML.
243:                try {
244:                    checkSimpleEntry(ctx, "simple/strXMLMethodInjection",
245:                            strXMLMethodInjection, "strXMLMethodInjection00");
246:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
247:                            MDBSimpleEntryEnv.class, XML_INJECTION_METHOD);
248:                    logger.debug("{0} is working properly.",
249:                            XML_INJECTION_METHOD.toString());
250:                } catch (Exception e) {
251:                    logger.debug("Error checking {0}: {1}",
252:                            XML_INJECTION_METHOD.toString(), e.getMessage());
253:                }
254:
255:                //Override an injection in a field with a XML.
256:                try {
257:                    //Attention: the "simple/strOverrideFieldInjection" is the injection declared using the XML.
258:                    checkSimpleEntry(ctx, "simple/strOverrideFieldInjection",
259:                            strOverrideFieldInjection,
260:                            "strOverrideFieldInjection00");
261:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
262:                            MDBSimpleEntryEnv.class, OVERRIDE_INJECTION_FIELD);
263:                    logger.debug("{0} is working properly.",
264:                            OVERRIDE_INJECTION_FIELD.toString());
265:                } catch (Exception e) {
266:                    logger
267:                            .debug("Error checking {0}: {1}",
268:                                    OVERRIDE_INJECTION_FIELD.toString(), e
269:                                            .getMessage());
270:                }
271:
272:                //Override an injection in a method with a XML.
273:                try {
274:                    //Attention: the "simple/strOverrideMethodInjection" is the injection declared using the XML.
275:                    checkSimpleEntry(ctx, "simple/strOverrideMethodInjection",
276:                            strOverrideMethodInjection,
277:                            "strOverrideMethodInjection00");
278:                    super .log(MDBSimpleEntryEnv.class, ON_MESSAGE,
279:                            MDBSimpleEntryEnv.class, OVERRIDE_INJECTION_METHOD);
280:                    logger.debug("{0} is working properly.",
281:                            OVERRIDE_INJECTION_METHOD.toString());
282:                } catch (Exception e) {
283:                    logger.debug("Error checking {0}: {1}",
284:                            OVERRIDE_INJECTION_METHOD.toString(), e
285:                                    .getMessage());
286:                }
287:
288:            }
289:
290:        }
w_ww.j___a__v___a__2___s__.__c___o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.