Our Java web applications consist of several components. By means of the Spring Framework these components can be easily exchanged and adapted. CMS Fiona includes several components, for example for the following tasks:
Each of these components is a so-called bean. The combination of beans to be used in the web application can be specified by means of one or several XML files. As a result, the available functions and the behavior of the application can be modified by adapting the configuration files accordingly. This also allows for integrating custom components.
Every bean is based on a Java class. If a bean is used, the Spring Framework creates an object of the corresponding class. A bean can be integrated as follows:
<bean id="sessionInvalidator" class="com.infopark.pm.DefaultSessionInvalidator"/>
An optional id
makes it possible to refer to the same bean in different locations.
If a bean has properties that need to be adapted to the installation environment, you can set their values in the following way:
<bean id="httpHelper" class="com.infopark.libs.http.ApacheHttpHelper"> <property name="connectionTimeout" value="3"/> <property name="defaultSocketTimeout" value="60"/> <property name="maxConnections" value="10"/> </bean>
A bean can access the functionality of another bean. The
permissionManager
bean, for example, requires access to content.
For being flexible when choosing the bean that supplies the content, the
permissionManager
bean has the documentSource
property. To this property the bean to be used can be assigned as a
reference. In the following example, the externalDocumentSource
bean is integrated for providing content. Then, the
permissionManager
bean is included and configured to access the
content via the externalDocumentSource
bean. To the properties
permissionReader
and permissionResolver
beans are
assigned as well. Since the respective bean is only used here, it is
integrated directly in the property, i.e. without using an
id
.
<bean id="externalDocumentSource" class="com.infopark.pm.doc.FileDocumentSource"> <property name="documentRoot" value="/opt/infopark/fiona/instance/default/export/online/docs"/> <property name="inputEncoding" value="UTF-8"/> </bean> <bean id="permissionManager" class="com.infopark.pm.doc.DocumentPermissionManager"> <property name="documentSource" ref="externalDocumentSource"/> <property name="permissionReader"> <bean class="com.infopark.pm.FionaPermissionReader"/> </property> <property name="permissionResolver"> <bean class="com.infopark.pm.FionaPermissionResolver"/> </property> </bean>
The properties of a bean are determined by its class. To be able to set
the value of a property, the class needs to have a public method. The name of
this method is composed of the string set
followed by the name of
the property. Exactly one argument is passed to this method, namely the value of the property.
In the example above, the setDocumentSource()
method
of the com.infopark.pm.doc.DocumentPermissionManager
class is
called. For the list of the public methods of the Java classes included in
CMS Fiona, please refer to the API documentation located in the
share/doc/javadoc/pm
directory in the installation directory of
the CMS.
Configuration errors have the effect that the web application concerned
can no longer be
deployed.
Please refer to the log file of the web application for details about the
error that occurred. Errors like this always raise a
BeanDefinitionStoreException
. Typical reasons for this error
include:
Line ... in XML document ... is invalid
The configuration file contains invalid XML. Check the file for syntactical correctness.
Bean class [ClassName] not found
The Java class ClassName
specified as the bean's
class
is unknown. The class name might have been misspelled,
or the class can neither be found in the WEB-INF/classes
directory nor as a jar archive in the web application's
WEB-INF/lib
directory.
Error setting property values
The value of the property could not be set. If the name has not been
misspelled, the method might not be (public
) or the value does not
suit the method's argument type.
Could not instantiate class [ClassName]
The specified Java class, ClassName
was found. However, an
object could not be created. A subclass of this class may be needed instead.