Package org.codehaus.aspectwerkz.exception

Examples of org.codehaus.aspectwerkz.exception.DefinitionException


    private static List loadAspectClassNamesFromFile(final ClassLoader loader, final boolean useCache) {
        String definitionFileName;
        if (DEFINITION_FILE == null) {
            URL definition = ContextClassLoader.loadResource(DEFAULT_DEFINITION_FILE_NAME);
            if (definition == null) {
                throw new DefinitionException(
                        "definition file could not be found on classpath (either specify the file by using the -Daspectwerkz.definition.file=.. option or by having a definition file called aspectwerkz.xml somewhere on the classpath)"
                );
            }
            definitionFileName = definition.getFile();
        }
View Full Code Here


        // check compatibility
        IntroductionDefinition def = m_prototype.getIntroductionDefinition();
        for (Iterator intfs = def.getInterfaceClassNames().iterator(); intfs.hasNext();) {
            if (!findInterfaceInHierarchy(newImplementationClass, (String)intfs.next())) {
                throw new DefinitionException("new implementation class is not compatible");
            }
        }

        synchronized (this) {
            try {
View Full Code Here

            }
            Constructor constructor = klass.getConstructor(new Class[]{CrossCuttingInfo.class});
            return (AspectContainer)constructor.newInstance(new Object[]{crossCuttingInfo});
        }
        catch (InvocationTargetException e) {
            throw new DefinitionException(e.getTargetException().toString());
        }
        catch (NoSuchMethodException e) {
            throw new DefinitionException(
                    "aspect container does not have a valid constructor [" + ASPECT_CONTAINER_IMPLEMENTATION_CLASS +
                    "] (one that takes a CrossCuttingInfo instance as its only parameter): " +
                    e.toString()
            );
        }
        catch (Exception e) {
            StringBuffer cause = new StringBuffer();
            cause.append("could not create aspect container using the implementation specified [");
            cause.append(ASPECT_CONTAINER_IMPLEMENTATION_CLASS);
            cause.append("] due to: ");
            cause.append(e.toString());
            throw new DefinitionException(cause.toString());
        }
    }
View Full Code Here

                AspectDefinition aspectDef = (AspectDefinition)it.next();
                registerAspect(uuid, aspectDef, definition.getParameters(aspectDef.getName()));
            }
        }
        catch (NullPointerException e) {
            throw new DefinitionException("aspects not properly defined");
        }
        catch (Exception e) {
            throw new WrappedRuntimeException(e);
        }
    }
View Full Code Here

     * @param name the name of the parameter
     * @return the value of the parameter
     */
    public String getParameter(final String name) {
        if (!m_parameters.containsKey(name)) {
            throw new DefinitionException("parameter to advice not specified: " + name);
        }
        return (String)m_parameters.get(name);
    }
View Full Code Here

    public static List getAspectClassNames(final File definitionFile) {
        if (definitionFile == null) {
            throw new IllegalArgumentException("definition file can not be null");
        }
        if (!definitionFile.exists()) {
            throw new DefinitionException("definition file " + definitionFile.toString() + " does not exist");
        }
        try {
            Document document = createDocument(definitionFile.toURL());
            return DocumentParser.parseAspectClassNames(document);
        }
        catch (MalformedURLException e) {
            throw new DefinitionException(definitionFile + " does not exist");
        }
        catch (DocumentException e) {
            throw new DefinitionException("XML definition file <" + definitionFile + "> has errors: " + e.toString());
        }
    }
View Full Code Here

        try {
            Document document = createDocument(stream);
            return DocumentParser.parseAspectClassNames(document);
        }
        catch (DocumentException e) {
            throw new DefinitionException("XML definition file on classpath has errors: " + e.toString());
        }
    }
View Full Code Here

    public static List parse(final ClassLoader loader, final File definitionFile, boolean isDirty) {
        if (definitionFile == null) {
            throw new IllegalArgumentException("definition file can not be null");
        }
        if (!definitionFile.exists()) {
            throw new DefinitionException("definition file " + definitionFile.toString() + " does not exist");
        }

        // if definition is not updated; don't parse but return it right away
        if (isNotUpdated(definitionFile)) {
            isDirty = false;
            return s_definitions;
        }

        // updated definition, ready to be parsed
        try {
            Document document = createDocument(definitionFile.toURL());
            s_definitions = DocumentParser.parse(loader, document);

            setParsingTimestamp();
            isDirty = true;

            return s_definitions;
        }
        catch (MalformedURLException e) {
            throw new DefinitionException(definitionFile + " does not exist");
        }
        catch (DocumentException e) {
            throw new DefinitionException("XML definition file <" + definitionFile + "> has errors: " + e.toString());
        }
    }
View Full Code Here

            Document document = createDocument(stream);
            s_definitions = DocumentParser.parse(loader, document);
            return s_definitions;
        }
        catch (DocumentException e) {
            throw new DefinitionException("XML definition file on classpath has errors: " + e.getMessage());
        }
    }
View Full Code Here

                    // will probably never be implemented
                    break;
            }
        }
        catch (Exception e) {
            throw new DefinitionException("member pattern is not well formed: " + pattern, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.exception.DefinitionException

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.