Class StorageFactory
java.lang.Object
de.iip_ecosphere.platform.deviceMgt.storage.StorageFactory
A StorageFactory is capable of creating different kinds of storages.
- Author:
- Dennis Pidun, University of Hildesheim
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Storageprivate StorageFactoryDescriptorprivate static final StorageFactoryprivate static final de.iip_ecosphere.platform.support.logging.Loggerprivate Storageprivate DeviceMgtSetup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a config storage with the help of the service provider.Creates a runtime storage with the help of the service provider.createStorage(PackageStorageSetup setup) Creates a storage based on the given setup.static StorageFactoryReturns the instance of this factory.getSetup()Returns the setup instance.private voidinitDesc()Initializes the descriptors.private voidLoads the setup.voidsetSetup(DeviceMgtSetup configuration) Sets the configuration, only used in testing.
-
Field Details
-
LOGGER
private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER -
INSTANCE
-
runtimeStorage
-
configStorage
-
setup
-
desc
-
-
Constructor Details
-
StorageFactory
public StorageFactory()
-
-
Method Details
-
getInstance
Returns the instance of this factory.- Returns:
- the instance
-
createStorage
Creates a storage based on the given setup.- Parameters:
setup- the setup- Returns:
- the storage instance, may be null if no storage descriptor is available or
setupis null
-
createRuntimeStorage
Creates a runtime storage with the help of the service provider. If no service provider is found, it will fall back to the S3StorageFactoryDescriptor as a default.- Returns:
- the runtime storage, may be null if no storage descriptor is available or
setupis null - See Also:
-
initDesc
private void initDesc()Initializes the descriptors. -
createConfigStorage
Creates a config storage with the help of the service provider. If no service provider is found, it will fall back to the S3StorageFactoryDescriptor as a default.- Returns:
- the runtime storage, may be null if no storage descriptor is available or
setupis null - See Also:
-
loadSetup
private void loadSetup()Loads the setup. -
setSetup
Sets the configuration, only used in testing. [public for testing]- Parameters:
configuration- the configuration
-
getSetup
Returns the setup instance.- Returns:
- the setup instance, null if none was loaded/none is available
-