JAVA Global Instance

Generated Objects

	@Property(name = "MyJavaGlobalInstance")
public JavaGlobalInstanceResource myJavaGlobalInstance;

myJavaGlobalInstance is an instance of com.tibco.bw.sharedresource.java.runtime.JavaGlobalInstanceResource. You can use it to get the java object contained in the referenced JAVA Global Instance resource. You can use access that object via Java reflection.

Business Logic Example

class CallMyMethodActivityExecutor implements Runnable {
			@Override
		public void run() {
			if(getActivityLogger().isDebugEnabled()) {
				activityLogger.debug(RuntimeMessageBundle.DEBUG_PLUGIN_ACTIVITY_METHOD_CALLED
									,new Object[] { "Executor run()"
									,activityContext.getActivityName()
									,activityContext.getProcessName()
									,activityContext.getDeploymentUnitName()
									,activityContext.getDeploymentUnitVersion() });
				String serializedNode = XMLUtils.serializeNode(inputData, processContext.getXMLProcessingContext());
		    	activityLogger.debug(RuntimeMessageBundle.DEBUG_PLUGIN_ACTIVITY_INPUT, new Object[] {activityContext.getActivityName(), serializedNode});
			}
			
			try {		
	
				
									// begin-custom-code
									// add your own business code here	

						try {
					// get the object instance
					Object object = myJavaGlobalInstance.getDeclaredClassObject();
					// use reflection to call getHello() method
					Method method = object.getClass().getDeclaredMethod("getHello");
					Object result = method.invoke(object);
					System.out.println((String) result);
				} catch (Exception e) {
					throw new ActivityFault(activityContext, e);
				}

						// end-custom-code
				
			
				
				N output = null;
				SerializableXMLDocument<N> wrapper = new SerializableXMLDocument<N>(processContext.getXMLProcessingContext(), output);
				notifier.setReady(wrapper);
			} catch (Exception e) {
				e.printStackTrace();
				notifier.setReady(e);
			}
		}
	}