当前位置: 首页>>代码示例>>Java>>正文


Java LockException类代码示例

本文整理汇总了Java中javax.jcr.lock.LockException的典型用法代码示例。如果您正苦于以下问题:Java LockException类的具体用法?Java LockException怎么用?Java LockException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LockException类属于javax.jcr.lock包,在下文中一共展示了LockException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setProperty

import javax.jcr.lock.LockException; //导入依赖的package包/类
public Property setProperty(String s, InputStream inputStream) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    RegistryJCRItemOperationUtil.checkRetentionPolicy(registrySession,getPath());
    RegistryJCRItemOperationUtil.checkRetentionHold(registrySession, getPath());

    registrySession.sessionPending();
    validatePropertyModifyPrivilege(s);

    Resource res = null;
    try {
        res = registrySession.getUserRegistry().newResource();
        if (inputStream != null) {
            res.setContentStream(inputStream);
            res.setProperty("registry.jcr.property.type", "input_stream");
            registrySession.getUserRegistry().put(nodePath + "/" + s, res);
            property = new RegistryProperty(nodePath + "/" + s, registrySession, s,inputStream);
        }
    } catch (RegistryException e) {
        String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
        log.debug(msg);
        throw new RepositoryException(msg, e);
    }

    isModified = true;
    return property;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:26,代码来源:RegistryNode.java

示例2: removeItem

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void removeItem(String s) throws VersionException, LockException, ConstraintViolationException,
        AccessDeniedException, RepositoryException {

    try {

        if (userRegistry.resourceExists(s)) {
            userRegistry.delete(s);
        } else {
            throw new PathNotFoundException("No such path exists" + s);
        }

    } catch (RegistryException e) {
        e.printStackTrace();

    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:18,代码来源:RegistrySession.java

示例3: removeMixin

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void removeMixin(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {
    RegistryJCRItemOperationUtil.checkRetentionHold(registrySession, getPath());

    try {
        Resource resource = registrySession.getUserRegistry().get(nodePath);
        if (resource.getPropertyValues("jcr:mixinTypes").contains(s)) {
            resource.getPropertyValues("jcr:mixinTypes").remove(s);
        } else {
            throw new NoSuchNodeTypeException("No such mix node type to remove");
        }
        registrySession.getUserRegistry().put(nodePath, resource);

    } catch (RegistryException e) {
        String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
        log.debug(msg);
        throw new RepositoryException(msg, e);
    }
   isModified = true;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:RegistryNode.java

示例4: remove

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void remove() throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException {
        //TODO  if nodetype is a mandatory one should throw ConstraintViolationException

//           A read only session must not be allowed to remove a node

        RegistryJCRItemOperationUtil.validateReadOnlyItemOpr(registrySession);

        try {
            RegistryJCRItemOperationUtil.checkRetentionPolicyWithParent(registrySession,getPath());
            RegistryJCRItemOperationUtil.checkRetentionHoldWithParent(registrySession,getPath());

            if (registrySession.getUserRegistry().resourceExists(nodePath)) {
                registrySession.removeItem(nodePath);
            } else {
                throw new InvalidItemStateException("Node " + nodePath + " has already removed from another session");
            }
        } catch (RegistryException e) {
            log.error("Error occured while removing the node at" + nodePath);
        }
        isRemoved = true;
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:22,代码来源:RegistryNode.java

示例5: checkout

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void checkout(String s) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {

        if (!isNodeTypeVersionable(s)) {
            throw new UnsupportedRepositoryOperationException("Cannot apply checkout for non versionalbe nodes .!!!");
        }
        try {
            Resource resource = ((RegistrySession) session).getUserRegistry().get(s);
            resource.setProperty("jcr:checkedOut", "true");   // no need both.But as in JCR spec there are two properties to set
            resource.setProperty("jcr:isCheckedOut", "true");
            ((RegistrySession) session).getUserRegistry().put(s, resource);

        } catch (RegistryException e) {
            throw new RepositoryException("Exception occurred at Registry level");
        }

    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:17,代码来源:RegistryVersionManager.java

示例6: setPrimaryType

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void setPrimaryType(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {

        // Check if node type already exists
        registrySession.getWorkspace().getNodeTypeManager().getNodeType(s);

//        if(s!= null && s.startsWith("mix")) {
//         throw  new ConstraintViolationException("Cannpot set mixin as primary types");
//        }
        try {

            Resource resource = registrySession.getUserRegistry().get(nodePath);
            resource.setProperty("jcr:primaryType", s);
            registrySession.getUserRegistry().put(nodePath, resource);

        } catch (RegistryException e) {
            String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
            log.debug(msg);
            throw new RepositoryException(msg, e);
        }


    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:RegistryNode.java

示例7: setAction

import javax.jcr.lock.LockException; //导入依赖的package包/类
private void setAction(final Node node, Node actions, String actionName, String implClass) throws RepositoryException, PathNotFoundException, ValueFormatException, VersionException, LockException, ConstraintViolationException, ItemExistsException, AccessDeniedException {
    String propName = "default" + StringUtils.capitalize(actionName);
    if (node.hasProperty(propName)) {
        Property defaultAction = node.getProperty(propName);
        if (defaultAction.getBoolean()) {
            actions.addNode(actionName, NodeTypes.ContentNode.NAME).setProperty("class", implClass);
        }
        defaultAction.remove();
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:11,代码来源:SaveDialogFormAction.java

示例8: addNode

import javax.jcr.lock.LockException; //导入依赖的package包/类
@Override
public Node addNode(String relPath, String primaryNodeTypeName) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
    Node node = new NodeImpl(session, Paths.resolve(getPath(), relPath));
    node.setPrimaryType(primaryNodeTypeName);
    session.changeItem(this);
    return node;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:NodeImpl.java

示例9: setProperty

import javax.jcr.lock.LockException; //导入依赖的package包/类
@Override
public Property setProperty(String name, Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    if (value == null) {
        if (hasProperty(name))
            getProperty(name).remove();
        return null;
    }
    PropertyImpl property = getOrCreateProperty(name);
    property.setValue(value);
    session.changeItem(this);
    return property;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:13,代码来源:NodeImpl.java

示例10: PropertyImpl

import javax.jcr.lock.LockException; //导入依赖的package包/类
public PropertyImpl(@Nonnull SessionImpl session, @Nonnull String path, @Nonnull String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    this(session, path);
    List<Value> stringValues = new ArrayList<>(values.length);
    for (String value : values)
        stringValues.add(new ValueImpl(value));
    setValue(stringValues.toArray(new Value[stringValues.size()]));
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:PropertyImpl.java

示例11: setValue

import javax.jcr.lock.LockException; //导入依赖的package包/类
@Override
public void setValue(@Nonnull String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    List<Value> valueList = new ArrayList<>(values.length);
    for (String value : values)
        valueList.add(new ValueImpl(value));
    setValue(valueList.toArray(new Value[valueList.size()]));
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:PropertyImpl.java

示例12: asRepositoryException

import javax.jcr.lock.LockException; //导入依赖的package包/类
/**
 * Wraps the given {@link CommitFailedException} instance using the
 * appropriate {@link javax.jcr.RepositoryException} subclass based on the
 * {@link CommitFailedException#getType() type} of the given exception.
 *
 * @param message The exception message.
 * @return matching repository exception
 */
public RepositoryException asRepositoryException(@Nonnull String message) {
    if (isConstraintViolation()) {
        return new ConstraintViolationException(message, this);
    } else if (isOfType(NAMESPACE)) {
        return new NamespaceException(message, this);
    } else if (isOfType(NODE_TYPE)) {
        return new NoSuchNodeTypeException(message, this);
    } else if (isAccessViolation()) {
        return new AccessDeniedException(message, this);
    } else if (isAccessControlViolation()) {
        return new AccessControlException(message, this);
    } else if (isOfType(INTEGRITY)) {
        return new ReferentialIntegrityException(message, this);
    } else if (isOfType(STATE)) {
        return new InvalidItemStateException(message, this);
    } else if (isOfType(MERGE)) {
        return new InvalidItemStateException(message, this);
    } else if (isOfType(VERSION)) {
        return new VersionException(message, this);
    } else if (isOfType(LABEL_EXISTS)) {
        return new LabelExistsVersionException(message, this);
    } else if (isOfType(LOCK)) {
        return new LockException(message, this);
    } else if (isOfType(UNSUPPORTED)) {
        return new UnsupportedRepositoryOperationException(message, this);
    } else {
        return new RepositoryException(message, this);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:38,代码来源:CommitFailedException.java

示例13: copy

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void copy(String s, String s1) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
//          A read only session must not be allowed to copy a node
        RegistryJCRItemOperationUtil.validateReadOnlyItemOpr(registrySession);

        try {

            if (userRegistry != null) {
                userRegistry.copy(s, s1);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:16,代码来源:RegistryWorkspace.java

示例14: setProperty

import javax.jcr.lock.LockException; //导入依赖的package包/类
@Override
public Property setProperty(final String name, final String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    MockProperty p = new MockProperty(name);
    p.setValue(values);
    properties.put(name, p);
    return p;
}
 
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:8,代码来源:MockNode.java

示例15: setValue

import javax.jcr.lock.LockException; //导入依赖的package包/类
public void setValue(Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    RegistryJCRItemOperationUtil.checkRetentionPolicy(session,getPath());

    validatePropertyModifyPrivilege();
    if (value != null) {
        this.value = (RegistryValue) value;
        persistNewPropertyValue("value", value);
    } else {
        remove();
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:12,代码来源:RegistryProperty.java


注:本文中的javax.jcr.lock.LockException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。