001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (C) Alkacon Software (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.cmis; 029 030import java.io.File; 031import java.math.BigInteger; 032 033import org.apache.chemistry.opencmis.commons.enums.CmisVersion; 034import org.apache.chemistry.opencmis.commons.server.CallContext; 035import org.apache.chemistry.opencmis.commons.server.ObjectInfoHandler; 036 037/** 038 * Call context implementation which delegates most methods to a wrapped call context, but also provides additional functionality.<p> 039 */ 040public class CmsCmisCallContext implements CallContext { 041 042 /** The wrapped call context. */ 043 private CallContext m_context; 044 045 /** The object info handler. */ 046 private ObjectInfoHandler m_objectInfo; 047 048 /** 049 * Creates a new instance.<p> 050 * 051 * @param originalContext the context to wrap 052 * @param objectInfo the object info handler to use 053 */ 054 public CmsCmisCallContext(CallContext originalContext, ObjectInfoHandler objectInfo) { 055 056 m_context = originalContext; 057 m_objectInfo = objectInfo; 058 } 059 060 public boolean encryptTempFiles() { 061 062 return false; 063 } 064 065 /** 066 * @see org.apache.chemistry.opencmis.commons.server.CallContext#get(java.lang.String) 067 */ 068 public Object get(String attr) { 069 070 return m_context.get(attr); 071 } 072 073 /** 074 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getBinding() 075 */ 076 public String getBinding() { 077 078 return m_context.getBinding(); 079 } 080 081 public CmisVersion getCmisVersion() { 082 083 // TODO Auto-generated method stub 084 return null; 085 } 086 087 /** 088 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getLength() 089 */ 090 public BigInteger getLength() { 091 092 return m_context.getLength(); 093 } 094 095 /** 096 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getLocale() 097 */ 098 public String getLocale() { 099 100 return m_context.getLocale(); 101 } 102 103 public long getMaxContentSize() { 104 105 return Integer.MAX_VALUE; 106 } 107 108 /** 109 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getMemoryThreshold() 110 */ 111 public int getMemoryThreshold() { 112 113 return m_context.getMemoryThreshold(); 114 } 115 116 /** 117 * The object info handler to use.<p> 118 * 119 * @return the object info handler 120 */ 121 public ObjectInfoHandler getObjectInfoHandler() { 122 123 return m_objectInfo; 124 } 125 126 /** 127 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getOffset() 128 */ 129 public BigInteger getOffset() { 130 131 return m_context.getOffset(); 132 } 133 134 /** 135 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getPassword() 136 */ 137 public String getPassword() { 138 139 return m_context.getPassword(); 140 } 141 142 /** 143 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getRepositoryId() 144 */ 145 public String getRepositoryId() { 146 147 return m_context.getRepositoryId(); 148 } 149 150 /** 151 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getTempDirectory() 152 */ 153 public File getTempDirectory() { 154 155 return m_context.getTempDirectory(); 156 } 157 158 /** 159 * @see org.apache.chemistry.opencmis.commons.server.CallContext#getUsername() 160 */ 161 public String getUsername() { 162 163 return m_context.getUsername(); 164 } 165 166 /** 167 * @see org.apache.chemistry.opencmis.commons.server.CallContext#isObjectInfoRequired() 168 */ 169 public boolean isObjectInfoRequired() { 170 171 return m_context.isObjectInfoRequired(); 172 } 173 174}