Package org.auraframework.throwable.quickfix

Examples of org.auraframework.throwable.quickfix.InvalidAccessValueException


        // See if we have authentication
        String ucItem = item.toUpperCase();
        try {
            Authentication auth = Authentication.valueOf(ucItem);
            if (authentication != null && auth != authentication) {
                throw new InvalidAccessValueException("Access attribute cannot specify both AUTHENTICATED and UNAUTHENTICATED");
            }
            authentication = auth;
            return;
        } catch (IllegalArgumentException e) {
            // continue to try other possibilities
        }
       
        // See if it is one of the scope constants
        try {
            Access acc = Access.valueOf(item.toUpperCase());
            if (access != null && access != acc) {
                throw new InvalidAccessValueException("Access attribute can only specifiy one of GLOBAL, PUBLIC, or PRIVATE"); // or internal
            }
            access = acc;
            return;
        } catch (IllegalArgumentException e) {
            // continue to try other possibilities
        }
       
        // Look for classname.methodname
        int dotPos = item.lastIndexOf('.');
        if (dotPos > 0) {
            String className = item.substring(0, dotPos);
            String methodName = item.substring(dotPos + 1);
            try {
                Class<?> clazz = Class.forName(className);
                Method meth = clazz.getMethod(methodName, new Class[0]);
                if (!Modifier.isStatic(meth.getModifiers())) {
                    throw new InvalidAccessValueException("\"" + item + "\" must be a static method");
                }
                Class<?> retType = meth.getReturnType();
                if (! Access.class.equals(retType)) {
                    throw new InvalidAccessValueException("\"" + item + "\" must return a result of type " +
                        Access.class.getName());
                }  
                if (this.accessMethod != null) {
                    throw new InvalidAccessValueException("Access attribute may not specify more than one static method");
                }
                this.accessMethod = meth;
                return;
            } catch (ClassNotFoundException e) {
            } catch (SecurityException e) {
            } catch (NoSuchMethodException e) {
            }
            throw new InvalidAccessValueException("\"" + item + "\" is not a valid public method reference");
        }
       
        throw new InvalidAccessValueException("Invalid access atttribute value \"" + item + "\"");
    }
View Full Code Here


    @Override
    public void validate(String namespace, boolean allowAuth, boolean allowPrivate)
            throws InvalidAccessValueException {
        boolean isPrivNamespace = Aura.getConfigAdapter().isPrivilegedNamespace(namespace);
        if (authentication != null && (!allowAuth || !isPrivNamespace)) {
            throw new InvalidAccessValueException("Invalid access atttribute value \"" + authentication.name() + "\"");
        }
        if (access == Access.PRIVATE  && !allowPrivate) {
            throw new InvalidAccessValueException("Invalid access atttribute value \"" + access.name() + "\"");
        }
        if (access == Access.INTERNAL && !isPrivNamespace) {
            throw new InvalidAccessValueException("Invalid access atttribute value \"" + access.name() + "\"");
        }
        if (access != null && accessMethod != null) {
            throw new InvalidAccessValueException("Access attribute may not specify \"" + access.name() + "\" when a static method is also specified");
        }
        if (!isPrivNamespace && accessMethod != null) {
            throw new InvalidAccessValueException("Access attribute may not use a static method");
        }
       
    }
View Full Code Here

TOP

Related Classes of org.auraframework.throwable.quickfix.InvalidAccessValueException

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.