Package org.torquebox.web.rack

Examples of org.torquebox.web.rack.RackMetaData


    private RailsRuntimeInitializer create(File root, String env) {
        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( "test-app");
        rubyAppMetaData.setRoot( root );
        rubyAppMetaData.setEnvironmentName( env );

        RackMetaData rackAppMetaData = new RackMetaData();
        RailsMetaData railsMetaData = new RailsMetaData();

        return new RailsRuntimeInitializer( rubyAppMetaData, rackAppMetaData, railsMetaData );
    }
View Full Code Here


        }
        ResourceRoot resourceRoot = unit.getAttachment( Attachments.DEPLOYMENT_ROOT );
        VirtualFile root = resourceRoot.getRoot();

        if (isRackApplication( root )) {
            RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

            if (rackAppMetaData == null) {
                rackAppMetaData = new RackMetaData();
                rackAppMetaData.setRackUpScriptLocation( DEFAULT_RACKUP_PATH );
                rackAppMetaData.attachTo( unit );
            }
        }
    }
View Full Code Here

            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;
        }

        ResourceRoot resourceRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
        VirtualFile root = resourceRoot.getRoot();

        ComponentEval instantiator = new ComponentEval();

        try {
            String rackUpFile = rackAppMetaData.getRackUpScriptFile(root.getPhysicalFile()).getAbsolutePath();
            instantiator.setCode(getCode(rackAppMetaData.getRackUpScript(root.getPhysicalFile()), rackUpFile));
            instantiator.setLocation(rackUpFile);

            ComponentResolverHelper helper = new ComponentResolverHelper(phaseContext, serviceName);

            helper
View Full Code Here

        ResourceRoot resourceRoot = unit.getAttachment( Attachments.DEPLOYMENT_ROOT );
        VirtualFile root = resourceRoot.getRoot();

        try {
            if (isRailsApplication( root )) {
                RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
                RailsMetaData railsAppMetaData = unit.getAttachment( RailsMetaData.ATTACHMENT_KEY );

                if (rackAppMetaData == null) {
                    rackAppMetaData = new RackMetaData();
                    rackAppMetaData.attachTo( unit );
                }

                if (railsAppMetaData == null) {
                    railsAppMetaData = new RailsMetaData();
                    unit.putAttachment( RailsMetaData.ATTACHMENT_KEY, railsAppMetaData );
View Full Code Here

        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }

        RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

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

    }

    @SuppressWarnings("unchecked")
    public void parse(DeploymentUnit unit, Object dataObj) throws Exception {

        RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

        if (rackAppMetaData == null) {
            rackAppMetaData = new RackMetaData();
            rackAppMetaData.attachTo( unit );
        }

        Map<String, Object> webData = (Map<String, Object>) dataObj;

        rackAppMetaData.setContextPath( (String) webData.get( "context" ) );
        rackAppMetaData.setStaticPathPrefix( (String) webData.get( "static" ) );

        if (webData.get( "rackup" ) != null) {
            rackAppMetaData.setRackUpScriptLocation( (String) webData.get( "rackup" ) );
        }

        Object hosts = webData.get( "host" );

        if (hosts instanceof List) {
            List<String> list = (List<String>) hosts;
            for (String each : list) {
                rackAppMetaData.addHost( each );
            }
        } else {
            rackAppMetaData.addHost( (String) hosts );
        }

        String timeoutStr = null;
       
        if (webData.containsKey( "session-timeout" )) {
            timeoutStr = webData.get( "session-timeout" ).toString();
        } else if (webData.containsKey( "session_timeout" )) {
            timeoutStr = webData.get( "session_timeout" ).toString();
        }

        rackAppMetaData.setSessionTimeout( TimeInterval.parseInterval( timeoutStr, TimeUnit.MINUTES ) );
    }
View Full Code Here

    @Test
    public void testPoolMetaDataAttaching() throws Throwable {
        MockDeploymentPhaseContext phaseContext = createPhaseContext();
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        (new RackMetaData()).attachTo( unit );

        deploy( phaseContext );

        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );
View Full Code Here

        prependDeployer( new TorqueBoxYamlParsingProcessor() );

        MockDeploymentPhaseContext phaseContext = setupResourceAsTorqueboxYml( "pooling.yml" );
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();

        (new RackMetaData()).attachTo( unit );

        deploy( phaseContext );
        List<PoolMetaData> allMetaData = unit.getAttachmentList( PoolMetaData.ATTACHMENTS_KEY );

        assertEquals( 1, allMetaData.size() );
View Full Code Here

        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
       
        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
        RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
        RailsMetaData railsAppMetaData = unit.getAttachment( RailsMetaData.ATTACHMENT_KEY );
       
        if (rubyAppMetaData == null || rackAppMetaData == null || railsAppMetaData == null) {
            return;
        }
       
        if (!railsAppMetaData.isRails3()) {
            File root = rubyAppMetaData.getRoot();
            File rackup = rackAppMetaData.getRackUpScriptFile(root);
            if (!rackup.exists()) {
                rackAppMetaData.setRackUpScript( getRackUpScript( rackAppMetaData.getContextPath() ) );
            }
        }
    }
View Full Code Here

    @Test
    public void testValidWebYml() throws Exception {
        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "valid-web.yml" );

        RackMetaData rackMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );

        assertNotNull( rackMetaData );

        assertEquals( "/tacos", rackMetaData.getContextPath() );
        assertEquals( 1, rackMetaData.getHosts().size() );
        assertEquals( "foobar.com", rackMetaData.getHosts().get( 0 ) );
        assertNull( rackMetaData.getStaticPathPrefix() );
        assertEquals( 600, rackMetaData.getSessionTimeout() );
    }
View Full Code Here

TOP

Related Classes of org.torquebox.web.rack.RackMetaData

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.