Examples of Aspect


Examples of org.bladerunnerjs.model.Aspect

      .and(brjs).usesProductionTemplates()
      .and(brjs).usedForServletModel();
   
    // generate the app structure
    App app = brjs.app("app");
    Aspect aspect = app.defaultAspect();
    Bladeset bs = app.bladeset("bs");
    Blade b1 = bs.blade("b1");
    Workbench workbench = b1.workbench();
   
    given(app).hasBeenPopulated()
View Full Code Here

Examples of org.bladerunnerjs.model.Aspect

  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("target-app-name");
    String aspectName = parsedArgs.getString("new-aspect-name");
   
    App app = brjs.app(appName);
    Aspect aspect = app.aspect(aspectName);
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(aspect.dirExists()) throw new NodeAlreadyExistsException(aspect, this);
   
    try {
      aspect.populate();
    }
    catch(InvalidNameException e) {
      throw new CommandArgumentsException(e, this);
    }
    catch(ModelUpdateException e) {
      throw new CommandOperationException("Cannot create aspect '" + aspect.dir().getPath() + "'", e);
    }
   
    logger.println(Messages.ASPECT_CREATE_SUCCESS_CONSOLE_MSG, aspectName);
    logger.println(Messages.ASPECT_PATH_CONSOLE_MSG, aspect.dir().getPath());
   
    return 0;
  }
View Full Code Here

Examples of org.bladerunnerjs.model.Aspect

    boolean isRequirePrefix = parsedArgs.getBoolean("prefix");
    boolean isAlias = parsedArgs.getBoolean("alias");
    boolean showAllDependencies = parsedArgs.getBoolean("all");
   
    App app = brjs.app(appName);
    Aspect aspect = app.aspect(aspectName);
   
    if(isRequirePrefix && isAlias) throw new CommandArgumentsException("The --prefix and --alias switches can't both be used at the same time", this);
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(!aspect.dirExists()) throw new NodeDoesNotExistException(aspect, this);
   
    try {
      if(isRequirePrefix) {
        logger.println(DependencyGraphReportBuilder.createReportForRequirePrefix(aspect, requirePathOrAlias, showAllDependencies));
      }
View Full Code Here

Examples of org.codehaus.aspectwerkz.Aspect

        }

        boolean hasThrowsPointcut = false;
        Collection aspects = m_system.getAspects();
        for (Iterator it = aspects.iterator(); it.hasNext();) {
            Aspect aspect = (Aspect)it.next();
            if (aspect.hasThrowsPointcut(
                    m_classMetaData,
                    m_methodMetaData,
                    cause.getClass().getName())) {
                hasThrowsPointcut = true;
                break;
View Full Code Here

Examples of org.codehaus.aspectwerkz.aspect.Aspect

            catch (ClassNotFoundException e) {
                throw new RuntimeException(aspectClassName + " could not be found on classpath: " + e.toString());
            }

            // create an instance of the aspect class
            final Aspect aspect;
            try {
                aspect = (Aspect)aspectClass.newInstance();
            }
            catch (Exception e) {
                throw new RuntimeException(
                        "could not create a new instance of aspect [" + aspectClassName +
                        "], does the class inherit the [org.codehaus.aspectwerkz.aspect.Aspect] class?: " +
                        e.toString()
                );
            }

            int deploymentModel;
            if (aspectDef.getDeploymentModel() == null || aspectDef.getDeploymentModel().equals("")) {
                deploymentModel = DeploymentModel.PER_JVM;
            }
            else {
                deploymentModel = DeploymentModel.getDeploymentModelAsInt(aspectDef.getDeploymentModel());
            }

            // set the parameters
            Field field = Aspect.class.getDeclaredField("m_uuid");
            field.setAccessible(true);
            field.set(aspect, uuid);

            aspect.___AW_setName(aspectDef.getName());
            aspect.___AW_setAspectClass(aspectClass);
            aspect.___AW_setDeploymentModel(deploymentModel);
            aspect.___AW_setAspectDef(aspectDef);
            for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) {
                Map.Entry entry = (Map.Entry)it.next();
                aspect.___AW_setParameter((String)entry.getKey(), (String)entry.getValue());
            }

            // create and set the container for the aspect
            aspect.___AW_setContainer(new AspectContainer(aspect));

            PointcutManager pointcutManager = new PointcutManager(uuid, aspectDef.getName(), deploymentModel);

            // register the aspect in the system
            SystemLoader.getSystem(uuid).getAspectManager().register(aspect, pointcutManager);
View Full Code Here

Examples of org.codehaus.aspectwerkz.attribdef.aspect.Aspect

        final Class targetClass = joinPoint.getTargetClass();
        Object result = null;
        try {
            if (!m_perClass.containsKey(targetClass)) {
                synchronized (m_perClass) {
                    Aspect aspect = Aspect.newInstance(m_prototype);
                    aspect.___AW_setTargetClass(targetClass);
                    m_perClass.put(targetClass, aspect);
                }
            }
            result = m_methodRepository[methodIndex].invoke(
                    m_perClass.get(targetClass),
View Full Code Here

Examples of org.codehaus.aspectwerkz.attribdef.aspect.Aspect

        }

        try {
            if (!m_perInstance.containsKey(targetInstance)) {
                synchronized (m_perInstance) {
                    Aspect aspect = Aspect.newInstance(m_prototype);
                    aspect.___AW_setTargetInstance(targetInstance);
                    m_perInstance.put(targetInstance, aspect);
                }
            }
            result = m_methodRepository[methodIndex].invoke(
                    m_perInstance.get(targetInstance),
View Full Code Here

Examples of org.codehaus.aspectwerkz.attribdef.aspect.Aspect

     */
    public Aspect getPerClassAspect(final Class callingClass) {
        if (!m_perClass.containsKey(callingClass)) {
            synchronized (m_perClass) {
                try {
                    Aspect aspect = Aspect.newInstance(m_prototype);
                    aspect.___AW_setTargetClass(callingClass);
                    m_perClass.put(callingClass, aspect);
                }
                catch (Exception e) {
                    throw new WrappedRuntimeException(e);
                }
View Full Code Here

Examples of org.codehaus.aspectwerkz.attribdef.aspect.Aspect

            return getPerClassAspect(callingInstance.getClass());
        }
        if (!m_perInstance.containsKey(callingInstance)) {
            synchronized (m_perInstance) {
                try {
                    Aspect aspect = Aspect.newInstance(m_prototype);
                    aspect.___AW_setTargetInstance(callingInstance);
                    m_perInstance.put(callingInstance, aspect);
                }
                catch (Exception e) {
                    throw new WrappedRuntimeException(e);
                }
View Full Code Here

Examples of org.codehaus.aspectwerkz.attribdef.aspect.Aspect

            catch (ClassNotFoundException e) {
                throw new RuntimeException(aspectClassName + " could not be found on classpath");
            }

            // create an instance of the aspect class
            final Aspect aspect;
            try {
                aspect = (Aspect)aspectClass.newInstance();
            }
            catch (Exception e) {
                throw new RuntimeException("could not create a new instance of aspect [" + aspectClassName + "], does the class inherit the [org.codehaus.aspectwerkz.attribdef.aspect.Aspect] class?");
            }

            int deploymentModel;
            if (aspectDef.getDeploymentModel() == null || aspectDef.getDeploymentModel().equals("")) {
                deploymentModel = DeploymentModel.PER_JVM;
            }
            else {
                deploymentModel = DeploymentModel.getDeploymentModelAsInt(aspectDef.getDeploymentModel());
            }

            // set the parameters
            Field field = Aspect.class.getDeclaredField("m_uuid");
            field.setAccessible(true);
            field.set(aspect, uuid);
            aspect.___AW_setName(aspectDef.getName());
            aspect.___AW_setAspectClass(aspectClass);
            aspect.___AW_setDeploymentModel(deploymentModel);
            aspect.___AW_setAspectDef(aspectDef);
            for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) {
                Map.Entry entry = (Map.Entry)it.next();
                aspect.___AW_setParameter((String)entry.getKey(), (String)entry.getValue());
            }

            // TODO: handle parameters for attribdef (needs attribute support)
            // handle the parameters passed to the advice
//            for (Iterator it2 = aspectDef.getParameters().entrySet().iterator(); it2.hasNext();) {
//                Map.Entry entry = (Map.Entry)it2.next();
//                aspect.setParameter((String)entry.getKey(), (String)entry.getValue());
//            }

            // create and set the container for the aspect
            AspectContainer container = createAspectContainer(aspect);
            if (container != null) {
                aspect.___AW_setContainer(container);
            }
            else {
                throw new DefinitionException("could not create aspect container for aspect [" + aspect.___AW_getName() + "]");
            }

            // register the aspect in the system
            AspectMetaData aspectMetaData = new AspectMetaData(
                    uuid, aspectDef.getName(), deploymentModel
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.