Skip to content

Commit

Permalink
Bug #10769
Browse files Browse the repository at this point in the history
Restructure the different sections of settings of the plugin SilverSetup in
order to separate correctly what are for configuration of Silverpeas, what
are for installation and what are for the migration of the data source.

Add a new plugin setting property: timeout. It sets the timeout of the
waiting for JBoss to answer to the requests sent by the plugin. By
default it is set to 5mn (instead of 2mn) but it can be changed by
setting the property
silversetup {
  timeout = <the number of milliseconds to wait for>
}
in the SILVERPEAS_HOME/bin/build.gradle file.
  • Loading branch information
mmoqui committed Aug 5, 2019
1 parent 39f6c9b commit 96ad5b0
Show file tree
Hide file tree
Showing 16 changed files with 302 additions and 187 deletions.
Expand Up @@ -67,21 +67,11 @@ class SilverpeasConfigurationProperties {
*/
final File jbossModulesDir

/**
* The Silverpeas settings as defined in the <code>config.properties</code> file.
* Some of them are computed from the properties in the file <code>config.properties</code>.
*/
final Map settings = [:]

@Inject
SilverpeasConfigurationProperties(Project project, File silverpeasHome) {
configurationHome = project.file("${silverpeasHome.path}/configuration")
jbossConfigurationDir = project.file("${silverpeasHome.path}/configuration/jboss")
silverpeasConfigurationDir = project.file("${silverpeasHome.path}/configuration/silverpeas")
jbossModulesDir = project.file("${jbossConfigurationDir.path}/modules")
}

void setSettings(final Map configProperties) {
this.settings.putAll(configProperties)
}
}
@@ -0,0 +1,65 @@
package org.silverpeas.setup

import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.api.provider.Property

import javax.inject.Inject
/**
* Properties for the installation and deployment of Silverpeas in a JBoss server.
* @author mmoquillon
*/
class SilverpeasInstallationProperties {

/**
* The distribution directory. It is the directory that contains all the content of the
* constructed Silverpeas collaborative application. Defaulted into the build directory. Set a
* different location is pertinent only for development mode as in this mode the distribution
* directory is deployed as such in the JBoss/Wildfly application server.
* environment variable.
*/
final Property<File> distDir

/**
* Directory that have to contain all the application or resource archives to deploy into
* JBoss/Wildfly. Defaulted in the SILVERPEAS_HOME/deployments directory.
*/
final Property<File> deploymentDir

/**
* Directory that have to contain all the drivers required by Silverpeas and the Silverpeas Setup
* plugin to access the data source of Silverpeas.
*/
final Property<File> dsDriversDir

/**
* Is in development mode? (In this case, some peculiar configuration are applied to support the
* dev mode in the application server.) This is a property and hence can be set by the user input
* from the build script.
*/
final Property<Boolean> developmentMode

/**
* Collections of software bundles required to construct the Silverpeas application.These bundles
* will be downloaded from our software repository server (provided by our Nexus service) and then
* unpacked to a given directory in order to generate the final application.
*/
final SoftwareBundles bundles

@Inject
SilverpeasInstallationProperties(Project project, File silverpeasHome) {
distDir = project.objects.property(File)
distDir.set(new File(project.buildDir, "dist"))
deploymentDir = project.objects.property(File)
deploymentDir.set(new File(silverpeasHome, 'deployments'))
dsDriversDir = project.objects.property(File)
dsDriversDir.set(new File(project.buildDir, "drivers"))
developmentMode = project.objects.property(Boolean)
developmentMode.set(false)
bundles = project.objects.newInstance(SoftwareBundles, project)
}

void bundles(Action<? extends SoftwareBundles> action) {
action.execute(bundles)
}
}
@@ -0,0 +1,39 @@
package org.silverpeas.setup

import org.gradle.api.Project
import org.gradle.api.provider.Property

import javax.inject.Inject

/**
* Properties for the migration of the data source used by Silverpeas when installing it or
* upgrading it to a new version.
* @author mmoquillon
*/
class SilverpeasMigrationProperties {

/**
* The directory in which are all located both the data source migration descriptors
* and the scripts to create or to update the schema of the database to be used by Silverpeas.
* It is defaulted to SILVERPEAS_HOME/migrations.
* It is expected to contain two kinds of subdirectories:
* <ul>
* <li><em><code>modules</code></em> in which are provided the XML descriptor of each migration
* module. These descriptors refers the scripts to use to create or to update the
* database schema for a given Silverpeas module;</li>
* <li><em><code>db</code></em> in which are located per database type and per module the
* different SQL scripts to create or to upgrade the schema of the database;</li>
* <li><em><code>scripts</code></em> in which are located per module the different programming
* scripts (currently, only Groovy is supported) to perform complex tasks on the database or
* any other data sources used by Silverpeas (like the JCR for example).
* </li>
* </ul>
*/
final Property<File> homeDir

@Inject
SilverpeasMigrationProperties(Project project, File silverpeasHome) {
this.homeDir = project.objects.property(File)
this.homeDir.set(new File(silverpeasHome, 'migrations'))
}
}
Expand Up @@ -25,9 +25,8 @@ package org.silverpeas.setup

import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.provider.Property
import org.silverpeas.setup.api.JBossServer
import org.silverpeas.setup.api.SystemWrapper
/**
* Extension of the plugin in which are defined the different properties required by the plugin to
Expand Down Expand Up @@ -64,43 +63,21 @@ class SilverpeasSetupExtension {
final File jbossHome

/**
* The distribution directory. It is the directory that contains all the content of the
* constructed Silverpeas collaborative application. Defaulted into the build directory. Set a
* different location is pertinent only for development mode as in this mode the distribution
* directory is deployed as such in the JBoss/Wildfly application server.
* environment variable.
*/
final Property<File> distDir

/**
* The properties to access the configuration if Silverpeas in order to apply it to the
* current Silverpeas distribution.
* The properties required by the configuration execution of a Silverpeas distribution.
*/
final SilverpeasConfigurationProperties config

/**
* The directory in which are all located both the data source migration descriptors
* and the scripts to create or to update the schema of the database to be used by Silverpeas.
* It is expected to contain two kinds of subdirectories:
* <ul>
* <li><em><code>modules</code></em> in which are provided the XML descriptor of each migration
* module. These descriptors refers the scripts to use to create or to update the
* database schema for a given Silverpeas module;</li>
* <li><em><code>db</code></em> in which are located per database type and per module the
* different SQL scripts to create or to upgrade the schema of the database;</li>
* <li><em><code>scripts</code></em> in which are located per module the different programming
* scripts (currently, only Groovy is supported) to perform complex tasks on the database or
* any other data sources used by Silverpeas (like the JCR for example).
* </li>
* </ul>
* The properties required by the build of a given version of Silverpeas and its deployment
* in a JBoss server.
*/
final File migrationHome
final SilverpeasInstallationProperties installation

/**
* Directory that have to contain all the application or resource archives to deploy into
* JBoss/Wildfly.
* The properties required to perform a data source migration when upgrading Silverpeas to a newer
* version or when installing a fresh Silverpeas version.
*/
final File deploymentDir
final SilverpeasMigrationProperties migration

/**
* The properties to configure the logging. They define the location of the logging file, the
Expand All @@ -109,25 +86,16 @@ class SilverpeasSetupExtension {
final SilverpeasLoggingProperties logging

/**
* All the software bundles that made Silverpeas. Those bundles are usually downloaded from our
* own Software Repository by the Silverpeas installer. They are required to assemble and build
* the final Silverpeas Web Application. The Jar libraries other than the supported JDBC drivers
* aren't taken in charge.
*/
final ConfigurableFileCollection silverpeasBundles

/**
* Any tiers bundles to add into the Silverpeas Application being built. The tiers bundles are
* processed differently by the plugin: only the JAR libraries are taken in charge.
* The time out when waiting JBoss answering to our requests. Defaulted to 5mn.
*/
final ConfigurableFileCollection tiersBundles
final Property<Long> timeout

/**
* Is in development mode ? (In this case, some peculiar configuration are applied to support the
* dev mode in the application server.) This is a property and hence can be set by the user input
* from the build script.
* The Silverpeas settings as defined in the <code>config.properties</code> file.
* Some of them are computed from the properties in the file <code>config.properties</code>.
* Tasks can overwrite some of the settings as well as add their own properties.
*/
final Property<Boolean> developmentMode
final Map settings = [:]

/**
* Constructs a new silverpeas configuration extension. It checks the environment variables
Expand All @@ -148,24 +116,17 @@ class SilverpeasSetupExtension {
println 'The path referred by SILVERPEAS_HOME or by JBOSS_HOME doesn\'t exist or isn\'t a directory!'
throw new IllegalStateException()
}
migrationHome = project.file("${silverpeasHome.path}/migrations")
deploymentDir = project.file("${silverpeasHome.path}/deployments")
distDir = project.objects.property(File)
distDir.set(new File(project.buildDir, "dist"))
config = project.objects.newInstance(SilverpeasConfigurationProperties, project, silverpeasHome)
installation = project.objects.newInstance(SilverpeasInstallationProperties, project, silverpeasHome)
migration = project.objects.newInstance(SilverpeasMigrationProperties, project, silverpeasHome)
logging = project.objects.newInstance(SilverpeasLoggingProperties)
silverpeasBundles = project.files()
tiersBundles = project.files();
developmentMode = project.objects.property(Boolean)
developmentMode.set(false)
timeout = project.objects.property(Long)
timeout.set(300000l)
JBossServer.DEFAULT_TIMEOUT = timeout.get()
}

void setSilverpeasBundles(FileCollection bundles) {
this.silverpeasBundles.setFrom(bundles)
}

void setTiersBundles(FileCollection bundles) {
this.tiersBundles.setFrom(bundles)
void setSettings(final Map configProperties) {
this.settings.putAll(configProperties)
}

void logging(Action<? extends SilverpeasLoggingProperties> action) {
Expand All @@ -175,4 +136,12 @@ class SilverpeasSetupExtension {
void config(Action<? extends SilverpeasConfigurationProperties> action) {
action.execute(config)
}

void installation(Action<? extends SilverpeasInstallationProperties> action) {
action.execute(installation)
}

void migration(Action<? extends SilverpeasMigrationProperties> action) {
action.execute(migration)
}
}

0 comments on commit 96ad5b0

Please sign in to comment.