Examples
Below are some examples presented in specific scenarios.
Creating a component
Consider the creation of a component br.com.lumis.intranet
. Note that, in this case, the component is located in br/com/lumis/intranet
, and consequently, its definition file is br/com/lumis/intranet/componentdefinition.xml
. This component will contain:
- two services:
- br.com.lumis.service.service1: located in the folder br/com/lumis/intranet/services/service1.
- lumis.service.service2: located in the folder br/com/lumis/intranet/services/service2.
- one theme:
- br.com.lumis.intranet.theme.theme1: located in the folder br/com/lumis/intranet/theme/theme1.
- public files:
- br/com/lumis/intranet/componentfiles/www/js/jquery.js
- br/com/lumis/intranet/componentfiles/www/img/img_arrow_left.png
- br/com/lumis/intranet/componentfiles/www/css/main.css
- structure:
- br/com/lumis/intranet/componentfiles/structure/
Services can be in any folder inside the component folder, as their identifier is defined in their definition file.
The themes, in turn, must be located in their specific folder, as their identifier is inferred from this folder. See more in Portal Themes.
Public files can be in any folder inside the www folder belonging to the component's folder.
The structure files must be inside the structure folder within the component's folder.
The definition file must be developed accordingly, including its version. For illustration, let’s assume this version is "1.0.0.0".
If needed, install, upgrade, and uninstall scripts can be added to the component, within the scripts folder.
After developing the component definition, its scripts (if any), and the component objects, the component folder can be packaged into a module for deployment in an environment.
Updating a component
Suppose the previously created component needs to be updated for some reason. The developer makes the necessary changes to the services, themes, etc. The component must have its version updated, let’s say to "1.1.0.0". The necessary changes to the component's scripts must be made.
The component is ready to be packaged into a module for deployment.
When deployed in an environment that already has version "1.0.0.0", it will be updated to "1.1.0.0". When deployed in an environment that does not have the component installed, it will be installed.
Renaming a component
If a component needs to be renamed, the instruction for component substitution in its definition file must be followed. In other words, renaming the component is the same as creating a component that replaces another component. For example, assume that the component br.com.empresa.service.news is renamed to br.com.empresa.projeto1.service.news.
Splitting a component into several
Now suppose the component br.com.lumis.intranet will be split into br.com.lumis.intranet.rj and br.com.lumis.intranet.sp. This split requires that a component substitution of br.com.lumis.intranet by the component br.com.lumis.intranet.rj and another substitution of the component br.com.lumis.intranet by the component br.com.lumis.intranet.sp be performed.
In other words, it must be declared in the definition of the component br.com.lumis.intranet.rj that it replaces the component br.com.lumis.intranet and, also, it must be declared in the component br.com.lumis.intranet.sp that it replaces the component br.com.lumis.intranet.
However, this is not enough. In this case, both components br.com.lumis.intranet.rj and br.com.lumis.intranet.sp must be installed at the same time, so that both replace the component br.com.lumis.intranet and, after this installation, both are maintained as distinct components. In this case, the component br.com.lumis.intranet.rj must declare that it replaces the component br.com.lumis.intranet together with the component br.com.lumis.intranet.sp, and the component br.com.lumis.intranet.sp must declare that it replaces the component br.com.lumis.intranet together with the component br.com.lumis.intranet.rj. Once this is done, the components br.com.lumis.intranet.rj and br.com.lumis.intranet.sp will only be deployed together if the component br.com.lumis.intranet has already been deployed beforehand. If the component br.com.lumis.intranet has not yet been deployed, the components br.com.lumis.intranet.rj and br.com.lumis.intranet.sp can be deployed separately.
Joining several components into one
Suppose the components br.com.lumis.intranet.rj and br.com.lumis.intranet.sp need to be combined into a single component br.com.lumis.intranet. This operation requires that the component br.com.lumis.intranet replace the components br.com.lumis.intranet.rj and br.com.lumis.intranet.sp.