[jbossws-commits] JBossWS SVN: r13344 - api and 15 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Sat Nov 27 21:10:52 EST 2010


Author: alessio.soldano at jboss.com
Date: 2010-11-27 21:10:52 -0500 (Sat, 27 Nov 2010)
New Revision: 13344

Added:
   api/
   api/branches/
   api/tags/
   api/trunk/
   api/trunk/pom.xml
   api/trunk/src/
   api/trunk/src/main/
   api/trunk/src/main/java/
   api/trunk/src/main/java/org/
   api/trunk/src/main/java/org/jboss/
   api/trunk/src/main/java/org/jboss/wsf/
   api/trunk/src/main/java/org/jboss/wsf/spi/
   api/trunk/src/main/java/org/jboss/wsf/spi/annotation/
   api/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java
   api/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java
   api/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java
   api/trunk/src/main/java/org/jboss/wsf/spi/binding/
   api/trunk/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
   api/trunk/src/main/java/org/jboss/wsf/spi/binding/JAXBBindingCustomization.java
   api/trunk/src/main/java/org/jboss/wsf/spi/management/
   api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/
   api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/Record.java
   api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordFilter.java
   api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordGroupAssociation.java
   api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordProcessor.java
   api/trunk/src/main/java/org/jboss/wsf/spi/tools/
   api/trunk/src/main/java/org/jboss/wsf/spi/tools/SecurityActions.java
   api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java
   api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumerFactory.java
   api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProvider.java
   api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProviderFactory.java
   api/trunk/src/main/java/org/jboss/wsf/spi/util/
   api/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java
   api/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java
   api/trunk/src/test/
   api/trunk/src/test/java/
   api/trunk/src/test/resources/
Log:
[JBWS-2709] Starting factoring public api out of jbossws-spi


Added: api/trunk/pom.xml
===================================================================
--- api/trunk/pom.xml	                        (rev 0)
+++ api/trunk/pom.xml	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,57 @@
+<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>
+
+  <name>JBoss Web Services - API</name>
+  <groupId>org.jboss.ws</groupId>
+  <artifactId>jbossws-api</artifactId>
+  <packaging>jar</packaging>
+  <description>JBossWS API</description>
+
+  <version>1.0.0-SNAPSHOT</version>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jboss.ws</groupId>
+    <artifactId>jbossws-parent</artifactId>
+    <version>1.0.9.GA</version>
+  </parent>
+
+  <!-- Source Control Management -->
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/api/trunk</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/api/trunk</developerConnection>
+    <url>http://fisheye.jboss.com/viewrep/JBossWS/api/trunk</url>
+  </scm>
+  
+  <properties>
+    <jboss-logging-spi.version>2.0.5.GA</jboss-logging-spi.version>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+
+    <!-- provided apis -->
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <version>${jboss-logging-spi.version}</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <!-- Plugins -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-release-plugin</artifactId>
+        <version>2.0-beta-8</version>
+        <configuration>
+          <scmCommentPrefix>[${jira.issue}] :</scmCommentPrefix>
+          <autoVersionSubmodules>true</autoVersionSubmodules>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: api/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation;
+
+import org.jboss.logging.Logger;
+
+/**
+ * The authMethod is used to configure the authentication mechanism for the web service. 
+ * As a prerequisite to gaining access to any web service which are protected by an 
+ * authorization constraint, a user must have authenticated using the configured mechanism.
+ * 
+ * @author ropalka at redhat.com
+ */
+public final class AuthMethod
+{
+   private static final Logger log = Logger.getLogger(AuthMethod.class);
+   
+   /**
+    * Basic authentication.
+    */
+   public static final String BASIC = "BASIC";
+   /**
+    * Client certificate based authentication.
+    */
+   public static final String CLIENT_CERT = "CLIENT-CERT";
+   
+   /**
+    * Forbidden constructor.
+    */
+   private AuthMethod()
+   {
+      super();
+   }
+
+   /**
+    * Returns string representing correct auth method value.
+    * @param s string to convert.
+    * @return correct auth method value
+    * @throws IllegalArgumentException if <b>s</b> is <b>null</b> or it contains unknown value.
+    */
+   public static String valueOf(final String s)
+   {
+      if (s != null)
+      {
+         if (s.equals(""))
+         {
+            return s;
+         }
+         if (s.equals(AuthMethod.BASIC))
+         {
+            return AuthMethod.BASIC;
+         }
+         if (s.equals(AuthMethod.CLIENT_CERT))
+         {
+            return AuthMethod.CLIENT_CERT;
+         }
+         log.warn("Non-standard auth method value: " + s);
+         return s;         
+      }
+      
+      throw new IllegalArgumentException("Illegal auth method value: " + s);
+   }
+   
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation;
+
+/**
+ * The transportGuarantee specifies that the communication
+ * between client and server should be NONE, INTEGRAL, or
+ * CONFIDENTIAL. NONE means that the application does not require any
+ * transport guarantees. A value of INTEGRAL means that the application
+ * requires that the data sent between the client and server be sent in
+ * such a way that it can't be changed in transit. CONFIDENTIAL means
+ * that the application requires that the data be transmitted in a
+ * fashion that prevents other entities from observing the contents of
+ * the transmission. In most cases, the presence of the INTEGRAL or
+ * CONFIDENTIAL flag will indicate that the use of SSL is required.
+ * 
+ * @author ropalka at redhat.com
+ */
+public final class TransportGuarantee
+{
+   
+   /**
+    * Application does not require any transport guarantees.
+    */
+   public static final String NONE = "NONE";
+   /**
+    * Application requires that the data sent between the client and
+    * server be sent in such a way that it can't be changed in transit.
+    */
+   public static final String INTEGRAL = "INTEGRAL";
+   /**
+    * Application requires that the data be transmitted in a fashion that
+    * prevents other entities from observing the contents of the transmission.
+    */
+   public static final String CONFIDENTIAL = "CONFIDENTIAL";
+
+   /**
+    * Forbidden constructor.
+    */
+   private TransportGuarantee()
+   {
+      super();
+   }
+   
+   /**
+    * Returns string representing correct transport guarantee value.
+    * @param s string to convert.
+    * @return correct transport guarantee value
+    * @throws IllegalArgumentException if <b>s</b> is <b>null</b> or it contains unknown value.
+    */
+   public static String valueOf(final String s)
+   {
+      if (s != null)
+      {
+         if (s.equals(""))
+         {
+            return s;
+         }
+         if (s.equals(TransportGuarantee.NONE))
+         {
+            return TransportGuarantee.NONE;
+         }
+         if (s.equals(TransportGuarantee.INTEGRAL))
+         {
+            return TransportGuarantee.INTEGRAL;
+         }
+         if (s.equals(TransportGuarantee.CONFIDENTIAL))
+         {
+            return TransportGuarantee.CONFIDENTIAL;
+         }
+      }
+      
+      throw new IllegalArgumentException("Illegal transport guarantee value: " + s);
+   }
+   
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Provides web context specific meta data to EJB based web service endpoints.
+ *
+ * @author thomas.diesler at jboss.org
+ * @since 26-Apr-2005
+ */
+ at Retention(value = RetentionPolicy.RUNTIME)
+ at Target(value = { ElementType.TYPE })
+public @interface WebContext {
+   
+   /** 
+    * The contextRoot element specifies the context root that the web service endpoint is deployed to.
+    * If it is not specified it will be derived from the deployment short name.
+    * 
+    * Applies to server side port components only. 
+    */
+   String contextRoot() default "";
+   
+   /** 
+    * The virtual hosts that the web service endpoint is deployed to.
+    * 
+    * Applies to server side port components only.
+    */
+   String[] virtualHosts() default {};
+   
+   /** 
+    * Relative path that is appended to the contextRoot to form fully qualified
+    * endpoint address for the web service endpoint.
+    * 
+    * Applies to server side port components only. 
+    */
+   String urlPattern() default "";
+
+   /**
+    * The authMethod is used to configure the authentication mechanism for the web service. 
+    * As a prerequisite to gaining access to any web service which are protected by an authorization
+    * constraint, a user must have authenticated using the configured mechanism.
+    *
+    * Standard values for this element are "BASIC", or "CLIENT-CERT", custom authMethods may also
+    * be specified.
+    * 
+    * @see AuthMethod
+    */
+   String authMethod() default "";
+
+   /**
+    * The transportGuarantee specifies that the communication
+    * between client and server should be NONE, INTEGRAL, or
+    * CONFIDENTIAL. NONE means that the application does not require any
+    * transport guarantees. A value of INTEGRAL means that the application
+    * requires that the data sent between the client and server be sent in
+    * such a way that it can't be changed in transit. CONFIDENTIAL means
+    * that the application requires that the data be transmitted in a
+    * fashion that prevents other entities from observing the contents of
+    * the transmission. In most cases, the presence of the INTEGRAL or
+    * CONFIDENTIAL flag will indicate that the use of SSL is required.
+    * 
+    * @see TransportGuarantee
+    */
+   String transportGuarantee() default "";
+
+   /**
+    * A secure endpoint does not secure wsdl access by default.
+    * Explicitly setting secureWSDLAccess overrides this behaviour.
+    * 
+    * Protect access to WSDL. See http://jira.jboss.org/jira/browse/JBWS-723   
+    */
+   boolean secureWSDLAccess() default false;
+    
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.binding;
+
+import java.util.HashMap;
+
+/**
+ * Allows introduction of arbitrary binding customization properties.<p>
+ * This may be different between stacks and addresses meta data binding
+ * (i.e JSR-181 to UnifiedMetaData) as well as JAVA to XML binding operations.
+ * <p>
+ * Supported properties need to be documented in subclasses.
+ *
+ * @author Heiko.Braun at jboss.com
+ *         Created: Jun 28, 2007
+ */
+public abstract class BindingCustomization extends HashMap
+{
+
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/binding/JAXBBindingCustomization.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/binding/JAXBBindingCustomization.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/binding/JAXBBindingCustomization.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.binding;
+
+import org.jboss.wsf.spi.binding.BindingCustomization;
+
+/**
+ * JAXB customizations.
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 05-Oct-2009
+ */
+public class JAXBBindingCustomization extends BindingCustomization
+{
+   private static final long serialVersionUID = 5547146387872057974L;
+   
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/Record.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/Record.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/Record.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.management.recording;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 8-Dec-2007
+ */
+public interface Record extends Serializable
+{
+   public enum MessageType {INBOUND, OUTBOUND};
+   
+   /**
+    * Gets the group ID corresponding to the current message exchange flow
+    * 
+    * @return
+    */
+   public String getGroupID();
+   
+   public void setGroupID(String groupID);
+   
+   /**
+    * Gets the date of this record
+    * 
+    * @return
+    */
+   public Date getDate();
+   
+   public void setDate(Date date);
+   
+   /**
+    * Gets the source (message sender) host. The result format conforms to RFC2732
+    * 
+    * @return source host
+    */
+   public String getSourceHost();
+   
+   public void setSourceHost(String host);
+   
+   /**
+    * Gets the source (message sender) host. The result format conforms to RFC2732
+    * 
+    * @return the source host
+    */
+   public String getDestinationHost();
+   
+   public void setDestinationHost(String host);
+   
+   /**
+    * Gets the message type, i.e. MessageType.INBOUND or MessageType.OUTBOUND
+    * 
+    * @return the message type
+    */
+   public MessageType getMessageType();
+   
+   public void setMessageType(MessageType type);
+   
+   
+   /**
+    * Gets the SOAP message envelope
+    * 
+    * @return
+    */
+   public String getEnvelope();
+   
+   public void setEnvelope(String envelope);
+   
+   /**
+    * Gets the HTTP headers
+    * 
+    * @return the headers
+    */
+   public Map<String, List<String>> getHeaders();
+   
+   public void addHeaders(String key, List<String> value);
+   
+   public void setHeaders(Map<String, List<String>> headers);
+   
+   /**
+    * Gets the invoked operation
+    * 
+    * @return the operation
+    */
+   public QName getOperation();
+   
+   public void setOperation(QName operation);
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordFilter.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordFilter.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordFilter.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.management.recording;
+
+import java.io.Serializable;
+
+/**
+ * A record filter
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 8-Dec-2007
+ */
+public interface RecordFilter extends Cloneable, Serializable
+{
+   /**
+    * Returns true if the filter matches the given record.
+    */
+   boolean match(Record record);
+   
+   /**
+    * RecordFilters must override Object.clone()
+    */
+   Object clone() throws CloneNotSupportedException;
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordGroupAssociation.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordGroupAssociation.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordGroupAssociation.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.management.recording;
+
+import java.util.Stack;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Associates the record group ID with the current thread. 
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 8-Dec-2007
+ */
+public class RecordGroupAssociation
+{
+   private static ThreadLocal<Stack<String>> groupIDAssoc = new ThreadLocal<Stack<String>>();
+   
+   // provide logging
+   private static Logger log = Logger.getLogger(RecordGroupAssociation.class);
+  
+
+   public static void pushGroupID(String groupID)
+   {
+      if(log.isTraceEnabled()) log.trace("pushGroupID: " + groupID + " (Thread " +Thread.currentThread().getName()+ ")");
+      Stack<String> stack = groupIDAssoc.get();
+      if (stack == null)
+      {
+         stack = new Stack<String>();
+         groupIDAssoc.set(stack);
+      }
+      stack.push(groupID);
+   }
+
+   public static String peekGroupID()
+   {
+      String groupID = null;
+      Stack<String> stack = groupIDAssoc.get();
+      if (stack != null && stack.isEmpty() == false)
+      {
+         groupID = stack.peek();
+      }
+      if(log.isTraceEnabled()) log.trace("peekGroupID: " + groupID + " (Thread " +Thread.currentThread().getName()+ ")");
+      return groupID;
+   }
+
+   public static String popGroupID()
+   {
+      String groupID = null;
+      Stack<String> stack = groupIDAssoc.get();
+      if (stack != null && stack.isEmpty() == false)
+      {
+         groupID = stack.pop();
+      }
+      if(log.isTraceEnabled()) log.trace("popGroupID: " + groupID +" (Thread " +Thread.currentThread().getName()+ ")");
+      return groupID;
+   }
+   
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordProcessor.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordProcessor.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/management/recording/RecordProcessor.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.management.recording;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Processes a record. A RecordProcessor may have filters to allow processing
+ * of records matching given criteria. It also gives users fine management of
+ * record's attributes to processed. 
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 8-Dec-2007
+ */
+public interface RecordProcessor extends Cloneable, Serializable
+{
+   String getName();
+
+   void setName(String name);
+
+   boolean isRecording();
+
+   void setRecording(boolean value);
+
+   void processRecord(Record record);
+
+   List<RecordFilter> getFilters();
+
+   void addFilter(RecordFilter filter);
+
+   void setFilters(List<RecordFilter> filters);
+
+   boolean isProcessSourceHost();
+
+   void setProcessSourceHost(boolean value);
+
+   boolean isProcessDestinationHost();
+
+   void setProcessDestinationHost(boolean value);
+
+   boolean isProcessMessageType();
+
+   void setProcessMessageType(boolean value);
+
+   boolean isProcessEnvelope();
+
+   void setProcessEnvelope(boolean value);
+
+   boolean isProcessHeaders();
+
+   void setProcessHeaders(boolean value);
+
+   boolean isProcessOperation();
+
+   void setProcessOperation(boolean value);
+
+   boolean isProcessDate();
+
+   void setProcessDate(boolean value);
+
+   /**
+    * RecordFilters must override Object.clone()
+    */
+   Object clone() throws CloneNotSupportedException;
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/tools/SecurityActions.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/tools/SecurityActions.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/tools/SecurityActions.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.tools;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+   /**
+    * Get context classloader.
+    * 
+    * @return the current context classloader
+    */
+   static ClassLoader getContextClassLoader()
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+      else
+      {
+         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            public ClassLoader run()
+            {
+               return Thread.currentThread().getContextClassLoader();
+            }
+         });
+      }
+   }
+
+   /**
+    * Set context classloader.
+    *
+    * @param cl the classloader
+    * @return previous context classloader
+    * @throws Throwable for any error
+    */
+   static ClassLoader setContextClassLoader(final ClassLoader cl)
+   {
+      if (System.getSecurityManager() == null)
+      {
+         ClassLoader result = Thread.currentThread().getContextClassLoader();
+         if (cl != null)
+            Thread.currentThread().setContextClassLoader(cl);
+         return result;
+      }
+      else
+      {
+         try
+         {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() {
+               public ClassLoader run() throws Exception
+               {
+                  try
+                  {
+                     ClassLoader result = Thread.currentThread().getContextClassLoader();
+                     if (cl != null)
+                        Thread.currentThread().setContextClassLoader(cl);
+                     return result;
+                  }
+                  catch (Exception e)
+                  {
+                     throw e;
+                  }
+                  catch (Error e)
+                  {
+                     throw e;
+                  }
+                  catch (Throwable e)
+                  {
+                     throw new RuntimeException("Error setting context classloader", e);
+                  }
+               }
+            });
+         }
+         catch (PrivilegedActionException e)
+         {
+            throw new RuntimeException("Error running privileged action", e.getCause());
+         }
+      }
+   }
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,212 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.tools;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.wsf.spi.util.ServiceLoader;
+
+/**
+ * WSContractConsumer is responsible for generating JAX-WS client and server
+ * artifacts from the specified WSDL file. To implement a client, one would use
+ * the generated ___Service.java file. For a server, one only needs to provide
+ * an implementation class that implements the generated service endpoint
+ * interface.
+ * 
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ */
+public abstract class WSContractConsumer
+{
+   private static String DEFAULT_PROVIDER = "org.jboss.ws.tools.jaxws.impl.SunRIConsumerFactoryImpl";
+   public static final String PROVIDER_PROPERTY = "org.jboss.wsf.spi.tools.ConsumerFactoryImpl";
+
+   /**
+    * Obtain a new instance of a WSContractConsumer. This will use the current
+    * thread's context class loader to locate the WSContractConsumerFactory
+    * implementation.
+    *
+    * @return a new WSContractConsumer
+    */
+   public static WSContractConsumer newInstance()
+   {
+      return newInstance(SecurityActions.getContextClassLoader());
+   }
+
+   /**
+    * Obtain a new instance of a WSContractConsumer. The specified ClassLoader will be used to
+    * locate the WebServiceImporterProvide implementation
+    *
+    * @param loader the ClassLoader to use
+    * @return a new WSContractConsumer
+    */
+   public static WSContractConsumer newInstance(ClassLoader loader)
+   {
+      ClassLoader oldLoader = SecurityActions.getContextClassLoader();
+      try
+      {
+         SecurityActions.setContextClassLoader(loader);
+         WSContractConsumerFactory factory = (WSContractConsumerFactory) ServiceLoader.loadService(PROVIDER_PROPERTY, DEFAULT_PROVIDER);
+         return factory.createConsumer();
+      }
+      finally
+      {
+         SecurityActions.setContextClassLoader(oldLoader);
+      }
+   }
+
+   /**
+    * Specifies the JAX-WS and JAXB binding files to use on import operations.
+    *
+    * @param bindingFiles list of JAX-WS or JAXB binding files
+    */
+   public abstract void setBindingFiles(List<File> bindingFiles);
+
+   /**
+    * Sets the OASIS XML Catalog file to use for entity resolution.
+    *
+    * @param catalog the OASIS XML Catalog file
+    */
+   public abstract void setCatalog(File catalog);
+
+   /**
+    * Sets the main output directory. If the directory does not exist, it will be created.
+    *
+    * @param directory the root directory for generated files
+    */
+   public abstract void setOutputDirectory(File directory);
+
+   /**
+    * Sets the source directory. This directory will contain any generated Java source.
+    * If the directory does not exist, it will be created. If not specified,
+    * the output directory will be used instead.
+    *
+    * @param directory the root directory for generated source code
+    */
+   public abstract void setSourceDirectory(File directory);
+
+   /**
+    * Enables/Disables SOAP 1.2 binding extension
+    * 
+    * @param extension whether or not to enable SOAP 1.2 binding extension
+    */
+   public abstract void setExtension(boolean extension);
+
+   /**
+    * Enables/Disables Java source generation.
+    *
+    * @param generateSource whether or not to generate Java source.
+    */
+   public abstract void setGenerateSource(boolean generateSource);
+
+   /**
+    * Enables/Disables Java source compilation.
+    *
+    * @param nocompile whether or not to compile Java source.
+    */
+   public abstract void setNoCompile(boolean nocompile);
+   
+   /**
+    * Sets the target package for generated source. If not specified the default
+    * is based off of the XML namespace.
+    *
+    * @param targetPackage the target package for generated source
+    */
+   public abstract void setTargetPackage(String targetPackage);
+
+   /**
+    * Sets the @@WebService.wsdlLocation and @@WebServiceClient.wsdlLocation attributes to a custom value.
+    *
+    * @param wsdlLocation the custom WSDL location to use in generated source
+    */
+   public abstract void setWsdlLocation(String wsdlLocation);
+
+   /**
+    * Sets the PrintStream to use for status feedback. The simplest example
+    * would be to use System.out.
+    *
+    * @param messageStream  the stream to use for status messages:
+    */
+   public abstract void setMessageStream(PrintStream messageStream);
+
+   /**
+    * Sets the additional classpath to use if/when invoking the Java compiler.
+    * Typically an implementation will use the system <code>java.class.path</code>
+    * property. So for most normal applications this method is not needed. However,
+    * if this API is being used from an isolated classloader, then it needs to
+    * be called in order to reference all jars that are required by the
+    * implementation.
+    *
+    * @param classPath a list of strings where each entry references a
+    *                  single jar or directory
+    */
+   public abstract void setAdditionalCompilerClassPath(List<String> classPath);
+
+   /**
+    * Enables or disables processing of implicit SOAP headers (i.e. SOAP headers
+    * defined in the wsdl:binding but not wsdl:portType section.) Default is false. 
+    * 
+    * @param additionalHeaders a boolean enabling processing of implicit SOAP headers
+    */
+   public abstract void setAdditionalHeaders(boolean additionalHeaders);
+   
+   /**
+    * Set the target JAX-WS specification target. Allowed values are 2.0, 2.1 and 2.2
+    * @param target  the JAX-WS specification version.
+    */
+   public abstract void setTarget(String target);
+
+   /**
+    * Generate the required artifacts using the specified WSDL URL. This method
+    * may be called more than once, although this is probably not desireable
+    * 
+    * @param wsdl the URL of the WSDL
+    */
+   public abstract void consume(URL wsdl);
+
+   /**
+    * Generate the required artifacts using the specified WSDL. This method
+    * may be called more than once, although this is probably not desireable.
+    * The passed string is expect to either be a valid URL, or a local file path.
+    *
+    * @param wsdl a URL or local file path
+    * @throws MalformedURLException if wsdl is not a legal URL or local file
+    */
+   public void consume(String wsdl) throws MalformedURLException
+   {
+      URL url = null;
+      try
+      {
+         url = new URL(wsdl);
+      }
+      catch (MalformedURLException e)
+      {
+         File file = new File(wsdl);
+         url = file.toURI().toURL();
+      }
+
+      consume(url);
+   }
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumerFactory.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumerFactory.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumerFactory.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+/**
+ * Creates WSContractConsumer implementations.
+ * 
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ */
+public interface WSContractConsumerFactory
+{
+   /**
+    * Create a new WSContractConsumer. There are no restrictions on how this
+    * should be performed. 
+    * 
+    * @return a new WSContractConsumer
+    */
+   public WSContractConsumer createConsumer();
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProvider.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProvider.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProvider.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.tools;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import org.jboss.wsf.spi.util.ServiceLoader;
+
+/**
+ * WSContractProvider is responsible for generating the required portable
+ * JAX-WS artifacts for a service endpoint implementation. This includes class
+ * files for wrapper types and fault beans. WSDL may be optionally generated as
+ * well using this API.
+ *
+ * <p>The following example generates class files, source files and WSDL for an
+ * endpoint:</p> 
+ * <pre>
+ * WSContractProvider provider = WSContractProvider.newInstance();
+ * provider.setGenerateSource(true);
+ * provider.setGenerateWsdl(true);
+ * provider.setOutputDirectory(new File("output"));
+ * provider.setMessageStream(System.out);
+ * provider.provide(TestMe.class);
+ * </pre>
+ * 
+ * <p>Thread-Safety:</p>
+ * This class expects to be thread-confined, so it can not be shared between threads.
+ *
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ */
+public abstract class WSContractProvider
+{
+   private static String DEFAULT_PROVIDER = "org.jboss.ws.tools.jaxws.impl.JBossWSProviderFactoryImpl";
+   public static final String PROVIDER_PROPERTY = "org.jboss.wsf.spi.tools.ProviderFactoryImpl";
+
+   protected WSContractProvider()
+   {
+
+   }
+
+   /**
+    * Obtain a new instance of a WSContractProvider. This will use the current
+    * thread's context class loader to locate the WSContractProviderFactory
+    * implementation.
+    * 
+    * @return a new WSContractProvider
+    */
+   public static WSContractProvider newInstance()
+   {
+      return newInstance(SecurityActions.getContextClassLoader());
+   }
+
+   /**
+    * Obtain a new instance of a WSContractProvider. The specified ClassLoader will be used to
+    * locate the WSContractProviderFactory implementation
+    * 
+    * @param loader the ClassLoader to use
+    * @return a new WSContractProvider
+    */
+   public static WSContractProvider newInstance(ClassLoader loader)
+   {
+      ClassLoader oldLoader = SecurityActions.getContextClassLoader();
+      try
+      {
+         SecurityActions.setContextClassLoader(loader);
+         WSContractProviderFactory factory = (WSContractProviderFactory) ServiceLoader.loadService(PROVIDER_PROPERTY, DEFAULT_PROVIDER);
+         return factory.createProvider(loader);
+      }
+      finally
+      {
+         SecurityActions.setContextClassLoader(oldLoader);
+      }
+   }
+
+   /**
+    * Enables/Disables WSDL generation.
+    * 
+    * @param generateWsdl whether or not to generate WSDL
+    */
+   public abstract void setGenerateWsdl(boolean generateWsdl);
+   
+   /**
+    * Enables/Disables SOAP 1.2 binding extension
+    * 
+    * @param extension whether or not to enable SOAP 1.2 binding extension
+    */
+   public abstract void setExtension(boolean extension);
+
+   /**
+    * Enables/Disables Java source generation.
+    * 
+    * @param generateSource whether or not to generate Java source.
+    */
+   public abstract void setGenerateSource(boolean generateSource);
+
+   /**
+    * Sets the main output directory. If the directory does not exist, it will be created.
+    * 
+    * @param directory the root directory for generated files
+    */
+   public abstract void setOutputDirectory(File directory);
+
+   /**
+    * Sets the resource directory. This directory will contain any generated
+    * WSDL and XSD files. If the directory does not exist, it will be created.
+    * If not specified, the output directory will be used instead.
+    * 
+    * @param directory the root directory for generated resource files
+    */
+   public abstract void setResourceDirectory(File directory);
+
+   /**
+    * Sets the source directory. This directory will contain any generated Java source.
+    * If the directory does not exist, it will be created. If not specified, 
+    * the output directory will be used instead.
+    * 
+    * @param directory the root directory for generated source code
+    */
+   public abstract void setSourceDirectory(File directory);
+
+   /**
+    * Sets the ClassLoader used to discover types. This defaults to the one used
+    * in instantiation.
+    * 
+    * @param loader the ClassLoader to use
+    */
+   public abstract void setClassLoader(ClassLoader loader);
+
+   /**
+    * Generates artifacts using the current settings. This method may be invoked
+    * more than once (e.g. multiple endpoints).
+    * 
+    * @param endpointClass the name of the endpoint implementation bean
+    * @throws RuntimeException if any error occurs during processing, or the class is not found
+    */
+   public abstract void provide(String endpointClass);
+
+   /**
+    * Generates artifacts using the current settings. This method may be invoked
+    * more than once (e.g. multiple endpoints).
+    * 
+    * @param endpointClass the endpoint implementation bean
+    * @throws RuntimeException if any error occurs during processing
+    */
+   public abstract void provide(Class<?> endpointClass);
+
+   /**
+    * Sets the PrintStream to use for status feedback. The simplest example
+    * would be to use System.out.
+    * 
+    * <p>Example output:</p> 
+    * <pre>
+    * Generating WSDL: 
+    * TestMeService.wsdl 
+    * Writing Source:
+    * org/jboss/ws/tools/jaxws/TestMe.java
+    * org/jboss/ws/tools/jaxws/TestMeResponse.java 
+    * Writing Classes:
+    * org/jboss/ws/tools/jaxws/TestMe.class
+    * org/jboss/ws/tools/jaxws/TestMeResponse.class
+    * </pre>
+    * @param messageStream  the stream to use for status messages:
+    */
+   public abstract void setMessageStream(PrintStream messageStream);
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProviderFactory.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProviderFactory.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/tools/WSContractProviderFactory.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+/**
+ * Creates WSContractProvider implementations.
+ * 
+ * @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
+ */
+public interface WSContractProviderFactory
+{
+   /**
+    * Create a new WSContractProvider. There are no restrictions on how this
+    * should be performed. The passed ClassLoader is the one used in
+    * {@link WSContractProvider#newInstance(ClassLoader)}. This loader
+    * should be made available to the generated WSContractProvider.
+    * 
+    * @param loader the ClassLoader for type discovery
+    * @return a new WSContractProvider
+    */
+   public WSContractProvider createProvider(ClassLoader loader);
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.util;
+
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+   /**
+    * Get context classloader.
+    * 
+    * @return the current context classloader
+    */
+   static ClassLoader getContextClassLoader()
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+      else
+      {
+         return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            public ClassLoader run()
+            {
+               return Thread.currentThread().getContextClassLoader();
+            }
+         });
+      }
+   }
+   
+   /**
+    * Set context classloader.
+    * 
+    */
+   static void setContextClassLoader(final ClassLoader cl)
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+      {
+         Thread.currentThread().setContextClassLoader(cl);
+      }
+      else
+      {
+         AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run()
+            {
+               Thread.currentThread().setContextClassLoader(cl);
+               return null;
+            }
+         });
+      }
+   }
+   
+   /**
+    * Get resource as stream
+    * 
+    * @param cl
+    * @param filename
+    * @return input stream
+    * @throws PrivilegedActionException
+    */
+   static InputStream getResourceAsStream(final ClassLoader cl, final String filename)
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+      {
+         return cl.getResourceAsStream(filename);
+      }
+      else
+      {
+         return AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
+            public InputStream run()
+            {
+               return cl.getResourceAsStream(filename);
+            }
+         });
+      }
+   }
+   
+   /**
+    * Load a class using the provided classloader
+    * 
+    * @param name
+    * @return
+    * @throws PrivilegedActionException
+    */
+   static Class<?> loadClass(final ClassLoader cl, final String name) throws PrivilegedActionException, ClassNotFoundException
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+      {
+         return cl.loadClass(name);
+      }
+      else
+      {
+         return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+            public Class<?> run() throws PrivilegedActionException
+            {
+               try
+               {
+                  return cl.loadClass(name);
+               }
+               catch (Exception e)
+               {
+                  throw new PrivilegedActionException(e);
+               }
+            }
+         });
+      }
+   }
+}

Added: api/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java
===================================================================
--- api/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java	                        (rev 0)
+++ api/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java	2010-11-28 02:10:52 UTC (rev 13344)
@@ -0,0 +1,306 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Load a service class using this ordered lookup procedure
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @author alessio.soldano at jboss.com
+ * @since 14-Dec-2006
+ */
+public abstract class ServiceLoader
+{
+   /**
+    * A synchronized weak hash map that keeps factory names retrieved using Service API (META-INF/services/*) for each classloader.
+    * Weak keys are used to remove entries when classloaders are garbage collected; values are service-property-name -> factory name maps.
+    */
+   private static Map<ClassLoader, Map<String, String>> serviceMap = Collections.synchronizedMap(new WeakHashMap<ClassLoader, Map<String, String>>());
+   
+   /**
+    * This method uses the algorithm below using the JAXWS Provider as an example.
+    * 
+    * 1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then
+    * its first line, if present, is used as the UTF-8 encoded name of the implementation class.
+    * 
+    * 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the 
+    * java.util.Properties.load(InputStream) method and it contains an entry whose key is 
+    * javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class.
+    * 
+    * 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used
+    * as the name of the implementation class.
+    * 
+    * 4. Finally, a default implementation class name is used.
+    */
+   public static Object loadService(String propertyName, String defaultFactory)
+   {
+      Object factory = loadFromServices(propertyName, null);
+      if (factory == null)
+      {
+         factory = loadFromPropertiesFile(propertyName, null);
+      }
+      if (factory == null)
+      {
+         factory = loadFromSystemProperty(propertyName, defaultFactory);
+      }
+      return factory;
+   }
+   
+   /** Use the Services API (as detailed in the JAR specification), if available, to determine the classname.
+    */
+   public static Object loadFromServices(String propertyName, String defaultFactory)
+   {
+      Object factory = null;
+      String factoryName = null;
+      ClassLoader loader = SecurityActions.getContextClassLoader();
+      
+      // Use the Services API (as detailed in the JAR specification), if available, to determine the classname.
+      String filename = "META-INF/services/" + propertyName;
+      
+      try
+      {
+         factoryName = getServiceNameUsingCache(loader, filename);
+         if (factoryName != null)
+         {
+            Class factoryClass = SecurityActions.loadClass(loader, factoryName);
+            factory = factoryClass.newInstance();
+         }
+      }
+      catch (Throwable t)
+      {
+         throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t);
+      }
+      
+      // Use the default factory implementation class.
+      if (factory == null && defaultFactory != null)
+      {
+         factory = loadDefault(defaultFactory);
+      }
+
+      return factory;
+   }
+
+   private static String getServiceNameUsingCache(ClassLoader loader, String filename) throws IOException
+   {
+      Map<String, String> map = serviceMap.get(loader);
+      if (map != null && map.containsKey(filename))
+      {
+         return map.get(filename);
+      }
+      else
+      {
+         if (map == null)
+         {
+            map = new ConcurrentHashMap<String, String>();
+            serviceMap.put(loader, map);
+         }
+         InputStream inStream = SecurityActions.getResourceAsStream(loader, filename);
+         String factoryName = null;
+         if (inStream != null)
+         {
+            BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8"));
+            factoryName = br.readLine();
+            br.close();
+            map.put(filename, factoryName);
+         }
+         return factoryName;
+      }
+   }
+   
+   /** Use the system property
+    */
+   public static Object loadFromSystemProperty(String propertyName, String defaultFactory)
+   {
+      Object factory = null;
+      ClassLoader loader = SecurityActions.getContextClassLoader();
+
+      PrivilegedAction action = new PropertyAccessAction(propertyName);
+      String factoryName = (String)AccessController.doPrivileged(action);
+      if (factoryName != null)
+      {
+         try
+         {
+            //if(log.isDebugEnabled()) log.debug("Load from system property: " + factoryName);
+            Class factoryClass = SecurityActions.loadClass(loader, factoryName);
+            factory = factoryClass.newInstance();
+         }
+         catch (Throwable t)
+         {
+            throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t);
+         }
+      }
+
+      // Use the default factory implementation class.
+      if (factory == null && defaultFactory != null)
+      {
+         factory = loadDefault(defaultFactory);
+      }
+
+      return factory;
+   }
+
+   /**
+    * Use the properties file "${java.home}/lib/jaxws.properties" in the JRE directory.
+    * This configuration file is in standard java.util.Properties format and contains the 
+    * fully qualified name of the implementation class with the key being the system property defined above.
+    */
+   public static Object loadFromPropertiesFile(String propertyName, String defaultFactory)
+   {
+      Object factory = null;
+      String factoryName = null;
+      ClassLoader loader = SecurityActions.getContextClassLoader();
+
+      // Use the properties file "lib/jaxm.properties" in the JRE directory.
+      // This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.
+      PrivilegedAction action = new PropertyAccessAction("java.home");
+      String javaHome = (String)AccessController.doPrivileged(action);
+      File jaxmFile = new File(javaHome + "/lib/jaxws.properties");
+      if ((Boolean)AccessController.doPrivileged(new PropertyFileExistAction(jaxmFile)))
+      {
+         try
+         {
+            action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath());
+            Properties jaxmProperties = (Properties)AccessController.doPrivileged(action);
+            factoryName = jaxmProperties.getProperty(propertyName);
+            if (factoryName != null)
+            {
+               //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile + ": " + factoryName);
+               Class<?> factoryClass = SecurityActions.loadClass(loader, factoryName);
+               factory = factoryClass.newInstance();
+            }
+         }
+         catch (Throwable t)
+         {
+            throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t);
+         }
+      }
+
+      // Use the default factory implementation class.
+      if (factory == null && defaultFactory != null)
+      {
+         factory = loadDefault(defaultFactory);
+      }
+
+      return factory;
+   }
+
+   private static Object loadDefault(String defaultFactory)
+   {
+      Object factory = null;
+      ClassLoader loader = SecurityActions.getContextClassLoader();
+
+      // Use the default factory implementation class.
+      if (defaultFactory != null)
+      {
+         try
+         {
+            //if(log.isDebugEnabled()) log.debug("Load from default: " + factoryName);
+            Class factoryClass = SecurityActions.loadClass(loader, defaultFactory);
+            factory = factoryClass.newInstance();
+         }
+         catch (Throwable t)
+         {
+            throw new IllegalStateException("Failed to load: " + defaultFactory, t);
+         }
+      }
+
+      return factory;
+   }
+
+   private static class PropertyAccessAction implements PrivilegedAction
+   {
+      private String name;
+
+      PropertyAccessAction(String name)
+      {
+         this.name = name;
+      }
+
+      public Object run()
+      {
+         return System.getProperty(name);
+      }
+   }
+
+   private static class PropertyFileAccessAction implements PrivilegedAction
+   {
+      private String filename;
+
+      PropertyFileAccessAction(String filename)
+      {
+         this.filename = filename;
+      }
+
+      public Object run()
+      {
+         InputStream inStream = null;
+         try
+         {
+            inStream = new FileInputStream(filename);
+            Properties props = new Properties();
+            props.load(inStream);
+            return props;
+         }
+         catch (IOException ex)
+         {
+            throw new SecurityException("Cannot load properties: " + filename, ex);
+         }
+         finally
+         {
+            try
+            {
+               inStream.close();
+            }
+            catch (Exception e) {} //ignore
+         }
+      }
+   }
+   
+   private static class PropertyFileExistAction implements PrivilegedAction
+   {
+      private File file;
+
+      PropertyFileExistAction(File file)
+      {
+         this.file = file;
+      }
+
+      public Object run()
+      {
+         return file.exists();
+      }
+   }
+}



More information about the jbossws-commits mailing list