Shared instance

In XINS the functions are initialised when you start the server, the initialisation also passes the properties defined in xins.properties to the function. XINS has the notion of shared instance which is an object created and initialized in a similar way as functions are. Furthermore this object is passed as an instance to all the defined functions of the API.

You can think about the following situations:

To add a shared instance to the API add in the impl.xml file <instance name="_sharedObject" getter="getSharedObject" class="SharedObject" />.

Now you need to create a class SharedObject in the implementation package that extends the org.xins.common.manageable.Manageable class (javadoc).

Now you could use this object by calling in the call(Request request) method

// Get some data from the shared object
String firstName = _sharedObject.getFirstName(request.getLastName());

An example is provided in the allinone project.