ComponentsAs stated in the introduction components handle the Model and Controler part of the web-application. There are two types of components. JucasBeans which represent the web-app for one user and Services which provide the common part between users. The two types are very different (see the table) but they have a few things in common: Both types of components are retrieved from the org.jucas.BeanManager by their name. The BeanManager is the component-manager used by Jucas. The name of both components is an URI. The scheme is 'jucas' for JucasBeans and 'service' for Services. The host denotes the type of the component. For Services it is the HiveMind id as defined in the modules which specify the services for JucasBeans the host denotes the full qualified class name. The (optional) path and query are only used for JucasBeans. For these they denote the instance. The (optional) fragment is a org.apache.BeanUtils properties-path, which is evaluated on the component. Both JucasBeans and Services may implement the org.jucas.Peer interface. The Peer interface indicates that on the implementing class through the request-parameters properties can be set and methods can be called. Differences between JucasBeans and Services
The org.jucas.BeanManagerThe BeanManager is the component-manager used by Jucas. An instance of the BeanManager can be gotten in three different ways:
For each request there is a BeanManager therefore the BeanManager may never be stored in a field-variable, in Session, Request or Application scope. Each time a BeanManager is needed it should be retrieved as described and must than be released. The BeanManager provides the following three functionalities:
Services are not managed directly by the BeanManager but rather by a HiveRegistry (the one gotten through BeanManager.getHiveRegistry()). However they can be retrieved from the BeanManager (which delegates further to the Registry). The BeanManager provides retrieving of Components by their nameEach Jucas component has a unique name, which is a java.net.URI. The name both identifies the component and defines how the component is loaded. Through the method BeanManager.getBean(uri) the bean can be retrieved. If the bean is not loaded yet the BeanManager will load it automatically. 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. The scheme of the URI of a JucasBean is 'jucas'. The host of the URI denotes either the full qulified class name of the JucasBean or for xml-defined JucasBeans the file location. To resolve the file forr the xml-defined Jucas Beans 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 on the JucasBean. The name of a Service component has the scheme 'service', the host denotes the HiveMind id the path and query are ignored and the fragment is interpreted as a BeanUtils path. For services the BeanManager just takes the host and retrieves the Service from the HiveMind-Registry. If a fragment is given it evaluates it on the Bean. |