Alfresco
Integrating with Alfresco OpenCMIS Extension
This section explains the process of using WSO2 Governance Registry as a repository and managing it using Alfresco OpenCMIS Extension. The Alfresco OpenCMIS Extension extends OpenCMIS to provide support for Alfresco API. The following are the contents of this section:
Prerequisites
- Download and install WSO2 Governance Registry (G-Reg).
- Download Alfresco OpenCMIS Extension.
- Download OpenCMIS client libraries from the Apache Chemistry website.
Setting Up the Project
Alfresco OpenCMIS Extension depends on OpenCMIS client libraries from Apache Chemistry. Download the latest OpenCMIS client libraries from the Apache Chemistry website. Then download the latest "Alfresco OpenCMIS Extension" package.
When creating the Java project, if you are using Maven, follow the building instructions in the Alfresco site.
Otherwise create a project with your IDE and add all of the above downloaded JARs to you project’s class path (both OpenCMIS and Alfresco OpenCMIS Extension related JARs).
Creating a Document using Alfresco OpenCMIS Extension
You can use the following code segment to create a session:
Map<String, String> parameter = new HashMap<String, String>(); // user credentials parameter.put(SessionParameter.USER, "admin"); parameter.put(SessionParameter.PASSWORD, "admin"); // connection settings parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:9763/cmis/atom"); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); // set the alfresco object factory parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
Note: The above code provides WSO2 Governance Registry’s AtomPub based URL: http://<IP Address>:9763/cmis/atom.
The following code segment creates a document called "My document" in the repository root.
// create session SessionFactory factory = SessionFactoryImpl.newInstance(); Session session = factory.getRepositories(parameter).get(0).createSession(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(PropertyIds.NAME, "My document"); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document"); // create document Document doc = session.getRootFolder().createDocument(properties, null, null);
Now you can browse this document using WSO2 Governance Registry.
Please check the managing resources section for more details. For more information you can follow documentation on the Alfresco site and Apache Chemistry OpenCMIS client examples.
Note: When developing please pay attention to Alfresco related items which do not have CMIS 1.0 compliance. For example: 'cm:description' and 'P:cm:titled' properties.
Â
Â