Finding repository optional capabilities with RepositoryInfo.getCapabilities()

14 views
Skip to first unread message

Rafael Cordones Marcos

unread,
Nov 29, 2011, 5:18:06 AM11/29/11
to xcmis
Hi!

First of all, thanks for xCMIS! I came accross xCMIS while looking for
a light-weight CMIS *server* implementation to use for a content-
centric application I am researching.

I am using the OpenCMIS client library to access xCMIS running on
Tomcat. I started with the example code provided by OpenCMIS here:
https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-getting-started/src/main/java/org/apache/chemistry/opencmis/doc/GettingStarted.java

When I run the sample, it fails because the call

RepositoryCapabilities capabilities =
session.getRepositoryInfo().getCapabilities();

returns null.

Is this expected behavior?

This happens against the xCMIS 1.2.2 release as well as the latest (as
of today) trunk code.

To reproduce the issue I have adapted the OpenCMIS sample to be able
to run it from the command-line (you will need Groovy):
{code}
#!/usr/bin/env groovy

@Grab(group = 'org.apache.chemistry.opencmis', module = 'chemistry-
opencmis-client-bindings', version = '0.5.0')
@Grab(group = 'org.apache.chemistry.opencmis', module = 'chemistry-
opencmis-client-api', version = '0.5.0')
@Grab(group = 'org.apache.chemistry.opencmis', module = 'chemistry-
opencmis-client-impl', version = '0.5.0')
import org.apache.chemistry.opencmis.client.runtime.*
import org.apache.chemistry.opencmis.commons.*
import
org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition
import org.apache.chemistry.opencmis.commons.exceptions.*
@Grab(group = 'org.apache.chemistry.opencmis', module = 'chemistry-
opencmis-commons-impl', version = '0.5.0')
import
org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl
import org.apache.chemistry.opencmis.client.api.*
import org.apache.chemistry.opencmis.commons.data.*
import org.apache.chemistry.opencmis.commons.enums.*
@Grab(group = 'junit', module = 'junit', version = '4.10')
import static org.junit.Assert.assertNotNull

def client = new CmisClient()
client.go()

public class CmisClient {

def username = "root";
def password = "exo";
def atomPubURL = "http://localhost:8080/xcmis/rest/cmisatom";
def repositoryName = "cmis1";

public void go(String[] args) {
System.out.println("Getting Started...");
System.out.println("------------------");

// Create a SessionFactory and set up the SessionParameter map
SessionFactory sessionFactory =
SessionFactoryImpl.newInstance();
Map<String, String> parameters = [
(SessionParameter.USER): username,
(SessionParameter.PASSWORD): password,
(SessionParameter.ATOMPUB_URL): atomPubURL,
(SessionParameter.BINDING_TYPE):
BindingType.ATOMPUB.value(),
(SessionParameter.REPOSITORY_ID): repositoryName
]

System.out.println("Accessing ATOMPUB_URL: " +
parameters.get(SessionParameter.ATOMPUB_URL)
+ " userid: " + parameters.get(SessionParameter.USER)
+ " password: "
+ parameters.get(SessionParameter.PASSWORD));

// create session with the first (and only) repository
//Repository repository = repositories.get(0);
Session session = sessionFactory.createSession(parameters);

System.out.println("Got a connection to repository: " +
repositoryName);

RepositoryInfo info = session.getRepositoryInfo();
assertNotNull(info);
println info;
RepositoryCapabilities capabilities = info.getCapabilities();
assertNotNull(capabilities);
}
}
{code}

Thanks for your time!

/rafa

andrew00x

unread,
Nov 29, 2011, 6:47:28 AM11/29/11
to xcmis
Hello Rafael,
Thank you for your interest to xCMIS project. I found that our rest-
binding does not support sending 'repositoryId' in query parameter.
I have changed you code as next:{code}
def atomPubURL = "http://localhost:8080/xcmis/rest/cmisatom/cmis1"; //
add repository ID directly in URL
{code}
After that your example works. I'll fix the issue today and add
support for sending 'repositoryId' in query parameter.

Thanks!
Andrey.
On Nov 29, 12:18 pm, Rafael Cordones Marcos


<rafael.cordo...@gmail.com> wrote:
> Hi!
>
> First of all, thanks for xCMIS! I came accross xCMIS while looking for
> a light-weight CMIS *server* implementation to use for a content-
> centric application I am researching.
>
> I am using the OpenCMIS client library to access xCMIS running on

> Tomcat. I started with the example code provided by OpenCMIS here:https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/chemistry-o...

andrew00x

unread,
Nov 30, 2011, 6:55:02 AM11/30/11
to xcmis
Hello Rafael,

The issue is fixed. Please update and try.

Thanks!
Andrey

Reply all
Reply to author
Forward
0 new messages