openrat-java-client

Unnamed repository; edit this file 'description' to name the repository.
git clone http://git.code.weiherhei.de/openrat-java-client.git
Log | Files | Refs

ExampleCMSTestAPI.java (854B)


      1 package de.openrat.client.test;
      2 
      3 import de.openrat.client.CMSClient;
      4 import de.openrat.client.util.CMSNode;
      5 
      6 import java.io.IOException;
      7 
      8 /**
      9  * this is an example API facade for calling CMS functions.
     10  */
     11 public class ExampleCMSTestAPI {
     12 
     13 	private CMSClient client;
     14 
     15 	public ExampleCMSTestAPI(CMSClient client) {
     16 		this.client = client;
     17 	}
     18 
     19 	public boolean login( String dbid, String user, String password ) throws IOException {
     20 		client.request("login","login").execute(); // Read Session and Token.
     21 
     22 		return client.request("login","login").forWriting().addParameter("dbid",dbid).addParameter("login_name",user).addParameter("login_password",password).execute().getValidationErrors().isEmpty();
     23 	}
     24 
     25 	public CMSNode info() throws IOException {
     26 		return client.request("login","license").execute().getOutput();
     27 	}
     28 
     29 	// ... add another methods here ...
     30 }