Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 453CED8A4 for ; Tue, 28 May 2013 07:24:20 +0000 (UTC) Received: (qmail 81780 invoked by uid 500); 28 May 2013 07:24:14 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 79958 invoked by uid 500); 28 May 2013 07:24:07 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 79266 invoked by uid 99); 28 May 2013 07:24:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2013 07:24:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2013 07:23:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9B9CF2388C6D; Tue, 28 May 2013 07:21:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1486787 [30/40] - in /chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings: ./ css/ images/ images/logos/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/chemistry/... Date: Tue, 28 May 2013 07:21:44 -0000 To: commits@chemistry.apache.org From: gabriele@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130528072151.9B9CF2388C6D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/SimpleTokenHandlerSessionHelper.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/SimpleTokenHandlerSessionHelper.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/SimpleTokenHandlerSessionHelper.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/SimpleTokenHandlerSessionHelper.html Tue May 28 07:21:41 2013 @@ -0,0 +1,340 @@ + + + + +SimpleTokenHandlerSessionHelper xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.impl.browser.token;
+20  
+21  import java.net.URL;
+22  import java.security.SecureRandom;
+23  
+24  import javax.servlet.http.HttpServletRequest;
+25  import javax.servlet.http.HttpSession;
+26  
+27  public class SimpleTokenHandlerSessionHelper {
+28  
+29      public static final String ATTR_CMIS_USER = "cmis-token.user";
+30      public static final String ATTR_CMIS_AUTH_TIMESTAMP = "cmis-token.timestamp";
+31      public static final String ATTR_CMIS_TOKEN = "cmis-token.token";
+32      public static final String ATTR_CMIS_LOGIN_KEY = "cmis-token.token.loginkey";
+33      public static final String ATTR_CMIS_FORM_KEY = "cmis-token.formkey";
+34      public static final String ATTR_CMIS_APP_URL = "cmis-token.appurl";
+35      public static final String ATTR_CMIS_APP_KEY = "cmis-token.appkey";
+36  
+37      public static final String ATTR_SEPARATOR = "\n";
+38  
+39      public static final String PARAM_KEY = "key";
+40      public static final String PARAM_TOKEN = "token";
+41      public static final String PARAM_URL = "url";
+42      public static final String PARAM_USER = "user";
+43      public static final String PARAM_PASSWORD = "password";
+44      public static final String PARAM_TRUSTAPP = "trustapp";
+45  
+46      public static final int APP_ID_BYTES = 10;
+47      public static final int APP_ID_LENGTH = APP_ID_BYTES * 2;
+48      public static final int KEY_BYTES = 20;
+49      public static final int KEY_LENGTH = KEY_BYTES * 2;
+50  
+51      public static String getApplicationIdFromKey(String key) {
+52          if (key == null || key.length() != APP_ID_LENGTH + KEY_LENGTH) {
+53              return null;
+54          }
+55  
+56          return key.substring(0, APP_ID_LENGTH);
+57      }
+58  
+59      public static String getLoginKey(HttpServletRequest request, String appId) {
+60          HttpSession hs = request.getSession(false);
+61          if (hs == null) {
+62              return null;
+63          }
+64  
+65          return (String) hs.getAttribute(ATTR_CMIS_LOGIN_KEY + appId);
+66      }
+67  
+68      public static void setLoginKey(HttpServletRequest request, String loginKey, String formKey, URL appURL) {
+69          HttpSession hs = request.getSession();
+70  
+71          String appId = getApplicationIdFromKey(loginKey);
+72  
+73          hs.setAttribute(ATTR_CMIS_LOGIN_KEY + appId, loginKey);
+74          hs.setAttribute(ATTR_CMIS_FORM_KEY + appId, formKey);
+75          hs.setAttribute(ATTR_CMIS_APP_URL + appId, appURL);
+76      }
+77  
+78      public static boolean checkLoginKey(HttpServletRequest request) {
+79          HttpSession hs = request.getSession(false);
+80          if (hs == null) {
+81              return false;
+82          }
+83  
+84          String key = getKey(request);
+85  
+86          if (key == null) {
+87              return false;
+88          }
+89  
+90          String appId = getApplicationIdFromKey(key);
+91          if (appId == null) {
+92              return false;
+93          }
+94  
+95          return key.equals(hs.getAttribute(ATTR_CMIS_LOGIN_KEY + appId));
+96      }
+97  
+98      public static void removeLoginKey(HttpServletRequest request, String appId) {
+99          HttpSession hs = request.getSession(false);
+100         if (hs == null) {
+101             return;
+102         }
+103 
+104         hs.removeAttribute(ATTR_CMIS_LOGIN_KEY + appId);
+105     }
+106 
+107     public static boolean checkFormKey(HttpServletRequest request) {
+108         HttpSession hs = request.getSession(false);
+109         if (hs == null) {
+110             return false;
+111         }
+112 
+113         String formKey = getKey(request);
+114 
+115         if (formKey == null) {
+116             return false;
+117         }
+118 
+119         String appId = getApplicationIdFromKey(formKey);
+120         if (appId == null) {
+121             return false;
+122         }
+123 
+124         return formKey.equals(hs.getAttribute(ATTR_CMIS_FORM_KEY + appId));
+125     }
+126 
+127     public static void removeFormKey(HttpServletRequest request, String appId) {
+128         HttpSession hs = request.getSession(false);
+129         if (hs == null) {
+130             return;
+131         }
+132 
+133         hs.removeAttribute(ATTR_CMIS_FORM_KEY + appId);
+134     }
+135 
+136     public static String getUser(HttpServletRequest request, String appId) {
+137         HttpSession hs = request.getSession(false);
+138         if (hs == null) {
+139             return null;
+140         }
+141 
+142         return (String) hs.getAttribute(ATTR_CMIS_USER + appId);
+143     }
+144 
+145     public static void setUser(HttpServletRequest request, String appId, String user) {
+146         HttpSession hs = request.getSession(false);
+147         if (hs == null) {
+148             return;
+149         }
+150 
+151         hs.setAttribute(ATTR_CMIS_USER + appId, user);
+152         hs.setAttribute(ATTR_CMIS_AUTH_TIMESTAMP + appId, System.currentTimeMillis());
+153     }
+154 
+155     public static String getApplicationKey(HttpServletRequest request, String appId) {
+156         HttpSession hs = request.getSession(false);
+157         if (hs == null) {
+158             return null;
+159         }
+160 
+161         return (String) hs.getAttribute(ATTR_CMIS_APP_KEY + appId);
+162     }
+163 
+164     public static void setApplicationKey(HttpServletRequest request, String key) {
+165         HttpSession hs = request.getSession();
+166 
+167         String appId = getApplicationIdFromKey(key);
+168 
+169         hs.setAttribute(ATTR_CMIS_APP_KEY + appId, key);
+170     }
+171 
+172     public static boolean checkApplicationKey(HttpServletRequest request) {
+173         HttpSession hs = request.getSession(false);
+174         if (hs == null) {
+175             return false;
+176         }
+177 
+178         String key = getKey(request);
+179 
+180         if (key == null) {
+181             return false;
+182         }
+183 
+184         String appId = getApplicationIdFromKey(key);
+185         if (appId == null) {
+186             return false;
+187         }
+188 
+189         return key.equals(hs.getAttribute(ATTR_CMIS_APP_KEY + appId));
+190     }
+191 
+192     public static void removeApplicationKey(HttpServletRequest request, String appId) {
+193         HttpSession hs = request.getSession(false);
+194         if (hs == null) {
+195             return;
+196         }
+197 
+198         hs.removeAttribute(ATTR_CMIS_APP_KEY + appId);
+199         hs.removeAttribute(ATTR_CMIS_APP_URL + appId);
+200         hs.removeAttribute(ATTR_CMIS_USER + appId);
+201         hs.removeAttribute(ATTR_CMIS_AUTH_TIMESTAMP + appId);
+202     }
+203 
+204     public static URL getApplicationURL(HttpServletRequest request, String appId) {
+205         HttpSession hs = request.getSession(false);
+206         if (hs == null) {
+207             return null;
+208         }
+209 
+210         return (URL) hs.getAttribute(ATTR_CMIS_APP_URL + appId);
+211     }
+212 
+213     /**
+214      * Retrieves the token from the requests and tests if this token belongs to
+215      * the current session. If the token is associated with the session, the
+216      * token will be removed from the session and cannot be reused again.
+217      * 
+218      * @return <code>true</code> if the request contains a token and this token
+219      *         belongs to the session, <code>false</code> otherwise
+220      */
+221     public static boolean testAndInvalidateToken(HttpServletRequest request) {
+222         HttpSession hs = request.getSession(false);
+223         if (hs == null) {
+224             return false;
+225         }
+226 
+227         String token = getToken(request);
+228 
+229         if (token == null) {
+230             return false;
+231         }
+232 
+233         String tokenKey = ATTR_CMIS_TOKEN + token;
+234 
+235         Long tokenCreationTimestamp = (Long) hs.getAttribute(tokenKey);
+236         if (tokenCreationTimestamp != null) {
+237             // if the token exists, remove it
+238             hs.removeAttribute(tokenKey);
+239 
+240             // PARANOIA: don't accept tokens that are older than 8 hours
+241             return System.currentTimeMillis() - tokenCreationTimestamp < 8 * 60 * 60 * 1000;
+242         }
+243 
+244         return false;
+245     }
+246 
+247     /**
+248      * Adds a token to the session.
+249      */
+250     public static void addToken(HttpServletRequest request, String token) {
+251         HttpSession hs = request.getSession();
+252 
+253         String tokenKey = ATTR_CMIS_TOKEN + token;
+254 
+255         // set the token and retain creation timestamp
+256         hs.setAttribute(tokenKey, System.currentTimeMillis());
+257     }
+258 
+259     /**
+260      * Gets the key parameter from the request and checks its validity.
+261      */
+262     public static String getKey(HttpServletRequest request) {
+263         String key = request.getParameter(PARAM_KEY);
+264         return normalizeKey(key);
+265     }
+266 
+267     /**
+268      * Gets the domain parameter from the request and checks its validity.
+269      */
+270     public static String getToken(HttpServletRequest request) {
+271         String token = request.getParameter(PARAM_TOKEN);
+272         return normalizeKey(token);
+273     }
+274 
+275     public static String normalizeKey(String key) {
+276         if (key == null) {
+277             return null;
+278         }
+279 
+280         key = key.trim();
+281 
+282         if (key.length() != APP_ID_LENGTH + KEY_LENGTH || !key.matches("^[0-9a-f]+$")) {
+283             return null;
+284         }
+285 
+286         return key;
+287     }
+288 
+289     public static String generateAppId() {
+290         SecureRandom random = new SecureRandom();
+291 
+292         byte[] bytes = new byte[APP_ID_BYTES];
+293         random.nextBytes(bytes);
+294 
+295         StringBuilder sb = new StringBuilder();
+296 
+297         for (byte b : bytes) {
+298             String s = Integer.toHexString(b & 0xff);
+299             if (s.length() < 2) {
+300                 sb.append('0');
+301             }
+302             sb.append(s);
+303         }
+304 
+305         return sb.toString();
+306     }
+307 
+308     public static String generateKey(String appId) {
+309         SecureRandom random = new SecureRandom();
+310 
+311         byte[] bytes = new byte[KEY_BYTES];
+312         random.nextBytes(bytes);
+313 
+314         StringBuilder sb = new StringBuilder(appId);
+315 
+316         for (byte b : bytes) {
+317             String s = Integer.toHexString(b & 0xff);
+318             if (s.length() < 2) {
+319                 sb.append('0');
+320             }
+321             sb.append(s);
+322         }
+323 
+324         return sb.toString();
+325     }
+326 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenCallContextHandler.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenCallContextHandler.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenCallContextHandler.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenCallContextHandler.html Tue May 28 07:21:41 2013 @@ -0,0 +1,100 @@ + + + + +TokenCallContextHandler xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.impl.browser.token;
+20  
+21  import java.util.HashMap;
+22  import java.util.Map;
+23  
+24  import javax.servlet.ServletContext;
+25  import javax.servlet.http.HttpServletRequest;
+26  import javax.servlet.http.HttpServletResponse;
+27  
+28  import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
+29  import org.apache.chemistry.opencmis.commons.impl.Constants;
+30  import org.apache.chemistry.opencmis.commons.server.CallContext;
+31  import org.apache.chemistry.opencmis.server.shared.BasicAuthCallContextHandler;
+32  import org.apache.chemistry.opencmis.server.shared.HttpUtils;
+33  
+34  public class TokenCallContextHandler extends BasicAuthCallContextHandler implements TokenHandler {
+35  
+36      private static final long serialVersionUID = 1L;
+37  
+38      private final TokenHandler tokenHandler;
+39  
+40      /**
+41       * Constructor.
+42       */
+43      public TokenCallContextHandler() {
+44          tokenHandler = new SimpleTokenHandler();
+45      }
+46  
+47      public Map<String, String> getCallContextMap(HttpServletRequest request) {
+48          Map<String, String> result = new HashMap<String, String>();
+49  
+50          Map<String, String> basicAuthMap = super.getCallContextMap(request);
+51          if (basicAuthMap != null && !basicAuthMap.isEmpty()) {
+52              result.putAll(basicAuthMap);
+53          }
+54  
+55          // lastResult must always provide an old token
+56          // -> don't check the token
+57          boolean isLastResultRequest = "lastresult".equalsIgnoreCase(HttpUtils.getStringParameter(request,
+58                  Constants.PARAM_SELECTOR));
+59  
+60          if (!isLastResultRequest) {
+61              // if a token is provided, check it
+62              if (request.getParameter(Constants.PARAM_TOKEN) != null) {
+63                  if (SimpleTokenHandlerSessionHelper.testAndInvalidateToken(request)) {
+64                      String token = SimpleTokenHandlerSessionHelper.getToken(request);
+65                      String appId = SimpleTokenHandlerSessionHelper.getApplicationIdFromKey(token);
+66                      result.put(CallContext.USERNAME, SimpleTokenHandlerSessionHelper.getUser(request, appId));
+67                      result.put(CallContext.PASSWORD, null);
+68                  } else {
+69                      throw new CmisPermissionDeniedException("Invalid token!");
+70                  }
+71              }
+72  
+73              if (!result.containsKey(CallContext.USERNAME)) {
+74                  // neither basic authentication nor token authentication have
+75                  // returned a username -> reject request
+76                  throw new CmisPermissionDeniedException("No authentication!");
+77              }
+78          }
+79  
+80          return result;
+81      }
+82  
+83      public void service(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) {
+84          tokenHandler.service(servletContext, request, response);
+85      }
+86  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenHandler.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenHandler.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenHandler.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/TokenHandler.html Tue May 28 07:21:41 2013 @@ -0,0 +1,42 @@ + + + + +TokenHandler xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.impl.browser.token;
+20  
+21  import javax.servlet.ServletContext;
+22  import javax.servlet.http.HttpServletRequest;
+23  import javax.servlet.http.HttpServletResponse;
+24  
+25  public interface TokenHandler {
+26  
+27      void service(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response);
+28  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-frame.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-frame.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-frame.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-frame.html Tue May 28 07:21:41 2013 @@ -0,0 +1,39 @@ + + + + + + OpenCMIS Server Implementation 0.9.0 Reference Package org.apache.chemistry.opencmis.server.impl.browser.token + + + + +

+ org.apache.chemistry.opencmis.server.impl.browser.token +

+ +

Classes

+ + + + + \ No newline at end of file Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-summary.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-summary.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-summary.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/browser/token/package-summary.html Tue May 28 07:21:41 2013 @@ -0,0 +1,92 @@ + + + + + + OpenCMIS Server Implementation 0.9.0 Reference Package org.apache.chemistry.opencmis.server.impl.browser.token + + + +
+ +
+
+ +
+ +

Package org.apache.chemistry.opencmis.server.impl.browser.token

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ AbstractSimpleTokenHandler +
+ SimpleTokenHandler +
+ SimpleTokenHandlerSessionHelper +
+ TokenCallContextHandler +
+ TokenHandler +
+ UrlServiceCall +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.html Tue May 28 07:21:41 2013 @@ -0,0 +1,128 @@ + + + + +DummyService xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.impl.dummy;
+20  
+21  import java.math.BigInteger;
+22  import java.util.Collections;
+23  import java.util.List;
+24  
+25  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
+26  import org.apache.chemistry.opencmis.commons.data.ObjectData;
+27  import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
+28  import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
+29  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+30  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+31  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
+32  import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+33  import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+34  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+35  import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
+36  import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
+37  
+38  /**
+39   * Simplest Repository Service implementation.
+40   */
+41  public class DummyService extends AbstractCmisService {
+42  
+43      private final RepositoryInfoImpl fRepInfo;
+44  
+45      public DummyService(String id, String name) {
+46          fRepInfo = new RepositoryInfoImpl();
+47  
+48          fRepInfo.setId(id);
+49          fRepInfo.setName(name);
+50          fRepInfo.setDescription(name);
+51          fRepInfo.setCmisVersionSupported("1.0");
+52          fRepInfo.setRootFolder("root");
+53  
+54          fRepInfo.setVendorName("OpenCMIS");
+55          fRepInfo.setProductName("OpenCMIS Server");
+56          fRepInfo.setProductVersion("1.0");
+57      }
+58  
+59      @Override
+60      public RepositoryInfo getRepositoryInfo(String repositoryId,
+61              ExtensionsData extension) {
+62          if (!fRepInfo.getId().equals(repositoryId)) {
+63              throw new CmisObjectNotFoundException(
+64                      "A repository with repository id '" + repositoryId
+65                              + "' does not exist!");
+66          }
+67  
+68          return fRepInfo;
+69      }
+70  
+71      @Override
+72      public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
+73          return Collections.singletonList((RepositoryInfo) fRepInfo);
+74      }
+75  
+76      @Override
+77      public ObjectInFolderList getChildren(String repositoryId, String folderId,
+78              String filter, String orderBy, Boolean includeAllowableActions,
+79              IncludeRelationships includeRelationships, String renditionFilter,
+80              Boolean includePathSegment, BigInteger maxItems,
+81              BigInteger skipCount, ExtensionsData extension) {
+82          throw new CmisNotSupportedException();
+83      }
+84  
+85      @Override
+86      public ObjectData getObject(String repositoryId, String objectId,
+87              String filter, Boolean includeAllowableActions,
+88              IncludeRelationships includeRelationships, String renditionFilter,
+89              Boolean includePolicyIds, Boolean includeAcl,
+90              ExtensionsData extension) {
+91          throw new CmisNotSupportedException();
+92      }
+93  
+94      @Override
+95      public List<ObjectParentData> getObjectParents(String repositoryId,
+96              String objectId, String filter, Boolean includeAllowableActions,
+97              IncludeRelationships includeRelationships, String renditionFilter,
+98              Boolean includeRelativePathSegment, ExtensionsData extension) {
+99          throw new CmisNotSupportedException();
+100     }
+101 
+102     @Override
+103     public TypeDefinitionList getTypeChildren(String repositoryId,
+104             String typeId, Boolean includePropertyDefinitions,
+105             BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+106         throw new CmisNotSupportedException();
+107     }
+108 
+109     @Override
+110     public TypeDefinition getTypeDefinition(String repositoryId, String typeId,
+111             ExtensionsData extension) {
+112         throw new CmisNotSupportedException();
+113     }
+114 }
+
+
+ +