.classpath | 4 modules/enterprise/gui/pom.xml | 1 modules/enterprise/gui/webdav-war/pom.xml | 286 ---------- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AuthenticatedCollectionResource.java | 36 - modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/Authenticator.java | 96 --- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AvailabilityResource.java | 75 -- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/BasicResource.java | 89 --- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ConfigResource.java | 95 --- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/GetableBasicResource.java | 88 --- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/MeasurementDataResource.java | 129 ---- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ResourceFolder.java | 120 ---- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/RootFolder.java | 120 ---- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/SafeEncoder.java | 45 - modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/TraitsResource.java | 106 --- modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/WebDAVResourceFactory.java | 110 --- modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/jboss-web.xml | 5 modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/web.xml | 27 17 files changed, 2 insertions(+), 1430 deletions(-)
New commits: commit 0bdc81a83bf68c50f2de1d2042440bda70ae368f Author: John Mazzitelli mazz@redhat.com Date: Thu Aug 2 11:19:30 2012 -0400
remove the webdav module - it is obsolete, was never in the distro and REST is now the way to obtain this functionality
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml index b9ca5f5..00a4222 100644 --- a/modules/enterprise/gui/pom.xml +++ b/modules/enterprise/gui/pom.xml @@ -31,7 +31,6 @@ <module>installer</module> <module>base-perspective-jar</module> <module>base-perspective-war</module> - <!--<module>webdav-war</module>--> <module>content_http-war</module> <module>coregui</module> <module>rest-war</module> diff --git a/modules/enterprise/gui/webdav-war/pom.xml b/modules/enterprise/gui/webdav-war/pom.xml deleted file mode 100644 index 3ab00df..0000000 --- a/modules/enterprise/gui/webdav-war/pom.xml +++ /dev/null @@ -1,286 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.rhq</groupId> - <artifactId>rhq-parent</artifactId> - <version>4.3.0-SNAPSHOT</version> - <relativePath>../../../../pom.xml</relativePath> - </parent> - - <artifactId>rhq-webdav</artifactId> - <packaging>war</packaging> - - <name>RHQ Enterprise WebDav</name> - <description>The RHQ WebDav inventory access</description> - - <dependencies> - - <!-- Internal Deps --> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <scope>provided</scope> <!-- by rhq.ear (as ejb-jar) --> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-gui</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-enterprise-server</artifactId> - <version>${project.version}</version> - <scope>provided</scope> <!-- by rhq.ear (as ejb-jar) --> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-util</artifactId> - <version>${project.version}</version> - <scope>provided</scope> <!-- by rhq.ear --> - </dependency> - - <!-- 3rd Party Deps --> - <dependency> - <groupId>com.ettrema</groupId> - <artifactId>milton-api</artifactId> - <version>1.4.1</version> - </dependency> - - <dependency> - <groupId>com.ettrema</groupId> - <artifactId>milton-servlet</artifactId> - <version>1.4.1</version> - </dependency> - - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-jdk14</artifactId> - <version>1.4.3</version> - </dependency> - - - <dependency> - <groupId>hibernate</groupId> - <artifactId>hibernate3</artifactId> - <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <!-- used by a test JSP --> - <dependency> - <groupId>hibernate-entitymanager</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <!-- needed for referenced domain entities that use Hibernate annotations (due to JDK5 bug) --> - <dependency> - <groupId>hibernate-annotations</groupId> - <artifactId>hibernate-annotations</artifactId> - <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - - <!-- needed for referenced domain entities that use JPA annotations (due to JDK5 bug) --> - <dependency> - <groupId>javax.persistence</groupId> - <artifactId>persistence-api</artifactId> - <version>1.0</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - <version>1.1.2</version> - </dependency> - - <!-- needed for EJB3 annotations (e.g. ApplicationException) --> - <dependency> - <groupId>jboss</groupId> - <artifactId>jboss-ejb3x</artifactId> - <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>jboss</groupId> - <artifactId>jboss-j2ee</artifactId> - <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - - - - - - - <dependency> - <groupId>commons-fileupload</groupId> - <artifactId>commons-fileupload</artifactId> - <version>1.2</version> - </dependency> - - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.0.1</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>1.3.1</version> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.0.4</version> - <scope>provided</scope> <!-- by JBossAS --> - </dependency> - - <dependency> - <groupId>commons-validator</groupId> - <artifactId>commons-validator</artifactId> - <version>1.1.4</version> - </dependency> - - </dependencies> - - <build> - <finalName>rhq-webdav</finalName> - <plugins> - - <plugin> - <artifactId>maven-war-plugin</artifactId> - <version>2.1-alpha-1</version> - <configuration> - <archive> - <manifest> - <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - </manifest> - <manifestEntries> - <Build-Number>${buildNumber}</Build-Number> - </manifestEntries> - </archive> - <webResources> - <resource> - <filtering>false</filtering> - <directory>${basedir}/src/main/webapp</directory> - </resource> - </webResources> - </configuration> - </plugin> - - </plugins> - - </build> - - <profiles> - - <profile> - <id>dev</id> - - <properties> - <rhq.rootDir>../../../..</rhq.rootDir> - <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName> - <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir> - </properties> - - <build> - <plugins> - - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - - <execution> - <id>deploy-classes</id> - <phase>compile</phase> - <configuration> - <target> - <property name="classes.dir" location="${rhq.deploymentDir}/WEB-INF/classes" /> - <echo>*** Copying updated files from target/classes to ${classes.dir}...</echo> - <copy todir="${classes.dir}" verbose="${rhq.verbose}"> - <fileset dir="target/classes" /> - </copy> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> - <echo>*** Copying updated files from src${file.separator}main${file.separator}webapp${file.separator} to ${deployment.dir}${file.separator}...</echo> - <copy todir="${deployment.dir}" verbose="${rhq.verbose}"> - <fileset dir="${basedir}/src/main/webapp" /> - </copy> - <!-- TODO: Also copy the files from src/main/webapp-filtered/, and then filter them ourselves. --> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> - <id>deploy</id> - <phase>package</phase> - <configuration> - <target> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> - <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo> - <copy todir="${deployment.dir}" verbose="${rhq.verbose}"> - <fileset dir="${basedir}/target/${project.build.finalName}" /> - </copy> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> - <id>undeploy</id> - <phase>clean</phase> - <configuration> - <target> - <property name="deployment.dir" location="${rhq.deploymentDir}" /> - <echo>*** Deleting ${deployment.dir}${file.separator}...</echo> - <delete dir="${deployment.dir}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - </executions> - </plugin> - - </plugins> - </build> - </profile> - - </profiles> - - <repositories> - <repository> - <id>ettrema</id> - <url>http://www.ettrema.com/maven2</url> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - -</project> diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AuthenticatedCollectionResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AuthenticatedCollectionResource.java deleted file mode 100644 index 5a86620..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AuthenticatedCollectionResource.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.List; - -import com.bradmcevoy.http.CollectionResource; -import com.bradmcevoy.http.Resource; - -import org.rhq.core.domain.auth.Subject; - -/** - * This is the {@link CollectionResource} interface with an additional ability - * to obtain the collection given a specific subject. - * - * @author John Mazzitelli - */ -public interface AuthenticatedCollectionResource extends CollectionResource { - List<? extends Resource> getChildren(Subject subject); -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/Authenticator.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/Authenticator.java deleted file mode 100644 index cb61cc42..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/Authenticator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import javax.security.auth.login.LoginException; - -import com.bradmcevoy.http.Resource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * Provides a utility object to perform user authentication. - * - * @author John Mazzitelli - */ -public class Authenticator { - private static final Log LOG = LogFactory.getLog(Authenticator.class); - - private Subject subject = null; - - public Authenticator(Subject subject) { - this.subject = subject; - } - - /** - * If the user has successfully authenticated himself, this will return the Subject for that login. - * If the user never logged in or failed to authenticate successfully, this will be <code>null</code>. - * - * @return the authenticated subject, or <code>null</code> if user is not authenticated - */ - public Subject getSubject() { - return this.subject; - } - - /** - * For those times when a user does not need to be authenticated to obtain data, use - * the overlord user, which provides full superuser authentication. - * - * @return the overlord user - */ - public Subject getOverlord() { - return LookupUtil.getSubjectManager().getOverlord(); - } - - /** - * Logs the user in with the given credentials. - * - * <i>This signature must match that of {@link Resource#authenticate(String, String)}</i> - * - * @param username - * @param password - * - * @return the {@link Subject} of the authenticated user - */ - public Object authenticate(String username, String password) { - try { - this.subject = LookupUtil.getSubjectManager().login(username, password); - LOG.debug("User [" + username + "] logged into the webdav server"); - } catch (LoginException e) { - LOG.warn("User [" + username + "] failed to log into the webdav server"); - this.subject = null; - } - return this.subject; - } - - /** - * Returns the security realm that the user must authenticate with. - * - * <i>This signature must match that of {@link Resource#getRealm()}</i> - * - * @return security realm name - */ - public String getRealm() { - return "Jopr Management Environment"; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AvailabilityResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AvailabilityResource.java deleted file mode 100644 index 31eaf11..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/AvailabilityResource.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.Date; - -import com.bradmcevoy.http.PropFindableResource; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.measurement.Availability; -import org.rhq.core.domain.resource.Resource; -import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * The property to indicate if the resource is up or down. - * - * @author Greg Hinkle - * @author John Mazzitelli - */ -public class AvailabilityResource extends BasicResource implements PropFindableResource { - private Availability availability; - - public AvailabilityResource(Subject subject, Resource managedResource) { - super(subject, managedResource); - } - - public String getUniqueId() { - return "avail_" + getAvailability().getId(); - } - - public String getName() { - return "availability_is_" + getAvailability().getAvailabilityType().getName(); - } - - /** - * The modified date is that when the current availability took effect. - * This is the same as {@link #getCreateDate()}. - */ - public Date getModifiedDate() { - return getAvailability().getStartTime(); - } - - /** - * The created date is that when the current availability took effect. - * This is the same as {@link #getModifiedDate()}. - */ - public Date getCreateDate() { - return getModifiedDate(); - } - - private Availability getAvailability() { - if (this.availability == null) { - AvailabilityManagerLocal am = LookupUtil.getAvailabilityManager(); - this.availability = am.getCurrentAvailabilityForResource(getSubject(), getManagedResource().getId()); - } - return this.availability; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/BasicResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/BasicResource.java deleted file mode 100644 index e21f026..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/BasicResource.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import com.bradmcevoy.http.Auth; -import com.bradmcevoy.http.PropFindableResource; -import com.bradmcevoy.http.Request; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.resource.Resource; -import org.rhq.enterprise.server.authz.AuthorizationManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * Represents a basic managed resource. Provides some hooks to the authentication subsystem to - * ensure the user is allowed to see the resource. - * - * @see ResourceFolder - * - * @author Greg Hinkle - * @author John Mazzitelli - */ -public abstract class BasicResource extends Authenticator implements PropFindableResource { - - private static final Log LOG = LogFactory.getLog(BasicResource.class); - - private final Resource managedResource; - - public BasicResource(Subject subject, Resource managedResource) { - super(subject); - - if (managedResource == null) { - throw new NullPointerException("managedResource == null"); - } - this.managedResource = managedResource; - } - - protected Resource getManagedResource() { - return this.managedResource; - } - - /** - * This implementation of authorise simply assures that the user has authenticated himself - * and the user is allowed to view the managed resource. Subclasses may wish to further - * restrict the authorization (e.g. deny access if the configuration of the resource - * is to be edited but the user is not allowed to change the configuration). - */ - public boolean authorise(Request request, Request.Method method, Auth auth) { - boolean authorized = false; - - if (auth != null) { - Subject subject = (Subject) auth.getTag(); - if (subject != null) { - AuthorizationManagerLocal authorizationManager = LookupUtil.getAuthorizationManager(); - authorized = authorizationManager.canViewResource(subject, getManagedResource().getId()); - } - - if (LOG.isDebugEnabled()) { - LOG.debug("BasicResource [" + getManagedResource() + "], auth=[" + auth.getTag() + "], isAuthorized=" - + authorized); - } - } - - return authorized; - } - - public String checkRedirect(Request request) { - return null; // no-op - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ConfigResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ConfigResource.java deleted file mode 100644 index 1fc7ad5..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ConfigResource.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.io.ByteArrayOutputStream; -import java.util.Date; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.Property; -import org.rhq.core.domain.resource.Resource; -import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * Provides the resource configuration XML for a given resource. - * - * @author Greg Hinkle - * @author John Mazzitelli - */ -public class ConfigResource extends GetableBasicResource { - - private Configuration configuration; - private String content; - - public ConfigResource(Subject subject, Resource managedResource) { - super(subject, managedResource); - } - - public String getUniqueId() { - return "config_" + getConfiguration().getId(); - } - - public String getName() { - return "resource_configuration.xml"; - } - - /** - * The modified date is that of the last time the configuration changed. - */ - public Date getModifiedDate() { - return new Date(getConfiguration().getModifiedTime()); - } - - /** - * The creation date is that of the configuration itself, not of the managed resource. - */ - public Date getCreateDate() { - return new Date(getConfiguration().getCreatedTime()); - } - - protected String loadContent() { - if (this.content == null) { - try { - JAXBContext context = JAXBContext.newInstance(Configuration.class, Property.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - marshaller.marshal(getConfiguration(), baos); - this.content = baos.toString(); - } catch (JAXBException e) { - throw new RuntimeException("Failed to translate configuration to XML", e); - } - } - return this.content; - } - - private Configuration getConfiguration() { - if (this.configuration == null) { - ConfigurationManagerLocal cm = LookupUtil.getConfigurationManager(); - this.configuration = cm.getResourceConfiguration(getManagedResource().getId()); - } - return this.configuration; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/GetableBasicResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/GetableBasicResource.java deleted file mode 100644 index 870f52f..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/GetableBasicResource.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Map; - -import com.bradmcevoy.http.Auth; -import com.bradmcevoy.http.GetableResource; -import com.bradmcevoy.http.Range; -import com.bradmcevoy.http.exceptions.NotAuthorizedException; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.resource.Resource; -import org.rhq.core.util.stream.StreamUtil; - -/** - * Extends the {@link BasicResource} by providing hooks to stream file content to the user. - * - * @author John Mazzitelli - */ -public abstract class GetableBasicResource extends BasicResource implements GetableResource { - - public GetableBasicResource(Subject subject, Resource managedResource) { - super(subject, managedResource); - } - - /** - * This implementation assumes the content will be of type "text/xml". - * Subclasses are free to override this behavior if they are returning content - * other than XML data. - */ - public String getContentType(String accepts) { - return "text/xml"; - } - - public Long getContentLength() { - return Long.valueOf(loadContent().length()); - } - - public void sendContent(OutputStream out, Range range, Map<String, String> params, String str) throws IOException, - NotAuthorizedException { - - byte[] bytes = loadContent().getBytes(); - long start = (range != null) ? range.getStart() : 0L; - long length = (range != null) ? ((range.getFinish() - start) + 1) : bytes.length; - - InputStream in = new ByteArrayInputStream(bytes); - StreamUtil.copy(in, out, start, length); - } - - /** - * This implementation assumes the user client should not cache the content. - * Subclasses are free to override this if they allow the content to be cached - * on the client side. - */ - public Long getMaxAgeSeconds(Auth auth) { - return Long.valueOf(0L); - } - - /** - * Subclasses must implement this to return the content as a String. Note that this really - * only supports small content since you don't want to load large files in memory. If you need - * content that is large, implement {@link GetableResource} directly; do not use this abstract class. - * - * @return the content as a string, must never be <code>null</code> - */ - protected abstract String loadContent(); -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/MeasurementDataResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/MeasurementDataResource.java deleted file mode 100644 index 8f095b8..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/MeasurementDataResource.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.Date; -import java.util.List; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.measurement.DataType; -import org.rhq.core.domain.measurement.MeasurementSchedule; -import org.rhq.core.domain.measurement.ui.MetricDisplaySummary; -import org.rhq.core.domain.resource.Resource; -import org.rhq.enterprise.server.measurement.MeasurementChartsManagerLocal; -import org.rhq.enterprise.server.measurement.MeasurementPreferences; -import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal; -import org.rhq.enterprise.server.measurement.MeasurementPreferences.MetricRangePreferences; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * The measurement data WebDAV resource that provides information on metrics of a managed resource. - * - * @author John Mazzitelli - */ -public class MeasurementDataResource extends GetableBasicResource { - - private String content; - private List<MetricDisplaySummary> measurements; - - public MeasurementDataResource(Subject subject, Resource managedResource) { - super(subject, managedResource); - } - - public String getUniqueId() { - return "metrics_" + getManagedResource().getId(); - } - - public String getName() { - return "measurement_data.xml"; - } - - /** - * We do not reply with any relevent date. The only way for a relevent date to - * be calculated is for us to actually query the database for the measurement data. - * To avoid querying the DB t(which is expensive), we simply return the current - * date, since the majority of the time, a new measurement collection interval - * will have triggered in the time the user took between getting the measurement data. - */ - public Date getModifiedDate() { - return new Date(); - } - - /** - * The created date is the date of the resource itself was created. - */ - public Date getCreateDate() { - return new Date(getManagedResource().getCtime()); - } - - protected String loadContent() { - if (this.content == null) { - StringBuilder str = new StringBuilder(); - str.append("<?xml version=\"1.0\"?>\n"); - str.append("<measurements>\n"); - for (MetricDisplaySummary meas : getMeasurements()) { - str.append(" <measurement>\n"); - str.append(" <name>").append(meas.getLabel()).append("</name>\n"); - str.append(" <description>").append(meas.getDescription()).append("</description>\n"); - str.append(" <alert-count>").append(meas.getAlertCount()).append("</alert-count>\n"); - str.append(" <min-value>").append(meas.getMinMetric().getValue()).append("</min-value>\n"); - str.append(" <max-value>").append(meas.getMaxMetric().getValue()).append("</max-value>\n"); - str.append(" <avg-value>").append(meas.getAvgMetric().getValue()).append("</avg-value>\n"); - str.append(" <last-value>").append(meas.getLastMetric().getValue()).append("</last-value>\n"); - str.append(" <units>").append(meas.getUnits()).append("</units>\n"); - str.append(" <begin-time>").append(new Date(meas.getBeginTimeFrame())).append("</begin-time>\n"); - str.append(" <end-time>").append(new Date(meas.getEndTimeFrame())).append("</end-time>\n"); - str.append(" <schedule-id>").append(meas.getScheduleId()).append("</schedule-id>\n"); - str.append(" </measurement>\n"); - } - str.append("</measurements>\n"); - this.content = str.toString(); - } - return this.content; - } - - private List<MetricDisplaySummary> getMeasurements() { - if (this.measurements == null) { - - int resourceId = getManagedResource().getId(); - - // determine the user's preferences so we know how far back to get the measurement data - MeasurementPreferences measurementPrefs = new MeasurementPreferences(getSubject()); - MetricRangePreferences range = measurementPrefs.getMetricRangePreferences(); - - // get all the enabled measurement schedules - MeasurementScheduleManagerLocal sm = LookupUtil.getMeasurementScheduleManager(); - List<MeasurementSchedule> measurementSchedules = sm.findSchedulesForResourceAndType(getSubject(), - resourceId, DataType.MEASUREMENT, null, true); - int[] scheduleIds = new int[measurementSchedules.size()]; - int i = 0; - for (MeasurementSchedule sched : measurementSchedules) { - scheduleIds[i++] = sched.getId(); - } - - // now get the measurement data for all the scheduled as far back as the user's range preferences says so - MeasurementChartsManagerLocal chartManager = LookupUtil.getMeasurementChartsManager(); - this.measurements = chartManager.getMetricDisplaySummariesForResource(getSubject(), resourceId, - scheduleIds, range.begin, range.end); - } - - return this.measurements; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ResourceFolder.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ResourceFolder.java deleted file mode 100644 index 73f55f1..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/ResourceFolder.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.bradmcevoy.http.Resource; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.resource.InventoryStatus; -import org.rhq.core.domain.resource.composite.ResourceFacets; -import org.rhq.core.domain.util.PageControl; -import org.rhq.core.domain.util.PageList; -import org.rhq.enterprise.server.resource.ResourceManagerLocal; -import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * Represents a managed resource along with its children resources. - * - * @see BasicResource - * - * @author Greg Hinkle - * @author John Mazzitelli - */ -public class ResourceFolder extends BasicResource implements AuthenticatedCollectionResource { - - private List<Resource> children; - - public ResourceFolder(Subject subject, org.rhq.core.domain.resource.Resource managedResource) { - super(subject, managedResource); - } - - public String getUniqueId() { - return String.valueOf(getManagedResource().getId()); - } - - public String getName() { - String name = getManagedResource().getName(); - return SafeEncoder.encode(name); - } - - public Date getModifiedDate() { - return new Date(getManagedResource().getMtime()); - } - - public Date getCreateDate() { - return new Date(getManagedResource().getCtime()); - } - - public Resource child(String childName) { - List<? extends Resource> children = getChildren(); - for (Resource child : children) { - if (childName.equals(child.getName())) { - return child; - } - } - return null; - } - - public List<? extends Resource> getChildren() { - return getChildren(getSubject()); - } - - public List<? extends Resource> getChildren(Subject subject) { - if (this.children == null) { - PageList<org.rhq.core.domain.resource.Resource> childs; - ResourceManagerLocal rm = LookupUtil.getResourceManager(); - childs = rm.findChildResources(subject, getManagedResource().getId(), PageControl.getUnlimitedInstance()); - - // inventory - this.children = new ArrayList<Resource>(childs.size()); - for (org.rhq.core.domain.resource.Resource child : childs) { - if (child.getInventoryStatus() == InventoryStatus.COMMITTED) { - this.children.add(new ResourceFolder(subject, child)); - } - } - - ResourceTypeManagerLocal rtm = LookupUtil.getResourceTypeManager(); - ResourceFacets facets = rtm.getResourceFacets(getManagedResource().getResourceType().getId()); - - // availability - this.children.add(new AvailabilityResource(subject, getManagedResource())); - - // resource configuration - if (facets.isConfiguration()) { - this.children.add(new ConfigResource(subject, getManagedResource())); - } - - // traits - if (facets.isMeasurement()) { - this.children.add(new TraitsResource(subject, getManagedResource())); - } - - // measurement data - if (facets.isMeasurement()) { - this.children.add(new MeasurementDataResource(subject, getManagedResource())); - } - } - return this.children; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/RootFolder.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/RootFolder.java deleted file mode 100644 index 89c78fd..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/RootFolder.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.bradmcevoy.http.Auth; -import com.bradmcevoy.http.PropFindableResource; -import com.bradmcevoy.http.Request; -import com.bradmcevoy.http.Resource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.resource.ResourceCategory; -import org.rhq.core.domain.resource.composite.ResourceComposite; -import org.rhq.core.domain.util.PageControl; -import org.rhq.enterprise.server.resource.ResourceManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * This represents the top of the managed environment (i.e. all of the top-level platforms being managed). - * - * @author Greg Hinkle - * @author John Mazzitelli - */ -public class RootFolder extends Authenticator implements AuthenticatedCollectionResource, PropFindableResource { - - private static final Log LOG = LogFactory.getLog(RootFolder.class); - - private List<ResourceFolder> roots; - - public RootFolder() { - super(null); - } - - public String getUniqueId() { - return "/"; - } - - public String getName() { - return "/"; - } - - public Date getModifiedDate() { - return new Date(); - } - - public Date getCreateDate() { - return new Date(); - } - - /** - * This implementation of authorise simply assures that the user has authenticated himself. - * If the user is logged in, <code>true</code> is returned; otherwise, <code>false</code> is returned. - */ - public boolean authorise(Request request, Request.Method method, Auth auth) { - boolean authorized = (auth != null) && (auth.getTag() != null); - if (LOG.isDebugEnabled()) { - LOG.debug("RootFolder auth=[" + ((auth != null) ? auth.getTag() : auth) + "], isAuthorized=" + authorized); - } - return authorized; - } - - public String checkRedirect(Request request) { - return null; // no-op - } - - public Resource child(String childName) { - List<? extends Resource> children = getChildren(); - for (Resource child : children) { - if (childName.equals(child.getName())) { - return child; - } - } - return null; - } - - public List<? extends Resource> getChildren() { - return getChildren(getSubject()); - } - - public List<? extends Resource> getChildren(Subject subject) { - if (this.roots == null) { - ResourceManagerLocal rm = LookupUtil.getResourceManager(); - - List<ResourceComposite> foundRoots = rm.findResourceComposites(subject, ResourceCategory.PLATFORM, null, - null, null, null, true, PageControl.getUnlimitedInstance()); - - if (foundRoots != null) { - this.roots = new ArrayList<ResourceFolder>(foundRoots.size()); - for (ResourceComposite comp : foundRoots) { - this.roots.add(new ResourceFolder(subject, comp.getResource())); - } - } else { - this.roots = new ArrayList<ResourceFolder>(); - } - } - return this.roots; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/SafeEncoder.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/SafeEncoder.java deleted file mode 100644 index 8805335..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/SafeEncoder.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -/** - * Seems like some of our resource names aren't able to safely become URLs that contain characters - * like \ or /. This utility will attempt to change names so they can safely be handled. - * - * @author John Mazzitelli - */ -public abstract class SafeEncoder { - // pick things that are at least half-sane, even if they doesn't look perfect - private static final String[][] REPLACEMENTS = new String[][] { { "\\", "||" }, { "/", "|" } }; - - public static String encode(String name) { - for (String[] replacement : REPLACEMENTS) { - name = name.replace(replacement[0], replacement[1]); - } - return name; - } - - public static String decode(String name) { - for (String[] replacement : REPLACEMENTS) { - name = name.replace(replacement[1], replacement[0]); - } - return name; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/TraitsResource.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/TraitsResource.java deleted file mode 100644 index 9293127..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/TraitsResource.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.measurement.MeasurementDataTrait; -import org.rhq.core.domain.resource.Resource; -import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * The measurement traits resource that provides information on all traits of a managed resource. - * - * @author John Mazzitelli - */ -public class TraitsResource extends GetableBasicResource { - - private List<MeasurementDataTrait> traits; - private String content; - - public TraitsResource(Subject subject, Resource managedResource) { - super(subject, managedResource); - } - - public String getUniqueId() { - return "traits_" + getManagedResource().getId(); - } - - public String getName() { - return "measurement_traits.xml"; - } - - /** - * The modified date is that of the last time a trait changed. - */ - public Date getModifiedDate() { - long latestTimestamp = 0L; - for (MeasurementDataTrait trait : getTraits()) { - if (latestTimestamp < trait.getTimestamp()) { - latestTimestamp = trait.getTimestamp(); - } - } - return new Date(latestTimestamp); - } - - /** - * The created date is the date of the resource itself was created. - */ - public Date getCreateDate() { - return new Date(getManagedResource().getCtime()); - } - - protected String loadContent() { - if (this.content == null) { - StringBuilder str = new StringBuilder(); - str.append("<?xml version=\"1.0\"?>\n"); - str.append("<traits>\n"); - for (MeasurementDataTrait trait : getTraits()) { - str.append(" <trait>\n"); - str.append(" <name>").append(trait.getName()).append("</name>\n"); - str.append(" <value>").append(trait.getValue()).append("</value>\n"); - str.append(" <last-changed>").append(new Date(trait.getTimestamp())).append("</last-changed>\n"); - str.append(" <schedule-id>").append(trait.getScheduleId()).append("</schedule-id>\n"); - str.append(" </trait>\n"); - } - str.append("</traits>\n"); - this.content = str.toString(); - } - return this.content; - } - - private List<MeasurementDataTrait> getTraits() { - if (this.traits == null) { - MeasurementDataManagerLocal mdm = LookupUtil.getMeasurementDataManager(); - List<MeasurementDataTrait> traits = mdm.findCurrentTraitsForResource(getSubject(), getManagedResource() - .getId(), null); - if (traits != null) { - this.traits = traits; - } else { - this.traits = new ArrayList<MeasurementDataTrait>(); - } - } - return this.traits; - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/WebDAVResourceFactory.java b/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/WebDAVResourceFactory.java deleted file mode 100644 index bf1a584..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav/WebDAVResourceFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2008 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.gui.webdav; - -import java.util.List; - -import com.bradmcevoy.http.Resource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.util.collection.ArrayUtils; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * The main entry point when a WebDAV request comes in. This will examine - * the URL being requested and convert that URL into a series of WebDAV - * resources for the user to see. - * - * @author Greg Hinkle - * @author John Mazzitelli - */ -public class WebDAVResourceFactory implements com.bradmcevoy.http.ResourceFactory { - - private static final Log LOG = LogFactory.getLog(WebDAVResourceFactory.class); - - public Resource getResource(String host, String url) { - Resource foundResource = null; - - // URL == /webdav/resource/<parent-resource-name>/<child-resource-name>/... - // paths[] = [, webdav, resource, <parent-resource-name>, <child-resource-name>, ...] - String[] paths = url.split("/"); - - if (paths.length >= 3) { - String webdavResourceType = paths[2]; - if ("resource".equals(webdavResourceType)) { - foundResource = getResourceResource(getSubarray(paths, 3)); - } - // TODO: some ideas for addition resource types - // else if "group".equals(webdavResourceType) - // else if "user".equals(webdavResourceType) - // else if "role".equals(webdavResourceType) - // else if "plugin".equals(webdavResourceType) - // else if "systemconfig".equals(webdavResourceType) - // else if "agentupdate/download".equals(webdavResourceType) - // else if "agentupdate/version".equals(webdavResourceType) - } - - if (foundResource == null) { - LOG.warn("Couldn't find resource associated with webdav url [" + url + "]"); - } - - return foundResource; - } - - public String getSupportedLevels() { - return "1"; - } - - private String[] getSubarray(String[] full, int index) { - return ArrayUtils.copyOfRange(full, index, full.length); - } - - public Subject getOverlord() { - return LookupUtil.getSubjectManager().getOverlord(); - } - - private Resource getResourceResource(String[] paths) { - if (paths.length == 0 || paths[0] == null || paths[0].length() == 0) { - return new RootFolder(); - } else { - Resource resourceFolder = new RootFolder(); - for (int i = 0; i < paths.length; i++) { - boolean found = false; - if (resourceFolder instanceof AuthenticatedCollectionResource) { - List<? extends Resource> children; - children = ((AuthenticatedCollectionResource) resourceFolder).getChildren(getOverlord()); - for (Resource child : children) { - String childName = child.getName(); - if (childName.equals(paths[i])) { - resourceFolder = child; - found = true; - } - } - } - if (!found) { - return null; - } - } - return resourceFolder; - } - } -} diff --git a/modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/jboss-web.xml b/modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/jboss-web.xml deleted file mode 100644 index 0e4fa0f..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"?> - -<jboss-web> - <context-root>webdav</context-root> -</jboss-web> diff --git a/modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 2a445aa..0000000 --- a/modules/enterprise/gui/webdav-war/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> - -<web-app xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - version="2.5"> - - <display-name>RHQ WebDav</display-name> - - - <!-- WebDAV support --> - <servlet> - <servlet-name>WebDAV</servlet-name> - <servlet-class>com.bradmcevoy.http.MiltonServlet</servlet-class> - <init-param> - <param-name>resource.factory.class</param-name> - <param-value>org.rhq.gui.webdav.WebDAVResourceFactory</param-value> - </init-param> - </servlet> - - <servlet-mapping> - <servlet-name>WebDAV</servlet-name> - <url-pattern>/</url-pattern> - </servlet-mapping> - -</web-app> -
commit edb83ed11d62a5375cd0da5723ed25f7e4bbb87d Author: John Mazzitelli mazz@redhat.com Date: Thu Aug 2 11:18:52 2012 -0400
fix eclipse classpath to use the new installer module
diff --git a/.classpath b/.classpath index e541e4f..44bf71a 100644 --- a/.classpath +++ b/.classpath @@ -49,8 +49,8 @@ <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/gui/installer-war/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/gwt-installer-war/src/main/java"/> - <classpathentry kind="src" path="modules/enterprise/gui/gwt-installer-war/target/generated-sources/gwt"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer/src/main/java"/> + <classpathentry kind="src" path="modules/enterprise/gui/installer/target/generated-sources/gwt"/> <classpathentry kind="src" path="modules/enterprise/gui/base-perspective-jar/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/client-api/src/main/java"/>
rhq-commits@lists.fedorahosted.org