- Notifications
You must be signed in to change notification settings - Fork1
DocuShare jQuery - A jQuery-like wrapper for the DocuShare Java API
License
cityssm/dsJQuery
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An attempt to simplify theXerox DocuShare API by modeling after the familiarjQuery API.
Need to talk to DocuShare from a NodeJS application?
Check outthe related node-docushare project.
Be sure to include adsapi.jar
that corresponds to your DocuShare installation,available on theDocuShare Developer Network website.
Developed and tested against DocuShare 6.6.1.
try {// Initialize the DSJQuery Session Handler with connection informationDSJQuerySessionHandler.serverSetup(ds_serverName);DSJQuerySessionHandler.sessionSetup(ds_domain,ds_userName,ds_password);// Create a new DSJquery object and retrieve the root collectionDSJQuerydsjQuery_rootCollection =newDSJQuery("#Collection-111");// Retrieve all documents under the root collectionDSJQuerydsjQuery_documents =dsjQuery_rootCollection.find(".Document");dsjQuery_documents .print() .sortAsc_byAttribute("title") .print();}catch (Exceptione) {e.printStackTrace();}finally {// Close open DocuShare sessionsDSJQuerySessionHandler.closeOpenSessions();}
DSJQuerySessionHandler.serverSetup(String serverName, int serverPort);
DSJQuerySessionHandler.serverSetup(String serverName);
- Initializes the DSJQuery Session Handler with the DocuShare server details that should be used.
- REQUIRED BEFORE USE.
- Uses default port number 1099 if the shorthand method is used.
DSJQuerySessionHandler.sessionSetup(String userDomain, String userName, String password);
DSJQuerySessionHandler.sessionSetup(String userName, String password);
- Initializes the DSJQuery Session Handler with the DocuShare session details that should be used.
- REQUIRED BEFORE USE.
- Uses default domain name "DocuShare" if the shorthand method is used.
dsjQuery.find(String selector);
Searches beneath all collections for objects that match the given selector.
- Use
*
to select all child objects. - Use
.
to select by class.- i.e.
.Collection
,.Document
- i.e.
- Use
#
to select a specific object by handle.- i.e.
#Collection-111
- i.e.
dsjQuery.filter(String selector);
Reduces the set of matched objects to those that match the selector.
- Use
.
to filter by class. i.e..Collection
,.Document
- Use
[name='value']
to filter those objects with attributes equal to a given value.- i.e.
[locale='en']
- i.e.
- Use
[name^='value']
to filter those objects with attributes starting with a given value.- i.e.
[content_type^='image/']
- i.e.
- Use
[name$='value']
to filter those objects with attributes ending with a given value.- i.e.
[original_file_name$='.docx']
- i.e.
- Use
[name~='value']
to filter those objects with attributes containing a given value.- i.e.
[keywords~='logo']
- i.e.
Retrieve all documents under known collection.
DSJQuerydsjQuery_documents =newDSJQuery("#Collection-111").find(".Document");
Retrieve all PNG documents with the word 'Logo' in the title sorted with the newer files first.
DSJQuerydsjQuery_documents =newDSJQuery(".Document") .filter("[title~='Logo']") .filter("[content_type='image/png']") .sortAsc_byAttribute("create_date") .reverse();
If you are using dsJQuery to upload files, you may run into an exception similar to the one below.
com.xerox.docushare.content.ContentStoreException: Couldn't get a stream to remote file: C:\file.txt; nested exception is:java.rmi.ConnectException: Connection refused to host: 192.168.56.1; nested exception is:java.net.ConnectException: Connection refused: connect; nested exception is:com.xerox.docushare.DSContentElementException: Couldn't get a stream to remote file: C:\file.txt; nested exception is:java.rmi.ConnectException: Connection refused to host: 192.168.56.1; nested exception is:java.net.ConnectException: Connection refused: connect...
This happens when the remote method gets bound to an incorrect IP address.In my case, the IP address in the exception is associated with Virtualbox.
There are many ways to solve this.See this question on Stack Overflow.
Theanswer I chose explicitly sets thejava.rmi.server.hostname
property,before initializing the Session Handler.
System.setProperty("java.rmi.server.hostname",properNetworkIpAddress);try {DSJQuerySessionHandler.serverSetup(ds_serverName);DSJQuerySessionHandler.sessionSetup(ds_domain,ds_userName,ds_password);// ...}// ...
About
DocuShare jQuery - A jQuery-like wrapper for the DocuShare Java API