Introduction

Creating an Adapter Module for PI takes a bit of an effort as we have to create the EJB and EAR projects in NWDS and set up all the necessary build paths and deployment descriptor files.

As I start to use EGit/Git to manage my NWDS projects, I’ve come to find different ways it can enhance my workflows. One such area is in setting up template EJB & EAR projects for custom adapter module. There is already other approaches like the blog below is using templates for adapter module projects.

Simple Steps to build an Adapter Module using EJB,EAR template

The benefit of using EGit is that the projects will be automatically version-managed by Git once the template is cloned into NWDS.

Below are the steps on how to quickly set up an adapter module project using template content from GitHub.

Prerequisite

The steps below are based on NWDS 7.31. EGit needs to be installed and configured first as detailed in Installation and Initial Configuration sections of the following blog.

Using EGit for Java source code management in NWDS

Steps

Step 1 – Clone Git repository from GitHub to NWDS

Go to the Git repository via the link below, and select Copy to clipboard.

engswee/pi-module-template · GitHub

/wp-content/uploads/2016/01/git_copy_865836.png

In NWDS, switch to Git perspective – Window > Open Perspective > Other > Git Repository Exploring

Click the Clone Git Repository button

/wp-content/uploads/2016/01/clone_865837.png

A window will pop up with pre-populated value of the GitHub URL details. Accept the default value and click Next.

/wp-content/uploads/2016/01/clone1_865931.png

It will load the GitHub branch details. Click Next again.

/wp-content/uploads/2016/01/clone2_865933.png

Finally, it will prompt for a destination of the local Git repository. Browse to the appropriate folder and select Finish.

/wp-content/uploads/2016/01/clone3_865934.png

The contents will be downloaded from GitHub to the local Git repository. The screenshot below shows the new (arbitrarily named) Git repository new-module.

/wp-content/uploads/2016/01/git_repo_865935.png

Step 2 – Import EJB and EAR projects

The contents in the Git repository already consists of the template EJB and EAR projects for a custom adapter module. This content will need to be imported into NWDS’s project explorer.

Right click on the Git repository and select Import Projects.

/wp-content/uploads/2016/01/import_865940.png

Select Import existing projects and click Next.

/wp-content/uploads/2016/01/import1_865942.png

Select both EJB and EAR projects and click Finish.

/wp-content/uploads/2016/01/import2_865943.png

After import has completed. Switch to the Java EE perspective and both the EJB and EAR projects will be listed in the Project Explorer.

/wp-content/uploads/2016/01/project_865944.png

Step 3 – Refactor project contents

Now just refactor the project contents according to the development naming conventions and requirements.

Rename EAR project.

/wp-content/uploads/2016/01/refactor_ear_865946.png

Update provider name in application-j2ee-engine.xml in EAR project.

/wp-content/uploads/2016/01/refactor_vendor_865950.png

Rename EJB project.

/wp-content/uploads/2016/01/refactor_ejb_865948.png

Rename package in EJB project.

/wp-content/uploads/2016/01/refactor_package_865949.png

Rename EJB 3.0 Session Bean.

/wp-content/uploads/2016/01/refactor_bean_865951.png

Rename ejb-j2ee-engine.xml deployment descriptor. Ensure that this matches the name of the session bean above.

/wp-content/uploads/2016/01/refactor_j2ee_865952.png

Rename ejb-jar.xml deployment descriptor. Ensure that the name and package path matches above changes.

/wp-content/uploads/2016/01/refactor_jar_865954.png

Step 4 – Commit initial content to Git (Optional)

Once all the changes have been done, optionally commit an initial version to the Git repository.

/wp-content/uploads/2016/01/commit1_865977.png

With this, the EJB and EAR projects are now ready for further development according to project requirements.

Conclusion

With this simple and easy steps, we can quickly establish a new custom adapter module project and dive right into the design and development details. We no longer need to remember the details of setting up the project configuration correctly, which can be quite repetitive (which I also find hard to remember at times with so many screens involved).

Once the Git repository is cloned, with just a few refactoring steps, the project is ready for development. Additionally, it benefits from already being tracked by Git.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Ryan Crosby

    Nice blog on the deployment… I saw it from a forum post and it gives good direction on all the steps for those that have not done it before.  Even a nice refresher for someone that doesn’t want to thumb through the 40-45 page guides that are available elsewhere.

    (0) 
    1. Eng Swee Yeoh Post author

      Thanks for the comment. Yeah, for someone who is quite absent-minded as I am, I had to keep on referring to the bulky guides each time I wanted to build a module. Now I can get it up and running in a jiffy 🙂

      (0) 

Leave a Reply