Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

Using EGit to quickly create an Adapter Module's EJB & EAR project

$
0
0

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

git_copy.png

 

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

Click the Clone Git Repository button

clone.png

 

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

clone1.png

 

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

clone2.png

 

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

clone3.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.

git_repo.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.

import.png

 

Select Import existing projects and click Next.

import1.png

 

Select both EJB and EAR projects and click Finish.

import2.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.

project.png

 

Step 3 - Refactor project contents

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

 

Rename EAR project.

refactor_ear.png

 

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

refactor_vendor.png

 

Rename EJB project.

refactor_ejb.png

 

Rename package in EJB project.

refactor_package.png

 

Rename EJB 3.0 Session Bean.

refactor_bean.png

 

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

refactor_j2ee.png

 

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

refactor_jar.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.

commit1.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.


Viewing all articles
Browse latest Browse all 2548

Trending Articles