本文整理汇总了Java中org.apache.chemistry.opencmis.commons.server.CallContext类的典型用法代码示例。如果您正苦于以下问题:Java CallContext类的具体用法?Java CallContext怎么用?Java CallContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallContext类属于org.apache.chemistry.opencmis.commons.server包,在下文中一共展示了CallContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFolder
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS createFolder.
*/
public String createFolder(CallContext context, Properties properties, String folderId) {
checkUser(context, true);
// check properties
checkNewProperties(properties, BaseTypeId.CMIS_FOLDER);
// get parent File
File parent = getFile(folderId);
if (!parent.isDirectory()) {
throw new CmisObjectNotFoundException("Parent is not a folder!");
}
// create the folder
String name = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
File newFolder = new File(parent, name);
if (!newFolder.mkdir()) {
throw new CmisStorageException("Could not create folder!");
}
return getId(newFolder);
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:25,代码来源:FileBridgeRepository.java
示例2: withCmisService
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
private <T extends Object> T withCmisService(CmisServiceCallback<T> callback, CmisVersion cmisVersion)
{
CmisService cmisService = null;
try
{
CallContext context = new SimpleCallContext("admin", "admin", cmisVersion);
cmisService = factory.getService(context);
T ret = callback.execute(cmisService);
return ret;
}
finally
{
if(cmisService != null)
{
cmisService.close();
}
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:CMISTest.java
示例3: create
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* Create* dispatch for AtomPub.
*/
public ObjectData create(CallContext context, Properties properties, String folderId, ContentStream contentStream,
VersioningState versioningState, ObjectInfoHandler objectInfos) {
log.debug("create({}, {})", properties, folderId);
String typeId = getTypeId(properties);
TypeDefinition type = types.getType(typeId);
if (type == null) {
throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
}
String objectId = null;
if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
objectId = createDocument(context, properties, folderId, contentStream, versioningState);
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
objectId = createFolder(context, properties, folderId);
} else {
throw new CmisObjectNotFoundException("Cannot create object of type '" + typeId + "'!");
}
return compileObjectType(context, getNode(objectId), null, false, false, objectInfos);
}
开发者ID:openkm,项目名称:document-management-system,代码行数:25,代码来源:CmisRepository.java
示例4: getObjectByPath
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS getObjectByPath.
*/
public ObjectData getObjectByPath(CallContext context, String folderPath, String filter, boolean includeAllowableActions,
boolean includeACL, ObjectInfoHandler objectInfos) {
log.debug("getObjectByPath({}, {}, {})", new Object[]{folderPath, filter, includeAllowableActions});
// split filter
Set<String> filterCollection = splitFilter(filter);
// check path
if (folderPath == null || !folderPath.startsWith("/")) {
throw new CmisInvalidArgumentException("Invalid folder path!");
}
// get the document or folder
Node node = getNode(folderPath);
return compileObjectType(context, node, filterCollection, includeAllowableActions, includeACL, objectInfos);
}
开发者ID:openkm,项目名称:document-management-system,代码行数:21,代码来源:CmisRepository.java
示例5: compileObjectType
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* Compiles an object type object from a file or folder.
*/
private ObjectData compileObjectType(CallContext context, Node node, Set<String> filter, boolean includeAllowableActions,
boolean includeAcl, ObjectInfoHandler objectInfos) {
ObjectDataImpl result = new ObjectDataImpl();
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
result.setProperties(compileProperties(node, filter, objectInfo));
if (includeAllowableActions) {
result.setAllowableActions(compileAllowableActions(node));
}
if (includeAcl) {
result.setAcl(compileAcl(node));
result.setIsExactAcl(true);
}
if (context.isObjectInfoRequired()) {
objectInfo.setObject(result);
objectInfos.addObjectInfo(objectInfo);
}
return result;
}
开发者ID:openkm,项目名称:document-management-system,代码行数:27,代码来源:CmisRepository.java
示例6: getService
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
@Override
public CmisService getService(CallContext context) {
// authentication can go here
String user = context.getUsername();
String password = context.getPassword();
log.debug("User: {}", user);
log.debug("Password: {}", password);
// if the authentication fails, throw a CmisPermissionDeniedException
// create a new service object (can also be pooled or stored in a ThreadLocal)
CmisServiceImpl service = new CmisServiceImpl(repository);
// add the CMIS service wrapper
// (The wrapper catches invalid CMIS requests and sets default values
// for parameters that have not been provided by the client.)
CmisServiceWrapper<CmisService> wrapperService = new CmisServiceWrapper<CmisService>(service, DEFAULT_MAX_ITEMS_TYPES,
DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
// hand over the call context to the service object
service.setCallContext(context);
return wrapperService;
}
开发者ID:openkm,项目名称:document-management-system,代码行数:25,代码来源:CmisServiceFactory.java
示例7: create
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* Create* dispatch for AtomPub.
*/
public ObjectData create(CallContext context, Properties properties, String folderId, ContentStream contentStream,
VersioningState versioningState, ObjectInfoHandler objectInfos) {
boolean userReadOnly = checkUser(context, true);
String typeId = FileBridgeUtils.getObjectTypeId(properties);
TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
if (type == null) {
throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
}
String objectId = null;
if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
objectId = createDocument(context, properties, folderId, contentStream, versioningState);
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
objectId = createFolder(context, properties, folderId);
} else {
throw new CmisObjectNotFoundException("Cannot create object of type '" + typeId + "'!");
}
return compileObjectData(context, getFile(objectId), null, false, false, userReadOnly, objectInfos);
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:25,代码来源:FileBridgeRepository.java
示例8: deleteObject
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS deleteObject.
*/
public void deleteObject(CallContext context, String objectId) {
checkUser(context, true);
// get the file or folder
File file = getFile(objectId);
if (!file.exists()) {
throw new CmisObjectNotFoundException("Object not found!");
}
// check if it is a folder and if it is empty
if (!isFolderEmpty(file)) {
throw new CmisConstraintException("Folder is not empty!");
}
// delete file
if (!file.delete()) {
throw new CmisStorageException("Deletion failed!");
}
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:23,代码来源:FileBridgeRepository.java
示例9: deleteTree
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS deleteTree.
*/
public FailedToDeleteData deleteTree(CallContext context, String folderId, Boolean continueOnFailure) {
checkUser(context, true);
boolean cof = FileBridgeUtils.getBooleanParameter(continueOnFailure, false);
// get the file or folder
File file = getFile(folderId);
FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
result.setIds(new ArrayList<String>());
// if it is a folder, remove it recursively
if (file.isDirectory()) {
deleteFolder(file, cof, result);
} else {
throw new CmisConstraintException("Object is not a folder!");
}
return result;
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:24,代码来源:FileBridgeRepository.java
示例10: compileObjectData
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* Compiles an object type object from a file or folder.
*/
private ObjectData compileObjectData(CallContext context, File file, Set<String> filter,
boolean includeAllowableActions, boolean includeAcl, boolean userReadOnly, ObjectInfoHandler objectInfos) {
ObjectDataImpl result = new ObjectDataImpl();
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
result.setProperties(compileProperties(context, file, filter, objectInfo));
if (includeAllowableActions) {
result.setAllowableActions(compileAllowableActions(file, userReadOnly));
}
if (includeAcl) {
result.setAcl(compileAcl(file));
result.setIsExactAcl(true);
}
if (context.isObjectInfoRequired()) {
objectInfo.setObject(result);
objectInfos.addObjectInfo(objectInfo);
}
return result;
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:27,代码来源:FileBridgeRepository.java
示例11: checkUser
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* Checks if the user in the given context is valid for this repository and
* if the user has the required permissions.
*/
private boolean checkUser(CallContext context, boolean writeRequired) {
if (context == null) {
throw new CmisPermissionDeniedException("No user context!");
}
Boolean readOnly = readWriteUserMap.get(context.getUsername());
if (readOnly == null) {
throw new CmisPermissionDeniedException("Unknown user!");
}
if (readOnly.booleanValue() && writeRequired) {
throw new CmisPermissionDeniedException("No write permission!");
}
return readOnly.booleanValue();
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:21,代码来源:FileBridgeRepository.java
示例12: slflog
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* slf logging version with dual output to console and slf
*/
protected void slflog(String operation, String repositoryId) {
if (repositoryId == null) {
repositoryId = "<none>";
}
HttpServletRequest request = (HttpServletRequest) getCallContext().get(CallContext.HTTP_SERVLET_REQUEST);
String userAgent = request.getHeader("User-Agent");
if (userAgent == null) {
userAgent = "<unknown>";
}
String binding = getCallContext().getBinding();
LOG.info("Operation: {}, Repository ID: {}, Binding: {}, User Agent: {}", operation, repositoryId, binding,
userAgent);
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:20,代码来源:CmisCustomPdfWatermarkServiceWrapper.java
示例13: acquireGregRepository
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* @param context context with user data
* @return
* @throws org.wso2.carbon.registry.core.exceptions.RegistryException
*/
private Registry acquireGregRepository(CallContext context, String tenantDomain, String uName) throws RegistryException, AxisFault {
UserRegistry userRegistry = null;
try{
PrivilegedCarbonContext.getThreadLocalCarbonContext().startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
RegistryService registryService =
(RegistryService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(RegistryService.class);
//userRegistry = registryService.getRegistry(username, password);
userRegistry = registryService.getRegistry(uName, context.getPassword(), PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
} catch (RegistryException e) {
log.error("unable to create registry instance for the respective enduser", e);
} finally {
PrivilegedCarbonContext.getThreadLocalCarbonContext().endTenantFlow();
}
return userRegistry;
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:29,代码来源:CMISServiceFactory.java
示例14: createFolder
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS createFolder.
*/
public String createFolder(CallContext context, Properties properties,
String folderId) {
checkUser(context, true);
// check properties
checkNewProperties(properties);
// get parent File
File parent = getFile(folderId);
if (!parent.isDirectory()) {
throw new CmisObjectNotFoundException("Parent is not a folder!");
}
// create the folder
String name = FileBridgeUtils.getStringProperty(properties,
PropertyIds.NAME);
File newFolder = new File(parent, name);
if (!newFolder.mkdir()) {
throw new CmisStorageException("Could not create folder!");
}
return getId(newFolder);
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:27,代码来源:FileBridgeRepository.java
示例15: deleteObject
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS deleteObject.
*/
public void deleteObject(CallContext context, String objectId) {
checkUser(context, true);
// get the file or folder
File file = getFile(objectId);
if (!file.exists()) {
throw new CmisObjectNotFoundException("Object not found!");
}
// check if it is a folder and if it is empty
if (!isFolderEmpty(file)) {
throw new CmisConstraintException("Folder is not empty!");
}
// delete file
if (!file.delete()) {
throw new CmisStorageException("Deletion failed!");
}
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:23,代码来源:FileBridgeRepository.java
示例16: deleteTree
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* CMIS deleteTree.
*/
public FailedToDeleteData deleteTree(CallContext context, String folderId,
Boolean continueOnFailure) {
checkUser(context, true);
boolean cof = FileBridgeUtils.getBooleanParameter(continueOnFailure,
false);
// get the file or folder
File file = getFile(folderId);
FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
result.setIds(new ArrayList<String>());
// if it is a folder, remove it recursively
if (file.isDirectory()) {
deleteFolder(file, cof, result);
} else {
throw new CmisConstraintException("Object is not a folder!");
}
return result;
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:26,代码来源:FileBridgeRepository.java
示例17: checkUser
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* Checks if the user in the given context is valid for this repository and
* if the user has the required permissions.
*/
private boolean checkUser(CallContext context, boolean writeRequired) {
if (context == null) {
throw new CmisPermissionDeniedException("No user context!");
}
Boolean readOnly = readWriteUserMap.get(context.getUsername());
if (readOnly == null) {
throw new CmisPermissionDeniedException("Unknown user!");
}
if (readOnly.booleanValue() && writeRequired) {
throw new CmisPermissionDeniedException("No write permission!");
}
return readOnly.booleanValue();
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:21,代码来源:FileBridgeRepository.java
示例18: slflog
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
/**
* slf logging version with dual output to console and slf
*/
protected void slflog(String operation, String repositoryId) {
if (repositoryId == null) {
repositoryId = "<none>";
}
HttpServletRequest request = (HttpServletRequest) getCallContext().get(CallContext.HTTP_SERVLET_REQUEST);
String userAgent = request.getHeader("User-Agent");
if (userAgent == null) {
userAgent = "<unknown>";
}
String binding = getCallContext().getBinding();
LOG.info("Operation: {}, Repository ID: {}, Binding: {}, User Agent: {}", operation, repositoryId, binding,
userAgent);
// also dump to console for testing
String result =
String.format("Operation: %s, Repository ID: %s, Binding: %s, User Agent: %s",
operation, repositoryId, binding, userAgent);
System.out.println(result);
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:26,代码来源:CmisCustomLoggingServiceWrapper.java
示例19: getChildren
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
@Override
public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
slflog("getChildren override from customer Chameleon module --------------", repositoryId);
long startTime = System.currentTimeMillis();
CallContext sharedContext = this.getCallContext();
// Get the native domain object from the call context if one is shared by the vendor (example only)
// Your CMIS vendor's documentation must expose the name of any shared objects they place here for extensions.
// Object objShared = sharedContext.get("shared_key_name_from_vendor");
ObjectInFolderList retVal = getWrappedService().getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension);
// dual log output in case logger not configured
LOG.info("[CmisCustomServiceWrapper] Exiting method getChildren. time (ms):" + (System.currentTimeMillis() - startTime));
System.out.println("[CmisCustomServiceWrapper] Exiting method getChildren. time (ms):" + (System.currentTimeMillis() - startTime));
return retVal;
}
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:23,代码来源:CmisCustomLoggingServiceWrapper.java
示例20: convertAspectPropertyValue
import org.apache.chemistry.opencmis.commons.server.CallContext; //导入依赖的package包/类
private String convertAspectPropertyValue(Object value)
{
if (value instanceof Date)
{
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.setTime((Date) value);
value = cal;
}
if (value instanceof GregorianCalendar)
{
DatatypeFactory df;
try
{
df = DatatypeFactory.newInstance();
}
catch (DatatypeConfigurationException e)
{
throw new IllegalArgumentException("Aspect conversation exception: " + e.getMessage(), e);
}
return df.newXMLGregorianCalendar((GregorianCalendar) value).toXMLFormat();
}
// MNT-12496 MNT-15044
// Filter for AtomPub and Web services bindings only. Browser/json binding already encodes.
if (AlfrescoCmisServiceCall.get() != null &&
(CallContext.BINDING_ATOMPUB.equals(AlfrescoCmisServiceCall.get().getBinding()) ||
CallContext.BINDING_WEBSERVICES.equals(AlfrescoCmisServiceCall.get().getBinding())))
{
return filterXmlRestrictedCharacters(value.toString());
}
else
{
return value.toString();
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:CMISConnector.java
注:本文中的org.apache.chemistry.opencmis.commons.server.CallContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论