[jboss-cvs] JBossAS SVN: r59515 - trunk/embedded/src/main/java/org/jboss/embedded.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 11 02:03:21 EST 2007
Author: bill.burke at jboss.com
Date: 2007-01-11 02:03:21 -0500 (Thu, 11 Jan 2007)
New Revision: 59515
Removed:
trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java
Log:
optimize imports
Deleted: trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java 2007-01-11 07:02:29 UTC (rev 59514)
+++ trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java 2007-01-11 07:03:21 UTC (rev 59515)
@@ -1,205 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.embedded;
-
-import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
-import org.jboss.deployers.spi.deployment.MainDeployer;
-import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * comment
- *
- * @author <a href="bill at jboss.com">Bill Burke</a>
- * @version $Revision: 1.1 $
- */
-public class ClasspathResourceScanner
-{
- private ArrayList<String> resources;
- private ArrayList<String> deployDirsByResource;
- private MainDeployer mainDeployer;
- private ClassLoader classLoader;
- private VirtualFileFilter filter;
-
-
- public ArrayList<String> getResources()
- {
- return resources;
- }
-
- public void setResources(ArrayList<String> resources)
- {
- this.resources = resources;
- }
-
-
- public ArrayList<String> getDeployDirsByResource()
- {
- return deployDirsByResource;
- }
-
-
- public ClassLoader getClassLoader()
- {
- return classLoader;
- }
-
- public void setClassLoader(ClassLoader classLoader)
- {
- this.classLoader = classLoader;
- }
-
-
- public VirtualFileFilter getFilter()
- {
- return filter;
- }
-
- public void setFilter(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
-
- /**
- * List of resources where whose directory will be used as a deploy directory
- * <p/>
- * The '.' character can be used to specify the current directory.
- * The '..' string can be used to specify a higher relative path
- * <p/>
- * i.e.
- * <p/>
- * "org/jboss/Test.class"
- * file:/<root>/org/jboss/
- * <p/>
- * "org/jboss/Test.class/.."
- * file:/<root>/org/
- * <p/>
- * "org/jboss/Test.class/../acme"
- * file:/<root>/org/acme/
- * <p/>
- * "org/jboss/Test.class/./embedded"
- * file:/<root>/org/jboss/embedded/
- */
- public void setDeployDirsByResource(ArrayList<String> deployDirsByResource)
- {
- this.deployDirsByResource = deployDirsByResource;
- }
-
- public void setMainDeployer(MainDeployer mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * A helper to find all deployments under a directory vf
- * and add them to the supplied list.
- *
- * We may recurse.
- */
- private void addDeployments(List<VirtualFile> list, VirtualFile root)
- throws IOException
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile component : components)
- {
- // Filter the component regardless of its type
- if( filter != null && filter.accepts(component) == false)
- continue;
- if (component.isLeaf())
- {
- list.add(component);
- }
- // TODO replace . in the name with isArchive() == false?
- else if (component.getName().indexOf('.') == -1)
- {
- // recurse if not '.' in name and recursive search is enabled
- addDeployments(list, component);
- }
- else
- {
- list.add(component);
- }
- }
- }
-
-
- public void start() throws Exception
- {
- if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader();
- if (resources != null)
- {
- for (String resource : resources)
- {
- URL url = classLoader.getResource(resource);
- VirtualFile file = null;
- try
- {
- file = VFS.getRoot(url);
- }
- catch (Exception e)
- {
- throw new Exception("Unable to find resource: " + resource, e);
- }
- DeploymentContext deployment = new AbstractDeploymentContext(file);
- mainDeployer.addDeploymentContext(deployment);
- }
- mainDeployer.process();
- }
- if (deployDirsByResource != null)
- {
- for (String deployDir : deployDirsByResource)
- {
- URL url = DeploymentGroupBean.getDirFromResource(classLoader, deployDir);
- if (url == null)
- {
- throw new Exception("Unable to find deployDir from resource: " + deployDir);
- }
- VirtualFile file = null;
- try
- {
- file = VFS.getRoot(url);
- }
- catch (Exception e)
- {
- throw new Exception("Unable to find deployDir from resource: " + deployDir, e);
- }
- List<VirtualFile> files = new ArrayList<VirtualFile>();
- addDeployments(files, file);
- for (VirtualFile vf : files)
- {
- DeploymentContext deployment = new AbstractDeploymentContext(vf);
- mainDeployer.addDeploymentContext(deployment);
- }
- mainDeployer.process();
- }
- }
- }
-
-}
More information about the jboss-cvs-commits
mailing list