Configuring Java Global Instance Shared Resource
You can configure Java global instance shared resource for an activity according to your own environment.
Prerequisites
Procedure
-
In the
General tab of your created activity, click
to create or choose a default resource.
- In the Project Explorer view, expand project name, right-click the src folder, and select New > Class.
- In the Java Class dialog, specify values in the Package and Name fields. Click Finish.
-
In the new
.java file, add your own code logic, and save the file.
This is an example:
package com.test; public class Person { private String name; private String age; public Person(String name, String age) { this.name = name; this.age = age; } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setAge(String age) { this.age = age; } public String getAge() { return age; } }
- In the Project Explorer view, expand project name > Resources > project name > JavaGlobalInstanceResource.javaGlobalInstanceResource.
-
In the
JavaGlobalInstanceResource.javaGlobalInstanceResource file, find the
Java Global Instance tab.
- Click Browse to find the .java file that created in Step 4. In the Class Selection dialog, enter the .java file name to find the created file. Select the file in the Matching items field, and click OK.
- From the Method list, select the constructor of the class.
- In the Parameter Input area, specify a value in the Value field for the parameter. For example, default.
- In the Advanced Configuration tab, select the Invoke Cleanup Method check box, and select clean() from the Cleanup Method list. Save your configurations.
- In the Project Explorer view, expand com.company_name.bw.palette.palette_name.runtime > src > com.company_name.bw.palette.palette_name.runtime > activity_nameactivity_type.java.
-
Double-click the
.java file, you can see the code changes of the created Java global instance shared resource.
/** * * * * @generated */ @Property(name = "JavaGlobalInstanceName") public JavaGlobalInstanceResource javaGlobalInstanceResource;
Copyright © Cloud Software Group, Inc. All Rights Reserved.