Package com.asakusafw.thundergate.runtime.cache

Examples of com.asakusafw.thundergate.runtime.cache.CacheInfo


                            "Unexpected protocol kind in GetCacheInfo: {0}",
                            protocol.getKind(),
                            protocol.getLocation()));
                }
                LOG.info("TG-GETCACHE-01006", protocol.getLocation());
                CacheInfo info = getCacheInfo(protocol.getLocation());
                FileProtocol result;
                if (info == null) {
                    result = new FileProtocol(FileProtocol.Kind.RESPONSE_NOT_FOUND, protocol.getLocation(), null);
                    LOG.info("TG-GETCACHE-01008", protocol.getLocation());
                } else {
                    result = new FileProtocol(FileProtocol.Kind.RESPONSE_CACHE_INFO, protocol.getLocation(), info);
                    LOG.info("TG-GETCACHE-01007",
                            protocol.getLocation(),
                            info.getId(),
                            info.getTableName(),
                            info.getTimestamp().getTime());
                }
                if (RuntimeContext.get().isSimulation() == false) {
                    output.openNext(result).close();
                }
            }
View Full Code Here


            throw new IllegalArgumentException(MessageFormat.format(
                    "Invalid protocol kind in \"{0}\": {1}",
                    KEY_KIND,
                    kindString), e);
        }
        CacheInfo info;
        if (kind.hasCacheInfo()) {
            info = CacheInfo.loadFrom(properties);
        } else {
            info = null;
        }
View Full Code Here

        assert bean != null;
        assert user != null;
        assert protocol.getKind() == FileProtocol.Kind.CREATE_CACHE
            || protocol.getKind() == FileProtocol.Kind.UPDATE_CACHE;

        CacheInfo info = protocol.getInfo();
        assert info != null;

        ImportTargetTableBean targetTableBean = bean.getTargetTable(info.getTableName());
        if (targetTableBean == null) {
            // 対応するテーブルの定義がDSL存在しない場合異常終了する。
            throw new BulkLoaderSystemException(getClass(), "TG-EXTRACTOR-02001",
                    MessageFormat.format(
                            "エントリに対応するテーブルの定義がDSL存在しない。テーブル名:{0}",
                            info.getTableName()));
        }

        URI dfsFilePath = resolveLocation(bean, user, protocol.getLocation());
        try {
            CacheStorage storage = new CacheStorage(new Configuration(), dfsFilePath);
            try {
                LOG.info("TG-EXTRACTOR-11001", info.getId(), info.getTableName(), storage.getPatchProperties());
                storage.putPatchCacheInfo(info);
                LOG.info("TG-EXTRACTOR-11002", info.getId(), info.getTableName(), storage.getPatchProperties());

                Class<?> targetTableModel = targetTableBean.getImportTargetType();
                Path targetUri = storage.getPatchContents("0");
                LOG.info("TG-EXTRACTOR-11003", info.getId(), info.getTableName(), targetUri);
                long recordCount = write(targetTableModel, targetUri.toUri(), content);
                LOG.info("TG-EXTRACTOR-11004", info.getId(), info.getTableName(), targetUri, recordCount);
                LOG.info("TG-PROFILE-01002",
                        bean.getTargetName(),
                        bean.getBatchId(),
                        bean.getJobflowId(),
                        bean.getExecutionId(),
                        info.getTableName(),
                        recordCount);
                return recordCount;
            } finally {
                storage.close();
            }
        } catch (IOException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-11005",
                    info.getId(), info.getTableName(), dfsFilePath);
        }
    }
View Full Code Here

            String user,
            long recordCount) throws BulkLoaderSystemException {
        assert protocol != null;
        assert bean != null;
        assert user != null;
        CacheInfo info = protocol.getInfo();
        URI location = resolveLocation(bean, user, protocol.getLocation());
        assert info != null;
        try {
            switch (protocol.getKind()) {
            case CREATE_CACHE:
                return createCacheBuilder(CacheBuildClient.SUBCOMMAND_CREATE, bean, location, info);
            case UPDATE_CACHE:
                if (recordCount > 0) {
                    return createCacheBuilder(CacheBuildClient.SUBCOMMAND_UPDATE, bean, location, info);
                } else {
                    return null;
                }
            default:
                throw new AssertionError(protocol);
            }
        } catch (IOException e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-EXTRACTOR-12002",
                    protocol.getKind(),
                    info.getId(),
                    info.getTableName(),
                    bean.getTargetName(),
                    bean.getBatchId(),
                    bean.getJobflowId(),
                    bean.getExecutionId());
        }
View Full Code Here

        bean.setTargetTable(targetTable);
        bean.setExecutionId(executionId);

        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        FileList.Writer writer = FileList.createWriter(buffer, true);
        final CacheInfo info = new CacheInfo("a", "c1", Calendar.getInstance(), "IMPORT_TARGET1", Arrays.asList("a", "b"), "X", 0);
        writer.openNext(new FileProtocol(
                FileProtocol.Kind.CREATE_CACHE,
                tableBean1.getDfsFilePath(),
                info)
        ).close();
View Full Code Here

        bean.setTargetTable(targetTable);
        bean.setExecutionId(executionId);

        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        FileList.Writer writer = FileList.createWriter(buffer, true);
        final CacheInfo info = new CacheInfo("a", "c1", Calendar.getInstance(), "IMPORT_TARGET1", Arrays.asList("a", "b"), "X", 0);
        writer.openNext(new FileProtocol(
                FileProtocol.Kind.UPDATE_CACHE,
                tableBean1.getDfsFilePath(),
                info)
        ).close();
View Full Code Here

     * cache information exists.
     * @throws Exception if failed
     */
    @Test(timeout =  5000L)
    public void found() throws Exception {
        CacheInfo info = new CacheInfo(
                "a",
                "id",
                calendar("2011-12-13 14:15:16"),
                "available",
                Collections.singleton("COL"),
View Full Code Here

     * multiple requests.
     * @throws Exception if failed
     */
    @Test(timeout =  5000L)
    public void mixed() throws Exception {
        CacheInfo info = new CacheInfo(
                "a",
                "id",
                calendar("2011-12-13 14:15:16"),
                "available",
                Collections.singleton("COL"),
View Full Code Here

     * cache information exists.
     * @throws Exception if failed
     */
    @Test
    public void found() throws Exception {
        CacheInfo info = new CacheInfo(
                "a",
                "id",
                calendar("2011-12-13 14:15:16"),
                "EXAMPLE",
                Collections.singleton("COL"),
View Full Code Here

     * multiple requests.
     * @throws Exception if failed
     */
    @Test
    public void mixed() throws Exception {
        CacheInfo info = new CacheInfo(
                "a",
                "id",
                calendar("2011-12-13 14:15:16"),
                "EXAMPLE",
                Collections.singleton("COL"),
View Full Code Here

TOP

Related Classes of com.asakusafw.thundergate.runtime.cache.CacheInfo

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.