class ExamplesServiceImpl extends BaseProjectImportService implements ExamplesService {

    @PostConstruct
    public void initPlaygroundRepository() {

        URL resource = getClass().getClassLoader().getResource(KIE_WB_PLAYGROUND_ZIP);
        if (resource == null) {
            logger.warn("Playground repository jar not found on classpath.");
            return;
        }
        String userDir = System.getProperty("user.dir");
        md5 = calculateMD5(resource);

        playgroundRootDirectory = new File(userDir,
                                           PLAYGROUND_DIRECTORY);

        // .kie-wb-playground/md5number
        File playgroundDirectory = new File(playgroundRootDirectory, md5);
        File doneMarker = new File(playgroundDirectory, DONE_MARKER_NAME);

        this.playgroundSpaceName = PREFIX + md5;

        String repositoryUrl = resolveRepositoryUrl(playgroundDirectory.getAbsolutePath());

        if (!playgroundDirectory.exists()) {
            playgroundDirectory.mkdirs();
        }

        FileSystemLock physicalLock = createLock();

        try {

            physicalLock.lock();

            if (!doneMarker.exists()) {
                // unzip folder if is not uncompressed
                unzipPlayground(resource, playgroundDirectory);
                doneMarker.createNewFile();
            }

            if (!this.existSpace(playgroundSpaceName)) {

                // create space
                this.createPlaygroundHiddenSpace(md5);

                spaceConfigStorageRegistry.getBatch(playgroundSpaceName).run(spaceConfigStorageBatchContext -> {
                    // Delete old folders;
                    this.deleteOldPlaygrounds(md5);

                    // Mark for deletion old playground spaces
                    this.deleteOldHiddenSpaces(md5);

                    this.cloneRepository(repositoryUrl);
                    return null;
                });
            }
        } catch (Exception e) {
            String message = "Can't create examples playground";
            logger.error(message);
            throw new ImportExamplesException(message, e);
        } finally {
            physicalLock.unlock();
        }

        playgroundRepository = new ExampleRepository(repositoryUrl);
    }

    @Inject public  ExamplesServiceImpl(final @Named("ioStrategy") IOService ioService,
                               final RepositoryFactory repositoryFactory,
                               final KieModuleService moduleService,
                               final OrganizationalUnitService ouService,
                               final WorkspaceProjectService projectService,
                               final MetadataService metadataService,
                               final Event<NewProjectEvent> newProjectEvent,
                               final ProjectScreenService projectScreenService,
                               final ImportProjectValidators validators,
                               final SpaceConfigStorageRegistry spaceConfigStorageRegistry,
                               final @Named("systemFS") FileSystem systemFS,
                               final PathUtil pathUtil,
                               final RepositoryService repoService);

}