You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/12/29 18:57:30 UTC
svn commit: r1225607 [2/2] - in /chemistry/opencmis/trunk:
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/
chemistry-opencmis-client/chemistry-opencmis-client-binding...
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java?rev=1225607&r1=1225606&r2=1225607&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java Thu Dec 29 17:57:29 2011
@@ -18,6 +18,12 @@
*/
package org.apache.chemistry.opencmis.server.impl.browser;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_DEPTH;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_MAX_ITEMS;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_PROPERTY_DEFINITIONS;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_SKIP_COUNT;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_TRANSACTION;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_TYPE_ID;
import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
@@ -35,7 +41,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
import org.apache.chemistry.opencmis.commons.server.CallContext;
import org.apache.chemistry.opencmis.commons.server.CmisService;
@@ -75,17 +80,20 @@ public final class RepositoryService {
/**
* getRepositoryInfo.
*/
+ @SuppressWarnings("unchecked")
public static void getRepositoryInfo(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// execute
RepositoryInfo ri = service.getRepositoryInfo(repositoryId, null);
+
String repositoryUrl = BrowserBindingUtils.compileRepositoryUrl(request, ri.getId()).toString();
String rootUrl = BrowserBindingUtils.compileRootUrl(request, ri.getId()).toString();
- JSONObject jsonRi = JSONConverter.convert(ri, repositoryUrl, rootUrl);
+ JSONObject result = new JSONObject();
+ result.put(ri.getId(), JSONConverter.convert(ri, repositoryUrl, rootUrl));
response.setStatus(HttpServletResponse.SC_OK);
- BrowserBindingUtils.writeJSON(jsonRi, request, response);
+ BrowserBindingUtils.writeJSON(result, request, response);
}
/**
@@ -94,7 +102,7 @@ public final class RepositoryService {
public static void getLastResult(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
- String transaction = getStringParameter(request, BrowserBindingUtils.PARAM_TRANSACTION);
+ String transaction = getStringParameter(request, PARAM_TRANSACTION);
String cookieName = BrowserBindingUtils.getCookieName(transaction);
String cookieValue = null;
@@ -131,10 +139,10 @@ public final class RepositoryService {
public static void getTypeChildren(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// get parameters
- String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);
- boolean includePropertyDefinitions = getBooleanParameter(request, Constants.PARAM_PROPERTY_DEFINITIONS, false);
- BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
- BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
+ String typeId = getStringParameter(request, PARAM_TYPE_ID);
+ boolean includePropertyDefinitions = getBooleanParameter(request, PARAM_PROPERTY_DEFINITIONS, false);
+ BigInteger maxItems = getBigIntegerParameter(request, PARAM_MAX_ITEMS);
+ BigInteger skipCount = getBigIntegerParameter(request, PARAM_SKIP_COUNT);
// execute
TypeDefinitionList typeList = service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
@@ -149,9 +157,9 @@ public final class RepositoryService {
public static void getTypeDescendants(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// get parameters
- String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);
- BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
- boolean includePropertyDefinitions = getBooleanParameter(request, Constants.PARAM_PROPERTY_DEFINITIONS, false);
+ String typeId = getStringParameter(request, PARAM_TYPE_ID);
+ BigInteger depth = getBigIntegerParameter(request, PARAM_DEPTH);
+ boolean includePropertyDefinitions = getBooleanParameter(request, PARAM_PROPERTY_DEFINITIONS, false);
// execute
List<TypeDefinitionContainer> typeTree = service.getTypeDescendants(repositoryId, typeId, depth,
@@ -173,7 +181,7 @@ public final class RepositoryService {
public static void getTypeDefinition(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// get parameters
- String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);
+ String typeId = getStringParameter(request, PARAM_TYPE_ID);
// execute
TypeDefinition type = service.getTypeDefinition(repositoryId, typeId, null);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java?rev=1225607&r1=1225606&r2=1225607&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java Thu Dec 29 17:57:29 2011
@@ -22,11 +22,11 @@ import static org.apache.chemistry.openc
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_CHECKIN_COMMENT;
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_FILTER;
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_MAJOR;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_TRANSACTION;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CONTENT;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_OBJECT_ID;
-import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.PARAM_TRANSACTION;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createAddAcl;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createContentStream;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createCookieValue;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/webapp/WEB-INF/web.xml?rev=1225607&r1=1225606&r2=1225607&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/webapp/WEB-INF/web.xml (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/webapp/WEB-INF/web.xml Thu Dec 29 17:57:29 2011
@@ -86,7 +86,6 @@
</servlet>
<!-- Browser Binding is deactivated until the implementation is complete. -->
- <!--
<servlet>
<servlet-name>cmisbrowser</servlet-name>
<servlet-class>org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet</servlet-class>
@@ -96,7 +95,6 @@
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
- -->
<servlet-mapping>
<servlet-name>cmisws</servlet-name>
@@ -109,12 +107,10 @@
</servlet-mapping>
<!-- Browser Binding is deactivated until the implementation is complete. -->
- <!--
<servlet-mapping>
<servlet-name>cmisbrowser</servlet-name>
<url-pattern>/browser/*</url-pattern>
</servlet-mapping>
- -->
<session-config>
<session-timeout>60</session-timeout>
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java?rev=1225607&r1=1225606&r2=1225607&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java Thu Dec 29 17:57:29 2011
@@ -82,6 +82,7 @@ public class LoginDialog extends JDialog
private JTextField urlField;
private JRadioButton bindingAtomButton;
private JRadioButton bindingWebServicesButton;
+ private JRadioButton bindingBrowserButton;
private JTextField usernameField;
private JPasswordField passwordField;
private JRadioButton authenticationNoneButton;
@@ -306,15 +307,22 @@ public class LoginDialog extends JDialog
private void createBindingButtons(Container pane) {
JPanel bindingContainer = new JPanel();
bindingContainer.setLayout(new BoxLayout(bindingContainer, BoxLayout.LINE_AXIS));
- boolean atom = (System.getProperty(SYSPROP_BINDING, "atom").toLowerCase().charAt(0) == 'a');
+ char bc = System.getProperty(SYSPROP_BINDING, "atom").toLowerCase().charAt(0);
+ boolean atom = (bc == 'a');
+ boolean ws = (bc == 'w');
+ boolean browser = (bc == 'b');
bindingAtomButton = new JRadioButton("AtomPub", atom);
- bindingWebServicesButton = new JRadioButton("Web Services", !atom);
+ bindingWebServicesButton = new JRadioButton("Web Services", ws);
+ bindingBrowserButton = new JRadioButton("Browser (experimental)", browser);
ButtonGroup bindingGroup = new ButtonGroup();
bindingGroup.add(bindingAtomButton);
bindingGroup.add(bindingWebServicesButton);
+ bindingGroup.add(bindingBrowserButton);
bindingContainer.add(bindingAtomButton);
bindingContainer.add(Box.createRigidArea(new Dimension(10, 0)));
bindingContainer.add(bindingWebServicesButton);
+ bindingContainer.add(Box.createRigidArea(new Dimension(10, 0)));
+ bindingContainer.add(bindingBrowserButton);
JLabel bindingLabel = new JLabel("Binding:", JLabel.TRAILING);
pane.add(bindingLabel);
@@ -460,7 +468,14 @@ public class LoginDialog extends JDialog
private Map<String, String> createBasicSessionParameters() {
String url = urlField.getText();
- BindingType binding = bindingAtomButton.isSelected() ? BindingType.ATOMPUB : BindingType.WEBSERVICES;
+
+ BindingType binding = BindingType.ATOMPUB;
+ if (bindingWebServicesButton.isSelected()) {
+ binding = BindingType.WEBSERVICES;
+ } else if (bindingBrowserButton.isSelected()) {
+ binding = BindingType.BROWSER;
+ }
+
String username = usernameField.getText();
String password = new String(passwordField.getPassword());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java?rev=1225607&r1=1225606&r2=1225607&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java Thu Dec 29 17:57:29 2011
@@ -106,7 +106,8 @@ public class ClientSession {
boolean cookies) {
Map<String, String> parameters = new LinkedHashMap<String, String>();
- if (binding == BindingType.WEBSERVICES) {
+ switch (binding) {
+ case WEBSERVICES:
parameters.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());
parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url);
parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url);
@@ -117,9 +118,17 @@ public class ClientSession {
parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url);
parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url);
parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url);
- } else {
+ break;
+ case ATOMPUB:
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameters.put(SessionParameter.ATOMPUB_URL, url);
+ break;
+ case BROWSER:
+ parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());
+ parameters.put(SessionParameter.BROWSER_URL, url);
+ break;
+ default:
+ parameters.put(SessionParameter.BINDING_TYPE, BindingType.CUSTOM.value());
}
switch (authentication) {