[jboss-cvs] JBossAS SVN: r101051 - in projects/metadata/common/tags: 2.0.0.Alpha11 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 16 17:17:58 EST 2010


Author: johnbailey
Date: 2010-02-16 17:17:58 -0500 (Tue, 16 Feb 2010)
New Revision: 101051

Added:
   projects/metadata/common/tags/2.0.0.Alpha11/
   projects/metadata/common/tags/2.0.0.Alpha11/pom.xml
   projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
Removed:
   projects/metadata/common/tags/2.0.0.Alpha11/pom.xml
   projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
Log:
[maven-release-plugin]  copy for tag 2.0.0.Alpha11

Copied: projects/metadata/common/tags/2.0.0.Alpha11 (from rev 101048, projects/metadata/common/trunk)

Deleted: projects/metadata/common/tags/2.0.0.Alpha11/pom.xml
===================================================================
--- projects/metadata/common/trunk/pom.xml	2010-02-16 21:55:55 UTC (rev 101048)
+++ projects/metadata/common/tags/2.0.0.Alpha11/pom.xml	2010-02-16 22:17:58 UTC (rev 101051)
@@ -1,221 +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.jboss</groupId>
-    <artifactId>jboss-parent</artifactId>
-    <version>4.0.CR1</version>
-  </parent>
-  <groupId>org.jboss.metadata</groupId>
-  <artifactId>jboss-metadata-common</artifactId>
-  <packaging>jar</packaging>
-  <version>2.0.0-SNAPSHOT</version>
-  <name>JBoss Metadata Common</name>
-  <url>http://www.jboss.org</url>
-  <description>The common JavaEE metadata classes</description>
-  <scm>
-    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/metadata/common/trunk</connection>
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/metadata/common/trunk</developerConnection>
-  </scm>
-
-  <build>
-    <outputDirectory>${profile.outputDirectory}</outputDirectory>
-    <testOutputDirectory>${profile.testOutputDirectory}</testOutputDirectory>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.4.3</version>
-        <configuration>
-          <printSummary>true</printSummary>
-          <disableXmlReport>false</disableXmlReport>
-          <redirectTestOutputToFile>true</redirectTestOutputToFile>
-           <testFailureIgnore>false</testFailureIgnore>
-          <includes>
-            <include>**/*TestCase.java</include>
-          </includes>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-            <configuration>
-               <excludes>
-                  <exclude>org/jboss/test/metadata/javaee/*TestCase.class</exclude>
-                  <exclude>org/jboss/test/metadata/javaee/*TestCase$*.class</exclude>
-                  <exclude>org/jboss/test/metadata/javaee/*.xml</exclude>
-               </excludes>
-            </configuration> 
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <repositories>
-    <repository>
-      <id>repository.jboss.org</id>
-      <name>JBoss Repository</name>
-      <layout>default</layout>
-      <url>http://repository.jboss.org/maven2/</url>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-    <repository>
-      <id>snapshots.jboss.org</id>
-      <name>JBoss Snapshot Repository</name>
-      <layout>default</layout>
-      <url>http://snapshots.jboss.org/maven2/</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-
-  <!-- 
-    Eclipse settings have been removed from parent. This needs to be
-    done via an eclipse profile.
-    http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085896#4085896 
-    -->
-  <profiles>
-    <profile>
-      <id>default</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-      </activation>
-      <properties>
-        <profile.outputDirectory>target/classes</profile.outputDirectory>
-        <profile.testOutputDirectory>target/tests-classes</profile.testOutputDirectory>
-      </properties>
-    </profile>
-    
-    <profile>
-      <id>eclipse</id>
-      <properties>
-        <profile.outputDirectory>eclipse-target/classes</profile.outputDirectory>
-        <profile.testOutputDirectory>eclipse-target/tests-classes</profile.testOutputDirectory>
-      </properties>
-    </profile>
-  </profiles>
-
-  <!-- Compile Dependencies -->
-  <dependencies>
-
-    <dependency>
-      <groupId>org.jboss.logging</groupId>
-      <artifactId>jboss-logging-spi</artifactId>
-      <version>2.0.5.GA</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-common-core</artifactId>
-      <version>2.2.14.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss.javaee</groupId>
-      <artifactId>jboss-ejb-api</artifactId>
-      <version>3.0.0.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.hibernate</groupId>
-      <artifactId>ejb3-persistence</artifactId>
-      <version>1.0.2.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss.javaee</groupId>
-      <artifactId>jboss-jms-api</artifactId>
-      <version>1.1.0.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss.ws</groupId>
-      <artifactId>jbossws-spi</artifactId>
-      <version>1.0.6.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>jboss.jbossws</groupId>
-      <artifactId>jboss-jaxws</artifactId>
-      <version>3.0.1-native-2.0.4.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jbossxb</artifactId>
-      <version>2.0.2.Beta1</version>
-      <exclusions>
-        <exclusion>
-          <groupId>jboss</groupId>
-          <artifactId>jboss-common-logging-spi</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.xml.bind</groupId>
-          <artifactId>jaxb-api</artifactId>
-        </exclusion>          
-      </exclusions>       
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-vfs</artifactId>
-      <version>2.0.0.CR1</version>    
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-mdr</artifactId>
-      <version>2.0.0.GA</version>
-    </dependency>
-
-    <dependency>
-      <groupId>sun-jaxb</groupId>
-      <artifactId>jaxb-api</artifactId>
-      <version>2.1.4</version>
-   </dependency>
-      
-    <dependency>
-      <groupId>apache-xerces</groupId>
-      <artifactId>xml-apis</artifactId>
-      <version>2.9.1</version>    
-    </dependency>
-    
-    <!-- Test Dependencies -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.4</version>
-      <scope>test</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss.test</groupId>
-      <artifactId>jboss-test</artifactId>
-      <version>1.1.4.GA</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-</project>
\ No newline at end of file

Copied: projects/metadata/common/tags/2.0.0.Alpha11/pom.xml (from rev 101050, projects/metadata/common/trunk/pom.xml)
===================================================================
--- projects/metadata/common/tags/2.0.0.Alpha11/pom.xml	                        (rev 0)
+++ projects/metadata/common/tags/2.0.0.Alpha11/pom.xml	2010-02-16 22:17:58 UTC (rev 101051)
@@ -0,0 +1,221 @@
+<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.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>4.0.CR1</version>
+  </parent>
+  <groupId>org.jboss.metadata</groupId>
+  <artifactId>jboss-metadata-common</artifactId>
+  <packaging>jar</packaging>
+  <version>2.0.0.Alpha11</version>
+  <name>JBoss Metadata Common</name>
+  <url>http://www.jboss.org</url>
+  <description>The common JavaEE metadata classes</description>
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/metadata/common/tags/2.0.0.Alpha11</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/metadata/common/tags/2.0.0.Alpha11</developerConnection>
+  </scm>
+
+  <build>
+    <outputDirectory>${profile.outputDirectory}</outputDirectory>
+    <testOutputDirectory>${profile.testOutputDirectory}</testOutputDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.3</version>
+        <configuration>
+          <printSummary>true</printSummary>
+          <disableXmlReport>false</disableXmlReport>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+           <testFailureIgnore>false</testFailureIgnore>
+          <includes>
+            <include>**/*TestCase.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+            <configuration>
+               <excludes>
+                  <exclude>org/jboss/test/metadata/javaee/*TestCase.class</exclude>
+                  <exclude>org/jboss/test/metadata/javaee/*TestCase$*.class</exclude>
+                  <exclude>org/jboss/test/metadata/javaee/*.xml</exclude>
+               </excludes>
+            </configuration> 
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <repositories>
+    <repository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Repository</name>
+      <layout>default</layout>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshot Repository</name>
+      <layout>default</layout>
+      <url>http://snapshots.jboss.org/maven2/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <!-- 
+    Eclipse settings have been removed from parent. This needs to be
+    done via an eclipse profile.
+    http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085896#4085896 
+    -->
+  <profiles>
+    <profile>
+      <id>default</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <profile.outputDirectory>target/classes</profile.outputDirectory>
+        <profile.testOutputDirectory>target/tests-classes</profile.testOutputDirectory>
+      </properties>
+    </profile>
+    
+    <profile>
+      <id>eclipse</id>
+      <properties>
+        <profile.outputDirectory>eclipse-target/classes</profile.outputDirectory>
+        <profile.testOutputDirectory>eclipse-target/tests-classes</profile.testOutputDirectory>
+      </properties>
+    </profile>
+  </profiles>
+
+  <!-- Compile Dependencies -->
+  <dependencies>
+
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <version>2.2.0.CR1</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-common-core</artifactId>
+      <version>2.2.14.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.javaee</groupId>
+      <artifactId>jboss-ejb-api</artifactId>
+      <version>3.0.0.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>ejb3-persistence</artifactId>
+      <version>1.0.2.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.javaee</groupId>
+      <artifactId>jboss-jms-api</artifactId>
+      <version>1.1.0.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.ws</groupId>
+      <artifactId>jbossws-spi</artifactId>
+      <version>1.0.6.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>jboss.jbossws</groupId>
+      <artifactId>jboss-jaxws</artifactId>
+      <version>3.0.1-native-2.0.4.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jbossxb</artifactId>
+      <version>2.0.2.Beta1</version>
+      <exclusions>
+        <exclusion>
+          <groupId>jboss</groupId>
+          <artifactId>jboss-common-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.xml.bind</groupId>
+          <artifactId>jaxb-api</artifactId>
+        </exclusion>          
+      </exclusions>       
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-vfs</artifactId>
+      <version>3.0.0.CR1</version>    
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-mdr</artifactId>
+      <version>2.0.0.GA</version>
+    </dependency>
+
+    <dependency>
+      <groupId>sun-jaxb</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>2.1.4</version>
+   </dependency>
+      
+    <dependency>
+      <groupId>apache-xerces</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>2.9.1</version>    
+    </dependency>
+    
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.4</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.1.4.GA</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

Deleted: projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	2010-02-16 21:55:55 UTC (rev 101048)
+++ projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	2010-02-16 22:17:58 UTC (rev 101051)
@@ -1,164 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.metadata.serviceref;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamField;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-
-// $Id: VirtualFileAdaptor.java 4049 2007-08-01 11:26:30Z thomas.diesler at jboss.com $
-
-/**
- * A JBoss50 VirtualFile adaptor
- *
- * @author Thomas.Diesler at jboss.org
- * @author Ales.Justin at jboss.org
- * @since 05-May-2006
- */
-public class VirtualFileAdaptor implements UnifiedVirtualFile
-{
-   private static final long serialVersionUID = -4509594124653184347L;
-
-   private static final ObjectStreamField[] serialPersistentFields =
-   {
-      new ObjectStreamField("rootUrl", URL.class),
-      new ObjectStreamField("path", String.class),
-   };
-
-   /** Minimal info to get full vfs file structure */
-   private URL rootUrl;
-   private String path;
-   /** The virtual file */
-   private transient VirtualFile file;
-
-   public VirtualFileAdaptor(VirtualFile file)
-   {
-      this.file = file;
-   }
-
-   public VirtualFileAdaptor(URL rootUrl, String path)
-   {
-      if (rootUrl == null)
-         throw new IllegalArgumentException("Null root url");
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-
-      this.rootUrl = rootUrl;
-      this.path = path;
-   }
-
-   /**
-    * Get the virtual file.
-    * Create file from root url and path if it doesn't exist yet.
-    *
-    * @return virtual file root
-    * @throws IOException for any error
-    */
-   @SuppressWarnings("deprecation")
-   protected VirtualFile getFile() throws IOException
-   {
-      if (file == null)
-      {
-         VirtualFile root = VFS.getRoot(rootUrl);
-         file = root.findChild(path);
-      }
-      return file;
-   }
-
-   @SuppressWarnings("deprecation")
-   public UnifiedVirtualFile findChild(String child) throws IOException
-   {
-      VirtualFile vf = getFile().findChild(child);
-      return new VirtualFileAdaptor(vf);
-   }
-
-   public URL toURL()
-   {
-      try
-      {
-         return getFile().toURL();
-      }
-      catch (Exception e)
-      {
-         return null;
-      }
-   }
-
-   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
-   {
-      URL url = rootUrl;
-      if (url == null)
-      {
-         VFS vfs = getFile().getVFS();
-         url = vfs.getRoot().toURL();
-      }
-      String pathName = path;
-      if (pathName == null)
-         pathName = getFile().getPathName();
-
-      ObjectOutputStream.PutField fields = out.putFields();
-      fields.put("rootUrl", url);
-      fields.put("path", pathName);
-      out.writeFields();
-   }
-
-   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
-   {
-      ObjectInputStream.GetField fields = in.readFields();
-      rootUrl = (URL) fields.get("rootUrl", null);
-      path = (String) fields.get("path", null);
-   }
-
-   public List<UnifiedVirtualFile> getChildren() throws IOException
-   {
-      List<VirtualFile> vfList = getFile().getChildren();
-      if (vfList == null)
-         return null;
-      List<UnifiedVirtualFile> uvfList = new LinkedList<UnifiedVirtualFile>();
-      for (VirtualFile vf : vfList)
-      {
-         uvfList.add(new VirtualFileAdaptor(vf));
-      }
-      return uvfList;
-   }
-
-   public String getName()
-   {
-      try
-      {
-         return getFile().getName();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-}

Copied: projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java (from rev 101049, projects/metadata/common/trunk/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java)
===================================================================
--- projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	                        (rev 0)
+++ projects/metadata/common/tags/2.0.0.Alpha11/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java	2010-02-16 22:17:58 UTC (rev 101051)
@@ -0,0 +1,170 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.metadata.serviceref;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+
+// $Id: VirtualFileAdaptor.java 4049 2007-08-01 11:26:30Z thomas.diesler at jboss.com $
+
+/**
+ * A JBoss50 VirtualFile adaptor
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Ales.Justin at jboss.org
+ * @since 05-May-2006
+ */
+public class VirtualFileAdaptor implements UnifiedVirtualFile
+{
+   private static final long serialVersionUID = -4509594124653184347L;
+
+   private static final ObjectStreamField[] serialPersistentFields =
+   {
+      new ObjectStreamField("rootUrl", URL.class),
+      new ObjectStreamField("path", String.class),
+   };
+
+   /** Minimal info to get full vfs file structure */
+   private URL rootUrl;
+   private String path;
+   /** The virtual file */
+   private transient VirtualFile file;
+
+   public VirtualFileAdaptor(VirtualFile file)
+   {
+      this.file = file;
+   }
+
+   public VirtualFileAdaptor(URL rootUrl, String path)
+   {
+      if (rootUrl == null)
+         throw new IllegalArgumentException("Null root url");
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      this.rootUrl = rootUrl;
+      this.path = path;
+   }
+
+   /**
+    * Get the virtual file.
+    * Create file from root url and path if it doesn't exist yet.
+    *
+    * @return virtual file root
+    * @throws IOException for any error
+    */
+   protected VirtualFile getFile() throws IOException
+   {
+      if (file == null)
+      {
+         VirtualFile root;
+         try
+         {
+            root = VFS.getChild(rootUrl);
+         }
+         catch (URISyntaxException e)
+         {
+            throw new IOException("Unable to get Virtualfile from URL: " + rootUrl, e);
+         }
+         file = root.getChild(path);
+      }
+      return file;
+   }
+
+   public UnifiedVirtualFile findChild(String child) throws IOException
+   {
+      VirtualFile vf = getFile().getChild(child);
+      return new VirtualFileAdaptor(vf);
+   }
+
+   public URL toURL()
+   {
+      try
+      {
+         return getFile().toURL();
+      }
+      catch (Exception e)
+      {
+         return null;
+      }
+   }
+
+   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
+   {
+      URL url = rootUrl;
+      if (url == null)
+      {
+         VirtualFile parentFile = getFile().getParent();
+         url = parentFile != null ? parentFile.toURL() : null;
+      }
+      String pathName = path;
+      if (pathName == null)
+         pathName = getFile().getName();
+
+      ObjectOutputStream.PutField fields = out.putFields();
+      fields.put("rootUrl", url);
+      fields.put("path", pathName);
+      out.writeFields();
+   }
+
+   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      ObjectInputStream.GetField fields = in.readFields();
+      rootUrl = (URL) fields.get("rootUrl", null);
+      path = (String) fields.get("path", null);
+   }
+
+   public List<UnifiedVirtualFile> getChildren() throws IOException
+   {
+      List<VirtualFile> vfList = getFile().getChildren();
+      if (vfList == null)
+         return null;
+      List<UnifiedVirtualFile> uvfList = new LinkedList<UnifiedVirtualFile>();
+      for (VirtualFile vf : vfList)
+      {
+         uvfList.add(new VirtualFileAdaptor(vf));
+      }
+      return uvfList;
+   }
+
+   public String getName()
+   {
+      try
+      {
+         return getFile().getName();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list