diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0199fd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/thermostat-1.6.4.tar.gz diff --git a/.rh-thermostat16-thermostat.metadata b/.rh-thermostat16-thermostat.metadata new file mode 100644 index 0000000..95f65d9 --- /dev/null +++ b/.rh-thermostat16-thermostat.metadata @@ -0,0 +1 @@ +647fd31c639f65b7f7cf1f9cd1deaece58a3b0b0 SOURCES/thermostat-1.6.4.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001_shared_fix_bundle_loading.patch b/SOURCES/0001_shared_fix_bundle_loading.patch new file mode 100644 index 0000000..33692f7 --- /dev/null +++ b/SOURCES/0001_shared_fix_bundle_loading.patch @@ -0,0 +1,396 @@ +diff --git a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/distribution/thermostat-plugin.xml b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/distribution/thermostat-plugin.xml +--- a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/distribution/thermostat-plugin.xml ++++ b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/distribution/thermostat-plugin.xml +@@ -39,7 +39,7 @@ + org.apache.commons.logging${symbol_dollar}{commons-logging.version} + org.apache.httpcomponents.httpcore${symbol_dollar}{httpcomponents.core.version} + org.apache.httpcomponents.httpclient${symbol_dollar}{httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${symbol_dollar}{gson.version} + + +diff --git a/dev/schema-info-command/distribution/thermostat-plugin.xml b/dev/schema-info-command/distribution/thermostat-plugin.xml +--- a/dev/schema-info-command/distribution/thermostat-plugin.xml ++++ b/dev/schema-info-command/distribution/thermostat-plugin.xml +@@ -63,7 +63,7 @@ + com.redhat.thermostat.web.client${project.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + org.mongodb.mongo-java-driver${mongo-driver.osgi-version} + + +diff --git a/distribution/config/commands/agent-info.properties b/distribution/config/commands/agent-info.properties +--- a/distribution/config/commands/agent-info.properties ++++ b/distribution/config/commands/agent-info.properties +@@ -4,7 +4,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ +diff --git a/distribution/config/commands/agent.properties b/distribution/config/commands/agent.properties +--- a/distribution/config/commands/agent.properties ++++ b/distribution/config/commands/agent.properties +@@ -3,7 +3,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + com.redhat.thermostat.process=${project.version}, \ + com.redhat.thermostat.common.core=${project.version}, \ +diff --git a/distribution/config/commands/clean-data.properties b/distribution/config/commands/clean-data.properties +--- a/distribution/config/commands/clean-data.properties ++++ b/distribution/config/commands/clean-data.properties +@@ -4,7 +4,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ +diff --git a/distribution/config/commands/connect.properties b/distribution/config/commands/connect.properties +--- a/distribution/config/commands/connect.properties ++++ b/distribution/config/commands/connect.properties +@@ -10,7 +10,7 @@ + org.apache.commons.logging=${commons-logging.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version} + + summary = persistently connect to storage +diff --git a/distribution/config/commands/gui.properties b/distribution/config/commands/gui.properties +--- a/distribution/config/commands/gui.properties ++++ b/distribution/config/commands/gui.properties +@@ -19,8 +19,11 @@ + com.redhat.thermostat.process=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ +- org.jboss.netty=${netty.version} ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ ++ org.jboss.netty=${netty.version}, \ ++ org.jfree.jcommon=${jcommon.osgi.version}, \ ++ org.jfree.jfreechart=${jfreechart.osgi.version}, \ ++ com.mxgraph=${jgraphx.osgi.version} + + summary = launch the GUI client + +diff --git a/distribution/config/commands/list-agents.properties b/distribution/config/commands/list-agents.properties +--- a/distribution/config/commands/list-agents.properties ++++ b/distribution/config/commands/list-agents.properties +@@ -4,7 +4,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ +diff --git a/distribution/config/commands/list-vms.properties b/distribution/config/commands/list-vms.properties +--- a/distribution/config/commands/list-vms.properties ++++ b/distribution/config/commands/list-vms.properties +@@ -4,7 +4,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ +diff --git a/distribution/config/commands/ping.properties b/distribution/config/commands/ping.properties +--- a/distribution/config/commands/ping.properties ++++ b/distribution/config/commands/ping.properties +@@ -5,7 +5,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ +diff --git a/distribution/config/commands/vm-info.properties b/distribution/config/commands/vm-info.properties +--- a/distribution/config/commands/vm-info.properties ++++ b/distribution/config/commands/vm-info.properties +@@ -4,7 +4,7 @@ + com.redhat.thermostat.web.client=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ +diff --git a/distribution/config/commands/vm-stat.properties b/distribution/config/commands/vm-stat.properties +--- a/distribution/config/commands/vm-stat.properties ++++ b/distribution/config/commands/vm-stat.properties +@@ -5,13 +5,15 @@ + com.redhat.thermostat.client.core=${project.version}, \ + org.apache.httpcomponents.httpcore=${httpcomponents.core.version}, \ + org.apache.httpcomponents.httpclient=${httpcomponents.client.version}, \ +- ${osgi.compendium.bundle.symbolic-name}=${osgi.compendium.osgi-version}, \ ++ org.apache.httpcomponents.httpmime=${httpcomponents.mime.version}, \ + com.google.gson=${gson.version}, \ + org.mongodb.mongo-java-driver=${mongo-driver.osgi-version}, \ + org.apache.commons.beanutils=${commons-beanutils.version}, \ + org.apache.commons.codec=${commons-codec.osgi-version}, \ + org.apache.commons.collections=${commons-collections.version}, \ +- org.apache.commons.logging=${commons-logging.version} ++ org.apache.commons.logging=${commons-logging.version}, \ ++ org.jfree.jcommon=${jcommon.osgi.version}, \ ++ org.jfree.jfreechart=${jfreechart.osgi.version} + + summary = show various statistics about a VM + +diff --git a/distribution/config/osgi-export.properties b/distribution/config/osgi-export.properties +--- a/distribution/config/osgi-export.properties ++++ b/distribution/config/osgi-export.properties +@@ -33,19 +33,6 @@ + # to do so, delete this exception statement from your version. + + # OSGi public API +-org.jfree.chart +-org.jfree.chart.axis +-org.jfree.chart.event +-org.jfree.chart.labels +-org.jfree.chart.plot +-org.jfree.chart.panel +-org.jfree.chart.renderer.xy +-org.jfree.data +-org.jfree.data.general +-org.jfree.data.time +-org.jfree.data.xy +-org.jfree.ui +-org.jfree.data.gantt + sun.swing + sun.swing.table + +diff --git a/killvm/distribution/thermostat-plugin.xml b/killvm/distribution/thermostat-plugin.xml +--- a/killvm/distribution/thermostat-plugin.xml ++++ b/killvm/distribution/thermostat-plugin.xml +@@ -81,9 +81,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + + + +diff --git a/main/src/main/resources/com/redhat/thermostat/main/impl/bootstrapbundles.properties b/main/src/main/resources/com/redhat/thermostat/main/impl/bootstrapbundles.properties +--- a/main/src/main/resources/com/redhat/thermostat/main/impl/bootstrapbundles.properties ++++ b/main/src/main/resources/com/redhat/thermostat/main/impl/bootstrapbundles.properties +@@ -5,4 +5,5 @@ + thermostat-plugin-validator-${project.version}.jar, \ + thermostat-launcher-${project.version}.jar, \ + jline-${jline.version}.jar, \ +- commons-cli-${commons-cli.version}.jar ++ commons-cli-${commons-cli.version}.jar, \ ++ jansi-${jansi.version}.jar +diff --git a/setup/distribution/thermostat-plugin.xml b/setup/distribution/thermostat-plugin.xml +--- a/setup/distribution/thermostat-plugin.xml ++++ b/setup/distribution/thermostat-plugin.xml +@@ -77,6 +77,8 @@ + com.redhat.thermostat.internal.utils.laf${project.version} + com.redhat.thermostat.plugin.validator${project.version} + com.redhat.thermostat.process${project.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + + + +diff --git a/storage-profile/distribution/thermostat-plugin.xml b/storage-profile/distribution/thermostat-plugin.xml +--- a/storage-profile/distribution/thermostat-plugin.xml ++++ b/storage-profile/distribution/thermostat-plugin.xml +@@ -70,9 +70,9 @@ + com.redhat.thermostat.storage.mongodb${project.version} + com.redhat.thermostat.web.common${project.version} + com.redhat.thermostat.web.client${project.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.mongodb.mongo-java-driver${mongo-driver.osgi-version} + org.apache.commons.beanutils${commons-beanutils.version} +diff --git a/vm-find/distribution/thermostat-plugin.xml b/vm-find/distribution/thermostat-plugin.xml +--- a/vm-find/distribution/thermostat-plugin.xml ++++ b/vm-find/distribution/thermostat-plugin.xml +@@ -220,9 +220,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + + + +diff --git a/vm-gc/distribution/thermostat-plugin.xml b/vm-gc/distribution/thermostat-plugin.xml +--- a/vm-gc/distribution/thermostat-plugin.xml ++++ b/vm-gc/distribution/thermostat-plugin.xml +@@ -76,9 +76,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + + + +@@ -122,9 +124,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + + + +diff --git a/vm-heap-analysis/distribution/thermostat-plugin.xml b/vm-heap-analysis/distribution/thermostat-plugin.xml +--- a/vm-heap-analysis/distribution/thermostat-plugin.xml ++++ b/vm-heap-analysis/distribution/thermostat-plugin.xml +@@ -87,9 +87,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +@@ -144,9 +146,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +@@ -204,9 +208,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +@@ -258,9 +264,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +@@ -312,9 +320,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +@@ -366,9 +376,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +@@ -414,9 +426,11 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + org.jboss.netty${netty.version} ++ org.jfree.jcommon${jcommon.osgi.version} ++ org.jfree.jfreechart${jfreechart.osgi.version} + ${lucene-core.bundle.symbolic-name}${lucene.osgi-version} + ${lucene-analysis.bundle.symbolic-name}${lucene.osgi-version} + +diff --git a/vm-profiler/distribution/thermostat-plugin.xml b/vm-profiler/distribution/thermostat-plugin.xml +--- a/vm-profiler/distribution/thermostat-plugin.xml ++++ b/vm-profiler/distribution/thermostat-plugin.xml +@@ -95,7 +95,7 @@ + org.apache.commons.logging${commons-logging.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + + + +diff --git a/web/endpoint-plugin/distribution/thermostat-plugin.xml b/web/endpoint-plugin/distribution/thermostat-plugin.xml +--- a/web/endpoint-plugin/distribution/thermostat-plugin.xml ++++ b/web/endpoint-plugin/distribution/thermostat-plugin.xml +@@ -73,7 +73,7 @@ + com.redhat.thermostat.web.client${project.version} + org.apache.httpcomponents.httpcore${httpcomponents.core.version} + org.apache.httpcomponents.httpclient${httpcomponents.client.version} +- ${osgi.compendium.bundle.symbolic-name}${osgi.compendium.osgi-version} ++ org.apache.httpcomponents.httpmime${httpcomponents.mime.version} + com.google.gson${gson.version} + com.redhat.thermostat.process${project.version} + com.redhat.thermostat.agent.cli${project.version} diff --git a/SOURCES/0002_shared_osgi_spec_fixes.patch b/SOURCES/0002_shared_osgi_spec_fixes.patch new file mode 100644 index 0000000..106a276 --- /dev/null +++ b/SOURCES/0002_shared_osgi_spec_fixes.patch @@ -0,0 +1,1995 @@ +diff --git a/agent/cli/pom.xml b/agent/cli/pom.xml +--- a/agent/cli/pom.xml ++++ b/agent/cli/pom.xml +@@ -97,8 +97,8 @@ + ${project.version} + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/agent/command/pom.xml b/agent/command/pom.xml +--- a/agent/command/pom.xml ++++ b/agent/command/pom.xml +@@ -76,8 +76,8 @@ + netty + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/agent/core/pom.xml b/agent/core/pom.xml +--- a/agent/core/pom.xml ++++ b/agent/core/pom.xml +@@ -88,8 +88,8 @@ + ${project.version} + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + + + com.sun +diff --git a/client/cli/pom.xml b/client/cli/pom.xml +--- a/client/cli/pom.xml ++++ b/client/cli/pom.xml +@@ -101,14 +101,8 @@ + ${project.version} + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/client/command/pom.xml b/client/command/pom.xml +--- a/client/command/pom.xml ++++ b/client/command/pom.xml +@@ -76,9 +76,8 @@ + netty + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/client/core/pom.xml b/client/core/pom.xml +--- a/client/core/pom.xml ++++ b/client/core/pom.xml +@@ -96,14 +96,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/client/living-vm-filter/core/pom.xml b/client/living-vm-filter/core/pom.xml +--- a/client/living-vm-filter/core/pom.xml ++++ b/client/living-vm-filter/core/pom.xml +@@ -90,15 +90,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/client/living-vm-filter/swing/pom.xml b/client/living-vm-filter/swing/pom.xml +--- a/client/living-vm-filter/swing/pom.xml ++++ b/client/living-vm-filter/swing/pom.xml +@@ -92,15 +92,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/client/swing/pom.xml b/client/swing/pom.xml +--- a/client/swing/pom.xml ++++ b/client/swing/pom.xml +@@ -110,14 +110,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/common/core/pom.xml b/common/core/pom.xml +--- a/common/core/pom.xml ++++ b/common/core/pom.xml +@@ -145,16 +145,6 @@ + commons-cli + + +- +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided +- + + + com.sun +diff --git a/config/pom.xml b/config/pom.xml +--- a/config/pom.xml ++++ b/config/pom.xml +@@ -91,14 +91,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/dev/multi-module-plugin-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/dev/multi-module-plugin-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +--- a/dev/multi-module-plugin-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml ++++ b/dev/multi-module-plugin-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +@@ -85,11 +85,8 @@ + + ${gson.version} + +- +- ${osgi.compendium.osgi-version} +- +- +- ${osgi.compendium.bundle.symbolic-name} ++ ++ ${felix.framework.version} + + + +diff --git a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/agent/pom.xml b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/agent/pom.xml +--- a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/agent/pom.xml ++++ b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/agent/pom.xml +@@ -52,8 +52,8 @@ + + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + provided + + +diff --git a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/client-cli/pom.xml b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/client-cli/pom.xml +--- a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/client-cli/pom.xml ++++ b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/client-cli/pom.xml +@@ -16,8 +16,8 @@ + + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + provided + + +diff --git a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/pom.xml b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/pom.xml +--- a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/pom.xml ++++ b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/pom.xml +@@ -107,13 +107,13 @@ + junit + ${symbol_dollar}{junit.version} + ++ ++ ++ org.apache.felix ++ org.apache.felix.framework ++ ${symbol_dollar}{felix.framework.version} ++ + +- +- org.osgi +- org.osgi.core +- ${symbol_dollar}{osgi.core.version} +- +- + + + +diff --git a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/storage-common/pom.xml b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/storage-common/pom.xml +--- a/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/storage-common/pom.xml ++++ b/dev/multi-module-plugin-archetype/src/main/resources/archetype-resources/storage-common/pom.xml +@@ -61,8 +61,8 @@ + + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + provided + + +diff --git a/host-cpu/agent/pom.xml b/host-cpu/agent/pom.xml +--- a/host-cpu/agent/pom.xml ++++ b/host-cpu/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-cpu/client-core/pom.xml b/host-cpu/client-core/pom.xml +--- a/host-cpu/client-core/pom.xml ++++ b/host-cpu/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-cpu/client-swing/pom.xml b/host-cpu/client-swing/pom.xml +--- a/host-cpu/client-swing/pom.xml ++++ b/host-cpu/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/host-cpu/common/pom.xml b/host-cpu/common/pom.xml +--- a/host-cpu/common/pom.xml ++++ b/host-cpu/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-memory/agent/pom.xml b/host-memory/agent/pom.xml +--- a/host-memory/agent/pom.xml ++++ b/host-memory/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-memory/client-core/pom.xml b/host-memory/client-core/pom.xml +--- a/host-memory/client-core/pom.xml ++++ b/host-memory/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-memory/client-swing/pom.xml b/host-memory/client-swing/pom.xml +--- a/host-memory/client-swing/pom.xml ++++ b/host-memory/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/host-memory/common/pom.xml b/host-memory/common/pom.xml +--- a/host-memory/common/pom.xml ++++ b/host-memory/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-overview/client-core/pom.xml b/host-overview/client-core/pom.xml +--- a/host-overview/client-core/pom.xml ++++ b/host-overview/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/host-overview/client-swing/pom.xml b/host-overview/client-swing/pom.xml +--- a/host-overview/client-swing/pom.xml ++++ b/host-overview/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/keyring/pom.xml b/keyring/pom.xml +--- a/keyring/pom.xml ++++ b/keyring/pom.xml +@@ -170,14 +170,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/killvm/agent/pom.xml b/killvm/agent/pom.xml +--- a/killvm/agent/pom.xml ++++ b/killvm/agent/pom.xml +@@ -103,8 +103,8 @@ + ${project.version} + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/killvm/client-swing/pom.xml b/killvm/client-swing/pom.xml +--- a/killvm/client-swing/pom.xml ++++ b/killvm/client-swing/pom.xml +@@ -100,14 +100,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/killvm/command/pom.xml b/killvm/command/pom.xml +--- a/killvm/command/pom.xml ++++ b/killvm/command/pom.xml +@@ -87,9 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/killvm/common/pom.xml b/killvm/common/pom.xml +--- a/killvm/common/pom.xml ++++ b/killvm/common/pom.xml +@@ -88,16 +88,6 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided +- +- + org.apache.felix + org.apache.felix.framework + 4.2.0 +@@ -120,4 +110,4 @@ + + + +- +\ No newline at end of file ++ +diff --git a/laf-utils/pom.xml b/laf-utils/pom.xml +--- a/laf-utils/pom.xml ++++ b/laf-utils/pom.xml +@@ -137,14 +137,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/notes/client-swing/pom.xml b/notes/client-swing/pom.xml +--- a/notes/client-swing/pom.xml ++++ b/notes/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/notes/common/pom.xml b/notes/common/pom.xml +--- a/notes/common/pom.xml ++++ b/notes/common/pom.xml +@@ -82,14 +82,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/numa/agent/pom.xml b/numa/agent/pom.xml +--- a/numa/agent/pom.xml ++++ b/numa/agent/pom.xml +@@ -80,9 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/numa/client-core/pom.xml b/numa/client-core/pom.xml +--- a/numa/client-core/pom.xml ++++ b/numa/client-core/pom.xml +@@ -83,14 +83,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/numa/client-swing/pom.xml b/numa/client-swing/pom.xml +--- a/numa/client-swing/pom.xml ++++ b/numa/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/numa/common/pom.xml b/numa/common/pom.xml +--- a/numa/common/pom.xml ++++ b/numa/common/pom.xml +@@ -82,14 +82,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/pom.xml b/pom.xml +--- a/pom.xml ++++ b/pom.xml +@@ -177,14 +177,26 @@ + org.apache.servicemix.bundles.lucene-analyzers-common + org.apache.servicemix.bundles.lucene + +- 4.3.1 ++ 4.2.0 + 4.3.1 + 4.3.1.201210102024 + osgi.cmpn +- 4.2.0 + + 3.2.4.Final + 4.3.2 +@@ -557,16 +569,6 @@ + + + +- org.osgi +- org.osgi.core +- ${osgi.core.version} +- +- +- org.osgi +- org.osgi.compendium +- ${osgi.compendium.version} +- +- + org.apache.felix + org.apache.felix.framework + ${felix.framework.version} +diff --git a/storage/cli/pom.xml b/storage/cli/pom.xml +--- a/storage/cli/pom.xml ++++ b/storage/cli/pom.xml +@@ -67,8 +67,8 @@ + ${project.version} + + +- org.osgi +- org.osgi.core ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/system-backend/pom.xml b/system-backend/pom.xml +--- a/system-backend/pom.xml ++++ b/system-backend/pom.xml +@@ -87,14 +87,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/thread/client-common/pom.xml b/thread/client-common/pom.xml +--- a/thread/client-common/pom.xml ++++ b/thread/client-common/pom.xml +@@ -73,14 +73,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/thread/client-controllers/pom.xml b/thread/client-controllers/pom.xml +--- a/thread/client-controllers/pom.xml ++++ b/thread/client-controllers/pom.xml +@@ -74,14 +74,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/thread/client-swing/pom.xml b/thread/client-swing/pom.xml +--- a/thread/client-swing/pom.xml ++++ b/thread/client-swing/pom.xml +@@ -68,14 +68,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/thread/collector/pom.xml b/thread/collector/pom.xml +--- a/thread/collector/pom.xml ++++ b/thread/collector/pom.xml +@@ -91,14 +91,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/thread/harvester/pom.xml b/thread/harvester/pom.xml +--- a/thread/harvester/pom.xml ++++ b/thread/harvester/pom.xml +@@ -74,14 +74,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/unix-process-handler/pom.xml b/unix-process-handler/pom.xml +--- a/unix-process-handler/pom.xml ++++ b/unix-process-handler/pom.xml +@@ -77,14 +77,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-classstat/agent/pom.xml b/vm-classstat/agent/pom.xml +--- a/vm-classstat/agent/pom.xml ++++ b/vm-classstat/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-classstat/client-core/pom.xml b/vm-classstat/client-core/pom.xml +--- a/vm-classstat/client-core/pom.xml ++++ b/vm-classstat/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-classstat/client-swing/pom.xml b/vm-classstat/client-swing/pom.xml +--- a/vm-classstat/client-swing/pom.xml ++++ b/vm-classstat/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-classstat/common/pom.xml b/vm-classstat/common/pom.xml +--- a/vm-classstat/common/pom.xml ++++ b/vm-classstat/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-compiler/agent/pom.xml b/vm-compiler/agent/pom.xml +--- a/vm-compiler/agent/pom.xml ++++ b/vm-compiler/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-compiler/client-core/pom.xml b/vm-compiler/client-core/pom.xml +--- a/vm-compiler/client-core/pom.xml ++++ b/vm-compiler/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-compiler/client-swing/pom.xml b/vm-compiler/client-swing/pom.xml +--- a/vm-compiler/client-swing/pom.xml ++++ b/vm-compiler/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-compiler/common/pom.xml b/vm-compiler/common/pom.xml +--- a/vm-compiler/common/pom.xml ++++ b/vm-compiler/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-cpu/agent/pom.xml b/vm-cpu/agent/pom.xml +--- a/vm-cpu/agent/pom.xml ++++ b/vm-cpu/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-cpu/client-cli/pom.xml b/vm-cpu/client-cli/pom.xml +--- a/vm-cpu/client-cli/pom.xml ++++ b/vm-cpu/client-cli/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-cpu/client-core/pom.xml b/vm-cpu/client-core/pom.xml +--- a/vm-cpu/client-core/pom.xml ++++ b/vm-cpu/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-cpu/client-swing/pom.xml b/vm-cpu/client-swing/pom.xml +--- a/vm-cpu/client-swing/pom.xml ++++ b/vm-cpu/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-cpu/common/pom.xml b/vm-cpu/common/pom.xml +--- a/vm-cpu/common/pom.xml ++++ b/vm-cpu/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-gc/agent/pom.xml b/vm-gc/agent/pom.xml +--- a/vm-gc/agent/pom.xml ++++ b/vm-gc/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-gc/client-core/pom.xml b/vm-gc/client-core/pom.xml +--- a/vm-gc/client-core/pom.xml ++++ b/vm-gc/client-core/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-gc/client-swing/pom.xml b/vm-gc/client-swing/pom.xml +--- a/vm-gc/client-swing/pom.xml ++++ b/vm-gc/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-gc/command/pom.xml b/vm-gc/command/pom.xml +--- a/vm-gc/command/pom.xml ++++ b/vm-gc/command/pom.xml +@@ -67,15 +67,10 @@ + ${project.version} + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + +- +- org.osgi +- org.osgi.compendium +- provided +- ++ + + com.redhat.thermostat + thermostat-common-test +diff --git a/vm-gc/common/pom.xml b/vm-gc/common/pom.xml +--- a/vm-gc/common/pom.xml ++++ b/vm-gc/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-gc/remote-collector-client-common/pom.xml b/vm-gc/remote-collector-client-common/pom.xml +--- a/vm-gc/remote-collector-client-common/pom.xml ++++ b/vm-gc/remote-collector-client-common/pom.xml +@@ -68,14 +68,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-gc/remote-collector-client-swing/pom.xml b/vm-gc/remote-collector-client-swing/pom.xml +--- a/vm-gc/remote-collector-client-swing/pom.xml ++++ b/vm-gc/remote-collector-client-swing/pom.xml +@@ -68,14 +68,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-gc/remote-collector-command/pom.xml b/vm-gc/remote-collector-command/pom.xml +--- a/vm-gc/remote-collector-command/pom.xml ++++ b/vm-gc/remote-collector-command/pom.xml +@@ -68,14 +68,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-gc/remote-collector-common/pom.xml b/vm-gc/remote-collector-common/pom.xml +--- a/vm-gc/remote-collector-common/pom.xml ++++ b/vm-gc/remote-collector-common/pom.xml +@@ -68,14 +68,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-heap-analysis/agent/pom.xml b/vm-heap-analysis/agent/pom.xml +--- a/vm-heap-analysis/agent/pom.xml ++++ b/vm-heap-analysis/agent/pom.xml +@@ -72,14 +72,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-heap-analysis/client-core/pom.xml b/vm-heap-analysis/client-core/pom.xml +--- a/vm-heap-analysis/client-core/pom.xml ++++ b/vm-heap-analysis/client-core/pom.xml +@@ -94,14 +94,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-heap-analysis/client-swing/pom.xml b/vm-heap-analysis/client-swing/pom.xml +--- a/vm-heap-analysis/client-swing/pom.xml ++++ b/vm-heap-analysis/client-swing/pom.xml +@@ -91,14 +91,8 @@ + + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-heap-analysis/command/pom.xml b/vm-heap-analysis/command/pom.xml +--- a/vm-heap-analysis/command/pom.xml ++++ b/vm-heap-analysis/command/pom.xml +@@ -93,14 +93,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-heap-analysis/common/pom.xml b/vm-heap-analysis/common/pom.xml +--- a/vm-heap-analysis/common/pom.xml ++++ b/vm-heap-analysis/common/pom.xml +@@ -93,14 +93,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/vm-io/agent/pom.xml b/vm-io/agent/pom.xml +--- a/vm-io/agent/pom.xml ++++ b/vm-io/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-io/client-cli/pom.xml b/vm-io/client-cli/pom.xml +--- a/vm-io/client-cli/pom.xml ++++ b/vm-io/client-cli/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-io/client-core/pom.xml b/vm-io/client-core/pom.xml +--- a/vm-io/client-core/pom.xml ++++ b/vm-io/client-core/pom.xml +@@ -98,14 +98,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-io/client-swing/pom.xml b/vm-io/client-swing/pom.xml +--- a/vm-io/client-swing/pom.xml ++++ b/vm-io/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-io/common/pom.xml b/vm-io/common/pom.xml +--- a/vm-io/common/pom.xml ++++ b/vm-io/common/pom.xml +@@ -98,14 +98,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-jmx/agent/pom.xml b/vm-jmx/agent/pom.xml +--- a/vm-jmx/agent/pom.xml ++++ b/vm-jmx/agent/pom.xml +@@ -86,14 +86,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-jmx/client-core/pom.xml b/vm-jmx/client-core/pom.xml +--- a/vm-jmx/client-core/pom.xml ++++ b/vm-jmx/client-core/pom.xml +@@ -88,14 +88,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-jmx/client-swing/pom.xml b/vm-jmx/client-swing/pom.xml +--- a/vm-jmx/client-swing/pom.xml ++++ b/vm-jmx/client-swing/pom.xml +@@ -96,14 +96,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-jmx/common/pom.xml b/vm-jmx/common/pom.xml +--- a/vm-jmx/common/pom.xml ++++ b/vm-jmx/common/pom.xml +@@ -88,14 +88,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-memory/agent/pom.xml b/vm-memory/agent/pom.xml +--- a/vm-memory/agent/pom.xml ++++ b/vm-memory/agent/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-memory/client-cli/pom.xml b/vm-memory/client-cli/pom.xml +--- a/vm-memory/client-cli/pom.xml ++++ b/vm-memory/client-cli/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-memory/client-core/pom.xml b/vm-memory/client-core/pom.xml +--- a/vm-memory/client-core/pom.xml ++++ b/vm-memory/client-core/pom.xml +@@ -84,14 +84,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-memory/client-swing/pom.xml b/vm-memory/client-swing/pom.xml +--- a/vm-memory/client-swing/pom.xml ++++ b/vm-memory/client-swing/pom.xml +@@ -90,14 +90,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-memory/common/pom.xml b/vm-memory/common/pom.xml +--- a/vm-memory/common/pom.xml ++++ b/vm-memory/common/pom.xml +@@ -99,14 +99,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-numa/agent/pom.xml b/vm-numa/agent/pom.xml +--- a/vm-numa/agent/pom.xml ++++ b/vm-numa/agent/pom.xml +@@ -86,9 +86,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-numa/client-core/pom.xml b/vm-numa/client-core/pom.xml +--- a/vm-numa/client-core/pom.xml ++++ b/vm-numa/client-core/pom.xml +@@ -89,9 +89,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-numa/client-swing/pom.xml b/vm-numa/client-swing/pom.xml +--- a/vm-numa/client-swing/pom.xml ++++ b/vm-numa/client-swing/pom.xml +@@ -93,9 +93,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-numa/common/pom.xml b/vm-numa/common/pom.xml +--- a/vm-numa/common/pom.xml ++++ b/vm-numa/common/pom.xml +@@ -104,9 +104,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-overview/client-core/pom.xml b/vm-overview/client-core/pom.xml +--- a/vm-overview/client-core/pom.xml ++++ b/vm-overview/client-core/pom.xml +@@ -83,14 +83,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-overview/client-swing/pom.xml b/vm-overview/client-swing/pom.xml +--- a/vm-overview/client-swing/pom.xml ++++ b/vm-overview/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-profiler/agent/pom.xml b/vm-profiler/agent/pom.xml +--- a/vm-profiler/agent/pom.xml ++++ b/vm-profiler/agent/pom.xml +@@ -96,14 +96,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-profiler/client-cli/pom.xml b/vm-profiler/client-cli/pom.xml +--- a/vm-profiler/client-cli/pom.xml ++++ b/vm-profiler/client-cli/pom.xml +@@ -80,14 +80,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-profiler/client-core/pom.xml b/vm-profiler/client-core/pom.xml +--- a/vm-profiler/client-core/pom.xml ++++ b/vm-profiler/client-core/pom.xml +@@ -98,14 +98,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/vm-profiler/client-swing/pom.xml b/vm-profiler/client-swing/pom.xml +--- a/vm-profiler/client-swing/pom.xml ++++ b/vm-profiler/client-swing/pom.xml +@@ -87,14 +87,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + org.jfree +diff --git a/vm-profiler/common/pom.xml b/vm-profiler/common/pom.xml +--- a/vm-profiler/common/pom.xml ++++ b/vm-profiler/common/pom.xml +@@ -98,14 +98,8 @@ + test + + +- org.osgi +- org.osgi.core +- provided +- +- +- org.osgi +- org.osgi.compendium +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + com.redhat.thermostat +diff --git a/web/client/pom.xml b/web/client/pom.xml +--- a/web/client/pom.xml ++++ b/web/client/pom.xml +@@ -64,9 +64,8 @@ + + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +@@ -96,10 +95,6 @@ + + +- org.osgi +- org.osgi.compendium +- +- + org.apache.httpcomponents + httpcore-osgi + ${httpcomponents.core.version} +diff --git a/web/endpoint-plugin/web-service/pom.xml b/web/endpoint-plugin/web-service/pom.xml +--- a/web/endpoint-plugin/web-service/pom.xml ++++ b/web/endpoint-plugin/web-service/pom.xml +@@ -54,9 +54,8 @@ + + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + +diff --git a/web/server/pom.xml b/web/server/pom.xml +--- a/web/server/pom.xml ++++ b/web/server/pom.xml +@@ -131,9 +131,8 @@ + + + +- org.osgi +- org.osgi.core +- provided ++ org.apache.felix ++ org.apache.felix.framework + + + diff --git a/SOURCES/0003_storage_init_fix.patch b/SOURCES/0003_storage_init_fix.patch new file mode 100644 index 0000000..2dd0ffa --- /dev/null +++ b/SOURCES/0003_storage_init_fix.patch @@ -0,0 +1,601 @@ +# HG changeset patch +# User Andrew Azores +# Date 1474381585 14400 +# Tue Sep 20 10:26:25 2016 -0400 +# Node ID 7a1c62f9337becc320476d4172025f24021da3e9 +# Parent d3a72ee75e2634dfeb996c151fb6d68b68f23f9b +Ensure storage is only initialized once in WebStorageEndPoint + +PR3170 +Reviewed-by: jerboaa +Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-September/020830.html + +diff --git a/web/server/pom.xml b/web/server/pom.xml +--- a/web/server/pom.xml ++++ b/web/server/pom.xml +@@ -63,6 +63,17 @@ + test + + ++ org.powermock ++ powermock-api-mockito ++ test ++ ++ ++ org.powermock ++ powermock-module-junit4 ++ test ++ ++ ++ + org.eclipse.jetty + jetty-server + ${jetty.version} +diff --git a/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactory.java b/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactory.java +--- a/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactory.java ++++ b/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactory.java +@@ -34,50 +34,14 @@ + * to do so, delete this exception statement from your version. + */ + +- + package com.redhat.thermostat.web.server; + + import com.redhat.thermostat.shared.config.CommonPaths; +-import com.redhat.thermostat.shared.config.SSLConfiguration; +-import com.redhat.thermostat.shared.config.internal.SSLConfigurationImpl; + import com.redhat.thermostat.storage.core.Storage; + import com.redhat.thermostat.storage.core.StorageCredentials; +-import com.redhat.thermostat.storage.core.StorageProvider; +-import com.redhat.thermostat.storage.mongodb.MongoStorageProvider; + +-class StorageFactory { ++interface StorageFactory { + +- private static Storage storage; ++ Storage getStorage(String storageClass, String storageEndpoint, CommonPaths paths, StorageCredentials creds); + +- // Web server is not OSGi, this factory method is workaround. +- static Storage getStorage(String storageClass, final String storageEndpoint, final CommonPaths paths, +- final StorageCredentials creds) { +- if (storage != null) { +- return storage; +- } +- SSLConfiguration sslConf = new SSLConfigurationImpl(paths); +- try { +- StorageProvider provider = (StorageProvider) Class.forName(storageClass).newInstance(); +- provider.setConfig(storageEndpoint, creds, sslConf); +- storage = provider.createStorage(); +- storage.getConnection().connect(); +- return storage; +- } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { +- // This fallback should infact not be used. But it gives us an automatic +- // Import-Package in the OSGi descriptor, which actually *prevents* this same +- // exception from happening (a recursive self-defeating catch-block) :-) +- System.err.println("could not instantiate provider: " + storageClass + ", falling back to MongoStorage"); +- e.printStackTrace(); +- StorageProvider provider = new MongoStorageProvider(); +- provider.setConfig(storageEndpoint, creds, sslConf); +- storage = provider.createStorage(); +- return storage; +- } +- } +- +- // Testing hook used in WebStorageEndpointTest +- static void setStorage(Storage storage) { +- StorageFactory.storage = storage; +- } + } +- +diff --git a/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactoryImpl.java b/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactoryImpl.java +new file mode 100644 +--- /dev/null ++++ b/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactoryImpl.java +@@ -0,0 +1,83 @@ ++/* ++ * Copyright 2012-2016 Red Hat, Inc. ++ * ++ * This file is part of Thermostat. ++ * ++ * Thermostat is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published ++ * by the Free Software Foundation; either version 2, or (at your ++ * option) any later version. ++ * ++ * Thermostat is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with Thermostat; see the file COPYING. If not see ++ * . ++ * ++ * Linking this code with other modules is making a combined work ++ * based on this code. Thus, the terms and conditions of the GNU ++ * General Public License cover the whole combination. ++ * ++ * As a special exception, the copyright holders of this code give ++ * you permission to link this code with independent modules to ++ * produce an executable, regardless of the license terms of these ++ * independent modules, and to copy and distribute the resulting ++ * executable under terms of your choice, provided that you also ++ * meet, for each linked independent module, the terms and conditions ++ * of the license of that module. An independent module is a module ++ * which is not derived from or based on this code. If you modify ++ * this code, you may extend this exception to your version of the ++ * library, but you are not obligated to do so. If you do not wish ++ * to do so, delete this exception statement from your version. ++ */ ++ ++ ++package com.redhat.thermostat.web.server; ++ ++import com.redhat.thermostat.shared.config.CommonPaths; ++import com.redhat.thermostat.shared.config.SSLConfiguration; ++import com.redhat.thermostat.shared.config.internal.SSLConfigurationImpl; ++import com.redhat.thermostat.storage.core.Storage; ++import com.redhat.thermostat.storage.core.StorageCredentials; ++import com.redhat.thermostat.storage.core.StorageProvider; ++import com.redhat.thermostat.storage.mongodb.MongoStorageProvider; ++ ++class StorageFactoryImpl { ++ ++ private static Storage storage; ++ ++ // Web server is not OSGi, this factory method is workaround. ++ static Storage getStorage(String storageClass, final String storageEndpoint, final CommonPaths paths, ++ final StorageCredentials creds) { ++ if (storage != null) { ++ return storage; ++ } ++ SSLConfiguration sslConf = new SSLConfigurationImpl(paths); ++ try { ++ StorageProvider provider = (StorageProvider) Class.forName(storageClass).newInstance(); ++ provider.setConfig(storageEndpoint, creds, sslConf); ++ storage = provider.createStorage(); ++ storage.getConnection().connect(); ++ return storage; ++ } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { ++ // This fallback should infact not be used. But it gives us an automatic ++ // Import-Package in the OSGi descriptor, which actually *prevents* this same ++ // exception from happening (a recursive self-defeating catch-block) :-) ++ System.err.println("could not instantiate provider: " + storageClass + ", falling back to MongoStorage"); ++ e.printStackTrace(); ++ StorageProvider provider = new MongoStorageProvider(); ++ provider.setConfig(storageEndpoint, creds, sslConf); ++ storage = provider.createStorage(); ++ return storage; ++ } ++ } ++ ++ // Testing hook used in WebStorageEndpointTest ++ static void setStorage(Storage storage) { ++ StorageFactoryImpl.storage = storage; ++ } ++} ++ +diff --git a/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactoryProvider.java b/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactoryProvider.java +new file mode 100644 +--- /dev/null ++++ b/web/server/src/main/java/com/redhat/thermostat/web/server/StorageFactoryProvider.java +@@ -0,0 +1,43 @@ ++/* ++ * Copyright 2012-2016 Red Hat, Inc. ++ * ++ * This file is part of Thermostat. ++ * ++ * Thermostat is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published ++ * by the Free Software Foundation; either version 2, or (at your ++ * option) any later version. ++ * ++ * Thermostat is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with Thermostat; see the file COPYING. If not see ++ * . ++ * ++ * Linking this code with other modules is making a combined work ++ * based on this code. Thus, the terms and conditions of the GNU ++ * General Public License cover the whole combination. ++ * ++ * As a special exception, the copyright holders of this code give ++ * you permission to link this code with independent modules to ++ * produce an executable, regardless of the license terms of these ++ * independent modules, and to copy and distribute the resulting ++ * executable under terms of your choice, provided that you also ++ * meet, for each linked independent module, the terms and conditions ++ * of the license of that module. An independent module is a module ++ * which is not derived from or based on this code. If you modify ++ * this code, you may extend this exception to your version of the ++ * library, but you are not obligated to do so. If you do not wish ++ * to do so, delete this exception statement from your version. ++ */ ++ ++package com.redhat.thermostat.web.server; ++ ++interface StorageFactoryProvider { ++ ++ StorageFactory createStorageFactory(); ++ ++} +diff --git a/web/server/src/main/java/com/redhat/thermostat/web/server/WebStorageEndPoint.java b/web/server/src/main/java/com/redhat/thermostat/web/server/WebStorageEndPoint.java +--- a/web/server/src/main/java/com/redhat/thermostat/web/server/WebStorageEndPoint.java ++++ b/web/server/src/main/java/com/redhat/thermostat/web/server/WebStorageEndPoint.java +@@ -145,6 +145,8 @@ + + private static final Logger logger = LoggingUtils.getLogger(WebStorageEndPoint.class); + ++ private final Object storageLock = new Object(); ++ private StorageFactoryProvider storageFactoryProvider; + private Storage storage; + private Gson gson; + private CommonPaths paths; +@@ -164,14 +166,27 @@ + private TimerRegistry timerRegistry; + + public WebStorageEndPoint() { +- // default constructor ++ // this ugliness allows for both unit tests to inject mocks and "integration" tests to inject fake values ++ this.storageFactoryProvider = new StorageFactoryProvider() { ++ @Override ++ public StorageFactory createStorageFactory() { ++ return new StorageFactory() { ++ @Override ++ public Storage getStorage(String storageClass, String storageEndpoint, CommonPaths paths, StorageCredentials creds) { ++ return StorageFactoryImpl.getStorage(storageClass, storageEndpoint, paths, creds); ++ } ++ }; ++ } ++ }; + } + + // Package private for testing +- WebStorageEndPoint(TimerRegistry timerRegistry, CommonPaths paths, ConfigurationFinder finder) { ++ WebStorageEndPoint(TimerRegistry timerRegistry, CommonPaths paths, ConfigurationFinder finder, ++ StorageFactoryProvider storageFactoryProvider) { + this.timerRegistry = timerRegistry; + this.paths = paths; + this.finder = finder; ++ this.storageFactoryProvider = storageFactoryProvider; + } + + @Override +@@ -222,41 +237,52 @@ + servletContext.setAttribute(PREPARED_STMT_MANAGER_KEY, new PreparedStatementManager()); + servletContext.setAttribute(SERVER_TOKEN_KEY, UUID.randomUUID()); + } ++ ++ synchronized (storageLock) { ++ if (storage == null) { ++ StorageCredentials creds; ++ try { ++ creds = getStorageCredentials(); ++ } catch (IOException e) { ++ String errorMsg = "Unable to retrieve backing storage credentials from file " + CREDENTIALS_FILE; ++ throw new InvalidConfigurationException(errorMsg); ++ } ++ // if creds are null there is no point to continue, fail prominently. ++ if (creds == null) { ++ String errorMsg = "No backing storage credentials file (" + CREDENTIALS_FILE + ") available"; ++ throw new InvalidConfigurationException(errorMsg); ++ } ++ String storageClass = getServletConfig().getInitParameter(STORAGE_CLASS); ++ String storageEndpoint = getServletConfig().getInitParameter(STORAGE_ENDPOINT); ++ storage = storageFactoryProvider.createStorageFactory().getStorage(storageClass, storageEndpoint, paths, creds); ++ } ++ } + } + + @Override + public void destroy() { + timerRegistry.shutDown(); +- logger.log(Level.INFO, "Going to shut down web service"); +- if (storage != null) { +- // See IcedTea BZ#1315. Shut down storage in order +- // to avoid further memory leaks. +- Connection connection = storage.getConnection(); +- try { +- // Tests have null connections +- if (connection != null) { +- connection.disconnect(); ++ synchronized (storageLock) { ++ logger.log(Level.INFO, "Going to shut down web service"); ++ if (storage != null) { ++ // See IcedTea BZ#1315. Shut down storage in order ++ // to avoid further memory leaks. ++ Connection connection = storage.getConnection(); ++ try { ++ // Tests have null connections ++ if (connection != null) { ++ connection.disconnect(); ++ } ++ } finally { ++ storage.shutdown(); + } +- } finally { +- storage.shutdown(); + } ++ logger.log(Level.INFO, "Web service shut down finished"); + } +- logger.log(Level.INFO, "Web service shut down finished"); + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { +- if (storage == null) { +- StorageCredentials creds = getStorageCredentials(); +- // if creds are null there is no point to continue, fail prominently. +- if (creds == null) { +- String errorMsg = "No backing storage credentials file (" + CREDENTIALS_FILE + ") available"; +- throw new InvalidConfigurationException(errorMsg); +- } +- String storageClass = getServletConfig().getInitParameter(STORAGE_CLASS); +- String storageEndpoint = getServletConfig().getInitParameter(STORAGE_ENDPOINT); +- storage = StorageFactory.getStorage(storageClass, storageEndpoint, paths, creds); +- } + String uri = req.getRequestURI(); + int lastPartIdx = uri.lastIndexOf("/"); + String cmd = uri.substring(lastPartIdx + 1); +@@ -413,8 +439,9 @@ + // PreparedStatementManager + PreparedStatement targetPreparedStatement; + try { +- targetPreparedStatement = (PreparedStatement) storage +- .prepareStatement(desc); ++ synchronized (storageLock) { ++ targetPreparedStatement = storage.prepareStatement(desc); ++ } + } catch (DescriptorParsingException e) { + logger.log(Level.WARNING, "Descriptor parse error!", e); + SharedStateId id = new SharedStateId(WebPreparedStatementResponse.DESCRIPTOR_PARSE_FAILED, serverToken); +@@ -452,7 +479,9 @@ + } + + String agentId = req.getParameter("agentId"); +- storage.purge(agentId); ++ synchronized (storageLock) { ++ storage.purge(agentId); ++ } + resp.setStatus(HttpServletResponse.SC_OK); + } + +@@ -466,21 +495,23 @@ + if (! isAllowedToLoadFile(req, resp, name)) { + return; + } +- try (InputStream data = storage.loadFile(name)) { +- if (data == null) { +- resp.setStatus(HttpServletResponse.SC_NO_CONTENT); +- return; ++ synchronized (storageLock) { ++ try (InputStream data = storage.loadFile(name)) { ++ if (data == null) { ++ resp.setStatus(HttpServletResponse.SC_NO_CONTENT); ++ return; ++ } ++ OutputStream out = resp.getOutputStream(); ++ byte[] buffer = new byte[512]; ++ int read = 0; ++ while (read >= 0) { ++ read = data.read(buffer); ++ if (read > 0) { ++ out.write(buffer, 0, read); ++ } ++ } ++ resp.setStatus(HttpServletResponse.SC_OK); + } +- OutputStream out = resp.getOutputStream(); +- byte[] buffer = new byte[512]; +- int read = 0; +- while (read >= 0) { +- read = data.read(buffer); +- if (read > 0) { +- out.write(buffer, 0, read); +- } +- } +- resp.setStatus(HttpServletResponse.SC_OK); + } + } + +@@ -507,7 +538,9 @@ + return; + } + InputStream in = item.getInputStream(); +- storage.saveFile(name, in); ++ synchronized (storageLock) { ++ storage.saveFile(name, in); ++ } + } + } + } catch (FileUploadException ex) { +@@ -591,7 +624,9 @@ + // The following has the side effect of registering the newly + // deserialized Category in the Categories class. + category = gson.fromJson(categoryParam, Category.class); +- storage.registerCategory(category); ++ synchronized (storageLock) { ++ storage.registerCategory(category); ++ } + } + id = catManager.putCategory(getServerToken(), category, catIdentifier); + if (isAggregateCat) { +diff --git a/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndPointUnitTest.java b/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndPointUnitTest.java +--- a/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndPointUnitTest.java ++++ b/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndPointUnitTest.java +@@ -42,10 +42,14 @@ + import static org.junit.Assert.assertNull; + import static org.junit.Assert.assertTrue; + import static org.junit.Assert.fail; ++import static org.mockito.Matchers.any; ++import static org.mockito.Matchers.anyString; + import static org.mockito.Mockito.mock; ++import static org.mockito.Mockito.verifyZeroInteractions; + import static org.mockito.Mockito.when; + import static org.mockito.Mockito.verify; + import static org.mockito.Matchers.eq; ++import static org.powermock.api.mockito.PowerMockito.whenNew; + + import java.io.File; + import java.io.IOException; +@@ -61,13 +65,18 @@ + import javax.servlet.ServletContext; + import javax.servlet.ServletException; + ++import com.redhat.thermostat.storage.core.Storage; + import org.junit.After; ++import org.junit.Before; + import org.junit.Test; ++import org.junit.runner.RunWith; + import org.mockito.ArgumentCaptor; + + import com.redhat.thermostat.shared.config.CommonPaths; + import com.redhat.thermostat.storage.core.StorageCredentials; + import com.redhat.thermostat.web.server.auth.WebStoragePathHandler; ++import org.powermock.core.classloader.annotations.PrepareForTest; ++import org.powermock.modules.junit4.PowerMockRunner; + + /** + * A test class for {@link WebStorageEndPoint}. It should contain tests for +@@ -75,9 +84,26 @@ + * more of the unit-test nature (rather than of the functional test nature). + * + */ ++@RunWith(PowerMockRunner.class) + public class WebStorageEndPointUnitTest { + + private static final String TH_HOME_PROP_NAME = "THERMOSTAT_HOME"; ++ ++ private StorageFactoryProvider storageFactoryProvider; ++ private StorageFactory storageFactory; ++ private Storage storage; ++ ++ @Before ++ public void setup() { ++ storage = mock(Storage.class); ++ storageFactory = mock(StorageFactory.class); ++ storageFactoryProvider = mock(StorageFactoryProvider.class); ++ ++ when(storageFactoryProvider.createStorageFactory()).thenReturn(storageFactory); ++ when(storageFactory.getStorage(anyString(), anyString(), any(CommonPaths.class), any(StorageCredentials.class))) ++ .thenReturn(storage); ++ } ++ + @After + public void tearDown() { + System.clearProperty(TH_HOME_PROP_NAME); +@@ -217,17 +243,27 @@ + * @throws IOException + */ + @Test +- public void testSetServletAttribute() throws ServletException, IOException { ++ @PrepareForTest({ WebStorageEndPoint.class }) ++ public void testSetServletAttribute() throws Exception { + final ServletContext mockContext = mock(ServletContext.class); + when(mockContext.getServerInfo()).thenReturn("jetty/9.1.0.v20131115"); ++ final ConfigurationFinder finder = mock(ConfigurationFinder.class); ++ when(finder.getConfiguration(anyString())).thenReturn(mock(File.class)); ++ FileBasedStorageCredentials mockCreds = mock(FileBasedStorageCredentials.class); ++ when(mockCreds.getUsername()).thenReturn("username"); ++ when(mockCreds.getPassword()).thenReturn("password".toCharArray()); ++ whenNew(FileBasedStorageCredentials.class).withAnyArguments().thenReturn(mockCreds); + @SuppressWarnings("serial") +- WebStorageEndPoint endpoint = new WebStorageEndPoint() { ++ WebStorageEndPoint endpoint = new WebStorageEndPoint(null, null, finder, storageFactoryProvider) { + @Override + public ServletContext getServletContext() { + return mockContext; + } + }; + ServletConfig config = mock(ServletConfig.class); ++ when(config.getInitParameter(WebStorageEndPoint.STORAGE_CLASS)).thenReturn("fooKlazz"); // let it fail through ++ when(config.getInitParameter(WebStorageEndPoint.STORAGE_ENDPOINT)).thenReturn("fooEndPoint"); ++ + ThCreatorResult result = creatWorkingThermostatHome(); + System.setProperty(TH_HOME_PROP_NAME, result.thermostatHome.toFile().getAbsolutePath()); + endpoint.init(config); +@@ -248,7 +284,7 @@ + @Test + public void testShutDownCancelsTimers() { + TimerRegistry registry = mock(TimerRegistry.class); +- WebStorageEndPoint endpoint = new WebStorageEndPoint(registry, null, null); ++ WebStorageEndPoint endpoint = new WebStorageEndPoint(registry, null, null, storageFactoryProvider); + endpoint.destroy(); + verify(registry).shutDown(); + } +@@ -263,12 +299,57 @@ + ConfigurationFinder finder = mock(ConfigurationFinder.class); + when(finder.getConfiguration("web.auth")).thenReturn(null); + +- WebStorageEndPoint endpoint = new WebStorageEndPoint(registry, paths, finder); ++ WebStorageEndPoint endpoint = new WebStorageEndPoint(registry, paths, finder, storageFactoryProvider); + StorageCredentials creds = endpoint.getStorageCredentials(); + + assertNull(creds); + } +- ++ ++ @Test ++// @Bug(id = "PR2941", ++// url = "http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2941", ++// summary = "Concurrent webstorage connections may cause storage exceptions") ++ @PrepareForTest({ WebStorageEndPoint.class }) ++ public void testStorageIsCreatedOnceOnInit() throws Exception { ++ final ServletContext mockContext = mock(ServletContext.class); ++ when(mockContext.getServerInfo()).thenReturn("jetty/9.1.0.v20131115"); ++ final ConfigurationFinder finder = mock(ConfigurationFinder.class); ++ when(finder.getConfiguration(anyString())).thenReturn(mock(File.class)); ++ FileBasedStorageCredentials mockCreds = mock(FileBasedStorageCredentials.class); ++ when(mockCreds.getUsername()).thenReturn("username"); ++ when(mockCreds.getPassword()).thenReturn("password".toCharArray()); ++ whenNew(FileBasedStorageCredentials.class).withAnyArguments().thenReturn(mockCreds); ++ @SuppressWarnings("serial") ++ WebStorageEndPoint endpoint = new WebStorageEndPoint(null, null, finder, storageFactoryProvider) { ++ @Override ++ public ServletContext getServletContext() { ++ return mockContext; ++ } ++ }; ++ ServletConfig config = mock(ServletConfig.class); ++ when(config.getInitParameter(WebStorageEndPoint.STORAGE_CLASS)).thenReturn("fooKlazz"); // let it fail through ++ when(config.getInitParameter(WebStorageEndPoint.STORAGE_ENDPOINT)).thenReturn("fooEndPoint"); ++ ++ ThCreatorResult result = creatWorkingThermostatHome(); ++ System.setProperty(TH_HOME_PROP_NAME, result.thermostatHome.toFile().getAbsolutePath()); ++ ++ // not created yet ++ verifyZeroInteractions(storageFactoryProvider); ++ verifyZeroInteractions(storageFactory); ++ ++ endpoint.init(mock(ServletConfig.class)); ++ ++ // created once ++ verify(storageFactoryProvider).createStorageFactory(); ++ verify(storageFactory).getStorage(anyString(), anyString(), any(CommonPaths.class), any(StorageCredentials.class)); ++ ++ endpoint.init(mock(ServletConfig.class)); ++ ++ // still only once ++ verify(storageFactoryProvider).createStorageFactory(); ++ verify(storageFactory).getStorage(anyString(), anyString(), any(CommonPaths.class), any(StorageCredentials.class)); ++ } ++ + private ThCreatorResult creatWorkingThermostatHome() throws IOException { + Path testThermostatHome = Files.createTempDirectory( + "foo-thermostat-home-", new FileAttribute[] {}); +diff --git a/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndpointTest.java b/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndpointTest.java +--- a/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndpointTest.java ++++ b/web/server/src/test/java/com/redhat/thermostat/web/server/WebStorageEndpointTest.java +@@ -223,7 +223,7 @@ + public void setUp() throws Exception { + + mockStorage = mock(BackingStorage.class); +- StorageFactory.setStorage(mockStorage); ++ StorageFactoryImpl.setStorage(mockStorage); + } + + private void startServer(int port, LoginService loginService) throws Exception { diff --git a/SOURCES/0004_verify_token_removal_fix.patch b/SOURCES/0004_verify_token_removal_fix.patch new file mode 100644 index 0000000..f389dec --- /dev/null +++ b/SOURCES/0004_verify_token_removal_fix.patch @@ -0,0 +1,61 @@ +# HG changeset patch +# User Jie Kang +# Date 1477487506 14400 +# Wed Oct 26 09:11:46 2016 -0400 +# Node ID a26429779377d98fcf07664d767f9d3400043eed +# Parent 9fe2266b4fa55eb78d372e634790878f328303f5 +Fix verified-token removal in TokenManager + +PR3210 + +Reviewed-by: jerboaa +Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-October/021425.html + +diff --git a/web/server/src/main/java/com/redhat/thermostat/web/server/TokenManager.java b/web/server/src/main/java/com/redhat/thermostat/web/server/TokenManager.java +--- a/web/server/src/main/java/com/redhat/thermostat/web/server/TokenManager.java ++++ b/web/server/src/main/java/com/redhat/thermostat/web/server/TokenManager.java +@@ -85,12 +85,12 @@ + return token; + } + +- private void scheduleRemoval(final String clientToken) { ++ private void scheduleRemoval(final String clientKey) { + TimerTask task = new TimerTask() { + + @Override + public void run() { +- tokens.remove(clientToken); ++ tokens.remove(clientKey); + } + }; + timer.schedule(task, timeout); +@@ -111,7 +111,7 @@ + byte[] storedToken = tokens.get(clientKey); + boolean verified = Arrays.equals(candidateToken, storedToken); + if (verified) { +- tokens.remove(clientToken); ++ tokens.remove(clientKey); + } + return verified; + } +diff --git a/web/server/src/test/java/com/redhat/thermostat/web/server/TokenManagerTest.java b/web/server/src/test/java/com/redhat/thermostat/web/server/TokenManagerTest.java +--- a/web/server/src/test/java/com/redhat/thermostat/web/server/TokenManagerTest.java ++++ b/web/server/src/test/java/com/redhat/thermostat/web/server/TokenManagerTest.java +@@ -91,6 +91,17 @@ + } + + @Test ++ public void generateTokenCanNotBeReusedTest() { ++ TokenManager tokenManager = new TokenManager(mock(TimerRegistry.class)); ++ String clientToken = "something"; ++ String action = "myAction"; ++ byte[] token = tokenManager.generateToken(clientToken.getBytes(), action); ++ assertTrue(tokenManager.verifyToken(clientToken.getBytes(), token, action)); ++ // try again with same action name, which should not verify ++ assertFalse(tokenManager.verifyToken(clientToken.getBytes(), token, action)); ++ } ++ ++ @Test + public void generateAndVerifyTokenTest() { + TokenManager tokenManager = new TokenManager(mock(TimerRegistry.class)); + String clientToken = "something"; diff --git a/SOURCES/fedora-thermostatrc b/SOURCES/fedora-thermostatrc new file mode 100644 index 0000000..d5072cb --- /dev/null +++ b/SOURCES/fedora-thermostatrc @@ -0,0 +1,64 @@ +#!/bin/bash +# +# Copyright 2012-2016 Red Hat, Inc. +# +# This file is part of Thermostat. +# +# Thermostat is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2, or (at your +# option) any later version. +# +# Thermostat is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Thermostat; see the file COPYING. If not see +# . +# +# Linking this code with other modules is making a combined work +# based on this code. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this code give +# you permission to link this code with independent modules to +# produce an executable, regardless of the license terms of these +# independent modules, and to copy and distribute the resulting +# executable under terms of your choice, provided that you also +# meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module +# which is not derived from or based on this code. If you modify +# this code, you may extend this exception to your version of the +# library, but you are not obligated to do so. If you do not wish +# to do so, delete this exception statement from your version. +# +##################################################################### +# +# Environment variables for the system Thermostat profile. You +# can assume that THERMOSTAT_HOME variable is correctly set and you +# may override system variables via a user profile in +# USER_THERMOSTAT_HOME/etc/thermostatrc. +# +##################################################################### + +# +# Extra jar files which need to be on the classpath when +# Thermostat boots. +# +THERMOSTAT_EXT_BOOT_CLASSPATH="__TOOLS_PATH__" +THERMOSTAT_EXT_BOOT_CLASSPATH="${THERMOSTAT_EXT_BOOT_CLASSPATH}:${THERMOSTAT_HOME}/plugins/embedded-web-endpoint/jetty-schemas-3.1.M0.jar" +export THERMOSTAT_EXT_BOOT_CLASSPATH + +# +# Extra java options +# +#THERMOSTAT_EXT_JAVA_OPTS="-Xint -ea" +#export THERMOSTAT_EXT_JAVA_OPTS + +# +# Extra options passed on to the Thermostat main class +# +THERMOSTAT_EXT_OPTS="--ignore-bundle-versions" +export THERMOSTAT_EXT_OPTS diff --git a/SOURCES/scl-thermostat-tomcat-service-sysconfig b/SOURCES/scl-thermostat-tomcat-service-sysconfig new file mode 100644 index 0000000..975bfb7 --- /dev/null +++ b/SOURCES/scl-thermostat-tomcat-service-sysconfig @@ -0,0 +1,10 @@ +# Custom configuration for Thermostat's CATALINA_BASE based tomcat. +# +# Where your tomcat installation lives +CATALINA_BASE="__catalina_base__" +CATALINA_HOME="__catalina_home__" +# Set Thermostat JAAS config via Tomcat's JAVA_OPTS variable. +# -Djava.security.egd=file:/dev/./urandom makes our tomcat use +# /dev/urandom over /dev/random which might block. See +# RHBZ#1328972 for details. +JAVA_OPTS="-Djava.security.auth.login.config=__jaas_config__ -Djava.security.egd=file:/dev/./urandom" diff --git a/SOURCES/scl-tomcat-initd.sh b/SOURCES/scl-tomcat-initd.sh new file mode 100644 index 0000000..63a24fd --- /dev/null +++ b/SOURCES/scl-tomcat-initd.sh @@ -0,0 +1,286 @@ +#!/bin/bash +# +# rh-thermostat16-thermostat-tomcat This shell script takes care of deploying SCL-ized thermostat +# webapp. +# +# chkconfig: - 80 20 +# +### BEGIN INIT INFO +# Provides: __service_name__ +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# Default-Start: +# Default-Stop: +# Description: Thermostat tomcat start wrapper +# Short-Description: start and stop Thermostat's tomcat +### END INIT INFO +# +# Clone of tomcat6's init script. +# + +## Source function library. +#. /etc/rc.d/init.d/functions +# Source LSB function library. +if [ -r /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +else + exit 1 +fi + +DISTRIB_ID=`lsb_release -i -s 2>/dev/null` + +NAME="$(basename $0)" +unset ISBOOT +if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then + NAME="${NAME:3}" + ISBOOT="1" +fi + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser -s /bin/sh" +else + SU="/bin/su -s /bin/sh" +fi + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${NAME} +fi + +# Define which connector port to use +CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/tomcat6" + +# Tomcat program name +TOMCAT_PROG="${NAME}" + +# Define the tomcat username +TOMCAT_USER="${TOMCAT_USER:-tomcat}" + +# Define the tomcat log file +TOMCAT_LOG="${TOMCAT_LOG:-/var/log/${NAME}-initd.log}" + +# Define the pid file name +# If change is needed, use sysconfig instead of here +export CATALINA_PID="${CATALINA_PID:-/var/run/${NAME}.pid}" + +RETVAL="0" + +function parseOptions() { + options="" + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ + $TOMCAT_CFG + )" + if [ -r "/etc/sysconfig/${NAME}" ]; then + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; + print "export ", $0, ";" }' \ + /etc/sysconfig/${NAME} + )" + fi + TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}" +} + +# rhbz 757632 +function version() { + parseOptions + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} version" >> ${TOMCAT_LOG} 2>&1 || RETVAL="4" +} + +# See how we were called. +function start() { + + echo -n "Starting ${TOMCAT_PROG}: " + if [ "$RETVAL" != "0" ]; then + log_failure_msg + return + fi + if [ -f "/var/lock/subsys/${NAME}" ]; then + if [ -f "${CATALINA_PID}" ]; then + read kpid < ${CATALINA_PID} +# if checkpid $kpid 2>&1; then + if [ -d "/proc/${kpid}" ]; then + log_success_msg + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi + RETVAL="0" + return + fi + fi + fi + # fix permissions on the log and pid files + touch $CATALINA_PID 2>&1 || RETVAL="4" + if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID + fi + parseOptions + if [ "$RETVAL" -eq "0" -a "$SECURITY_MANAGER" = "true" ]; then + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security" \ + >> ${TOMCAT_LOG} 2>&1 || RETVAL="4" + else + + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start" >> ${TOMCAT_LOG} 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + log_success_msg + touch /var/lock/subsys/${NAME} + else + log_failure_msg "Error code ${RETVAL}" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function stop() { + echo -n "Stopping ${TOMCAT_PROG}: " + if [ -f "/var/lock/subsys/${NAME}" ]; then + parseOptions + if [ "$RETVAL" -eq "0" ]; then + touch /var/lock/subsys/${NAME} 2>&1 || RETVAL="4" + [ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> ${TOMCAT_LOG} 2>&1 || RETVAL="4" + fi + if [ "$RETVAL" -eq "0" ]; then + count="0" + if [ -f "${CATALINA_PID}" ]; then + read kpid < ${CATALINA_PID} + until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ + [ "$count" -gt "$SHUTDOWN_WAIT" ]; do + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + echo "waiting for processes $kpid to exit" + fi + sleep 1 + let count="${count}+1" + done + if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + log_warning_msg "killing processes which did not stop after ${SHUTDOWN_WAIT} seconds" + fi + kill -9 $kpid + fi + log_success_msg + fi + rm -f /var/lock/subsys/${NAME} ${CATALINA_PID} + else + log_failure_msg + RETVAL="4" + fi + else + log_success_msg + RETVAL="0" + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi +} + +function status() +{ + checkpidfile + if [ "$RETVAL" -eq "0" ]; then + log_success_msg "${NAME} (pid ${kpid}) is running..." + elif [ "$RETVAL" -eq "1" ]; then + log_failure_msg "PID file exists, but process is not running" + else + checklockfile + if [ "$RETVAL" -eq "2" ]; then + log_failure_msg "${NAME} lockfile exists but process is not running" + else + pid="$(/usr/bin/pgrep -u ${TOMCAT_USER} -f tomcat)" + if [ -z "$pid" ]; then + log_success_msg "${NAME} is stopped" + RETVAL="3" + else + log_success_msg "${NAME} (pid $pid) is running..." + RETVAL="0" + fi + fi + fi +} + +function checklockfile() +{ + if [ -f /var/lock/subsys/${NAME} ]; then + pid="$(/usr/bin/pgrep -u ${TOMCAT_USER} -f tomcat)" +# The lockfile exists but the process is not running + if [ -z "$pid" ]; then + RETVAL="2" + fi + fi +} + +function checkpidfile() +{ + if [ -f "${CATALINA_PID}" ]; then + read kpid < ${CATALINA_PID} + if [ -d "/proc/${kpid}" ]; then +# The pid file exists and the process is running + RETVAL="0" + else +# The pid file exists but the process is not running + RETVAL="1" + return + fi + fi +# pid file does not exist and program is not running + RETVAL="3" +} + +function usage() +{ + echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" + RETVAL="2" +} + +# See how we were called. +RETVAL="0" +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + reload) + RETVAL="3" + ;; + force-reload) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + status) + status + ;; + version) + version +# ${TOMCAT_SCRIPT} version + ;; + *) + usage + ;; +esac + +exit $RETVAL diff --git a/SOURCES/scl-tomcat-systemd.service b/SOURCES/scl-tomcat-systemd.service new file mode 100644 index 0000000..f3b359e --- /dev/null +++ b/SOURCES/scl-tomcat-systemd.service @@ -0,0 +1,21 @@ +# Thermostat tomcat systemd service file for RHEL 7.0. +# +# Please start tomcat via "service tomcat@thermostat start" or +# "systemctl start tomcat@thermostat" instead if you are using +# RHEL-7.1. +[Unit] +Description=Apache Tomcat for Thermostat Container +After=syslog.target network.target + +[Service] +Type=forking +# Provides the SERVICE_NAME to tomcat-sysd +EnvironmentFile=__service_file_path__/__service_file_name__ +ExecStart=/usr/sbin/tomcat-sysd start +ExecStop=/usr/sbin/tomcat-sysd stop +SuccessExitStatus=143 +User=tomcat +Group=tomcat + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/thermostat-sysconfig b/SOURCES/thermostat-sysconfig new file mode 100644 index 0000000..ee30193 --- /dev/null +++ b/SOURCES/thermostat-sysconfig @@ -0,0 +1,13 @@ +# This file is "sourced" for systemd services only +# +# If thermostat {storage,agent} is run via systemd, +# data directories are in __thermostat_home__ +# +# Do not change this unless you know what you are doing +THERMOSTAT_HOME=__thermostat_home__ +USER_THERMOSTAT_HOME=__thermostat_user_home__ + +# any value for this env value will do +THERMOSTAT_SYSTEM_USER=true + +RH_THERMOSTAT16_SCLS_ENABLED="rh-thermostat16 rh-mongodb32" diff --git a/SPECS/thermostat.spec b/SPECS/thermostat.spec new file mode 100644 index 0000000..d5b6c8f --- /dev/null +++ b/SPECS/thermostat.spec @@ -0,0 +1,1243 @@ +# Do not repack jars +%global __jar_repack 0 + +# Upstream Thermostat version triplet +%global major 1 +%global minor 6 +%global patchlevel 4 + +# non_bootstrap_build == 1 means add self-BR so that +# xmvn-subst symlinks correctly +%global non_bootstrap_build 1 + +%if 0%{?rhel} + +%if 0%{?rhel} <= 6 + %global is_rhel_6 1 + %global with_systemd 0 + %global custom_release 60 + %global tomcat_name tomcat6 +%else + %global is_rhel_6 0 + %global with_systemd 1 + %global custom_release 70 + %global tomcat_name tomcat +%endif + +%else + +%global is_rhel_6 0 +%global with_systemd 1 +%global custom_release 1 + +%endif + +# Thermostat requires exact versions for bundle dependencies. +# We use those versions to pass to the maven build in order for +# it to set it in relevant files. + +%if 0%{?fedora} >= 22 + + ######################################### + # Fedora 23 and up + ######################################### + + # Real OSGi Bundle-Version is 3.9.3.Final + %global netty_bundle_version 3.9.3 + %global jcommon_bundle_version 1.0.23 + %global jfreechart_bundle_version 1.0.19 + # apache-commons-beanutils + %global beanutils_bundle_version 1.9.2 + # apache-commons-codec + %global codec_bundle_version 1.10.0 + # apache-commons-collections + %global collections_bundle_version 3.2.2 + # apache-commons-logging + %global logging_bundle_version 1.2.0 + %global hc_core_bundle_version 4.4.5 + %global hc_client_bundle_version 4.5.2 + %global gson_bundle_version 2.3.1 + %global mongo_bundle_version 3.2.1 + %global lucene_analysis_core_bsn org.apache.lucene.analyzers-common + %global lucene_version 5.5.0 + # The javax.servlet bundle version used by the + # endpoint plugin: a.k.a web-storage-service + %global javax_servlet_bundle_version 3.1.0 + %global javax_servlet_bsn javax.servlet-api + %global jgraphx_bundle_version 3.5.0 + %global jetty_version 9.4.0 + +%else + + ######################################### + # EL 6 + 7 + ######################################### + # Real OSGi Bundle-Version is 3.6.3.Final + %global netty_bundle_version 3.6.3 + %global jcommon_bundle_version 1.0.18 + %global jfreechart_bundle_version 1.0.14 + # apache-commons-beanutils + %global beanutils_bundle_version 1.8.3 + # apache-commons-codec + %global codec_bundle_version 1.8.0 + # apache-commons-collections + %global collections_bundle_version 3.2.1 + # apache-commons-logging + %global logging_bundle_version 1.1.2 + %global hc_core_bundle_version 4.3.3 + %global hc_client_bundle_version 4.3.6 + %global gson_bundle_version 2.2.2 + %global mongo_bundle_version 3.2.1 + %global lucene_analysis_core_bsn org.apache.lucene.analyzers-common + %global lucene_version 5.4.1 + # The javax.servlet bundle version used by the + # endpoint plugin: a.k.a web-storage-service + # Comming from rh-java-common-tomcat-servlet-XXX-api + # package. + %global javax_servlet_bundle_version 3.0.0 + %global javax_servlet_bsn javax.servlet + %global jgraphx_bundle_version 3.1.2 + %global jetty_version 9.0.3.v20130506 + +%endif + +# Jansi is used as bootstrap bundle and the +# bootstrap bundle properties file refers to the jar +# with version suffix. See 0001_shared_fix_bundle_loading.patch +%global jansi_version 1.11 + + +# Base path to the JDK which will be used in boot scripts +%if 0%{?fedora} >= 22 + %global jdk_base /etc/alternatives/java_sdk_openjdk +%else + %if 0%{?is_rhel_6} + %global jdk_base /usr/lib/jvm/java-1.7.0-openjdk.x86_64 + %else + %global jdk_base /usr/lib/jvm/java-1.7.0-openjdk + %endif +%endif + +%{?scl:%scl_package thermostat} +%{!?scl:%global pkg_name %{name}} + +# Global directory definitions +# _root_ don't seem to be defined in non-SCL context. +# Define some vars we use instead in order for the build to work +# for SCL/non-SCL contexts. +%{?scl: + %global system_confdir %{_root_sysconfdir} + %global system_root_datadir %{_root_datadir} + %global system_tmpfilesdir %{_root_exec_prefix}/lib/tmpfiles.d + %global system_datadir %{_root_localstatedir}/lib/%{name} + %global system_cachedir %{_root_localstatedir}/cache/%{name} + %global system_logdir %{_root_localstatedir}/log/%{name} + %global system_statedir %{_root_localstatedir}/run/%{name} + %global system_sbindir %{_root_sbindir} + +# directories for system user for storage as a systemd service + %global user_datadir %{_localstatedir}/lib + %global user_cachedir %{_localstatedir}/cache + %global user_logdir %{_localstatedir}/log + %global user_statedir %{_localstatedir}/run +%if 0%{?is_rhel_6} + %global system_initrddir %{_root_sysconfdir}/rc.d/init.d/ +%endif +} +# not SCL +%{!?scl: + %global system_confdir %{_sysconfdir} + %global system_root_datadir %{_datadir} + %global system_tmpfilesdir %{_tmpfilesdir} + %global system_datadir %{_localstatedir}/lib/%{name} + %global system_cachedir %{_localstatedir}/cache/%{name} + %global system_logdir %{_localstatedir}/log/%{name} + %global system_statedir %{_localstatedir}/run/%{name} +} + +# Some Maven coordinates mismatch due to compat versioning. +%{!?scl: +%global object_web_asm_maven_coords org.ow2.asm:asm-all +%global lucene_core_coords org.apache.lucene:lucene-core +%global lucene_analyzers_coords org.apache.lucene:lucene-analyzers +%global netty_maven_coords io.netty:netty:%{netty_bundle_version} +} +%{?scl: +# objectweb-asm is objectweb-asm5 in SCL +%global object_web_asm_maven_coords org.ow2.asm:asm-all:5 +# netty coordinates are org.jboss.netty:netty in SCL +%global netty_maven_coords org.jboss.netty:netty +%global lucene_core_coords org.apache.lucene:lucene-core:5 +%global lucene_analyzers_coords org.apache.lucene:lucene-analyzers:5 +} + + +# THERMOSTAT_HOME and USER_THERMOSTAT_HOME variables. Note that +# we use USER_THERMOSTAT_HOME only for systemd related setup. +%global thermostat_home %{_datarootdir}/%{pkg_name} +%{?scl: +# /opt/rh/rh-thermostat16/root + %global user_thermostat_home %{_scl_root} +} +# not SCL +%{!?scl: + # Prefix is "/" for non-scl + %global user_thermostat_home / +} + +# thermostat-webapp specific variables +%{?scl: + %global thermostat_catalina_base %{_datarootdir}/tomcat +} +# not SCL +%{!?scl: + %global thermostat_catalina_base %{_localstatedir}/lib/tomcats/%{pkg_name} +} +%global system_catalina_home %{system_root_datadir}/%{tomcat_name} +# The port tomcat will be listening on +%global thermostat_catalina_port 8999 +%global thermostat_tomcat_service_name %{?scl_prefix}%{pkg_name}-tomcat + +# Don't generate native library provides for JNI libs. Those aren't +# SCL-ized and might conflict with base RHEL. See RHBZ#1045552 +%{?scl: + %if 0%{?is_rhel_6} + %filter_from_provides /lib.*\.so(.*)$/d + %filter_setup + %else + %global __provides_exclude_from ^%{_libdir}/thermostat/.*|%{thermostat_home}/libs/native/.*$ + %endif +} + +%if 0%{?rhel} + # Use java common's requires/provides generator + %{?java_common_find_provides_and_requires} +%endif + +# Uncomment to build from snapshot out of hg. See also Release and Source0 +#%%global hgrev b7c6db90e034 + +Name: %{?scl_prefix}thermostat +Version: %{major}.%{minor}.%{patchlevel} +# If building from snapshot out of hg, uncomment and adjust below value as appropriate +#Release: 0.1.20131122hg%{hgrev}%{?dist} +Release: %{custom_release}.5%{?dist} +Summary: A monitoring and serviceability tool for OpenJDK +License: GPLv2+ with exceptions and OFL +URL: http://icedtea.classpath.org/thermostat/ +# This is the source URL to be used for released versions +Source0: http://icedtea.classpath.org/download/%{pkg_name}/%{pkg_name}-%{version}.tar.gz +# This is the source to be used for hg snapshot versions from HEAD +#wget -O thermostat-%{hgrev}.tar.bz2 http://icedtea.classpath.org/hg/%{pkg_name}/archive/%{hgrev}.tar.bz2 +#Source0: thermostat-%{hgrev}.tar.bz2 +# This is the source to be used for hg snapshot versions from a release branch +#wget -O thermostat-%{major}.%{minor}-%{hgrev}.tar.bz2 http://icedtea.classpath.org/hg/release/%{pkg_name}-%{major}.${minor}/archive/%{hgrev}.tar.bz2 +#Source0: thermostat-%{major}.%{minor}-%{hgrev}.tar.bz2 +# This is _NOT_ suitable for upstream at this point. +# It's very Fedora/SCL specific. +Source1: thermostat-sysconfig +Source3: scl-thermostat-tomcat-service-sysconfig +Source4: fedora-thermostatrc +Source5: scl-tomcat-initd.sh +Source6: scl-tomcat-systemd.service + +# This is _NOT_ suitable for upstream at this point. +# jfreechart isn't a bundle upstream. Also some httpclient* related bundles +# include transitive deps upstream, which isn't the case in Fedora (i.e. is +# properly done in Fedora) +Patch1: 0001_shared_fix_bundle_loading.patch +# Patch proposed upstream, but was denied. +# See http://icedtea.classpath.org/pipermail/thermostat/2013-October/008602.html +# For now _NOT_ suitable for upstream until felix ships an API only package which +# is 4.3 OSGi spec. +Patch2: 0002_shared_osgi_spec_fixes.patch + +# This patch is in upstream and should be removed once the thermostat package +# in the collection is updated to the latest release. The changeset can be +# found at: +# http://icedtea.classpath.org/hg/release/thermostat-1.6/rev/7a1c62f9337b +# This resolves RHBZ#1329003 +Patch3: 0003_storage_init_fix.patch + +# This patch is in upstream and should be removed once the thermostat package +# in the collection is updated to the latest release. The changeset can be +# found at: +# http://icedtea.classpath.org/hg/release/thermostat-1.6/rev/a26429779377 +# This resolves RHBZ#1388898 +Patch4: 0004_verify_token_removal_fix.patch + +%if 0%{?non_bootstrap_build} +# Work-around xmvn-subst limitation +BuildRequires: %{?scl_prefix}thermostat-webapp = %{version} +%endif + +# RHEL 6 does not have virtual provides java-devel >= 1.7 +%if 0%{?is_rhel_6} +BuildRequires: java-1.7.0-openjdk-devel +%else +BuildRequires: java-devel >= 1:1.7.0 +%endif +BuildRequires: %{?scl_prefix_java_common}javapackages-tools +BuildRequires: %{?scl_prefix_maven}maven-local +BuildRequires: %{?scl_prefix_maven}maven-dependency-plugin +BuildRequires: %{?scl_prefix_maven}maven-shade-plugin +BuildRequires: %{?scl_prefix_maven}maven-surefire-plugin +BuildRequires: %{?scl_prefix_maven}maven-war-plugin +BuildRequires: %{?scl_prefix_maven}maven-clean-plugin +BuildRequires: %{?scl_prefix_maven}maven-assembly-plugin +BuildRequires: %{?scl_prefix_maven}maven-plugin-bundle +BuildRequires: %{?scl_prefix_maven}maven-javadoc-plugin +BuildRequires: %{?scl_prefix_maven}maven-antrun-plugin +# Archetype maven plugins not available in SCL +%{!?scl: +BuildRequires: %{?scl_prefix_maven}maven-archetype-packaging +BuildRequires: %{?scl_prefix_maven}mvn(org.apache.maven.plugins:maven-archetype-plugin) +} +%if 0%{?is_rhel_6} +BuildRequires: gnome-keyring-devel +%else +# Use libsecret on Fedora +%{!?scl: +BuildRequires: libsecret-devel +} +%{?scl: +BuildRequires: libgnome-keyring-devel +} +%endif +# Keyring JNI uses autotools +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +# laf-utils JNI need pkconfig files for gtk2+ +BuildRequires: gtk2-devel +BuildRequires: %{?scl_prefix_java_common}mvn(org.apache.felix:org.apache.felix.framework) +BuildRequires: %{?scl_prefix_maven}mvn(org.fusesource:fusesource-pom:pom:) +BuildRequires: %{?scl_prefix_java_common}mvn(org.apache.commons:commons-cli) +BuildRequires: %{?scl_prefix}mvn(jline:jline) +BuildRequires: %{?scl_prefix_java_common}mvn(org.fusesource.jansi:jansi) +BuildRequires: %{?scl_prefix_java_common}mvn(%{lucene_core_coords}) +BuildRequires: %{?scl_prefix_java_common}mvn(%{lucene_analyzers_coords}) +BuildRequires: %{?scl_prefix_java_common}mvn(com.google.code.gson:gson) +BuildRequires: %{?scl_prefix}mvn(org.jfree:jfreechart) +BuildRequires: %{?scl_prefix}mvn(org.jfree:jcommon) +BuildRequires: %{?scl_prefix_java_common}mvn(org.apache.commons:commons-beanutils) +BuildRequires: %{?scl_prefix_mongodb}mvn(org.mongodb:mongo-java-driver) +# Change to netty 4 once RHBZ#1053619 is +# resolved. +# The version number in mvn() means it's a compat package. +BuildRequires: %{?scl_prefix}mvn(%{netty_maven_coords}) + +# BRs for webapp sub-package +BuildRequires: %{?tomcat_name} + +BuildRequires: %{?scl_prefix_java_common}mvn(javax.servlet:servlet-api) >= 2.5 +BuildRequires: %{?scl_prefix_java_common}mvn(commons-fileupload:commons-fileupload) + +# thermostat web-storage-service BRs +BuildRequires: %{?scl_prefix_java_common}mvn(org.eclipse.jetty:jetty-server) +BuildRequires: %{?scl_prefix_java_common}mvn(org.eclipse.jetty:jetty-jaas) +BuildRequires: %{?scl_prefix_java_common}mvn(org.eclipse.jetty:jetty-webapp) +# FIXME: jetty-schemas not available in SCLs +%if 0%{?fedora} +BuildRequires: mvn(org.eclipse.jetty.toolchain:jetty-schemas) +%endif + +################################################### +# The following BRs are specified via osgi's +# symbolic name. This is to ensure exact versions +# as specified in thermostat's bundle list has +# a chance of working at runtime. +################################################### +# 1.0.14-7 has OSGi metadata and itext dep fix +BuildRequires: %{?scl_prefix}osgi(org.jfree.jfreechart) = %{jfreechart_bundle_version} +# 1.0.17-4 has OSGi metadata +BuildRequires: %{?scl_prefix}osgi(org.jfree.jcommon) = %{jcommon_bundle_version} +BuildRequires: %{?scl_prefix_java_common}osgi(org.apache.commons.logging) = %{logging_bundle_version} +BuildRequires: %{?scl_prefix_java_common}osgi(org.apache.commons.beanutils) = %{beanutils_bundle_version} +BuildRequires: %{?scl_prefix_java_common}osgi(org.apache.commons.codec) = %{codec_bundle_version} +BuildRequires: %{?scl_prefix_mongodb}osgi(org.mongodb.mongo-java-driver) = %{mongo_bundle_version} +# Netty osgi provides are not there in SCL +%{!?scl: +BuildRequires: %{?scl_prefix}osgi(org.jboss.netty) = %{netty_bundle_version} +} +BuildRequires: %{?scl_prefix_java_common}osgi(com.google.gson) = %{gson_bundle_version} +BuildRequires: %{?scl_prefix_java_common}osgi(org.apache.httpcomponents.httpcore) = %{hc_core_bundle_version} +# httpmime comes from httpcomponents-client just like httpclient itself +BuildRequires: %{?scl_prefix_java_common}osgi(org.apache.httpcomponents.httpclient) = %{hc_client_bundle_version} +BuildRequires: %{?scl_prefix_java_common}osgi(org.apache.httpcomponents.httpmime) = %{hc_client_bundle_version} +# The thread plugin needs this for visualizing thread deadlocks +BuildRequires: %{?scl_prefix}osgi(com.mxgraph) = %{jgraphx_bundle_version} +# The web endpoint plugin gets this bundle baked into the bundles list. +BuildRequires: %{?scl_prefix_java_common}osgi(%{javax_servlet_bsn}) = %{javax_servlet_bundle_version} +BuildRequires: %{?scl_prefix_java_common}mvn(%{object_web_asm_maven_coords}) >= 5 + +%{?!scl: +Requires: javapackages-tools +Requires: java-devel >= 1:1.8.0 +} +%{?scl: +Requires: %{?scl_prefix}runtime +Requires: java-1.7.0-openjdk-devel +} +# Only require mongodb-server on arches where it's available +%ifarch %{arm} %{ix86} x86_64 +Requires: %{?scl_prefix_mongodb}mongodb-server +# Fedora's thermostat-setup uses mongo directly +Requires: %{?scl_prefix_mongodb}mongodb +%endif +%if 0%{?is_rhel_6} +Requires: gnome-keyring +%else +# Use libsecret on Fedora +%{?!scl: +Requires: libsecret +} +%{?scl: +Requires: libgnome-keyring +} +%endif +%if 0%{?is_rhel_6} +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +%else +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%endif +# Sanity requires for needed OSGi bundles. +Requires: %{?scl_prefix}osgi(org.jfree.jfreechart) >= %{jfreechart_bundle_version} +Requires: %{?scl_prefix}osgi(org.jfree.jcommon) >= %{jcommon_bundle_version} +Requires: %{?scl_prefix_java_common}osgi(org.apache.commons.logging) >= %{logging_bundle_version} +Requires: %{?scl_prefix_java_common}osgi(org.apache.commons.beanutils) >= %{beanutils_bundle_version} +Requires: %{?scl_prefix_java_common}osgi(org.apache.commons.codec) >= %{codec_bundle_version} +# FIXME: switch back to mongodb prefix once 2.13.2 is available in +# the mongodb collection. +Requires: %{?scl_prefix_mongodb}osgi(org.mongodb.mongo-java-driver) >= %{mongo_bundle_version} +# Netty osgi provides is not there in SCL +%{!?scl: +Requires: %{?scl_prefix}osgi(org.jboss.netty) = %{netty_bundle_version} +} +Requires: %{?scl_prefix_java_common}osgi(com.google.gson) >= %{gson_bundle_version} +Requires: %{?scl_prefix_java_common}osgi(org.apache.httpcomponents.httpcore) >= %{hc_core_bundle_version} +# httpmime comes from httpcomponents-client just like httpclient itself +Requires: %{?scl_prefix_java_common}osgi(org.apache.httpcomponents.httpclient) >= %{hc_client_bundle_version} +Requires: %{?scl_prefix_java_common}osgi(org.apache.httpcomponents.httpmime) >= %{hc_client_bundle_version} + +%description +Thermostat is a monitoring and instrumentation tool for the Hotspot JVM, +with support for monitoring multiple JVM instances. The system is made +up of two processes: an Agent, which collects data, and a Client which +allows users to visualize this data. These components communicate via +a MongoDB-based storage layer. A pluggable agent and gui framework +allows for collection and visualization of performance data beyond that +which is included out of the box. + +%package javadoc +Summary: Javadocs for %{pkg_name} +Group: Documentation +%{!?scl: +Requires: javapackages-tools +} + +BuildArch: noarch + +%description javadoc +This package contains the API documentation for %{pkg_name} + +%package webapp +Summary: Web storage endpoint for Thermostat +BuildArch: noarch +%if 0%{?is_rhel_6} +Requires: %{tomcat_name} +%else +Requires: %{tomcat_name} >= 7.0.54 +%endif +Requires: %{name} = %{version}-%{release} +Requires: %{?scl_prefix_java_common}apache-commons-fileupload + +%description webapp +This package contains the exploded web archive. This web application +contains the server-side parts for deploying thermostat with improved +security. + +%prep +%{?scl:scl enable %{scl_maven} %{scl_java_common} %{scl_mongodb} %{scl} - << "EOF"} +# When Source0 is released version. +%setup -q -n %{pkg_name}-%{version} +# When Source0 is a snapshot from HEAD. +#%%setup -q -n %%{pkg_name}-%%{hgrev} +# When Source 0 is a snapshot from a release branch. +#%%setup -q -n %%{pkg_name}-%%{major}-%%{minor}-%%{hgrev} +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + +# Fix up artifact names which have different name upstream +# lucene +%pom_remove_dep "org.apache.servicemix.bundles:org.apache.servicemix.bundles.lucene" vm-heap-analysis/common +%pom_remove_dep "org.apache.servicemix.bundles:org.apache.servicemix.bundles.lucene" vm-heap-analysis/distribution +%pom_remove_dep "org.apache.servicemix.bundles:org.apache.servicemix.bundles.lucene-analyzers-common" vm-heap-analysis/common +%pom_remove_dep "org.apache.servicemix.bundles:org.apache.servicemix.bundles.lucene-analyzers-common" vm-heap-analysis/distribution +%pom_add_dep "org.apache.lucene:lucene-analyzers:%{lucene_version}" vm-heap-analysis/common +%pom_add_dep "org.apache.lucene:lucene-analyzers:%{lucene_version}" vm-heap-analysis/distribution +%pom_add_dep "org.apache.lucene:lucene-core:%{lucene_version}" vm-heap-analysis/common +%pom_add_dep "org.apache.lucene:lucene-core:%{lucene_version}" vm-heap-analysis/distribution +# Fix up artifact names for jgraphx +%pom_remove_dep "org.tinyjee.jgraphx:jgraphx" +%pom_add_dep "com.mxgraph:jgraphx:3.1.2.0" +%pom_remove_dep "org.tinyjee.jgraphx:jgraphx" thread/client-swing +%pom_add_dep "com.mxgraph:jgraphx:3.1.2.0" thread/client-swing +# httpclient +%pom_remove_dep org.apache.httpcomponents:httpclient-osgi web/client +%pom_add_dep org.apache.httpcomponents:httpclient:4.4.0 web/client +%pom_remove_dep org.apache.httpcomponents:httpclient-osgi client/command +%pom_add_dep org.apache.httpcomponents:httpclient:4.4.0 client/command +# add httpmime dep. this is included in upstreams' strange jar +%pom_add_dep org.apache.httpcomponents:httpmime:4.4.0 web/client +# httpcore +%pom_remove_dep org.apache.httpcomponents:httpcore-osgi web/client +%pom_add_dep org.apache.httpcomponents:httpcore:4.4.0 web/client +# need jline 2.13 (otherwise this resolves to jline 1) +%pom_xpath_remove "pom:properties/pom:jline.version" +%pom_xpath_inject "pom:properties" "2.13" +# netty +#%%pom_remove_dep org.jboss.netty:netty +%pom_remove_dep org.jboss.netty:netty common/command +%pom_remove_dep org.jboss.netty:netty client/command +%pom_remove_dep org.jboss.netty:netty agent/command +%pom_add_dep io.netty:netty:%{netty_bundle_version} common/command +%pom_add_dep io.netty:netty:%{netty_bundle_version} client/command +%pom_add_dep io.netty:netty:%{netty_bundle_version} agent/command + +# Don't use maven-exec-plugin. We do things manually in order to avoid this +# additional dep. It's used in agent/core/pom.xml et.al. +%pom_remove_plugin org.codehaus.mojo:exec-maven-plugin agent/core +%pom_remove_plugin org.codehaus.mojo:exec-maven-plugin keyring +%pom_remove_plugin org.codehaus.mojo:exec-maven-plugin laf-utils + +# Remove license plugin in main pom.xml +%pom_remove_plugin com.mycila:license-maven-plugin + +# Remove javacoco-coverage plugin (in main pom.xml and web/war/pom.xml) +%pom_remove_plugin org.jacoco:jacoco-maven-plugin +%pom_remove_plugin org.jacoco:jacoco-maven-plugin web/war + +# Remove pmd plugin +%pom_remove_plugin org.apache.maven.plugins:maven-pmd-plugin + +# Remove m2e's lifecyle plugin +%pom_remove_plugin org.eclipse.m2e:lifecycle-mapping + +# Disable test modules +%pom_disable_module test common +%pom_disable_module integration-tests +%pom_disable_module testutils storage +%pom_remove_dep com.redhat.thermostat:thermostat-storage-testutils vm-cpu/common +%pom_remove_dep com.redhat.thermostat:thermostat-storage-testutils vm-profiler/common +%pom_remove_dep com.redhat.thermostat:thermostat-storage-testutils thread/collector +# Disable some dev modules we don't ship +%pom_disable_module ide-launcher dev +%pom_disable_module schema-info-command dev +%pom_disable_module perflog-analyzer dev +# SCL would need maven archetype packaging plugin for this to work. For now package in +# Fedora only. +%{?scl: +%pom_disable_module archetype-ext dev +%pom_disable_module multi-module-plugin-archetype dev +} +%pom_remove_dep com.redhat.thermostat:thermostat-schema-info-distribution distribution + +# Remove system scope and systempath from tools jar dependency. +%pom_xpath_remove -r "pom:dependencies/pom:dependency[pom:groupId='com.sun']/pom:scope" +%pom_xpath_remove -r "pom:dependencies/pom:dependency[pom:groupId='com.sun']/pom:systemPath" + +# Remove depencency on the web archive for web-storage-service we'll make deps +# available manually +%pom_remove_dep "com.redhat.thermostat:thermostat-web-war" web/endpoint-plugin/web-service + +# jetty-schemas is not available in SCLs +%{?scl: +%pom_remove_dep org.eclipse.jetty.toolchain:jetty-schemas web/endpoint-plugin/distribution +} +# Skip automatic installation of zip artifacts. We only use it for our build +# to assemble plug-ins. +%mvn_package com.redhat.thermostat::zip: __noinstall +# Skip automatic installation of the war module. +# We install it manually. Without this "config" %mvn_build -f +# fails. See RHBZ#963838 +%mvn_package com.redhat.thermostat:thermostat-web-war __noinstall +# Don't install :thermostat-common-test, it's a test only dep which +# isn't run during the build. +%mvn_package com.redhat.thermostat:thermostat-common-test __noinstall + +# These are just upstream build helpers. Don't install them. +%mvn_package com.redhat.thermostat:thermostat-distribution __noinstall +%mvn_package com.redhat.thermostat:thermostat-assembly __noinstall + +# thermostat-web-server and thermostat-web-endpoint should be part of +# the webapp sub-package +%mvn_package com.redhat.thermostat:thermostat-web-server webapp +%mvn_package "com.redhat.thermostat:thermostat-web-endpoint-plugin" webapp +%mvn_package "com.redhat.thermostat:thermostat-web-endpoint:pom:" webapp +%mvn_package "com.redhat.thermostat:thermostat-web-endpoint-distribution:pom:" webapp +# Do not embed jgraphx dependency in thread client. +%pom_xpath_remove "pom:project/pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-bundle-plugin']/pom:configuration/pom:instructions/pom:Embed-Dependency" thread/client-swing +%{?scl:EOF} + +%build +%{?scl:scl enable %{scl_maven} %{scl_java_common} %{scl_mongodb} %{scl} - << "EOF"} +export CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" +# Set JAVA_HOME. make uses this +. /usr/share/java-utils/java-functions +set_jvm +export JAVA_HOME + +################## Build JNI bits ######################## +# JNI bits depend on NativeLibraryResolver so compile that +# first and relevant Java classes with native methods +# after. +pushd annotations + mkdir -p target/classes + javac -d target/classes \ + src/main/java/com/redhat/thermostat/annotations/Service.java +popd +pushd config + mkdir -p target/classes + javac -d target/classes \ + -cp ../annotations/target/classes \ + src/main/java/com/redhat/thermostat/shared/config/NativeLibraryResolver.java \ + src/main/java/com/redhat/thermostat/shared/config/CommonPaths.java \ + src/main/java/com/redhat/thermostat/shared/config/internal/CommonPathsImpl.java \ + src/main/java/com/redhat/thermostat/shared/config/InvalidConfigurationException.java \ + src/main/java/com/redhat/thermostat/shared/locale/Translate.java \ + src/main/java/com/redhat/thermostat/shared/locale/LocalizedString.java \ + src/main/java/com/redhat/thermostat/shared/locale/internal/LocaleResources.java +popd +pushd keyring + mkdir -p target/classes + javac -cp ../config/target/classes:../annotations/target/classes \ + -d target/classes \ + src/main/java/com/redhat/thermostat/utils/keyring/Keyring.java \ + src/main/java/com/redhat/thermostat/utils/keyring/KeyringException.java \ + src/main/java/com/redhat/thermostat/utils/keyring/impl/KeyringImpl.java + autoreconf --install + ./configure + make all +popd +pushd agent/core + mkdir -p target/classes + javac -cp ../../config/target/classes:../../annotations/target/classes \ + -d target/classes \ + src/main/java/com/redhat/thermostat/agent/utils/hostname/HostName.java \ + src/main/java/com/redhat/thermostat/agent/utils/username/UserNameUtil.java \ + src/main/java/com/redhat/thermostat/agent/utils/username/UserNameLookupException.java \ + src/main/java/com/redhat/thermostat/utils/username/internal/UserNameUtilImpl.java + make all +popd +pushd laf-utils + mkdir -p target/classes + javac -cp ../config/target/classes \ + -d target/classes src/main/java/com/redhat/thermostat/internal/utils/laf/gtk/GTKThemeUtils.java + make all +popd +################## Build JNI bits (end) ################## + +# This is roughly equivalent to: +# mvn +# -Dthermostat.home=... \ +# install javadoc:aggregate +# Everything after '--' is passed to plain xmvn/mvn +%mvn_build -f -- -Dthermostat.home=%{thermostat_home} \ + -Dthermostat.system.user=thermostat \ + -Dthermostat.system.group=thermostat \ + -Dnetty.version=%{netty_bundle_version}.Final \ + -Dcommons-logging.version=%{logging_bundle_version} \ + -Dcommons-collections.version=%{collections_bundle_version} \ + -Dcommons-codec.osgi-version=%{codec_bundle_version} \ + -Dcommons-beanutils.version=%{beanutils_bundle_version} \ + -Dgson.version=%{gson_bundle_version} \ + -Dmongo-driver.osgi-version=%{mongo_bundle_version} \ + -Dhttpcomponents.core.version=%{hc_core_bundle_version} \ + -Dhttpcomponents.client.version=%{hc_client_bundle_version} \ + -Dhttpcomponents.mime.version=%{hc_client_bundle_version} \ + -Djansi.version=%{jansi_version} \ + -Djcommon.osgi.version=%{jcommon_bundle_version} \ + -Djfreechart.osgi.version=%{jfreechart_bundle_version} \ + -Dlucene-core.bundle.symbolic-name=org.apache.lucene.core \ + -Dlucene-analysis.bundle.symbolic-name=%{lucene_analysis_core_bsn} \ + -Dlucene.osgi-version=%{lucene_version} \ + -Dosgi.compendium.bundle.symbolic-name=org.osgi.compendium \ + -Dosgi.compendium.osgi-version=4.1.0 \ + -Djgraphx.osgi.version=%{jgraphx_bundle_version} \ + -Djetty.javax.servlet.osgi.version=%{javax_servlet_bundle_version} \ + -Djavax.servlet.bsn=%{javax_servlet_bsn} \ + -Djetty.version=%{jetty_version} + +# Make path to java so that it keeps working after updates. +# We require java >= 1.7.0 +sed -i 's|^JAVA=.*|JAVA="%{jdk_base}/bin/java"|' distribution/target/image/bin/thermostat-agent-proxy +sed -i 's|^JAVA=.*|JAVA="%{jdk_base}/bin/java"|' distribution/target/image/bin/thermostat-webservice +sed -i 's|^JAVA=.*|JAVA="%{jdk_base}/bin/java"|' distribution/target/image/bin/thermostat-command-channel +sed -i 's|^JAVA=.*|JAVA="%{jdk_base}/bin/java"|' distribution/target/image/bin/thermostat +# Fix path to tools.jar, replace system thermostatrc +sed 's|__TOOLS_PATH__|%{jdk_base}/lib/tools.jar|' %{SOURCE4} > distribution/target/image/etc/thermostatrc +sed -i 's|^TOOLS_JAR=.*|TOOLS_JAR="%{jdk_base}/lib/tools.jar"|' distribution/target/image/bin/thermostat-agent-proxy +sed -i 's|^TOOLS_JAR=.*|TOOLS_JAR="%{jdk_base}/lib/tools.jar"|' distribution/target/image/bin/thermostat-command-channel +sed -i 's|^TOOLS_JAR=.*|TOOLS_JAR="%{jdk_base}/lib/tools.jar"|' distribution/target/image/bin/thermostat +%{?scl:EOF} + + +%install +%{?scl:scl enable %{scl_maven} %{scl_java_common} %{scl_mongodb} %{scl} - << "EOF"} +####################################################### +# Thermostat core +####################################################### +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_sysconfdir}/%{pkg_name} +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +mkdir -p %{buildroot}%{system_confdir}/sysconfig +# JNI things live there +mkdir -p %{buildroot}%{_libdir}/%{pkg_name} +mkdir -p %{buildroot}%{_jnidir} +# Systemd/initrd files live there +%if 0%{?is_rhel_6} +mkdir -p %{buildroot}%{system_initrddir} +%else +mkdir -p %{buildroot}%{_unitdir} +%endif +# Thermostat icon lives there +mkdir -p %{buildroot}%{_datarootdir}/icons/hicolor/scalable/apps +# Thermostat desktop lives there +mkdir -p %{buildroot}%{_datarootdir}/applications +# Example config files are in docdir +mkdir -p %{buildroot}%{_docdir}/%{pkg_name} +# Man page +mkdir -p %{buildroot}%{_mandir}/man1 + +# Dance the xmvn install limbo. This only makes sense if %mvn_build does NOT +# have the '-i' switch. +%mvn_install + +pushd distribution/target/image/libs +# JNI jars need to be in %{_jnidir}, we symlink to +# %{_libdir}/%{pkg_name} files. Files are moved to +# %{_libdir}/%{pkg_name} next. +for i in thermostat-keyring-*.jar \ + thermostat-agent-core-*.jar \ + thermostat-laf-utils-*.jar; do + ln -s %{_libdir}/%{pkg_name}/$i %{buildroot}%{_jnidir}/$i +done +# JNI files are in %{_libdir} +mv thermostat-keyring-*.jar \ + thermostat-agent-core-*.jar \ + thermostat-laf-utils-*.jar \ + %{buildroot}%{_libdir}/%{pkg_name} +# Make native libs executable so that debuginfos get properly +# generated +chmod +x native/*.so +mv native/* %{buildroot}%{_libdir}/%{pkg_name} +popd + +# Install systemd unit/init script files for storage +%if 0%{?is_rhel_6} + # FIXME: No way to run thermostat storage via init.d script. +%else + pushd distribution/target/packaging/systemd + sed -i 's/User=thermostat/User=root/g' thermostat-agent.service + sed -i 's/Group=thermostat/Group=root/g' thermostat-agent.service + # FIXME: install or not-to-install agent service running as root? + # Currently: Don't install. + %{?scl: + sed -i 's#ExecStart=.*#ExecStart=/usr/bin/scl enable $RH_THERMOSTAT16_SCLS_ENABLED -- %{thermostat_home}/bin/thermostat storage --start#g' thermostat-storage.service + sed -i 's#ExecStop=.*#ExecStop=/usr/bin/scl enable $RH_THERMOSTAT16_SCLS_ENABLED -- %{thermostat_home}/bin/thermostat storage --stop#g' thermostat-storage.service + sed -i 's#EnvironmentFile=.*#EnvironmentFile=%{_sysconfdir}/sysconfig/%{name}#g' thermostat-storage.service + } + cp -a thermostat-storage.service %{buildroot}%{_unitdir}/%{?scl_prefix}%{pkg_name}-storage.service + popd +%endif + +# Install tmpfiles.d config file for /var/run/%{pkg_name} +mkdir -p %{buildroot}%{system_tmpfilesdir} +# Maintain rh-thermostat16-thermostat instead of thermostat +pushd distribution/target/packaging/systemd/tmpfiles.d + +sed -i 's#/var/run/thermostat#/var/run/rh-thermostat16-thermostat#g' %{pkg_name}.conf +install -m 0644 %{pkg_name}.conf %{buildroot}%{system_tmpfilesdir}/%{name}.conf + +popd + +# Install thermostat man page +install -m 0644 distribution/packaging/shared/man/%{pkg_name}.1 %{buildroot}%{_mandir}/man1/%{pkg_name}.1 + +# Install bash completions. Note those won't work on EL 6 unless somebody +# finds a bash-completion package somewhere (e.g. via EPEL) +# FIXME: Install it outside the SCL +# (i.e. /usr/share directly) since there does not seem to be support +# for it otherwise. +# See: https://bugzilla.redhat.com/show_bug.cgi?id=1264094 +mkdir -p %{buildroot}%{system_root_datadir}/bash-completion/completions +install -pm 644 distribution/target/packaging/bash-completion/thermostat-completion %{buildroot}%{system_root_datadir}/bash-completion/completions/%{name} + +rm -rf distribution/target/image/bin/%{pkg_name}.orig +# Remove developer setup things. +rm distribution/target/image/bin/thermostat-devsetup +rm distribution/target/image/etc/devsetup.input + +# We'll install webapp later, move it out of the way +mv distribution/target/image/webapp webstorage-webapp +# Move everything else into $THERMOSTAT_HOME +cp -a distribution/target/image %{buildroot}%{thermostat_home} + +# Replace jars with symlinks to installed libs +pushd %{buildroot}%{thermostat_home}/libs + xmvn-subst . +popd +# Do the same for thermostat plugin dirs +pushd %{buildroot}%{thermostat_home}/plugins +for plugin_name in $(ls); do + pushd $plugin_name + xmvn-subst . + popd +done +popd +# Remove duplicate tools*.jar files which makes the resulting +# RPM insanely large (21 * 20 MB) ~= 410 MB => ~90 to 100 MB compressed +find %{buildroot}%{thermostat_home} -name 'tools*.jar' | xargs rm +# Remove jzlib.jar/jzlib-any.jar which maven thinks we need but we don't +# actually need. +rm -rf %{buildroot}%{thermostat_home}/libs/jzlib*.jar + +pushd %{buildroot}%{_libdir}/%{pkg_name} +# symlink JNI jars +for i in *.jar; do + ln -s %{_libdir}/%{pkg_name}/$i \ + %{buildroot}%{thermostat_home}/libs/$i +done +# symlink shared libs +for i in *.so; do + ln -s %{_libdir}/%{pkg_name}/$i \ + %{buildroot}%{thermostat_home}/libs/native/$i +done +popd + +# Symlink the thermostat script(s) in /usr/bin +ln -s %{_datarootdir}/%{pkg_name}/bin/thermostat \ + %{buildroot}%{_bindir}/thermostat +ln -s %{_datarootdir}/%{pkg_name}/bin/thermostat-setup \ + %{buildroot}%{_bindir}/thermostat-setup + +# Move config files to /etc and symlink stuff under +# $THERMOSTAT_HOME/etc to it. Put example configs +# in docdir. +mv %{buildroot}%{thermostat_home}/etc/examples \ + %{buildroot}%{_docdir}/%{pkg_name}/ +mv %{buildroot}%{thermostat_home}/etc/* \ + %{buildroot}%{_sysconfdir}/%{pkg_name} +rmdir %{buildroot}%{thermostat_home}/etc +ln -s %{_sysconfdir}/%{pkg_name}/ \ + %{buildroot}%{thermostat_home}/etc + +# Install sysconfig file. This is so as to set various env vars +# which controls how thermostat behaves. In the systemd case we +# want thermostat to run as system user. +sed 's#__thermostat_home__#%{thermostat_home}/#g' %{SOURCE1} > thermostat_sysconfig.env +sed -i 's#__thermostat_user_home__#%{user_thermostat_home}/#g' thermostat_sysconfig.env +cp thermostat_sysconfig.env %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +# Set up directory structure for running thermostat storage/ +# thermostat agend via systemd +%{__install} -d -m 0775 %{buildroot}%{system_datadir} +# Create a setup-complete.stamp file so as to prevent the launcher hook from +# successfully running the thermostat1-thermostat-storage service. +echo "setup-complete.stamp for thermostat-storage systemd service" > %{buildroot}%{system_datadir}/setup-complete.stamp +%{__install} -d -m 0775 %{buildroot}%{system_cachedir} +%{__install} -d -m 0775 %{buildroot}%{system_logdir} +%{__install} -d -m 0775 %{buildroot}%{system_statedir} +# Symlink storage/agent directories so that they can be run +# as systemd services. The target directories will have +# appropriate permissions for the thermostat user to allow +# writing. +ln -s %{system_datadir} %{buildroot}%{thermostat_home}/data +ln -s %{system_statedir} %{buildroot}%{thermostat_home}/run +ln -s %{system_logdir} %{buildroot}%{thermostat_home}/logs +ln -s %{system_cachedir} %{buildroot}%{thermostat_home}/cache + +# Symlink system user folders as well for storage as a systemd service +%{?scl: + %{__install} -d -m 0775 %{buildroot}%{user_datadir} + %{__install} -d -m 0775 %{buildroot}%{user_statedir} + %{__install} -d -m 0775 %{buildroot}%{user_logdir} + %{__install} -d -m 0775 %{buildroot}%{user_cachedir} + + ln -s %{system_datadir} %{buildroot}%{user_datadir}/%{pkg_name} + ln -s %{system_statedir} %{buildroot}%{user_statedir}/%{pkg_name} + ln -s %{system_logdir} %{buildroot}%{user_logdir}/%{pkg_name} + ln -s %{system_cachedir} %{buildroot}%{user_cachedir}/%{pkg_name} +} +####################################################### +# Thermostat web storage webapp +####################################################### +mkdir -p %{buildroot}%{thermostat_catalina_base}/webapps +pushd webstorage-webapp +# Fixup THERMOSTAT_HOME in web.xml + sed -i '/THERMOSTAT_HOME<[/]param-name>/,/.*<[/]param-value>/{ s$.*$%{thermostat_home}$ }' \ + WEB-INF/web.xml +popd +cp -r webstorage-webapp %{buildroot}%{thermostat_catalina_base}/webapps/%{pkg_name} +# Provide a link to webapp in THERMOSTAT_HOME +ln -s %{thermostat_catalina_base}/webapps/%{pkg_name} %{buildroot}%{thermostat_home}/webapp + +# Replace jars with symlinks +pushd %{buildroot}%{thermostat_catalina_base}/webapps/%{pkg_name}/WEB-INF/lib + xmvn-subst . +popd + +# Remove tools.jar (coming from the JVM). We also don't need jzlib.jars. +# The latter jar might be a (broken?) symlink which makes web-storage-service fail. +rm -rf %{buildroot}%{thermostat_catalina_base}/webapps/%{pkg_name}/WEB-INF/lib/jzlib*.jar +rm -rf %{buildroot}%{thermostat_catalina_base}/webapps/%{pkg_name}/WEB-INF/lib/tools*.jar + +# We use a custom CATALINA_BASE with core tomcat directories +# symlinked. This allows us to deploy the thermostat webapp +# nicely configured without any configuration required prior +# starting tomcat via systemd. +sed 's#__catalina_base__#%{thermostat_catalina_base}#g' %{SOURCE3} > tomcat_service_thermostat.txt +sed -i 's#__catalina_home__#%{system_catalina_home}#g' tomcat_service_thermostat.txt +sed -i 's#__jaas_config__#%{_sysconfdir}/%{pkg_name}/%{pkg_name}_jaas.conf#g' tomcat_service_thermostat.txt +%{?scl: + # install the init script on RHEL 6 + %if 0%{?is_rhel_6} + sed 's#__service_name__#%{thermostat_tomcat_service_name}#g' %{SOURCE5} > tomcat_initd.sh + cp tomcat_initd.sh %{buildroot}%{system_initrddir}/%{thermostat_tomcat_service_name} + cp tomcat_service_thermostat.txt %{buildroot}%{system_confdir}/sysconfig/%{thermostat_tomcat_service_name} + %else + # RHEL 7 + +cat <systemd_tomcat_env_thermostat.txt +# This file is sourced via the thermostat tomcat systemd service. +SERVICE_NAME=%{thermostat_tomcat_service_name} +SYSTEMD_TOMCAT_ENV + + cp systemd_tomcat_env_thermostat.txt %{buildroot}%{system_confdir}/sysconfig/%{thermostat_tomcat_service_name} + # Install file twice, since RHEL 7.0 and RHEL 7.1 have different tomcat versions. + # The first file is used by thermostat1-thermostat-tomcat's service. The second one is + # used by "tomcat@thermostat". + cp tomcat_service_thermostat.txt %{buildroot}%{system_confdir}/sysconfig/%{thermostat_tomcat_service_name} + # systemd converts - in names to / in file paths: + mkdir -p %{buildroot}%{system_confdir}/sysconfig/tomcat@rh + cp tomcat_service_thermostat.txt %{buildroot}%{system_confdir}/sysconfig/tomcat@rh/thermostat16 + sed "s#__service_file_name__#%{thermostat_tomcat_service_name}#g" %{SOURCE6} > systemd_tomcat_thermostat.service + sed -i "s#__service_file_path__#%{system_confdir}/sysconfig#g" systemd_tomcat_thermostat.service + cp systemd_tomcat_thermostat.service %{buildroot}%{_unitdir}/%{thermostat_tomcat_service_name}.service + %endif +} +%{!?scl: + cp tomcat_service_thermostat.txt %{buildroot}%{system_confdir}/sysconfig/tomcat@%{pkg_name} +} +# Create a symlinked CATALINA_BASE in order to make tomcat deploy +# the scl-ized tomcat web-app. We use our own copy of conf/server.xml in order +# to not port-conflict with system tomcat. See RHBZ#1054396 +pushd %{buildroot}/%{thermostat_catalina_base} + for i in lib logs work temp; do + ln -s %{system_catalina_home}/$i $i + done + mkdir conf +popd +# Symlink everything other than server.xml +pushd %{system_catalina_home}/conf + for i in *; do + ln -s %{system_catalina_home}/conf/$i %{buildroot}/%{thermostat_catalina_base}/conf/$i + done + rm %{buildroot}/%{thermostat_catalina_base}/conf/server.xml + cp -p server.xml %{buildroot}/%{thermostat_catalina_base}/conf/server.xml +popd +pushd %{buildroot}/%{thermostat_catalina_base}/conf + # Fix the connector port, use a different access log file name + sed -i -e 's//dev/null || : +${__bin_dir}/useradd -c "Thermostat system user" -g thermostat \ + -s /sbin/nologin -r -d %{thermostat_home} thermostat 2>/dev/null || : + +%post +# Install but don't activate +%systemd_post %{?scl_prefix}%{pkg_name}-storage.service +# Required for icon cache (i.e. Thermostat icon) +/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : + +%post webapp +# install but don't activate +%if 0%{?is_rhel_6} + /sbin/chkconfig --add %{thermostat_tomcat_service_name} +%endif + +%preun +%systemd_preun %{?scl_prefix}%{pkg_name}-storage.service + +%postun +# Required for icon cache (i.e. Thermostat icon) +if [ $1 -eq 0 ] ; then + /bin/touch --no-create %{_datadir}/icons/hicolor &> /dev/null + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : +fi +%systemd_postun %{?scl_prefix}%{pkg_name}-storage.service + +%posttrans +# Required for icon cache (i.e. Thermostat icon) +/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : + +%files -f .mfiles +%doc LICENSE +# %license macro not available in RHEL 6 +%if 0%{?is_rhel_6} +%doc COPYING +%doc OFL.txt +%else +%license COPYING +%license OFL.txt +%endif +%doc README +%doc README.api +# Own appropriate files in /etc/ part of them belong to the +# webapp sub-package +%config(noreplace) %dir %{_sysconfdir}/%{pkg_name} +# This file is only used by the systemd service running agent. +# Only root should be able to read/write to it. +%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/%{pkg_name}/agent.auth +%config(noreplace) %{_sysconfdir}/%{pkg_name}/agent.properties +%config(noreplace) %{_sysconfdir}/%{pkg_name}/db.properties +%config(noreplace) %{_sysconfdir}/%{pkg_name}/logging.properties +%config %{_sysconfdir}/%{pkg_name}/bash-complete-logging.properties +%{system_root_datadir}/bash-completion/completions/%{name} +# Own containing directories since bash-completion package might not +# be installed +%dir %{system_root_datadir}/bash-completion/completions +%dir %{system_root_datadir}/bash-completion +%config(noreplace) %{_sysconfdir}/%{pkg_name}/plugins.d +%config(noreplace) %{_sysconfdir}/%{pkg_name}/ssl.properties +%config %{_sysconfdir}/%{pkg_name}/commands +%config %{_sysconfdir}/%{pkg_name}/osgi-export.properties +%config %{_sysconfdir}/%{pkg_name}/thermostatrc +# Required for systemd services +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%{_datadir}/%{pkg_name}/etc +%{_datadir}/%{pkg_name}/bin +# Command channel script should be owned by thermostat user to drop root privileges +%attr(0755,thermostat,thermostat) %{_datadir}/%{pkg_name}/bin/thermostat-command-channel +%{_datadir}/%{pkg_name}/libs +%{_datadir}/%{pkg_name}/plugins/local +%{_datadir}/%{pkg_name}/plugins/host-cpu +%{_datadir}/%{pkg_name}/plugins/host-memory +%{_datadir}/%{pkg_name}/plugins/host-overview +%{_datadir}/%{pkg_name}/plugins/killvm +%{_datadir}/%{pkg_name}/plugins/notes +%{_datadir}/%{pkg_name}/plugins/numa +%{_datadir}/%{pkg_name}/plugins/storage-profile +%{_datadir}/%{pkg_name}/plugins/thread +%{_datadir}/%{pkg_name}/plugins/validate +%{_datadir}/%{pkg_name}/plugins/setup +%{_datadir}/%{pkg_name}/plugins/vm-classstat +%{_datadir}/%{pkg_name}/plugins/vm-compiler +%{_datadir}/%{pkg_name}/plugins/vm-cpu +%{_datadir}/%{pkg_name}/plugins/vm-gc +%{_datadir}/%{pkg_name}/plugins/vm-heap-analysis +%{_datadir}/%{pkg_name}/plugins/vm-io +%{_datadir}/%{pkg_name}/plugins/vm-jmx +%{_datadir}/%{pkg_name}/plugins/vm-memory +%{_datadir}/%{pkg_name}/plugins/vm-numa +%{_datadir}/%{pkg_name}/plugins/vm-overview +%{_datadir}/%{pkg_name}/plugins/vm-profiler +%{_datadir}/%{pkg_name}/plugins/vm-find +%{_datadir}/%{pkg_name}/plugins/experimental +%dir %{_datadir}/%{pkg_name}/plugins +%dir %{_datadir}/%{pkg_name} +%dir %{_mavenpomdir}/%{pkg_name} +%dir %{_javadir}/%{pkg_name} +%{_datadir}/%{pkg_name}/cache +%{_datadir}/%{pkg_name}/data +%{_datadir}/%{pkg_name}/logs +%{_datadir}/%{pkg_name}/run +%{_libdir}/%{pkg_name} +%dir %{_jnidir}/%{pkg_name} +%{_jnidir}/thermostat-*.jar +%{_bindir}/thermostat +%{_bindir}/thermostat-setup +%dir %{_mandir}/man1 +%{_mandir}/man1/%{pkg_name}.1* +%if 0%{?with_systemd} +%{_unitdir}/%{?scl_prefix}%{pkg_name}-storage.service +%endif +%{system_tmpfilesdir}/%{name}.conf +# To these directories get written to when thermostat storage/agent +# run as systemd services +%{?scl: + %{user_datadir}/%{pkg_name} + %{user_statedir}/%{pkg_name} + %{user_logdir}/%{pkg_name} + %{user_cachedir}/%{pkg_name} +} + +%attr(0770,thermostat,thermostat) %dir %{system_datadir} +%attr(0660,thermostat,thermostat) %{system_datadir}/setup-complete.stamp +%attr(0770,thermostat,thermostat) %dir %{system_cachedir} +%attr(0770,thermostat,thermostat) %dir %{system_logdir} +%attr(0770,thermostat,thermostat) %dir %{system_statedir} +%doc %{_docdir}/%{pkg_name} + +%files javadoc -f .mfiles-javadoc +%doc LICENSE +# license macro not available in RHEL 6 +%if 0%{?is_rhel_6} +%doc COPYING +%doc OFL.txt +%else +%license COPYING +%license OFL.txt +%endif +%{?scl: + %{_datarootdir}/javadoc/%{pkg_name} +} + +%files webapp -f .mfiles-webapp +%{thermostat_catalina_base} +%config(noreplace) %{_sysconfdir}/%{pkg_name}/%{pkg_name}_jaas.conf +%config(noreplace) %{_sysconfdir}/%{pkg_name}/web-storage-service.properties +# Those files should be readable by root and tomcat only +%attr(0640,root,tomcat) %config(noreplace) %{_sysconfdir}/%{pkg_name}/%{pkg_name}-users.properties +%attr(0640,root,tomcat) %config(noreplace) %{_sysconfdir}/%{pkg_name}/%{pkg_name}-roles.properties +%attr(0640,root,tomcat) %config(noreplace) %{_sysconfdir}/%{pkg_name}/web.auth +# We need an extra file in order to make thermostat-webapp work with +# our custom CATALINA_BASE. This sets the JAAS-config option. +%{?scl: +%if 0%{?is_rhel_6} + %config(noreplace) %{system_confdir}/sysconfig/%{thermostat_tomcat_service_name} + # thermostat tomcat init script + %attr(0755,root,root) %{system_initrddir}/%{thermostat_tomcat_service_name} + %attr(0770,tomcat,tomcat) %dir %{_root_localstatedir}/log/%{thermostat_tomcat_service_name} +%else + %config(noreplace) %{system_confdir}/sysconfig/%{thermostat_tomcat_service_name} + %{_unitdir}/%{?scl_prefix}%{pkg_name}-tomcat.service + %attr(0770,tomcat,tomcat) %dir %{_root_localstatedir}/log/%{thermostat_tomcat_service_name} + # File used by RHEL-7.1's tomcat@thermostat service. + # escaped form of %%{scl_name} + %dir %{system_confdir}/sysconfig/tomcat@rh + %config(noreplace) %{system_confdir}/sysconfig/tomcat@rh/thermostat16 +%endif +} +%{!?scl: + %config(noreplace) %{system_confdir}/sysconfig/tomcat@%{pkg_name} +} +%{_datadir}/%{pkg_name}/webapp +%{_datadir}/%{pkg_name}/plugins/embedded-web-endpoint + +%changelog +* Wed Oct 26 2016 Jie Kang - 1.6.4-5 +- Add patch for fixing verified token removal + Resolves RHBZ#1388898 + +* Wed Oct 12 2016 Jie Kang - 1.6.4-4 +- Add patch for fixing storage initilization on + concurrent connections. Resolves RHBZ#1329003 + +* Tue Oct 11 2016 Severin Gehwolf - 1.6.4-3 +- Change owner of thermostat-command-channel script to + thermostat:thermostat. Resolves RHBZ#1379702 + +* Thu Sep 15 2016 Jie Kang - 1.6.4-2 +- Add self-br for proper symlinking + +* Thu Sep 15 2016 Jie Kang - 1.6.4-1 +- Update to latest upstream release 1.6.4 +- For RHBZ#1364549 + +* Wed Sep 14 2016 Jie Kang - 1.6.2-2 +- Add self-br for proper symlinking + +* Wed Sep 14 2016 Jie Kang - 1.6.2-1 +- Update to latest upstream release 1.6.2 +- Resolves RHBZ#1364549 + +* Tue Sep 06 2016 Jie Kang - 1.6.0-13 +- Own another in collection directory. Resolves RHBZ#1371518 + +* Thu Sep 01 2016 Jie Kang - 1.6.0-12 +- Own in collection directories +- Fix broken symlinks to tomcat files for el6 + +* Mon Aug 29 2016 Jie Kang - 1.6.0-11 +- Add self-br for proper symlinking + +* Mon Aug 29 2016 Jie Kang - 1.6.0-10 +- Remove self-br for bootstrap build + +* Wed Aug 03 2016 Jie Kang - 1.6.0-9 +- Add self-br for proper symlinking + +* Wed Aug 03 2016 Jie Kang - 1.6.0-8 +- Remove self-br for bootstrap build + +* Wed Aug 03 2016 Jie Kang - 1.6.0-7 +- Fix rh-thermostat16-thermostat-storage.service +- Prevent /var/run/rh-thermostat16-thermostat file from + disappearing after system reboot + +* Tue Jul 26 2016 Omair Majid - 1.6.0-6 +- Make rh-thermostat16-thermostat parallel-installable with thermostat1-thermostat + +* Tue Jul 26 2016 Jie Kang - 1.6.0-5 +- Fix typo in thermostatrc script replacement + +* Tue Jul 26 2016 Jie Kang - 1.6.0-4 +- Use java-common package for apache-commons-fileupload + +* Mon Jul 18 2016 Omair Majid - 1.6.0-3 +- Use /dev/urandom for tomcat@thermostat service. +- Resolves: RHBZ#1328972 + +* Thu Jul 14 2016 Jie Kang - 1.6.0-2 +- Add self-br for proper symlinking + +* Thu Jul 14 2016 Jie Kang - 1.6.0-1 +- Update to upstream 1.6.0 release. + +* Mon Jun 27 2016 Severin Gehwolf - 1.5.9-5 +- Fix lucene analyzers core bundle symbolic name. + +* Mon Jun 27 2016 Severin Gehwolf - 1.5.9-4 +- Fix bundle loading errors for "thermostat local". + +* Mon Jun 27 2016 Severin Gehwolf - 1.5.9-3 +- Fix bundle loading errors on framework boot. + +* Fri Jun 24 2016 Severin Gehwolf - 1.5.9-2 +- Add self-br for proper symlinking. + +* Fri Jun 24 2016 Severin Gehwolf - 1.5.9-1 +- Initial package.