This topic contains some tips for working with Portlet Factory and a source control system. The tips provided here are not specific to any particular source control system, and should be adaptable to whatever source control system you prefer.
Points covered in this topic include:
Organizing your project assets
- Organizing your project assets
- Using source control
- Creating a project from source controlled files
Wherever possible, create folders in the appropriate locations within the project to hold all the assets that you create. This makes it easy to keep HTML files, models, schemas, etc. that you create separate from assets that are part of Portlet Factory. It is worthwhile to invest a bit of thought at the beginning of the project, and gain some some agreement among team members about where assets will be created and how they will be named.
Wherever possible, create folders to isolate the files that you create from the files that are part of Portlet Factory. This will make is easier to identify your project assets for placing them under source control.
Here are a few examples of places where you should create your own folders or properties files:
- create a single folder under WebContent/WEB-INF/models for all models associated with your project or team. Create additional folders under this for further classification of your models. Consider creating 'packages' for your models in the same way that you would create packages for Java code that you create. Perhaps divide by functionality, or by section of the application.
- create a /WebContent/WEB-INF/config/override.properties file and use this file to set/override any Portlet Factory properties that you need to modify from the default settings. This will protect your property settings from getting overwritten when you create a new project or upgrade to a new version of Portlet Factory.
- create and name your own copies of any configuration properties files that you use for access to back-end systems such as Domino or SAP.
Use similar naming conventions and folder arrangements for models and their associated HTML files, Java classes, etc. This will make it easy for all project members to tell which files are related. For example, let's say I'm a developer for Acme Corp. and I'm building a self service HR application for employees and managers. I might have a portlet for requesting vacation leave. Here is an example of how I might arrange assets associated with this model in my project:
request_vacation_form.html - base page for the request form
request_vacation_confirm.html - base page for the request confirmation
request_vacation.xml - data definition for request_vacation form
request_vacation.model - model for the Request vacation portlet
vacation_provider.model - service provider model for vacation-related operations
request_vacation.java - Java class used as LJO for request_vacation.model
Using source control
Use source control to check in only those project files that you create. If you have done a good job of keeping your project assets separate from Portlet Factory files, it will be easy to identify the files that you want to check in to source control.
The folder structure in source control should be a sparse representation of the folder structure within the project, containing only those files and folders that contain your assets. Create a folder that will be a placeholder for the project root. Under this placeholder, project root should be the WebContent folder, and under that all your project assets that you want to place under source control.
It is usually not recommended to check in the .project and .classpath files for a project. Forcing all team members to use a single copy of these files limits the flexibility for all team members to be able to create projects in the manner that suits their needs.
Creating a project from source controlled files
To create a Portlet Factory project that includes assets from source control:
- create an image of the source-controlled files in your file system. For example, if you are using ClearCase, create a snapshot view that contains all the project files, starting with the placeholder project root folder.
- in Eclipse or RAD, create a Portlet Factory project. On the first page of the New Project wizard, name your project, and UNcheck the box for "Use default location". For the project location, select the project root placeholder folder. All the Portlet Factory project files will be added to the sparse tree from your source control system to complete your Portlet Factory project.