|
Developing Applications
The sample application presented in this tutorial is deployed with the
server package under IRIS_HOME/demo/datasynch and is comprised of:
- Publisher client that updates application data;
- Susbscriber client that is notified of data changes;
- Server application that accepts publishing requests, stores the data and
sends the new data to the subscribers.
The data synchronized is a String message.
The sample application demonstrates how to:
- Create and export server commands. These are objects that are created at server startup
and can be invoked by client applications. Generally server commands don't encapsulate
session or request information;
- Use command factories to create session commands. Session commands are object instances
created on the fly and can be invoked only by the client session that created the command.
The purpose of the session commands is to encapsulate session state;
- Invoke server commands in synchronous or asynchronous mode;
- Invoke callback objects registered on the client from the server code;
- Use session listeners to initialize session data or perform cleanup when the clients disconnect;
- Implement application security using roles and grants.
Application Objects
Every application is comprised of the following elements:
- Interfaces - These are the common interfaces shared by the
deployed server application and the clients;
- Commands - The command classes are deployed on the server. The clients can access
the commands through the interfaces implemented by the command class;
- Client callback interfaces - These are interfaces that are exported by the client and
can be invoked by the server application through the client proxy provided by the server
framework. The client must register object handlers that implement callback interfaces;
- Session listeners - These are server objects that are notified when a client is invoking
the application commands for the first time or when the client disconnects;
- Application roles and grants that are used to implement application access control;
- The application description file
application.properties that declares the
objects exported by the application;
- Client applications.
Directory Structure
The deployed datasynch application is organized in the following directory hierarchy under the
application root directory datasynch/:
-
The
application.properties file is located in the root directory;
-
The
lib/ subdirectory contains all jars required by the server application. These are
the interfaces jar, the server code and other third party APIs;
-
The
bin/ subsdirectory contains the interfaces jar, the client source code and third party APIs
used by the client;
-
Deployed with the sample application we included startup scripts for the clients, the source code
and the application JavaDoc.
- The server will automatically create a database file in the root directory including
the application roles assigned to the server users and called grants.db .
|