Examples of Lifecycle


Examples of org.apache.catalina.Lifecycle

    @Override
    public void lifecycleEvent(LifecycleEvent event) {
        String type = event.getType();
        if (Lifecycle.BEFORE_STOP_EVENT.equals(type) || Lifecycle.STOP_EVENT.equals(type) || Lifecycle.AFTER_STOP_EVENT.equals(type)) {
            Lifecycle source = event.getLifecycle();
            boolean removed = activeManagers.remove(source);

            if (removed) {
                source.removeLifecycleListener(this);

                WebLogger.WEB_SSO_LOGGER.tracef("ClusteredSSO: removed stopped manager %s", source);
            }

            // TODO consider getting the sessions and removing any from our sso's
View Full Code Here

Examples of org.apache.catalina.Lifecycle

      Object[] args = {};
      String[] sig = {};
      Connector[] connectors = (Connector[]) server.invoke(service, "findConnectors", args, sig);
      for (int n = 0; n < connectors.length; n++)
      {
         Lifecycle lc = connectors[n];
         lc.start();
      }
      /*
       * TODO: // Notify listeners that connectors have started processing requests sendNotification(new
       * Notification(TOMCAT_CONNECTORS_STARTED, this, getNextNotificationSequenceNumber()));
       */
 
View Full Code Here

Examples of org.apache.catalina.Lifecycle

        Class clazz = Class.forName(className);
        LifecycleListener listener =
            (LifecycleListener) clazz.newInstance();

        // Add this LifecycleListener to our associated component
        Lifecycle lifecycle = (Lifecycle) digester.peek();
        lifecycle.addLifecycleListener(listener);

    }
View Full Code Here

Examples of org.apache.catalina.Lifecycle

        Class clazz = Class.forName(className);
        LifecycleListener listener =
            (LifecycleListener) clazz.newInstance();

        // Add this LifecycleListener to our associated component
        Lifecycle lifecycle = (Lifecycle) digester.peek();
        lifecycle.addLifecycleListener(listener);

    }
View Full Code Here

Examples of org.apache.maven.lifecycle.Lifecycle

            try
            {
                DefaultLifecycleExecutor lifecycleExecutor =
                    (DefaultLifecycleExecutor) session.lookup( LifecycleExecutor.ROLE );

                Lifecycle lifecycle = (Lifecycle) lifecycleExecutor.getPhaseToLifecycleMap().get( cmd );
                if ( lifecycle == null )
                {
                    throw new MojoExecutionException( "The given phase '" + cmd + "' is an unknown phase." );
                }

                LifecycleMapping lifecycleMapping =
                    (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, project.getPackaging() );
                @SuppressWarnings( "unchecked" )
                List<String> phases = lifecycle.getPhases();

                if ( lifecycle.getDefaultPhases() == null )
                {
                    descriptionBuffer.append( "'" + cmd + "' is a phase corresponding to this plugin:\n" );
                    for ( String key : phases )
                    {
                        if ( !key.equals( cmd ) )
                        {
                            continue;
                        }

                        if ( lifecycleMapping.getPhases( "default" ).get( key ) != null )
                        {
                            descriptionBuffer.append( lifecycleMapping.getPhases( "default" ).get( key ) );
                            descriptionBuffer.append( "\n" );
                        }
                    }

                    descriptionBuffer.append( "\n" );
                    descriptionBuffer.append(
                        "It is a part of the lifecycle for the POM packaging '" + project.getPackaging()
                            + "'. This lifecycle includes the following phases:" );
                    descriptionBuffer.append( "\n" );
                    for ( String key : phases )
                    {
                        descriptionBuffer.append( "* " + key + ": " );
                        String value = (String) lifecycleMapping.getPhases( "default" ).get( key );
                        if ( StringUtils.isNotEmpty( value ) )
                        {
                            for ( StringTokenizer tok = new StringTokenizer( value, "," ); tok.hasMoreTokens(); )
                            {
                                descriptionBuffer.append( tok.nextToken().trim() );

                                if ( !tok.hasMoreTokens() )
                                {
                                    descriptionBuffer.append( "\n" );
                                }
                                else
                                {
                                    descriptionBuffer.append( ", " );
                                }
                            }
                        }
                        else
                        {
                            descriptionBuffer.append( NOT_DEFINED ).append( "\n" );
                        }
                    }
                }
                else
                {
                    descriptionBuffer.append( "'" + cmd + "' is a lifecycle with the following phases: " );
                    descriptionBuffer.append( "\n" );

                    for ( String key : phases )
                    {
                        descriptionBuffer.append( "* " + key + ": " );
                        if ( lifecycle.getDefaultPhases().get( key ) != null )
                        {
                            descriptionBuffer.append( lifecycle.getDefaultPhases().get( key ) ).append( "\n" );
                        }
                        else
                        {
                            descriptionBuffer.append( NOT_DEFINED ).append( "\n" );
                        }
View Full Code Here

Examples of org.apache.maven.lifecycle.mapping.Lifecycle

        {
            return lifecycleMap;
        }

        lifecycleMap = new LinkedHashMap<String, Lifecycle>();
        Lifecycle lifecycle = new Lifecycle();

        lifecycle.setId( "default" );
        Map<String, String> phases = new LinkedHashMap<String, String>();
        phases.put( "process-resources", "org.apache.maven.plugins:maven-resources-plugin:resources" );
        phases.put( "compile", getCompiler() );
        phases.put( "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:testResources" );
        phases.put( "test-compile", "net.flexmojos.oss:flexmojos-maven-plugin:test-compile" );
        phases.put( "test", "net.flexmojos.oss:flexmojos-maven-plugin:test-run" );
        if ( getPackage() != null )
        {
            phases.put( "package", getPackage() );
        }
        phases.put( "install", "org.apache.maven.plugins:maven-install-plugin:install" );
        phases.put( "deploy", "org.apache.maven.plugins:maven-deploy-plugin:deploy" );
        lifecycle.setPhases( phases );

        lifecycleMap.put( "default", lifecycle );
        return lifecycleMap;
    }
View Full Code Here

Examples of org.apache.maven.plugin.lifecycle.Lifecycle

            Map map = new HashMap();

            for ( Iterator i = config.getLifecycles().iterator(); i.hasNext(); )
            {
                Lifecycle l = (Lifecycle) i.next();
                map.put( l.getId(), l );
            }

            lifecycleMappings = map;
        }
        return (Lifecycle) lifecycleMappings.get( lifecycle );
View Full Code Here

Examples of org.apache.openejb.jee.Lifecycle

//            return;
//        }
        if (!(specDD instanceof Lifecycle)) {
            return;
        }
        Lifecycle lifecycle = (Lifecycle) specDD;
        AbstractFinder classFinder = module.getClassFinder();
        //TODO Need to double check the LifecycleMethod Scanning, seems we also do it in the OpenEJB
        String componentType = null;
        if (specDD instanceof EnterpriseBean) {
            componentType = ((EnterpriseBean) specDD).getEjbClass();
        } else if (specDD instanceof Interceptor) {
            componentType = ((Interceptor) specDD).getInterceptorClass();
        } else if (specDD instanceof ApplicationClient) {
            componentType = ((ApplicationClient) specDD).getMainClass();
        }
        Map<String, LifecycleCallback> postConstructMap = mapLifecycleCallbacks(lifecycle.getPostConstruct(), componentType);
        Map<String, LifecycleCallback> preDestroyMap = mapLifecycleCallbacks(lifecycle.getPreDestroy(), componentType);
        if (module.getClassFinder() != null) {
            List<Method> postConstructs = classFinder.findAnnotatedMethods(PostConstruct.class);
            for (Method m : postConstructs) {
                String methodName = m.getName();
                String className = m.getDeclaringClass().getName();
                if (!postConstructMap.containsKey(className)) {
                    LifecycleCallback callback = new LifecycleCallback();
                    callback.setLifecycleCallbackClass(className);
                    callback.setLifecycleCallbackMethod(methodName);
                    lifecycle.getPostConstruct().add(callback);
                    postConstructMap.put(className, callback);
                }
            }
            List<Method> preDestroys = classFinder.findAnnotatedMethods(PreDestroy.class);
            for (Method m : preDestroys) {
                String methodName = m.getName();
                String className = m.getDeclaringClass().getName();
                if (!preDestroyMap.containsKey(className)) {
                    LifecycleCallback callback = new LifecycleCallback();
                    callback.setLifecycleCallbackClass(className);
                    callback.setLifecycleCallbackMethod(methodName);
                    preDestroyMap.put(className, callback);
                    lifecycle.getPreDestroy().add(callback);
                }
            }
        }
        Map<String, LifecycleMethod> postConstructs = map(postConstructMap);
        Map<String, LifecycleMethod> preDestroys = map(preDestroyMap);
View Full Code Here

Examples of org.apache.tapestry.ioc.annotations.Lifecycle

                _classFactory));
    }

    private String extractLifecycle(Method method)
    {
        Lifecycle lifecycle = method.getAnnotation(Lifecycle.class);

        return lifecycle != null ? lifecycle.value() : IOCConstants.DEFAULT_LIFECYCLE;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.Lifecycle

            return;
        }
        // shutdown destroyable instances in reverse instantiation order
        ListIterator<Context> iter = destroyQueue.listIterator(destroyQueue.size());
        while(iter.hasPrevious()){
            Lifecycle context = iter.previous();
            if (context.getLifecycleState() == RUNNING) {
                try {
                    if (context instanceof AtomicContext){
                        ((AtomicContext)context).destroy();
                    }
                } catch (TargetException e) {
                    // TODO send a monitoring event
                }
            }
        }
        if (contexts == null){
            return;
        }
        for(Lifecycle context: contexts.values()) {
            try {
                if (context.getLifecycleState() == RUNNING) {
                    context.stop();
                }
            } catch (CoreRuntimeException e){
                // TODO send monitoring event
            }
        }
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.