private ConfigGroup getGlobalConfiguration() {
   // Global Configurations used by many of Drools Workbench editors
   final ConfigGroup group =
       configurationFactory.newConfigGroup(ConfigType.GLOBAL, GLOBAL_SETTINGS, "");
   group.addConfigItem(configurationFactory.newConfigItem("build.enable-incremental", "true"));
   return group;
 }
Example #2
0
  private ConfigGroup getGlobalConfiguration() {
    final ConfigGroup group =
        configurationFactory.newConfigGroup(ConfigType.GLOBAL, GLOBAL_SETTINGS, "");

    /*
    group.addConfigItem( configurationFactory.newConfigItem( "drools.dateformat",
            "dd-MMM-yyyy" ) );
    group.addConfigItem( configurationFactory.newConfigItem( "drools.datetimeformat",
            "dd-MMM-yyyy hh:mm:ss" ) );
    group.addConfigItem( configurationFactory.newConfigItem( "drools.defaultlanguage",
            "en" ) );
    group.addConfigItem( configurationFactory.newConfigItem( "drools.defaultcountry",
            "US" ) );
    */

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

    /*
    group.addConfigItem( configurationFactory.newConfigItem( "rule-modeller-onlyShowDSLStatements",
            "false" ) );
    group.addConfigItem( configurationFactory.newConfigItem( "designer.url",
            "http://localhost:8080" ) );
    group.addConfigItem( configurationFactory.newConfigItem( "designer.context",
            "designer" ) );
    group.addConfigItem( configurationFactory.newConfigItem( "designer.profile",
            "jbpm" ) );
    */

    return group;
  }
 private ConfigItem getRepositoryConfigItem(
     final RepositoryEnvironmentConfiguration configuration) {
   if (configuration.isSecuredConfigurationItem()) {
     return configurationFactory.newSecuredConfigItem(
         configuration.getName(), configuration.getValue().toString());
   } else {
     return configurationFactory.newConfigItem(configuration.getName(), configuration.getValue());
   }
 }
  @Override
  public Repository createRepository(
      final String scheme,
      final String alias,
      final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations) {

    if (configuredRepositories.containsAlias(alias)) {
      throw new RepositoryAlreadyExistsException(alias);
    }

    Repository repo = null;
    try {
      configurationService.startBatch();
      final ConfigGroup repositoryConfig =
          configurationFactory.newConfigGroup(REPOSITORY, alias, "");
      repositoryConfig.addConfigItem(
          configurationFactory.newConfigItem("security:groups", new ArrayList<String>()));

      if (!repositoryEnvironmentConfigurations.containsConfiguration(SCHEME)) {
        repositoryConfig.addConfigItem(configurationFactory.newConfigItem(SCHEME, scheme));
      }

      for (final RepositoryEnvironmentConfiguration configuration :
          repositoryEnvironmentConfigurations.getConfigurationList()) {
        repositoryConfig.addConfigItem(getRepositoryConfigItem(configuration));
      }

      repo = createRepository(repositoryConfig);
      return repo;
    } catch (final Exception e) {
      logger.error("Error during create repository", e);
      throw new RuntimeException(e);
    } finally {
      configurationService.endBatch();
      if (repo != null) {
        event.fire(new NewRepositoryEvent(repo));
      }
    }
  }
Example #5
0
 private ConfigGroup getGlobalConfiguration() {
   // Global Configurations used by many of Drools Workbench editors
   final ConfigGroup group =
       configurationFactory.newConfigGroup(ConfigType.GLOBAL, GLOBAL_SETTINGS, "");
   group.addConfigItem(configurationFactory.newConfigItem("drools.dateformat", "dd-MMM-yyyy"));
   group.addConfigItem(
       configurationFactory.newConfigItem("drools.datetimeformat", "dd-MMM-yyyy hh:mm:ss"));
   group.addConfigItem(configurationFactory.newConfigItem("drools.defaultlanguage", "en"));
   group.addConfigItem(configurationFactory.newConfigItem("drools.defaultcountry", "US"));
   group.addConfigItem(configurationFactory.newConfigItem("build.enable-incremental", "true"));
   group.addConfigItem(
       configurationFactory.newConfigItem("rule-modeller-onlyShowDSLStatements", "false"));
   return group;
 }
  @Override
  public Repository updateRepositoryConfiguration(
      final Repository repository,
      final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations) {
    final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias());

    if (thisRepositoryConfig != null && repositoryEnvironmentConfigurations != null) {

      try {
        configurationService.startBatch();

        for (final Map.Entry<String, Object> entry :
            repositoryEnvironmentConfigurations.getConfigurationMap().entrySet()) {

          ConfigItem configItem = thisRepositoryConfig.getConfigItem(entry.getKey());
          if (configItem == null) {
            thisRepositoryConfig.addConfigItem(
                configurationFactory.newConfigItem(entry.getKey(), entry.getValue()));
          } else {
            configItem.setValue(entry.getValue());
          }
        }

        configurationService.updateConfiguration(thisRepositoryConfig);

        final Repository updatedRepo = repositoryFactory.newRepository(thisRepositoryConfig);
        configuredRepositories.update(updatedRepo);

        return updatedRepo;
      } catch (final Exception e) {
        logger.error("Error during remove repository", e);
        throw new RuntimeException(e);
      } finally {
        configurationService.endBatch();
      }

    } else {
      throw new IllegalArgumentException("Repository " + repository.getAlias() + " not found");
    }
  }