chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Clijsters <peter.clijst...@everett.nl>
Subject Problems with simple atompub client
Date Thu, 05 Nov 2009 09:20:02 GMT
Hi all,
 
I'm in the process of making a simple atompub client with Chemistry. I've
run into some issues and I'm beginning to wonder if I'm on the right track
here.. The code I currently have is the code displayed below and taken
largely from the tests in Chemistry. Firstly, this gave me an error that
"cmis:parentId" was not set. I've worked around this by removing PARENT_ID
from the mandatory properties in TypeEntryReader.java. But now, I get the
following error. 

Any help and suggestions on how to make this simple client work are welcome!


+++++++++++++++++++++++++++++++++++++
10:06:49,914 WARN  [HttpMethodDirector] Required credentials not available
for BASIC <any realm>@cmis.alfresco.com:80
10:06:49,914 WARN  [HttpMethodDirector] Preemptive authentication requested
but no default credentials available
10:06:50,006 INFO  [AuthChallengeProcessor] basic authentication scheme
selected
Repository Id: 8269258c-1ab3-4db4-8e8e-70b68ca88acd
Repository Name: Main Repository
Root Folder Id: workspace://SpacesStore/d14049b7-e63f-4075-acc2-a4cd5a541f3c
Exception in thread "main"
org.apache.chemistry.atompub.client.ContentManagerException: GET request
failed
	at
org.apache.chemistry.atompub.client.connector.HttpClientConnector.get(HttpCl
ientConnector.java:92)
	at
org.apache.chemistry.atompub.client.APPConnection.getObjectEntry(APPConnecti
on.java:368)
	at
org.apache.chemistry.atompub.client.APPConnection.getObject(APPConnection.ja
va:378)
	at
org.apache.chemistry.atompub.client.APPConnection.getRootFolder(APPConnectio
n.java:105)
	at
nl.surfnet.wave.cmisrobot.test.simpleCMISClient.main(simpleCMISClient.java:3
7)
Caused by: java.lang.IllegalArgumentException: Invalid uri
'http://cmis.alfresco.com:80/service/cmis/arg/n?noderef=workspace://SpacesSt
ore/d14049b7-e63f-4075-acc2-a4cd5a541f3c&filter={filter}&includeAllowableAct
ions={includeAllowableActions}&includePolicyIds={includePolicyIds}&includeRe
lationships={includeRelationships}&includeACL={includeACL}&renditionFilter={
renditionFilter}': Invalid query
	at
org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
	at
org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
	at
org.apache.chemistry.atompub.client.connector.HttpClientConnector.get(HttpCl
ientConnector.java:86)
	... 4 more
+++++++++++++++++++++++++++++++++++++
 
=====================================================
package nl.surfnet.wave.cmisrobot.test;

import java.util.List;

import org.apache.chemistry.CMISObject;
import org.apache.chemistry.Connection;
import org.apache.chemistry.Folder;
import org.apache.chemistry.ObjectId;
import org.apache.chemistry.atompub.client.*;
import org.apache.chemistry.atompub.client.connector.APPContentManager;

public class simpleCMISClient {

	public static void main(String args[]) {
		String serverUrl =
"http://cmis.alfresco.com:80/service/cmis";

		APPContentManager cm = new APPContentManager(serverUrl);

		cm.login("admin", "admin");

		APPRepository[] repositories = (APPRepository[])
cm.getRepositories();

		for (int i=0;i<repositories.length;i++) {
			if (repositories[i]== null) {
				System.out.println("Repository "+i+" is
empty");
			}
			else {
				APPRepository repository = repositories[i];

				System.out.println("Repository Id:
"+repository.getId());
				System.out.println("Repository Name:
"+repository.getName());

				ObjectId rootFolder =
repository.getInfo().getRootFolderId();
				System.out.println("Root Folder Id:
"+rootFolder.getId());

				Connection conn =
repository.getConnection(null);
				Folder root = conn.getRootFolder();
				List<CMISObject> children =
root.getChildren();
				for (CMISObject child : children) {
					String name = child.getName();
					String title =
child.getString("title");
					String descr =
child.getString("description");

					System.out.println("Child name:
"+name);
					System.out.println("  Title:
"+title);
					System.out.println("  Description:
"+descr);
				}
			}
		}
	}
}
=====================================================

Thanks,

Peter Clijsters


Mime
View raw message