3.9.2 Custom Repository Protocol
The Style Intelligence report server uses one of the following protocols: RMI, HTTP, CORBA, or SOAP. You can also implement a repository proxy class to provide support for a different protocol. This third-party protocol support is intended mainly for communications between a custom viewer and the report server. For a servlet-based viewer, as the repository already resides on the server machine, there is no need to use a custom protocol to communicate between the servlet and repository.
To incorporate a different protocol, follow these steps:
1. Create a Repository Client Proxy.
The proxy should implement the RepletRepository interface. In each method, it should forward the request (method parameters) to the server and pass the result back.
public class RepositoryProxy implements RepletRepository {
public RepositoryProxy(...) {
// establish connection to the server
// using the third-party protocol
}
public Object create(String name, Object ticket) throws RemoteException, RepletException {
// call the server to perform a create()
// return the result from the server
}
}
2. Create a Repository Server.
The server exposes methods to be called by the proxy using the same protocol. It can use the Replet Engine as the implementation of the repository.
public RepositoryServer2 {
public RepositoryServer2() {
engine = new RepletEngine();
engine.init();
// register with protocol as needed...
}
// The signature of this method is protocol-dependent.
// We use the same signature as the RepletRepository for
// convenience. This is the method the client proxy
// calls through the protocol
public Object create(String name, Object ticket) {
return engine.create(name, ticket);
}
}
3. Create a proxy repository in the client and pass it to the viewer:
RepositoryProxy proxy = new RepositoryProxy(...);
Viewer viewer = new Viewer(proxy);
Depending on the protocol selected for the proxy and server, the implementation needs to convert the Java object parameters and return values to the data structures supported by the protocol. All objects used in the RepletRepository methods are serializable. Therefore, the easiest way to convert the parameters is to serialize the objects into bytes, pass them across the protocol as raw data and convert them back to Java objects at the receiving end.
| << Configuring a Custom Button | © 1996-2013 InetSoft Technology Corporation (v11.4) | 4 SOAP Web Services >> |