Setting up the Development Environment

From Globalsight
Revision as of 09:24, 2 January 2014 by Techwriter (talk) (Encoding)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Developers
Go to: Getting Started Guide
Footer-logo.gif
System requirements

Installing GlobalSight
3rd party comps: Windows | Ubuntu
GlobalSight: Windows | Ubuntu
Desktop Icon

Setting up GlobalSight
Running GlobalSight Behind an Apache Reverse Proxy

Developing GlobalSight
GlobalSight Architecture
Getting the Code
Building and Deploying GlobalSight
GlobalSight Developer’s Guide
Setting up the Development Environment
Debugging GlobalSight
Designing the GlobalSight Adapters
GlobalSight Web Services API
Using the GlobalSight Web Services API Test Tool
Using the GlobalSight CVS Connector
Connecting to a CVS with the GlobalSight Desktop Icon

Upgrading GlobalSight
Comparing GlobalSight with WorldServer

Developers can create their own development environment by downloading the source code to build and set up a project.

System requirements

Before programming, make sure that the following software has been installed. For system requirements in general, see System requirements.

Getting the source code

  1. Download the source code for the GlobalSight system from GlobalSight.com. For more details on downloading the software, see Installing GlobalSight.
  2. Unzip or un-package the code into a new directory, for example GlobalSight7.1.

In this root directory, main6/envoy means GlobalSight7.1/main6/envoy and so on for other default paths.

When you have downloaded the code successfully, the package structure is as follows:

File structure after download

Building a project

Before setting up a project or development, you need to build a project once since the javacc command generates other special source code needed.

  1. Open a command window
  2. Forward to the HOME/main6/tools/build/ folder
  3. Execute the following ant script:
    Setup2.jpg

The dist target compiles the whole project. It also deploys it as a zip file in the dist sub-folder in the build folder. For more details on building, see Building and Deploying GlobalSight.

Setting up a project

To set up a project, you need to know:

  • Source folders:
    • main6/diplomat/dev/src/java/*
    • main6/envoy/src/java/*
    • main6/ling/ You only need the com/* sub-folder
  • Source code encoding: ISO-8859-1. This is needed when compiling codes
  • Library files: make sure that all library files necessary have been added to the class path before development
    • most files are in the main6/tools/lib/ directory
    • each source folder has its own library folder
    • the container library for JBoss is in the main6/tools/j2eeVendor/jboss folder

Eclipse is used as an example to demonstrate how to set up a project in it. Download version 3.2.x or later of Eclipse from Eclipse.org.

Creating a project

  1. Open the Eclipse environment
  2. Select File->New->Java Project

Importing the source code

  1. Enter a project name, such as GlobalSight
  2. Select Create project from existing source in Contents under the project name
  3. Click Browse
  4. Forward to the root folder of the source code, HOME
  5. Click Next to import the source code into Eclipse

Do NOT click Finish. Some default settings are still modified later.

New Java project

Removing all default source folders

The default settings of the GlobalSight appear in Eclipse, as shown below. This can take a few seconds or even minutes.

  1. Select all of the default source folders. This is basically everything except the last folder, main6
  2. Click the Remove from Java build path link to remove them from the source folder list
Removing all default source folders

When all folders have been removed successfully, only the main6 folder remains.

All default source folders have been removed

Adding real source folders

Add the real source folders needed in the system:

  • main6/diplomat/dev/src/java
  • main6/envoy/src/java
  • main6/ling

Using the first folder as an example:

  1. Select the main6/diplomat/dev/src/java folder
  2. Click Add folder 'java' to build path link to add it as source folder
Adding source folders

When you have added all source folders successfully, you see the following:

Adding all source folders

Improving the project environment

You have now almost built a new project using the system source code. Add the following more detailed settings to improve the project environment.

Filtering files from the source folder

Filtering unnecessary files from the source folder reduces the load on the system memory and speeds up the Eclipse environment.

Using the main6/ling folder as an example:

  1. Select the source folder
  2. Click the Configure inclusion and exclusion filters link
Configuring the source folder

The configuration window for Inclusion and Exclusion shows.

  1. Click Add Multiple ... in the Exclusion pattern frame
  2. Select the sub-folders and files except the com folder
  3. Click OK in Selection
  4. Click Finish in Inclusion and Exclusion Patterns
Add filters for ling folder

After this, you can see there are more description sentence after source folder “main6/ling”, such as “6 items excluded”.

Other files that you can also exclude from the source folder:

  • main6/envoy/src/java/com/globalsight/resources/**
  • main6/ling/com/globalsight/resources/

Modifying the default output folder

To make it easier to find or use the classes files, you can change the default output folder that shows at the bottom of the project window to something more familiar. For example, you can change from GlobalSight/main6/tools/build/cxeclasses to GlobalSight/main6/bin, or whatever you want.

Encoding

You can now click Finish to complete the creation process.

If you have changed the output folder directory, a window may pop up asking you to copy files from the original directory to the new one. Click Yes, and a new project is created successfully.

Eclipse also performs some tasks after creation.

For any future errors when compiling, edit the file encoding of the project as follows:

  1. Right-click the project name
  2. Select Properties from bottom of the pop-up menu
  3. Click Resource in the menu on the left. This is often default
  4. Change the Text file encoding to ISO-8859-1