Source Code Cross Referenced for FakedSessionContext.java in  » Testing » Ejb3Unit » com » bm » utils » substitues » 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 » Testing » Ejb3Unit » com.bm.utils.substitues 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.bm.utils.substitues;
002:
003:        import java.security.Principal;
004:        import java.util.Hashtable;
005:        import java.util.Properties;
006:
007:        import javax.ejb.EJBHome;
008:        import javax.ejb.EJBLocalHome;
009:        import javax.ejb.EJBLocalObject;
010:        import javax.ejb.EJBObject;
011:        import javax.ejb.SessionContext;
012:        import javax.ejb.TimerService;
013:        import javax.naming.Context;
014:        import javax.naming.InitialContext;
015:        import javax.naming.NamingException;
016:        import javax.transaction.UserTransaction;
017:        import javax.xml.rpc.handler.MessageContext;
018:
019:        import org.apache.commons.lang.NotImplementedException;
020:
021:        import com.bm.jndi.MemoryContextFactory;
022:
023:        /**
024:         * Represnts a dummy implementation for a session context. Later we can
025:         * implements more functionality here.
026:         * 
027:         * @author Daniel Wiese
028:         * 
029:         */
030:        public class FakedSessionContext implements  SessionContext {
031:
032:            private final InitialContext ctx;
033:
034:            public FakedSessionContext() {
035:                Hashtable<String, String> env = new Hashtable<String, String>();
036:                env.put(Context.INITIAL_CONTEXT_FACTORY,
037:                        MemoryContextFactory.class.getName());
038:                try {
039:                    ctx = new InitialContext(env);
040:                } catch (NamingException e) {
041:                    throw new RuntimeException(
042:                            "Can't setup JNDI context for testing");
043:                }
044:            }
045:
046:            /**
047:             * {@inheritDoc}
048:             */
049:            public <T> T getBusinessObject(Class<T> businessInterface) {
050:                throw new NotImplementedException("Not yet implemented");
051:            }
052:
053:            /**
054:             * {@inheritDoc}
055:             */
056:            public EJBLocalObject getEJBLocalObject() {
057:                throw new NotImplementedException("Not yet implemented");
058:            }
059:
060:            /**
061:             * {@inheritDoc}
062:             */
063:            public EJBObject getEJBObject() {
064:                throw new NotImplementedException("Not yet implemented");
065:            }
066:
067:            /**
068:             * {@inheritDoc}
069:             */
070:            public Class getInvokedBusinessInterface() {
071:                throw new NotImplementedException("Not yet implemented");
072:            }
073:
074:            /**
075:             * {@inheritDoc}
076:             */
077:            public MessageContext getMessageContext() {
078:                throw new NotImplementedException("Not yet implemented");
079:            }
080:
081:            /**
082:             * {@inheritDoc}
083:             */
084:            public Principal getCallerPrincipal() {
085:                throw new NotImplementedException("Not yet implemented");
086:            }
087:
088:            /**
089:             * {@inheritDoc}
090:             */
091:            public EJBHome getEJBHome() {
092:                throw new NotImplementedException("Not yet implemented");
093:            }
094:
095:            /**
096:             * {@inheritDoc}
097:             */
098:            public EJBLocalHome getEJBLocalHome() {
099:                throw new NotImplementedException("Not yet implemented");
100:            }
101:
102:            /**
103:             * {@inheritDoc}
104:             */
105:            public Properties getEnvironment() {
106:                throw new NotImplementedException("Not yet implemented");
107:            }
108:
109:            /**
110:             * {@inheritDoc}
111:             */
112:            public boolean getRollbackOnly() {
113:                throw new NotImplementedException("Not yet implemented");
114:            }
115:
116:            /**
117:             * {@inheritDoc}
118:             */
119:            public TimerService getTimerService() {
120:                throw new NotImplementedException(
121:                        "Please use injection for timer: @Resource private TimerService timerService;");
122:            }
123:
124:            /**
125:             * {@inheritDoc}
126:             */
127:            public UserTransaction getUserTransaction() {
128:                throw new NotImplementedException("Not yet implemented");
129:            }
130:
131:            /**
132:             * {@inheritDoc}
133:             */
134:            @SuppressWarnings("deprecation")
135:            public boolean isCallerInRole(java.security.Identity role) {
136:                throw new NotImplementedException("Not yet implemented");
137:            }
138:
139:            /**
140:             * {@inheritDoc}
141:             */
142:            public boolean isCallerInRole(String roleName) {
143:                throw new NotImplementedException("Not yet implemented");
144:            }
145:
146:            /**
147:             * {@inheritDoc}
148:             */
149:            public Object lookup(String name) {
150:                try {
151:                    return ctx.lookup(name);
152:                } catch (NamingException e) {
153:                    throw new RuntimeException(e);
154:                }
155:            }
156:
157:            /**
158:             * {@inheritDoc}
159:             */
160:            public void setRollbackOnly() {
161:                throw new NotImplementedException("Not yet implemented");
162:            }
163:
164:            /**
165:             * {@inheritDoc}
166:             */
167:            @SuppressWarnings("deprecation")
168:            public java.security.Identity getCallerIdentity() {
169:                throw new NotImplementedException("Not yet implemented");
170:            }
171:
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.