[jboss-cvs] JBossAS SVN: r63834 - in projects/metadata/trunk/src/main/java/org/jboss/ws: integration and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 5 05:17:55 EDT 2007


Author: wolfc
Date: 2007-07-05 05:17:55 -0400 (Thu, 05 Jul 2007)
New Revision: 63834

Added:
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ResourceLoaderAdapter.java
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefElement.java
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/URLLoaderAdapter.java
   projects/metadata/trunk/src/main/java/org/jboss/ws/integration/UnifiedVirtualFile.java
Log:
Initial import

Added: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ResourceLoaderAdapter.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ResourceLoaderAdapter.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ResourceLoaderAdapter.java	2007-07-05 09:17:55 UTC (rev 63834)
@@ -0,0 +1,118 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.ws.integration.UnifiedVirtualFile;
+
+
+/**
+ * The default file adapter loads resources through an associated classloader.
+ * If no classload is set, the the thread context classloader will be used.
+ *
+ * @author Heiko.Braun at jboss.org
+ * @since 25.01.2007
+ */
+public class ResourceLoaderAdapter implements UnifiedVirtualFile
+{
+   private URL resourceURL;
+   private ClassLoader loader;
+
+   public ResourceLoaderAdapter()
+   {
+      this(Thread.currentThread().getContextClassLoader());
+   }
+   
+   public ResourceLoaderAdapter(ClassLoader loader)
+   {
+      this.loader = loader;
+   }
+   
+   private ResourceLoaderAdapter(ClassLoader loader, URL resourceURL)
+   {
+      this.resourceURL = resourceURL;
+      this.loader = loader;
+   }
+
+   public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+   {
+      URL resourceURL = null;
+      if (resourcePath != null)
+      {
+         // Try the child as URL
+         try
+         {
+            resourceURL = new URL(resourcePath);
+         }
+         catch (MalformedURLException ex)
+         {
+            // ignore
+         }
+
+         // Try the filename as File
+         if (resourceURL == null)
+         {
+            try
+            {
+               File file = new File(resourcePath);
+               if (file.exists())
+                  resourceURL = file.toURL();
+            }
+            catch (MalformedURLException e)
+            {
+               // ignore
+            }
+         }
+
+         // Try the filename as Resource
+         if (resourceURL == null)
+         {
+            try
+            {
+               resourceURL = loader.getResource(resourcePath);
+            }
+            catch (Exception ex)
+            {
+               // ignore
+            }
+         }
+      }
+
+      if (resourceURL == null)
+         throw new IOException("Cannot get URL for: " + resourcePath);
+
+      return new ResourceLoaderAdapter(loader, resourceURL);
+   }
+
+   public URL toURL()
+   {
+      if (null == this.resourceURL)
+         throw new IllegalStateException("UnifiedVirtualFile not initialized");
+      return resourceURL;
+   }
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ResourceLoaderAdapter.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefElement.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefElement.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefElement.java	2007-07-05 09:17:55 UTC (rev 63834)
@@ -0,0 +1,36 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import java.io.Serializable;
+
+/**
+ * A marker for all <service-ref> related objects.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-Mar-2007
+ */
+public abstract class ServiceRefElement implements Serializable
+{
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefElement.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java	2007-07-05 09:17:55 UTC (rev 63834)
@@ -0,0 +1,47 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * An implementation of this interface handles all service-ref binding concerns 
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2004
+ */
+public interface ServiceRefHandler
+{
+   ServiceRefMetaData newServiceRefMetaData();
+
+   Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs);
+
+   void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value);
+   
+   void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ClassLoader loader, ServiceRefMetaData sref) throws NamingException;
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefMetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefMetaData.java	2007-07-05 09:17:55 UTC (rev 63834)
@@ -0,0 +1,55 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import java.io.Serializable;
+
+import org.w3c.dom.Element;
+
+/**
+ * An abstract service-ref meta data object.
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-Mar-2007
+ */
+public abstract class ServiceRefMetaData extends ServiceRefElement implements Serializable
+{
+   public abstract String getServiceRefName();
+
+   public abstract void setServiceRefName(String name);
+
+   public abstract Object getAnnotatedElement();
+
+   public abstract void setAnnotatedElement(Object anElement);
+
+   public abstract boolean isProcessed();
+
+   public abstract void setProcessed(boolean flag);
+
+   public abstract void importStandardXml(Element element);
+
+   public abstract void importJBossXml(Element element);
+
+   public abstract void merge(ServiceRefMetaData targetRef);
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/ServiceRefMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/URLLoaderAdapter.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/ws/integration/URLLoaderAdapter.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/ws/integration/URLLoaderAdapter.java	2007-07-05 09:17:55 UTC (rev 63834)
@@ -0,0 +1,126 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.jboss.ws.integration.UnifiedVirtualFile;
+
+/**
+ * The default file adapter loads resources through an associated classloader.
+ * If no classload is set, the the thread context classloader will be used.
+ *
+ * @author Heiko.Braun at jboss.org
+ * @since 25.01.2007
+ */
+public class URLLoaderAdapter implements UnifiedVirtualFile
+{
+   private URL rootURL;
+   private URL resourceURL;
+   private transient URLClassLoader loader;
+
+   public URLLoaderAdapter(URL rootURL)
+   {
+      this.rootURL = rootURL;
+   }
+   
+   private URLLoaderAdapter(URL rootURL, URLClassLoader loader, URL resourceURL)
+   {
+      this.rootURL = rootURL;
+      this.resourceURL = resourceURL;
+      this.loader = loader;
+   }
+
+   public UnifiedVirtualFile findChild(String resourcePath) throws IOException
+   {
+      URL resourceURL = null;
+      if (resourcePath != null)
+      {
+         // Try the child as URL
+         try
+         {
+            resourceURL = new URL(resourcePath);
+         }
+         catch (MalformedURLException ex)
+         {
+            // ignore
+         }
+
+         // Try the filename as File
+         if (resourceURL == null)
+         {
+            try
+            {
+               File file = new File(resourcePath);
+               if (file.exists())
+                  resourceURL = file.toURL();
+            }
+            catch (MalformedURLException e)
+            {
+               // ignore
+            }
+         }
+
+         // Try the filename as Resource
+         if (resourceURL == null)
+         {
+            try
+            {
+               resourceURL = getResourceLoader().getResource(resourcePath);
+            }
+            catch (Exception ex)
+            {
+               // ignore
+            }
+         }
+      }
+
+      if (resourceURL == null)
+         throw new IOException("Cannot get URL for: " + resourcePath);
+
+      return new URLLoaderAdapter(rootURL, loader, resourceURL);
+   }
+
+   public URL toURL()
+   {
+      if (resourceURL != null)
+         return resourceURL;
+      else
+         return rootURL;
+   }
+
+   private URLClassLoader getResourceLoader()
+   {
+      if (loader == null)
+      {
+         ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+         loader = new URLClassLoader(new URL[]{rootURL}, ctxLoader);
+      }
+      return loader;
+   }
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/URLLoaderAdapter.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/UnifiedVirtualFile.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/ws/integration/UnifiedVirtualFile.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/ws/integration/UnifiedVirtualFile.java	2007-07-05 09:17:55 UTC (rev 63834)
@@ -0,0 +1,42 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * An adaptor to a VirtualFile from jboss-vfs.jar
+ * jboss-vfs cannot be used in jboss-4.x because of its dependeny on jboss-common-core.jar
+ *  
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public interface UnifiedVirtualFile extends Serializable
+{
+   UnifiedVirtualFile findChild(String child) throws IOException;
+
+   URL toURL();
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/ws/integration/UnifiedVirtualFile.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list