Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.AccessControlException


    public File getConfigurationDirectory() throws AccessControlException {

        if (configurationDirectory == null) {

            if (configurationDirectoryPath == null) {
                throw new AccessControlException("Configuration directory not set!");
            }

            Source source = null;
            SourceResolver resolver = null;
            File directory;
            try {

                getLogger().debug(
                        "Configuration directory Path: [" + configurationDirectoryPath + "]");

                resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
                source = resolver.resolveURI(configurationDirectoryPath);

                getLogger().debug("Configuration directory URI: " + source.getURI());
                directory = new File(new URI(NetUtils.encodePath(source.getURI())));
            } catch (Exception e) {
                throw new AccessControlException(e);
            } finally {
                if (resolver != null) {
                    if (source != null) {
                        resolver.release(source);
                    }
View Full Code Here


     *
     * @throws AccessControlException if an error occurs
     */
    public void setConfigurationDirectory(File file) throws AccessControlException {
        if (file == null || !file.isDirectory()) {
            throw new AccessControlException("Configuration directory [" + file
                    + "] does not exist!");
        }
        configurationDirectory = file;
    }
View Full Code Here

                authorized = authorizeUsecase(usecase, roles, configurationUri);
            } else {
                getLogger().debug("No usecase to authorize. Granting access.");
            }
        } catch (Exception e) {
            throw new AccessControlException(e);
        } finally {
            if (resolver != null) {
                manager.release(resolver);
            }
        }
View Full Code Here

        UsecaseRolesBuilder builder = new UsecaseRolesBuilder();
        UsecaseRoles usecaseRoles;
        try {
            usecaseRoles = (UsecaseRoles) getCache().get(configurationUri, builder);
        } catch (CachingException e) {
            throw new AccessControlException(e);
        }
       
        if (usecaseRoles == null) {
            throw new AccessControlException("Usecase policies configuration not found at [" + configurationUri + "]");
        }
       
        if (usecaseRoles.hasRoles(usecase)) {

            getLogger().debug("Roles for usecase found.");
View Full Code Here

            }
          }
        }

      } catch (Exception e) {
        throw new AccessControlException(e);
      } finally {
        if (resolver != null) {
          manager.release(resolver);
        }
      }
View Full Code Here

        try {
            PolicyBuilder builder = new PolicyBuilder(controller);
            policy = (DefaultPolicy) getCache().get(policyUri, builder);
        } catch (CachingException e) {
            throw new AccessControlException(e);
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Policy exists: [" + (policy != null) + "]");
        }
View Full Code Here

        String fileUri = getPolicySourceURI(url, policyFilename);
        File file;
        try {
            file = new File(new URI(NetUtils.encodePath(fileUri)));
        } catch (final Exception e) {
            throw new AccessControlException(e);
        }
        return file;
    }
View Full Code Here

        try {
            if (!file.exists()) {
                file.getParentFile().mkdirs();
                if (!file.createNewFile()) {
                    throw new AccessControlException("File [" + file + "] could not be created.");
                }
            }
            DocumentHelper.writeDocument(document, file);
        } catch (AccessControlException e) {
            throw e;
        } catch (Exception e) {
            throw new AccessControlException("Path: [" + file.getAbsolutePath() + "]", e);
        }
    }
View Full Code Here

                resolver = (SourceResolver) getServiceManager().lookup(SourceResolver.ROLE);
                source = resolver.resolveURI(policiesDirectoryUri);
                getLogger().debug("Policies directory source: [" + source.getURI() + "]");
                directory = new File(new URI(NetUtils.encodePath(source.getURI())));
            } catch (final Exception e) {
                throw new AccessControlException("Resolving policies directory failed: ", e);
            } finally {
                if (resolver != null) {
                    if (source != null) {
                        resolver.release(source);
                    }
View Full Code Here

     * @throws AccessControlException if the directory is not a directory
     */
    public void setPoliciesDirectory(File directory) throws AccessControlException {
        getLogger().debug("Setting policies directory [" + directory.getAbsolutePath() + "]");
        if (!directory.isDirectory()) {
            throw new AccessControlException("Policies directory invalid: ["
                    + directory.getAbsolutePath() + "]");
        }
        policiesDirectory = directory;
    }
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.AccessControlException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.