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 class
Configuration 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 existingFileUploadState
matching the path or creates one if none found.protected FileUploadStateService<FileUploadState>
int
getPhase()
protected org.springframework.core.io.ResourceLoader
protected StorageService
boolean
protected void
void
start()
void
stop()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfaceorg.springframework.context.Phased
- Specified by:
getPhase
in 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 existingFileUploadState
matching the path or creates one if none found.- Returns:
- An existing or new
FileUploadState
for the initial data found at the path
-
getStorageService
-
getFileUploadStateService
-
getResourceLoader
protected org.springframework.core.io.ResourceLoader getResourceLoader() -
getInitialDataProperties
-