Author: alessio.soldano(a)jboss.com
Date: 2009-04-21 12:18:03 -0400 (Tue, 21 Apr 2009)
New Revision: 9851
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/ArchiveDeploymentImpl.java
Log:
[JBWS-2619] Using additional metadata files
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/ArchiveDeploymentImpl.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/ArchiveDeploymentImpl.java 2009-04-21
16:17:13 UTC (rev 9850)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/ArchiveDeploymentImpl.java 2009-04-21
16:18:03 UTC (rev 9851)
@@ -24,7 +24,10 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import org.jboss.logging.Logger;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
@@ -40,6 +43,10 @@
private ArchiveDeployment parent;
// The root file for this deployment
private UnifiedVirtualFile rootFile;
+
+ private static Logger log = Logger.getLogger(ArchiveDeploymentImpl.class);
+
+ private List<UnifiedVirtualFile> metadataFiles;
ArchiveDeploymentImpl(String simpleName, ClassLoader classLoader)
{
@@ -94,11 +101,60 @@
if (resourceURL == null && getRootFile() != null)
{
- UnifiedVirtualFile vfResource = getRootFile().findChild(resourcePath);
- resourceURL = vfResource.toURL();
+ try
+ {
+ UnifiedVirtualFile vfResource = getRootFile().findChild(resourcePath);
+ resourceURL = vfResource.toURL();
+ }
+ catch (IOException e)
+ {
+ if (metadataFiles == null || metadataFiles.isEmpty())
+ {
+ throw e;
+ }
+ else
+ {
+ log.debug("Cannot get " + resourcePath + " from root
file, trying with additional metadata files", e);
+ }
+
+ }
}
+ //scan additional metadata files (for instance originally attached to a
VFSDeploymentUnit)
+ if (resourceURL == null && metadataFiles != null &&
!metadataFiles.isEmpty())
+ {
+ UnifiedVirtualFile vfResource = null;
+ for (Iterator<UnifiedVirtualFile> it = getMetadataFiles().iterator();
it.hasNext() && vfResource != null; )
+ {
+ UnifiedVirtualFile uvf = it.next();
+ if (resourcePath.equals(uvf.getName()))
+ vfResource = uvf;
+ else
+ {
+ try
+ {
+ vfResource = uvf.findChild(resourcePath);
+ }
+ catch (IOException e)
+ {
+ log.debug("Cannot get " + resourcePath + " from
" + uvf, e);
+ }
+ }
+ }
+ if (vfResource == null)
+ throw new IOException("Could not find " + resourcePath + "
in the additional metadatafiles!");
+ }
}
return resourceURL;
}
+
+ public List<UnifiedVirtualFile> getMetadataFiles()
+ {
+ return metadataFiles;
+ }
+
+ public void setMetadataFiles(List<UnifiedVirtualFile> metadataFiles)
+ {
+ this.metadataFiles = metadataFiles;
+ }
}
Show replies by date