本文整理了Java中javax.jcr.AccessDeniedException
类的一些代码示例,展示了AccessDeniedException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AccessDeniedException
类的具体详情如下:
包路径:javax.jcr.AccessDeniedException
类名称:AccessDeniedException
[英]Exception thrown by access-related methods.
[中]访问相关方法引发的异常。
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
public void checkPermissions(@Nonnull String oakPath, @Nonnull String actions) throws RepositoryException {
if (!hasPermissions(oakPath, actions)) {
throw new AccessDeniedException("Access denied.");
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static Node copy(Node srcNode, Node destNode) {
try {
Session sess = srcNode.getSession();
return copy(sess, srcNode.getPath(), destNode.getPath());
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to copy source node: " + srcNode + " to destination node: " + destNode, e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
@Nonnull
public static Map<String, String> getUserProperties(@Nonnull final Node node) {
iterator = node.getProperties();
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to get properties for node: " + node, e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to access property \"" + property + "\" on node: " + node, e);
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Nonnull
@Override
public Node perform() throws RepositoryException {
if (node.isRoot()) {
throw new ItemNotFoundException("Root has no parent");
} else {
NodeDelegate parent = node.getParent();
if (parent == null) {
throw new AccessDeniedException();
}
return createNode(parent, sessionContext);
}
}
});
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
private void cacheGroups(@Nonnull Tree authorizableNode, @Nonnull Set<Group> groupPrincipals) {
try {
root.refresh();
log.debug("Failed to cache group membership", e.getMessage());
} catch (CommitFailedException e) {
log.debug("Failed to cache group membership", e.getMessage(), e);
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
public RepositoryException asRepositoryException(@Nonnull String message) {
if (isConstraintViolation()) {
return new ConstraintViolationException(message, this);
return new NoSuchNodeTypeException(message, this);
} else if (isAccessViolation()) {
return new AccessDeniedException(message, this);
} else if (isAccessControlViolation()) {
return new AccessControlException(message, this);
return new UnsupportedRepositoryOperationException(message, this);
} else {
return new RepositoryException(message, this);
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
private boolean nonVersionableNodeChckoutCheck(String s) throws RepositoryException {
Node vParent = null;
try {
vParent = session.getNode(s).getParent();
while (!vParent.isNodeType("mix:simpleVersionable")) {
vParent = vParent.getParent();
}
} catch (ItemNotFoundException e) {
// root reached.
} catch (AccessDeniedException e) {
throw new AccessDeniedException("Access denied on node " + s);
} catch (PathNotFoundException e) {
throw new PathNotFoundException("No such path exists " + s);
}
try {
if (vParent != null && vParent.isNodeType("mix:simpleVersionable")) {
if (vParent.isCheckedOut()) {
return true;
} else {
return false;
}
} else {
return true;
}
} catch (RepositoryException e) {
throw new RepositoryException(e.getMessage());
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine
/**
* @see AccessManager#checkPermission(ItemId, int)
*/
@Deprecated
public void checkPermission(ItemId id, int permissions) throws AccessDeniedException, ItemNotFoundException,
RepositoryException {
log.warn("checkPermission(ItemId, int) is DEPRECATED!", new RepositoryException(
"Use of deprecated method checkPermission(ItemId, int)"));
// just use the isGranted method
if (!isGranted(id, permissions)) {
throw new AccessDeniedException();
}
}
代码示例来源:origin: apache/jackrabbit
public void testReadVersionInfo3() throws RepositoryException, NotExecutableException {
Node trn = getTestNode();
modifyPrivileges(trn.getPath(), PrivilegeRegistry.REP_WRITE, true);
modifyPrivileges(trn.getPath(), Privilege.JCR_NODE_TYPE_MANAGEMENT, true);
modifyPrivileges(trn.getPath(), Privilege.JCR_VERSION_MANAGEMENT, true);
modifyPrivileges(VERSION_STORAGE_PATH, Privilege.JCR_READ, false);
Node n = createVersionableNode(trn);
assertTrue(n.isNodeType(mixVersionable));
assertFalse(n.isModified());
try {
n.getVersionHistory();
n.getBaseVersion();
fail("No READ permission in the version storage");
} catch (AccessDeniedException e) {
// success
log.debug(e.getMessage());
} catch (ItemNotFoundException e) {
// success
log.debug(e.getMessage());
}
}
}
代码示例来源:origin: apache/jackrabbit
if (!exists()) {
log.warn("Unable to retrieve lock: no item found at '" + getResourcePath() + "'");
} else if (((Node) item).isLocked()) {
Lock jcrLock = ((Node) item).getLock();
lock = new JcrActiveLock(jcrLock);
DavResourceLocator locator = super.getLocator();
String lockroot = locator
.getFactory()
.createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), jcrLock.getNode().getPath(),
false).getHref(false);
lock.setLockroot(lockroot);
log.error("Error while accessing resource lock: "+e.getMessage());
} catch (UnsupportedRepositoryOperationException e) {
log.error("Error while accessing resource lock: "+e.getMessage());
} catch (RepositoryException e) {
log.error("Error while accessing resource lock: "+e.getMessage());
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static String getPath(Node node) {
try {
return node.getPath();
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to get the Path", e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static Node getNode(Node parentNode, String name) {
try {
return parentNode.getNode(name);
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to retrieve the Node named " + name, e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static Node createNode(Node parentNode, String name, String nodeType) {
try {
return parentNode.addNode(name, nodeType);
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to create the Node named " + name, e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static <T extends JcrObject> T getReferencedObject(Node node, String property, JcrObjectTypeResolver<T> typeResolver) {
try {
Property prop = node.getProperty(property);
return createJcrObject(prop.getNode(), typeResolver.resolve(prop.getNode()));
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to dereference object of type using: " + typeResolver, e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static String getName(Node node) {
try {
return node.getName();
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to get name of Node " + node, e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static boolean hasProperty(Node node, String propName) {
try {
return node.hasProperty(propName);
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to test for property", e);
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static boolean hasNode(Node parentNode, String name) {
try {
return parentNode.hasNode(name);
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to check for the existence of the node named " + name, e);
}
}
代码示例来源:origin: apache/jackrabbit
RepositoryException ex) {
if (ex instanceof AccessDeniedException) {
return new AccessDeniedException(ex.getMessage());
} else if (ex instanceof ConstraintViolationException) {
return new ConstraintViolationException(ex.getMessage());
} else if (ex instanceof InvalidItemStateException) {
return new InvalidItemStateException(ex.getMessage());
} else if (ex instanceof InvalidQueryException) {
return new InvalidQueryException(ex.getMessage());
return new ItemExistsException(ex.getMessage());
} else if (ex instanceof ItemNotFoundException) {
return new ItemNotFoundException(ex.getMessage());
} else if (ex instanceof LockException) {
return new LockException(ex.getMessage());
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
boolean success;
try {
success = collect();
} catch (AccessDeniedException e) {
// don't throw further, simply return error and break filter chain
log.debug(e.getMessage(), e);
if (!response.isCommitted()) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
}
// stop the chain
return;
} catch (RepositoryException e) {
log.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
}
if (!success) {
log.debug("Resource not found, redirecting request for [{}] to 404 URI", request.getRequestURI());
if (!response.isCommitted()) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
} else {
log.info("Unable to redirect to 404 page, response is already committed. URI was {}", request.getRequestURI());
}
// stop the chain
return;
}
chain.doFilter(request, response);
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
state = sism.getItemState(itemId);
} catch (NoSuchItemStateException nsise) {
throw new ItemNotFoundException(itemId.toString(), nsise);
} catch (ItemStateException ise) {
String msg = "failed to retrieve item state of item " + itemId;
log.error(msg, ise);
throw new RepositoryException(msg, ise);
throw new AccessDeniedException("cannot read item " + data.getId());
内容来源于网络,如有侵权,请联系作者删除!