A JucasBean is a Java class which implements the interface org.jucas.JucasBean (there is a base-implementation org.jucas.BaseJucasBean). The JucasBean must have a default constructor (no argumenst public) so that it can be loaded by the BeanManager based on the Beans name.
Like for Services the name of a JucasBean is an URI. Through this name the JucasBean can be retrieved from the BeanManager.
The scheme of the URI of a JucasBean name is 'jucas'. The host of the URI denotes either the full qualified class name of the JucasBean or for xml-defined JucasBeans the file location. To resolve the file the dots in the host are replaces with '/', the extension '.jucas.xml' is appended and this path is searched from the path WEB-INF/jucas/resources/beans.
The (optional) path and query of the URI indicate different instances of the same type of JucasBeans. Finally the (optional) fragment of the URI (after #) is treated as BeanUtils properties path which is evaluated by the BeanManager on the JucasBean.
The BeanName of a JucasBean can be retrieved through JucasBean.getBeanName(). The BeanName is set on the JucasBean by the BeanManager when the JucasBean is instantiated by the BeanManager.
Jucas differntiates between two types of JucasBeans. The ones which are directly held, automatically loaded and managed by the BeanManager (they have no fragment in their name URI). They are called PageBeans. And those JucasBeans which are created and retrieved from the directly managed JucasBeans. These have a fragment part in their name: This child JucasBeans are said to be contained in a PageBean.
If a JucasBean is not a PageBean (not directly managed by the BeanManager) the getJucasParent() method will return the JucasBean which created it (it?s container). Note that this is not necessarily the same as the one from which it is gotten by a Property.
Because of the dynamic loading of the PageBeans references in fields should only be kept to objects which are not contained in the same PageBean. If an Object of another PageBean or the other PageBean is needed in a method the method should retrieve the needed JucasBean form the BeanManager, do the execution and than release it again. If a reference has to be stored an org.jucas.BeanLink should be used.
Like the BeanName the parent is set on the JuasBean when it is initialized.
PageBeans (directly managed by the BeanManager JucasBeans) are held by the BeanManager either in Session or Request scope. In request scope they are released after the request is finished and will be loaded newly for each request. In the Session scope the JucasBean will be kept during the user Session.
Contrary to Services, JucasBeans are never (and can not be used) in the application-scope. They are bound to one user. Therefore each user interaction will have its own set of JucasBeans. Because in one user Session there can only be one thread at a time (this is enforced by Jucas) JucasBeans don?t have to be synchronized.
In which scope the Bean is kept is defined by the Bean itself. The user who retrieves the JucasBean through the BeanManaget.getBean() method can give the JucasBean a hint in which scope the user wants the bean to be kept. The JucasBean defines where it wants to be kept by implementing the method JuasBean.getAllowedPageBeanScope(Scope userHint). The BeanManagers getBean() methods take an additional parameter where the retriever can give the hint. By default the hint is 'null', which just means that no hint is given.
There are three different services provided:
All three services are accessible through the class org.jucas.BeanHelper, which defines a large number of methods which provide the Services. An instance of this class will be set on the JucasBean when it is initialized by the BeanManager through the method IJucasBean.givenBeanHelperJucasOnly().
The individual Services are explained in the section on the services.