Package org.codehaus.aspectwerkz.exception

Examples of org.codehaus.aspectwerkz.exception.DefinitionException


                    adviceType = AdviceType.AFTER_FINALLY;
                } else if (type.startsWith("after finally ")) {
                    adviceType = AdviceType.AFTER_FINALLY;
                }
                if (specialArgumentType != null && specialArgumentType.indexOf(' ') > 0) {
                    throw new DefinitionException(
                            "argument to after (returning/throwing) can only be a type (parameter name binding should be done using args(..))"
                    );
                }
                final String aspectName = aspectDef.getName();
                AdviceDefinition adviceDef = DefinitionParserHelper.createAdviceDefinition(
                        name,
                        adviceType,
                        bindTo,
                        specialArgumentType,
                        aspectName,
                        aspectDef.getClassName(),
                        method,
                        aspectDef
                );

                aspectDef.addAfterAdviceDefinition(adviceDef);
            } else {
                throw new DefinitionException("Unkonw type for advice : " + type);
            }
        } catch (DefinitionException e) {
            System.err.println(
                    "WARNING: unable to register advice " + aspectDef.getName() + "." + name +
                    " at pointcut [" + bindTo + "] due to: " + e.getMessage()
View Full Code Here


                } else if (token.trim().equalsIgnoreCase("set")) {
                    hasSetPointcut = true;
                } else if (token.trim().equalsIgnoreCase("get")) {
                    hasGetPointcut = true;
                } else if (token.trim().equalsIgnoreCase("handler")) {
                    throw new DefinitionException("handler pointcut for advisable class is not supported");
                }
            }
        }
        if (hasAllPointcuts || hasExecutionPointcut) {
            DefinitionParserHelper.createAndAddAdvisableDef(
View Full Code Here

            }
            s_loader = new URLClassLoader(classPath, AnnotationC.class.getClassLoader());
        } catch (MalformedURLException e) {
            String message = "URL [" + classPath + "] is not valid: " + e.toString();
            logError(message);
            throw new DefinitionException(message, e);
        }

        String destDirToUse = destDir;
        if (destDir == null) {
            if (classpath.length != 1) {
                throw new DefinitionException("destDir must be specified since classpath is composite");
            }
            destDirToUse = classpath[0];
        }

        final AnnotationManager manager = new AnnotationManager(s_loader);
View Full Code Here

                ANNOTATION_DEFINITION.load(in);
            } catch (Exception e) {
                String message = "custom annotation properties " + propertiesFile + " can not be loaded: " +
                                 e.toString();
                logWarning(message);
                throw new DefinitionException(message);
            } finally {
                try {
                    in.close();
                } catch (Exception e) {
                    ;
                }
            }
        }

        for (Iterator it = ANNOTATION_DEFINITION.entrySet().iterator(); it.hasNext();) {
            Map.Entry entry = (Map.Entry) it.next();
            String name = ((String) entry.getKey()).trim();
            String className = ((String) entry.getValue()).trim();
            Class klass;
            if (className.equals("")) {
                // use default untyped annotation
                klass = UntypedAnnotation.class;
                className = klass.getName();
            } else {
                try {
                    klass = s_loader.loadClass(className);
                } catch (ClassNotFoundException e) {
                    String message = className
                                     +
                                     " could not be found on system classpath or class path provided as argument to the compiler";
                    logError(message);
                    throw new DefinitionException(message);
                }
            }
            logInfo("register custom annotation [" + name + " :: " + className + ']');
            manager.registerAnnotationProxy(klass, name);
            s_customAnnotations.put(name, className);
View Full Code Here

                        pointcut.startsWith("preinitialization(")) {
                    adviceInfo.pointcut = pointcut;
                } else if (pointcut.endsWith("()")) {
                    adviceInfo.pointcut = pointcut.substring(0, pointcut.length() - 2);
                } else {
                    throw new DefinitionException("pointcuts of type [" + pointcut + " are not yet supported");
                }
                adviceInfo.extraParameterFlags = adviceAttr.getExtraParameterFlags();
                int nrArgs = method.getArgumentTypes().length;
                String[] parameterTypes = new String[nrArgs];
                for (int i = 0; i < nrArgs; i++) {
View Full Code Here

            cv.visitFieldInsn(
                    GETFIELD, m_joinPointClassName, aspectInfo.getAspectFieldName(),
                    aspectInfo.getAspectClassSignature()
            );
        } else {
            throw new DefinitionException("deployment model [" + deploymentModel + "] is not supported");
        }
    }
View Full Code Here

            modifiers = ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC;
        } else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {
            fieldInfo.isStatic = false;
            modifiers = ACC_PRIVATE + ACC_FINAL + ACC_SYNTHETIC;
        } else {
            throw new DefinitionException(
                    "deployment model [" + mixinDef.getDeploymentModel() +
                    "] for mixin [" + mixinDef.getMixinImpl().getName() +
                    "] is not supported"
            );
View Full Code Here

     * @return the definitions
     */
    private static List loadDefinitionsAsResource(final ClassLoader loader) {
        final InputStream stream = ContextClassLoader.getResourceAsStream(DEFAULT_DEFINITION_FILE_NAME);
        if (stream == null) {
            throw new DefinitionException(
                    "either you have to specify an XML definition file using the -Daspectwerkz.definition.file=... option or you have to have the XML definition file <aspectwerkz.xml> somewhere on the classpath"
            );
        }
        return XmlParser.parse(loader, stream);
    }
View Full Code Here

    private static List loadDefinitionsFromFile(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

     * @return the definitions
     */
    private static List loadAspectClassNamesAsResource(final ClassLoader loader) {
        final InputStream stream = ContextClassLoader.getResourceAsStream(DEFAULT_DEFINITION_FILE_NAME);
        if (stream == null) {
            throw new DefinitionException(
                    "either you have to specify an XML definition file using the -Daspectwerkz.definition.file=... option or you have to have the XML definition file <aspectwerkz.xml> somewhere on the classpath"
            );
        }
        return XmlParser.getAspectClassNames(stream);
    }
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.