The adamoto soap interface – How to develop an adamoto client-agent |
Since version 0.4.5 adamoto has a soap interface and works as web service. Soap means "Simple Object Access Protocol". With Soap it is very easy to call objects and functions that run anywhere in net or your intranet. Colour
With the soap interface implemented in adamoto it is very easy to write a client-agent for your hardware, programming language or operating system currently not supported by adamoto.
This documents explains how to implement a client-agent for adamoto using the perl client-agent as example.
The perl agent-client asks the adamoto server for a package for a system identified by the system name. If there is a new package the client install it and messages the success to the adamoto server.
First the clients initialises the soap interface:
$soap = new SOAP::Lite; $soap->init();
Then he asks the server for a new package for the system:
$soap->GetPackage($ARGV[0]); # $ARGV[0] contains the system name
Now it is possible to get all the data of the package, be using
getX() functions. The perl client checks, if there is a package to
install by comparing the value he got by getFile() with an empty
string. If the string contains something, there is a package that has
to be installed. The client calls the function installer with the
required variables delivered by soap-calls (getFile(), getName(),
...). Before the client starts the installer, it sets the status of
the distribution to started.
if (getFile() ne "") { # Write the State of Distribution to "started" writestate(getID(),STARTED); installer(getName(),getNetConnection(),getFile(),getInstallationProgram(), getNetConnectionInstallProgram(),getCheckFile(),gettimeout(),getautocheck(),getType()); # Write the State of Distribution writestate(getID(),$state); }
That is the connection between the client-agent and the server. 5 lines of code. So feel encouraged to write a client-agent, maybe in C++. We are pleased to help you. Just mail to one of the developers.
You can download the full perl-code of the client agent here. A java example can be downloaded here
The following reference is written in java notification.
// Has to be called first. Initialises the Interface. public void init() throws java.rmi.RemoteException; // Gets a pacckage for system, identified by the given system name public boolean getPackage(java.lang.String name) throws java.rmi.RemoteException; // Returns the name of the package public java.lang.String getName() throws java.rmi.RemoteException; // Returns the priority of the package public int getPriority() throws java.rmi.RemoteException; // Returns the type of the package public java.lang.String getType() throws java.rmi.RemoteException; // Returns the Filename, which should be installed public java.lang.String getFile() throws java.rmi.RemoteException; // Returns the Connection-Path of the file, which should be installed public java.lang.String getNetConnection() throws java.rmi.RemoteException; // Returns the program, which should do the installation (only for some types of installation) public java.lang.String getInstallationProgram() throws java.rmi.RemoteException; // Returns the connection-Path of the program, which should do the installation (only for some types of installation) public java.lang.String getNetConnectionInstallationProgram() throws java.rmi.RemoteException; // Return the autocheck-value, which indicates if adamoto should check for succesful installation public boolean getautocheck() throws java.rmi.RemoteException; // Return the timeout-value, which indicates how long the autocheck should wait for the installation public int gettimeout() throws java.rmi.RemoteException; // Writes the given state to the database public boolean writestate(java.lang.String state) throws java.rmi.RemoteException; //Returns an error-text, if an error occured (for debugging use) public java.lang.String geterror() throws java.rmi.RemoteException; //Returns the pathname of the conf-file (for debugging use) public java.lang.String getpathname() throws java.rmi.RemoteException; //Returns the last SQL-String send to database (for debugging use) public java.lang.String getsql() throws java.rmi.RemoteException; //Returns the last JDBC-String send to database (for debugging use) public java.lang.String getJDBCString() throws java.rmi.RemoteException;