Class InitialDataAutoConfiguration
java.lang.Object
com.broadleafcommerce.asset.autoconfigure.InitialDataAutoConfiguration
- All Implemented Interfaces:
org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
@Configuration
@EnableConfigurationProperties(InitialDataProperties.class)
@ConditionalOnProperty(prefix="broadleaf.asset.data",
name="load-on-startup")
public class InitialDataAutoConfiguration
extends Object
implements org.springframework.context.SmartLifecycle
Configuration class for initializing the base seed data for the app. This will load data from a
configurable set of zip files on the filesystem if
broadleaf.asset.data.load-on-startup
is not false. The process will also spawn a FileUploadState for audit and debugging
purposes.- Author:
- Nathan Moore (nathandmoore), Nick Crum (ncrum)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration properties for loading any initial asset data on startup. -
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionInitialDataAutoConfiguration(StorageService storageService, FileUploadStateService<FileUploadState> fileUploadStateService, org.springframework.core.io.ResourceLoader resourceLoader, InitialDataAutoConfiguration.InitialDataProperties initialDataProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<FileUploadState>getFileUploadState(String path, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest) Looks for an existingFileUploadStatematching the path or creates one if none found.protected FileUploadStateService<FileUploadState>intgetPhase()protected org.springframework.core.io.ResourceLoaderprotected StorageServicebooleanprotected voidvoidstart()voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup, stop
-
Constructor Details
-
InitialDataAutoConfiguration
public InitialDataAutoConfiguration(StorageService storageService, FileUploadStateService<FileUploadState> fileUploadStateService, org.springframework.core.io.ResourceLoader resourceLoader, InitialDataAutoConfiguration.InitialDataProperties initialDataProperties)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
loadInitialDataForFile
protected void loadInitialDataForFile(InitialDataAutoConfiguration.InitialDataProperties.DataImportFile file) -
getFileUploadState
protected Optional<FileUploadState> getFileUploadState(String path, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest) Looks for an existingFileUploadStatematching the path or creates one if none found.- Returns:
- An existing or new
FileUploadStatefor the initial data found at the path
-
getStorageService
-
getFileUploadStateService
-
getResourceLoader
protected org.springframework.core.io.ResourceLoader getResourceLoader() -
getInitialDataProperties
-