Package org.torquebox.core

Examples of org.torquebox.core.TorqueBoxMetaData


    @Test
    public void testSimpleTorqueBoxYml() throws Exception {
        MockDeploymentUnit unit = deployResourceAsTorqueboxYml( "simple-torquebox.yml" );
       
        TorqueBoxMetaData metaData = unit.getAttachment( TorqueBoxMetaData.ATTACHMENT_KEY );
        assertNotNull( metaData );

        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
        assertNotNull( rubyAppMetaData );
       
View Full Code Here


        MockDeploymentPhaseContext phaseContext = createPhaseContext( "torquebox.yml", torqueboxYml );
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();
        deploy( phaseContext );
       
        TorqueBoxMetaData metaData = unit.getAttachment( TorqueBoxMetaData.ATTACHMENT_KEY );
        assertNotNull( metaData );
    }
View Full Code Here

        MockDeploymentPhaseContext phaseContext = createPhaseContext( "torquebox.yml", torqueboxYml );
        MockDeploymentUnit unit = phaseContext.getMockDeploymentUnit();
        deploy( phaseContext );
       

        TorqueBoxMetaData metaData = unit.getAttachment( TorqueBoxMetaData.ATTACHMENT_KEY );
        assertNotNull( metaData );

        assertNotNull( metaData.getSection( "application" ) );
        assertNotNull( metaData.getSection( "app" ) );
        assertSame( metaData.getSection("app"), metaData.getSection( "application" ) );
        assertNotNull( metaData.getSection( "web" ) );
        assertNotNull( metaData.getSection( "queues" ) );
        assertNotNull( metaData.getSection( "topics" ) );
        assertNotNull( metaData.getSection( "messaging" ) );
        assertNotNull( metaData.getSection( "services" ) );
        assertNotNull( metaData.getSection( "jobs" ) );
        assertNotNull( metaData.getSection( "ruby" ) );
    }
View Full Code Here

                data = YAMLUtils.parseYaml( file );
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException("Error processing yaml: ", e);
            }
                       
            TorqueBoxMetaData metaData = new TorqueBoxMetaData( data );
            TorqueBoxMetaData externalMetaData = unit.getAttachment( TorqueBoxMetaData.ATTACHMENT_KEY );
            if (externalMetaData != null) {
                metaData = externalMetaData.overlayOnto( metaData );
            }
           
            try {
                metaData.validate();
            } catch (SchemaException e) {
View Full Code Here

    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        ResourceRoot resourceRoot = unit.getAttachment( Attachments.DEPLOYMENT_ROOT );
        TorqueBoxMetaData globalMetaData = unit.getAttachment( TorqueBoxMetaData.ATTACHMENT_KEY );

        Object data = null;

        if (globalMetaData != null) {
            data = globalMetaData.getSection( getSectionName() );
        }

        VirtualFile root = resourceRoot.getRoot();
        if (data == null && isSupportsStandalone()) {
            VirtualFile metaDataFile = getMetaDataFile( root, getFileName() );
View Full Code Here

                log.error( "  " + e.getMessage() );
                log.error( "============================================================" );
               
                throw new DeploymentUnitProcessingException( "Failed to load " + file.getAbsolutePath(), e );
            }
            TorqueBoxMetaData metaData = new TorqueBoxMetaData( metaDataHash );
            TorqueBoxMetaData existingMetaData = unit.getAttachment( TorqueBoxMetaData.ATTACHMENT_KEY );
            if ( existingMetaData != null ) {
                metaData = existingMetaData.overlayOnto( metaData );
            }
            unit.putAttachment( TorqueBoxMetaData.ATTACHMENT_KEY, metaData );
        }
    }
View Full Code Here

public class AppKnobYamlParsingProcessor extends AbstractParsingProcessor {

    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        TorqueBoxMetaData metaData = null;
        File rootFile = null;
        ResourceRoot appRoot = null;

        try {
            VirtualFile appKnobYml = getFile( unit );
            if (appKnobYml == null) {
                return;
            }
            GlobalRuby ruby = null;
            try {
                ruby = (GlobalRuby) phaseContext.getServiceRegistry().getRequiredService( CoreServices.GLOBAL_RUBY ).getValue();
                metaData = new TorqueBoxMetaData( ruby.evaluateErb( YAMLUtils.parseYaml( appKnobYml ) ) );
            } catch (org.jboss.msc.service.ServiceNotFoundException e) {
                log.warn("No GlobalRuby available to parse ERB in deployment descriptor");
                metaData = new TorqueBoxMetaData( YAMLUtils.parseYaml( appKnobYml ) );
            }
            rootFile = metaData.getApplicationRootFile();

            if (rootFile != null) {
                VirtualFile root = VFS.getChild( rootFile.toURI() );
                if (!root.exists()) {
                    throw new DeploymentUnitProcessingException( "Application root does not exist: " + root.toURL().toExternalForm() );
                }

                if (root.exists() && !root.isDirectory()) {
                    // Expand the referenced root if it's not a directory (ie
                    // .knob archive)
                    final Closeable closable = VFS.mountZipExpanded( root, root, TempFileProviderService.provider() );
                    final MountHandle mountHandle = new MountHandle( closable );
                    appRoot = new ResourceRoot( root, mountHandle );

                } else {
                    appRoot = new ResourceRoot( root, null );
                }
                appRoot.putAttachment( Attachments.INDEX_RESOURCE_ROOT, false );
                unit.putAttachment( Attachments.DEPLOYMENT_ROOT, appRoot );
            }
            else {
                log.infof( "Rootless deployment detected: %s", unit.getName() );
                DeploymentUtils.markUnitAsRootless( unit );
            }

        } catch (YAMLException e) {
            throw new DeploymentUnitProcessingException( "Error processing YAML: ", e );
        } catch (Exception e) {
            throw new DeploymentUnitProcessingException( e );
        }

        unit.putAttachment( TorqueBoxMetaData.ATTACHMENT_KEY, metaData );

        RubyAppMetaData rubyAppMetaData = new RubyAppMetaData( unit.getName() );
        rubyAppMetaData.setRoot( rootFile );
        rubyAppMetaData.setEnvironmentName( metaData.getApplicationEnvironment() );
        rubyAppMetaData.attachTo( unit );

    }
View Full Code Here

TOP

Related Classes of org.torquebox.core.TorqueBoxMetaData

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.