Search

Chapter 5. Migration Examples

download PDF

5.1. Hello World Project Migration

Let us start with the simplest migration example, a simple Hello World kind of process. This is just to get you started and make you comfortable with the migration process.

Data Migration

Start Red Hat JBoss RMS 5 with a clean repository and install the built-in samples. To make it more interesting, add one BPMN process with following structure:

START->SCRIPT_Task->Human_Task->End

Save the process and build the package. This is what it looks like in Red Hat JBoss RMS 5:

6305

As discussed earlier, in order to automatically migrate assets from Red Hat JBoss RMS 5 to Red Hat JBoss BPM Suite 6, you need to convert the JCR repository, storage for business assets in 5, to a GIT repository—​storage for business assets in 6. Run the migration tool:

$ ./runMigration.sh -i /home/osiris/jboss-playground/jboss-eap-6.0-brms/bin/repository -o /home/osiris/Downloads/myGitRepo -r MyMigratedRepo

This example assumes that the Red Hat JBoss RMS 5 instance was started from the bin directory, using ./standalone.sh, so by default, the repository directory and repository.xml will be created in this directory.

The destination (specified by the -o option) can be whatever directory you want it to be. The GIT repository is created under myGitRepo folder once the migration tool finishes its work.

Note

The destination folder must not exist when you run this command otherwise you will get an error.

Once done, clone this repository into Red Hat JBoss BPM Suite 6.x via Administration Repositories Clone Repository. Point it to file:///home/osiris/Downloads/myGitRepo/MyMigratedRepo.git to start the import.

It is now possible to build and deploy project in Red Hat JBoss BPM Suite 6 and easily instantiate the process. This is what it should look like once successfully imported.

6306

5.2. Cool Store Project Migration

The 'Hello World' scenario is a useful migration demo to get your hands dirty. Let us make it more interesting by trying on a real-life project, such as the Cool Store Demo by Eric Schabell which is a reasonably complex project mimicking an online web shopping cart example.

This project provides both Red Hat JBoss BRMS 5 and Red Hat JBoss BPM Suite 6 repositories.

The Red Hat JBoss RMS 5 repository with included business-assets can be downloaded from the following location: https://github.com/jbossdemocentral/brms-coolstore-demo/tree/v1.0.

Let us migrate this repository to Red Hat JBoss BPM Suite 6 step by step:

  1. Navigate to bin folder of your BRMS 5 installation—​make sure there is no repository folder and no repository.xml file in this folder as we want to start with a clean repository for this example.
  2. Start the server using ./standalone.sh command. On JBoss EAP 5, start the server by executing the run.sh script.
  3. In your browser, navigate to and login to http://localhost:8080/jboss-brms. If this is the first time you are running this, you will be prompted to install the default examples. Select No Thanks to installing these.
  4. To start the migration of the business assets, let us first import the CoolStore repo into BRMS 5. Open a terminal window and execute the following commands:
// get the repo
$ git clone https://github.com/jbossdemocentral/brms-coolstore-demo.git
$ cd brms-coolstore-demo
// switch to the version 5 quickstart
$ git checkout jdf-quickstart
$ cd support
// this unzips the 5.x repo in an XML format which we will now import
$ unzip repository_export.zip

You now have the 5.x repository of the CoolStore demo in the file repository_export.xml which you can import in Red Hat JBoss RMS 5 via the Administration section of the Guvnor (Business Central in 5.x branch of BRMS). Do this now, and once finished, there will be numerous assets present in the repository. You can view them at http://localhost:8080/jboss-brms/rest/packages/com.redhat.coolstore/. Your Guvnor should look similar to the following figure:

6311

Build the package and the repository using the Guvnor interface and then migrate it using the migration tool.

Run the migration tool like this, from the bin folder of the Red Hat JBoss RMS 5 EAP install:

$ ./runMigration.sh -i /home/osiris/jboss-playground/jboss-eap-6.0-brms/bin/repository -o /home/osiris/Downloads/MigrateRepository -r "MyMigratedRepo"
Reminder on how to use the migration tool
  1. Red Hat JBoss RMS 5 uses the JackRabbit repository for storage of its business assets. Its location is specified via the -i parameter.
  2. Red Hat JBoss RMS 6/Red Hat JBoss BPM Suite 6 uses the Git repository for the storage of business assets. Its location is specified via the -o parameter.
  3. Name of the Git repository is specified via the -r parameter.
  4. Make sure that the destination folder MigrateRepository does not already exist.

After running the previous command successfully, your file structure should resemble:

$ pwd
/home/osiris/jboss-playground/jboss-eap-6.0-brms/bin
$ tree | grep repository
|-- repository
|   |-- repository
|   |-- repository.xml
|-- repository.xml

The /bin/repository/repository.xml file has been placed there manually—​it is a copy of /bin/repository.xml file.

The output of this migration command will be the Git repository located here: /home/osiris/Downloads/MigrateRepository/MyMigratedRepo.git This Git repository is fully compatible with Red Hat JBoss BPM Suite 6 and you will import it to Business Central later.

Migrating POJOs

Although the migration tool migrates most assets, it does not migrate POJO model JARs. These have to be migrated manually and your project will not build till this is done due to unresolved dependencies.

Open up your Red Hat JBoss BPM Suite 6 instance, and import the Git repository into it. Once imported, your Business Central window should look like the following:

6308

As you can see, there are unresolved dependencies errors which will prevent this project from being built. We have not imported the JAR with POJO model classes yet. We need to do this manually.

Log back into Red Hat JBoss RMS 5 Guvnor and locate the Fact Model JAR and download it to your local filesystem. You will import this JAR in Red Hat JBoss BPM Suite 6 Business Central.

6309

In Business Central, log into Authoring Artifact Repository. Press Upload and locate the JAR that you downloaded from Red Hat JBoss RMS 5.

Note

This JAR is not a Maven project, and it is a requirement that all JARs used by Business Central are Maven based. If they are not, you need to provide at least some Maven info in the form of Group, Artifact and Version (GAV). Fill in these values for the uploaded Fact Model JAR (these can be anything you want).

Include JAR as a dependency

You now need to place this JAR on the project’s classpath so it will be available for every business asset located within the project. From Tools Project Editor Dependencies, select Add from repository, and then select the freshly downloaded JAR. Press Save and then Build & Deploy.

The unresolved dependencies errors will now go away, but you will have another issue:

Fixing syntax issues

If you look in the Problems section of Business Central, you will notice that the build has not been successful due to an issue with Declare Events DRL. Looks like this rule has a syntax issue that needs fixing.

Although the BPMN2 and the DRL syntax did not change between Red Hat JBoss RMS 5 and Red Hat JBoss BPM Suite 6, what did change was stricter enforcing of syntax rules in version 6 than in version 5. This should normally not be an issue, and the system will always tell you where there is a mistake.

In version 6, you always need to include the basic keywords when defining a rule. Therefore, in the error you saw earlier, the missing keywords are: WHEN, THEN and END. It is easy to fix this!

6310

Make these changes in the rule file and then press the Validate button. Your project should validate successfully, without any errors.

Note

The Validate button is a great tool when migrating content. With it, you are able to see if an asset can be built, before you actually try to build or deploy a whole project. The interface should tell you the root cause of any issue. More detailed information is also usually displayed in the server.log.

Now let us get back to Tools Project Editor. Press Build & Deploy; the project will build successfully. The migration is successful and all assets are validated and transferred in this process.

Migrating Selected Assets Manually

In some projects, you might not need to migrate the complete repository. The manual approach to transferring assets is fairly simple:

  1. Create a new Git repository in Business Central.
  2. For DRL, create an empty rule and copy paste the content of the rule from Red Hat JBoss RMS 5.

    For BPMN processes, create a new process and use Import from BPMN2 to import process definition from Red Hat JBoss BRMS 5.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.