Search in sources :

Example 1 with SystemLoadResultJson

use of com.enonic.xp.impl.server.rest.model.SystemLoadResultJson in project xp by enonic.

the class LoadRunnableTask method run.

@Override
public void run(final TaskId id, final ProgressReporter progressReporter) {
    SystemLoadResultJson result;
    loadDumpListener = new SystemLoadListenerImpl(progressReporter);
    final Path dumpRoot = getDumpRoot(params.getName());
    if (isExport(dumpRoot)) {
        result = doLoadFromExport(dumpRoot);
    } else {
        result = doLoadFromSystemDump(params);
    }
    progressReporter.info(result.toString());
}
Also used : Path(java.nio.file.Path) NodePath(com.enonic.xp.node.NodePath) SystemLoadListenerImpl(com.enonic.xp.impl.server.rest.task.listener.SystemLoadListenerImpl) SystemLoadResultJson(com.enonic.xp.impl.server.rest.model.SystemLoadResultJson)

Example 2 with SystemLoadResultJson

use of com.enonic.xp.impl.server.rest.model.SystemLoadResultJson in project xp by enonic.

the class LoadRunnableTask method doLoadFromExport.

private SystemLoadResultJson doLoadFromExport(final Path rootDir) {
    final SystemLoadResult.Builder builder = SystemLoadResult.create();
    final Repositories repositories = repositoryService.list();
    final long branchesCount = repositories.stream().flatMap(repository -> repository.getBranches().stream()).count();
    loadDumpListener.totalBranches(branchesCount);
    builder.add(importSystemRepo(rootDir));
    this.repositoryService.invalidateAll();
    for (Repository repository : repositories) {
        initializeRepo(repository);
        builder.add(importRepoBranches(rootDir, repository));
    }
    return SystemLoadResultJson.from(builder.build());
}
Also used : Repositories(com.enonic.xp.repository.Repositories) RepositoryService(com.enonic.xp.repository.RepositoryService) VirtualFiles(com.enonic.xp.vfs.VirtualFiles) Branch(com.enonic.xp.branch.Branch) RepoLoadResult(com.enonic.xp.dump.RepoLoadResult) SystemLoadResultJson(com.enonic.xp.impl.server.rest.model.SystemLoadResultJson) AbstractRunnableTask(com.enonic.xp.task.AbstractRunnableTask) RepositoryId(com.enonic.xp.repository.RepositoryId) ContextAccessor(com.enonic.xp.context.ContextAccessor) ImportNodesParams(com.enonic.xp.export.ImportNodesParams) DumpService(com.enonic.xp.dump.DumpService) NodeImportResult(com.enonic.xp.export.NodeImportResult) ContextBuilder(com.enonic.xp.context.ContextBuilder) ProgressReporter(com.enonic.xp.task.ProgressReporter) SystemConstants(com.enonic.xp.security.SystemConstants) Path(java.nio.file.Path) NodeRepositoryService(com.enonic.xp.repository.NodeRepositoryService) Files(java.nio.file.Files) ExportService(com.enonic.xp.export.ExportService) NodeImportResultTranslator(com.enonic.xp.impl.server.rest.NodeImportResultTranslator) NodePath(com.enonic.xp.node.NodePath) SystemLoadListener(com.enonic.xp.dump.SystemLoadListener) CreateRepositoryParams(com.enonic.xp.repository.CreateRepositoryParams) TaskId(com.enonic.xp.task.TaskId) Repositories(com.enonic.xp.repository.Repositories) SystemLoadParams(com.enonic.xp.dump.SystemLoadParams) HomeDir(com.enonic.xp.home.HomeDir) SystemLoadRequestJson(com.enonic.xp.impl.server.rest.model.SystemLoadRequestJson) FileNames(com.enonic.xp.core.internal.FileNames) Preconditions(com.google.common.base.Preconditions) Context(com.enonic.xp.context.Context) SystemLoadListenerImpl(com.enonic.xp.impl.server.rest.task.listener.SystemLoadListenerImpl) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult) SystemLoadResult(com.enonic.xp.dump.SystemLoadResult) Repository(com.enonic.xp.repository.Repository) Repository(com.enonic.xp.repository.Repository) SystemLoadResult(com.enonic.xp.dump.SystemLoadResult)

Aggregations

SystemLoadResultJson (com.enonic.xp.impl.server.rest.model.SystemLoadResultJson)2 SystemLoadListenerImpl (com.enonic.xp.impl.server.rest.task.listener.SystemLoadListenerImpl)2 NodePath (com.enonic.xp.node.NodePath)2 Path (java.nio.file.Path)2 Branch (com.enonic.xp.branch.Branch)1 Context (com.enonic.xp.context.Context)1 ContextAccessor (com.enonic.xp.context.ContextAccessor)1 ContextBuilder (com.enonic.xp.context.ContextBuilder)1 FileNames (com.enonic.xp.core.internal.FileNames)1 BranchLoadResult (com.enonic.xp.dump.BranchLoadResult)1 DumpService (com.enonic.xp.dump.DumpService)1 RepoLoadResult (com.enonic.xp.dump.RepoLoadResult)1 SystemLoadListener (com.enonic.xp.dump.SystemLoadListener)1 SystemLoadParams (com.enonic.xp.dump.SystemLoadParams)1 SystemLoadResult (com.enonic.xp.dump.SystemLoadResult)1 ExportService (com.enonic.xp.export.ExportService)1 ImportNodesParams (com.enonic.xp.export.ImportNodesParams)1 NodeImportResult (com.enonic.xp.export.NodeImportResult)1 HomeDir (com.enonic.xp.home.HomeDir)1 NodeImportResultTranslator (com.enonic.xp.impl.server.rest.NodeImportResultTranslator)1