[jboss-cvs] jboss-cvs-commits Digest, Vol 40, Issue 464

Ales Justin ales.justin at gmail.com
Wed Oct 21 15:14:15 EDT 2009


Sure, the cleanup() method was there before.
But the impl detail of how this is cleaned up should not be.

e.g. cleanup hooks - I don't care how this gets cleaned up,
it could be hooks, or it could be whatever

David M. Lloyd wrote:
> Also as far as I can see, DeploymentContext already has a cleanup method 
> - we didn't add it.
> 
> On 10/21/2009 09:51 AM, David M. Lloyd wrote:
>> Do you have a more helpful suggestion? The problem is that structural
>> deployers don't have a chance to do undeploy cleanup, so they don't have
>> a chance to dispose of resources allocated by the structural deployer.
>> So we need some kind of hook to do this.
>>
>> - DML
>>
>> On 10/21/2009 04:54 AM, Ales Justin wrote:
>>> This is wrong.
>>> ContextInfo/DeploymentContext should have no such public contract of
>>> being aware of some cleanup tasks.
>>> This can be impl detail, but definitely not part of spi/api.
>>>
>>> If there are other such invalid conceptual changes, please fix/remove
>>> them.
>>> Otherwise I'll never accept this as part of MC.
>>>
>>> jboss-cvs-commits-request at lists.jboss.org wrote:
>>>> Send jboss-cvs-commits mailing list submissions to
>>>> jboss-cvs-commits at lists.jboss.org
>>>>
>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>> https://lists.jboss.org/mailman/listinfo/jboss-cvs-commits
>>>> or, via email, send a message with subject or body 'help' to
>>>> jboss-cvs-commits-request at lists.jboss.org
>>>>
>>>> You can reach the person managing the list at
>>>> jboss-cvs-commits-owner at lists.jboss.org
>>>>
>>>> When replying, please edit your Subject line so it is more specific
>>>> than "Re: Contents of jboss-cvs-commits digest..."
>>>>
>>>>
>>>> Today's Topics:
>>>>
>>>> 1. JBossAS SVN: r95237 - in
>>>> projects/jboss-deployers/branches/vfs3:
>>>> deployers-core/src/main/java/org/jboss/deployers/plugins/structure
>>>> and 13 other directories. (jboss-cvs-commits at lists.jboss.org)
>>>>
>>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>> Message: 1
>>>> Date: Tue, 20 Oct 2009 22:20:50 -0400
>>>> From: jboss-cvs-commits at lists.jboss.org
>>>> Subject: [jboss-cvs] JBossAS SVN: r95237 - in
>>>> projects/jboss-deployers/branches/vfs3:
>>>> deployers-core/src/main/java/org/jboss/deployers/plugins/structure and
>>>> 13 other directories.
>>>> To: jboss-cvs-commits at lists.jboss.org
>>>> Message-ID:
>>>> <200910210220.n9L2KoqV024281 at svn01.web.mwc.hst.phx2.redhat.com>
>>>> Content-Type: text/plain; charset=UTF-8
>>>>
>>>> Author: johnbailey
>>>> Date: 2009-10-20 22:20:48 -0400 (Tue, 20 Oct 2009)
>>>> New Revision: 95237
>>>>
>>>> Added:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java 
>>>>
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestMetaDataUrlIntegrationDeployer.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestPathUrlIntegrationDeployer.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/JARStructureUnitTestCase.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/AbstractWARStructureTest.java 
>>>>
>>>>
>>>> projects/jboss-deployers/branches/vfs3/pom.xml
>>>> Log:
>>>> Added Cleanup tasks to DeploymentContext to support closing VFS handles
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -64,6 +64,9 @@
>>>>
>>>> /** The modification type */
>>>> private ModificationType modificationType;
>>>> +
>>>> + /** Cleanup Task */
>>>> + private Runnable cleanupTask;
>>>>
>>>> /**
>>>> * Create a new ContextInfoImpl.
>>>> @@ -241,7 +244,15 @@
>>>> {
>>>> this.modificationType = modificationType;
>>>> }
>>>> +
>>>> + public Runnable getCleanupTask() {
>>>> + return cleanupTask;
>>>> + }
>>>>
>>>> + public void setCleanupTask(Runnable cleanupTask) {
>>>> + this.cleanupTask = cleanupTask;
>>>> + }
>>>> +
>>>> @Override
>>>> public String toString()
>>>> {
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -125,4 +125,18 @@
>>>> * @param modificationType the modification type
>>>> */
>>>> void setModificationType(ModificationType modificationType);
>>>> +
>>>> + /**
>>>> + * A task to be run during deployment cleanup
>>>> + *
>>>> + * @return the cleanup task
>>>> + */
>>>> + Runnable getCleanupTask();
>>>> +
>>>> + /**
>>>> + * Set a task to be run during deployment cleanup.
>>>> + *
>>>> + * @param cleanupTask the cleanup task
>>>> + */
>>>> + void setCleanupTask(Runnable cleanupTask);
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -407,4 +407,11 @@
>>>> * Cleanup the deployment context
>>>> */
>>>> void cleanup();
>>>> +
>>>> + /**
>>>> + * Additional tasks to run during cleanup
>>>> + *
>>>> + * @param cleanupTasks
>>>> + */
>>>> + void setCleanTasks(List<Runnable> cleanupTasks);
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -160,6 +160,9 @@
>>>> /** The required stage */
>>>> private DeploymentStage requiredStage = DeploymentStages.INSTALLED;
>>>>
>>>> + /** Tasks to run at cleanup */
>>>> + private List<Runnable> cleanupTasks;
>>>> +
>>>> /**
>>>> * Get the scope builder for a deployment context
>>>> *
>>>> @@ -994,6 +997,14 @@
>>>> public void cleanup()
>>>> {
>>>> cleanupRepository(this);
>>>> +
>>>> + if(cleanupTasks != null)
>>>> + {
>>>> + for(Runnable task : cleanupTasks)
>>>> + {
>>>> + task.run();
>>>> + }
>>>> + }
>>>> }
>>>>
>>>> public ObjectName preRegister(MBeanServer server, ObjectName name)
>>>> throws Exception
>>>> @@ -1016,6 +1027,11 @@
>>>> public void postDeregister()
>>>> {
>>>> }
>>>> +
>>>> + public void setCleanTasks(List<Runnable> cleanupTasks)
>>>> + {
>>>> + this.cleanupTasks = cleanupTasks;
>>>> + }
>>>>
>>>> /**
>>>> * Register mbeans
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -21,9 +21,12 @@
>>>> */
>>>> package org.jboss.deployers.structure.spi.helpers;
>>>>
>>>> +import java.util.List;
>>>> +
>>>> import org.jboss.deployers.client.spi.Deployment;
>>>> import org.jboss.deployers.spi.DeploymentException;
>>>> import org.jboss.deployers.spi.attachments.Attachments;
>>>> +import org.jboss.deployers.spi.structure.ContextInfo;
>>>> import org.jboss.deployers.spi.structure.StructureMetaData;
>>>> import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
>>>> import org.jboss.deployers.structure.spi.DeploymentContext;
>>>> @@ -78,19 +81,41 @@
>>>> }
>>>> catch (DeploymentException e)
>>>> {
>>>> + cleanup(structureMetaData);
>>>> throw e;
>>>> }
>>>> catch (Throwable t)
>>>> {
>>>> + cleanup(structureMetaData);
>>>> throw DeploymentException.rethrowAsDeploymentException("Exception
>>>> determining structure: " + deployment, t);
>>>> }
>>>> }
>>>> -
>>>> - return structureBuilder.populateContext(deployment,
>>>> structureMetaData);
>>>> + try {
>>>> + return structureBuilder.populateContext(deployment,
>>>> structureMetaData);
>>>> + } catch(DeploymentException deploymentException) {
>>>> + cleanup(structureMetaData);
>>>> + throw deploymentException;
>>>> + }
>>>> }
>>>>
>>>> protected void determineStructure(Deployment deployment,
>>>> StructureMetaData structure) throws Exception
>>>> {
>>>> // NOTHING
>>>> }
>>>> +
>>>> + protected void cleanup(StructureMetaData structureMetaData) {
>>>> + if(structureMetaData != null) {
>>>> + List<ContextInfo> contexts = structureMetaData.getContexts();
>>>> + if(contexts != null) {
>>>> + for(ContextInfo context : contexts) {
>>>> + cleanup(context);
>>>> + }
>>>> + }
>>>> + }
>>>> + }
>>>> +
>>>> + protected void cleanup(ContextInfo contextInfo) {
>>>> + if(contextInfo.getCleanupTask() != null)
>>>> + contextInfo.getCleanupTask().run();
>>>> + }
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -22,6 +22,7 @@
>>>> package org.jboss.deployers.structure.spi.helpers;
>>>>
>>>> import java.lang.reflect.Field;
>>>> +import java.util.Collections;
>>>> import java.util.Comparator;
>>>> import java.util.List;
>>>>
>>>> @@ -79,7 +80,10 @@
>>>>
>>>> applyStructureMetaData(result, metaData);
>>>> contextInfo.setPredeterminedManagedObjects(deployment.getPredeterminedManagedObjects()); 
>>>>
>>>>
>>>> +
>>>> applyContextInfo(result, contextInfo);
>>>> +
>>>> +
>>>> }
>>>> catch (Throwable t)
>>>> {
>>>> @@ -212,6 +216,9 @@
>>>>
>>>> if (structureProcessor != null)
>>>> structureProcessor.applyContextInfo(context, contextInfo);
>>>> +
>>>> + if(contextInfo.getCleanupTask() != null)
>>>> +
>>>> context.setCleanTasks(Collections.singletonList(contextInfo.getCleanupTask())); 
>>>>
>>>>
>>>> }
>>>>
>>>> /**
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -105,6 +105,9 @@
>>>> /** The mutable scope */
>>>> private ScopeKey mutableScope;
>>>>
>>>> + /** The cleanup tasks */
>>>> + private List<Runnable> cleanupTasks;
>>>> +
>>>> /**
>>>> * For serialization
>>>> */
>>>> @@ -638,6 +641,13 @@
>>>> public void cleanup()
>>>> {
>>>> AbstractDeploymentContext.cleanupRepository(this);
>>>> + if(cleanupTasks != null)
>>>> + {
>>>> + for(Runnable task : cleanupTasks)
>>>> + {
>>>> + task.run();
>>>> + }
>>>> + }
>>>> }
>>>>
>>>> public ObjectName preRegister(MBeanServer server, ObjectName name)
>>>> throws Exception
>>>> @@ -660,6 +670,10 @@
>>>> public void postDeregister()
>>>> {
>>>> }
>>>> +
>>>> + public void setCleanTasks(List<Runnable> cleanupTasks) {
>>>> + this.cleanupTasks = cleanupTasks;
>>>> + }
>>>>
>>>> /**
>>>> * Register mbeans
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -129,7 +129,7 @@
>>>> {
>>>> for (URL integrationURL : integrationURLs)
>>>> {
>>>> - VirtualFile integration = VFS.getRoot(integrationURL);
>>>> + VirtualFile integration = VFS.getChild(integrationURL);
>>>> unit.addClassPath(integration);
>>>> added.add(integration);
>>>> }
>>>> @@ -153,7 +153,7 @@
>>>> {
>>>> try
>>>> {
>>>> - VirtualFile integration = VFS.getRoot(integrationURL);
>>>> + VirtualFile integration = VFS.getChild(integrationURL);
>>>> unit.removeClassPath(integration);
>>>> }
>>>> catch (Throwable t)
>>>>
>>>> Added:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java 
>>>>
>>>> (rev 0)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -0,0 +1,54 @@
>>>> +/*
>>>> + * JBoss, Home of Professional Open Source.
>>>> + * Copyright 2009, Red Hat Middleware LLC, 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.deployers.vfs.plugins.structure;
>>>> +
>>>> +import java.io.Closeable;
>>>> +import java.util.List;
>>>> +
>>>> +import org.jboss.vfs.VFSUtils;
>>>> +
>>>> +/**
>>>> + * VFSHandleCleanupTask -
>>>> + *
>>>> + * Task used to close VFS handles.
>>>> + *
>>>> + * @author<a href="baileyje at gmail.com">John Bailey</a>
>>>> + * @version $Revision: 1.1 $
>>>> + */
>>>> +public class VFSHandleCleanupTask implements Runnable {
>>>> + /** The Handles */
>>>> + private final List<Closeable> handles;
>>>> +
>>>> + /**
>>>> + * Constructs a new VFSHandleContext
>>>> + *
>>>> + * @param handles List of VFS handles
>>>> + */
>>>> + public VFSHandleCleanupTask(List<Closeable> handles) {
>>>> + this.handles = handles;
>>>> + }
>>>> +
>>>> + public void run() {
>>>> + VFSUtils.safeClose(handles);
>>>> + }
>>>> +
>>>> +}
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -21,9 +21,13 @@
>>>> */
>>>> package org.jboss.deployers.vfs.plugins.structure.jar;
>>>>
>>>> +import java.io.Closeable;
>>>> +import java.io.IOException;
>>>> +import java.util.ArrayList;
>>>> +import java.util.HashSet;
>>>> +import java.util.List;
>>>> import java.util.Set;
>>>> -import java.util.Collections;
>>>> -import java.util.HashSet;
>>>> +import java.util.concurrent.ScheduledExecutorService;
>>>>
>>>> import org.jboss.beans.metadata.api.annotations.Install;
>>>> import org.jboss.beans.metadata.api.annotations.Uninstall;
>>>> @@ -31,7 +35,11 @@
>>>> import org.jboss.deployers.spi.deployer.matchers.JarExtensionProvider;
>>>> import org.jboss.deployers.spi.structure.ContextInfo;
>>>> import
>>>> org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
>>>> +import org.jboss.deployers.vfs.plugins.structure.VFSHandleCleanupTask;
>>>> import org.jboss.deployers.vfs.spi.structure.StructureContext;
>>>> +import org.jboss.vfs.TempFileProvider;
>>>> +import org.jboss.vfs.VFS;
>>>> +import org.jboss.vfs.VFSUtils;
>>>> import org.jboss.vfs.VirtualFile;
>>>>
>>>> /**
>>>> @@ -43,14 +51,29 @@
>>>> */
>>>> public class JARStructure extends AbstractVFSStructureDeployer
>>>> {
>>>> - private final Set<String> suffixes =
>>>> Collections.synchronizedSet(new HashSet<String>());
>>>> + public static final Set<String> DEFAULT_SUFFIXES = new
>>>> HashSet<String>();
>>>> + static {
>>>> +
>>>> + DEFAULT_SUFFIXES.add(".zip");
>>>> + DEFAULT_SUFFIXES.add(".ear");
>>>> + DEFAULT_SUFFIXES.add(".jar");
>>>> + DEFAULT_SUFFIXES.add(".rar");
>>>> + DEFAULT_SUFFIXES.add(".war");
>>>> + DEFAULT_SUFFIXES.add(".sar");
>>>> + DEFAULT_SUFFIXES.add(".har");
>>>> + DEFAULT_SUFFIXES.add(".aop");
>>>> + }
>>>> +
>>>> + private final Set<String> suffixes = new
>>>> HashSet<String>();//Collections.synchronizedSet(new HashSet<String>());
>>>>
>>>> + private ScheduledExecutorService scheduledExecutorService;
>>>> +
>>>> /**
>>>> * Create a new JARStructure. with the default suffixes
>>>> */
>>>> public JARStructure()
>>>> {
>>>> - this(null);
>>>> + this(DEFAULT_SUFFIXES);
>>>> }
>>>>
>>>> /**
>>>> @@ -64,8 +87,28 @@
>>>> setSuffixes(suffixes);
>>>> setRelativeOrder(10000);
>>>> }
>>>> +
>>>> + /**
>>>> + * Get the scheduled executor service.
>>>> + *
>>>> + * @return the scheduled executor service
>>>> + */
>>>> + public ScheduledExecutorService getScheduledExecutorService()
>>>> + {
>>>> + return scheduledExecutorService;
>>>> + }
>>>>
>>>> /**
>>>> + * Set the scheduled executor service.
>>>> + *
>>>> + * @param scheduledExecutorService the scheduled executor service
>>>> + */
>>>> + public void setScheduledExecutorService(final
>>>> ScheduledExecutorService scheduledExecutorService)
>>>> + {
>>>> + this.scheduledExecutorService = scheduledExecutorService;
>>>> + }
>>>> +
>>>> + /**
>>>> * Gets the set of suffixes recognised as jars
>>>> *
>>>> * @return the set of suffixes
>>>> @@ -102,26 +145,21 @@
>>>> }
>>>>
>>>> private boolean isArchive(String name) {
>>>> - int i = name.length() - 1;
>>>> - for (;;) {
>>>> - i = name.lastIndexOf('.', i);
>>>> - if (i == -1) {
>>>> - return false;
>>>> - }
>>>> - if (suffixes.contains(name.substring(i))) {
>>>> - return true;
>>>> - }
>>>> - }
>>>> + int idx = name.lastIndexOf('.');
>>>> + if(idx == -1)
>>>> + return false;
>>>> + return suffixes.contains(name.substring(idx).toLowerCase());
>>>> }
>>>>
>>>> public boolean determineStructure(StructureContext structureContext)
>>>> throws DeploymentException
>>>> {
>>>> ContextInfo context = null;
>>>> VirtualFile file = structureContext.getFile();
>>>> + final List<Closeable> handles = new ArrayList<Closeable>();
>>>> try
>>>> {
>>>> boolean trace = log.isTraceEnabled();
>>>> -
>>>> +
>>>> if (isLeaf(file) == false)
>>>> {
>>>> // For non top level directories that don't look like jars
>>>> @@ -131,7 +169,7 @@
>>>> if (structureContext.isTopLevel() == false)
>>>> {
>>>> VirtualFile child = file.getChild("META-INF");
>>>> - if (child != null)
>>>> + if (child != null&& child.exists())
>>>> {
>>>> if (trace)
>>>> log.trace("... ok - non top level directory has a META-INF
>>>> subdirectory");
>>>> @@ -157,6 +195,12 @@
>>>> {
>>>> if (trace)
>>>> log.trace("... ok - its an archive or at least pretending to be.");
>>>> +
>>>> + try {
>>>> + handles.add(VFS.mountZipExpanded(file, file,
>>>> TempFileProvider.create(file.getName(), scheduledExecutorService)));
>>>> + } catch (IOException e) {
>>>> + DeploymentException.rethrowAsDeploymentException("Failed to mount
>>>> JAR archive", e);
>>>> + }
>>>> }
>>>> else
>>>> {
>>>> @@ -188,11 +232,16 @@
>>>>
>>>> // We try all the children as potential subdeployments
>>>> addAllChildren(structureContext);
>>>> +
>>>> + context.setCleanupTask(new VFSHandleCleanupTask(handles));
>>>> }
>>>> return valid;
>>>> }
>>>> catch (Exception e)
>>>> {
>>>> + // Undo all mounts
>>>> + VFSUtils.safeClose(handles);
>>>> +
>>>> // Remove the invalid context
>>>> if(context != null)
>>>> structureContext.removeChild(context);
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -21,6 +21,7 @@
>>>> */
>>>> package org.jboss.test.deployers;
>>>>
>>>> +import java.net.MalformedURLException;
>>>> import java.net.URL;
>>>>
>>>> import org.jboss.deployers.client.spi.DeployerClient;
>>>> @@ -36,7 +37,6 @@
>>>> import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
>>>> import org.jboss.vfs.VFS;
>>>> import org.jboss.vfs.VirtualFile;
>>>> -import org.jboss.vfs.plugins.context.jar.JarUtils;
>>>>
>>>> /**
>>>> * BaseDeployersVFSTest.
>>>> @@ -70,7 +70,7 @@
>>>> protected VirtualFile getVirtualFile(String root, String path) throws
>>>> Exception
>>>> {
>>>> URL url = getResource(root);
>>>> - return VFS.getVirtualFile(url, path);
>>>> + return VFS.getChild(url).getChild(path);
>>>> }
>>>>
>>>> /**
>>>> @@ -108,7 +108,7 @@
>>>> protected String getJarURL(String path) throws Exception
>>>> {
>>>> URL url = getResource(path);
>>>> - url = JarUtils.createJarURL(url);
>>>> + url = createJarURL(url);
>>>> return url.toString();
>>>> }
>>>>
>>>> @@ -159,4 +159,12 @@
>>>> VirtualFile file = getVirtualFile(root, path);
>>>> return new AbstractVFSDeploymentContext(file, "");
>>>> }
>>>> +
>>>> + private URL createJarURL(URL url) throws MalformedURLException
>>>> + {
>>>> + if (url == null)
>>>> + throw new IllegalArgumentException("Null url");
>>>> + return new URL("jar:" + url + "!/");
>>>> + }
>>>> +
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -21,6 +21,7 @@
>>>> */
>>>> package org.jboss.test.deployers;
>>>>
>>>> +import java.net.URISyntaxException;
>>>> import java.net.URL;
>>>> import java.security.CodeSource;
>>>> import java.security.ProtectionDomain;
>>>> @@ -43,12 +44,9 @@
>>>> import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
>>>> import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
>>>> import org.jboss.test.kernel.junit.MicrocontainerTest;
>>>> -import org.jboss.vfs.AssembledDirectory;
>>>> import org.jboss.vfs.VFS;
>>>> import org.jboss.vfs.VirtualFile;
>>>> -import org.jboss.vfs.plugins.context.file.FileSystemContext;
>>>> -import org.jboss.vfs.plugins.context.jar.JarUtils;
>>>> -import org.jboss.vfs.plugins.vfs.helpers.SuffixesExcludeFilter;
>>>> +import org.jboss.vfs.util.SuffixesExcludeFilter;;
>>>>
>>>> /**
>>>> * BootstrapDeployersTest.
>>>> @@ -96,12 +94,12 @@
>>>> return (BootstrapDeployersTestDelegate) super.getDelegate();
>>>> }
>>>>
>>>> - protected VirtualFile createDeploymentRoot(String root, String
>>>> child) throws IOException
>>>> + protected VirtualFile createDeploymentRoot(String root, String
>>>> child) throws IOException, URISyntaxException
>>>> {
>>>> URL resourceRoot = getClass().getResource(root);
>>>> if (resourceRoot == null)
>>>> fail("Resource not found: " + root);
>>>> - VirtualFile deployment = VFS.getVirtualFile(resourceRoot, child);
>>>> + VirtualFile deployment = VFS.getChild(resourceRoot).getChild(child);
>>>> if (deployment == null)
>>>> fail("Child not found " + child + " from " + resourceRoot);
>>>> return deployment;
>>>> @@ -351,9 +349,5 @@
>>>> super.setUp();
>>>> // This is a hack for a hack. ;-)
>>>> AbstractJDKChecker.getExcluded().add(BootstrapDeployersTest.class);
>>>> -
>>>> - // Reduce the noise from the VFS
>>>> - // FIXME add method change logging levels to AbstractTestCase
>>>> - Logger.getLogger(FileSystemContext.class).setLevel(Level.INFO);
>>>> }
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestMetaDataUrlIntegrationDeployer.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestMetaDataUrlIntegrationDeployer.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestMetaDataUrlIntegrationDeployer.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -25,7 +25,6 @@
>>>>
>>>> import
>>>> org.jboss.deployers.vfs.plugins.classloader.MetaDataUrlIntegrationDeployer; 
>>>>
>>>>
>>>> import org.jboss.kernel.spi.deployment.KernelDeployment;
>>>> -import org.jboss.vfs.VFS;
>>>>
>>>> /**
>>>> * @author<a href="mailto:ales.justin at jboss.com">Ales Justin</a>
>>>> @@ -36,7 +35,6 @@
>>>> {
>>>> super(KernelDeployment.class);
>>>> setFiles(new String[]{"metadata-touch-beans.xml"});
>>>> - VFS.init();
>>>> URL dynamicClassRoot = new URL("vfsmemory", "integration-test", "");
>>>> setIntegrationURL(dynamicClassRoot);
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestPathUrlIntegrationDeployer.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestPathUrlIntegrationDeployer.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/support/TestPathUrlIntegrationDeployer.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -25,7 +25,6 @@
>>>>
>>>> import
>>>> org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
>>>> import org.jboss.kernel.spi.deployment.KernelDeployment;
>>>> -import org.jboss.vfs.VFS;
>>>>
>>>> /**
>>>> * @author<a href="mailto:ales.justin at jboss.com">Ales Justin</a>
>>>> @@ -36,7 +35,6 @@
>>>> {
>>>> super(KernelDeployment.class);
>>>> setFiles(new String[]{"data/path-touch-beans.xml"});
>>>> - VFS.init();
>>>> URL dynamicClassRoot = new URL("vfsmemory", "integration-test", "");
>>>> setIntegrationURL(dynamicClassRoot);
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -32,7 +32,7 @@
>>>> import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
>>>> import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
>>>> import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
>>>> -import org.jboss.deployers.vfs.plugins.structure.war.WARStructure;
>>>> +//import org.jboss.deployers.vfs.plugins.structure.war.WARStructure;
>>>> import org.jboss.deployers.vfs.spi.client.VFSDeployment;
>>>> import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
>>>> import org.jboss.deployers.vfs.spi.structure.StructureDeployer;
>>>> @@ -40,7 +40,6 @@
>>>> import org.jboss.test.BaseTestCase;
>>>> import org.jboss.vfs.VFS;
>>>> import org.jboss.vfs.VirtualFile;
>>>> -import org.jboss.vfs.VFSUtils;
>>>>
>>>> /**
>>>> * AbstractStructureUnitTestCase.
>>>> @@ -56,11 +55,11 @@
>>>> super(name);
>>>> }
>>>>
>>>> - protected void assertUnpacked(VirtualFile file) throws Exception
>>>> - {
>>>> - VirtualFile modified = VFSUtils.unpack(file);
>>>> - assertTrue(VFSUtils.isTemporaryFile(modified));
>>>> - }
>>>> +// protected void assertUnpacked(VirtualFile file) throws Exception
>>>> +// {
>>>> +// VirtualFile modified = VFSUtils.unpack(file);
>>>> +// assertTrue(VFSUtils.isTemporaryFile(modified));
>>>> +// }
>>>>
>>>> protected void assertNoChildContexts(VFSDeploymentContext context)
>>>> {
>>>> @@ -161,7 +160,7 @@
>>>> {
>>>> VirtualFile root = context.getRoot();
>>>> List<VirtualFile> metaDataLocation = context.getMetaDataLocations();
>>>> - VirtualFile expected = root.findChild(metaDataPath);
>>>> + VirtualFile expected = root.getChild(metaDataPath);
>>>> assertNotNull(metaDataLocation);
>>>> assertEquals(1, metaDataLocation.size());
>>>> assertEquals(expected, metaDataLocation.get(0));
>>>> @@ -175,7 +174,7 @@
>>>> int i = 0;
>>>> for(String path : metaDataPath)
>>>> {
>>>> - VirtualFile expected = root.findChild(path);
>>>> + VirtualFile expected = root.getChild(path);
>>>> assertEquals(expected, metaDataLocations.get(i++));
>>>> }
>>>> }
>>>> @@ -216,7 +215,7 @@
>>>> for (String path : paths)
>>>> {
>>>> VirtualFile ref = reference.getRoot();
>>>> - VirtualFile expected = ref.findChild(path);
>>>> + VirtualFile expected = ref.getChild(path);
>>>> assertTrue("Expected " + expected +" in " + classPath,
>>>> classPath.contains(expected));
>>>> }
>>>> }
>>>> @@ -250,7 +249,7 @@
>>>>
>>>> protected VFSDeploymentContext
>>>> determineStructureWithAllStructureDeployers(VFSDeployment deployment)
>>>> throws Exception
>>>> {
>>>> - return determineStructureWithStructureDeployers(deployment, new
>>>> FileStructure(), new WARStructure(), new JARStructure());
>>>> + return determineStructureWithStructureDeployers(deployment, new
>>>> FileStructure(), /**new WARStructure(),*/ new JARStructure());
>>>> }
>>>>
>>>> protected VFSDeploymentContext
>>>> determineStructureWithStructureDeployers(VFSDeployment deployment,
>>>> StructureDeployer... deployers) throws Exception
>>>> @@ -295,6 +294,7 @@
>>>> {
>>>> VFSDeploymentContext result = assertDeploy(context, path);
>>>> assertNoChildContexts(result);
>>>> + result.cleanup();
>>>> return result;
>>>> }
>>>>
>>>> @@ -321,7 +321,8 @@
>>>> protected VirtualFile getVirtualFile(String root, String path) throws
>>>> Exception
>>>> {
>>>> URL url = getResource(root);
>>>> - return VFS.getVirtualFile(url, path);
>>>> + VirtualFile rootFile = VFS.getChild(url);
>>>> + return rootFile.getChild(path);
>>>> }
>>>>
>>>> @Override
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -42,7 +42,7 @@
>>>> import org.jboss.vfs.VFSUtils;
>>>> import org.jboss.vfs.VirtualFile;
>>>> import org.jboss.vfs.VirtualFileFilter;
>>>> -import org.jboss.vfs.plugins.vfs.helpers.SuffixMatchFilter;
>>>> +import org.jboss.vfs.util.SuffixMatchFilter;
>>>>
>>>> /**
>>>> * A mock ear structure deployer that illustrates concepts involved
>>>> with an ear
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -48,7 +48,8 @@
>>>> public void testDirectory() throws Throwable
>>>> {
>>>> // The jar deployer recognises the directory in the combined test
>>>> - assertDeployNoChildren("/structure/file", "directory");
>>>> + VFSDeploymentContext vfsDeploymentContext =
>>>> assertDeployNoChildren("/structure/file", "directory");
>>>> + assertNotNull(vfsDeploymentContext.getVfsHandles());
>>>> }
>>>>
>>>> public void testNotKnownInSubdirectory() throws Throwable
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -42,9 +42,8 @@
>>>> import org.jboss.test.BaseTestCase;
>>>> import
>>>> org.jboss.test.deployers.vfs.structure.file.support.BshFileMatcher;
>>>> import
>>>> org.jboss.test.deployers.vfs.structure.file.support.TmpFileStructure;
>>>> +import org.jboss.vfs.VFS;
>>>> import org.jboss.vfs.VirtualFile;
>>>> -import org.jboss.vfs.spi.VFSContext;
>>>> -import org.jboss.vfs.spi.VirtualFileHandler;
>>>>
>>>> /**
>>>> * FileMatcherTestCase.
>>>> @@ -65,7 +64,7 @@
>>>>
>>>> protected VirtualFile getVirtualFile() throws Throwable
>>>> {
>>>> - return new MyVirtualFile();
>>>> + return VFS.getChild("somefile.bsh");
>>>> }
>>>>
>>>> public void testMatcher() throws Throwable
>>>> @@ -100,162 +99,162 @@
>>>> }
>>>> }
>>>>
>>>> - private static class MyVirtualFile extends VirtualFile
>>>> - {
>>>> - /** The serialVersionUID */
>>>> - private static final long serialVersionUID = 1L;
>>>> -
>>>> - public MyVirtualFile()
>>>> - {
>>>> - super(getVirtualFileHandler());
>>>> - }
>>>> -
>>>> - private static VirtualFileHandler getVirtualFileHandler()
>>>> - {
>>>> - return new VirtualFileHandler()
>>>> - {
>>>> - /** The serialVersionUID */
>>>> - private static final long serialVersionUID = 1L;
>>>> -
>>>> - public String getName()
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public String getPathName()
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public URL toVfsUrl() throws MalformedURLException, 
>>>> URISyntaxException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public URI toURI() throws URISyntaxException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public URL toURL() throws MalformedURLException, URISyntaxException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public long getLastModified() throws IOException
>>>> - {
>>>> - return 0;
>>>> - }
>>>> -
>>>> - public boolean hasBeenModified() throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public long getSize() throws IOException
>>>> - {
>>>> - return 0;
>>>> - }
>>>> -
>>>> - public boolean exists() throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public boolean isLeaf() throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public boolean isArchive() throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public boolean isHidden() throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public String getLocalPathName()
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public boolean isNested() throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public InputStream openStream() throws IOException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public VirtualFileHandler getParent() throws IOException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public List<VirtualFileHandler> getChildren(boolean ignoreErrors)
>>>> throws IOException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public VirtualFileHandler getChild(String path) throws IOException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public VFSContext getVFSContext()
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public VirtualFile getVirtualFile()
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public void close()
>>>> - {
>>>> -
>>>> - }
>>>> -
>>>> - public void replaceChild(VirtualFileHandler original,
>>>> VirtualFileHandler replacement)
>>>> - {
>>>> -
>>>> - }
>>>> -
>>>> - public boolean removeChild(String name) throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public boolean delete(int gracePeriod) throws IOException
>>>> - {
>>>> - return false;
>>>> - }
>>>> -
>>>> - public URL getRealURL() throws IOException, URISyntaxException
>>>> - {
>>>> - return null;
>>>> - }
>>>> -
>>>> - public void cleanup()
>>>> - {
>>>> - }
>>>> -
>>>> - public Certificate[] getCertificates()
>>>> - {
>>>> - return null;
>>>> - }
>>>> - };
>>>> - }
>>>> -
>>>> - public String getName()
>>>> - {
>>>> - return "somefile.bsh";
>>>> - }
>>>> - }
>>>> +// private static class MyVirtualFile extends VirtualFile
>>>> +// {
>>>> +// /** The serialVersionUID */
>>>> +// private static final long serialVersionUID = 1L;
>>>> +//
>>>> +// public MyVirtualFile()
>>>> +// {
>>>> +// super(getVirtualFileHandler());
>>>> +// }
>>>> +//
>>>> +// private static VirtualFileHandler getVirtualFileHandler()
>>>> +// {
>>>> +// return new VirtualFileHandler()
>>>> +// {
>>>> +// /** The serialVersionUID */
>>>> +// private static final long serialVersionUID = 1L;
>>>> +//
>>>> +// public String getName()
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public String getPathName()
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public URL toVfsUrl() throws MalformedURLException,
>>>> URISyntaxException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public URI toURI() throws URISyntaxException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public URL toURL() throws MalformedURLException, URISyntaxException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public long getLastModified() throws IOException
>>>> +// {
>>>> +// return 0;
>>>> +// }
>>>> +//
>>>> +// public boolean hasBeenModified() throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public long getSize() throws IOException
>>>> +// {
>>>> +// return 0;
>>>> +// }
>>>> +//
>>>> +// public boolean exists() throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public boolean isLeaf() throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public boolean isArchive() throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public boolean isHidden() throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public String getLocalPathName()
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public boolean isNested() throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public InputStream openStream() throws IOException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public VirtualFileHandler getParent() throws IOException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public List<VirtualFileHandler> getChildren(boolean ignoreErrors)
>>>> throws IOException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public VirtualFileHandler getChild(String path) throws IOException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public VFSContext getVFSContext()
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public VirtualFile getVirtualFile()
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public void close()
>>>> +// {
>>>> +//
>>>> +// }
>>>> +//
>>>> +// public void replaceChild(VirtualFileHandler original,
>>>> VirtualFileHandler replacement)
>>>> +// {
>>>> +//
>>>> +// }
>>>> +//
>>>> +// public boolean removeChild(String name) throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public boolean delete(int gracePeriod) throws IOException
>>>> +// {
>>>> +// return false;
>>>> +// }
>>>> +//
>>>> +// public URL getRealURL() throws IOException, URISyntaxException
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +//
>>>> +// public void cleanup()
>>>> +// {
>>>> +// }
>>>> +//
>>>> +// public Certificate[] getCertificates()
>>>> +// {
>>>> +// return null;
>>>> +// }
>>>> +// };
>>>> +// }
>>>> +//
>>>> +// public String getName()
>>>> +// {
>>>> +// return "somefile.bsh";
>>>> +// }
>>>> +// }
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/ConfiguredSuffixJARStructureUnitTestCase.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -28,7 +28,6 @@
>>>> import junit.framework.TestSuite;
>>>> import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
>>>> import org.jboss.test.BaseTestCase;
>>>> -import org.jboss.vfs.plugins.context.jar.JarUtils;
>>>>
>>>> /**
>>>> * ConfiguredSuffixJARStructureUnitTestCase.
>>>> @@ -40,8 +39,8 @@
>>>> public class ConfiguredSuffixJARStructureUnitTestCase extends
>>>> BaseTestCase
>>>> {
>>>> /** The file structure deployer */
>>>> - private static final Set<String> defaultSuffixes =
>>>> JarUtils.getSuffixes();
>>>> -
>>>> + private static final Set<String> defaultSuffixes =
>>>> JARStructure.DEFAULT_SUFFIXES;
>>>> +
>>>> public static Test suite()
>>>> {
>>>> return new TestSuite(ConfiguredSuffixJARStructureUnitTestCase.class);
>>>> @@ -73,24 +72,17 @@
>>>>
>>>> public void testOverwriteDefaults() throws Exception
>>>> {
>>>> - try
>>>> - {
>>>> - Set<String> newSuffixes = new HashSet<String>();
>>>> - newSuffixes.add(".bar");
>>>> - newSuffixes.add(".tar");
>>>> - newSuffixes.add(".far");
>>>> -
>>>> - JARStructure structure = new JARStructure(newSuffixes);
>>>> - Set<String> suffixes = structure.getSuffixes();
>>>> - assertNotNull(suffixes);
>>>> - assertEquals(3, suffixes.size());
>>>> - assertTrue(suffixes.contains(".bar"));
>>>> - assertTrue(suffixes.contains(".tar"));
>>>> - assertTrue(suffixes.contains(".far"));
>>>> - }
>>>> - finally
>>>> - {
>>>> - JarUtils.setJarSuffixes(defaultSuffixes);
>>>> - }
>>>> + Set<String> newSuffixes = new HashSet<String>();
>>>> + newSuffixes.add(".bar");
>>>> + newSuffixes.add(".tar");
>>>> + newSuffixes.add(".far");
>>>> +
>>>> + JARStructure structure = new JARStructure(newSuffixes);
>>>> + Set<String> suffixes = structure.getSuffixes();
>>>> + assertNotNull(suffixes);
>>>> + assertEquals(3, suffixes.size());
>>>> + assertTrue(suffixes.contains(".bar"));
>>>> + assertTrue(suffixes.contains(".tar"));
>>>> + assertTrue(suffixes.contains(".far"));
>>>> }
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/JARStructureUnitTestCase.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/JARStructureUnitTestCase.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/jar/test/JARStructureUnitTestCase.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -48,6 +48,6 @@
>>>>
>>>> protected VFSDeploymentContext determineStructure(VFSDeployment
>>>> deployment) throws Exception
>>>> {
>>>> - return determineStructureWithStructureDeployer(deployment, new
>>>> JARStructure());
>>>> + return determineStructureWithStructureDeployers(deployment, false,
>>>> new JARStructure());
>>>> }
>>>> }
>>>>
>>>> Modified:
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/AbstractWARStructureTest.java 
>>>>
>>>>
>>>> ===================================================================
>>>> ---
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/AbstractWARStructureTest.java 
>>>>
>>>> 2009-10-21 02:14:24 UTC (rev 95236)
>>>> +++
>>>> projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/AbstractWARStructureTest.java 
>>>>
>>>> 2009-10-21 02:20:48 UTC (rev 95237)
>>>> @@ -74,11 +74,11 @@
>>>> assertNotNull("classpath", classpath);
>>>> assertEquals("classpath.size = 3", 3, classpath.size());
>>>> VirtualFile warFile = war.getRoot();
>>>> - VirtualFile classes = warFile.findChild("WEB-INF/classes");
>>>> + VirtualFile classes = warFile.getChild("WEB-INF/classes");
>>>> assertTrue("WEB-INF/classes in classpath", 
>>>> classpath.contains(classes));
>>>> - VirtualFile j0 = warFile.findChild("WEB-INF/lib/j0.jar");
>>>> + VirtualFile j0 = warFile.getChild("WEB-INF/lib/j0.jar");
>>>> assertTrue("WEB-INF/lib/j0.jar in classpath", classpath.contains(j0));
>>>> - VirtualFile j1 = warFile.findChild("WEB-INF/lib/j1.jar");
>>>> + VirtualFile j1 = warFile.getChild("WEB-INF/lib/j1.jar");
>>>> assertTrue("WEB-INF/lib/j1.jar in classpath", classpath.contains(j1));
>>>> }
>>>> }
>>>>
>>>> Modified: projects/jboss-deployers/branches/vfs3/pom.xml
>>>> ===================================================================
>>>> --- projects/jboss-deployers/branches/vfs3/pom.xml 2009-10-21
>>>> 02:14:24 UTC (rev 95236)
>>>> +++ projects/jboss-deployers/branches/vfs3/pom.xml 2009-10-21
>>>> 02:20:48 UTC (rev 95237)
>>>> @@ -28,8 +28,8 @@
>>>> <version.jboss.classloader>2.2.0-SNAPSHOT</version.jboss.classloader>
>>>> <version.jboss.classloading.spi>5.1.0.SP1</version.jboss.classloading.spi> 
>>>>
>>>>
>>>> <version.jboss.common.core>2.2.14.GA</version.jboss.common.core>
>>>> -<version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
>>>> -<version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
>>>> +<version.jboss.logging.spi>2.2.0.CR1</version.jboss.logging.spi>
>>>> +<version.jboss.logging.log4j>2.2.0.CR1</version.jboss.logging.log4j>
>>>> <version.jbossxb>2.0.2-SNAPSHOT</version.jbossxb>
>>>> <version.jboss.aop>2.1.0.CR3</version.jboss.aop>
>>>> <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> _______________________________________________
>>>> jboss-cvs-commits mailing list
>>>> jboss-cvs-commits at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/jboss-cvs-commits
>>>>
>>>>
>>>> End of jboss-cvs-commits Digest, Vol 40, Issue 464
>>>> **************************************************
>>>>
>>> _______________________________________________
>>> jboss-cvs-commits mailing list
>>> jboss-cvs-commits at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/jboss-cvs-commits
> 



More information about the jboss-cvs-commits mailing list