[jboss-cvs] JBossAS SVN: r73643 - in projects/jboss-deployers/trunk: deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 23 19:26:16 EDT 2008


Author: alesj
Date: 2008-05-23 19:26:16 -0400 (Fri, 23 May 2008)
New Revision: 73643

Added:
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossExtensionDeployer.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java
Modified:
   projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java
Log:
Multi input type / single output type deployers.

Modified: projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java	2008-05-23 22:09:10 UTC (rev 73642)
+++ projects/jboss-deployers/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java	2008-05-23 23:26:16 UTC (rev 73643)
@@ -127,6 +127,12 @@
     */
    public void setNames(Set<String> names)
    {
+      if (names != null && names.isEmpty() == false)
+      {
+         for (String name : names)
+            if (name == null)
+               throw new IllegalArgumentException("Null name: " + names);
+      }
       this.names = names;
    }
 

Added: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossExtensionDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossExtensionDeployer.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossExtensionDeployer.java	2008-05-23 23:26:16 UTC (rev 73643)
@@ -0,0 +1,84 @@
+/*
+* 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.deployers.vfs.spi.deployer;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * JBossExtensionDeployer.
+ *
+ * @param <U> the spec type
+ * @param <V> the jboss type
+ * @param <T> the expected type
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class JBossExtensionDeployer<U, V, T> extends MultipleSchemaResolverDeployer<T>
+{
+   private Class<U> specClass;
+   private Class<V> jbossClass;
+
+   public JBossExtensionDeployer(Class<T> output, String specName, Class<U> specClass, String jbossName, Class<V> jbossClass)
+   {
+      this(output, specName, specClass, jbossName, jbossClass, null);
+   }
+
+   public JBossExtensionDeployer(Class<T> output, String specName, Class<U> specClass, String jbossName, Class<V> jbossClass, Set<Class<?>> excluded)
+   {
+      super(output, toMap(specName, specClass, jbossName, jbossClass), excluded);
+      if (specClass == null)
+         throw new IllegalArgumentException("Null spec class");
+      if (jbossClass == null)
+         throw new IllegalArgumentException("Null jboss class");
+      this.specClass = specClass;
+      this.jbossClass = jbossClass;
+   }
+
+   protected static Map<String, Class<?>> toMap(String specName, Class specClass, String jbossName, Class jbossClass)
+   {
+      Map<String, Class<?>> map = new HashMap<String, Class<?>>();
+      map.put(specName, specClass);
+      map.put(jbossName, jbossClass);
+      return map;
+   }
+
+   protected T mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, Object> metadata) throws Exception
+   {
+      U spec = specClass.cast(metadata.get(specClass));
+      V jboss = jbossClass.cast(metadata.get(jbossClass));
+      return mergeMetaData(unit, spec, jboss);
+   }
+
+   /**
+    * Merge spec and extension.
+    *
+    * @param unit deployment unit
+    * @param spec the spec metadata instance
+    * @param jboss the jboss metadata instance
+    * @return merged metadata
+    * @throws Exception for any error
+    */
+   protected abstract T mergeMetaData(VFSDeploymentUnit unit, U spec, V jboss) throws Exception;
+}
\ No newline at end of file

Copied: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java (from rev 72857, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java	2008-05-23 23:26:16 UTC (rev 73643)
@@ -0,0 +1,185 @@
+/*
+* 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.deployers.vfs.spi.deployer;
+
+import java.io.InputStream;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+/**
+ * JBossXB deployer.
+ *
+ * @param <T> the expected type
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class JBossXBDeployer<T> extends AbstractVFSParsingDeployer<T>
+{
+   /** Unmarshaller factory */
+   private static final UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
+
+   /** The singleton schema resolver */
+   private static DefaultSchemaResolver resolver = (DefaultSchemaResolver)SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+
+   /** Whether the Unmarshaller will use schema validation */
+   private boolean useSchemaValidation = true;
+
+   /** Whether to validate */
+   private boolean useValidation = true;
+
+   /**
+    * Create a new SchemaResolverDeployer.
+    *
+    * @param output the output
+    * @throws IllegalArgumentException for a null output
+    */
+   protected JBossXBDeployer(Class<T> output)
+   {
+      super(output);
+   }
+
+   /**
+    * Get the useSchemaValidation.
+    *
+    * @return the useSchemaValidation.
+    */
+   public boolean isUseSchemaValidation()
+   {
+      return useSchemaValidation;
+   }
+
+   /**
+    * Set the useSchemaValidation.
+    *
+    * @param useSchemaValidation the useSchemaValidation.
+    */
+   public void setUseSchemaValidation(boolean useSchemaValidation)
+   {
+      this.useSchemaValidation = useSchemaValidation;
+   }
+
+   /**
+    * Get the useValidation.
+    *
+    * @return the useValidation.
+    */
+   public boolean isUseValidation()
+   {
+      return useValidation;
+   }
+
+   /**
+    * Set the useValidation.
+    *
+    * @param useValidation the useValidation.
+    */
+   public void setUseValidation(boolean useValidation)
+   {
+      this.useValidation = useValidation;
+   }
+
+   /**
+    * Add class binding.
+    *
+    * @param namespace the namespace
+    * @param metadata the metadata
+    */
+   protected void addClassBinding(String namespace, Class<?> metadata)
+   {
+      resolver.addClassBinding(namespace, metadata);
+   }
+
+   /**
+    * Remove class binding.
+    *
+    * @param namespace the namespace
+    */
+   protected void removeClassBinding(String namespace)
+   {
+      resolver.removeClassBinding(namespace);
+   }
+
+   /**
+    * Find the namespace on class/package
+    *
+    * @param metadata the metadata class
+    * @return jboss xml schema namespace
+    */
+   protected static String findNamespace(Class<?> metadata)
+   {
+      JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
+      if (jBossXmlSchema == null)
+      {
+         Package pckg = metadata.getPackage();
+         if (pckg != null)
+            jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
+      }
+      return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
+   }
+
+   /**
+    * Parse the file to create metadata instance.
+    *
+    * @param expectedType the expected type
+    * @param file the file
+    * @return new metadata instance
+    * @throws Exception for any error
+    */
+   protected <U> U parse(Class<U> expectedType, VirtualFile file) throws Exception
+   {
+      if (expectedType == null)
+         throw new IllegalArgumentException("Null expected type");
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+
+      log.debug("Parsing file: "+file+" for type: " + expectedType);
+      Unmarshaller unmarshaller = factory.newUnmarshaller();
+      unmarshaller.setSchemaValidation(isUseSchemaValidation());
+      unmarshaller.setValidation(isUseValidation());
+      InputStream is = openStreamAndValidate(file);
+      Object parsed = null;
+      try
+      {
+         parsed = unmarshaller.unmarshal(is, resolver);
+         log.debug("Parsed file: "+file+" to: "+parsed);
+      }
+      finally
+      {
+         try
+         {
+            is.close();
+         }
+         catch (Exception ignored)
+         {
+         }
+      }
+      if (parsed == null)
+         throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!");
+
+      return expectedType.cast(parsed);
+   }
+}
\ No newline at end of file

Copied: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java (from rev 72857, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java	2008-05-23 23:26:16 UTC (rev 73643)
@@ -0,0 +1,181 @@
+/*
+* 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.deployers.vfs.spi.deployer;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.HashMap;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.annotations.JBossXmlConstants;
+
+/**
+ * MultipleSchemaResolverDeployer.
+ *
+ * @param <T> the expected type
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class MultipleSchemaResolverDeployer<T> extends JBossXBDeployer<T>
+{
+   private Map<String, Class<?>> mappings;
+   private Set<Class<?>> excluded;
+   private Set<String> namespaces;
+
+   public MultipleSchemaResolverDeployer(Class<T> output, Map<String, Class<?>> mappings)
+   {
+      this(output, mappings, null);
+   }
+
+   public MultipleSchemaResolverDeployer(Class<T> output, Map<String, Class<?>> mappings, Set<Class<?>> excluded)
+   {
+      super(output);
+      if (mappings == null || mappings.isEmpty())
+         throw new IllegalArgumentException("Illegal mappings");
+      this.mappings = mappings;
+      setNames(mappings.keySet());
+      if (excluded == null)
+         excluded = Collections.emptySet();
+      this.excluded = excluded;
+      this.namespaces = new HashSet<String>();
+   }
+
+   /**
+    * Create a new SchemaResolverDeployer.
+    *
+    * @param output the output
+    * @throws IllegalArgumentException for a null output
+    */
+   public MultipleSchemaResolverDeployer(Class<T> output)
+   {
+      super(output);
+   }
+
+   /**
+    * Check if we need to register schema to jbossxb.
+    */
+   public void create()
+   {
+      for (Class<?> metadata : mappings.values())
+      {
+         if (excluded.contains(metadata) == false)
+         {
+            String namespace = findNamespace(metadata);
+            if (namespace == null || JBossXmlConstants.DEFAULT.equals(namespace))
+               throw new IllegalArgumentException(
+                     "Registering schema with JBossXB is enabled, but cannot find namespace on class or package: " + metadata +
+                     ", perhaps missing @JBossXmlSchema or using default namespace attribute."
+               );
+
+            addClassBinding(namespace, metadata);
+            namespaces.add(namespace);
+         }
+      }
+   }
+
+   /**
+    * Remove registered schema
+    */
+   public void destroy()
+   {
+      for (String namespace : namespaces)
+         removeClassBinding(namespace);
+      namespaces.clear();
+   }
+
+   /**
+    * Match file to mapping metadata class.
+    *
+    * @param file the file
+    * @return matching metadata class
+    */
+   protected Class<?> matchFileToClass(VirtualFile file)
+   {
+      String fileName = file.getName();
+      Class<?> result = mappings.get(fileName);
+      if (result == null)
+      {
+         for(Map.Entry<String, Class<?>> entry : mappings.entrySet())
+         {
+            if (fileName.endsWith(entry.getKey()))
+            {
+               result = entry.getValue();
+               break;
+            }
+         }
+      }
+
+      if (result == null)
+         throw new IllegalArgumentException("Should not be here, file '" + file + "' must macth some mapping: " + mappings);
+
+      return result;
+   }
+
+   @SuppressWarnings("unchecked")
+   protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception
+   {
+      Class<?> expectedClass = matchFileToClass(file);
+      if (getOutput().isAssignableFrom(expectedClass) == false)
+         throw new IllegalArgumentException("Matched " + expectedClass + " which is not assignable to output " + getOutput());
+
+      return (T)parse(expectedClass, file);
+   }
+
+   protected T mergeFiles(VFSDeploymentUnit unit, T root, Set<VirtualFile> files, Set<String> missingFiles) throws Exception
+   {
+      Map<Class<?> , Object> metadata = new HashMap<Class<?>, Object>();
+      for (VirtualFile file : files)
+      {
+         Class<?> clazz = matchFileToClass(file);
+         Object instance = parse(clazz, file);
+         metadata.put(clazz, instance);
+      }
+      return mergeMetaData(unit, root, metadata, missingFiles);
+   }
+
+   /**
+    * Merge metadatas into single piece of metatdata
+    *
+    * @param unit the unit
+    * @param root possibly null pre-existing root
+    * @param metadata the metadatas
+    * @param missingFiles file names that are missing matching file
+    * @return merged metadata
+    * @throws Exception for any error
+    */
+   protected T mergeMetaData(VFSDeploymentUnit unit, T root, Map<Class<?>, Object> metadata, Set<String> missingFiles) throws Exception
+   {
+      return mergeMetaData(unit, metadata);
+   }
+
+   /**
+    * Merge metadatas into single piece of metatdata
+    *
+    * @param unit the unit
+    * @param metadata the metadatas
+    * @return merged metadata
+    * @throws Exception for any error
+    */
+   protected abstract T mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, Object> metadata) throws Exception;
+}
\ No newline at end of file

Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java	2008-05-23 22:09:10 UTC (rev 73642)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java	2008-05-23 23:26:16 UTC (rev 73643)
@@ -21,17 +21,9 @@
 */
 package org.jboss.deployers.vfs.spi.deployer;
 
-import java.io.InputStream;
-
-import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.xb.annotations.JBossXmlSchema;
 import org.jboss.xb.annotations.JBossXmlConstants;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
 
 /**
  * SchemaResolverDeployer.
@@ -42,20 +34,8 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision 1.1 $
  */
-public class SchemaResolverDeployer<T> extends AbstractVFSParsingDeployer<T>
+public class SchemaResolverDeployer<T> extends JBossXBDeployer<T>
 {
-   /** Unmarshaller factory */
-   private static final UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
-
-   /** The singleton schema resolver */
-   private static DefaultSchemaResolver resolver = (DefaultSchemaResolver)SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
-
-   /** Whether the Unmarshaller will use schema validation */
-   private boolean useSchemaValidation = true;
-
-   /** Whether to validate */
-   private boolean useValidation = true;
-
    /** Whether we register with  jbossxb */
    private boolean registerWithJBossXB;
 
@@ -74,46 +54,6 @@
    }
 
    /**
-    * Get the useSchemaValidation.
-    * 
-    * @return the useSchemaValidation.
-    */
-   public boolean isUseSchemaValidation()
-   {
-      return useSchemaValidation;
-   }
-
-   /**
-    * Set the useSchemaValidation.
-    * 
-    * @param useSchemaValidation the useSchemaValidation.
-    */
-   public void setUseSchemaValidation(boolean useSchemaValidation)
-   {
-      this.useSchemaValidation = useSchemaValidation;
-   }
-
-   /**
-    * Get the useValidation.
-    * 
-    * @return the useValidation.
-    */
-   public boolean isUseValidation()
-   {
-      return useValidation;
-   }
-
-   /**
-    * Set the useValidation.
-    * 
-    * @param useValidation the useValidation.
-    */
-   public void setUseValidation(boolean useValidation)
-   {
-      this.useValidation = useValidation;
-   }
-
-   /**
     * Get the registerWithJBossXB.
     *
     * @return the registerWithJBossXB
@@ -150,14 +90,14 @@
    {
       if (isRegisterWithJBossXB())
       {
-         namespace = findNamespace();
+         namespace = findNamespace(getOutput());
          if (namespace == null || JBossXmlConstants.DEFAULT.equals(namespace))
             throw new IllegalArgumentException(
                   "RegisterWithJBossXB is enabled, but cannot find namespace on class or package: " + getOutput() +
                   ", perhaps missing @JBossXmlSchema or using default namespace attribute."
             );
 
-         resolver.addClassBinding(namespace, getOutput());
+         addClassBinding(namespace, getOutput());
       }
    }
 
@@ -169,64 +109,14 @@
       if (isRegisterWithJBossXB())
       {
          // namespace should exist, since we got past create
-         resolver.removeClassBinding(namespace);
+         removeClassBinding(namespace);
       }
    }
 
-   /**
-    * Find the namespace on class/package
-    *
-    * @return jboss xml schema namespace
-    */
-   protected String findNamespace()
-   {
-      Class<T> metadata = getOutput();
-      JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
-      if (jBossXmlSchema == null)
-      {
-         Package pckg = metadata.getPackage();
-         if (pckg != null)
-            jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
-      }
-      return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
-   }
-
    protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception
    {
       if (file == null)
          throw new IllegalArgumentException("Null file");
-      return parse(file);
+      return parse(getOutput(), file);
    }
-
-   protected T parse(VirtualFile file) throws Exception
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
-      
-      log.debug("Parsing file: "+file+" for deploymentType: " + getOutput());
-      Unmarshaller unmarshaller = factory.newUnmarshaller();
-      unmarshaller.setSchemaValidation(isUseSchemaValidation());
-      unmarshaller.setValidation(isUseValidation());
-      InputStream is = openStreamAndValidate(file);
-      Object parsed = null;
-      try
-      {
-         parsed = unmarshaller.unmarshal(is, resolver);
-         log.debug("Parsed file: "+file+" to: "+parsed);
-      }
-      finally
-      {
-         try
-         {
-            is.close();
-         }
-         catch (Exception ignored)
-         {
-         }
-      }
-      if (parsed == null)
-         throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!");
-
-      return getOutput().cast(parsed);
-   }
 }




More information about the jboss-cvs-commits mailing list