001/* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016package org.opengion.hayabusa.io; 017 018import java.io.InputStream; 019import java.util.Map; 020 021import jakarta.servlet.http.HttpSession; 022 023/** 024 * クラウドストレージ操作用のインターフェイス。 025 * 026 * 継承クラスのコンストラクターはコンテナ名とHTTPセッションを持たせます。 027 * 028 * @og.group 029 * @og.rev 5.9.25.0 (2017/10/06) 新規作成 030 * 031 * @version 5.0 032 * @author T.OTA 033 * @since JDK7.0 034 */ 035public interface StorageAPI { 036 /** 037 * トークンキー 038 */ 039 String SESSION_CLOUD_TOKEN = "SESSION_CLOUD_TOKEN"; // 7.2.9.4 (2020/11/20) public static final 040 041 /** 042 * ファイル情報に格納されている値 043 * サイズ 044 */ 045 String FILEINFO_SIZE = "SIZE"; // 7.2.9.4 (2020/11/20) public static final 046 047 /** 048 * 最終更新時刻 049 */ 050 String FILEINFO_LASTMODIFIED = "LASTMODIFIED"; // 7.2.9.4 (2020/11/20) public static final 051 052 /** 053 * 削除。 054 * 055 * @param filePath 削除ファイルのパス 056 * @param hsession セッション 057 */ 058 void delete(String filePath, HttpSession hsession); 059 060 /** 061 * コピー。 062 * 063 * @param oldFilePath コピー元ファイルパス 064 * @param newFilePath コピー先ファイルパス 065 * @param hsession セッション 066 */ 067 void copy(String oldFilePath, String newFilePath, HttpSession hsession); 068 069 /** 070 * ダウンロード。 071 * 072 * @param filePath ダウンロード対象のファイルパス 073 * @param hsession セッション 074 * @return ストリーム 075 */ 076 InputStream get(String filePath, HttpSession hsession); 077 078 /** 079 * アップロード。 080 * 081 * @param partInputStream アップロード対象のストリーム 082 * @param updFolder アップロードフォルタ名 083 * @param updFileName アップロードファイル名 084 * @param hsession セッション 085 */ 086 void add(InputStream partInputStream, String updFolder, String updFileName, HttpSession hsession); 087 088 /** 089 * ファイル名変更。 090 * 091 * @param fileUrl ファイルパス 092 * @param oldFileName 変更前ファイル名 093 * @param newFileName 変更後ファイル名 094 * @param useBackup 変更後ファイル名が既に存在する場合のバックアップ作成フラグ 095 * @param session セッション 096 */ 097 void rename(String fileUrl, String oldFileName, String newFileName, final boolean useBackup, HttpSession session); 098 099 /** 100 * ファイル一覧取得。 101 * 102 * @param startsWith パスの前方一致 103 * @param hsession セッション 104 * @return ファイルパス一覧 105 */ 106 String[] list(String startsWith, HttpSession hsession); 107 108 /** 109 * ファイル存在チェック。 110 * 111 * @param path ファイルパス 112 * @param hsession セッション 113 * @return true:存在 false:存在しない 114 */ 115 boolean exists(String path, HttpSession hsession); 116 117 /** 118 * ファイル情報取得。 119 * 120 * @param path ファイルパス 121 * @param hsession セッション 122 * @return ファイル情報格納Map 123 */ 124 Map<String,String> getInfo(String path, HttpSession hsession); 125}