Package org.qi4j.api.service

Examples of org.qi4j.api.service.ServiceImporterException


        {
            throw e;
        }
        catch( Exception e )
        {
            throw new ServiceImporterException( "Could not import service " + identity, e );
        }
    }
View Full Code Here


        {
            throw e;
        }
        catch( Exception e )
        {
            throw new ServiceImporterException( "Could not import service " + identity, e );
        }
    }
View Full Code Here

            }
        }

        if( service == null )
        {
            throw new ServiceImporterException( "No service importer with id '" + serviceId + "' was found" );
        }

        return service;
    }
View Full Code Here

            filteredServices.add( service );
        }
        T service = ServiceQualifier.firstService( selector, filteredServices );
        if( service == null )
        {
            throw new ServiceImporterException( "Could not find any service to import that matches the given specification for " + serviceDescriptor
                .identity() );
        }
        return service;
    }
View Full Code Here

                if ( !circuitBreaker.isOn() ) {
                    Throwable throwable = circuitBreaker.lastThrowable();
                    if ( throwable != null ) {
                        throw throwable;
                    } else {
                        throw new ServiceImporterException( "Circuit breaker for DataSource " + dataSourceIdentity + " is not on" );
                    }
                }

                try {
                    Object result = method.invoke( pool, args );
View Full Code Here

                        throws Throwable
                    {
                        ServiceFinder finder = serviceDescriptor.metaInfo( ServiceFinder.class );
                        if( finder == null )
                        {
                            throw new ServiceImporterException( "No ServiceFinder specified for imported service " + serviceDescriptor
                                .identity() );
                        }
                        Object service = finder.findService( mainType ).get();
                        return method.invoke( service, args );
                    }
View Full Code Here

            try {

                DataSourceConfigurationValue config = getConfiguration( importedServiceDescriptor.identity() );
                if ( !config.enabled().get() ) {
                    // Not started
                    throw new ServiceImporterException( "DataSource not enabled" );
                }

                // Instantiate pool
                pool = setupDataSourcePool( config );
                pools.put( importedServiceDescriptor.identity(), pool );

                LOGGER.info( "Starting up DataSource '" + importedServiceDescriptor.identity() + "' for: {}@{}", config.username().get(), config.url().get() );

            } catch ( Exception e ) {
                throw new ServiceImporterException( e );
            }

            // Test the pool
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            Thread.currentThread().setContextClassLoader( null );
            try {
                pool.getConnection().close();
                LOGGER.info( "Database for DataSource is up!" );
            } catch ( SQLException e ) {
                LOGGER.warn( "Database for DataSource " + importedServiceDescriptor.identity() + " is not currently available" );
                throw new ServiceImporterException( "Database for DataSource " + importedServiceDescriptor.identity() + " is not currently available", e );
            } finally {
                Thread.currentThread().setContextClassLoader( cl );
            }
        }
View Full Code Here

                metaInfo( ApplicationContext.class ).
                getBean( serviceDescriptor.identity(), serviceDescriptor.type() );
        }
        catch( Throwable e )
        {
            throw new ServiceImporterException( "Could not import Spring service with id " + serviceDescriptor.identity(), e );
        }
    }
View Full Code Here

TOP

Related Classes of org.qi4j.api.service.ServiceImporterException

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.