Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.Item


                    klass + config.getAttributeNames();
                log.error(errorMsg);
                throw new AccessControlException(errorMsg, e);
            }

            Item item = null;

            try {
                item = (Item) Class.forName(klass).newInstance();
            } catch (Exception e) {
                String errorMsg = "Exception when trying to instanciate: " + klass +
                    " with exception: " + e.fillInStackTrace();

                // an exception occured when trying to instanciate
                // a user.
                log.error(errorMsg);
                throw new AccessControlException(errorMsg, e);
            }

            item.setConfigurationDirectory(configurationDirectory);

            try {
                item.configure(config);
            } catch (ConfigurationException e) {
                String errorMsg = "Exception when trying to configure: " + klass;
                throw new AccessControlException(errorMsg, e);
            }
View Full Code Here


                    klass + config.getAttributeNames();
                log.error(errorMsg);
                throw new AccessControlException(errorMsg, e);
            }

            Item item = null;

            try {
                item = (Item) Class.forName(klass).newInstance();
            } catch (Exception e) {
                String errorMsg = "Exception when trying to instanciate: " + klass +
                    " with exception: " + e.fillInStackTrace();

                // an exception occured when trying to instanciate
                // a user.
                log.error(errorMsg);
                throw new AccessControlException(errorMsg, e);
            }

            item.setConfigurationDirectory(configurationDirectory);

            try {
                item.configure(config);
            } catch (ConfigurationException e) {
                String errorMsg = "Exception when trying to configure: " + klass;
                throw new AccessControlException(errorMsg, e);
            }
View Full Code Here

     * @param accreditable The accreditable of the credential to wrap.
     * @param role The role of the credential to wrap.
     */
    public CredentialWrapper(Accreditable accreditable, Role role) {
        if (accreditable instanceof Item) {
            Item item = (Item) accreditable;
            accreditableId = item.getId();
            accreditableName = item.getName();
       
            if (item instanceof User) {
                type = USER;
            }
            else if (item instanceof Group) {
View Full Code Here

            }

            File[] addedFiles = notifier.getAddedFiles();

            for (int i = 0; i < addedFiles.length; i++) {
                Item item = loadItem(addedFiles[i]);
                add(item);
            }

            File[] removedFiles = notifier.getRemovedFiles();
            for (int i = 0; i < removedFiles.length; i++) {
                String fileName = removedFiles[i].getName();
                String id = fileName.substring(0, fileName.length() - getSuffix().length());

                Item item = (Item) items.get(id);

                if (item != null) {

                    if (item instanceof Groupable) {
                        ((Groupable) item).removeFromAllGroups();
                    }
                    if (item instanceof Group) {
                        ((Group) item).removeAllMembers();
                    }

                    remove(item);
                }
            }

            File[] changedFiles = notifier.getChangedFiles();
            for (int i = 0; i < changedFiles.length; i++) {
                Item item = loadItem(changedFiles[i]);
                update(item);
            }

        }
View Full Code Here

    protected Item loadItem(File file) throws AccessControlException {
        Configuration config = getItemConfiguration(file);

        String fileName = file.getName();
        String id = fileName.substring(0, fileName.length() - getSuffix().length());
        Item item = (Item) items.get(id);

        String klass = getItemClass(config);
        if (item == null) {
            try {
                item = (Item) Class.forName(klass).newInstance();
            } catch (Exception e) {
                String errorMsg =
                    "Exception when trying to instanciate: "
                        + klass
                        + " with exception: "
                        + e.fillInStackTrace();

                // an exception occured when trying to instanciate
                // a user.
                log.error(errorMsg);
                throw new AccessControlException(errorMsg, e);
            }
            item.setConfigurationDirectory(configurationDirectory);
        }

        try {
            item.configure(config);
        } catch (ConfigurationException e) {
            String errorMsg = "Exception when trying to configure: " + klass;
            throw new AccessControlException(errorMsg, e);
        }
        return item;
View Full Code Here

     * @param accreditable The accreditable of the credential to wrap.
     * @param role The role of the credential to wrap.
     */
    public CredentialWrapper(Accreditable accreditable, Role role) {
        if (accreditable instanceof Item) {
            Item item = (Item) accreditable;
            accreditableId = item.getId();
            accreditableName = item.getName();
       
            if (item instanceof User) {
                type = USER;
            }
            else if (item instanceof Group) {
View Full Code Here

            }

            File[] addedFiles = notifier.getAddedFiles();

            for (int i = 0; i < addedFiles.length; i++) {
                Item item = loadItem(addedFiles[i]);
                add(item);
            }

            File[] removedFiles = notifier.getRemovedFiles();
            for (int i = 0; i < removedFiles.length; i++) {
                String fileName = removedFiles[i].getName();
                String id = fileName.substring(0, fileName.length() - getSuffix().length());

                Item item = (Item) items.get(id);

                if (item != null) {

                    if (item instanceof Groupable) {
                        ((Groupable) item).removeFromAllGroups();
                    }
                    if (item instanceof Group) {
                        ((Group) item).removeAllMembers();
                    }

                    remove(item);
                }
            }

            File[] changedFiles = notifier.getChangedFiles();
            for (int i = 0; i < changedFiles.length; i++) {
                Item item = loadItem(changedFiles[i]);
                update(item);
            }

        }
View Full Code Here

    protected Item loadItem(File file) throws AccessControlException {
        Configuration config = getItemConfiguration(file);

        String fileName = file.getName();
        String id = fileName.substring(0, fileName.length() - getSuffix().length());
        Item item = (Item) items.get(id);

        String klass = getItemClass(config);
        if (item == null) {
            try {
                item = (Item) Class.forName(klass).newInstance();
            } catch (Exception e) {
                String errorMsg =
                    "Exception when trying to instanciate: "
                        + klass
                        + " with exception: "
                        + e.fillInStackTrace();

                // an exception occured when trying to instanciate
                // a user.
                log.error(errorMsg);
                throw new AccessControlException(errorMsg, e);
            }
            item.setConfigurationDirectory(configurationDirectory);
        }

        try {
            item.configure(config);
        } catch (ConfigurationException e) {
            String errorMsg = "Exception when trying to configure: " + klass;
            throw new AccessControlException(errorMsg, e);
        }
        return item;
View Full Code Here

     * @param accreditable The accreditable of the credential to wrap.
     * @param role The role of the credential to wrap.
     */
    public CredentialWrapper(Accreditable accreditable, Role role) {
        if (accreditable instanceof Item) {
            Item item = (Item) accreditable;
            accreditableId = item.getId();
            accreditableName = item.getName();
       
            if (item instanceof User) {
                type = USER;
            }
            else if (item instanceof Group) {
View Full Code Here

TOP

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

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.