[jboss-cvs] jboss-cvs-commits Digest, Vol 61, Issue 58
Ales Justin
ales.justin at gmail.com
Wed Jul 20 09:31:31 EDT 2011
What exactly does this ExplicitDeclaredStructure fix?
-Ales
> ------------------------------
>
> Message: 3
> Date: Wed, 20 Jul 2011 09:01:48 -0400
> From: jboss-cvs-commits at lists.jboss.org
> Subject: [jboss-cvs] JBossAS SVN: r111792 - in trunk/server/src:
> main/java/org/jboss/deployment and 1 other directories.
> To: jboss-cvs-commits at lists.jboss.org
> Message-ID:
> <201107201301.p6KD1mNq023606 at svn01.web.mwc.hst.phx2.redhat.com>
> Content-Type: text/plain; charset=UTF-8
>
> Author: jaikiran
> Date: 2011-07-20 09:01:47 -0400 (Wed, 20 Jul 2011)
> New Revision: 111792
>
> Added:
> trunk/server/src/main/java/org/jboss/deployment/ExplicitDeclaredStructure.java
> Modified:
> trunk/server/src/etc/conf/all/bootstrap/deployers.xml
> trunk/server/src/main/java/org/jboss/web/deployers/AbstractWarDeployer.java
> Log:
> JBAS-8786 Fix the issue where the jar file contents were filling up filesystem, during .war deployment
>
> Modified: trunk/server/src/etc/conf/all/bootstrap/deployers.xml
> ===================================================================
> --- trunk/server/src/etc/conf/all/bootstrap/deployers.xml 2011-07-20 12:16:20 UTC (rev 111791)
> +++ trunk/server/src/etc/conf/all/bootstrap/deployers.xml 2011-07-20 13:01:47 UTC (rev 111792)
> @@ -108,7 +108,7 @@
> </bean>
>
> <!-- A declared structure descriptor deployer -->
> - <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
> + <bean name="DeclaredStructure" class="org.jboss.deployment.ExplicitDeclaredStructure"/>
>
> <!-- JAR Structure -->
> <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
>
> Added: trunk/server/src/main/java/org/jboss/deployment/ExplicitDeclaredStructure.java
> ===================================================================
> --- trunk/server/src/main/java/org/jboss/deployment/ExplicitDeclaredStructure.java (rev 0)
> +++ trunk/server/src/main/java/org/jboss/deployment/ExplicitDeclaredStructure.java 2011-07-20 13:01:47 UTC (rev 111792)
> @@ -0,0 +1,52 @@
> +/*
> + * JBoss, Home of Professional Open Source.
> + * Copyright 2010, Red Hat, Inc., and individual contributors
> + * as indicated by the @author tags. See the copyright.txt file in the
> + * distribution for a full listing of individual contributors.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +
> +package org.jboss.deployment;
> +
> +import org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure;
> +import org.jboss.vfs.VirtualFile;
> +import org.jboss.vfs.util.automount.Automounter;
> +import org.jboss.vfs.util.automount.MountOption;
> +
> +import java.io.IOException;
> +
> +/**
> + * This class is just here to fix a bug in {@link DeclaredStructure} where the {@link DeclaredStructure#performMount(org.jboss.vfs.VirtualFile)}
> + * does <i>not</i> explode the .war files.
> + * <p/>
> + * Once the {@link DeclaredStructure} is fixed, we will no longer require this {@link ExplicitDeclaredStructure}
> + * <p/>
> + *
> + * @see Related to https://issues.jboss.org/browse/JBAS-8786
> + * User: Jaikiran Pai
> + */
> +public class ExplicitDeclaredStructure extends DeclaredStructure {
> +
> + @Override
> + protected void performMount(VirtualFile file) throws IOException {
> + if (file.getName().endsWith(".war")) {
> + Automounter.mount(file, MountOption.EXPANDED, MountOption.COPY);
> + return;
> + }
> + Automounter.mount(file, MountOption.COPY);
> + }
> +}
>
> Modified: trunk/server/src/main/java/org/jboss/web/deployers/AbstractWarDeployer.java
> ===================================================================
> --- trunk/server/src/main/java/org/jboss/web/deployers/AbstractWarDeployer.java 2011-07-20 12:16:20 UTC (rev 111791)
> +++ trunk/server/src/main/java/org/jboss/web/deployers/AbstractWarDeployer.java 2011-07-20 13:01:47 UTC (rev 111792)
> @@ -391,11 +391,9 @@
>
> if (unit instanceof VFSDeploymentUnit)
> {
> - URL expWarUrl;
> -
> VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
> VirtualFile root = vfsUnit.getRoot();
> - expWarUrl = getExplodedWarUrl(root);
> + final URL expandedWarURL = root.getPhysicalFile().toURI().toURL();
>
> // Map
> String warPathName = root.getPathName();
> @@ -413,7 +411,7 @@
> if (path.startsWith(warPathName))
> {
> path = path.substring(warPathName.length());
> - URL pathURL = new URL(expWarUrl, path);
> + URL pathURL = new URL(expandedWarURL, path);
> classpath.add(pathURL);
> }
> else
> @@ -430,7 +428,7 @@
> }
>
> // Indicate that an expanded URL exists
> - unit.addAttachment("org.jboss.web.expandedWarURL", expWarUrl, URL.class);
> + unit.addAttachment("org.jboss.web.expandedWarURL", expandedWarURL, URL.class);
>
> // Resolve any ear relative alt-dd path to an expWarUrl/WEB-INF/alt-dd.xml file
> String altDDPath = metaData.getAlternativeDD();
> @@ -817,39 +815,6 @@
> }
>
> /**
> - * This method is a hack to make sure the WAR is fully exploded. Currently this is only needed
> - * for WARs that come through the DeclaredStructure deployer. This should be removed when the
> - * DeclaredStructure deployer correctly support exploding WARs.
> - */
> - private URL getExplodedWarUrl(VirtualFile virtualFile) throws MalformedURLException, IOException {
> - if(virtualFile.isDirectory())
> - {
> - VirtualFileVisitor visitor = new VirtualFileVisitor()
> - {
> - public void visit(VirtualFile virtualFile)
> - {
> - try
> - {
> - virtualFile.getPhysicalFile();
> - }
> - catch (IOException e)
> - {
> - throw new RuntimeException("Failed to force explosion of VirtualFile: " + virtualFile, e);
> - }
> - }
> -
> - public VisitorAttributes getAttributes()
> - {
> - return VisitorAttributes.RECURSE_LEAVES_ONLY;
> - }
> - };
> - virtualFile.visit(visitor);
> - return virtualFile.getPhysicalFile().toURI().toURL();
> - }
> - return virtualFile.toURL();
> - }
> -
> - /**
> *
> * Similar to {@link ServiceDependencyMetaData} except that this allows to specify the "whenRequired" and
> * "dependentState" {@link ControllerState ControllerState}
>
>
More information about the jboss-cvs-commits
mailing list