Overview of Workspace Setup

Overview of Workspace Setup

After you have the software requirements installed, below are the steps that you have to perform to setup your workspace for CM WebClient from scratch. Each step will be discussed in details when you click on the link.

Install WebClient Builder Plugin

Copy com.adcaustin.webclient. WebClientPlugin-1.8.x.jar to eclipse\dropins or plugins folder (Depends of the eclipse version)..

To confirm that WebClient Plugin builder is installed correctly.

Go to Help  About Eclipse → Click on Installation Details → Sort Plug-in Id column in ascending order.

Configure the default JRE

a. Create a default jre for your workspace

Window → Preferences → Java → Installed JREs →  Click on Add.. → Standard VM → Browse your java installation directory →  click finish →  Select the new jre you created and click apply and close


Note: Ensure the selected JRE Home is a full JDK and is of a version that will satisfy Apache Tomcat

Configure Apache Tomcat in Eclipse

a. Create a Tomcat installed runtime.

Window → Preferences → Server → Installed Runtimes/Runtime Environments → Click on Add... → Select Apache Tomcat vX under Apache → Click Next > → Browse to your Apache Tomcat installation directory.

Note : Select the version of Tomcat that best suits the version of Java you have.

b. Start Tomcat server.

Window → Show View → Servers → Right-click on the server window → Select New → Server → Select Apache → Tomcat vX server → Click Finish → Right-click on the server → Click Start.

C. If the server starts without any problem that means you don’t have any errors. So for now on stop the server to continue the installation

Create a New Java Project

Introduction

A Java project contains the generated Plex Java source code, resource files and generated web templates.

Instructions

a. File → New → Other... → Expand Java folder → Select Java Project → Click Next >

b. Enter your project name in the project name field → Select Use default JRE → click Finish. (Be sure what version of java you want to use)

Note: if you’re using java 9 or higher Eclipse will try to create a module-info, but you need to select Don’t create when the next message pop up


And in other version the message don’t pop up but before creating the java project there’s a new option that you need to unchecked


There are 2 ways to create the source Folders:

  1. Using Plexbuild Project
  2. Using Linked source Folder

Choose the one you’re more comfortable with.

  1. Import PlexBuild project

Introduction

PlexBuild is an Eclipse project that contains an Apache Ant script to move Plex Java source code into Eclipse for compilation. Ant allows Eclipse to create and run Ant buildfiles from the Eclipse workbench. On the classpath tab of the Ant Runtime preference page, additional classes defining tasks and types can be added to the Ant classpath.

Instructions

c. Create a new resource folder named PlexResource.

Right-click on your java project → Select New → Select Source Folder → Enter PlexResource as the folder name → Click Finish.

  1. File → Import... → Expand General folder → Select Existing Projects into Workspace → Click Next >
  2. If you have the project in a file directory, use Select root directory. If you have the project in a zip file format, use Select archive file. Browse to your directory and click Finish.

Setup PlexBuild Run Configuration

  1. Modify Ant classpath globally

    Window → Preferences → Expand Ant → Select Runtime → Open the Properties tab → Click Add Property...

  2. Create an ANT classpath for launch configuration.

    • Run → External Tools → External Tools Configuration... → Select Ant Build → Press the new button.

    • Name the new configuration PlexBuild. Set the Buildfile to ${workspace_loc:/PlexBuild/BuildConfig/build.xml} and Base Directory to ${workspace_loc:/PlexBuild/BuildConfig}


    • Click Apply to save.

    • Open the Refresh tab → Check on Refresh resources upon completion.


    • Click Apply to save.

    • Open the Build tab → Uncheck Build before launch.


    • Click Apply to save.

    • Open Targets tab → Check move Plex60Source and moveresources[default] as targets to execute.


    • Click Apply to save.

Configure build.properties File in PlexBuild project

  1. Expand PlexBuild project → Expand BuildConfig folder → Right-click on build.properties file and select open with Text Editor.

  2. Find the line plex.import.project_name=XXX. Edit the line so that plex.import.project_name=<your java project name>

  3. Find the line plex.gen.root=XXX. Edit the line so that plex.gen.root=<your gen
    directory>

    Note that forward slashes will be used instead of backward slashes.

  4. Save the file.

Generate your Plex functions. Do not build.

How to Run PlexBuild in Eclipse
  1. Go to Run → External Tools → External Tools Configuration...

  2. Click Run.
    You should see on your console that the functions are successfully built and moved to your project source folder.
  3. The next time you run PlexBuild, you can click on   icon shown below.

  1. Linked source Folder

The idea of this option is to use the same folders of the gen folder from your plex model. Instructions

  1. Right-click on your java project → Select Properties → Select Java build Path→ Select Source tab→ Click Link source...

    1. In the linked folder location you will put the path of your Gen Source folder location and the folder name you can put any name, (A descriptive name like “PlexSrc” would be better to identify is the Source folder.) then click Finish.

b. After creating the Src now you will need to create the res folder the same way you create the src folder. Now in the Linked folder location you will put the path to the of your Gen Source folder location. (Remember to put a descriptive name like “PlexRes”) Then click finish.

Note: The next time you generate a function, you need to make a refresh in your workspace by right-clicking in the project explorer. (Validate that you don’t have any project selected)


Import WebClient project

  1. File → Import... → Expand General folder → Select Existing Projects into Workspace → Click Next >

  2. If you have the project in an existing folder in your file system, use Select root directory. If you have the project in a zip file format (Most common), use Select archive file . Browse to your directory and click Finish.


Configure Java Project

  1. Right-click on your java project → Select Properties → Select Java Build Path → Open Libraries tab → Click Add Library...                                                                                   Note: If you’re using Java 9 or higher you need to add all your needed libraries or jar files in your classpath

  2. Select WebClient Component → Click Next > → Check WebClient → Click Finish

  3. Import obclient.properties to your java project souce folder \src folder.
    File → Import → Expand General folder → Select File System → Click Next > → Browse to ObJava directory under CA Plex folder and select obclient.properties → Click Finish.
    If you have tab functions, you also need to add pvAll.jar in your java project build path.

  4. Right-click on your java project → Select Properties → Select Java Build Path → Open Libraries tab → Click Add External JARs... → Browse to CA Plex browse to C:\Documents and Settings\All Users\Documents\CA\Plex\ver\classver\PatternLibs\ACTIVE\Beans for Plex ver

  5. Click Finish.


Configure obclient.properties

Note: CM WebClient date and time format works based on browser locale instead of obclient.properties date and time format.

  1. Open obclient.properties with Text Editor.
    Right-click on obclient.properties → Select Open With → Select Text Editor.

    The file is configured differently depending on what driver and data source you are using. It determines which database and port to connect to. The example below is using SUN JDBC driver.


    Environment.Default.Driver=sun.jdbc.odbc.JdbcOdbcDriver Environment.Default.DataSource=jdbc:odbc:WebClient                                  Environment.Default.User=username                                Environment.Default.Password=password

  2. Save changes.

Generate WebClient Templates

  1. Right-click on your java project → Select WebClient → Enable Template Builder.
    WebGenTemplates folder will be automatically created under your java project. You will be prompted to enter your genlicense.lic. Click on Use Trial or enter your license file and click Finish.

    If you have the build automatically on, the console should display “Generating Web templates” with no error message.
    If you don’t have it on you need to click on Project → click Build automatically and now you have set it on


  2. You should have WebGenTemplates folder created under your java project.

Note: If you’are using plexbuild and there is no web template generated, check if there is a PlexResource folder was created. If there is, make sure PlexResource is a source folder and there are .panelresource and .resource files associated to the function name.

Create a New Dynamic Web Project

Introduction

A Dynamic Web Project contains JSP (Java Server Pages) files, HTML files, servlets, and Plex runtime JAR files. The web project is then deployed on Apache Tomcat to be viewed on a browser. To avoid any unexpected issue, we recommend that a new server is created in the workspace before creating a new web project.

Instructions

  1. File → New → Other... → Expand Web folder → Select Dynamic Web Project → click Next >

  2. Enter your web project name in the project name field → Select target runtime server → Dynamic web module version should be set to 2.4 → Click Finish.



    Expand your web project/WebContent/WEB-INF folder to make sure that there is web.xml file created.

Note: According on what eclipse version you have, the structure of the web project wiil be different, on this new structure the web.xml is located in src/main/webapp/ WEB-INF

Configure Build Path for the New Web Project

a. Right-click on your web project → Select Properties → Select Java Build Path
→ Open Libraries tab → Click Add Library…
b. Select WebClient Component → Click Next > → Check WebClient → Click 
Finish.



c. Select Deployment Assembly on Properties window → Click Add… → SelectProject → Click Next > → Select your java project → Click Finish.

If you have any additional jar files that are required for deployment, you need to addthem in Deployment Assembly.



Create a New Servlet in Web Project

Introduction

WebClientServlet is a method of deploying the CM WebClient architecture. It consists of a servlet, called WebClientServlet, which launches your WebClient Plex application within a servlet container, and a configuration file, called WebClient.properties, which contains settings for the servlet.

In this mode, a single Plex function is the top-level component of your web application, known as the entry point. Consequentially, WebClientServlet is not suitable when you wish to launch a Plex function as a Business Process in Websydian Express. If you are using Websydian Express, see chapters Deploying CM WebClient with Websydian Express for Java.

Instructions

  1. Right-click on your web project → Select New → Servlet → Check “Use an existing Servlet class or JSP” → Select WebClientServlet → Click OK.
  2. Note: If WebClientServlet is not showing up on your servlet list, add WebClient project in the Deployment Assembly under your web project.Right-click on your web project → select Properties → select Deployment Assembly → Click Add... button → select Project → select WebClient project → click Finish.

For WebClient multi session servlet implementation, select WebClientMultiSessionServlet.


  1. Click Finish in Create Servlet window.

Create a New Listener in WebClient Servlet

Instructions

  1. Right-click on your web project → Select New → Listener → Check “Use existing listener class” → Select WebSessionListener → Click OK.
  2. Click Finish in Create Listener window.

Add Plex Images to the Web Project

  1. Create an images folder under WebProject/WebContent folder. (Remember that in some eclipse version the structure of the project is different, the images folder will be located in src/main/webapp )

  2. Copy/Import all images files in the images folder.
    Note: Keep in mind that CM WebClient is case-sensitive. Make sure that your Plex panel properties and your image filename is a match.

Note: Keep in mind that CM WebClient is case-sensitive. Make sure that your Plex panel properties and your image filename is a match.

Add web project to tomcat server

1.Right-click on your tomcat server in the server tab → Select Add and remove.


2. Select yout Web project and press ****the add button → Select Finish.
3. Right-click on your tomcat server in the server tab → Select Publish.

Configure the webclient properties

Before running the tomcat server you need to configure the webclient properties.

You need to put the Webclient.properties in the src folder of your Dynamic Web Project. (In some version will look like src/main/java but it won’t affect and will still working) Then you need to change the properties parameters as follows:

Essential Configuration options:

You will need to have at least these properties defined in your file for everything to work correctly.

**webclient.entry : <packagename>.<Plex function implementation name>.**The entry point to the Web Application; i.e., the initial function to be called when a new session is created. Specify the full name of the class including package names.For example:webclient.entry=WXPCOURSE60.WXuF

Define.WSACTION :/<DynamicWebProject>/<ServletName>. URL reference for servlet.For example:Define.WSACTION=/myWebProject/WebClientServlet

resurl.plex.imageresourcesURL reference for where the image resources as referenced by Plex are kept. This URL should contain a folder named images.For example:resurl.plex.imageresources=/myWebProjectt

log4j.logger.com.adcaustin.WebClient :

The granularity of the log messages. Legal values are: DEBUG, INFO,

WARN, ERROR, FATAL. DEBUG should only be used when

debugging and in test environments. In a production environment use

WARN or ERROR.

For example:

log4j.logger.com.adcaustin.WebClient=INFO, WebClientServlet

log4j.appender. WebClientServlet.filespecifies the path and the name of the log file.For example:log4j.appender.WebClientServlet.file=C:/WebClient.log

Other configuration options

There others properties that you have here, but these are optional, so just add them if you really need them.

licensingserver.tcpportThe TCP port on which licensing server listens. Only uncomment this property if you have WebClient licensing server installed. The default port is 65000.For example:licensingserver.tcpport=65000

licensingserver.licensefileIf there is no valid license file, this property must be commented. CM WebClient will automatically activate 10-user developer license. If there is a license file, then specifies the complete file system path to the license file(license.lic)For example:licensingserver.licensefile=C\\:/Program Files\\WebClient/license.lic

webclient.entry.timeoutThe entry point that is called if a session has timed out on the server and the user attempts to resume the session.For example:webclient.entry.timeout=WXPCOURSE60.sesstimeout

**webclient.entry.url.<path>*The entry point that is associated with a specific url. The url is determined by taking the components after the word "url", and changing dots to forward slashes (/). For example:webclient.entry.url.pub.item=com.foo.bar causes the relative url /pub/item to launch the function com.foo.bar.Wildcards are allowed and are specified with an asterisk(). For example:webclient.entry.url.api.=com.foo.api. causes the relative url /api/myfunc to launch the function com.foo.api.myfunc.In both cases, the url specified is relative to the url-pattern in the servlet-mapping of the servlet in the web.xml file. The url-pattern must end with "/" in order for this to work. For example, if the url-pattern is /webclient/, then the url mappings above will be relative to /webclient(e.g., /webclient/pub/item and /webclient/api/myfunc)

servlet.errorpage.urlspecifies a relative URL to an error page within the context of the WAR file where the servlet is deployed. On errors the servlet will then call this error page which then is responsible of generating a response to the user. The error page have to be placed within the scope of theWAR-file where / (slash) indicates the root of the WAR-file.For example:servlet.errorpage.url=/myWebProject/error.jsp

Define.WCTHEMESet WebClient theme to either claro or tundra. This property is optional. If it is not set, the default value is set to tundra.For example:Define.WCTHEME=claro

servlet.statistics.levelSet this option to cause the servlet to gather some runtime statistics on called functions. This feature only works when calling AS/400 functions. The valid levels are as follows: 1 = Collect data on called functions grouped by function type and function name. The number of times each function is called as well as its inclusive run time. After each request, a report is logged to the servlet log at the INFO log level.For example:servlet.statistics.level=1

  1. After finishing all the necessary configuration you need to Save changes.
  2. Republish your web server.

Run WebClient in Eclipse

    1. After it is finished publishing → select Start.
    2. Open your browser and go to http://localhost:<PortNumber>/<contextroot>/<servletname>

    To find your context root, right-click on your web project → select Properties → Select Web Project Settings. (Normally is the same name that you used to create the Dynamic Web project )

    To find your servlet name, expand your web project → expand WebContent folder → expand WEB-INF folder → open your web.xml with Text Editor


Note: According on what eclipse version you have, the structure of the web project wiil be different, on this new structure the web.xml is located in src/main/webapp/ WEB-INF

To find or change the tomcat port just double-click the server runtime and change the HTTP/1.1 Port number








    • Related Articles

    • Incident Reporter Setup

      Download Workshop Materials Workspace Setup The workspace is already configured, but you will need Eclipse with the Android SDK installed.  To do this, please follow the instructions listed here:  developer.android.com/sdk Database setup We are using ...
    • Incident Reporter Setup

      Download Workshop Materials Workspace Setup The workspace is already configured, but you will need Eclipse with the Android SDK installed.  To do this, please follow the instructions listed here:  developer.android.com/sdk Database setup We are using ...
    • Dashboard Overview

      This document will cover the basics of the CM evolveIT Dashboard. There will be a review of the different parts of the dashboard, how to customize the dashboard for personal viewing.   After completing this document, you should have a basic ...
    • CM evolveIT ETL - Workspace Creation Wizard

      1. Open Workspace Creation wizard 2. Workspace Name and Product Mode By clicking on "Create a new Workspace" button, it should be shown a dialog. Enter name (1) and select a Product Mode(2), then move to the next step (3) 3. List Project Models Each ...
    • CM WebClient File Upload Setup

      File Upload This guide will show you how to upload files to your Web Server from your WebClient application. 1. Import the attached zip Java Project into your Eclipse Workspace. 2. Right click your Java Project, and select Properties. Under “Java ...