Package org.torquebox.core.app

Examples of org.torquebox.core.app.RubyAppMetaData


        phaseContext.getServiceTarget().addService( ServicesServices.serviceInjectableService( unit, serviceMetaData.getName() ), injectableService )
            .addDependencies( serviceStartName )
            .setInitialMode( Mode.PASSIVE )
            .install();
       
        final RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
       
        String mbeanName = ObjectNameFactory.create( "torquebox.services", new Hashtable<String, String>() {
            {
                put( "app", rubyAppMetaData.getApplicationName() );
                put( "name", StringUtils.underscore( serviceMetaData.getName() ) );
            }
        } ).toString();

        ServiceName mbeanServiceName = serviceStartName.append( "mbean" );
View Full Code Here


        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }

        ServiceName serviceName = WebServices.rackApplicationComponentResolver(unit);
        RubyAppMetaData rubyAppMetaData = unit.getAttachment(RubyAppMetaData.ATTACHMENT_KEY);
        RackMetaData rackAppMetaData = unit.getAttachment(RackMetaData.ATTACHMENT_KEY);

        if (rubyAppMetaData == null || rackAppMetaData == null) {
            return;
        }
View Full Code Here

        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
       
        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
        RailsMetaData railsAppMetaData = unit.getAttachment( RailsMetaData.ATTACHMENT_KEY );
       
        if ( rubyAppMetaData == null || railsAppMetaData == null) {
            return;
        }
       
        File railsRoot = rubyAppMetaData.getRoot();
        railsAppMetaData.setVersionSpec( determineRailsVersion( railsRoot ) );
    }
View Full Code Here

        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }

        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );

        if (rubyAppMetaData == null) {
            return;
        }

        String currentEnv = rubyAppMetaData.getEnvironmentName();
        String applicationDir = rubyAppMetaData.getRoot().getAbsolutePath();

        List<DatabaseMetaData> allMetaData = unit.getAttachmentList( DatabaseMetaData.ATTACHMENTS );

        Set<String> adapterIds = new HashSet<String>();
View Full Code Here

        // Add to our notifier's watch list
        unit.addToAttachmentList(DeploymentNotifier.SERVICES_ATTACHMENT_KEY, serviceName);
    }

    private boolean isInDevmode() {
        RubyAppMetaData appMetaData = unit.getAttachment(RubyAppMetaData.ATTACHMENT_KEY);

        boolean alwaysReload = false;

        if (appMetaData != null) {
            alwaysReload = appMetaData.isDevelopmentMode();
        }

        return alwaysReload;
    }
View Full Code Here

        }
    }

    protected void deploy(DeploymentPhaseContext phaseContext, final PoolMetaData poolMetaData) {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        final RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );

        if (rubyAppMetaData == null) {
            return;
        }

        if (poolMetaData.isShared()) {
            SharedRubyRuntimePool pool = new SharedRubyRuntimePool();
           
            pool.setName( poolMetaData.getName() );
            pool.setDeferUntilRequested( poolMetaData.isDeferUntilRequested() );

            RestartableRubyRuntimePool restartablePool = new RestartableRubyRuntimePool( pool );
            RubyRuntimeFactoryPoolService service = new RubyRuntimeFactoryPoolService( restartablePool );

            ServiceName name = CoreServices.runtimePoolName( unit, pool.getName() );

            phaseContext.getServiceTarget().addService( name, service )
                    .addDependency( CoreServices.runtimeFactoryName( unit ), RubyRuntimeFactory.class, service.getRubyRuntimeFactoryInjector() )
                    .addDependency( CoreServices.appNamespaceContextSelector( unit ), NamespaceContextSelector.class, service.getNamespaceContextSelectorInjector() )
                    .install();

            unit.addToAttachmentList( DeploymentNotifier.SERVICES_ATTACHMENT_KEY, name );

            ServiceName startName = CoreServices.runtimeStartPoolName( unit, pool.getName() );
            phaseContext.getServiceTarget().addService( startName, new RubyRuntimePoolStartService( pool ) )
                    .addDependency( name )
                    .setInitialMode( Mode.PASSIVE )
                    .install();

            String mbeanName = ObjectNameFactory.create( "torquebox.pools", new Hashtable<String, String>() {
                {
                    put( "app", rubyAppMetaData.getApplicationName() );
                    put( "name", poolMetaData.getName() );
                }
            } ).toString();

            ServiceName mbeanServiceName = name.append( "mbean" );
            MBeanRegistrationService<BasicRubyRuntimePoolMBean> mbeanService = new MBeanRegistrationService<BasicRubyRuntimePoolMBean>( mbeanName, mbeanServiceName );
            phaseContext.getServiceTarget().addService( mbeanServiceName, mbeanService )
                    .addDependency( DependencyType.OPTIONAL, MBeanServerService.SERVICE_NAME, MBeanServer.class, mbeanService.getMBeanServerInjector() )
                    .addDependency( name, BasicRubyRuntimePoolMBean.class, mbeanService.getValueInjector() )
                    .setInitialMode( Mode.PASSIVE )
                    .install();

        } else {
            DefaultRubyRuntimePool pool = new DefaultRubyRuntimePool();
           
            pool.setName( poolMetaData.getName() );
            pool.setMinimumInstances( poolMetaData.getMinimumSize() );
            pool.setMaximumInstances( poolMetaData.getMaximumSize() );
            pool.setDeferUntilRequested( poolMetaData.isDeferUntilRequested() );

            RestartableRubyRuntimePool restartablePool = new RestartableRubyRuntimePool( pool );
            RubyRuntimeFactoryPoolService service = new RubyRuntimeFactoryPoolService( restartablePool );

            ServiceName name = CoreServices.runtimePoolName( unit, pool.getName() );
            phaseContext.getServiceTarget().addService( name, service )
                    .addDependency( CoreServices.runtimeFactoryName( unit ), RubyRuntimeFactory.class, service.getRubyRuntimeFactoryInjector() )
                    .addDependency( CoreServices.appNamespaceContextSelector( unit ), NamespaceContextSelector.class, service.getNamespaceContextSelectorInjector() )
                    .install();

            unit.addToAttachmentList( DeploymentNotifier.SERVICES_ATTACHMENT_KEY, name );

            phaseContext.getServiceTarget().addService( name.append( "START" ), new RubyRuntimePoolStartService( pool ) )
                    .addDependency( name )
                    .setInitialMode( Mode.PASSIVE )
                    .install();
           
            String mbeanName = ObjectNameFactory.create( "torquebox.pools", new Hashtable<String, String>() {
                {
                    put( "app", rubyAppMetaData.getApplicationName() );
                    put( "name", poolMetaData.getName() );
                }
            } ).toString();
           
            ServiceName mbeanServiceName = name.append( "mbean" );
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyAppMetaData rubyAppMetaData = unit.getAttachment(RubyAppMetaData.ATTACHMENT_KEY);

        if (rubyAppMetaData == null) {
            return;
        }
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );

        if (rubyAppMetaData != null) {
            if (rubyAppMetaData.getEnvironmentName() != null) {
                AbstractSplitYamlParsingProcessor.logDeprecation( unit, "Setting the application environment via the 'application:' section is deprecated. Set RAILS_ROOT or RACK_ROOT via the 'environment:' section instead." );
            }
            rubyAppMetaData.extractAppEnvironment();
            rubyAppMetaData.applyDefaults();
        }
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void parse(DeploymentUnit unit, Object dataObj) throws Exception {
       
        RubyAppMetaData appMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );

        if (appMetaData == null) {
            appMetaData = new RubyAppMetaData( unit.getName() );
            appMetaData.attachTo( unit );
        }

        Map<String, Object> envData = (Map<String, Object>) dataObj;
        Map<String, String> env = new HashMap<String, String>();

        for (String key : envData.keySet()) {
            env.put( key, envData.get( key ).toString() );
        }

        Map<String, String> appEnv = appMetaData.getEnvironmentVariables();

        if (appEnv == null) {
            appEnv = new HashMap<String, String>();
            appMetaData.setEnvironmentVariables( appEnv );
        }

        appEnv.putAll( env );
    }
View Full Code Here

        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
        PoolMetaData jobsPool = PoolMetaData.extractNamedMetaData( allMetaData, "jobs" );

        if (jobsPool == null) {
            RubyAppMetaData envMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
            boolean devMode = envMetaData != null && envMetaData.isDevelopmentMode();
            jobsPool = devMode ? new PoolMetaData( "jobs", 1, 10 ) : new PoolMetaData( "jobs" );
            unit.addToAttachmentList( PoolMetaData.ATTACHMENTS_KEY, jobsPool );
        }
    }
View Full Code Here

TOP

Related Classes of org.torquebox.core.app.RubyAppMetaData

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.