This project has retired. For details please refer to its Attic page.
CallContextImpl 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;
20  
21  import java.io.File;
22  import java.math.BigInteger;
23  import java.util.HashMap;
24  import java.util.Map;
25  
26  import org.apache.chemistry.opencmis.commons.server.CallContext;
27  
28  /**
29   * Implementation of the {@link CallContext} interface.
30   */
31  public class CallContextImpl implements CallContext {
32  
33      private final String binding;
34      private final boolean objectInfoRequired;
35      private final Map<String, Object> parameter = new HashMap<String, Object>();
36  
37      public CallContextImpl(String binding, String repositoryId, boolean objectInfoRequired) {
38          this.binding = binding;
39          this.objectInfoRequired = objectInfoRequired;
40          put(REPOSITORY_ID, repositoryId);
41      }
42  
43      public String getBinding() {
44          return binding;
45      }
46  
47      public boolean isObjectInfoRequired() {
48          return objectInfoRequired;
49      }
50  
51      public Object get(String key) {
52          return parameter.get(key);
53      }
54  
55      public String getRepositoryId() {
56          return (String) get(REPOSITORY_ID);
57      }
58  
59      public String getUsername() {
60          return (String) get(USERNAME);
61      }
62  
63      public String getPassword() {
64          return (String) get(PASSWORD);
65      }
66  
67      public String getLocale() {
68          return (String) get(LOCALE);
69      }
70  
71      public BigInteger getOffset() {
72          return (BigInteger) get(OFFSET);
73      }
74  
75      public BigInteger getLength() {
76          return (BigInteger) get(LENGTH);
77      }
78  
79      public File getTempDirectory() {
80          return (File) get(TEMP_DIR);
81      }
82  
83      public int getMemoryThreshold() {
84          return (Integer) get(MEMORY_THRESHOLD);
85      }
86  
87      /**
88       * Adds a parameter.
89       */
90      public void put(String key, Object value) {
91          parameter.put(key, value);
92      }
93  
94      /**
95       * Removes a parameter.
96       */
97      public Object remove(String key) {
98          return parameter.remove(key);
99      }
100 }