Package org.apache.fulcrum.yaafi.framework.component

Examples of org.apache.fulcrum.yaafi.framework.component.ServiceComponent


     *
     * @param serviceList the list of services to dispose
     */
    private void disposeAll(List serviceList)
    {
        ServiceComponent serviceComponent = null;

        for( int i=serviceList.size()-1; i>=0; i-- )
        {
            serviceComponent = (ServiceComponent) serviceList.get(i);
            this.dispose( serviceComponent );
View Full Code Here


    {
        Validate.notNull(roleConfiguration,"roleConfiguration");
        Validate.notNull(logger,"logger");

        ArrayList result = new ArrayList();
        ServiceComponent serviceComponent = null;

        // create an appropriate instance of role configuration parser

        RoleConfigurationParser roleConfigurationParser = this.createRoleConfigurationParser();

        // extract the role entries

        RoleEntry[] roleEntryList = roleConfigurationParser.parse(roleConfiguration);

        // get the default interceptors defined for the container

        ArrayList defaultInterceptorList = this.getDefaultInterceptorServiceList();

        // create the service components based on the role entries

        for ( int i=0; i<roleEntryList.length; i++ )
        {
            try
            {
                // add the default interceptors to all role entries

                RoleEntry roleEntry = roleEntryList[i];

                if( this.hasDynamicProxies() )
                {
                    roleEntry.addInterceptors(defaultInterceptorList);
                }
                else
                {
                    roleEntry.setHasDynamicProxy(false);
                }

                serviceComponent = new AvalonServiceComponentImpl(
                    roleEntry,
                    this.getLogger(),
                    logger
                    );

                result.add( serviceComponent );
            }
            catch( Throwable t )
            {
                String serviceComponentName = ( serviceComponent != null ? serviceComponent.getName() : "unknown" );
                String msg = "Failed to load the service " + serviceComponentName;
                this.getLogger().error( msg, t );
                throw new ConfigurationException( msg, t );
            }
        }
View Full Code Here

        // fill the service map mapping from a service name to an instance

        for( int i=0; i<this.getServiceList().size(); i++ )
        {
            ServiceComponent serviceComponent = (ServiceComponent) this.getServiceList().get(i);
            this.getServiceMap().put( serviceComponent.getName(), serviceComponent );
        }

        // ensure that fallback service managers are available

        for(int i=0; i<this.fallbackServiceManagerList.size(); i++)
View Full Code Here

        throws ConfigurationException
    {
        Validate.notNull( configuration, "configuration" );

        int exceptionCounter = 0;
        ServiceComponent serviceComponent = null;

        this.getLogger().warn("Reconfiguring all services ...");

        // 1) wait for some time

        this.waitForReconfiguration();

        // 2) store the new configuration

        this.serviceConfiguration = configuration;

        Properties componentConfigurationProperties = this.loadComponentConfigurationProperties();

        ConfigurationUtil.expand(
            this.getLogger(),
            (DefaultConfiguration) this.serviceConfiguration,
            componentConfigurationProperties
            );

        // 3) reconfigure the services

        for( int i=0; i<this.getServiceList().size(); i++ )
        {
            serviceComponent = (ServiceComponent) this.getServiceList().get(i);

            Configuration serviceComponentConfiguraton = this.getServiceConfiguration().getChild(
                serviceComponent.getShorthand()
                );

            try
            {
                serviceComponent.setConfiguration(serviceComponentConfiguraton);
                serviceComponent.reconfigure();
            }
            catch(Throwable t)
            {
                String msg = "Reconfiguring of " + serviceComponent.getShorthand() + " failed";
                this.getLogger().error(msg);
                exceptionCounter++;
            }
        }
View Full Code Here

        // fill the service map mapping from a service name to an instance

        for( int i=0; i<this.getServiceList().size(); i++ )
        {
            ServiceComponent serviceComponent = (ServiceComponent) this.getServiceList().get(i);
            this.getServiceMap().put( serviceComponent.getName(), serviceComponent );
        }

        // run the various lifecycle stages

        this.incarnateAll( this.getServiceList() );
View Full Code Here

    {
        Validate.notNull( configuration, "configuration" );

        Object lock = null;
        int exceptionCounter = 0;
        ServiceComponent serviceComponent = null;

        this.getLogger().warn("Reconfiguring all services ...");

        try
        {
            // 1) lock the service container

            lock = this.getWriteLock();

          // 2) store the new configuration

          this.serviceConfiguration = configuration;

            Properties componentConfigurationProperties = this.loadComponentConfigurationProperties();

            ConfigurationUtil.expand(
                this.getLogger(),
                (DefaultConfiguration) this.serviceConfiguration,
                componentConfigurationProperties
                );

          // 3) reconfigure the services

          for( int i=0; i<this.getServiceList().size(); i++ )
          {
              serviceComponent = (ServiceComponent) this.getServiceList().get(i);

              Configuration serviceComponentConfiguraton = this.getServiceConfiguration().getChild(
                  serviceComponent.getShorthand()
                  );

              try
              {
                  serviceComponent.setConfiguration(serviceComponentConfiguraton);
                  serviceComponent.reconfigure();
              }
              catch(Throwable t)
              {
                  String msg = "Reconfiguring of " + serviceComponent.getShorthand() + " failed";
                  this.getLogger().error(msg);
                  exceptionCounter++;
              }
          }
View Full Code Here

        try
        {
            lock = this.getReadLock();

          List serviceList = this.getServiceList();
          ServiceComponent serviceComponent = null;
          RoleEntry[] result = new RoleEntry[serviceList.size()];

          for( int i=0; i<result.length; i++ )
          {
              serviceComponent = (ServiceComponent) serviceList.get(i);
              result[i] = serviceComponent.getRoleEntry();
          }

          return result;
        }
        finally
View Full Code Here

    {
        Validate.notEmpty( name, "name" );

        boolean result = false;
        Object lock = null;
        ServiceComponent serviceComponent = null;

        // look at our available service

        try
        {
View Full Code Here

    {
        Validate.notEmpty( name, "name" );

        Object lock = null;
        Object result = null;
        ServiceComponent serviceComponent = null;

        // look at our available service

        try
        {
            lock = this.getReadLock();
            serviceComponent = this.getLocalServiceComponent(name);

            if( serviceComponent != null )
            {
                result = serviceComponent.getInstance();
            }
        }
        catch( Throwable t )
        {
            String msg = "Failed to lookup a service " + name;
View Full Code Here

        Object lock = null;

        try
        {
            lock = this.getWriteLock();
            ServiceComponent serviceComponent = this.getServiceComponentEx(name);
            this.decommision(serviceComponent);
        }
        finally
        {
            this.releaseLock(lock);
View Full Code Here

TOP

Related Classes of org.apache.fulcrum.yaafi.framework.component.ServiceComponent

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.