Friday, 22 March 2019

Apache Chemistry: Setting up CMIS Environment


In this post, I am going to show you, how to setup openCMIS Inmemory repository and cmis work bench provided by Apache Chemistry.

What is openCMIS inmemory repository?
It is an implementation of CMIS repository. it holds the content and metadata in memory. So once you restart the machine (or) application, the data will be lost.

Why do we require Inmemory repository?
First of all, for new comers, it is easy to experiment with CMIS APIs, if they had repository in their computer.

What is CMIS workbench?
CMIS workbench is a swing based CMIS client, used to connect to the repositories. By using CMIS work bench, you can
a.   Access the repository
b.   Perform CRUD operations against repository
c.    Get the information about the repository
d.   It provides TCK (Test Compatibility kit), to verify whether given repository is CMIS compliance or not.
e.   Provide interactive Groovy Console.

Setting up OpenCMIS in memory repository
Make sure you installed and setup Java on your machine. Following post explains how to setup Java on your machine.

Go to following location and download ‘OpenCMIS Server Webapps’.

Extract the download zip file, you can able to see two war files.
chemistry-opencmis-server-fileshare-1.1.0.war
chemistry-opencmis-server-inmemory-1.1.0.war
War file
Description
chemistry-opencmis-server-fileshare-1.1.0.war

It is an implementation of CMIS repository. The FileShare repository uses the file system as its back-end store and provides read/write access to content and metadata. In other words, it puts a CMIS interface on top of your file system.
chemistry-opencmis-server-inmemory-1.1.0.war

It is an implementation of CMIS repository. The OpenCMIS In-Memory Repository is an implementation of a CMIS repository that holds content and metadata in memory. Therefore, all data stored in the repository is lost after each restart.

Since the in memory repository is a web application, we need to deploy this in an application server like tomcat. Next steps shows you how to install and deploy the war file ‘chemistry-opencmis-server-inmemory-1.1.0.war’.

Downloading and setting up tomcat
Go to following location and download the latest version of tomcat server.

Extract the downloaded tomcat distribution.

Go to the bin directory of tomcat distribution and run ‘startup.bat’ file.

If everything goes fine, server will start on the port 8080.

Open web browser and hit the url ‘http://localhost:8080/’, you can able to see following output.



By using ‘Manager App’ button, we can deploy war files. To use ‘manager App’, we should configure a user.

How to configure a user in tomcat?
First stop the tomcat server by running ‘shutdown.bat’ file.

Tomcat users are defined in the file – $TOMCAT_HOME/conf/tomcat-users.xml, by default, no user is configured. To access the tomcat manager page, we should configure user in tomcat-users.xml file.

Add following lines to the <tomcat-users>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>

Before updating
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
</tomcat-users>


After updating
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
</tomcat-users> 

Now run startup.bat file.

Open the browser and hit the url ‘http://localhost:8080/’


Click on the button ‘Manager App’. It prompts for user name and password. Enter admin as username and password and press Login.


After successful login, you can able to see following screen.


Choose the war file and deploy the war file ‘chemistry-opencmis-server-inmemory-1.1.0.war’.

After successful deployment of war file, the in memory application ‘chemistry-opencmis-server-inmemory-1.1.0’ is added to Applications table.


Click on the link ‘chemistry-opencmis-server-inmemory-1.1.0’, you can able to see the following page.


In the above page, you can get access information of the in memory server. Following access information is copied from above page.

CMIS 1.1
WS (SOAP) Binding: http://localhost:8080/chemistry-opencmis-server-inmemory-1.1.0/services11/cmis?wsdl

AtomPub Binding: http://localhost:8080/chemistry-opencmis-server-inmemory-1.1.0/atom11

Browser Binding: http://localhost:8080/chemistry-opencmis-server-inmemory-1.1.0/browser

CMIS 1.0
WS (SOAP) Binding: http://localhost:8080/chemistry-opencmis-server-inmemory-1.1.0/services/cmis?wsdl


Remember above binding urls, they are required to connect to the repository.


Setting up CMIS workbench
CMIS Workbench is an independent swing based application (You can assume like CMIS desktop client), used to connect to a cmis repository.

Go to following location and download CMIS workbench.

Extract the downloaded workbench and run ‘workbench.bat’ file. You can able to see following swing user interface.

By default 'Binding' will be selected as 'AtomPub'. You can give following AtomPub url and connect.

Click on the button 'Load Repositories'. You can able to see list of repositories available. Since we configured only one inmemory repository, you can able to see one.

Select the in memory repository and press Login. You can able to see following kind of screen.

That’s it, you are done. Now you can experiment with the CMIS work bench.

Previous                                                 Next                                                 Home

No comments:

Post a Comment