2022

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Now we will discuss the steps for creating a new "Hello World" AppCode. In this example we want to demonstrate how to create one AppCode implementation from scratch. This AppCode class which we are talking about, we will be able to demonstrate the operations which we need to implement as a part of the AppCode implementation.

The HelloWorld implementation class will take the input data as a list of HelloParameter objects and will print it out by prefixing "Hello" to it. The Read operation on it will return an array of pre-defined HelloParameters with their data 

1. Open your TestAppCode project which you downloaded as a part of the QuickStart section

2. Define your new HelloWorld AppCode implementation class in the source folder and ensure you are selecting the interface as AppCode while defining the class
You would see a new class created with the default method signatures 

Coming to the 3 methods showing up, the following would be the basic functionality 

1. Open

This method should open the connection with the 3rd party system and should initiate the session as mentioned earlier. In our case since it is a Hello World and there is no 3rd party system which we are integrating with actually. We will just initialize the session key and print it out to the console and to the log. 

 @Override
public void open() throws RemoteException {
	// TODO Auto-generated method stub
	sessionKey = UUID.randomUUID().toString();
	logger.log(Level.INFO, "Hello World AppCode Session opened:" + sessionKey);

System.out.println("Hello World AppCode Session opened:" + sessionKey);

	}

2. setContext

This method should initialize the context for the AppCode Implementation and is called before the open method is called. It normally the contains the initialization parameters which are required to initialize the custom implementation.
In our HellWorld we can just log a trace stating setContext is called in the console and in the log 

 @Override
public void setContext(Context arg0) {
	// TODO Auto-generated method stub
	logger.log(Level.INFO, "Hello World AppCode Set Context called");

	System.out.println("Hello World AppCode Set Context called");

	}
  • No labels