Creating Java Projects for Agentry Java API Development

Prerequisites
Before creating a Java project in Eclipse for use with Agentry Java API development work, the following items must be addressed:
  • The SAP Mobile SDK installer must have been successfully run on the same system as the Eclipse and Agentry Editor plug-in have been installed; or, to a system that is accessible from this system.
  • All Java resources needed for the development work should be accessible and available to the Eclipse platform host system. This can include jar files as well as other code and documentation (i.e. Javadoc archives) resources that may be needed for the development work.
  • SAP Java Connector (SAP JCo) version 2.1.8, or any later 2.x version, is required for development and runtime environments in which the Agentry SAP Framework Foundation is used. JCo version 3.0 or later is not supported at this time.
  • Many mobile applications that make use of the Java Virtual Machine system connection type include multiple layers of Java code libraries that reside logically between the Agentry Java API and the logic for the specific mobile application. In such situations these other libraries must exist in a location that is always available to the Eclipse platform.
  • Determine the proper version of the JRE to be used for the Java development portion of the application. The Ganymede release of Eclipse requires the JRE version 1.6. The development project may need a different version of the JRE based on the requirements of the back end system with which synchronization will occur through the Java system connection. A part of creating the Java project in Eclipse is the optional designation of the specific JRE version to use.
  • The Java Perspective should be open in Eclipse. Note that by default this perspective is always open, though it can be closed at any time. To reopen this perspective, select the Windows | Open Perspective | Other... menu item in Eclipse. Select the Java (default) perspective in the list shown.
Task

This procedure provides the basic steps of creating a Java project to contain the development work performed with the Agentry Java API. When this procedure is complete a Java project will exist in the current Eclipse workspace that will include the resources needed for performing development work related to the Java Virtual Machine system connection type. This project will include:

  • The Agentry Java API jar file as installed by the SAP Mobile SDK.
  • A source folder location for Java logic created for the mobile application.
  • Any other resources that may be needed for the project (e.g. sapjco.jar).
This procedure is not intended to be a comprehensive discussion on Java projects created in the Java Perspective in Eclipse, nor is it a discussion intended for the novice Java developer. A level of understanding and knowledge is assumed on the part of the reader related to these topics. Full information on the JDT project, which includes the Java Perspective, can be found at the Eclipse help site:
http://help.eclipse.org/documentation

At the above link see the documentation matching the Eclipse version you installed for the Agentry Editor plug-in.

  1. Start the Java Project Wizard in Eclipse using one of the following methods:
    • Select the menu item File | New | Java Project.
    • Right click in the Package Explorer View in the Java Perspective and select the pop-up menu item New | Java Project.
    • Right click in the Project Explorer View provided with the Eclipse Platform and select the popup menu item New | Project. In the screen displayed, select the tree control item Java | Java Project.

    Any one of these actions will display the New Java Project wizard.

  2. In this first wizard screen, begin by giving the project a name. This will be the identifier for the Java project in the Eclipse Project and Package Explorer views. Then:
    1. Select the Use Default Location checkbox to store the project resources within the default location within the current Eclipse workspace; alternately, deselect this box to specify a different location if needed.
    2. In the JRE section specify the JRE version for the Java development project. This selection must match the needs of the back end system for which the mobile application development work will be performed. This need not be the same JRE version as Eclipse uses for its own execution. The version of the JRE to be used must be installed prior to making this selection. The third option is to select a Java execution environment.
    3. The Project Layout specifies the location of the source and built class files for the Java project. The default is the separate locations for source and output files. The default folders are src and bin, respectively, which will reside as sub-folders to the project folder in the Eclipse workspace. These locations can be modified by clicking the Configure default hyperlink in this section.
    4. The new project can be added to a Working Set. If unfamiliar with working sets in Eclipse, see the help topic “Working Sets” in the Eclipse publication Workbench User Guide.
  3. Once these options are set, click the [Next >] button to proceed.

    The next screen of the New Java Project wizard is displayed. This screen contains multiple tabs for further configuration of the new Java project’s build settings, including source file location, included projects, libraries, and the build order and export.

  4. Set the Source options as needed for the given project. Options here include selecting additional source folders outside the workspace, adding new folders to the project within the workspace that will be used as source folders, and other source file-related tasks.
  5. Select the Projects path to set other projects to be included on the build path for the current project. This project must reside in the same workspace as the new project being created. Once added, options exist to select the files or sources within the project to be used. The build order for the project selected here is set in the Order and Export tab.
  6. Select the Libraries tab. Here is where the libraries related to the Agentry Java API, as well as other libraries needed by the back end are selected and included in the project. this can also include the SAP JCo jar file, if applicable to your implementation and development work. To add libraries to the project’s build path, begin by clicking the button to the right to add the type of library needed. For the Agentry Java API, click the Add External JARs... button. Navigate to the location of this Jar file, as provided by the SAP Mobile SDK installer. Once added, you can expand the new node for this jar file and add the Javadoc source for the Agentry Java API. This is a ZIP archive named Agentry-v5-doc.zip.
  7. Once the libraries have been added, select the Order and Export tab. Here the build order is specified for the libraries and external projects for the new Java project. The specific build order is completely dependent on the project being created. However, the JRE System Library will likely always be first. Within this order, the Agentry Java API library should be ordered before any libraries or projects that extend the Agentry classes or interfaces. Also, it is likely any resources from the back end system should be ordered before the mobile application-specific items, which may include “application suite” libraries, as it is likely these too will extend or access these items. Once the build order is set, click the [Finish] button to create the new Java project.

A new Java project will be created in the current Eclipse workspace. This project will now be accessible to the Agentry application project. When defining Java steps, or complex table or data table Java synchronization components, it will be possible to select items contained in the Agentry Java API, as well as those in the other libraries and projects for the Java project.

Next

Changes to the project’s configuration can be made by selecting the project in the Project Explorer or Package Explorer and selecting the Properties menu item.