Hi everyone, firstly I must thank you for great product which for sure openKM is!
I'm just starting working with openKM. My point is to extend search / indexing engine in semantic direction.
I've added front end extension responsible for adding some extra metadata to document. It's available as a tab when you click on particular document.
Extension is called GeoSpatialDocumentPropertiesTab and it extends TabDocumentExtension.
Result:
Screen: http://postimage.org/image/7j5zcpnh3/
Now I've got additional external system already written which is responsible for semantic data processing which offers REST API.
Example: when you access link below (through browser or curl)
http://localhost:9090/geospatialsis/res ... 6d59566894
it will produce xml:
I've already added dependency in pom.xml:
Example (get method)
1) Where should I put dto classes (in which package?) Should I also made some changes in xml somewhere to inform that I want to use this class in GeoSpatialDocumentPropertiesTab?
2) Where should I put my DocumentPropertyService class?
I tried to put dto classes and service class in com.openkm.extension.dao and later in com.openkm.dao
but whenever I try to create and access mentioned classes I got compilation error in GeoSpatialDocumentPropertiesTab.java in import statement.
Even thought when I just call jersey-client directly from GeoSpatialDocumentPropertiesTab I get error like:
Probably I don't have enough knowledge about openKM, if you have any other ideas how to solve accessing data from rest api in quicker / nicer way just please let me know.
Sorry, if my question are trivial. Hope that I make myself clear.
Thanks in advice for replay.
I'm just starting working with openKM. My point is to extend search / indexing engine in semantic direction.
I've added front end extension responsible for adding some extra metadata to document. It's available as a tab when you click on particular document.
Extension is called GeoSpatialDocumentPropertiesTab and it extends TabDocumentExtension.
Result:
Screen: http://postimage.org/image/7j5zcpnh3/
Now I've got additional external system already written which is responsible for semantic data processing which offers REST API.
Example: when you access link below (through browser or curl)
http://localhost:9090/geospatialsis/res ... 6d59566894
it will produce xml:
Code: Select all
Inside my extension I want to call rest get method using jersey-client.<document-properties>
<area>
<points>
<latitude>12.0</latitude>
<longitude>31.0</longitude>
</points>
<radius>100</radius>
<type>POINT</type>
</area>
<period>
<from>2012-11-22T03:01:39.202+01:00</from>
</period>
<place>
<apartmentNumber>915</apartmentNumber>
<buildingNumber>4</buildingNumber>
<continent>EUROPE</continent>
<country>Poland</country>
<city>Wroclaw</country>
<street>Swietokrzyska</street>
<zipCode>51-231</zipCode>
</place>
<uuid>284b4b9e-8b1a-4bb7-aee1-7a6d59566894</uuid>
</document-properties>
I've already added dependency in pom.xml:
Code: Select all
I wrote DocumentPropertyService with simple methods like: get, add <!-- jersey client -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.8</version>
</dependency>
Example (get method)
Code: Select all
DocumentProperties it just simple dto class with xml annotations:
Client c = new Client();
WebResource r = c.resource("http://localhost:9090/geospatialsis/rest-api/document-properties/284b4b9e-8b1a-4bb7-aee1-7a6d59566894");
ClientResponse cr = r.accept("application/xml").get(ClientResponse.class);
if(cr.getStatus() == 200){
DocumentProperties d = cr.getEntity(DocumentProperties.class);
} else {
throw new RuntimeException("Failed to load rest resource. Error code: " + cr.getStatus());
}
Code: Select all
So my questions are:@XmlRootElement(name="document-properties")
public class DocumentProperties {
private String uuid;
private Place place;
private Area area;
private Period period;
@XmlElement(name="uuid")
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
..
1) Where should I put dto classes (in which package?) Should I also made some changes in xml somewhere to inform that I want to use this class in GeoSpatialDocumentPropertiesTab?
2) Where should I put my DocumentPropertyService class?
I tried to put dto classes and service class in com.openkm.extension.dao and later in com.openkm.dao
but whenever I try to create and access mentioned classes I got compilation error in GeoSpatialDocumentPropertiesTab.java in import statement.
Even thought when I just call jersey-client directly from GeoSpatialDocumentPropertiesTab I get error like:
Code: Select all
I went through the wiki and I know that you are using webservices, but jersey client should also work here (am I wrong?)[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Failed to get JNode
[INFO] at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:140)
[INFO] at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:71)
[INFO] at com.google.gwt.dev.jjs.impl.BuildTypeMap.getType(BuildTypeMap.java:730)
[INFO] at com.google.gwt.dev.jjs.impl.BuildTypeMap.access$000(BuildTypeMap.java:99)
[INFO] at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.visit(BuildTypeMap.java:195)
[INFO] at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.traverse(LocalDeclaration.java:237)
[INFO] at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:239)
[INFO] at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1239)
[INFO] at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:687)
[INFO] at com.google.gwt.dev.jjs.impl.BuildTypeMap.createPeersForNonTypeDecls(BuildTypeMap.java:637)
[INFO] at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:514)
[INFO] at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:523)
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:599)
[INFO] at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:232)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:198)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[INFO] [ERROR] <no source info>: public class com.sun.jersey.api.client.Client
[INFO] extends Unresolved type com.sun.jersey.api.client.filter.Filterable
[INFO] implements : Unresolved type com.sun.jersey.api.client.ClientHandler
Probably I don't have enough knowledge about openKM, if you have any other ideas how to solve accessing data from rest api in quicker / nicer way just please let me know.
Sorry, if my question are trivial. Hope that I make myself clear.
Thanks in advice for replay.