001package org.opengion.hayabusa.io; 002 003import org.opengion.fukurou.model.FileOperationFactory; 004import org.opengion.fukurou.model.FileOperation; 005import org.opengion.fukurou.util.StringUtil; 006import org.opengion.hayabusa.common.HybsSystem; 007 008/** 009 * クラウド別のクラス生成 010 * 011 * @og.rev 5.10.8.0 (2019/02/01) 新規作成 012 * @og.group 013 * 014 * @version 5.0 015 * @author Takahashi Masakazu 016 * @sinse JDK7.0 017 */ 018public class HybsFileOperationFactory { 019 private static String defPlugin=HybsSystem.sys("CLOUD_TARGET"); 020 021 /** 022 * コンストラクタはprivate化しておきます。 023 */ 024 private HybsFileOperationFactory(){ 025 // コンストラクタ 026 } 027 028 /** 029 * fukurouのFileOperationFactoryを呼び出してFOInterfaceを取得します。 030 * plugin,buketを指定しない場合はシステムリソースを利用します。 031 * 032 * @param plugin 033 * @param buket 034 * @param path 035 * @return FileOperationインタフェース 036 */ 037 public static FileOperation create(String plugin, String buket, String path) { 038 return FileOperationFactory.newStorageOperation(StringUtil.nval(plugin, defPlugin), buket, path); 039 } 040 041 /** 042 * ディレクトリとファイル名を指定用です。 043 * 044 * @param plugin 045 * @param buket 046 * @param dir 047 * @param file 048 * @return FileOperationインタフェース 049 */ 050 public static FileOperation create(String plugin, String buket, String dir, String file) { 051 StringBuilder sb = new StringBuilder(HybsSystem.BUFFER_SMALL); 052 sb.append(dir).append(HybsSystem.FS).append(file); 053 return create(plugin, buket, sb.toString()); 054 } 055 056 /** 057 * FileOperation(ディレクトリ)とファイル名を指定用です。 058 * 059 * @param plugin 060 * @param buket 061 * @param dir 062 * @param file 063 * @return FileOperationインタフェース 064 */ 065 public static FileOperation create(String plugin, String buket, FileOperation dir, String file) { 066 StringBuilder sb = new StringBuilder(HybsSystem.BUFFER_SMALL); 067 sb.append(dir.getPath()).append(HybsSystem.FS).append(file); 068 return create(plugin, buket, sb.toString()); 069 } 070}