[rhq] Branch 'rhq-on-as7' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/ear/src/main/application/server-comm-configuration.xml | 468 ----------
modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml | 4
modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration.xml | 468 ++++++++++
3 files changed, 468 insertions(+), 472 deletions(-)
New commits:
commit 72724f45b8c34da971ac5dabbf24effddacb9f8d
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Fri Sep 21 13:25:56 2012 -0400
Move server-comm-configuration.xml to the service sar top level so it can be
found bu the comm service on the classpath.
diff --git a/modules/enterprise/server/ear/src/main/application/server-comm-configuration.xml b/modules/enterprise/server/ear/src/main/application/server-comm-configuration.xml
deleted file mode 100644
index 7f30276..0000000
--- a/modules/enterprise/server/ear/src/main/application/server-comm-configuration.xml
+++ /dev/null
@@ -1,468 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE preferences SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>
-
-<!--
-==============================================================================
-RHQ Server Communications Configuration
-==============================================================================
--->
-
-<preferences EXTERNAL_XML_VERSION="1.0">
- <root type="user">
- <map />
- <node name="rhq-server">
- <map />
- <node name="default">
- <map>
- <!--
- _______________________________________________________________
- rhq.server.configuration-schema-version
-
- Defines what version of the server configuration schema this
- file conforms to. This is the schema for the rhq.server
- preferences.
- -->
- <entry key="rhq.server.configuration-schema-version" value="1" />
-
- <!--
- _______________________________________________________________
- rhq.server.agent-files-directory
-
- This defines the directory location that contains all the files
- that can be sent remotely to agents. If this is not defined,
- this effectively disables the server's ability to remotely
- send files to agents. If deploying within a JBossAS instance,
- leave this undefined, and set this as a configuration override
- property in the server-comm-service.xml
- deployment configuration file. This will allow you to use the
- ${jboss.server.home.dir} replacement variable expression
- as part of the directory location, for example.
- -->
- <!--
- <entry key="rhq.server.agent-files-directory" value="conf" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.server.client.queue-size
-
- The maximum size of the client command queue - this is the
- maximum number of commands that can be queued for sending to
- an agent. If this is 0, then the queue is unbounded.
- WARNING! Setting this to 0 could lead to resources being used
- up if for some reason commands keep getting queued but are
- not getting sent.
- -->
- <entry key="rhq.server.client.queue-size" value="50000" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.max-concurrent
-
- The maximum number of concurrent commands that can be in the
- process of being sent to an agent at any one time.
- -->
- <entry key="rhq.server.client.max-concurrent" value="1" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.command-timeout-msecs
-
- The time in milliseconds that the client sender will wait
- before aborting a command. This is the amount of time in
- milliseconds that the agent has in order to process commands.
- This value is only the default if a command has not specified
- its own timeout. A command can override this by setting its
- own timeout in the command's configuration, so this value may
- not be used for all commands that are sent. If this value is
- less than or equal to 0, there will be no default timeout
- and commands will therefore be allowed to take as long as they
- need (again, this is the default, individual commands may
- override this and set their own timeout). While this infinite
- timeout default could conceivably cause a thread to hang
- waiting for a rogue command that never finishes, it also reduces
- the amount of short-lived threads created by the system
- and will increase throughput, dramatically in some cases.
- -->
- <entry key="rhq.server.client.command-timeout-msecs" value="600000" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.retry-interval-msecs
-
- This is the minimum amount of time, in milliseconds, the client
- sender will wait before trying to resend a guaranteed command
- that previously failed. This is not a guarantee of when
- a command is retried - all that can be inferred is that a
- command that fails to be sent will not be retried until at
- least this amount of time passes.
- Note: if the sender is currently waiting in this retry pause
- period, the server will not be able to be shutdown until that
- retry period is over. In other words, if the server is asked
- to shutdown, it will wait for those commands waiting in this
- retry interval to wake up. This is to help ensure those
- commands are not lost.
- -->
- <entry key="rhq.server.client.retry-interval-msecs" value="15000" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.max-retries
-
- If a guaranteed delivery message is sent, but the server fails
- to connect to the agent and deliver the message, it will
- always be retried. However, if the error was something other
- than a "cannot connect" error, the command will only be retried
- this amount of times before the command is dropped. When this
- happens, the guaranteed command will never be delivered. This
- will normally happen under very odd and rare circumstances.
- Also, this setting only effects asynchronous messages that
- are sent with guaranteed delivery. This setting has no effect
- on other messages.
- -->
- <entry key="rhq.server.client.max-retries" value="10" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.command-spool-file.name
-
- This defines the name of the command spool file. This
- file must be located in the data directory (if one does not
- exist, it will be created). Note that if you do not define
- this setting, the default is to not spool commands to disk
- and thus implicitly disable guaranteed delivery.
- -->
- <!--
- <entry key="rhq.server.client.command-spool-file.name" value="command-spool.dat" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.server.client.command-spool-file.params
-
- This defines the parameters for the command spool file.
- The spool file is where the server persists commands that
- are flagged for guaranteed delivery and need to be sent.
- The format is defined as "max-file-size:purge-percentage".
- The first number is the size, in bytes, of the maximum file
- size threshold. If the spool file grows larger than this, a
- "purge" will be triggered in order to shrink the file.
- The second number is the purge percentage which indicates how
- large the file is allowed to be after a purge. This is
- specified as a percentage of the first parameter - the max
- file size threshold. For example, if the max file size is
- 100000 (i.e. 100KB) and the purge percentage is 90, then when
- the spool file grows larger than 100KB, a purge will be
- triggered and the file will be shrunk to no more than
- 90% of 100KB - which is 90KB. In effect, 10KB will be freed
- to allow room for new commands to be spooled. When this
- occurs, unused space is freed first and if that does not
- free up enough space, the oldest commands in the spool file
- will be sacrificed in order to make room for the newer
- commands.
- -->
- <entry key="rhq.server.client.command-spool-file.params" value="1000000:75" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.command-spool-file.compressed
-
- If this flag is true, the commands stored in the spool file
- will be compressed. This can potentially save about 30%-40% in
- disk space (give or take), however, it slows down the
- persistence mechanism considerably. Recommended setting for
- this should be false unless something on the server deployment
- box warrants disk-saving over persistence performance.
- -->
- <entry key="rhq.server.client.command-spool-file.compressed" value="false" />
-
- <!--
- _______________________________________________________________
- rhq.server.client.send-throttling
-
- If this setting is defined, it will enable send throttling to
- occur while sending commands to an agent. The format is
- defined as "max-commands:quiet-period-milliseconds"
- where the maximum commands defines the maximum number
- of commands that will be sent before the start of a quiet
- period. The quiet period defines the number of milliseconds
- in which no commands should be sent. After this duration
- expires, commands can again be sent, up to the maximum defined.
- Note that send throttling only affects those commands that
- are "throttle-able". Some commands are sent as soon as
- possible, regardless of the throttling settings.
-
- This affects sending commands synchronously and asynchronously.
- -->
- <!--
- <entry key="rhq.server.client.send-throttling" value="100:1000" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.server.client.queue-throttling
-
- If this setting is defined, it will enable queue throttling to
- occur while sending commands to an agent. The format is
- defined as "max-commands-per-burst:burst-period-milliseconds"
- where the maximum commands per burst defines the maximum number
- of commands that can be dequeued within a burst period. The
- burst period defines the number of milliseconds in which the
- defined maximum number of commands can be dequeued. If more
- than the maximum number of commands are queued within this
- time period, they will wait until the next burst period starts
- before being able to be dequeued.
-
- This does not affect sending commands synchronously. It only
- effects commands queued to be sent asynchronously.
- -->
- <!--
- <entry key="rhq.server.client.queue-throttling" value="50:3000" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.communications.configuration-schema-version
-
- Defines what version of the configuration schema this
- file conforms to. This is the schema for the
- rhq.communications preferences.
- -->
- <entry key="rhq.communications.configuration-schema-version" value="1" />
-
- <!--
- _______________________________________________________________
- rhq.communications.service-container.mbean-server-name
-
- Name of the MBean Server that houses the communications MBean
- services. This is actually the default domain name of the
- MBean Server and if an MBean Server has already been registered
- with this name, it will be used to house the communications
- services. If an MBean Server has not yet been registered with
- this name as its default domain, one will be created.
- If deploying within a JBossAS instance, the JBoss MBeanServer
- will be used, so this value can be left undefined since it
- will be unused.
- -->
- <!--
- <entry key="rhq.communications.service-container.mbean-server-name" value="jboss-on" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.communications.data-directory
-
- The location where the communication services write internal
- data files. If deploying within a JBossAS instance, leave
- this undefined, and set this as a configuration override
- property in the server-comm-service.xml deployment
- configuration file. This will allow you to use the
- ${jboss.server.data.dir} replacement variable as the data
- directory location.
- -->
- <!--
- <entry key="rhq.communications.data-directory" value="data" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.communications.global-concurrency-limit
-
- The maximum number of incoming commands that are allowed to be
- received concurrently. Any extra commands received over this
- amount will be dropped and the client will be asked to
- resend it later.
- -->
- <entry key="rhq.communications.global-concurrency-limit" value="200" />
-
- <!--
- _______________________________________________________________
- rhq.communications.multicast-detector.enabled
- rhq.communications.multicast-detector.multicast-address
- rhq.communications.multicast-detector.bind-address
- rhq.communications.multicast-detector.port
- rhq.communications.multicast-detector.default-time-delay
- rhq.communications.multicast-detector.heartbeat-time-delay
-
- The multicast detector configuration. This is the service that
- listens for new remote servers/agents coming on and going offline
- and is required if you want agent auto-detection. If you do not
- have auto-detection enabled or your network will not
- support multicast traffic, you should disable the multicast
- detector.
-
- The multicast-address is used to broadcast detection messages.
- To be more specific, it is the IP address of the
- multicast group the detector will join. The bind-address
- is the IP that is bound by the network interface.
-
- The detector will send heartbeat messages every X milliseconds
- (this is the heartbeat-time-delay). If external servers'
- detectors do not send their heartbeat messages within the
- default-time-delay, our detector will assume that external
- server has gone down. These settings affect the timeliness
- of our auto-detection mechanism.
- -->
- <entry key="rhq.communications.multicast-detector.enabled" value="false" />
- <entry key="rhq.communications.multicast-detector.multicast-address" value="224.16.16.16" />
- <entry key="rhq.communications.multicast-detector.bind-address" value="0.0.0.0" />
- <entry key="rhq.communications.multicast-detector.port" value="16162" />
- <entry key="rhq.communications.multicast-detector.default-time-delay" value="5000" />
- <entry key="rhq.communications.multicast-detector.heartbeat-time-delay" value="1000" />
-
- <!--
- _______________________________________________________________
- rhq.communications.connector.rhqtype
- rhq.communications.connector.transport
- rhq.communications.connector.bind-port
- rhq.communications.connector.bind-address
- rhq.communications.connector.transport-params
- rhq.communications.connector.lease-period
-
- The server connector configuration. This is the service that
- listens for incoming agent requests and passes them to the
- appropriate server-side components for processing. See the
- JBoss/Remoting documentation for a full list of options
- that can be specified. Note that because this is an XML file,
- you must specify "&" in the transport-params value
- when needing an ampersand to separate the parameters.
- -->
- <entry key="rhq.communications.connector.rhqtype" value="server" />
- <entry key="rhq.communications.connector.transport" value="servlet" />
- <entry key="rhq.communications.connector.bind-port" value="7080" />
- <entry key="rhq.communications.connector.transport-params" value="/jboss-remoting-servlet-invoker/ServerInvokerServlet" />
- <!--
- <entry key="rhq.communications.connector.bind-address" value="127.0.0.1" />
- <entry key="rhq.communications.connector.lease-period" value="5000" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.communications.connector.security.secure-socket-protocol
- rhq.communications.connector.security.keystore.file
- rhq.communications.connector.security.keystore.algorithm
- rhq.communications.connector.security.keystore.type
- rhq.communications.connector.security.keystore.password
- rhq.communications.connector.security.keystore.key-password
- rhq.communications.connector.security.keystore.alias
- rhq.communications.connector.security.truststore.file
- rhq.communications.connector.security.truststore.algorithm
- rhq.communications.connector.security.truststore.type
- rhq.communications.connector.security.truststore.password
- rhq.communications.connector.security.client-auth-mode
-
- rhq.server.client.security.secure-socket-protocol
- rhq.server.client.security.keystore.file
- rhq.server.client.security.keystore.algorithm
- rhq.server.client.security.keystore.type
- rhq.server.client.security.keystore.password
- rhq.server.client.security.keystore.key-password
- rhq.server.client.security.keystore.alias
- rhq.server.client.security.truststore.file
- rhq.server.client.security.truststore.algorithm
- rhq.server.client.security.truststore.type
- rhq.server.client.security.truststore.password
- rhq.server.client.security.server-auth-mode-enabled
-
- These are the settings that are used if SSL is to be used for
- either the server or client communications. These can be left
- unset since the defaults will normally suffice. These
- properties are here just in case some use case occurs that
- require one or more of these settings to be customized.
-
- Note that if client-auth-mode is specified, it must be one of:
- "none", "want", "need". To support Tomcat syntax, "true" can be used
- in place of "need" and "false" can be used in place of "none".
- -->
- <!--
- <entry key="rhq.communications.connector.security.secure-socket-protocol" value="TLS" />
- <entry key="rhq.communications.connector.security.keystore.file" value="data/keystore.dat" />
- <entry key="rhq.communications.connector.security.keystore.algorithm" value="SunX509" />
- <entry key="rhq.communications.connector.security.keystore.type" value="JKS" />
- <entry key="rhq.communications.connector.security.keystore.password" value="rhqpwd" />
- <entry key="rhq.communications.connector.security.keystore.key-password" value="rhqpwd" />
- <entry key="rhq.communications.connector.security.keystore.alias" value="rhq" />
- <entry key="rhq.communications.connector.security.truststore.file" value="data/truststore.dat" />
- <entry key="rhq.communications.connector.security.truststore.algorithm" value="SunX509" />
- <entry key="rhq.communications.connector.security.truststore.type" value="JKS" />
- <entry key="rhq.communications.connector.security.truststore.password" value="" />
- <entry key="rhq.communications.connector.security.client-auth-mode" value="none" />
-
- <entry key="rhq.server.client.security.secure-socket-protocol" value="TLS" />
- <entry key="rhq.server.client.security.keystore.file" value="data/keystore.dat" />
- <entry key="rhq.server.client.security.keystore.algorithm" value="SunX509" />
- <entry key="rhq.server.client.security.keystore.type" value="JKS" />
- <entry key="rhq.server.client.security.keystore.password" value="rhqpwd" />
- <entry key="rhq.server.client.security.keystore.alias" value="rhq" />
- <entry key="rhq.server.client.security.keystore.key-password" value="rhqpwd" />
- <entry key="rhq.server.client.security.truststore.file" value="data/truststore.dat" />
- <entry key="rhq.server.client.security.truststore.algorithm" value="SunX509" />
- <entry key="rhq.server.client.security.truststore.type" value="JKS" />
- <entry key="rhq.server.client.security.truststore.password" value="" />
- <entry key="rhq.server.client.security.server-auth-mode-enabled" value="false" />
- -->
-
- <!--
- _______________________________________________________________
- rhq.communications.remote-stream-max-idle-time-msecs
-
- The maximum amount of milliseconds a remoted stream
- is allowed to be idle before it is automatically closed and
- removed from the server. This means that a client must
- attempt to access the remoted stream every X milliseconds
- (where X is the value of this setting) or that stream will no
- longer be available. Note that this does not mean a client
- must read or write the entire stream in this amount of time,
- it only means a client must make a request on the stream every
- X milliseconds (be it to read or write one byte, see how many
- bytes are available to be read, etc).
- -->
- <entry key="rhq.communications.remote-stream-max-idle-time-msecs" value="300000" />
-
- <!--
- _______________________________________________________________
- rhq.communications.command-service-directory.allow-dynamic-discovery
-
- Flag to allow new command services to be added to the command
- services directory during runtime. If this is false, only
- those services defined in the
- rhq.communications.command-services preference will be available
- during the lifetime of the command service directory.
- -->
- <entry key="rhq.communications.command-service-directory.allow-dynamic-discovery" value="true" />
-
- <!--
- _______________________________________________________________
- rhq.communications.command-services
-
- Command Services that are to be added immediately at startup.
- -->
- <entry key="rhq.communications.command-services" value="org.rhq.enterprise.communications.command.impl.echo.server.EchoCommandService, org.rhq.enterprise.communications.command.impl.identify.server.IdentifyCommandService" />
-
- <!--
- _______________________________________________________________
- rhq.communications.remote-pojos
-
- Objects that are to be created and their remote interfaces
- deployed immediately at startup. The format of the value is
- a comma separated list of implementation/interface names:
- class.to.instantiate.via.noarg.constructor:interface.to.expose
- -->
- <entry key="rhq.communications.remote-pojos"
- value="org.rhq.enterprise.communications.PingImpl:org.rhq.enterprise.communications.Ping,org.rhq.enterprise.server.core.CoreServerServiceImpl:org.rhq.core.clientapi.server.core.CoreServerService,org.rhq.enterprise.server.discovery.DiscoveryServerServiceImpl:org.rhq.core.clientapi.server.discovery.DiscoveryServerService,org.rhq.enterprise.server.measurement.MeasurementServerServiceImpl:org.rhq.core.clientapi.server.measurement.MeasurementServerService,org.rhq.enterprise.server.operation.OperationServerServiceImpl:org.rhq.core.clientapi.server.operation.OperationServerService,org.rhq.enterprise.server.configuration.ConfigurationServerServiceImpl:org.rhq.core.clientapi.server.configuration.ConfigurationServerService,org.rhq.enterprise.server.resource.ResourceFactoryServerServiceImpl:org.rhq.core.clientapi.server.inventory.ResourceFactoryServerService,org.rhq.enterprise.server.content.ContentServerServiceImpl:org.rhq.core.clientapi.server.content.ContentSer
verService,org.rhq.enterprise.server.event.EventServerServiceImpl:org.rhq.core.clientapi.server.event.EventServerService,org.rhq.enterprise.server.bundle.BundleServerServiceImpl:org.rhq.core.clientapi.server.bundle.BundleServerService,org.rhq.enterprise.server.drift.DriftServerServiceImpl:org.rhq.core.clientapi.server.drift.DriftServerService" />
-
- <!--
- _______________________________________________________________
- rhq.communications.command-authenticator
-
- A command authenticator class that will be used to authenticate incoming commands.
- -->
- <entry key="rhq.communications.command-authenticator" value="org.rhq.enterprise.server.core.comm.SecurityTokenCommandAuthenticator" />
-
- </map>
- </node>
- </node>
- </root>
-</preferences>
-
\ No newline at end of file
diff --git a/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml b/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml
index 23f0f49..e1acc1f 100644
--- a/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml
+++ b/modules/enterprise/server/sars/services-sar/src/main/resources/META-INF/jboss-service.xml
@@ -64,10 +64,6 @@ org.quartz.jobStore.lockHandler.class = ${rhq.server.quartz.lockHandler
<mbean code="org.rhq.enterprise.server.core.comm.ServerCommunicationsService"
name="rhq:service=ServerCommunications">
- <!--
- <attribute name="ConfigurationFile">.../server-comm-configuration.xml</attribute>
- -->
-
<!-- see https://issues.jboss.org/browse/AS7-5342 for why we have two attributes instead of just one-->
<attribute name="ConfigurationOverrides">
# location of the plugin jars and other files agents can download directly from sever
diff --git a/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration.xml b/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration.xml
new file mode 100644
index 0000000..7f30276
--- /dev/null
+++ b/modules/enterprise/server/sars/services-sar/src/main/resources/server-comm-configuration.xml
@@ -0,0 +1,468 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE preferences SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>
+
+<!--
+==============================================================================
+RHQ Server Communications Configuration
+==============================================================================
+-->
+
+<preferences EXTERNAL_XML_VERSION="1.0">
+ <root type="user">
+ <map />
+ <node name="rhq-server">
+ <map />
+ <node name="default">
+ <map>
+ <!--
+ _______________________________________________________________
+ rhq.server.configuration-schema-version
+
+ Defines what version of the server configuration schema this
+ file conforms to. This is the schema for the rhq.server
+ preferences.
+ -->
+ <entry key="rhq.server.configuration-schema-version" value="1" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.agent-files-directory
+
+ This defines the directory location that contains all the files
+ that can be sent remotely to agents. If this is not defined,
+ this effectively disables the server's ability to remotely
+ send files to agents. If deploying within a JBossAS instance,
+ leave this undefined, and set this as a configuration override
+ property in the server-comm-service.xml
+ deployment configuration file. This will allow you to use the
+ ${jboss.server.home.dir} replacement variable expression
+ as part of the directory location, for example.
+ -->
+ <!--
+ <entry key="rhq.server.agent-files-directory" value="conf" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.queue-size
+
+ The maximum size of the client command queue - this is the
+ maximum number of commands that can be queued for sending to
+ an agent. If this is 0, then the queue is unbounded.
+ WARNING! Setting this to 0 could lead to resources being used
+ up if for some reason commands keep getting queued but are
+ not getting sent.
+ -->
+ <entry key="rhq.server.client.queue-size" value="50000" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.max-concurrent
+
+ The maximum number of concurrent commands that can be in the
+ process of being sent to an agent at any one time.
+ -->
+ <entry key="rhq.server.client.max-concurrent" value="1" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.command-timeout-msecs
+
+ The time in milliseconds that the client sender will wait
+ before aborting a command. This is the amount of time in
+ milliseconds that the agent has in order to process commands.
+ This value is only the default if a command has not specified
+ its own timeout. A command can override this by setting its
+ own timeout in the command's configuration, so this value may
+ not be used for all commands that are sent. If this value is
+ less than or equal to 0, there will be no default timeout
+ and commands will therefore be allowed to take as long as they
+ need (again, this is the default, individual commands may
+ override this and set their own timeout). While this infinite
+ timeout default could conceivably cause a thread to hang
+ waiting for a rogue command that never finishes, it also reduces
+ the amount of short-lived threads created by the system
+ and will increase throughput, dramatically in some cases.
+ -->
+ <entry key="rhq.server.client.command-timeout-msecs" value="600000" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.retry-interval-msecs
+
+ This is the minimum amount of time, in milliseconds, the client
+ sender will wait before trying to resend a guaranteed command
+ that previously failed. This is not a guarantee of when
+ a command is retried - all that can be inferred is that a
+ command that fails to be sent will not be retried until at
+ least this amount of time passes.
+ Note: if the sender is currently waiting in this retry pause
+ period, the server will not be able to be shutdown until that
+ retry period is over. In other words, if the server is asked
+ to shutdown, it will wait for those commands waiting in this
+ retry interval to wake up. This is to help ensure those
+ commands are not lost.
+ -->
+ <entry key="rhq.server.client.retry-interval-msecs" value="15000" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.max-retries
+
+ If a guaranteed delivery message is sent, but the server fails
+ to connect to the agent and deliver the message, it will
+ always be retried. However, if the error was something other
+ than a "cannot connect" error, the command will only be retried
+ this amount of times before the command is dropped. When this
+ happens, the guaranteed command will never be delivered. This
+ will normally happen under very odd and rare circumstances.
+ Also, this setting only effects asynchronous messages that
+ are sent with guaranteed delivery. This setting has no effect
+ on other messages.
+ -->
+ <entry key="rhq.server.client.max-retries" value="10" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.command-spool-file.name
+
+ This defines the name of the command spool file. This
+ file must be located in the data directory (if one does not
+ exist, it will be created). Note that if you do not define
+ this setting, the default is to not spool commands to disk
+ and thus implicitly disable guaranteed delivery.
+ -->
+ <!--
+ <entry key="rhq.server.client.command-spool-file.name" value="command-spool.dat" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.command-spool-file.params
+
+ This defines the parameters for the command spool file.
+ The spool file is where the server persists commands that
+ are flagged for guaranteed delivery and need to be sent.
+ The format is defined as "max-file-size:purge-percentage".
+ The first number is the size, in bytes, of the maximum file
+ size threshold. If the spool file grows larger than this, a
+ "purge" will be triggered in order to shrink the file.
+ The second number is the purge percentage which indicates how
+ large the file is allowed to be after a purge. This is
+ specified as a percentage of the first parameter - the max
+ file size threshold. For example, if the max file size is
+ 100000 (i.e. 100KB) and the purge percentage is 90, then when
+ the spool file grows larger than 100KB, a purge will be
+ triggered and the file will be shrunk to no more than
+ 90% of 100KB - which is 90KB. In effect, 10KB will be freed
+ to allow room for new commands to be spooled. When this
+ occurs, unused space is freed first and if that does not
+ free up enough space, the oldest commands in the spool file
+ will be sacrificed in order to make room for the newer
+ commands.
+ -->
+ <entry key="rhq.server.client.command-spool-file.params" value="1000000:75" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.command-spool-file.compressed
+
+ If this flag is true, the commands stored in the spool file
+ will be compressed. This can potentially save about 30%-40% in
+ disk space (give or take), however, it slows down the
+ persistence mechanism considerably. Recommended setting for
+ this should be false unless something on the server deployment
+ box warrants disk-saving over persistence performance.
+ -->
+ <entry key="rhq.server.client.command-spool-file.compressed" value="false" />
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.send-throttling
+
+ If this setting is defined, it will enable send throttling to
+ occur while sending commands to an agent. The format is
+ defined as "max-commands:quiet-period-milliseconds"
+ where the maximum commands defines the maximum number
+ of commands that will be sent before the start of a quiet
+ period. The quiet period defines the number of milliseconds
+ in which no commands should be sent. After this duration
+ expires, commands can again be sent, up to the maximum defined.
+ Note that send throttling only affects those commands that
+ are "throttle-able". Some commands are sent as soon as
+ possible, regardless of the throttling settings.
+
+ This affects sending commands synchronously and asynchronously.
+ -->
+ <!--
+ <entry key="rhq.server.client.send-throttling" value="100:1000" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.server.client.queue-throttling
+
+ If this setting is defined, it will enable queue throttling to
+ occur while sending commands to an agent. The format is
+ defined as "max-commands-per-burst:burst-period-milliseconds"
+ where the maximum commands per burst defines the maximum number
+ of commands that can be dequeued within a burst period. The
+ burst period defines the number of milliseconds in which the
+ defined maximum number of commands can be dequeued. If more
+ than the maximum number of commands are queued within this
+ time period, they will wait until the next burst period starts
+ before being able to be dequeued.
+
+ This does not affect sending commands synchronously. It only
+ effects commands queued to be sent asynchronously.
+ -->
+ <!--
+ <entry key="rhq.server.client.queue-throttling" value="50:3000" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.configuration-schema-version
+
+ Defines what version of the configuration schema this
+ file conforms to. This is the schema for the
+ rhq.communications preferences.
+ -->
+ <entry key="rhq.communications.configuration-schema-version" value="1" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.service-container.mbean-server-name
+
+ Name of the MBean Server that houses the communications MBean
+ services. This is actually the default domain name of the
+ MBean Server and if an MBean Server has already been registered
+ with this name, it will be used to house the communications
+ services. If an MBean Server has not yet been registered with
+ this name as its default domain, one will be created.
+ If deploying within a JBossAS instance, the JBoss MBeanServer
+ will be used, so this value can be left undefined since it
+ will be unused.
+ -->
+ <!--
+ <entry key="rhq.communications.service-container.mbean-server-name" value="jboss-on" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.data-directory
+
+ The location where the communication services write internal
+ data files. If deploying within a JBossAS instance, leave
+ this undefined, and set this as a configuration override
+ property in the server-comm-service.xml deployment
+ configuration file. This will allow you to use the
+ ${jboss.server.data.dir} replacement variable as the data
+ directory location.
+ -->
+ <!--
+ <entry key="rhq.communications.data-directory" value="data" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.global-concurrency-limit
+
+ The maximum number of incoming commands that are allowed to be
+ received concurrently. Any extra commands received over this
+ amount will be dropped and the client will be asked to
+ resend it later.
+ -->
+ <entry key="rhq.communications.global-concurrency-limit" value="200" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.multicast-detector.enabled
+ rhq.communications.multicast-detector.multicast-address
+ rhq.communications.multicast-detector.bind-address
+ rhq.communications.multicast-detector.port
+ rhq.communications.multicast-detector.default-time-delay
+ rhq.communications.multicast-detector.heartbeat-time-delay
+
+ The multicast detector configuration. This is the service that
+ listens for new remote servers/agents coming on and going offline
+ and is required if you want agent auto-detection. If you do not
+ have auto-detection enabled or your network will not
+ support multicast traffic, you should disable the multicast
+ detector.
+
+ The multicast-address is used to broadcast detection messages.
+ To be more specific, it is the IP address of the
+ multicast group the detector will join. The bind-address
+ is the IP that is bound by the network interface.
+
+ The detector will send heartbeat messages every X milliseconds
+ (this is the heartbeat-time-delay). If external servers'
+ detectors do not send their heartbeat messages within the
+ default-time-delay, our detector will assume that external
+ server has gone down. These settings affect the timeliness
+ of our auto-detection mechanism.
+ -->
+ <entry key="rhq.communications.multicast-detector.enabled" value="false" />
+ <entry key="rhq.communications.multicast-detector.multicast-address" value="224.16.16.16" />
+ <entry key="rhq.communications.multicast-detector.bind-address" value="0.0.0.0" />
+ <entry key="rhq.communications.multicast-detector.port" value="16162" />
+ <entry key="rhq.communications.multicast-detector.default-time-delay" value="5000" />
+ <entry key="rhq.communications.multicast-detector.heartbeat-time-delay" value="1000" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.connector.rhqtype
+ rhq.communications.connector.transport
+ rhq.communications.connector.bind-port
+ rhq.communications.connector.bind-address
+ rhq.communications.connector.transport-params
+ rhq.communications.connector.lease-period
+
+ The server connector configuration. This is the service that
+ listens for incoming agent requests and passes them to the
+ appropriate server-side components for processing. See the
+ JBoss/Remoting documentation for a full list of options
+ that can be specified. Note that because this is an XML file,
+ you must specify "&" in the transport-params value
+ when needing an ampersand to separate the parameters.
+ -->
+ <entry key="rhq.communications.connector.rhqtype" value="server" />
+ <entry key="rhq.communications.connector.transport" value="servlet" />
+ <entry key="rhq.communications.connector.bind-port" value="7080" />
+ <entry key="rhq.communications.connector.transport-params" value="/jboss-remoting-servlet-invoker/ServerInvokerServlet" />
+ <!--
+ <entry key="rhq.communications.connector.bind-address" value="127.0.0.1" />
+ <entry key="rhq.communications.connector.lease-period" value="5000" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.connector.security.secure-socket-protocol
+ rhq.communications.connector.security.keystore.file
+ rhq.communications.connector.security.keystore.algorithm
+ rhq.communications.connector.security.keystore.type
+ rhq.communications.connector.security.keystore.password
+ rhq.communications.connector.security.keystore.key-password
+ rhq.communications.connector.security.keystore.alias
+ rhq.communications.connector.security.truststore.file
+ rhq.communications.connector.security.truststore.algorithm
+ rhq.communications.connector.security.truststore.type
+ rhq.communications.connector.security.truststore.password
+ rhq.communications.connector.security.client-auth-mode
+
+ rhq.server.client.security.secure-socket-protocol
+ rhq.server.client.security.keystore.file
+ rhq.server.client.security.keystore.algorithm
+ rhq.server.client.security.keystore.type
+ rhq.server.client.security.keystore.password
+ rhq.server.client.security.keystore.key-password
+ rhq.server.client.security.keystore.alias
+ rhq.server.client.security.truststore.file
+ rhq.server.client.security.truststore.algorithm
+ rhq.server.client.security.truststore.type
+ rhq.server.client.security.truststore.password
+ rhq.server.client.security.server-auth-mode-enabled
+
+ These are the settings that are used if SSL is to be used for
+ either the server or client communications. These can be left
+ unset since the defaults will normally suffice. These
+ properties are here just in case some use case occurs that
+ require one or more of these settings to be customized.
+
+ Note that if client-auth-mode is specified, it must be one of:
+ "none", "want", "need". To support Tomcat syntax, "true" can be used
+ in place of "need" and "false" can be used in place of "none".
+ -->
+ <!--
+ <entry key="rhq.communications.connector.security.secure-socket-protocol" value="TLS" />
+ <entry key="rhq.communications.connector.security.keystore.file" value="data/keystore.dat" />
+ <entry key="rhq.communications.connector.security.keystore.algorithm" value="SunX509" />
+ <entry key="rhq.communications.connector.security.keystore.type" value="JKS" />
+ <entry key="rhq.communications.connector.security.keystore.password" value="rhqpwd" />
+ <entry key="rhq.communications.connector.security.keystore.key-password" value="rhqpwd" />
+ <entry key="rhq.communications.connector.security.keystore.alias" value="rhq" />
+ <entry key="rhq.communications.connector.security.truststore.file" value="data/truststore.dat" />
+ <entry key="rhq.communications.connector.security.truststore.algorithm" value="SunX509" />
+ <entry key="rhq.communications.connector.security.truststore.type" value="JKS" />
+ <entry key="rhq.communications.connector.security.truststore.password" value="" />
+ <entry key="rhq.communications.connector.security.client-auth-mode" value="none" />
+
+ <entry key="rhq.server.client.security.secure-socket-protocol" value="TLS" />
+ <entry key="rhq.server.client.security.keystore.file" value="data/keystore.dat" />
+ <entry key="rhq.server.client.security.keystore.algorithm" value="SunX509" />
+ <entry key="rhq.server.client.security.keystore.type" value="JKS" />
+ <entry key="rhq.server.client.security.keystore.password" value="rhqpwd" />
+ <entry key="rhq.server.client.security.keystore.alias" value="rhq" />
+ <entry key="rhq.server.client.security.keystore.key-password" value="rhqpwd" />
+ <entry key="rhq.server.client.security.truststore.file" value="data/truststore.dat" />
+ <entry key="rhq.server.client.security.truststore.algorithm" value="SunX509" />
+ <entry key="rhq.server.client.security.truststore.type" value="JKS" />
+ <entry key="rhq.server.client.security.truststore.password" value="" />
+ <entry key="rhq.server.client.security.server-auth-mode-enabled" value="false" />
+ -->
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.remote-stream-max-idle-time-msecs
+
+ The maximum amount of milliseconds a remoted stream
+ is allowed to be idle before it is automatically closed and
+ removed from the server. This means that a client must
+ attempt to access the remoted stream every X milliseconds
+ (where X is the value of this setting) or that stream will no
+ longer be available. Note that this does not mean a client
+ must read or write the entire stream in this amount of time,
+ it only means a client must make a request on the stream every
+ X milliseconds (be it to read or write one byte, see how many
+ bytes are available to be read, etc).
+ -->
+ <entry key="rhq.communications.remote-stream-max-idle-time-msecs" value="300000" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.command-service-directory.allow-dynamic-discovery
+
+ Flag to allow new command services to be added to the command
+ services directory during runtime. If this is false, only
+ those services defined in the
+ rhq.communications.command-services preference will be available
+ during the lifetime of the command service directory.
+ -->
+ <entry key="rhq.communications.command-service-directory.allow-dynamic-discovery" value="true" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.command-services
+
+ Command Services that are to be added immediately at startup.
+ -->
+ <entry key="rhq.communications.command-services" value="org.rhq.enterprise.communications.command.impl.echo.server.EchoCommandService, org.rhq.enterprise.communications.command.impl.identify.server.IdentifyCommandService" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.remote-pojos
+
+ Objects that are to be created and their remote interfaces
+ deployed immediately at startup. The format of the value is
+ a comma separated list of implementation/interface names:
+ class.to.instantiate.via.noarg.constructor:interface.to.expose
+ -->
+ <entry key="rhq.communications.remote-pojos"
+ value="org.rhq.enterprise.communications.PingImpl:org.rhq.enterprise.communications.Ping,org.rhq.enterprise.server.core.CoreServerServiceImpl:org.rhq.core.clientapi.server.core.CoreServerService,org.rhq.enterprise.server.discovery.DiscoveryServerServiceImpl:org.rhq.core.clientapi.server.discovery.DiscoveryServerService,org.rhq.enterprise.server.measurement.MeasurementServerServiceImpl:org.rhq.core.clientapi.server.measurement.MeasurementServerService,org.rhq.enterprise.server.operation.OperationServerServiceImpl:org.rhq.core.clientapi.server.operation.OperationServerService,org.rhq.enterprise.server.configuration.ConfigurationServerServiceImpl:org.rhq.core.clientapi.server.configuration.ConfigurationServerService,org.rhq.enterprise.server.resource.ResourceFactoryServerServiceImpl:org.rhq.core.clientapi.server.inventory.ResourceFactoryServerService,org.rhq.enterprise.server.content.ContentServerServiceImpl:org.rhq.core.clientapi.server.content.ContentSer
verService,org.rhq.enterprise.server.event.EventServerServiceImpl:org.rhq.core.clientapi.server.event.EventServerService,org.rhq.enterprise.server.bundle.BundleServerServiceImpl:org.rhq.core.clientapi.server.bundle.BundleServerService,org.rhq.enterprise.server.drift.DriftServerServiceImpl:org.rhq.core.clientapi.server.drift.DriftServerService" />
+
+ <!--
+ _______________________________________________________________
+ rhq.communications.command-authenticator
+
+ A command authenticator class that will be used to authenticate incoming commands.
+ -->
+ <entry key="rhq.communications.command-authenticator" value="org.rhq.enterprise.server.core.comm.SecurityTokenCommandAuthenticator" />
+
+ </map>
+ </node>
+ </node>
+ </root>
+</preferences>
+
\ No newline at end of file
11 years, 8 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit e389e47613a57457b46dce6ab8a4d7634b76c07c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Sep 21 12:20:58 2012 -0400
this MBean no longer exists in AS7 and I can't find any place in AS7 that tells me when it started. So I will use the RHQ MBean service that has this information
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
index 71c807f..5cd138c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
@@ -761,9 +761,8 @@ public class StartupBean {
private long getElapsedTimeSinceStartup() throws RuntimeException {
long elapsed;
try {
- ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
- MBeanServer jbossServer = ManagementFactory.getPlatformMBeanServer();
- Date startTime = (Date) jbossServer.getAttribute(jbossServerName, "StartDate");
+ CoreServerMBean coreServer = LookupUtil.getCoreServer();
+ Date startTime = coreServer.getBootTime();
long currentTime = System.currentTimeMillis();
elapsed = currentTime - startTime.getTime();
} catch (Exception e) {
11 years, 8 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit a533e6361eddc25a9b47595c3089aa1e6d10e6f0
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Sep 21 12:06:36 2012 -0400
add logging
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
index 946b02c..e285655 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
@@ -692,11 +692,13 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
}
private void reloadConfiguration() throws Exception {
+ log("Will now ask the app server to reload its configuration");
ModelControllerClient mcc = null;
try {
mcc = getModelControllerClient();
final CoreJBossASClient client = new CoreJBossASClient(mcc);
client.reload();
+ log("App server has been successfully asked to reload its configuration");
} catch (Exception e) {
log("reloadConfiguration failed - restart the server to complete the installation", e);
} finally {
11 years, 8 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 9 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanPreparation.java | 68 ++++++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanToWorkaroundAS7_5530.java | 46 ------
3 files changed, 76 insertions(+), 47 deletions(-)
New commits:
commit e20f96e957c17e12ec72dac7a86d158a2915c772
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Sep 21 11:41:21 2012 -0400
work around a deadlock inside AS7 when it tries to deploy our app
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
index 70b6637..946b02c 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
@@ -70,7 +70,14 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
try {
// If we are already fully installed, we don't have to do anything. Just return immediately.
- if (getInstallationResults() != null) {
+ String installationResults = getInstallationResults();
+ if (installationResults != null) {
+ if (installationResults.length() == 0) {
+ log("The installer has already been told to perform its work. The server should be ready soon.");
+ } else {
+ log("The installer has already attempted to install the server but errors occurred:\n"
+ + installationResults);
+ }
return;
}
} catch (Throwable t) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanPreparation.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanPreparation.java
new file mode 100644
index 0000000..88790d5
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanPreparation.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program 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 version 2 of the License.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.core;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.ejb.Timeout;
+import javax.ejb.TimerConfig;
+import javax.ejb.TimerService;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This startup singleton EJB is here to work around bug AS7-5530 and to
+ * schedule the real StartupBean's work in a delayed fashion (this is to allow
+ * AS7 to complete its deployment work before we do our work).
+ *
+ * See https://issues.jboss.org/browse/AS7-5530
+ */
+@Singleton
+@Startup
+public class StartupBeanPreparation {
+ private Log log = LogFactory.getLog(this.getClass());
+
+ @EJB
+ private StartupBean startupBean;
+
+ @Resource
+ private TimerService timerService; // needed to schedule our startup bean init call
+
+ @PostConstruct
+ public void initWithTransactionBecauseAS75530() throws RuntimeException {
+ timerService.createSingleActionTimer(10000, new TimerConfig(null, false)); // call StartupBean in 10s
+ }
+
+ @Timeout
+ public void initializeServer() throws RuntimeException {
+ try {
+ this.startupBean.init();
+ } catch (Throwable t) {
+ // do NOT allow exceptions to bubble out of our method because then
+ // the EJB container would simply re-trigger the timer and call us again
+ // and we don't want to keep failing over and over filling the logs
+ // in an infinite loop.
+ log.fatal("The server failed to start up properly", t);
+ }
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanToWorkaroundAS7_5530.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanToWorkaroundAS7_5530.java
deleted file mode 100644
index f683110..0000000
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBeanToWorkaroundAS7_5530.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program 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 version 2 of the License.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.server.core;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.EJB;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-
-/**
- * This startup singleton EJB is here solely to work around bug AS7-5530:
- * https://issues.jboss.org/browse/AS7-5530
- *
- * When that bug is fixed, delete this class and uncomment the appropriate things in StartupBean.
- */
-@Singleton
-@Startup
-public class StartupBeanToWorkaroundAS7_5530 {
- @EJB
- private StartupBean startupBean;
-
- @PostConstruct
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- // this @TransactionAttribute annotation is ignored because of bug AS7-5530
- public void initWithTransactionBecauseAS75530() throws RuntimeException {
- this.startupBean.init(); // call init() which is NOT_SUPPORTED so it suspends the tx bug AS7-5530 gives us erroneously
- }
-}
11 years, 8 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java | 243 +++++++++-
1 file changed, 242 insertions(+), 1 deletion(-)
New commits:
commit 6ab817044c8480a02eb82798c75a40e1a0bd4649
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Sep 21 17:04:01 2012 +0200
Tests for MeasurementDataManagerBean testing adding and finding the MeasurementTraitData (in particular methods: MeasurementDataManagerBean.addTraitData(), MeasurementDataManagerBean.findTraits(), MeasurementDataManagerBean.findTraitsByCriteria(), and MeasurementDataManagerBean.findCurrentTraitsForResource())
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
index a6abea9..80f0cd2 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
@@ -41,6 +41,7 @@ import org.testng.annotations.Test;
import org.rhq.core.clientapi.agent.measurement.MeasurementAgentService;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementCategory;
@@ -88,7 +89,7 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
private MeasurementSchedule schedule1, schedule2, schedule3;
private ResourceType theResourceType;
private Agent theAgent;
- private Set<MeasurementData> expectedResult1, expectedResult2, expectedResult3;
+ private Set<MeasurementData> expectedResult1, expectedResult2, expectedResult3, expectedResult4;
@BeforeMethod
public void beforeMethod() {
@@ -363,12 +364,15 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
long time1 = System.currentTimeMillis();
long time2 = time1 + 1;
long time3 = time2 + 1;
+ long time4 = time3 + 1;
String name1 = "a";
String name2 = "b";
String name3 = "c";
+ String name4 = "d";
String value1 = "test-value1";
String value2 = "test-value2";
String value3 = "test-value3";
+ String value4 = "test-value4";
// method findLiveDataForGroup adds prefix with resource id which is part of equals
MeasurementData expectedData1 = makeMeasurement(time1, schedule1.getId(), value1, name1);
@@ -377,6 +381,8 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
expectedData2.setName(resource2.getId() + ":" + name2);
MeasurementData expectedData3 = makeMeasurement(time3, schedule3.getId(), value3, name3);
expectedData3.setName(resource2.getId() + ":" + name3);
+ MeasurementData expectedData4 = makeMeasurement(time4, schedule2.getId(), value4, name4);
+ expectedData4.setName(resource2.getId() + ":" + name4);
expectedResult1 = new HashSet<MeasurementData>(1);
expectedResult1.add(expectedData1);
@@ -386,6 +392,9 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
expectedResult3 = new HashSet<MeasurementData>(3);
expectedResult3.addAll(expectedResult1);
expectedResult3.addAll(expectedResult2);
+ expectedResult4 = new HashSet<MeasurementData>(2);
+ expectedResult4.add(expectedData2);
+ expectedResult4.add(expectedData4);
// mock the MeasurementAgentService
MeasurementAgentService mockedMeasurementService = mock(MeasurementAgentService.class);
@@ -475,6 +484,238 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
// ok, it was expected
}
}
+
+ @Test
+ public void testAddAndFindTrait1() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ Set<MeasurementDataTrait> expectedResult = new HashSet<MeasurementDataTrait>();
+ for (MeasurementData data : expectedResult1) {
+ data.setName(null);
+ expectedResult.add((MeasurementDataTrait) data);
+ }
+ // add the trait data (it stores it in db (without name field))
+ measurementDataManager.addTraitData(expectedResult);
+
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findTraits(overlord, resource1.getId(), definitionCt1.getId());
+
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+ @Test
+ public void testAddAndFindTrait2() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ Set<MeasurementDataTrait> expectedResult = new HashSet<MeasurementDataTrait>();
+ for (MeasurementData data : expectedResult4) {
+ data.setName(null);
+ expectedResult.add((MeasurementDataTrait) data);
+ }
+ // add the trait data (it stores it in db (without name field))
+ measurementDataManager.addTraitData(expectedResult);
+
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findTraits(overlord, resource2.getId(), definitionCt2.getId());
+
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+ @Test
+ public void testAddAndFindTrait3() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ Set<MeasurementDataTrait> traitsData = new HashSet<MeasurementDataTrait>();
+ Set<MeasurementDataTrait> expectedResult = new HashSet<MeasurementDataTrait>();
+ for (MeasurementData data : expectedResult2) {
+ data.setName(null);
+ traitsData.add((MeasurementDataTrait) data);
+ if (data.getScheduleId() == schedule2.getId()){
+ expectedResult.add((MeasurementDataTrait) data);
+ }
+ }
+
+ // add the trait data (it stores it in db (without name field))
+ measurementDataManager.addTraitData(traitsData);
+
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findTraits(overlord, resource2.getId(), definitionCt2.getId());
+
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+ @Test
+ public void testFindNonExistentTraitByResourceId() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findTraits(overlord, resource2.getId(), definitionCt2.getId());
+
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(Collections.<MeasurementData> emptySet(), actualResultSet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+
+ /**
+ * This test tests more combination of criteria
+ * @throws Exception
+ */
+ @Test
+ public void testAddAndFindByCriteria() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ Set<MeasurementDataTrait> expectedResult = new HashSet<MeasurementDataTrait>();
+ for (MeasurementData data : expectedResult1) {
+ data.setName(null);
+ expectedResult.add((MeasurementDataTrait) data);
+ }
+ // add the trait data (it stores it in db (without name field))
+ measurementDataManager.addTraitData(expectedResult);
+
+ // get back the trait data by schedule id
+ MeasurementDataTraitCriteria criteria = new MeasurementDataTraitCriteria();
+ criteria.addFilterScheduleId(schedule1.getId());
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findTraitsByCriteria(overlord, criteria);
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+
+ // get back the trait data by resource id
+ criteria = new MeasurementDataTraitCriteria();
+ criteria.addFilterResourceId(resource1.getId());
+ actualResult = measurementDataManager.findTraitsByCriteria(overlord, criteria);
+ actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+
+ // get back the trait data by schedule id and resource id
+ criteria = new MeasurementDataTraitCriteria();
+ criteria.addFilterScheduleId(schedule1.getId());
+ criteria.addFilterResourceId(resource1.getId());
+ actualResult = measurementDataManager.findTraitsByCriteria(overlord, criteria);
+ actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+
+ // get back the trait data by wrong schedule id
+ criteria = new MeasurementDataTraitCriteria();
+ criteria.addFilterScheduleId(Integer.MIN_VALUE);
+ actualResult = measurementDataManager.findTraitsByCriteria(overlord, criteria);
+ assertTrue(actualResult.isEmpty());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+ @Test
+ public void testAddAndFindCurrentTraitByResourceId() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findCurrentTraitsForResource(overlord, resource1.getId(), null);
+ assertTrue(actualResult.isEmpty());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+
+ @Test
+ public void testAddAndFindCurrentTraitByResourceIdAcrossMoreSchedules() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ Set<MeasurementDataTrait> expectedResult = new HashSet<MeasurementDataTrait>();
+ for (MeasurementData data : expectedResult2) {
+ data.setName(null);
+ expectedResult.add((MeasurementDataTrait) data);
+ }
+ // add the trait data (it stores it in db (without name field))
+ measurementDataManager.addTraitData(expectedResult);
+
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findCurrentTraitsForResource(overlord, resource2.getId(), null);
+
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
+ @Test
+ public void testFindNonExistentCurrentTraitByResourceId() throws Exception {
+ // prepare DB
+ EntityManager em = beginTx();
+ setupGroupOfResources(em);
+ commitAndClose(em);
+ try {
+ Set<MeasurementDataTrait> expectedResult = new HashSet<MeasurementDataTrait>();
+ for (MeasurementData data : expectedResult2) {
+ data.setName(null);
+ expectedResult.add((MeasurementDataTrait) data);
+ }
+ // add the trait data (it stores it in db (without name field))
+ measurementDataManager.addTraitData(expectedResult);
+
+ // get back the trait data
+ List<MeasurementDataTrait> actualResult = measurementDataManager.findCurrentTraitsForResource(overlord, resource2.getId(), null);
+
+ Set<MeasurementData> actualResultSet = new HashSet<MeasurementData>(actualResult);
+ assertEquals(expectedResult, actualResultSet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ throw e;
+ }
+ }
+
private MeasurementData makeMeasurement(long time, int scheduleId, String value, String name) {
MeasurementData measurement = new MeasurementDataTrait(new MeasurementDataPK(time, scheduleId), value);
11 years, 8 months
[rhq] 2 commits - modules/core
by lkrejci
modules/core/util/intentional-api-changes-since-4.4.0.xml | 15 ++++++++++
modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java | 3 +-
2 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 8cdbab3e33cbeb42ce8ef30a863c9d5e3420bd80
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Sep 21 14:46:44 2012 +0200
[BZ 803737] - Adding API difference justification for code change introduced
by commit bf4b25f421769909e886eb42f7b99c66b207b200.
diff --git a/modules/core/util/intentional-api-changes-since-4.4.0.xml b/modules/core/util/intentional-api-changes-since-4.4.0.xml
new file mode 100644
index 0000000..bcbe4e5
--- /dev/null
+++ b/modules/core/util/intentional-api-changes-since-4.4.0.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/core/util/exec/ProcessExecutor</className>
+ <differenceType>7006</differenceType><!-- method return type changed -->
+ <method>void redirectStreams(*)</method>
+ <to>org.rhq.core.util.exec.ProcessExecutor$RedirectThreads</to>
+ <justification>
+ This is a protected method and thus accessible only to subclasses. No known subclasses exist.
+ This is a source-compatible change though (this method used to be void so no caller could have
+ used the return type) so if there exists a subclass in the 3rd party code, it is going to
+ be enough for that code to be recompiled to start working again.
+ </justification>
+ </difference>
+</differences>
commit 9f7142e9d8f5e7dd816f2dadfb92cc4f638a7296
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Sep 21 14:43:58 2012 +0200
Adding generic signature and @Override to get rid of code-style warnings.
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java b/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java
index 308d9bd..390bb5e 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java
@@ -104,7 +104,8 @@ public class ProcessExecutor {
// wait if told to - note that the default is not to wait
if (process.getWaitForExit().intValue() > 0) {
- Callable<Integer> call = new Callable() {
+ Callable<Integer> call = new Callable<Integer>() {
+ @Override
public Integer call() throws Exception {
Thread.currentThread().setName("ExecuteProcess-" + process.getProgramTitle());
try {
11 years, 8 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 5 +++--
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
New commits:
commit 7713848c0267cf46c7723118eb1a36cb24c0fb17
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 20 17:23:55 2012 -0400
the installer should skip if the ear is currently deploying
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
index ba636a2..70b6637 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
@@ -120,9 +120,10 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
String deployDir = client.getAppServerDefaultDeploymentDir();
boolean deployedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.DEPLOYED);
boolean failedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.FAILED);
+ boolean isDeployingExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.ISDEPLOYING);
if (!failedExists) {
- if (deployedExists) {
- return ""; // everything looks OK and the ear has been successfully deployed
+ if (deployedExists || isDeployingExists) {
+ return ""; // everything looks OK and the ear either has been successfully deployed or is deploying
} else {
return null; // installer hasn't done anything yet
}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
index 855091c..1fc4388 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
@@ -83,7 +83,8 @@ public class ServerInstallUtil {
};
public enum Marker {
- DO_DEPLOY(".dodeploy"), SKIP_DEPLOY(".skipdeploy"), DEPLOYED(".deployed"), FAILED(".failed");
+ DO_DEPLOY(".dodeploy"), SKIP_DEPLOY(".skipdeploy"), DEPLOYED(".deployed"), FAILED(".failed"), ISDEPLOYING(
+ ".isdeploying");
private String extension;
@@ -117,7 +118,7 @@ public class ServerInstallUtil {
CoreJBossASClient client = new CoreJBossASClient(mcc);
// the EAR could take a long time to deploy, increase the deployment timeout
- client.setAppServerDefaultDeploymentTimeout(240); // 30 minutes should be plenty of time
+ client.setAppServerDefaultDeploymentTimeout(1800); // 30 minutes should be plenty of time
// We don't need to scan the deployment directory after everything is installed.
// TODO: We would like this to be 0, so it only scans at startup, but the installer
11 years, 8 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java | 8 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java | 17 +++++++---
2 files changed, 20 insertions(+), 5 deletions(-)
New commits:
commit 6c3264cbd00f2dff09143291cc95422a077de7f7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 20 15:17:36 2012 -0400
don't throw NoResultException, just return null
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
index 901e6d9..3071a2d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/PluginGWTServiceImpl.java
@@ -461,6 +461,10 @@ public class PluginGWTServiceImpl extends AbstractGWTServiceImpl implements Plug
// first load the full original plugin data
ServerPlugin plugin = serverPlugins.getServerPlugin(serverPluginKey);
+ if (plugin == null) {
+ throw new IllegalArgumentException("Unknown plugin key: " + serverPluginKey);
+ }
+
plugin = serverPlugins.getServerPluginRelationships(plugin);
// now overwrite the config that we want to set and tell the server about it
@@ -490,6 +494,10 @@ public class PluginGWTServiceImpl extends AbstractGWTServiceImpl implements Plug
// first load the full original plugin data
ServerPlugin plugin = serverPlugins.getServerPlugin(serverPluginKey);
+ if (plugin == null) {
+ throw new IllegalArgumentException("Unknown plugin key: " + serverPluginKey);
+ }
+
plugin = serverPlugins.getServerPluginRelationships(plugin);
// now overwrite the config that we want to set and tell the server about it
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
index 1f398cf..eb3a080 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
@@ -105,8 +105,12 @@ public class ServerPluginsBean implements ServerPluginsLocal {
public ServerPlugin getServerPlugin(PluginKey key) {
Query query = entityManager.createNamedQuery(ServerPlugin.QUERY_FIND_BY_NAME);
query.setParameter("name", key.getPluginName());
- ServerPlugin plugin = (ServerPlugin) query.getSingleResult();
- return plugin;
+ try {
+ ServerPlugin plugin = (ServerPlugin) query.getSingleResult();
+ return plugin;
+ } catch (NoResultException nre) {
+ return null;
+ }
}
public ServerPlugin getServerPluginRelationships(ServerPlugin plugin) {
@@ -167,6 +171,10 @@ public class ServerPluginsBean implements ServerPluginsLocal {
public ServerPluginDescriptorType getServerPluginDescriptor(PluginKey pluginKey) throws Exception {
ServerPlugin plugin = getServerPlugin(pluginKey);
+ if (plugin == null) {
+ throw new IllegalArgumentException("Unknown plugin key: " + pluginKey);
+ }
+
File pluginsDir = LookupUtil.getServerPluginService().getServerPluginsDirectory();
File pluginJar = new File(pluginsDir, plugin.getPath());
URL url = pluginJar.toURI().toURL();
@@ -431,9 +439,8 @@ public class ServerPluginsBean implements ServerPluginsLocal {
ServerPlugin existingPlugin = null;
boolean newOrUpdated = false;
- try {
- existingPlugin = getServerPlugin(pluginKey);
- } catch (NoResultException nre) {
+ existingPlugin = getServerPlugin(pluginKey);
+ if (existingPlugin == null) {
newOrUpdated = true; // this is expected for new plugins
}
11 years, 8 months
[rhq] Branch 'rhq-on-as7' - 2 commits - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/Server.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationScheduleEntity.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/plugin/ServerPlugin.java | 52 +--
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 56 +--
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java | 4
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java | 5
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 156 +++++++---
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java | 16 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/service/ManagementService.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/ServerPluginsBeanTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBeanTest.java | 4
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/OperationMetadataManagerBeanTest.java | 10
18 files changed, 216 insertions(+), 127 deletions(-)
New commits:
commit fe14d79a25f594d41feaa1b6320012a3dd1e5ce6
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Thu Sep 20 14:37:34 2012 -0400
H4 is more strict about the use of identification variables (aka alias)
in queries. Make sure we define them and use them if necesssary. This was
a particular problem in ServerPlugin queries.
FYI: H4 may throw a NoResultException when this issue occurs.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java
index 9682e35..790ba9a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/FailoverListDetails.java
@@ -50,7 +50,7 @@ import javax.persistence.Table;
@NamedQueries( //
{
@NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID, query = "SELECT fld FROM FailoverListDetails fld WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
- @NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID_WITH_SERVERS, query = "SELECT fld FROM FailoverListDetails fld JOIN FETCH fld.server WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
+ @NamedQuery(name = FailoverListDetails.QUERY_GET_VIA_AGENT_ID_WITH_SERVERS, query = "SELECT fld FROM FailoverListDetails fld JOIN FETCH fld.server server WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent.id = :agentId )"),
@NamedQuery(name = FailoverListDetails.QUERY_DELETE_VIA_AGENT, query = "DELETE FROM FailoverListDetails fld WHERE fld.failoverList IN ( SELECT fl FROM FailoverList fl WHERE fl.agent = :agent )"),
@NamedQuery(name = FailoverListDetails.QUERY_DELETE_VIA_SERVER, query = "DELETE FROM FailoverListDetails fld WHERE fld.server.id = :serverId"),
@NamedQuery(name = FailoverListDetails.QUERY_GET_ASSIGNED_LOADS, query = "SELECT new org.rhq.core.domain.cloud.composite.FailoverListDetailsComposite(fld.ordinal, fld.serverId, COUNT(fld.serverId)) FROM FailoverListDetails fld GROUP BY fld.ordinal, fld.serverId ORDER BY fld.ordinal ASC"),
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/Server.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/Server.java
index 520ab14..64b7224 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/Server.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/Server.java
@@ -66,7 +66,7 @@ import org.rhq.core.domain.resource.Agent;
@NamedQuery(name = Server.QUERY_FIND_BY_NAME, query = "" //
+ " SELECT s " //
+ " FROM Server s " //
- + "LEFT JOIN FETCH s.affinityGroup " //
+ + "LEFT JOIN FETCH s.affinityGroup ag " //
+ " WHERE s.name = :name"),
@NamedQuery(name = Server.QUERY_FIND_ALL_CLOUD_MEMBERS, query = "SELECT s FROM Server s WHERE NOT s.operationMode = 'INSTALLED'"),
@NamedQuery(name = Server.QUERY_FIND_ALL_NORMAL_CLOUD_MEMBERS, query = "SELECT s FROM Server s WHERE s.operationMode = 'NORMAL'"),
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java
index 0ac09c0..ed03b52 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java
@@ -61,12 +61,12 @@ import org.rhq.core.domain.configuration.Configuration;
@Entity
@NamedQueries( {
@NamedQuery(name = ContentSource.QUERY_FIND_ALL, query = "SELECT cs FROM ContentSource cs "),
- @NamedQuery(name = ContentSource.QUERY_FIND_ALL_WITH_CONFIG, query = "SELECT cs FROM ContentSource cs LEFT JOIN FETCH cs.configuration"),
+ @NamedQuery(name = ContentSource.QUERY_FIND_ALL_WITH_CONFIG, query = "SELECT cs FROM ContentSource cs LEFT JOIN FETCH cs.configuration config"),
@NamedQuery(name = ContentSource.QUERY_FIND_BY_NAME_AND_TYPENAME, query = "SELECT cs " + " FROM ContentSource cs "
- + " LEFT JOIN FETCH cs.configuration" + " WHERE cs.name = :name "
+ + " LEFT JOIN FETCH cs.configuration config" + " WHERE cs.name = :name "
+ " AND cs.contentSourceType.name = :typeName "),
@NamedQuery(name = ContentSource.QUERY_FIND_BY_ID_WITH_CONFIG, query = "SELECT cs " + " FROM ContentSource cs "
- + " LEFT JOIN FETCH cs.configuration" + " WHERE cs.id = :id "),
+ + " LEFT JOIN FETCH cs.configuration config" + " WHERE cs.id = :id "),
@NamedQuery(name = ContentSource.QUERY_FIND_BY_REPO_ID, // do not do a fetch join here
query = "SELECT cs FROM ContentSource cs LEFT JOIN cs.repoContentSources ccs WHERE ccs.repo.id = :id"),
@NamedQuery(name = ContentSource.QUERY_FIND_AVAILABLE_BY_REPO_ID, //
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
index 84f40ae..7802ea1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceType.java
@@ -56,10 +56,11 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@Entity
@NamedQueries( {
@NamedQuery(name = ContentSourceType.QUERY_FIND_ALL, query = "SELECT cst " + " FROM ContentSourceType cst "
- + " LEFT JOIN FETCH cst.contentSourceConfigurationDefinition d " + " LEFT JOIN FETCH d.templates "),
+ + " LEFT JOIN FETCH cst.contentSourceConfigurationDefinition d "
+ + " LEFT JOIN FETCH d.templates t "),
@NamedQuery(name = ContentSourceType.QUERY_FIND_BY_NAME_WITH_CONFIG_DEF, query = "SELECT cst "
+ " FROM ContentSourceType cst " + " LEFT JOIN FETCH cst.contentSourceConfigurationDefinition d "
- + " LEFT JOIN FETCH d.templates " + " WHERE cst.name = :name"),
+ + " LEFT JOIN FETCH d.templates t " + " WHERE cst.name = :name"),
@NamedQuery(name = ContentSourceType.QUERY_FIND_BY_NAME, query = "SELECT cst " + " FROM ContentSourceType cst "
+ " WHERE cst.name = :name") })
@SequenceGenerator(allocationSize = org.rhq.core.domain.util.Constants.ALLOCATION_SIZE, name = "SEQ", sequenceName = "RHQ_CONTENT_SOURCE_TYPE_ID_SEQ")
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
index de69bae..15e07c5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
@@ -97,7 +97,7 @@ public class ResourceTypeCriteria extends Criteria {
filterOverrides.put("categories", "category in ( ? )");
filterOverrides.put("parentResourceTypesEmpty", "" //
+ "id IN ( SELECT innerRt.id FROM ResourceType innerRt " //
- + " LEFT JOIN innerRt.parentResourceTypes " //
+ + " LEFT JOIN innerRt.parentResourceTypes innerParentRt" //
+ " WHERE ( ? = true AND innerRt.parentResourceTypes IS EMPTY ) " //
+ " OR ( ? = false AND innerRt.parentResourceTypes IS NOT EMPTY ) )");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
index d5bc23e..ff4d4c6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java
@@ -60,7 +60,7 @@ import org.rhq.core.domain.configuration.Configuration;
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@NamedQueries( {
- @NamedQuery(name = OperationHistory.QUERY_FIND_BY_JOB_ID, query = "SELECT h FROM OperationHistory h LEFT JOIN FETCH h.parameters "
+ @NamedQuery(name = OperationHistory.QUERY_FIND_BY_JOB_ID, query = "SELECT h FROM OperationHistory h LEFT JOIN FETCH h.parameters hp "
+ " WHERE h.jobName = :jobName " + " AND h.jobGroup = :jobGroup " + " AND h.createdTime = :createdTime"),
@NamedQuery(name = OperationHistory.QUERY_GET_RECENTLY_COMPLETED_RESOURCE_ADMIN, query = "SELECT DISTINCT new org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite( "
+ " ro.id, "
@@ -100,9 +100,9 @@ import org.rhq.core.domain.configuration.Configuration;
+ " go.operationDefinition.displayName, "
+ " go.createdTime, "
+ " go.status, "
- + " go.group.id, "
- + " go.group.name, "
- + " go.group.resourceType.name) "
+ + " g.id, "
+ + " g.name, "
+ + " g.resourceType.name) "
+ " FROM GroupOperationHistory go JOIN go.group g JOIN g.roles r JOIN r.subjects s "
+ " WHERE go.status != 'INPROGRESS' AND s = :subject "),
@NamedQuery(name = OperationHistory.QUERY_GET_PARAMETER_CONFIGURATION_IDS, query = "" //
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationScheduleEntity.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationScheduleEntity.java
index dc68031..eab6e43 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationScheduleEntity.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationScheduleEntity.java
@@ -105,9 +105,9 @@ import javax.persistence.Table;
+ " go.jobGroup, " //
+ " '', " //
+ " go.nextFireTime, " //
- + " go.group.id, " //
- + " go.group.name, " //
- + " go.group.resourceType.name) " //
+ + " g.id, " //
+ + " g.name, " //
+ + " g.resourceType.name) " //
+ " FROM GroupOperationScheduleEntity go " //
+ " JOIN go.group g " //
+ " JOIN g.roles r " //
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/ServerPlugin.java b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/ServerPlugin.java
index 34d2f17..d351ea1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/ServerPlugin.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/ServerPlugin.java
@@ -73,14 +73,14 @@ import org.rhq.core.domain.configuration.Configuration;
+ " p.md5, " //
+ " p.version, " //
+ " p.ampsVersion, " //
- + " p.pluginConfiguration, " //
- + " p.scheduledJobsConfiguration, " //
+ + " pluginConfig, " //
+ + " jobsConfig, " //
+ " p.type, " //
+ " p.ctime, " //
+ " p.mtime) " //
+ " FROM ServerPlugin AS p " //
- + " LEFT JOIN p.pluginConfiguration " //
- + " LEFT JOIN p.scheduledJobsConfiguration " //
+ + " LEFT JOIN p.pluginConfiguration AS pluginConfig " //
+ + " LEFT JOIN p.scheduledJobsConfiguration AS jobsConfig " //
+ " WHERE p.id IN (:ids) " //
+ " AND p.status = 'INSTALLED' "), //
@@ -99,14 +99,14 @@ import org.rhq.core.domain.configuration.Configuration;
+ " p.md5, " //
+ " p.version, " //
+ " p.ampsVersion, " //
- + " p.pluginConfiguration, " //
- + " p.scheduledJobsConfiguration, " //
+ + " pluginConfig, " //
+ + " jobsConfig, " //
+ " p.type, " //
+ " p.ctime, " //
+ " p.mtime) " //
+ " FROM ServerPlugin AS p " //
- + " LEFT JOIN p.pluginConfiguration " //
- + " LEFT JOIN p.scheduledJobsConfiguration " //
+ + " LEFT JOIN p.pluginConfiguration AS pluginConfig " //
+ + " LEFT JOIN p.scheduledJobsConfiguration AS jobsConfig " //
+ " WHERE p.id IN (:ids) "), //
// this query does not load the content blob, but loads everything else
@@ -123,15 +123,15 @@ import org.rhq.core.domain.configuration.Configuration;
+ " p.md5, " //
+ " p.version, " //
+ " p.ampsVersion, " //
- + " p.pluginConfiguration, " //
- + " p.scheduledJobsConfiguration, " //
+ + " pluginConfig, " //
+ + " jobsConfig, " //
+ " p.type, " //
+ " p.ctime, " //
+ " p.mtime) " //
- + " FROM ServerPlugin AS p " //
- + " LEFT JOIN p.pluginConfiguration " //
- + " LEFT JOIN p.scheduledJobsConfiguration " //
- + " WHERE p.name=:name " //
+ + " FROM ServerPlugin AS p" //
+ + " LEFT JOIN p.pluginConfiguration AS pluginConfig " //
+ + " LEFT JOIN p.scheduledJobsConfiguration AS jobsConfig " //
+ + " WHERE p.name = :name " //
+ " AND p.status = 'INSTALLED' "), //
// gets the plugin, even if it is deleted
@@ -149,14 +149,14 @@ import org.rhq.core.domain.configuration.Configuration;
+ " p.md5, " //
+ " p.version, " //
+ " p.ampsVersion, " //
- + " p.pluginConfiguration, " //
- + " p.scheduledJobsConfiguration, " //
+ + " pluginConfig, " //
+ + " jobsConfig, " //
+ " p.type, " //
+ " p.ctime, " //
+ " p.mtime) " //
+ " FROM ServerPlugin AS p " //
- + " LEFT JOIN p.pluginConfiguration " //
- + " LEFT JOIN p.scheduledJobsConfiguration " //
+ + " LEFT JOIN p.pluginConfiguration AS pluginConfig " //
+ + " LEFT JOIN p.scheduledJobsConfiguration AS jobsConfig " //
+ " WHERE p.name=:name "), //
// finds all installed AND deleted
@@ -174,14 +174,14 @@ import org.rhq.core.domain.configuration.Configuration;
+ " p.md5, " //
+ " p.version, " //
+ " p.ampsVersion, " //
- + " p.pluginConfiguration, " //
- + " p.scheduledJobsConfiguration, " //
+ + " pluginConfig, " //
+ + " jobsConfig, " //
+ " p.type, " //
+ " p.ctime, " //
+ " p.mtime) " //
+ " FROM ServerPlugin AS p " //
- + " LEFT JOIN p.pluginConfiguration " //
- + " LEFT JOIN p.scheduledJobsConfiguration "),
+ + " LEFT JOIN p.pluginConfiguration AS pluginConfig " //
+ + " LEFT JOIN p.scheduledJobsConfiguration AS jobsConfig "),
// finds all installed - ignores those plugins marked as deleted
// this query does not load the content blob, but loads everything else
@@ -198,14 +198,14 @@ import org.rhq.core.domain.configuration.Configuration;
+ " p.md5, " //
+ " p.version, " //
+ " p.ampsVersion, " //
- + " p.pluginConfiguration, " //
- + " p.scheduledJobsConfiguration, " //
+ + " pluginConfig, " //
+ + " jobsConfig, " //
+ " p.type, " //
+ " p.ctime, " //
+ " p.mtime) " //
+ " FROM ServerPlugin AS p " //
- + " LEFT JOIN p.pluginConfiguration " //
- + " LEFT JOIN p.scheduledJobsConfiguration " //
+ + " LEFT JOIN p.pluginConfiguration AS pluginConfig " //
+ + " LEFT JOIN p.scheduledJobsConfiguration AS jobsConfig " //
+ " WHERE p.status = 'INSTALLED' "), //
// returns all installed plugins, both enabled and disabled
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index 424cab2..846d910 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -235,7 +235,7 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUP_COMPOSITE, query = ""
+ " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) "
+ " FROM Resource res "
- + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a "
+ + " JOIN res.resourceType rt LEFT JOIN rt.subCategory sc JOIN res.currentAvailability a "
+ " WHERE res.id = :id "
+ " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)"
+ "GROUP BY res.parentResource, rt "),
@@ -248,16 +248,16 @@ import org.rhq.core.domain.util.Summary;
+ "GROUP BY res.parentResource, rt "),
@NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUP_COMPOSITE_ADMIN, query = "" //
+ " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) "
- + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory "
+ + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory sc "
+ " WHERE res.id = :id " + "GROUP BY res.parentResource, rt"),
@NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUPS_COMPOSITE_ADMIN, query = "" //
+ " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) "
- + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory "
+ + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory sc "
+ " WHERE res.id IN ( :ids ) " + "GROUP BY res.parentResource, rt"),
@NamedQuery(name = Resource.QUERY_FIND_CHILDREN_AUTOGROUP_COMPOSITES, query = ""
+ " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) "
+ " FROM Resource res "
- + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a "
+ + " JOIN res.resourceType rt LEFT JOIN rt.subCategory sc JOIN res.currentAvailability a "
+ " WHERE res.parentResource = :parent " //
+ " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)"
+ " AND res.inventoryStatus = :inventoryStatus " //
@@ -272,7 +272,7 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = Resource.QUERY_FIND_CHILDREN_AUTOGROUP_COMPOSITES_BY_TYPE, query = ""
+ " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) "
+ " FROM Resource res "
- + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a "
+ + " JOIN res.resourceType rt LEFT JOIN rt.subCategory sc JOIN res.currentAvailability a "
+ " WHERE res.parentResource = :parent " //
+ " AND rt.id IN ( :resourceTypeIds ) " //
+ " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)"
@@ -282,7 +282,7 @@ import org.rhq.core.domain.util.Summary;
+ " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) "
+ " FROM Resource res " //
+ " JOIN res.currentAvailability a " //
- + " JOIN res.resourceType rt LEFT JOIN rt.subCategory " //
+ + " JOIN res.resourceType rt LEFT JOIN rt.subCategory sc " //
+ " WHERE res.parentResource = :parent " //
+ " AND rt.id IN ( :resourceTypeIds ) " //
+ " AND res.inventoryStatus = :inventoryStatus GROUP BY res.parentResource, rt"),
@@ -541,14 +541,14 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = Resource.QUERY_FIND_BY_ID, query = "" //
+ " SELECT res " //
+ " FROM Resource res " //
- + "LEFT JOIN FETCH res.currentAvailability " // fetch to remove extra query, LEFT so unit tests needn't set it
- + " JOIN FETCH res.resourceType " // fetch to remove extra query
+ + "LEFT JOIN FETCH res.currentAvailability ca " // fetch to remove extra query, LEFT so unit tests needn't set it
+ + " JOIN FETCH res.resourceType rt " // fetch to remove extra query
+ " WHERE res.id = :resourceId "),
@NamedQuery(name = Resource.QUERY_FIND_BY_IDS, query = "" //
+ " SELECT res " //
+ " FROM Resource res " //
- + "LEFT JOIN FETCH res.currentAvailability " // fetch to remove extra query, LEFT so unit tests needn't set it
- + " JOIN FETCH res.resourceType " // fetch to remove extra query
+ + "LEFT JOIN FETCH res.currentAvailability ca " // fetch to remove extra query, LEFT so unit tests needn't set it
+ + " JOIN FETCH res.resourceType rt " // fetch to remove extra query
+ " WHERE res.id IN ( :ids ) " //
+ " AND res.id IN ( SELECT rr.id FROM Resource rr " //
+ " JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s " //
@@ -556,17 +556,17 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = Resource.QUERY_FIND_BY_IDS_ADMIN, query = "" //
+ " SELECT res " //
+ " FROM Resource res " //
- + "LEFT JOIN FETCH res.currentAvailability " // fetch to remove extra query, LEFT so unit tests needn't set it
- + " JOIN FETCH res.resourceType " // fetch to remove extra query
+ + "LEFT JOIN FETCH res.currentAvailability ca " // fetch to remove extra query, LEFT so unit tests needn't set it
+ + " JOIN FETCH res.resourceType rt " // fetch to remove extra query
+ " WHERE res.id IN ( :ids )"),
@NamedQuery(name = Resource.QUERY_FIND_WITH_PARENT_BY_IDS, query = "" //
+ " SELECT res " //
+ " FROM Resource res " //
- + "LEFT JOIN FETCH res.currentAvailability " // fetch to remove extra query, LEFT so unit tests needn't set it
- + " JOIN FETCH res.resourceType " // fetch to remove extra query
+ + "LEFT JOIN FETCH res.currentAvailability ca " // fetch to remove extra query, LEFT so unit tests needn't set it
+ + " JOIN FETCH res.resourceType rt " // fetch to remove extra query
+ "LEFT JOIN FETCH res.parentResource parent " //
- + "LEFT JOIN FETCH parent.currentAvailability " // left fetch to remove extra query for parent
- + "LEFT JOIN FETCH parent.resourceType " // left fetch to remove extra query for parent
+ + "LEFT JOIN FETCH parent.currentAvailability pca " // left fetch to remove extra query for parent
+ + "LEFT JOIN FETCH parent.resourceType prt " // left fetch to remove extra query for parent
+ " WHERE res.id IN ( :ids ) " //
+ " AND res.id IN ( SELECT rr.id FROM Resource rr " //
+ " JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s " //
@@ -574,11 +574,11 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = Resource.QUERY_FIND_WITH_PARENT_BY_IDS_ADMIN, query = "" //
+ " SELECT res " //
+ " FROM Resource res " //
- + "LEFT JOIN FETCH res.currentAvailability " // fetch to remove extra query, LEFT so unit tests needn't set it
- + " JOIN FETCH res.resourceType " // fetch to remove extra query
+ + "LEFT JOIN FETCH res.currentAvailability ca " // fetch to remove extra query, LEFT so unit tests needn't set it
+ + " JOIN FETCH res.resourceType rt " // fetch to remove extra query
+ "LEFT JOIN FETCH res.parentResource parent " //
- + "LEFT JOIN FETCH parent.currentAvailability " // left fetch to remove extra query for parent
- + "LEFT JOIN FETCH parent.resourceType " // left fetch to remove extra query for parent
+ + "LEFT JOIN FETCH parent.currentAvailability pca " // left fetch to remove extra query for parent
+ + "LEFT JOIN FETCH parent.resourceType prt " // left fetch to remove extra query for parent
+ " WHERE res.id IN ( :ids )"),
@NamedQuery(name = Resource.QUERY_FIND_COMPOSITE, query = "" //
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceComposite(res, a.availabilityType, " //
@@ -751,23 +751,23 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_IN_COMPLIANCE, query = ""
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceInstallCount("
- + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(distinct r), "
+ + "rt.name, rt.plugin, rt.category, rt.id, count(distinct r), "
+ "r.version, size(templates), 0) "
- + "FROM Resource r JOIN r.resourceType type JOIN type.driftDefinitionTemplates templates "
+ + "FROM Resource r JOIN r.resourceType rt JOIN rt.driftDefinitionTemplates templates "
+ "WHERE r.inventoryStatus = 'COMMITTED' AND " //
+ " 0 = ( SELECT COUNT(defs) FROM r.driftDefinitions defs WHERE NOT defs.complianceStatus = 0) "
- + "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, r.version "
- + "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name, r.version "),
+ + "GROUP BY rt.name, rt.plugin, rt.category, rt.id, r.version "
+ + "ORDER BY rt.category, rt.plugin, rt.name, r.version "),
@NamedQuery(name = Resource.QUERY_RESOURCE_VERSION_AND_DRIFT_OUT_OF_COMPLIANCE, query = ""
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceInstallCount("
- + "r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, count(distinct r), "
+ + "rt.name, rt.plugin, rt.category, rt.id, count(distinct r), "
+ "r.version, size(templates), 1) "
- + "FROM Resource r JOIN r.resourceType type JOIN type.driftDefinitionTemplates templates "
+ + "FROM Resource r JOIN r.resourceType rt JOIN rt.driftDefinitionTemplates templates "
+ "WHERE r.inventoryStatus = 'COMMITTED' AND " //
+ " 0 < ( SELECT COUNT(defs) FROM r.driftDefinitions defs WHERE defs.complianceStatus <> 0) "
- + "GROUP BY r.resourceType.name, r.resourceType.plugin, r.resourceType.category, r.resourceType.id, r.version "
- + "ORDER BY r.resourceType.category, r.resourceType.plugin, r.resourceType.name, r.version ") })
+ + "GROUP BY rt.name, rt.plugin, rt.category, rt.id, r.version "
+ + "ORDER BY rt.category, rt.plugin, rt.name, r.version ") })
@SequenceGenerator(allocationSize = org.rhq.core.domain.util.Constants.ALLOCATION_SIZE, name = "RHQ_RESOURCE_SEQ", sequenceName = "RHQ_RESOURCE_ID_SEQ")
@Table(name = Resource.TABLE_NAME)
@XmlAccessorType(XmlAccessType.FIELD)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index 64d6079..1efaf2d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -169,8 +169,8 @@ import org.rhq.core.domain.util.Summary;
+ "WHERE rt.subCategory = :subCategory AND rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_ID_WITH_ALL_OPERATIONS, query = "SELECT DISTINCT rt "
+ "FROM ResourceType rt " + "LEFT JOIN FETCH rt.operationDefinitions def "
- + "LEFT JOIN FETCH def.parametersConfigurationDefinition "
- + "LEFT JOIN FETCH def.resultsConfigurationDefinition " + "WHERE rt.id = :id AND rt.deleted = false"),
+ + "LEFT JOIN FETCH def.parametersConfigurationDefinition psDef "
+ + "LEFT JOIN FETCH def.resultsConfigurationDefinition rcDef " + "WHERE rt.id = :id AND rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_RESOURCE_FACETS, query = "" //
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceFacets " //
+ " ( " //
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
index e80ad53..855091c 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
@@ -117,7 +117,7 @@ public class ServerInstallUtil {
CoreJBossASClient client = new CoreJBossASClient(mcc);
// the EAR could take a long time to deploy, increase the deployment timeout
- client.setAppServerDefaultDeploymentTimeout(1800); // 30 minutes should be plenty of time
+ client.setAppServerDefaultDeploymentTimeout(240); // 30 minutes should be plenty of time
// We don't need to scan the deployment directory after everything is installed.
// TODO: We would like this to be 0, so it only scans at startup, but the installer
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/ServerPluginsBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/ServerPluginsBeanTest.java
index 935721c..9ce4829 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/ServerPluginsBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/ServerPluginsBeanTest.java
@@ -78,7 +78,7 @@ public class ServerPluginsBeanTest extends AbstractEJB3Test {
em = getEntityManager();
Query q = em
- .createQuery("SELECT p FROM ServerPlugin p LEFT JOIN FETCH p.pluginConfiguration LEFT JOIN FETCH p.scheduledJobsConfiguration WHERE p.name LIKE 'serverplugintest%'");
+ .createQuery("SELECT p FROM ServerPlugin p LEFT JOIN FETCH p.pluginConfiguration ppc LEFT JOIN FETCH p.scheduledJobsConfiguration psjc WHERE p.name LIKE 'serverplugintest%'");
List<ServerPlugin> doomed = q.getResultList();
for (ServerPlugin plugin : doomed) {
em.remove(em.getReference(ServerPlugin.class, plugin.getId()));
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBeanTest.java
index 712606d..6f5582a 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBeanTest.java
@@ -111,7 +111,7 @@ public class ContentMetadataManagerBeanTest extends MetadataBeanTest {
PackageType loadPackageType(String resourceType, String plugin, String packageType) {
return (PackageType) getEntityManager()
.createQuery(
- "from PackageType p left join fetch p.deploymentConfigurationDefinition "
+ "from PackageType p left join fetch p.deploymentConfigurationDefinition pdcd "
+ "where p.name = :packageType and " + "p.resourceType.name = :resourceType and "
+ "p.resourceType.plugin = :plugin").setParameter("packageType", packageType)
.setParameter("plugin", plugin).setParameter("resourceType", resourceType).getSingleResult();
@@ -120,7 +120,7 @@ public class ContentMetadataManagerBeanTest extends MetadataBeanTest {
ResourceType loadResourceTypeWithBundleType(String resourceType, String plugin) {
return (ResourceType) getEntityManager()
.createQuery(
- "from ResourceType t left join fetch t.bundleType where t.name = :resourceType and t.plugin = :plugin")
+ "from ResourceType t left join fetch t.bundleType tbt where t.name = :resourceType and t.plugin = :plugin")
.setParameter("resourceType", resourceType).setParameter("plugin", plugin).getSingleResult();
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/OperationMetadataManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/OperationMetadataManagerBeanTest.java
index b2b02d9..59f5d44 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/OperationMetadataManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/OperationMetadataManagerBeanTest.java
@@ -1,7 +1,9 @@
package org.rhq.enterprise.server.resource.metadata;
+import static java.util.Arrays.asList;
+import static java.util.Collections.EMPTY_LIST;
+
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import org.testng.annotations.Test;
@@ -10,9 +12,6 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.ResourceType;
-import static java.util.Arrays.asList;
-import static java.util.Collections.EMPTY_LIST;
-
public class OperationMetadataManagerBeanTest extends MetadataBeanTest {
@Test(groups = {"plugin.metadata", "Operations.NewPlugin"})
@@ -114,7 +113,8 @@ public class OperationMetadataManagerBeanTest extends MetadataBeanTest {
ResourceType loadResourceTypeWithOperationDefs(String resourceType, String plugin) {
return (ResourceType) getEntityManager().createQuery(
- "from ResourceType t left join fetch t.operationDefinitions " +
+ "from ResourceType t left join fetch t.operationDefinitions tod "
+ +
"where t.name = :resourceType and t.plugin = :plugin")
.setParameter("resourceType", resourceType)
.setParameter("plugin", plugin)
commit 2a6ad04a961939d27bac537a31f74eb773487ee0
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Wed Sep 19 16:10:00 2012 -0400
Call ModelControllerClient.close() when done with it.
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
index add78a6..f7d0c38 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
@@ -50,6 +50,11 @@ public class ManagementService implements ServiceActivator {
private static volatile ModelController controller;
private static volatile ExecutorService executor;
+ /**
+ * The caller should call ModelControllerClient.close() when finished with the client.
+ *
+ * @return the ModelControllerClient
+ */
public static ModelControllerClient getClient() {
return controller.createClient(executor);
}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
index 830b76b..ba636a2 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
@@ -111,23 +111,30 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
@Override
public String getInstallationResults() throws Exception {
- // use JBossAS's marker files to determine the status of the application EAR
- CoreJBossASClient client = new CoreJBossASClient(getClient());
- String deployDir = client.getAppServerDefaultDeploymentDir();
- boolean deployedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.DEPLOYED);
- boolean failedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.FAILED);
- if (!failedExists) {
- if (deployedExists) {
- return ""; // everything looks OK and the ear has been successfully deployed
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+
+ // use JBossAS's marker files to determine the status of the application EAR
+ CoreJBossASClient client = new CoreJBossASClient(mcc);
+ String deployDir = client.getAppServerDefaultDeploymentDir();
+ boolean deployedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.DEPLOYED);
+ boolean failedExists = ServerInstallUtil.markerFileExists(deployDir, EAR_NAME, Marker.FAILED);
+ if (!failedExists) {
+ if (deployedExists) {
+ return ""; // everything looks OK and the ear has been successfully deployed
+ } else {
+ return null; // installer hasn't done anything yet
+ }
} else {
- return null; // installer hasn't done anything yet
- }
- } else {
- String error = slurpFile(ServerInstallUtil.getMarkerFile(deployDir, EAR_NAME, Marker.FAILED));
- if (error.length() == 0) {
- error = "Unknown installation error";
+ String error = slurpFile(ServerInstallUtil.getMarkerFile(deployDir, EAR_NAME, Marker.FAILED));
+ if (error.length() == 0) {
+ error = "Unknown installation error";
+ }
+ return error;
}
- return error;
+ } finally {
+ safeClose(mcc);
}
}
@@ -317,7 +324,13 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
ServerInstallUtil.createKeystore(serverDetails, getAppServerConfigDir());
// Make sure our deployment scanner is configured to be ready for deploy our services and application
- ServerInstallUtil.configureDeploymentScanner(getClient());
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+ ServerInstallUtil.configureDeploymentScanner(mcc);
+ } finally {
+ safeClose(mcc);
+ }
// now create our deployment services and our main EAR
deployServices(serverProperties);
@@ -438,34 +451,64 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
@Override
public String getAppServerVersion() throws Exception {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
- final String version = client.getAppServerVersion();
- return version;
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
+ final String version = client.getAppServerVersion();
+ return version;
+ } finally {
+ safeClose(mcc);
+ }
}
@Override
public String getOperatingSystem() throws Exception {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
- final String osName = client.getOperatingSystem();
- return osName;
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
+ final String osName = client.getOperatingSystem();
+ return osName;
+ } finally {
+ safeClose(mcc);
+ }
}
private String getAppServerHomeDir() throws Exception {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
- final String dir = client.getAppServerHomeDir();
- return dir;
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
+ final String dir = client.getAppServerHomeDir();
+ return dir;
+ } finally {
+ safeClose(mcc);
+ }
}
private String getAppServerConfigDir() throws Exception {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
- final String dir = client.getAppServerConfigDir();
- return dir;
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
+ final String dir = client.getAppServerConfigDir();
+ return dir;
+ } finally {
+ safeClose(mcc);
+ }
}
private String getLogDir() throws Exception {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
- final String dir = client.getAppServerLogDir();
- return dir;
+ ModelControllerClient mcc = null;
+ try {
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
+ final String dir = client.getAppServerLogDir();
+ return dir;
+ } finally {
+ safeClose(mcc);
+ }
}
private File getServerPropertiesFile() throws Exception {
@@ -559,48 +602,63 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
return serverDetails;
}
- private ModelControllerClient getClient() {
+ private ModelControllerClient getModelControllerClient() {
final ModelControllerClient client = ManagementService.getClient();
return client;
}
private void deployServices(HashMap<String, String> serverProperties) throws Exception {
+
+ ModelControllerClient mcc = null;
try {
- ModelControllerClient client = getClient();
+ mcc = getModelControllerClient();
// create the security domain needed by the datasources
- ServerInstallUtil.createDatasourceSecurityDomain(client, serverProperties);
+ ServerInstallUtil.createDatasourceSecurityDomain(mcc, serverProperties);
// create the security domain needed by REST
- ServerInstallUtil.createRESTSecurityDomain(client, serverProperties);
+ ServerInstallUtil.createRESTSecurityDomain(mcc, serverProperties);
// set up REST cache
- ServerInstallUtil.createNewCaches(client, serverProperties);
+ ServerInstallUtil.createNewCaches(mcc, serverProperties);
// create the JDBC driver configurations for use by datasources
- ServerInstallUtil.createNewJdbcDrivers(client, serverProperties);
+ ServerInstallUtil.createNewJdbcDrivers(mcc, serverProperties);
// create the datasources
- ServerInstallUtil.createNewDatasources(client, serverProperties);
+ ServerInstallUtil.createNewDatasources(mcc, serverProperties);
// create the JMS queues
- ServerInstallUtil.createNewJMSQueues(client, serverProperties);
+ ServerInstallUtil.createNewJMSQueues(mcc, serverProperties);
// setup the email service
- ServerInstallUtil.setupMailService(client, serverProperties);
+ ServerInstallUtil.setupMailService(mcc, serverProperties);
// we don't want to the JBossAS welcome screen; turn it off
- new WebJBossASClient(client).setEnableWelcomeRoot(false);
+ new WebJBossASClient(mcc).setEnableWelcomeRoot(false);
} catch (Exception e) {
log("deployServices failed", e);
throw new Exception("Failed to deploy services: " + ThrowableUtil.getAllMessages(e));
+ } finally {
+ safeClose(mcc);
+ }
+ }
+
+ private static void safeClose(final ModelControllerClient mcc) {
+ if (null != mcc) {
+ try {
+ mcc.close();
+ } catch (Exception e) {
+ }
}
}
private void deployApp() throws Exception {
+ ModelControllerClient mcc = null;
try {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
final String deployDir = client.getAppServerDefaultDeploymentDir();
if (deployDir == null) {
throw new IllegalStateException("Missing the deployment scanner - cannot finish install");
@@ -620,22 +678,30 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
} catch (Exception e) {
log("deployApp failed", e);
throw new Exception("Failed to deploy the app: " + ThrowableUtil.getAllMessages(e));
+ } finally {
+ safeClose(mcc);
}
}
private void reloadConfiguration() throws Exception {
+ ModelControllerClient mcc = null;
try {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
client.reload();
} catch (Exception e) {
log("reloadConfiguration failed - restart the server to complete the installation", e);
+ } finally {
+ safeClose(mcc);
}
}
// left this here in case we want to undeploy the installer in the future; for now, we don't use this
private void undeployInstaller() throws Exception {
+ ModelControllerClient mcc = null;
try {
- final CoreJBossASClient client = new CoreJBossASClient(getClient());
+ mcc = getModelControllerClient();
+ final CoreJBossASClient client = new CoreJBossASClient(mcc);
final String deployDir = client.getAppServerDefaultDeploymentDir();
if (deployDir == null) {
throw new IllegalStateException("Missing the deployment scanner - cannot undeploy installer");
@@ -663,6 +729,8 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
} catch (Exception e) {
log("undeployInstaller failed", e);
throw new Exception("Failed to undeploy the installer: " + ThrowableUtil.getAllMessages(e));
+ } finally {
+ safeClose(mcc);
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java
index 339a73b..ddd0815 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java
@@ -50,8 +50,6 @@ import org.rhq.enterprise.server.util.security.UntrustedSSLSocketFactory;
* module is only deployed if LDAP is enabled in the RHQ configuration.
*/
public class CustomJaasDeploymentService implements CustomJaasDeploymentServiceMBean, MBeanRegistration {
- private static final String AUTH_METHOD = "addAppConfig";
- private static final String AUTH_OBJECTNAME = "jboss.security:service=XMLLoginConfig";
private Log log = LogFactory.getLog(CustomJaasDeploymentService.class.getName());
private MBeanServer mbeanServer = null;
@@ -105,8 +103,9 @@ public class CustomJaasDeploymentService implements CustomJaasDeploymentServiceM
private void registerJaasModules(Properties systemConfig) throws Exception {
+ ModelControllerClient mcc = null;
try {
- final ModelControllerClient mcc = ManagementService.getClient();
+ mcc = ManagementService.getClient();
final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc);
final String securityDomain = RHQ_USER_SECURITY_DOMAIN;
@@ -163,6 +162,17 @@ public class CustomJaasDeploymentService implements CustomJaasDeploymentServiceM
}
} catch (Exception e) {
throw new Exception("Error registering RHQ JAAS modules", e);
+ } finally {
+ safeClose(mcc);
+ }
+ }
+
+ private static void safeClose(final ModelControllerClient mcc) {
+ if (null != mcc) {
+ try {
+ mcc.close();
+ } catch (Exception e) {
+ }
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/service/ManagementService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/service/ManagementService.java
index fd6f052..f22cff0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/service/ManagementService.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/service/ManagementService.java
@@ -50,6 +50,11 @@ public class ManagementService implements ServiceActivator {
private static volatile ModelController controller;
private static volatile ExecutorService executor;
+ /**
+ * The caller should call ModelControllerClient.close() when finished with the client.
+ *
+ * @return the ModelControllerClient
+ */
public static ModelControllerClient getClient() {
return controller.createClient(executor);
}
11 years, 8 months
[rhq] modules/core modules/enterprise modules/plugins pom.xml
by lkrejci
modules/core/domain/intentional-api-changes-since-4.4.0.xml | 22 ++++++++++
modules/core/plugin-api/intentional-api-changes-since-4.4.0.xml | 15 ++++++
modules/enterprise/server/jar/intentional-api-changes-since-4.4.0.xml | 14 ++++++
modules/enterprise/server/jar/pom.xml | 10 ++++
modules/plugins/database/intentional-api-changes-since-4.4.0.xml | 14 ++++++
modules/plugins/jboss-as-5/intentional-api-changes-since-4.4.0.xml | 16 +++++++
pom.xml | 10 ++++
7 files changed, 100 insertions(+), 1 deletion(-)
New commits:
commit dad63bee36143bd4619e62c924cf34b0d65f4f8e
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Sep 20 15:28:13 2012 +0200
[BZ 803737] - Adding the ignore rules for intentional API changes (apart from AS7 plugin that I leave for other to investigate and fill in).
diff --git a/modules/core/domain/intentional-api-changes-since-4.4.0.xml b/modules/core/domain/intentional-api-changes-since-4.4.0.xml
new file mode 100644
index 0000000..6d70888
--- /dev/null
+++ b/modules/core/domain/intentional-api-changes-since-4.4.0.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/core/domain/configuration/ObfuscatedPropertySimple</className>
+ <differenceType>7004</differenceType><!-- number of args changed -->
+ <method>void *obfuscate()</method>
+ <justification>Protected methods used only by JPA and other internal logic. It is not visible or supposed to be used outside of this class.</justification>
+ </difference>
+ <difference>
+ <className>org/rhq/core/domain/configuration/ObfuscatedPropertySimple</className>
+ <differenceType>7006</differenceType><!-- return type changed -->
+ <method>void *obfuscate()</method>
+ <to>java.lang.String</to>
+ <justification>Protected methods used only by JPA and other internal logic. It is not visible or supposed to be used outside of this class.</justification>
+ </difference>
+ <difference>
+ <className>**/*</className>
+ <differenceType>6003</differenceType><!-- value of compile-time constant changed -->
+ <field>*</field>
+ <justification>The constants we declare on the domain objects are not supposed for public consumption.</justification>
+ </difference>
+</differences>
diff --git a/modules/core/plugin-api/intentional-api-changes-since-4.4.0.xml b/modules/core/plugin-api/intentional-api-changes-since-4.4.0.xml
new file mode 100644
index 0000000..33dd783
--- /dev/null
+++ b/modules/core/plugin-api/intentional-api-changes-since-4.4.0.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/core/pluginapi/inventory/ResourceContext</className>
+ <differenceType>7004</differenceType><!-- number of args changed -->
+ <method>ResourceContext(*)</method>
+ <justification>Instances of this class are provided by the API, it is not supposed to be instantiated by users.</justification>
+ </difference>
+ <difference>
+ <className>org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext</className>
+ <differenceType>7004</differenceType><!-- number of args changed -->
+ <method>ResourceUpgradeContext(*)</method>
+ <justification>Instances of this class are provided by the API, it is not supposed to be instantiated by users.</justification>
+ </difference>
+</differences>
diff --git a/modules/enterprise/server/jar/intentional-api-changes-since-4.4.0.xml b/modules/enterprise/server/jar/intentional-api-changes-since-4.4.0.xml
new file mode 100644
index 0000000..743c970
--- /dev/null
+++ b/modules/enterprise/server/jar/intentional-api-changes-since-4.4.0.xml
@@ -0,0 +1,14 @@
+<differences>
+ <difference>
+ <className>org/rhq/enterprise/server/content/RepoManagerRemote</className>
+ <differenceType>7012</differenceType><!-- method added to an interface -->
+ <method>byte[] getPackageVersionBytes(org.rhq.core.domain.auth.Subject, int, int)</method>
+ <justification>Adding a method to a remote API interface is safe. This class is never to be implemented by users.</justification>
+ </difference>
+ <difference>
+ <className>org/rhq/enterprise/server/measurement/MeasurementDataManagerRemote</className>
+ <differenceType>7012</differenceType><!-- method added to an interface -->
+ <method>java.util.Set findLiveDataForGroup(org.rhq.core.domain.auth.Subject, int, int[], int[])</method>
+ <justification>Adding a method to a remote API interface is safe. This class is never to be implemented by users.</justification>
+ </difference>
+</differences>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 4efad25..0a067fe 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -916,6 +916,16 @@
<include>**/*Remote</include>
<include>**/ServerVersion</include>
</includes>
+ <ignored>
+ <!-- This is intentionally ignored in any version of RHQ. We never
+ even report it. -->
+ <difference>
+ <className>**/ServerVersion</className>
+ <differenceType>6003</differenceType> <!-- Constant field value changed -->
+ <field>namespace</field>
+ <justification>The namespace changes with every version, so this is definitely an intentional change.</justification>
+ </difference>
+ </ignored>
</configuration>
</plugin>
</plugins>
diff --git a/modules/plugins/database/intentional-api-changes-since-4.4.0.xml b/modules/plugins/database/intentional-api-changes-since-4.4.0.xml
new file mode 100644
index 0000000..d1f007a
--- /dev/null
+++ b/modules/plugins/database/intentional-api-changes-since-4.4.0.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/plugins/database/DatabaseQueryUtility</className>
+ <differenceType>7009</differenceType><!-- decreased visibility -->
+ <method>DatabaseQueryUtility()</method>
+ <justification>This is a static utility class, so holding a reference to it doesn't make sense. People should correct their code if they did so.</justification>
+ </difference>
+ <difference>
+ <className>org/rhq/plugins/database/DatabaseQueryUtility$StatementParameter</className>
+ <differenceType>8001</differenceType><!-- class removed -->
+ <justification>Removed an unused class.</justification>
+ </difference>
+</differences>
diff --git a/modules/plugins/jboss-as-5/intentional-api-changes-since-4.4.0.xml b/modules/plugins/jboss-as-5/intentional-api-changes-since-4.4.0.xml
new file mode 100644
index 0000000..a6fa4c9
--- /dev/null
+++ b/modules/plugins/jboss-as-5/intentional-api-changes-since-4.4.0.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/plugins/jbossas5/Ejb2BeanComponent</className>
+ <differenceType>7004</differenceType><!-- number of arguments changed -->
+ <method>org.jboss.managed.api.ManagedComponent getManagedComponent()</method>
+ <justification>
+ This difference is due to fixes applied for bug 835113. The old method signature cannot be added back because it would re-introduce the problem fixed by bug 835113.
+ This method is just protected so it is not visible (or available for use) outside of inheriting classes.
+ Also, this method is just an override for a base method from ManagedComponentComponent. The base class, ManagedComponentComponent, still has both methods available for use.
+ The fix for bug 835113 had the Ejb2BeanComponent override a different base method.
+
+ Based on this, no action to be taken for this difference.
+ </justification>
+ </difference>
+</differences>
diff --git a/pom.xml b/pom.xml
index 61343ef..b1a59d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -191,6 +191,10 @@
<!-- a default value for the child modules indicating that the module is not
part of our public API and is therefore not API-checked. -->
<rhq.internal>true</rhq.internal>
+
+ <!-- The name of the file in the module's root dir that contains the intentional
+ api changes to be ignored by Clirr api checks -->
+ <intentional-api-changes-file>intentional-api-changes-since-${signature-check-base-version}.xml</intentional-api-changes-file>
</properties>
@@ -1373,8 +1377,12 @@
</comparisonArtifacts>
<logResults>true</logResults>
<xmlOutputFile>${project.build.directory}/${project.build.finalName}.signature-check.xml</xmlOutputFile>
- <failOnError>false</failOnError>
+ <failOnError>true</failOnError>
+ <failOnWarning>true</failOnWarning>
<skip>${rhq.internal}</skip>
+ <!-- note that this is only available in clirr maven plugin 2.5, but internally we use a patched version for our CI builds.
+ Once new Clirr maven plugin is released, this will work for you, too. -->
+ <ignoredDifferencesFile>${intentional-api-changes-file}</ignoredDifferencesFile>
</configuration>
</execution>
</executions>
11 years, 8 months