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.commons.server; 20 21 import java.io.File; 22 import java.math.BigInteger; 23 24 /** 25 * An object implementing this interface holds context data of the current call. 26 */ 27 public interface CallContext { 28 29 String BINDING_ATOMPUB = "atompub"; 30 String BINDING_WEBSERVICES = "webservices"; 31 String BINDING_BROWSER = "browser"; 32 String BINDING_LOCAL = "local"; 33 34 String REPOSITORY_ID = "repositoryId"; 35 String USERNAME = "username"; 36 String PASSWORD = "password"; 37 String LOCALE = "locale"; 38 String OFFSET = "offset"; 39 String LENGTH = "length"; 40 String LOCALE_ISO639_LANGUAGE = "language"; 41 String LOCALE_ISO3166_COUNTRY = "country"; 42 43 String SERVLET_CONTEXT = "servletContext"; 44 String HTTP_SERVLET_REQUEST = "httpServletRequest"; 45 String HTTP_SERVLET_RESPONSE = "httpServletResponse"; 46 47 String TEMP_DIR = "tempDir"; 48 String MEMORY_THRESHOLD = "memoryThreshold"; 49 50 /** 51 * Returns the binding. Usually it returns 52 * {@link CallContext#BINDING_ATOMPUB}, 53 * {@link CallContext#BINDING_WEBSERVICES}, 54 * {@link CallContext#BINDING_BROWSER} or {@link CallContext#BINDING_LOCAL}. 55 */ 56 String getBinding(); 57 58 /** 59 * Returns if <code>true</code> object infos can improve the performance. 60 */ 61 boolean isObjectInfoRequired(); 62 63 /** 64 * Returns context data by key. 65 * 66 * @param key 67 * the key 68 * @return the data if the key is valid, <code>null</code> otherwise 69 */ 70 Object get(String key); 71 72 /** 73 * Returns the repository id. 74 */ 75 String getRepositoryId(); 76 77 /** 78 * Returns the user name. 79 */ 80 String getUsername(); 81 82 /** 83 * Returns the password. 84 */ 85 String getPassword(); 86 87 /** 88 * Returns the locale. 89 */ 90 String getLocale(); 91 92 /** 93 * Returns the content offset if set, <code>null</code> otherwise 94 */ 95 BigInteger getOffset(); 96 97 /** 98 * Returns the content length if set, <code>null</code> otherwise 99 */ 100 BigInteger getLength(); 101 102 /** 103 * Returns the temp directory. 104 */ 105 File getTempDirectory(); 106 107 /** 108 * Returns the memory threshold. 109 */ 110 int getMemoryThreshold(); 111 }