Skip to content

Commit

Permalink
GUVNOR-2521: Consolidate server-side bootstrap logic in various workb…
Browse files Browse the repository at this point in the history
…ench implementations (kiegroup#425)
  • Loading branch information
paulovmr authored and cristianonicolai committed Jun 20, 2016
1 parent a12750e commit 84946af
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 200 deletions.
5 changes: 4 additions & 1 deletion jbpm-console-ng-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@
</exclusions>
</dependency>


<!-- UberFire -->
<dependency>
<groupId>org.uberfire</groupId>
Expand Down Expand Up @@ -685,6 +684,10 @@
<artifactId>kie-wb-common-workbench-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie.workbench.screens</groupId>
<artifactId>kie-wb-common-workbench-backend</artifactId>
</dependency>

<!-- Needed for the Deployment Descriptor Editor -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,66 +22,72 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.guvnor.structure.repositories.Repository;
import org.guvnor.structure.organizationalunit.OrganizationalUnitService;
import org.guvnor.structure.repositories.RepositoryService;
import org.guvnor.structure.server.config.ConfigGroup;
import org.guvnor.structure.server.config.ConfigType;
import org.guvnor.structure.server.config.ConfigurationFactory;
import org.guvnor.structure.server.config.ConfigurationService;
import org.jbpm.console.ng.bd.service.AdministrationService;
import org.kie.workbench.common.services.shared.project.KieProjectService;
import org.kie.workbench.screens.workbench.backend.BaseAppSetup;
import org.uberfire.commons.services.cdi.ApplicationStarted;
import org.uberfire.commons.services.cdi.Startup;
import org.uberfire.io.IOService;

@ApplicationScoped
@Startup
public class AppSetup {
public class AppSetup extends BaseAppSetup {

// default repository section - start
// default repository section - start
private static final String JBPM_WB_PLAYGROUND_ALIAS = "jbpm-playground";
private static final String JBPM_WB_PLAYGROUND_ORIGIN = "https://github.com/droolsjbpm/jbpm-playground.git";


private static final String GLOBAL_SETTINGS = "settings";

@Inject
@Named("ioStrategy")
private IOService ioService;

@Inject
private AdministrationService administrationService;

@Inject
private ConfigurationService configurationService;

@Inject
private ConfigurationFactory configurationFactory;
private Event<ApplicationStarted> applicationStartedEvent;

protected AppSetup() {
}

@Inject
private Event<ApplicationStarted> applicationStartedEvent;
public AppSetup( @Named("ioStrategy") final IOService ioService,
final RepositoryService repositoryService,
final OrganizationalUnitService organizationalUnitService,
final KieProjectService projectService,
final ConfigurationService configurationService,
final ConfigurationFactory configurationFactory,
final AdministrationService administrationService,
final Event<ApplicationStarted> applicationStartedEvent ) {
super( ioService, repositoryService, organizationalUnitService, projectService, configurationService, configurationFactory );
this.administrationService = administrationService;
this.applicationStartedEvent = applicationStartedEvent;
}

@PostConstruct
public void onStartup() {
if (!"false".equalsIgnoreCase(System.getProperty("org.kie.demo"))) {
if ( !"false".equalsIgnoreCase( System.getProperty( "org.kie.demo" ) ) ) {
administrationService.bootstrapRepository( "demo", JBPM_WB_PLAYGROUND_ALIAS, JBPM_WB_PLAYGROUND_ORIGIN,
"", "" );
} else if ("true".equalsIgnoreCase(System.getProperty("org.kie.example"))) {
} else if ( "true".equalsIgnoreCase( System.getProperty( "org.kie.example" ) ) ) {
administrationService.bootstrapRepository( "example", "repository1", null, "", "" );
administrationService.bootstrapProject("repository1", "org.kie.example", "project1", "1.0.0-SNAPSHOT");
administrationService.bootstrapProject( "repository1", "org.kie.example", "project1", "1.0.0-SNAPSHOT" );
}
configurationService.addConfiguration( getGlobalConfiguration() );

// notify cluster service that bootstrap is completed to start synchronization
applicationStartedEvent.fire(new ApplicationStarted());
applicationStartedEvent.fire( new ApplicationStarted() );
}


private ConfigGroup getGlobalConfiguration() {
final ConfigGroup group = configurationFactory.newConfigGroup( ConfigType.GLOBAL, GLOBAL_SETTINGS, "" );
final ConfigGroup group = configurationFactory.newConfigGroup( ConfigType.GLOBAL,
GLOBAL_SETTINGS,
"" );

group.addConfigItem( configurationFactory.newConfigItem( "build.enable-incremental",
"true" ) );
"true" ) );
group.addConfigItem( configurationFactory.newConfigItem( "support.runtime.deploy",
"true" ) );
"true" ) );

return group;
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Alternative;
import javax.enterprise.inject.Produces;
import javax.inject.Named;

Expand All @@ -33,6 +34,7 @@
import static org.apache.lucene.util.Version.*;

@ApplicationScoped
@Alternative
public class LuceneConfigProducer {

private LuceneConfig config;
Expand Down
4 changes: 4 additions & 0 deletions jbpm-console-ng-showcase/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" bean-discovery-mode="all">
<alternatives>
<class>org.jbpm.services.cdi.producer.JAASUserGroupInfoProducer</class>
<class>org.jbpm.console.ng.server.impl.LuceneConfigProducer</class>
</alternatives>

<scan>
<!-- These exclusions were added by Errai to avoid deploying client-side classes to the server -->
Expand Down

0 comments on commit 84946af

Please sign in to comment.