What an Enterprise Bean May Not Do


The specification of Enterprise JavaBeans is very restrictive for the developer of an Enterprise Bean as it relates to the use of certain interfaces. The most important restrictions will be presented in this section. What is most interesting is the question of the reason for such prohibitions. We shall investigate this question after we briefly introduce the most important restrictions (the complete list of restrictions can be found in [21]):

  • An Enterprise Bean may not use static variables. Static constants, on the other hand, are permitted.

  • An Enterprise Bean may not use a thread synchronization mechanism.

  • An Enterprise Bean may not use the functionality of the AWT (Abstract Windowing Toolkit) to produce output via a graphic user interface or to read input from the keyboard.

  • An Enterprise Bean may not use any classes from java.io to access files or directories in a file system.

  • An Enterprise Bean may not listen in on a network socket; it may not accept a connection to a network socket; and it may not use a socket for multicast.

  • An Enterprise Bean may not attempt to use introspection or reflection to access information from classes and instances that are supposed to remain secret according to the Java security policy.

  • An Enterprise Bean may not generate a class loader; it may not use a class loader; it may not change the context of a class loader; it may not set a security manager; it may not generate a security manager; it may not stop the Java virtual machine; and it may not change the standard input the standard output, or the standard error.

  • An Enterprise Bean may not use an object of the class Policy, Security, Provider, Signer,or Identity from the java.security package or attempt to change their values.

  • An Enterprise Bean may not set a socket factory that is used by the classes ServerSocket and Socket. The same holds for the stream handler factory of the URL class.

  • An Enterprise Bean may not use threads. It may neither start nor stop them.

  • An Enterprise Bean may not directly read or write file descriptors.

  • An Enterprise Bean may not load a native library.

  • An Enterprise Bean may never pass this as an argument in a call to a method or this as the return value of a method call.

To "program" an Enterprise Bean means to develop server-side logic at a relatively high level of abstraction. The specification of Enterprise JavaBeans describes a component architecture for distributed applications. Through the component model the specification seeks to establish a clear distribution of labor among various tasks. The server and the EJB container are responsible for system-specific functionality. The bean uses this infrastructure as its run-time environment and thus need not concern itself with system-specific functionality. The task of the bean is to concentrate on the logic for enterprise-related processes. In order to be able to carry out this task, it should use the services made available to it by the EJB container, and no others. These restrictions imposed by the specification of Enterprise Beans should serve to ward off conflicts between the EJB container and the Enterprise Beans.




Enterprise JavaBeans 2.1
Enterprise JavaBeans 2.1
ISBN: 1590590880
EAN: 2147483647
Year: 2006
Pages: 103

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net