Java Doc for EJBUtil.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » util » 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 » Workflow Engines » wfmopen 2.1.1 » de.danet.an.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   de.danet.an.util.EJBUtil

EJBUtil
public class EJBUtil (Code)
Collection of EJB utilities. This class adds common utilitites for an EJB environment.




Method Summary
public static  ObjectcreateSession(Class ejbClass, String jndiName)
     Create a session EJB.
public static  EJBObjectcreateSession(EJBHome home)
     Create a session EJB.
public static  EJBLocalObjectcreateSession(EJBLocalHome home)
     Create a session EJB.
public static  EJBHomelookupEJBHome(Class ejbClass, String jndiName)
     Lookup a home interface using EJBUtil.lookupJNDIEntrylookupJNDIEntry . The method provides caching of looked up home interface if the JNDI name is global (i.e.
public static  EJBLocalHomelookupEJBLocalHome(Class ejbClass, String jndiName)
     Lookup a local home interface using EJBUtil.lookupJNDIEntrylookupJNDIEntry .
public static  ObjectlookupJNDIEntry(String entry)
     Lookup a JNDI entry.
public static  longnewPrimaryKey(String table, long min)
     Gets the next unique primary key for the given database table observing a minimum value.

This method uses a high/low algorithm.

public static  longnewPrimaryKey(String table)
     Gets the next unique primary key for the given database table.
Parameters:
  table - the name of the table.
public static  voidremoveSession(Object handle)
     Convenience method to clean up a session connection after usage.
public static  EJBHomeretrieveEJBHome(Class ejbClass, String jndiName)
     Return an EJB's home interface using EJBUtil.lookupEJBHomelookupEJBHome .
public static  EJBLocalHomeretrieveEJBLocalHome(Class ejbClass, String jndiName)
     Return an EJB's local home interface using EJBUtil.lookupEJBHome lookupEJBLocalHome .
public static  ObjectretrieveJNDIEntry(String entry)
     Lookup a JNDI entry using EJBUtil.lookupJNDIEntrylookupJNDIEntry .
public static  ThrowableunwrapEJBException(Throwable ex)
     Unwrap the root cuase of an EJBException.



Method Detail
createSession
public static Object createSession(Class ejbClass, String jndiName) throws IllegalArgumentException, ResourceNotAvailableException(Code)
Create a session EJB. This method can be used for the special — but very common — case when you want to create a session EJB and the corresponding home interface has a create method without any paramaters.

The given home interface is looked up using EJBUtil.retrieveEJBHome retrieveEJBHome or EJBUtil.retrieveEJBLocalHome retrieveEJBLocalHome (as appropriate for the given class) and then the create session method is called.
Parameters:
  ejbClass - the class of the home interface which must define acreate() method.
Parameters:
  jndiName - the JNDI name of the home interface the new EJBObject.
throws:
  IllegalArgumentException - if no createmethod without arguments exists.
throws:
  ResourceNotAvailableException - if a problem occurs thatshould be temporary.




createSession
public static EJBObject createSession(EJBHome home) throws IllegalArgumentException, ResourceNotAvailableException(Code)
Create a session EJB. This method can be used for the special - but very common - case when you want to create a session EJB and the corresponding home interface has a create method without any paramaters.


Parameters:
  home - the home interface
throws:
  IllegalArgumentException - if no createmethod without arguments exists.
throws:
  ResourceNotAvailableException - if a problem occurs thatshould be temporary. the new EJBObject.




createSession
public static EJBLocalObject createSession(EJBLocalHome home) throws IllegalArgumentException, ResourceNotAvailableException(Code)
Create a session EJB. This method can be used for the special - but very common - case when you want to create a session EJB and the corresponding home interface has a create method without any paramaters.


Parameters:
  home - the home interface
throws:
  IllegalArgumentException - if no createmethod without arguments exists.
throws:
  ResourceNotAvailableException - if a problem occurs thatshould be temporary. the new EJBObject.




lookupEJBHome
public static EJBHome lookupEJBHome(Class ejbClass, String jndiName) throws NamingException(Code)
Lookup a home interface using EJBUtil.lookupJNDIEntrylookupJNDIEntry . The method provides caching of looked up home interface if the JNDI name is global (i.e. does not start with "java:comp/").
Parameters:
  ejbClass - the class of the home interface
Parameters:
  jndiName - the JNDI name of the home interface an EJBHome object
throws:
  NamingException - if the JNDI lookup fails.



lookupEJBLocalHome
public static EJBLocalHome lookupEJBLocalHome(Class ejbClass, String jndiName) throws NamingException(Code)
Lookup a local home interface using EJBUtil.lookupJNDIEntrylookupJNDIEntry .
Parameters:
  ejbClass - the class of the home interface
Parameters:
  jndiName - the JNDI name of the home interface an EJBHome object
throws:
  NamingException - if the JNDI lookup fails.



lookupJNDIEntry
public static Object lookupJNDIEntry(String entry) throws NamingException(Code)
Lookup a JNDI entry. This method implements caching as not all application servers implement JNDI efficiently. As a consequence, this method can only be used for read-only entries that do not change over time.
Parameters:
  entry - the JNDI name of the entry the object found object
throws:
  NamingException - if the JNDI lookup fails.



newPrimaryKey
public static long newPrimaryKey(String table, long min) throws ResourceNotAvailableException(Code)
Gets the next unique primary key for the given database table observing a minimum value.

This method uses a high/low algorithm. The high values are obtained from an EJB that maintains a table in a database. The JNDI name of the ejb used can be set in a properties file "/de.danet.an.util.jdbcKeyGen.properties with the entry "generatorEjbJndiName".

The JNDI name defaults to "java:comp/env/ejb/JdbcKeyGenLocal". This reflects the assumption that this method is usually called from an EJB or servlet. Of course, the deployment descriptor of the calling EJB or servlet must include an <ejb-ref> entry that links to the local home of EJB "KeyGen".

The table used by the EJB can be set with the property "highKeyTable". It defaults to "KeyGeneratorHighs". This table must be created as:

create table KeyGeneratorHighs (
 TabName VARCHAR(50) NOT NULL,
 NextKey INTEGER NOT NULL
 )/

Another property that can be set is "highFactor". It determines the number of low keys used before a new high key is requested. This value defaults to 64.
Parameters:
  table - the name of the table.
Parameters:
  min - the minimum value of the returned key. the new primary key.
throws:
  ResourceNotAvailableException - if an error occurs.




newPrimaryKey
public static long newPrimaryKey(String table) throws ResourceNotAvailableException(Code)
Gets the next unique primary key for the given database table.
Parameters:
  table - the name of the table. the new primary key.
throws:
  ResourceNotAvailableException - if an error occurs.
See Also:   EJBUtil.newPrimaryKey(String,long)



removeSession
public static void removeSession(Object handle)(Code)
Convenience method to clean up a session connection after usage. If the given parameter is an instance of EJBObject it simply calls remove() on the given object. If the parameter is null (indicating that the previous session creation propably failed) nothing happens. If an error occurs when calling remove(), it will be logged as warning.
Parameters:
  handle - the — maybe — ejb session object.



retrieveEJBHome
public static EJBHome retrieveEJBHome(Class ejbClass, String jndiName) throws ResourceNotAvailableException, IllegalStateException(Code)
Return an EJB's home interface using EJBUtil.lookupEJBHomelookupEJBHome . This should be called from a context where the JNDI name of the home interface is expected to exist. NamingExceptions should thus only occur if the service is not available due to dynamic error conditions (network failure etc.). These exceptions are mapped to a ResourceNotAvailable exception.

If, nevertheless, the NamingException indicates that the JNDI entry does not exists, we assume a configuration error and throw an IllegalStateException.
Parameters:
  ejbClass - the class of the home interface
Parameters:
  jndiName - the JNDI name of the home interface an EJBHome object
throws:
  ResourceNotAvailableException - if a problem occurs thatshould be temporary.
throws:
  IllegalStateException - if the givenjndiName is not registered.




retrieveEJBLocalHome
public static EJBLocalHome retrieveEJBLocalHome(Class ejbClass, String jndiName) throws ResourceNotAvailableException, IllegalStateException(Code)
Return an EJB's local home interface using EJBUtil.lookupEJBHome lookupEJBLocalHome . This should be called from a context where the JNDI name of the home interface is expected to exist. NamingExceptions should thus only occur if the service is not available due to dynamic error conditions (network failure etc.). These exceptions are mapped to a ResourceNotAvailable exception.

If, nevertheless, the NamingException indicates that the JNDI entry does not exists, we assume a configuration error and throw an IllegalStateException.
Parameters:
  ejbClass - the class of the home interface
Parameters:
  jndiName - the JNDI name of the home interface an EJBHome object
throws:
  ResourceNotAvailableException - if a problem occurs thatshould be temporary.
throws:
  IllegalStateException - if the givenjndiName is not registered.




retrieveJNDIEntry
public static Object retrieveJNDIEntry(String entry) throws ResourceNotAvailableException, IllegalStateException(Code)
Lookup a JNDI entry using EJBUtil.lookupJNDIEntrylookupJNDIEntry . This should be called from a context where the JNDI name is expected to exist. NamingExceptions should thus only occur if the service is not available due to dynamic error conditions (network failure etc.). These exceptions are mapped to a ResourceNotAvailable exception.

If, nevertheless, the NamingException indicates that the JNDI entry does not exists, we assume a configuration error and throw an IllegalStateException.
Parameters:
  entry - the JNDI name an EJBHome object
throws:
  ResourceNotAvailableException - if a problem occurs thatshould be temporary.
throws:
  IllegalStateException - if the givenjndiName is not registered.




unwrapEJBException
public static Throwable unwrapEJBException(Throwable ex)(Code)
Unwrap the root cuase of an EJBException. The EJBException wrappers often hide the root cause of an exception. This method calls getCausedByException() until it finds an exception that is not of type EJBException. This exception is returned.
Parameters:
  ex - the exception to be unwrapped. the root cause exception.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.