Package org.codehaus.loom.interfaces

Examples of org.codehaus.loom.interfaces.LoomException


            loadBlockListeners();
        }
        catch( final Throwable t )
        {
            getLogger().info( "Exception loading listeners:" + t.getMessage() + "\n", t );
            throw new LoomException( t.getMessage(), t );
        }
        try
        {
            final PartitionProfile partition =
                m_context.getPartitionProfile().getPartition( ContainerConstants.BLOCK_PARTITION );
            final ComponentProfile[] blocks = partition.getComponents();
            for( int i = 0; i < blocks.length; i++ )
            {
                final String blockName = blocks[i].getTemplate().getName();
                final BlockEntry blockEntry = new BlockEntry( blocks[i] );
                m_entries.put( blockName, blockEntry );
            }

            // load blocks
            runPhase( PHASE_STARTUP );
        }
        catch( final Throwable t )
        {
            getLogger().info( "exception while starting:" + t.getMessage() + "\n" );
            t.printStackTrace();
            throw new LoomException( t.getMessage(), t );
        }

        m_running = true;
    }
View Full Code Here


            (Map)m_installations.get( name );
        if( null == installation )
        {
            final String message =
                REZ.format( "deploy.no-deployment.error", name );
            throw new LoomException( message );
        }
        try
        {
            final File source = (File)installation.
                get( ContainerConstants.INSTALL_SOURCE );
            redeploy( name, source.toURL() );
        }
        catch( final LoomException e )
        {
            throw e;
        }
        catch( final Exception e )
        {
            throw new LoomException( e.getMessage(), e );
        }
    }
View Full Code Here

            undeploy( name );
            deploy( name, location );
        }
        catch( final Exception e )
        {
            throw new LoomException( e.getMessage(), e );
        }
        finally
        {
            m_kernel.unlock();
        }
View Full Code Here

            (Map)m_installations.remove( name );
        if( null == installation )
        {
            final String message =
                REZ.format( "deploy.no-deployment.error", name );
            throw new LoomException( message );
        }
        try
        {
            m_kernel.removeApplication( name );
            m_installer.uninstall( installation );
        }
        catch( final Exception e )
        {
            throw new LoomException( e.getMessage(), e );
        }
    }
View Full Code Here

        {
            deploy( name, new URL( sarURL ) );
        }
        catch( MalformedURLException mue )
        {
            throw new LoomException( mue.getMessage(), mue );
        }
    }
View Full Code Here

        if( m_installations.containsKey( name ) )
        {
            final String message =
                REZ.format( "deploy.already-deployed.error",
                            name );
            throw new LoomException( message );
        }

        /*
         * Clear all the reosurces out of ResourceManager cache
         * so that reloaded applications will have their i18n bundles
         * reloaded.
         */
        ResourceManager.clearResourceCache();

        Map installation = null;
        boolean success = false;
        try
        {
            //m_baseWorkDirectory
            installation = m_installer.install( name, location );

            final Configuration config =
                getConfigurationFor( installation,
                                     ContainerConstants.INSTALL_CONFIG,
                                     null );
            final Configuration environment =
                getConfigurationFor( installation,
                                     ContainerConstants.INSTALL_ENVIRONMENT,
                                     null );
            final Configuration assembly =
                getConfigurationFor( installation,
                                     ContainerConstants.INSTALL_ASSEMBLY,
                                     ConfigurationBuilder.ASSEMBLY_SCHEMA );

            final File homeDirectory =
                (File)installation.get( ContainerConstants.INSTALL_HOME );
            final File workDirectory =
                (File)installation.get( ContainerConstants.INSTALL_WORK );

            final Map data = new HashMap();
            data.put( BlockContext.APP_NAME, name );
            data.put( BlockContext.APP_HOME_DIR, homeDirectory );

            final Configuration logs = environment.getChild( "logs", false );
            //Load hierarchy before classloader placed in context as
            //that way the logFactory will not try to use the application
            //specific classloader to load the targets which will cause
            //CastClassExceptions
            final LoggerStore store =
                m_logManager.createHierarchy( logs,
                                              homeDirectory,
                                              workDirectory,
                                              data );

            final ClassLoaderSet classLoaderSet =
                m_classLoaderManager.createClassLoaderSet( environment,
                                                           data,
                                                           homeDirectory,
                                                           workDirectory );

            //TODO: Add classLoaderSet to application resources

            final ClassLoader classLoader =
                classLoaderSet.getDefaultClassLoader();

            final Configuration newConfig =
                processConfiguration( name, config );

            final Map parameters = new HashMap();
            parameters.put( ContainerConstants.ASSEMBLY_NAME, name );
            parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
            parameters.put( ContainerConstants.CONFIG_DESCRIPTOR, newConfig );
            parameters.put( ContainerConstants.ASSEMBLY_CLASSLOADER,
                            classLoader );

            //assemble all the blocks for application
            final PartitionProfile profile =
                m_builder.buildProfile( parameters );

            m_verifier.verifySar( profile, classLoader );

            //Setup configuration for all the applications blocks
            verifyConfiguration( profile, newConfig );

            validateConfiguration( profile, classLoader );

            //Finally add application to kernel
            m_kernel.addApplication( profile,
                                     homeDirectory,
                                     workDirectory,
                                     classLoader,
                                     store );

            m_installations.put( name, installation );

            final String message =
                REZ.format( "deploy.notice.sar.add",
                            name );
            getLogger().debug( message );
            success = true;
        }
        catch( final LoomException de )
        {
            throw de;
        }
        catch( final Exception e )
        {
            //From classloaderManager/kernel
            throw new LoomException( e.getMessage(), e );
        }
        finally
        {
            if( !success && null != installation )
            {
View Full Code Here

        catch( final Exception e )
        {
            final String message = REZ.format( "deploy.error.config.create",
                                               location );
            getLogger().error( message, e );
            throw new LoomException( message, e );
        }
    }
View Full Code Here

                                                       config );
                newConfiguration.addChild( newConfig );
            }
            catch( final ConfigurationException ce )
            {
                throw new LoomException( ce.getMessage(), ce );
            }
        }
        return newConfiguration;
    }
View Full Code Here

            if( null == component )
            {
                final String message =
                    REZ.format( "deploy.error.extra.config",
                                name );
                throw new LoomException( message );
            }
        }
    }
View Full Code Here

                final String message =
                    "Unable to validate configuration of component " +
                    component.getTemplate().getName() +
                    " of type " +
                    component.getInfo().getType().getName();
                throw new LoomException( message );
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.loom.interfaces.LoomException

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.