Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.AssemblyException


            UsedLayersModel usedLayersModel = new UsedLayersModel( usedLayers );
            List<ModuleModel> moduleModels = new ArrayList<>();
            String name = layerAssembly.name();
            if( name == null )
            {
                throw new AssemblyException( "Layer must have name set" );
            }
            ActivatorsModel<Layer> layerActivators = new ActivatorsModel<>( layerAssembly.activators() );
            LayerModel layerModel = new LayerModel( name, layerAssembly.metaInfo(), usedLayersModel, layerActivators, moduleModels );

            for( ModuleAssemblyImpl moduleAssembly : layerAssembly.moduleAssemblies() )
            {
                moduleModels.add( moduleAssembly.assembleModule( helper ) );
            }
            mapAssemblyModel.put( layerAssembly, layerModel );
            layerModels.add( layerModel );
        }

        // Populate used layer lists
        for( LayerAssemblyImpl layerAssembly : layerAssemblies )
        {
            Set<LayerAssembly> usesLayers = layerAssembly.uses();
            List<LayerModel> usedLayers = mapUsedLayers.get( layerAssembly );
            for( LayerAssembly usesLayer : usesLayers )
            {
                LayerModel layerModel = mapAssemblyModel.get( usesLayer );
                usedLayers.add( layerModel );
            }
        }

        // Bind model
        // This will resolve all dependencies
        try
        {
//            applicationModel.bind();
            applicationModel.accept( new BindingVisitor( applicationModel ) );
        }
        catch( BindingException e )
        {
            throw new AssemblyException( "Unable to bind: " + applicationModel, e );
        }

        return applicationModel;
    }
View Full Code Here


        for( Class<?> objectType : objectTypes )
        {
            if( objectType.isInterface() )
            {
                throw new AssemblyException( "Interfaces can not be Qi4j Objects." );
            }
            if( objectAssemblies.containsKey( objectType ) )
            {
                assemblies.add( objectAssemblies.get( objectType ) );
            }
View Full Code Here

        List<ServiceModel> serviceModels = new ArrayList<>();
        List<ImportedServiceModel> importedServiceModels = new ArrayList<>();

        if( name == null )
        {
            throw new AssemblyException( "Module must have name set" );
        }

        for( TransientAssemblyImpl compositeDeclaration : transientAssemblies.values() )
        {
            transientModels.add( compositeDeclaration.newTransientModel( metaInfoDeclaration, helper ) );
View Full Code Here

            filter( not( isAssignableFrom( Assembler.class ) ),
                    assemblerClasses )
        );
        if( !notAssemblers.isEmpty() )
        {
            throw new AssemblyException(
                "Classes " + notAssemblers + " are not implementing " + Assembler.class.getName()
            );
        }
        for( Class<?> assemblerClass : assemblerClasses )
        {
View Full Code Here

        {
            clazz = getClass().getClassLoader().loadClass( classname );
        }
        catch( Exception e )
        {
            throw new AssemblyException( "Unable to load class " + classname, e );
        }
        if( !Assembler.class.isAssignableFrom( clazz ) )
        {
            throw new AssemblyException(
                "Class " + classname + " is not implementing " + Assembler.class.getName()
            );
        }
        //noinspection unchecked
        return (Class<? extends Assembler>) clazz;
View Full Code Here

    private Assembler createAssemblerInstance( Class<?> assemblerClass )
        throws AssemblyException
    {
        if( !Assembler.class.isAssignableFrom( assemblerClass ) )
        {
            throw new AssemblyException(
                "Class " + assemblerClass + " is not implementing " + Assembler.class.getName()
            );
        }
        try
        {
            return (Assembler) assemblerClass.newInstance();
        }
        catch( Exception e )
        {
            throw new AssemblyException( "Unable to instantiate " + assemblerClass, e );
        }
    }
View Full Code Here

        try
        {
            SQLVendor sqlVendor = this.getSQLVendor();
            if( sqlVendor == null )
            {
                throw new AssemblyException( "SQL Vendor could not be determined." );
            }
            module.services( DatabaseSQLServiceComposite.class ).
                withMixins( DatabaseSQLServiceCoreMixin.class,
                            DatabaseSQLServiceSpi.CommonMixin.class,
                            getDatabaseStringBuilderMixin(),
                            DatabaseSQLServiceStatementsMixin.class,
                            getDatabaseSQLServiceSpecializationMixin() ).
                identifiedBy( hasIdentity() ? identity() : DEFAULT_ENTITYSTORE_IDENTITY ).
                visibleIn( Visibility.module ).
                setMetaInfo( sqlVendor );
        }
        catch( IOException ioe )
        {
            throw new AssemblyException( ioe );
        }
        module.services( SQLEntityStoreService.class,
                         UuidIdentityGeneratorService.class ).
            visibleIn( visibility() );
        if( hasConfig() )
View Full Code Here

        try
        {
            SQLVendor sqlVendor = getSQLVendor();
            if( sqlVendor == null )
            {
                throw new AssemblyException( "SQL Vendor could not be determined." );
            }
            module.services( getIndexQueryServiceType() )
                .identifiedBy( identity() )
                .setMetaInfo( sqlVendor )
                .visibleIn( visibility() )
                .instantiateOnStartup();
        }
        catch( IOException ex )
        {
            throw new AssemblyException( "SQL Vendor could not be created", ex );
        }

        module.services( ReindexerService.class ).
            visibleIn( Visibility.module );
        module.services( ReindexingStrategy.class ).
View Full Code Here

                declareDefaults().
                iniResourcePath().set( "classpath:web-shiro.ini" );
        }
        catch( IOException ex )
        {
            throw new AssemblyException( "Unable to find free port to bind to", ex );
        }
    }
View Full Code Here

            addServlets( serve( "/*" ).with( MyServletService.class ) ).to( module );
        }
        catch( IOException ex )
        {
            throw new AssemblyException( "Unable to find free port to bind to", ex );
        }
    }
View Full Code Here

TOP

Related Classes of org.qi4j.bootstrap.AssemblyException

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.