[jboss-svn-commits] JBL Code SVN: r21514 - in labs/jbossesb/workspace/skeagh: api and 14 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 13 09:30:31 EDT 2008
Author: tfennelly
Date: 2008-08-13 09:30:31 -0400 (Wed, 13 Aug 2008)
New Revision: 21514
Added:
labs/jbossesb/workspace/skeagh/api/
labs/jbossesb/workspace/skeagh/api/pom.xml
labs/jbossesb/workspace/skeagh/api/service/
labs/jbossesb/workspace/skeagh/api/service/pom.xml
labs/jbossesb/workspace/skeagh/api/service/src/
labs/jbossesb/workspace/skeagh/api/service/src/main/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/JBossESBException.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/AddressingContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/package.html
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/ServiceInvoker.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/package.html
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/doc-files/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/doc-files/4.x-to-5.x-devnotes.html
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/package.html
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/package.html
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/Service.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceException.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/package.html
labs/jbossesb/workspace/skeagh/api/service/src/main/java/overview.html
labs/jbossesb/workspace/skeagh/api/service/src/main/resources/
labs/jbossesb/workspace/skeagh/api/service/src/test/
labs/jbossesb/workspace/skeagh/api/service/src/test/java/
labs/jbossesb/workspace/skeagh/api/service/src/test/resources/
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java
Log:
Restructuring for API modules.
Added: labs/jbossesb/workspace/skeagh/api/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/api/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/pom.xml 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb</artifactId>
+ <version>5.0-SNAPSHOT</version>
+ </parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>api</artifactId>
+ <packaging>pom</packaging>
+ <version>5.0-SNAPSHOT</version>
+ <name>Jboss ESB (API Base POM)</name>
+ <url>http://www.jboss.org/jbossesb/</url>
+
+ <properties>
+ <jboss.esb.version>5.0-SNAPSHOT</jboss.esb.version>
+ </properties>
+
+ <modules>
+ <module>service</module>
+ </modules>
+
+</project>
Property changes on: labs/jbossesb/workspace/skeagh/api/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/pom.xml 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>api</artifactId>
+ <version>5.0-SNAPSHOT</version>
+ </parent>
+ <name>JBoss ESB - Service API</name>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-service-api</artifactId>
+ <version>${jboss.esb.version}</version>
+ <url>http://www.jboss.org/jbossesb/</url>
+
+</project>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/api/service/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/JBossESBException.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/JBossESBException.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/JBossESBException.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBossESBException extends Exception
+{
+ /**
+ * Public Constructor.
+ *
+ * @param message Exception message.
+ */
+ public JBossESBException(final String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Public Constructor.
+ *
+ * @param message Exception message.
+ * @param cause Exception cause.
+ */
+ public JBossESBException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/JBossESBException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/AddressingContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/AddressingContext.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/AddressingContext.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.context;
+
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * Message Addressing Context.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class AddressingContext
+{
+ /**
+ * "To" ServiceName for the message associated with the current context.
+ */
+ private ServiceName to;
+ /**
+ * "From" ServiceName for the message associated with the current context.
+ */
+ private ServiceName from;
+ /**
+ * "ReplyTo" ServiceName for the message associated with the current context.
+ */
+ private ServiceName replyTo;
+ /**
+ * "FaultTo" ServiceName for the message associated with the current context.
+ */
+ private ServiceName faultTo;
+
+ /**
+ * Get the {@link AddressingContext} associated with the message currently
+ * being processed.
+ * @return The {@link AddressingContext} associated with the message currently
+ * being processed.
+ */
+ public static AddressingContext getAddressingContext()
+ {
+ return null;
+ }
+
+ /**
+ * Get the "To" address.
+ * @return The "To" address.
+ */
+ public final ServiceName getTo()
+ {
+ return to;
+ }
+
+ /**
+ * Set the "To" address.
+ * @param to The "To" address.
+ */
+ public final void setTo(final ServiceName to)
+ {
+ this.to = to;
+ }
+
+ /**
+ * Get the "From" address.
+ * @return The "From" address.
+ */
+ public final ServiceName getFrom()
+ {
+ return from;
+ }
+
+ /**
+ * Set the "To" address.
+ * @param from The "To" address.
+ */
+ public final void setFrom(final ServiceName from)
+ {
+ this.from = from;
+ }
+
+ /**
+ * Get the "ReplyTo" address.
+ * @return The "ReplyTo" address.
+ */
+ public final ServiceName getReplyTo()
+ {
+ return replyTo;
+ }
+
+ /**
+ * Set the "ReplyTo" address.
+ * @param replyTo The "ReplyTo" address.
+ */
+ public final void setReplyTo(final ServiceName replyTo)
+ {
+ this.replyTo = replyTo;
+ }
+
+ /**
+ * Get the "FaultTo" address.
+ * @return The "FaultTo" address.
+ */
+ public final ServiceName getFaultTo()
+ {
+ return faultTo;
+ }
+
+ /**
+ * Set the "FaultTo" address.
+ * @param faultTo The "FaultTo" address.
+ */
+ public final void setFaultTo(final ServiceName faultTo)
+ {
+ this.faultTo = faultTo;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/AddressingContext.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.context;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Deployment Context.
+ * <p/>
+ * Mutable context scoped around the deployment unit to which the caller
+ * is part of.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class DeploymentContext implements ESBContext
+{
+
+ /**
+ * Context Data Map.
+ */
+ private Map<Object, Object> contextMap = new LinkedHashMap<Object, Object>();
+
+ /**
+ * Get the {@link DeploymentContext} associated with the caller.
+ * @return The {@link DeploymentContext} associated with the caller.
+ */
+ public static DeploymentContext getDeploymentContext()
+ {
+ return null;
+ }
+
+ /**
+ * Get the Object from the context using the supplied key.
+ * @param key The context key.
+ * @return The Object bound under the supplied context key, otherwise false.
+ */
+ public final Object get(final Object key)
+ {
+ return contextMap.get(key);
+ }
+
+ /**
+ * Set the value Object into the context using the supplied key.
+ * @param key The context key.
+ * @param value The value object to be set in the context.
+ */
+ public final void set(final Object key, final Object value)
+ {
+ contextMap.put(key, value);
+ }
+
+ /**
+ * Get the context Map.
+ * @return The context Map.
+ */
+ public final Map<Object, Object> getAll()
+ {
+ return contextMap;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.context;
+
+import java.util.Map;
+
+/**
+ * ESB Context.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public interface ESBContext
+{
+
+ /**
+ * Get an object from the context.
+ *
+ * @param key The context object key.
+ * @return The Object instance, or null if the Object is not bound to the
+ * context instance.
+ */
+ Object get(final Object key);
+
+ /**
+ * Set an object on the context.
+ *
+ * @param key The context object key.
+ * @param value The object instance.
+ */
+ void set(final Object key, final Object value);
+
+ /**
+ * Get all the context objects.
+ *
+ * @return The context Map.
+ */
+ Map<Object, Object> getAll();
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.context;
+
+import org.jboss.esb.invocation.InvocationParameters;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * InvocationContext Context.
+ * <p/>
+ * Mutable context scoped around a ServiceInvocation.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class InvocationContext implements ESBContext
+{
+
+ /**
+ * Context Data Map.
+ */
+ private Map<Object, Object> contextMap = new LinkedHashMap<Object, Object>();
+
+ /**
+ * Get the {@link InvocationContext} associated with the message currently
+ * being processed.
+ * @return The {@link InvocationContext} associated with the message currently
+ * being processed.
+ */
+ public static InvocationContext getInvocationContext()
+ {
+ return null;
+ }
+
+ /**
+ * Get the Object from the context using the supplied key.
+ * @param key The context key.
+ * @return The Object bound under the supplied context key, otherwise false.
+ */
+ public final Object get(final Object key)
+ {
+ return contextMap.get(key);
+ }
+
+ /**
+ * Set the value Object into the context using the supplied key.
+ * @param key The context key.
+ * @param value The value object to be set in the context.
+ */
+ public final void set(final Object key, final Object value)
+ {
+ contextMap.put(key, value);
+ }
+
+ /**
+ * Get the context Map.
+ * @return The context Map.
+ */
+ public final Map<Object, Object> getAll()
+ {
+ return contextMap;
+ }
+
+ /**
+ * Get the {@link org.jboss.esb.invocation.InvocationParameters} associated with this
+ * Invocation.
+ * <p/>
+ * TODO: Should we have this as a non-static method on this class?
+ *
+ * @return The InvocationParameters instance, or null if no
+ * InvocationParameters were sent with the {@link org.jboss.esb.message.Message}
+ * during the Service Invocation.
+ */
+ public static InvocationParameters getInvocationParameters()
+ {
+ return null;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/package.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESB Context.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.invocation;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Imutable Service Invocation Parameters.
+ * <p/>
+ * An ESB {@link org.jboss.esb.message.Message} is an integral part of
+ * any Service Invocation. That's not the full picture however. Sometimes
+ * it is necessary to send "Invocation Parameters" in parallel with the
+ * basic ESB {@link org.jboss.esb.message.Message} e.g. parameters that
+ * identify a process instance on the target Service.
+ * <p/>
+ * A Service can access the InvocationParameters instance (associated with the
+ * Message it is currently processing) via the
+ * {@link org.jboss.esb.context.InvocationContext#getInvocationParameters()} method.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class InvocationParameters
+{
+
+ /**
+ * Invocation Parameters.
+ */
+ private Map<String, Object> parameters = new LinkedHashMap<String, Object>();
+
+ /**
+ * Public constructor.
+ * @param parameters The invocation parameters.
+ */
+ public InvocationParameters(final Map<String, Object> parameters)
+ {
+ this.parameters = parameters;
+ }
+
+ /**
+ * Get the named invocation parameter value.
+ * @param name The name of the invocation parameter.
+ * @return The invocation parameter value, or null if not specified.
+ */
+ public final Object getParameter(final String name)
+ {
+ return parameters.get(name);
+ }
+
+ /**
+ * Get the parameter Map.
+ * @return The parameter Map.
+ */
+ public final Map<String, Object> getParameters()
+ {
+ return parameters;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/ServiceInvoker.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/ServiceInvoker.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.invocation;
+
+import org.jboss.esb.message.Message;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * Service Invoker.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class ServiceInvoker
+{
+ /**
+ * Get the ServiceInvoker instance for the deployment.
+ * @return The ServiceInvoker instance.
+ */
+ public static ServiceInvoker getServiceInvoker()
+ {
+ return null;
+ }
+
+ /**
+ * Send the supplied message to the specified Service.
+ * <p/>
+ * Supports an asynchronous replyTo.
+ *
+ * @param message The message to be sent.
+ * @param to The Service to which the message is to be sent.
+ * @param replyTo The Service to which the reply should be sent.
+ */
+ public void send(final Message message, final ServiceName to, final ServiceName replyTo)
+ {
+
+ }
+
+ /**
+ * Send the supplied message to the specified Service.
+ *
+ * @param message The message to be sent.
+ * @param to The Service to which the message is to be sent.
+ */
+ public void sendOneWay(final Message message, final ServiceName to)
+ {
+
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/ServiceInvoker.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/package.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESB Invocation.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.message;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * JBoss ESB Message.
+ * <p/>
+ * <b>Note</b>: <i>For those moving from JBossESB 4.x, please read the
+ * <a href="doc-files/4.x-to-5.x-devnotes.html#message">4.x to 5.x Developer Notes</a></i>.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class Message
+{
+
+ /**
+ * Primary Payload.
+ */
+ private Object payload;
+ /**
+ * Attachments.
+ */
+ private Map<String, Object> attachments = new LinkedHashMap<String, Object>();
+
+ /**
+ * Get the primary payload Object.
+ *
+ * @return The primary payload Object.
+ */
+ public final Object getPayload()
+ {
+ return payload;
+ }
+
+ /**
+ * Set the primary payload Object.
+ *
+ * @param payload The primary payload Object.
+ */
+ public final void setPayload(final Object payload)
+ {
+ this.payload = payload;
+ }
+
+ /**
+ * Get the message attachments.
+ *
+ * @return Message attachments.
+ */
+ public final Map<String, Object> getAttachments()
+ {
+ return attachments;
+ }
+
+ /**
+ * Set the message attachments.
+ *
+ * @param attachments Message attachments.
+ */
+ public final void setAttachments(final Map<String, Object> attachments)
+ {
+ this.attachments = attachments;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/doc-files/4.x-to-5.x-devnotes.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/doc-files/4.x-to-5.x-devnotes.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/doc-files/4.x-to-5.x-devnotes.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,49 @@
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" TITLE="Style"/>
+</head>
+<body>
+<h2>Notes for JBossESB 4.x Developers Moving to JBossESB 5.x</h2>
+This page contains notes for developers moving from JBossESB 4.x to JBossESB 5.x.
+
+<h3 id="message">Message Changes</h3>
+One of the big changes in the 5.x API is the <a href="../Message.html">Message</a>.
+The message in JBossESB 5.x is a simple POJO, contrasting with the complex/confusing
+structure defined in the 4.x API.
+<p/>
+The main points of difference are:
+<table border="1" cellpadding="3" cellspacing="0" width="100%">
+ <tr class="TableHeadingColor">
+ <th>4.x</th>
+ <th>5.x</th>
+ </tr>
+ <tr>
+ <td>Multiple named message payload locations in the message "Body".</td>
+ <td>Single "Primary" message payload located directly on the Message (unnamed).
+ If your message contains multiple Objects, then the primary payload
+ would be a Collection.
+ </td>
+ </tr>
+ <tr>
+ <td>Contextual info (e.g. Addressing/Call info) passed around with the Message.</td>
+ <td>Contextual info not available on the Message. This information can be
+ accessed via the classes defined in the <a
+ href="../../context/package-summary.html">org.jboss.esb.context</a> package.
+ </td>
+ </tr>
+ <tr>
+ <td>Contextual information getting stored on the Message, causing "pollution" of
+ the Message.
+ </td>
+ <td>Proper "Context" objects are now available through the <a href="../../context/package-summary.html">org.jboss.esb.context</a>
+ package. No need to polute the Message.
+ </td>
+ </tr>
+ <tr>
+ <td>Serialization parameters were defined on the Message.</td>
+ <td>Serialization is a completely orthogonal function.</td>
+ </tr>
+</table>
+
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/package.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESB Message.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/package.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESb Service.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/Service.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/Service.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/Service.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.service;
+
+import org.jboss.esb.message.Message;
+
+/**
+ * ESB Service interface.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface Service
+{
+ /**
+ * Service process method.
+ * @param message The message to be processed.
+ * @return The resultant {@link Message}.
+ * @throws ServiceException Service exception processing the message.
+ */
+ Message process(final Message message) throws ServiceException;
+}
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/Service.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceException.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceException.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceException.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.service;
+
+import org.jboss.esb.JBossESBException;
+
+/**
+ * Service Exception.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ServiceException extends JBossESBException
+{
+ /**
+ * Public Constructor.
+ *
+ * @param message Exception message.
+ */
+ public ServiceException(final String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Public Constructor.
+ *
+ * @param message Exception message.
+ * @param cause Exception cause.
+ */
+ public ServiceException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.esb.service;
+
+/**
+ * Service Name.
+ *
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class ServiceName
+{
+
+ /**
+ * Service Category.
+ */
+ private final String category;
+ /**
+ * Service Name.
+ */
+ private final String name;
+
+ /**
+ * Public constructor.
+ * @param category Service Category.
+ * @param name Service Name.
+ */
+ public ServiceName(final String category, final String name)
+ {
+ this.category = category;
+ this.name = name;
+ }
+
+ /**
+ * Get the Service Category.
+ * @return Service Category.
+ */
+ public final String getCategory()
+ {
+ return category;
+ }
+
+ /**
+ * Get the Service Name.
+ * @return The Service Name.
+ */
+ public final String getName()
+ {
+ return name;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/package.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESb Service.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/api/service/src/main/java/overview.html
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/overview.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/overview.html 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,9 @@
+<html>
+<head></head>
+<body>
+JBoss ESB - Service API.
+
+<h1>Overview</h1>
+This is the Core Service API for JBoss ESB.
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java 2008-08-13 13:30:31 UTC (rev 21514)
@@ -0,0 +1,198 @@
+/*
+ * 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.esb.classpath;
+
+import org.apache.log4j.Logger;
+
+import java.io.InputStream;
+import java.lang.reflect.Proxy;
+
+/**
+ * Utility methods to aid in class/resource loading.
+ *
+ * @author kevin
+ */
+public abstract class ClassUtil
+{
+ /**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(ClassUtil.class);
+
+ /**
+ * Private default constructor.
+ */
+ private ClassUtil()
+ {
+ }
+
+ /**
+ * Load the specified class.
+ *
+ * @param className The name of the class to load.
+ * @param caller The class of the caller.
+ * @return The specified class.
+ * @throws ClassNotFoundException If the class cannot be found.
+ */
+ public static Class forName(final String className, final Class caller)
+ throws ClassNotFoundException
+ {
+ final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
+ if (threadClassLoader != null)
+ {
+ try
+ {
+ return Class.forName(className, true, threadClassLoader);
+ }
+ catch (final ClassNotFoundException cnfe)
+ {
+ if (cnfe.getException() != null)
+ {
+ throw cnfe;
+ }
+ }
+ }
+
+ final ClassLoader classLoader = caller.getClassLoader();
+ if (classLoader != null)
+ {
+ try
+ {
+ return Class.forName(className, true, classLoader);
+ }
+ catch (final ClassNotFoundException cnfe)
+ {
+ if (cnfe.getException() != null)
+ {
+ throw cnfe;
+ }
+ }
+ }
+
+ return Class.forName(className, true, ClassLoader.getSystemClassLoader());
+ }
+
+ /**
+ * Resolve a proxy for the specified interfaces.
+ *
+ * @param interfaces The interfaces associated with the proxy.
+ * @param caller The class of the caller.
+ * @return The specified proxy class.
+ * @throws ClassNotFoundException If the class cannot be found.
+ */
+ public static Class resolveProxy(final String[] interfaces, final Class caller)
+ throws ClassNotFoundException
+ {
+ final int numInterfaces = (interfaces == null ? 0 : interfaces.length);
+ if (numInterfaces == 0)
+ {
+ throw new ClassNotFoundException("Cannot generate proxy with no interfaces");
+ }
+
+ final Class[] interfaceClasses = new Class[numInterfaces];
+ for (int count = 0; count < numInterfaces; count++)
+ {
+ interfaceClasses[count] = forName(interfaces[count], caller);
+ }
+
+ final ClassLoader proxyClassLoader;
+ final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
+ if (threadClassLoader != null)
+ {
+ proxyClassLoader = threadClassLoader;
+ } else
+ {
+ final ClassLoader classLoader = caller.getClassLoader();
+ if (classLoader != null)
+ {
+ proxyClassLoader = classLoader;
+ } else
+ {
+ proxyClassLoader = ClassLoader.getSystemClassLoader();
+ }
+ }
+
+ return Proxy.getProxyClass(proxyClassLoader, interfaceClasses);
+ }
+
+ /**
+ * Get the specified resource as a stream.
+ *
+ * @param resourceName The name of the class to load.
+ * @param caller The class of the caller.
+ * @return The input stream for the resource or null if not found.
+ */
+ public static InputStream getResourceAsStream(final String resourceName, final Class caller)
+ {
+ final String resource;
+ if (resourceName.startsWith("/"))
+ {
+ resource = resourceName.substring(1);
+ } else
+ {
+ final Package callerPackage = caller.getPackage();
+ if (callerPackage != null)
+ {
+ resource = callerPackage.getName().replace('.', '/') + '/' + resourceName;
+ } else
+ {
+ resource = resourceName;
+ }
+ }
+ final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
+ if (threadClassLoader != null)
+ {
+ final InputStream is = threadClassLoader.getResourceAsStream(resource);
+ if (is != null)
+ {
+ return is;
+ }
+ }
+
+ final ClassLoader classLoader = caller.getClassLoader();
+ if (classLoader != null)
+ {
+ final InputStream is = classLoader.getResourceAsStream(resource);
+ if (is != null)
+ {
+ return is;
+ }
+ }
+
+ return ClassLoader.getSystemResourceAsStream(resource);
+ }
+
+ /**
+ * Get a package name and convert it to a path value, so it can be used
+ * in calls to methods like {@link #getResourceAsStream}.
+ * <p/>
+ * Adds a '/' prefix and converts all '." characters to '/'. Doesn't add a
+ * trailing slash.
+ *
+ * @param packageObj The package.
+ * @return The package path.
+ */
+ public static String getPath(final Package packageObj)
+ {
+ return "/" + packageObj.getName().replace('.', '/');
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list