Difference between revisions of "SDK for Java"

From OpenKM Documentation
Jump to: navigation, search
m
Line 1: Line 1:
{{Note|If '''you want to collaborate''' extending features or add newer '''contact with us at''' [http://www.openkm.com/en/contact.html contact website form] indicating this url.}}
+
{{Note|If '''you want to collaborate''' extending features or add newer '''contact with us at''' [http://www.openkm.com/en/contact.html contact website form] indicating this URL.}}
  
OpenKM SDK for java are a set of software developement tools that allows for the creation of application for OpenKM. The OpenKM SDK for java include A Webservice library. Webservices library is a complete api layer to access OpenKM with webservices what provide complete compatibility between webservices versions without change code.  
+
OpenKM SDK for Java are a set of software developement tools that allows for the creation of application for OpenKM. The OpenKM SDK for Java include A webservice library. Webservices library is a complete API layer to access OpenKM with webservices what provide complete compatibility between webservices versions without change code.  
  
 
'''Available jar file'''
 
'''Available jar file'''
 
* [[Java SDK| Openkm-sdk4j.jar]]
 
* [[Java SDK| Openkm-sdk4j.jar]]
 +
 +
 +
== Sample client using this JDK ==
 +
You can make use of the OpenKM Maven Repository and will be using the right JDK version. This is a sample pom.xml configuration:
 +
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<project xmlns="http://maven.apache.org/POM/4.0.0"
 +
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 +
  <modelVersion>4.0.0</modelVersion>
 +
 +
  <groupId>com.openkm.sample</groupId>
 +
  <artifactId>prueba</artifactId>
 +
  <version>1.0-SNAPSHOT</version>
 +
 +
  <repositories>
 +
    <repository>
 +
      <id>openkm.com</id>
 +
      <name>OpenKM Maven Repository</name>
 +
      <url>http://maven.openkm.com/maven2</url>
 +
    </repository>
 +
  </repositories>
 +
 +
  <dependencies>
 +
    <dependency>
 +
      <groupId>com.openkm</groupId>
 +
      <artifactId>sdk4j</artifactId>
 +
      <version>1.0</version>
 +
    </dependency>
 +
  </dependencies>
 +
</project>
 +
</source>
 +
 +
In this class you can see how to call an API method to request all folder children from "/okm:root":
 +
 +
<source lang="java">
 +
import com.openkm.sdk4j.OKMWebservices;
 +
import com.openkm.sdk4j.OKMWebservicesFactory;
 +
import com.openkm.sdk4j.bean.Folder;
 +
import com.openkm.sdk4j.exception.*;
 +
 +
/**
 +
* Sample OpenKM JDK client
 +
*/
 +
public class Main {
 +
    public static void main(String var[]) throws Exception {
 +
        String url = "http://demo.openkm.com/OpenKM";
 +
        String user = "user5";
 +
        String pass = "pass5";
 +
        OKMWebservices okm = OKMWebservicesFactory.newInstance(OKMWebservicesFactory.PROFESSIONAL_6_2, url, user, pass);
 +
 +
        for (Folder fld : okm.getFolderChildren("/okm:root")) {
 +
            System.out.println("Fodler -> " + fld.getPath());
 +
        }
 +
    }
 +
</source>
 +
 +
Ans this is the pom.xml used in this project:
 +
  
 
[[Category: Extension Guide]]
 
[[Category: Extension Guide]]

Revision as of 11:25, 24 March 2014


Nota clasica.png If you want to collaborate extending features or add newer contact with us at contact website form indicating this URL.

OpenKM SDK for Java are a set of software developement tools that allows for the creation of application for OpenKM. The OpenKM SDK for Java include A webservice library. Webservices library is a complete API layer to access OpenKM with webservices what provide complete compatibility between webservices versions without change code.

Available jar file


Sample client using this JDK

You can make use of the OpenKM Maven Repository and will be using the right JDK version. This is a sample pom.xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.openkm.sample</groupId>
  <artifactId>prueba</artifactId>
  <version>1.0-SNAPSHOT</version>

  <repositories>
    <repository>
      <id>openkm.com</id>
      <name>OpenKM Maven Repository</name>
      <url>http://maven.openkm.com/maven2</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.openkm</groupId>
      <artifactId>sdk4j</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
</project>

In this class you can see how to call an API method to request all folder children from "/okm:root":

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Folder;
import com.openkm.sdk4j.exception.*;

/**
 * Sample OpenKM JDK client
 */
public class Main {
    public static void main(String var[]) throws Exception {
        String url = "http://demo.openkm.com/OpenKM";
        String user = "user5";
        String pass = "pass5";
        OKMWebservices okm = OKMWebservicesFactory.newInstance(OKMWebservicesFactory.PROFESSIONAL_6_2, url, user, pass);

        for (Folder fld : okm.getFolderChildren("/okm:root")) {
            System.out.println("Fodler -> " + fld.getPath());
        }
    }

Ans this is the pom.xml used in this project: