Package com.asakusafw.bulkloader.cache

Examples of com.asakusafw.bulkloader.cache.LocalCacheInfoRepository


            return;
        }
        LOG.info("TG-IMPORTER-11012",
                bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
        Connection connection = DBConnection.getConnection();
        LocalCacheInfoRepository repository = new LocalCacheInfoRepository(connection);
        try {
            repository.releaseLock(bean.getExecutionId());
        } finally {
            DBConnection.closeConn(connection);
        }
    }
View Full Code Here


    private void prepareForCache(ImportBean bean) throws BulkLoaderSystemException, BulkLoaderReRunnableException {
        assert bean != null;
        boolean succeed = false;
        Connection connection = DBConnection.getConnection();
        LocalCacheInfoRepository repository = new LocalCacheInfoRepository(connection);
        try {
            LOG.info("TG-IMPORTER-11004",
                    bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
            acquireCacheLock(bean, repository);

            LOG.info("TG-IMPORTER-11006",
                    bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
            Map<String, CacheInfo> map = collectRemoteCacheInfo(bean);

            for (String tableName : bean.getImportTargetTableList()) {
                ImportTargetTableBean tableInfo = bean.getTargetTable(tableName);
                String cacheId = tableInfo.getCacheId();
                if (cacheId == null) {
                    assert tableInfo.getImportProtocol() != null;
                    continue;
                }

                CacheInfo currentRemoteInfo = map.get(tableInfo.getDfsFilePath());
                Calendar startTimestamp = computeStartTimestamp(currentRemoteInfo, repository, tableName, tableInfo);

                tableInfo.setStartTimestamp(startTimestamp);
                LocalCacheInfo nextLocalInfo = new LocalCacheInfo(
                        cacheId,
                        null,
                        startTimestamp,
                        tableName,
                        tableInfo.getDfsFilePath());

                ThunderGateCacheSupport model = createDataModelObject(tableName, tableInfo);
                Calendar nextTimestamp = repository.putCacheInfo(nextLocalInfo);
                CacheInfo nextRemoteInfo = new CacheInfo(
                        CacheInfo.FEATURE_VERSION,
                        cacheId,
                        nextTimestamp,
                        tableName,
                        tableInfo.getImportTargetColumns(),
                        model.getClass().getName(),
                        model.__tgc__DataModelVersion());

                FileProtocol.Kind kind = startTimestamp == null
                    ? FileProtocol.Kind.CREATE_CACHE
                    : FileProtocol.Kind.UPDATE_CACHE;
                FileProtocol protocol = new FileProtocol(kind, tableInfo.getDfsFilePath(), nextRemoteInfo);
                tableInfo.setImportProtocol(protocol);
            }
            succeed = true;
        } finally {
            if (succeed == false) {
                repository.releaseLock(bean.getExecutionId());
            }
            DBConnection.closeConn(connection);
        }
    }
View Full Code Here

        tb1.setSearchCondition("");
        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    null,
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        final Calendar last = offset(-1);
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    last,
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

        tb1.setSearchCondition("");
        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    null,
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

        tb1.setSearchCondition("");
        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    offset(-1),
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

        tb1.setSearchCondition("");
        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    null,
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

        tb1.setSearchCondition("");
        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    null,
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

        tb1.setSearchCondition("");
        targetTable.put("__TG_TEST1", tb1);

        Connection conn = DBConnection.getConnection();
        try {
            LocalCacheInfoRepository repo = new LocalCacheInfoRepository(conn);
            repo.putCacheInfo(new LocalCacheInfo(
                    tb1.getCacheId(),
                    null,
                    null,
                    "__TG_TEST1",
                    tb1.getDfsFilePath()));
View Full Code Here

TOP

Related Classes of com.asakusafw.bulkloader.cache.LocalCacheInfoRepository

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.