This project has retired. For details please refer to its Attic page.
DummyCallContext xref

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   *
20   */
21  package org.apache.chemistry.opencmis.inmemory;
22  
23  import java.io.File;
24  import java.math.BigInteger;
25  import java.util.HashMap;
26  import java.util.Map;
27  
28  import org.apache.chemistry.opencmis.commons.server.CallContext;
29  
30  public class DummyCallContext implements CallContext {
31      private final Map<String, Object> fParameter = new HashMap<String, Object>();
32  
33      public DummyCallContext() {
34          fParameter.put(USERNAME, "Admin");
35          fParameter.put(PASSWORD, "secret");
36          fParameter.put(LOCALE, "en");
37      }
38  
39      public DummyCallContext(String principalId) {
40          fParameter.put(USERNAME, principalId);
41          fParameter.put(PASSWORD, "secret");
42          fParameter.put(LOCALE, "en");
43      }
44  
45      public boolean isObjectInfoRequired() {
46          return false;
47      }
48  
49      public Object get(String key) {
50          return fParameter.get(key);
51      }
52  
53      public String getBinding() {
54          return BINDING_ATOMPUB;
55      }
56  
57      public String getRepositoryId() {
58          return (String) get(REPOSITORY_ID);
59      }
60  
61      public String getLocale() {
62          return (String) get(LOCALE);
63      }
64  
65      public BigInteger getOffset() {
66          return (BigInteger) get(OFFSET);
67      }
68  
69      public BigInteger getLength() {
70          return (BigInteger) get(LENGTH);
71      }
72  
73      public String getPassword() {
74          return (String) get(PASSWORD);
75      }
76  
77      public String getUsername() {
78          return (String) get(USERNAME);
79      }
80  
81      public void put(String key, String value) {
82          fParameter.put(key, value);
83      }
84  
85      public File getTempDirectory() {
86          return null;
87      }
88  
89      public int getMemoryThreshold() {
90          return 4 * 1024 * 1024;
91      }
92  }