From 759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 4 Dec 2019 19:43:32 +0100 Subject: common EGIZ code-style refactoring --- .../eaaf/core/api/storage/ITransactionStorage.java | 243 ++++++++++----------- 1 file changed, 120 insertions(+), 123 deletions(-) (limited to 'eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/storage/ITransactionStorage.java') diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/storage/ITransactionStorage.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/storage/ITransactionStorage.java index ad424329..b8438a79 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/storage/ITransactionStorage.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/storage/ITransactionStorage.java @@ -1,138 +1,135 @@ -/******************************************************************************* - * Copyright 2017 Graz University of Technology - * EAAF-Core Components has been developed in a cooperation between EGIZ, - * A-SIT Plus, A-SIT, and Graz University of Technology. +/* + * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a + * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology. * - * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European + * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in + * compliance with the Licence. You may obtain a copy of the Licence at: * https://joinup.ec.europa.eu/news/understanding-eupl-v12 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - *******************************************************************************/ -/******************************************************************************* - *******************************************************************************/ -/******************************************************************************* - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software distributed under the Licence + * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the Licence for the specific language governing permissions and limitations under + * the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text file for details on the + * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative + * works that you distribute must include a readable copy of the "NOTICE" text file. +*/ + package at.gv.egiz.eaaf.core.api.storage; import java.util.Date; import java.util.List; - -import at.gv.egiz.eaaf.core.exceptions.EAAFException; -import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import at.gv.egiz.eaaf.core.exceptions.EaafException; +import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; /** + * Interface to store arbitrary data. + * * @author tlenz * */ public interface ITransactionStorage { - /** - * Check if transaction storage contains a data object with a specific key - * - * @param key Key, which identifies a data object - * @return true if key is found, otherwise false - */ - public boolean containsKey(String key); - - /** - * Store a data object with a key to transaction storage - * - * @param key Id which identifiers the data object - * @param value Data object which should be stored. - * This data must implement the java.io.Serializable interface - * @param timeout_ms Defines the period of time a data object is kept within the storage - * @throws EAAFStorageException In case of store operation failed - */ - public void put(String key, Object value, int timeout_ms) throws EAAFException; - - /** - * Get a data object from transaction storage - * - * @param key key Id which identifiers the data object - * @return The transaction-data object, or null - * @throws EAAFStorageException In case of load operation failed - */ - public Object get(String key) throws EAAFException; - - /** - * Get a data object from transaction storage - * - * @param key Id which identifiers the data object - * @param clazz The class type which is stored with this key - * @return The transaction-data object from type class, or null - * @throws EAAFStorageException In case of load operation failed - */ - public T get(String key, final Class clazz) throws EAAFException; - - /** - * Get a data object from transaction storage - * - * @param key Id which identifiers the data object - * @param clazz The class type which is stored with this key - * @param Data-object timeout in [ms] - * @return The transaction-data object from type class, or null - * @throws EAAFStorageException In case of load operation failed - */ - public T get(String key, final Class clazz, long dataTimeOut) throws EAAFException; - - - /** - * Change the key of a data object and store it under the new key - * - * @param oldKey Old key of the data object - * @param newKey New key, which should be used to store the data object - * @param value Data object which should be stored - * @throws EAAFStorageException In case of store operation failed - */ - public void changeKey(String oldKey, String newKey, Object value) throws EAAFException; - - /** - * Remove a data object from transaction storage - * - * @param key Id which identifiers the data object - */ - public void remove(String key); - - /** - * Get all entries for Clean-up the transaction storage - * - * @param now Current time - * @param dataTimeOut Data-object timeout in [ms] - * @return List of entry-keys which as a timeout - */ - public List clean(Date now, long dataTimeOut); - - - /** - * Get a raw object from storage by using this key - * - * @param key - * @return - * @throws EAAFException - */ - public Object getRaw(String key) throws EAAFException; - - - /** - * Set a raw object to storage - * - * @param key - * @param element - * @throws EAAFException - */ - public void putRaw(String key, Object element) throws EAAFException; - - + /** + * Check if transaction storage contains a data object with a specific key. + * + * @param key Key, which identifies a data object + * @return true if key is found, otherwise false + */ + public boolean containsKey(String key); + + /** + * Store a data object with a key to transaction storage. + * + * @param key Id which identifiers the data object + * @param value Data object which should be stored. This data must implement the + * java.io.Serializable interface + * @param timeoutMs Defines the period of time a data object is kept within the storage + * @throws EaafStorageException In case of store operation failed + */ + public void put(String key, Object value, int timeoutMs) throws EaafException; + + /** + * Get a data object from transaction storage. + * + * @param key key Id which identifiers the data object + * @return The transaction-data object, or null + * @throws EaafStorageException In case of load operation failed + */ + public Object get(String key) throws EaafException; + + /** + * Get a data object from transaction storage. + * + * @param key Id which identifiers the data object + * @param clazz The class type which is stored with this key + * @return The transaction-data object from type class, or null + * @throws EaafStorageException In case of load operation failed + */ + public T get(String key, final Class clazz) throws EaafException; + + /** + * Get a data object from transaction storage. + * + * @param key Id which identifiers the data object + * @param clazz The class type which is stored with this key + * @param dataTimeOut Data-object timeout in [ms] + * @return The transaction-data object from type class, or null + * @throws EaafStorageException In case of load operation failed + */ + public T get(String key, final Class clazz, long dataTimeOut) throws EaafException; + + + /** + * Change the key of a data object and store it under the new key. + * + * @param oldKey Old key of the data object + * @param newKey New key, which should be used to store the data object + * @param value Data object which should be stored + * @throws EaafStorageException In case of store operation failed + */ + public void changeKey(String oldKey, String newKey, Object value) throws EaafException; + + /** + * Remove a data object from transaction storage. + * + * @param key Id which identifiers the data object + */ + public void remove(String key); + + /** + * Get all entries for Clean-up the transaction storage. + * + * @param now Current time + * @param dataTimeOut Data-object timeout in [ms] + * @return List of entry-keys which as a timeout + */ + public List clean(Date now, long dataTimeOut); + + + /** + * Get a raw object from storage by using this key. + * + * @param key Storagekey + * @return Object stored with this key, or null + * @throws EaafException In case of a storage error + */ + @Nullable + public Object getRaw(String key) throws EaafException; + + + /** + * Set a raw object to storage. + * + * @param key Storagekey + * @param element Object to store + * @throws EaafException In case of a storage error + */ + public void putRaw(@Nonnull String key, @Nonnull Object element) throws EaafException; + + } -- cgit v1.2.3