Search in sources :

Example 26 with ComponentLookupException

use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project x-pipe by ctripcorp.

the class DcClusterDao method postConstruct.

@PostConstruct
private void postConstruct() {
    try {
        dcClusterTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterTblDao.class);
        dcClusterShardTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterShardTblDao.class);
    } catch (ComponentLookupException e) {
        throw new ServerException("Cannot construct dao.", e);
    }
}
Also used : ServerException(com.ctrip.xpipe.redis.console.exception.ServerException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) PostConstruct(javax.annotation.PostConstruct)

Example 27 with ComponentLookupException

use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project x-pipe by ctripcorp.

the class RedisDao method postConstruct.

@PostConstruct
private void postConstruct() {
    try {
        redisTblDao = ContainerLoader.getDefaultContainer().lookup(RedisTblDao.class);
        dcClusterShardTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterShardTblDao.class);
    } catch (ComponentLookupException e) {
        throw new ServerException("Cannot construct dao.", e);
    }
}
Also used : ServerException(com.ctrip.xpipe.redis.console.exception.ServerException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) PostConstruct(javax.annotation.PostConstruct)

Example 28 with ComponentLookupException

use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project x-pipe by ctripcorp.

the class H2Init method executeSqlScript.

protected void executeSqlScript(String prepareSql) throws ComponentLookupException, SQLException {
    DataSourceManager dsManager = ContainerLoader.getDefaultContainer().lookup(DataSourceManager.class);
    Connection conn = null;
    PreparedStatement stmt = null;
    try {
        conn = dsManager.getDataSource(DATA_SOURCE).getConnection();
        conn.setAutoCommit(false);
        if (!Strings.isEmpty(prepareSql)) {
            for (String sql : prepareSql.split(";")) {
                logger.debug("[setup][data]{}", sql.trim());
                stmt = conn.prepareStatement(sql);
                stmt.executeUpdate();
            }
        }
        conn.commit();
    } catch (Exception ex) {
        logger.error("[SetUpTestDataSource][fail]:", ex);
        if (null != conn) {
            conn.rollback();
        }
    } finally {
        if (null != stmt) {
            stmt.close();
        }
        if (null != conn) {
            conn.setAutoCommit(true);
            conn.close();
        }
    }
}
Also used : Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) DataSourceManager(org.unidal.dal.jdbc.datasource.DataSourceManager) IOException(java.io.IOException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) SQLException(java.sql.SQLException)

Example 29 with ComponentLookupException

use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project x-pipe by ctripcorp.

the class DalTransactionAspect method postConstruct.

@PostConstruct
private void postConstruct() {
    try {
        transactionManager = ContainerLoader.getDefaultContainer().lookup(TransactionManager.class, ROLE_HINT);
        logger.info("[postConstruct]Load TransactionManager: {}", transactionManager.getClass());
    } catch (ComponentLookupException e) {
        throw new ServerException("Cannot find transaction manager.", e);
    }
}
Also used : ServerException(com.ctrip.xpipe.redis.console.exception.ServerException) TransactionManager(org.unidal.dal.jdbc.transaction.TransactionManager) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) PostConstruct(javax.annotation.PostConstruct)

Example 30 with ComponentLookupException

use of org.codehaus.plexus.component.repository.exception.ComponentLookupException in project x-pipe by ctripcorp.

the class ShardDao method postConstruct.

@PostConstruct
private void postConstruct() {
    try {
        clusterTblDao = ContainerLoader.getDefaultContainer().lookup(ClusterTblDao.class);
        dcClusterTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterTblDao.class);
        shardTblDao = ContainerLoader.getDefaultContainer().lookup(ShardTblDao.class);
        dcClusterShardTblDao = ContainerLoader.getDefaultContainer().lookup(DcClusterShardTblDao.class);
    } catch (ComponentLookupException e) {
        throw new ServerException("Cannot construct dao.", e);
    }
}
Also used : ServerException(com.ctrip.xpipe.redis.console.exception.ServerException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ComponentLookupException (org.codehaus.plexus.component.repository.exception.ComponentLookupException)40 IOException (java.io.IOException)11 ServerException (com.ctrip.xpipe.redis.console.exception.ServerException)7 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)7 ArrayList (java.util.ArrayList)6 PostConstruct (javax.annotation.PostConstruct)6 File (java.io.File)5 ArchiverException (org.codehaus.plexus.archiver.ArchiverException)5 Artifact (org.apache.maven.artifact.Artifact)4 ArtifactFilter (org.apache.maven.artifact.resolver.filter.ArtifactFilter)4 MavenSession (org.apache.maven.execution.MavenSession)4 SettingsBuildingException (org.apache.maven.settings.building.SettingsBuildingException)4 LinkedHashMap (java.util.LinkedHashMap)3 LinkedHashSet (java.util.LinkedHashSet)3 InvalidRepositoryException (org.apache.maven.artifact.InvalidRepositoryException)3 ArtifactMetadataRetrievalException (org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException)3 ArtifactMetadataSource (org.apache.maven.artifact.metadata.ArtifactMetadataSource)3 ResolutionGroup (org.apache.maven.artifact.metadata.ResolutionGroup)3 DefaultMetadataResolutionRequest (org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest)3 MetadataResolutionRequest (org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest)3