modules/plugins/apache/pom.xml
| 6
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
| 73 +++++
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheFilesComponent.java
| 74 +++++
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheLocationComponent.java
| 74 +++++
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
| 15 +
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
| 134 +++++++++-
6 files changed, 373 insertions(+), 3 deletions(-)
New commits:
commit 8f4d6d32e8c793c7093a15c4116e388e3d758eec
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon Nov 30 20:37:52 2009 +0100
More work on apache res conf, future components stubs...
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index 2ed59c1..dec0090 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -32,6 +32,12 @@
<version>1.8.2</version>
</dependency>
+ <dependency>
+ <groupId>${rhq.groupId}</groupId>
+ <artifactId>rhq-platform-plugin</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
new file mode 100644
index 0000000..ea21527
--- /dev/null
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
@@ -0,0 +1,73 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.plugins.apache;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.platform.PlatformComponent;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class ApacheDirectoryComponent implements
ResourceComponent<ApacheServerComponent>, ConfigurationFacet {
+
+ ResourceContext<ApacheServerComponent> resourceContext;
+
+ public void start(ResourceContext<ApacheServerComponent> context) throws
InvalidPluginConfigurationException, Exception {
+ // TODO Auto-generated method stub
+ resourceContext = context;
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+ }
+
+ public AvailabilityType getAvailability() {
+ //TODO implement this
+ return AvailabilityType.UP;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.rhq.core.pluginapi.configuration.ConfigurationFacet#loadResourceConfiguration()
+ */
+ public Configuration loadResourceConfiguration() throws Exception {
+ // TODO Auto-generated method stub
+ return
resourceContext.getResourceType().getResourceConfigurationDefinition().getDefaultTemplate().createConfiguration();
+ }
+
+ /* (non-Javadoc)
+ * @see
org.rhq.core.pluginapi.configuration.ConfigurationFacet#updateResourceConfiguration(org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport)
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheFilesComponent.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheFilesComponent.java
new file mode 100644
index 0000000..e0be3ee
--- /dev/null
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheFilesComponent.java
@@ -0,0 +1,74 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.plugins.apache;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.platform.PlatformComponent;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class ApacheFilesComponent implements
ResourceComponent<ApacheServerComponent>, ConfigurationFacet {
+
+ ResourceContext<ApacheServerComponent> resourceContext;
+
+ public void start(ResourceContext<ApacheServerComponent> context) throws
InvalidPluginConfigurationException, Exception {
+ // TODO Auto-generated method stub
+ resourceContext = context;
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+ }
+
+ public AvailabilityType getAvailability() {
+ //TODO implement this
+ return AvailabilityType.UP;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.rhq.core.pluginapi.configuration.ConfigurationFacet#loadResourceConfiguration()
+ */
+ public Configuration loadResourceConfiguration() throws Exception {
+ // TODO Auto-generated method stub
+ return
resourceContext.getResourceType().getResourceConfigurationDefinition().getDefaultTemplate().createConfiguration();
+ }
+
+ /* (non-Javadoc)
+ * @see
org.rhq.core.pluginapi.configuration.ConfigurationFacet#updateResourceConfiguration(org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport)
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ // TODO Auto-generated method stub
+ }
+
+
+}
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheLocationComponent.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheLocationComponent.java
new file mode 100644
index 0000000..9df9d98
--- /dev/null
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheLocationComponent.java
@@ -0,0 +1,74 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.plugins.apache;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.platform.PlatformComponent;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+public class ApacheLocationComponent implements
ResourceComponent<ApacheServerComponent>, ConfigurationFacet {
+
+ ResourceContext<ApacheServerComponent> resourceContext;
+
+ public void start(ResourceContext<ApacheServerComponent> context) throws
InvalidPluginConfigurationException, Exception {
+ // TODO Auto-generated method stub
+ resourceContext = context;
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+ }
+
+ public AvailabilityType getAvailability() {
+ //TODO implement this
+ return AvailabilityType.UP;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.rhq.core.pluginapi.configuration.ConfigurationFacet#loadResourceConfiguration()
+ */
+ public Configuration loadResourceConfiguration() throws Exception {
+ // TODO Auto-generated method stub
+ return
resourceContext.getResourceType().getResourceConfigurationDefinition().getDefaultTemplate().createConfiguration();
+ }
+
+ /* (non-Javadoc)
+ * @see
org.rhq.core.pluginapi.configuration.ConfigurationFacet#updateResourceConfiguration(org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport)
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ // TODO Auto-generated method stub
+ }
+
+
+}
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index c8fe799..22a5194 100644
---
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -40,6 +40,8 @@ import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.event.EventContext;
import org.rhq.core.pluginapi.event.EventPoller;
import org.rhq.core.pluginapi.event.log.LogFileEventPoller;
@@ -53,6 +55,7 @@ import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.core.system.OperatingSystemType;
import org.rhq.core.system.SystemInfo;
import org.rhq.plugins.apache.util.ApacheBinaryInfo;
+import org.rhq.plugins.platform.PlatformComponent;
import org.rhq.plugins.www.snmp.SNMPClient;
import org.rhq.plugins.www.snmp.SNMPException;
import org.rhq.plugins.www.snmp.SNMPSession;
@@ -64,7 +67,7 @@ import org.rhq.plugins.www.util.WWWUtils;
*
* @author Ian Springer
*/
-public class ApacheServerComponent implements ResourceComponent, MeasurementFacet,
OperationFacet {
+public class ApacheServerComponent implements ResourceComponent<PlatformComponent>,
MeasurementFacet, OperationFacet, ConfigurationFacet {
private final Log log = LogFactory.getLog(this.getClass());
public static final String PLUGIN_CONFIG_PROP_SERVER_ROOT = "serverRoot";
@@ -258,6 +261,16 @@ public class ApacheServerComponent implements ResourceComponent,
MeasurementFace
return this.operationsDelegate.invokeOperation(name, params);
}
+ public Configuration loadResourceConfiguration() throws Exception {
+ //TODO this is nae right of course...
+ return
resourceContext.getResourceType().getResourceConfigurationDefinition().getDefaultTemplate().createConfiguration();
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ // TODO Auto-generated method stub
+
+ }
+
/**
* Returns an SNMP session that can be used to communicate with this server's
SNMP agent.
*
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index ba3dcd2..f7e6bd4 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -43,6 +43,7 @@
The log entry format is documented fully in the Apache documentation
http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats.
</c:description>
</c:simple-property>
+ <c:simple-property name="_index" readOnly="true"
required="false" description="Helper property to retain the consistent
ordering inside Apache configuration files."/>
</c:map-property>
</c:list-property>
'>
@@ -151,7 +152,74 @@
</c:simple-property>
'>
+<!ENTITY Options '
+ <c:list-property name="Options" required="false">
+ <c:description>
+ The Options directive controls which server features are available in a
particular directory.
+ </c:description>
+ <c:map-property name="Options">
+ <c:simple-property name="Mode">
+ <c:property-options>
+ <c:option value="Set"/>
+ <c:option value="Add"/>
+ <c:option value="Remove"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="Option">
+ <c:property-options>
+ <c:option value="All" default="true"/>
+ <c:option value="None"/>
+ <c:option value="ExecCGI"/>
+ <c:option value="FollowSymLinks"/>
+ <c:option value="Includes"/>
+ <c:option value="IncludesNOEXEC"/>
+ <c:option value="Indexes"/>
+ <c:option value="MultiViews"/>
+ <c:option value="SymLinksIfOwnerMatch"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="_index" readOnly="true"
required="false" description="Helper property to retain the consistent
ordering inside Apache configuration files."/>
+ </c:map-property>
+ </c:list-property>
+'>
+
+<!ENTITY Order '
+ <c:simple-property name="Order" required="false">
+ <c:description>
+ The Order directive, along with the Allow and Deny directives, controls a
three-pass access control system. The first pass processes either all Allow or all Deny
directives, as specified by the Order directive. The second pass parses the rest of the
directives (Deny or Allow). The third pass applies to all requests which do not match
either of the first two.
+ </c:description>
+ <c:property-options>
+ <c:option value="Allow,Deny"/>
+ <c:option value="Deny,Allow"/>
+ </c:property-options>
+ </c:simple-property>
+'>
+
+<!ENTITY Allow '
+ <c:list-property name="Allow" required="false">
+ <c:description>
+ The Allow directive affects which hosts can access an area of the server.
Access can be controlled by hostname, IP address, IP address range.
+ The environment variables settings are not supported in the user interface.
+ </c:description>
+ <c:map-property name="Allow">
+ <c:simple-property name="host"/>
+ </c:map-property>
+ </c:list-property>
+'>
+
+<!ENTITY Deny '
+ <c:list-property name="Deny" required="false">
+ <c:description>
+ The arguments for the Deny directive are identical to the arguments for the
Allow directive.
+ </c:description>
+ <c:map-property name="Deny">
+ <c:simple-property name="host"/>
+ </c:map-property>
+ </c:list-property>
+'>
+
]>
+
<plugin name="Apache"
displayName="Apache HTTP Server"
description="Management of Apache web servers"
@@ -354,15 +422,17 @@
Note that the IP address of a name-based virtual host must exactly match
the value of this property.
</c:description>
</c:simple-property>
+ &Options;
&UseCanonicalName;
- &UseCanonicalPhysicalPort;
+ &UseCanonicalPhysicalPort;
<c:group name="Logging">
&ErrorLog;
&CustomLogs;
</c:group>
+
</resource-configuration>
- <service name="Apache Virtual Host"
discovery="ApacheVirtualHostServiceDiscoveryComponent"
class="ApacheVirtualHostServiceComponent">
+ <service name="Apache Virtual Host"
discovery="ApacheVirtualHostServiceDiscoveryComponent"
class="ApacheVirtualHostServiceComponent"
createDeletePolicy="both">
<plugin-configuration>
<c:simple-property name="url" displayName="URL"
@@ -559,9 +629,69 @@
&ErrorDocuments;
&ErrorLog;
&Timeout;
+ &Options;
&UseCanonicalName;
&UseCanonicalPhysicalPort;
</resource-configuration>
+
+ <service name="Directory"
class="ApacheDirectoryComponent" createDeletePolicy="both">
+ <resource-configuration>
+ <c:simple-property name="path" />
+ <c:simple-property name="regularExpression"
type="boolean" default="false"/>
+ &Order;
+ &Allow;
+ &Deny;
+ <c:map-property name="AllowOverride"
required="false">
+ <c:description>
+ When the server finds an .htaccess file (as specified by
AccessFileName) it needs to know which directives declared in that file can override
earlier configuration directives.
+ </c:description>
+ <c:simple-property name="All" type="boolean"
default="true" description="Any directive which has the .htaccess Context
is allowed in .htaccess files" />
+ <c:simple-property name="None" type="boolean"
description=".htaccess files are completely ignored. In this case, the server will
not even attempt to read .htaccess files in the filesystem."/>
+ <c:simple-property name="AuthConfig"
type="boolean" description="Allow use of the authorization directives
(AuthDBMGroupFile, AuthDBMUserFile, AuthGroupFile, AuthName, AuthType, AuthUserFile,
Require, etc.)."/>
+ <c:simple-property name="FileInfo"
type="boolean" description="Allow use of the directives controlling
document types (DefaultType, ErrorDocument, ForceType, LanguagePriority, SetHandler,
SetInputFilter, SetOutputFilter, and mod_mime Add* and Remove* directives, etc.), document
meta data (Header, RequestHeader, SetEnvIf, SetEnvIfNoCase, BrowserMatch, CookieExpires,
CookieDomain, CookieStyle, CookieTracking, CookieName), mod_rewrite directives
RewriteEngine, RewriteOptions, RewriteBase, RewriteCond, RewriteRule) and Action from
mod_actions."/>
+ <c:simple-property name="Indexes"
type="boolean" description="Allow use of the directives controlling
directory indexing (AddDescription, AddIcon, AddIconByEncoding, AddIconByType,
DefaultIcon, DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore, IndexOptions,
ReadmeName, etc.)."/>
+ <c:simple-property name="Limit" type="boolean"
description="Allow use of the directives controlling host access (Allow, Deny and
Order)."/>
+ <c:simple-property name="Options"
type="boolean" description="Allow use of the directives controlling
specific directory features (Options and XBitHack)."/>
+ </c:map-property>
+ &AddDefaultCharset;
+ &DefaultType;
+ &DirectoryIndex;
+ &ErrorDocuments;
+ &Options;
+ &UseCanonicalName;
+ &UseCanonicalPhysicalPort;
+ </resource-configuration>
+ </service>
+
+ <service name="Files" class="ApacheFilesComponent"
createDeletePolicy="both">
+ <resource-configuration>
+ &Order;
+ &Allow;
+ &Deny;
+ &AddDefaultCharset;
+ &DefaultType;
+ &DirectoryIndex;
+ &ErrorDocuments;
+ &Options;
+ &UseCanonicalName;
+ &UseCanonicalPhysicalPort;
+ </resource-configuration>
+ </service>
+
+ <service name="Location" class="ApacheLocationComponent"
createDeletePolicy="both">
+ <resource-configuration>
+ &Order;
+ &Allow;
+ &Deny;
+ &AddDefaultCharset;
+ &DefaultType;
+ &DirectoryIndex;
+ &ErrorDocuments;
+ &Options;
+ &UseCanonicalName;
+ &UseCanonicalPhysicalPort;
+ </resource-configuration>
+ </service>
</service>
<service name="Mod JK" description="Management of mod_jk"