[jboss-svn-commits] JBL Code SVN: r27169 - in labs/jbossesb/workspace/systinet/product/tools: systinet and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jun 26 20:43:57 EDT 2009
Author: tcunning
Date: 2009-06-26 20:43:57 -0400 (Fri, 26 Jun 2009)
New Revision: 27169
Added:
labs/jbossesb/workspace/systinet/product/tools/systinet/
labs/jbossesb/workspace/systinet/product/tools/systinet/build.xml
labs/jbossesb/workspace/systinet/product/tools/systinet/src/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletRequest.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletResponse.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletInputStream.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletOutputStream.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Inquiry.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/InquiryService.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/JNDIRegistration.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Publish.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/PublishService.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RegistrationService.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RemoteHttpServlet.java
labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/resources/
labs/jbossesb/workspace/systinet/product/tools/systinet/systinet.properties
Log:
Check RMI transport into systinet branch.
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/build.xml
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/build.xml (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/build.xml 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,61 @@
+<project name="jon-build" default="deploy" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
+
+ <property name="build.dir" location="build"/>
+ <property name="classes.dir" value="${build.dir}/classes"/>
+ <property name="classpath.dir" location="../../../antlib"/>
+
+ <property name="soap.classes.dir" location="${basedir}/../../services/soap/build/classes"/>
+ <property name="esb.transport.jar.version" value="1.0"/>
+ <property name="esb.transport.jar.name" value="jbossesb-transport-${esb.transport.jar.version}.jar"/>
+ <property name="esb.transport.client.jar.name" value="jbossesb-transport-client-${esb.transport.jar.version}.jar"/>
+ <property name="esb.transport.jar" location="${build.dir}/${esb.transport.jar.name}"/>
+ <property name="esb.client.transport.jar" location="${build.dir}/${esb.transport.client.jar.name}"/>
+
+ <property name="src.dir" location="src/main"/>
+ <property name="java.dir" location="${src.dir}/java"/>
+ <property name="resources.dir" location="${src.dir}/resources"/>
+
+ <property file="systinet.properties"/>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <path id="classpath">
+ <fileset dir="/home/tcunning/jboss-4.2.2.GA/server/default/lib"
+ includes="**/*.jar"/>
+ <fileset dir="${systinet.reg.dir}/lib" includes="**/*.jar"/>
+ <fileset dir="${systinet.reg.dir}/app/uddi" includes="**/*.jar"/>
+ </path>
+
+ <target name="compile-transport">
+ <mkdir dir="build"/>
+ <mkdir dir="${classes.dir}"/>
+ <javac deprecation="off" nowarn="on" debug="on" srcdir="${java.dir}" destdir="${classes.dir}" classpathref="classpath" source="1.5"/>
+ </target>
+
+ <target name="jar-transport" depends="compile-transport">
+ <echo message="Plugin version is ${esb.transport.jar.version}"/>
+ <jar destfile="${esb.transport.jar}">
+ <fileset dir="${classes.dir}"/>
+ <fileset dir="${resources.dir}"/>
+ </jar>
+ <jar destfile="${esb.client.transport.jar}">
+ <fileset dir="${classes.dir}">
+ <include name="**/Inquiry.class"/>
+ <include name="**/Publish.class"/>
+ </fileset>
+ <fileset dir="${resources.dir}"/>
+ </jar>
+ </target>
+
+ <target name="deploy" depends="jar-transport">
+ <copy file="${esb.transport.jar}"
+ overwrite="true"
+ todir="/home/tcunning/jboss-4.2.2.GA/server/default/deploy/registry.war/WEB-INF/lib"/>
+ <copy file="${esb.client.transport.jar}"
+ overwrite="true"
+ todir="/home/tcunning/jboss-4.2.2.GA/server/default/deploy/jbossesb.sar/lib"/>
+ </target>
+
+</project>
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletRequest.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletRequest.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletRequest.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,354 @@
+/*
+ * 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.soa.esb.http.mock;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ */
+public class SOAPProcessorHttpServletRequest implements HttpServletRequest
+{
+ private final Map<String, List<String>> headers ;
+ private Map<String, String[]> parameters = new HashMap<String, String[]>();
+
+ private final byte[] content ;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ private final String path ;
+ private HttpSession session = null;
+
+ public SOAPProcessorHttpServletRequest(final String path, final byte[] content, final Map<String, List<String>> headers)
+ {
+ this.path = path ;
+ this.content = content ;
+ this.headers = headers ;
+ }
+
+ public String getHeader(final String name)
+ {
+ final List<String> values = headers.get(name) ;
+ if (values != null)
+ {
+ return values.get(0) ;
+ }
+ return null ;
+ }
+
+ public Enumeration getHeaderNames()
+ {
+ return Collections.enumeration(headers.keySet()) ;
+ }
+
+ public String getMethod()
+ {
+ // always use POST
+ return "POST" ;
+ }
+
+ public String getPathInfo()
+ {
+ return null ;
+ }
+
+ public String getQueryString()
+ {
+ return null ;
+ }
+
+ public String getRequestURI()
+ {
+ return (path == null ? "/" : path) ;
+ }
+
+ public String getContextPath()
+ {
+ return "" ;
+ }
+
+ public HttpSession getSession(boolean arg0)
+ {
+ return session;
+ }
+
+ public String getContentType()
+ {
+ return getHeader("Content-Type") ;
+ }
+
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return new SOAPProcessorServletInputStream(new ByteArrayInputStream(content)) ;
+ }
+
+ public String getParameter(final String name)
+ {
+ return null ;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ // TODO link this is with security
+ return null ;
+ }
+
+ public boolean isUserInRole(final String name)
+ {
+ // TODO link this is with security
+ return false ;
+ }
+
+ /*
+ * The following methods are not supported by this adapter.
+ */
+
+ public StringBuffer getRequestURL()
+ {
+ return new StringBuffer(getRequestURI());
+ }
+
+ public String getAuthType()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Cookie[] getCookies()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public long getDateHeader(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getHeaders(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getIntHeader(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getPathTranslated()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRemoteUser()
+ {
+ return null;
+ }
+
+ public String getRequestedSessionId()
+ {
+ return null;
+ }
+
+ public String getServletPath()
+ {
+ return "/jbossesbfakepath";
+ }
+
+ public HttpSession getSession()
+ {
+ return session;
+ }
+
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdFromURL()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isRequestedSessionIdValid()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return Collections.enumeration(attributes.keySet());
+ }
+
+ public String getCharacterEncoding()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getContentLength()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Locale getLocale()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Enumeration getLocales()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Map getParameterMap()
+ {
+ return parameters;
+ }
+
+ public Enumeration getParameterNames()
+ {
+ return Collections.enumeration(parameters.keySet());
+ }
+
+ public String[] getParameterValues(String arg0)
+ {
+ return parameters.get(arg0);
+ }
+
+ public String getProtocol()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRealPath(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRemoteAddr()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getRemoteHost()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getScheme()
+ {
+ return null;
+ }
+
+ public String getServerName()
+ {
+ return null;
+ }
+
+ public int getServerPort()
+ {
+ return 0;
+ }
+
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ attributes.remove(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ if (arg1 != null) {
+ attributes.put(arg0, arg1);
+ } else {
+ attributes.remove(arg0);
+ }
+ }
+
+ public void setCharacterEncoding(String arg0)
+ throws UnsupportedEncodingException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Object getAttribute(String arg0)
+ {
+ return attributes.get(arg0);
+ }
+
+ public String getLocalAddr()
+ {
+ return null;
+ }
+
+ public String getLocalName()
+ {
+ return null;
+ }
+
+ public int getLocalPort()
+ {
+ return 0;
+ }
+
+ public int getRemotePort()
+ {
+ return 0;
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletResponse.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletResponse.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorHttpServletResponse.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,319 @@
+/*
+ * 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.soa.esb.http.mock;
+
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ */
+public class SOAPProcessorHttpServletResponse implements HttpServletResponse
+{
+ private static final String CHARSET = "charset=" ;
+
+ private Map<String, List<String>> headers = new HashMap<String, List<String>>() ;
+
+ private int status ;
+
+ private ByteArrayOutputStream baos ;
+
+ private boolean streamReturned;
+ private boolean committed = false;
+
+ public SOAPProcessorHttpServletResponse()
+ {
+ baos = new ByteArrayOutputStream() ;
+ }
+
+ public void addHeader(final String name, final String value)
+ {
+ final String normalisedName = name.toLowerCase() ;
+ final List<String> values = headers.get(normalisedName) ;
+ if (values != null)
+ {
+ values.add(value) ;
+ }
+ else
+ {
+ final List<String> newValues = new ArrayList<String>() ;
+ newValues.add(value) ;
+ headers.put(normalisedName, newValues) ;
+ }
+ }
+
+ public void setHeader(final String name, final String value)
+ {
+ final List<String> values = new ArrayList<String>() ;
+ values.add(value) ;
+ headers.put(name.toLowerCase(), values) ;
+ }
+
+ public void setStatus(final int status)
+ {
+ this.status = status ;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ //if (streamReturned)
+ //{
+ // throw new IOException("Output stream already accessed") ;
+ //}
+ streamReturned = true ;
+ return new SOAPProcessorServletOutputStream(baos) ;
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ //if (streamReturned)
+ //{
+ // throw new IOException("Output stream already accessed") ;
+ //}
+ streamReturned = true ;
+ final String charset = getCharset() ;
+ final OutputStreamWriter osw = (charset != null ? new OutputStreamWriter(baos, charset) : new OutputStreamWriter(baos)) ;
+ return new PrintWriter(new BufferedWriter(osw)) ;
+ }
+
+ public void setContentType(final String contentType)
+ {
+ setHeader("content-type", contentType) ;
+ }
+
+ public int getStatus()
+ {
+ return status ;
+ }
+
+ public Map<String, List<String>> getHeaders()
+ {
+ return headers ;
+ }
+
+ public byte[] getContent()
+ {
+ return baos.toByteArray() ;
+ }
+
+ public String getContentType()
+ {
+ final List<String> values = headers.get("content-type") ;
+ if (values != null)
+ {
+ return values.get(0) ;
+ }
+ return null ;
+ }
+
+ public String getCharset()
+ {
+ final String contentType = getContentType() ;
+ if (contentType != null)
+ {
+ final int index = contentType.indexOf(CHARSET) ;
+ if (index >= 0)
+ {
+ final int beginIndex = index + CHARSET.length() ;
+ if (beginIndex < contentType.length())
+ {
+ final int endIndex = contentType.indexOf(';', beginIndex) ;
+ if (endIndex >= 0)
+ {
+ return contentType.substring(beginIndex, endIndex).trim() ;
+ }
+ else
+ {
+ return contentType.substring(beginIndex).trim();
+ }
+ }
+ }
+ }
+ return null ;
+ }
+
+ public void setCharacterEncoding(final String charset)
+ {
+ final String contentType = getContentType() ;
+ if (contentType != null)
+ {
+ final int charsetIndex = contentType.indexOf(CHARSET) ;
+ if (charsetIndex == -1)
+ {
+ setContentType(contentType + ';' + CHARSET + charset) ;
+ }
+ else
+ {
+ final StringBuilder sb = new StringBuilder() ;
+ sb.append(contentType, 0, charsetIndex) ;
+ sb.append(CHARSET) ;
+ sb.append(charset) ;
+ final int endIndex = contentType.indexOf(';', charsetIndex) ;
+ if (endIndex != -1)
+ {
+ sb.append(contentType, endIndex, contentType.length()) ;
+ }
+ setContentType(sb.toString()) ;
+ }
+ }
+ }
+
+ /*
+ * The following methods are not supported by this adapter.
+ */
+
+ public void addCookie(Cookie arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void addDateHeader(String arg0, long arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void addIntHeader(String arg0, int arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean containsHeader(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeRedirectURL(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeRedirectUrl(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeURL(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String encodeUrl(String arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void sendError(int arg0) throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void sendError(int arg0, String arg1) throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void sendRedirect(String arg0) throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setDateHeader(String arg0, long arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setIntHeader(String arg0, int arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setStatus(int arg0, String arg1)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public int getBufferSize()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public String getCharacterEncoding()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public Locale getLocale()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public boolean isCommitted()
+ {
+ return committed;
+ }
+
+ public void reset()
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void resetBuffer()
+ {
+ baos.reset();
+ }
+
+ public void setBufferSize(int arg0)
+ {
+ }
+
+ public void setContentLength(int arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+
+ public void setLocale(Locale arg0)
+ {
+ throw new UnsupportedOperationException("Not yet supported") ;
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletInputStream.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletInputStream.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletInputStream.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,50 @@
+/*
+ * 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.soa.esb.http.mock;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ */
+public class SOAPProcessorServletInputStream extends ServletInputStream
+{
+ private final InputStream is ;
+
+ SOAPProcessorServletInputStream(final InputStream is)
+ {
+ this.is = is ;
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ return is.read() ;
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletOutputStream.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletOutputStream.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/http/mock/SOAPProcessorServletOutputStream.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,51 @@
+/*
+ * 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.soa.esb.http.mock;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.ServletOutputStream;
+
+/**
+ * This is an adapter used when integrating with JBossWS.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+ */
+public class SOAPProcessorServletOutputStream extends ServletOutputStream
+{
+ private final OutputStream os ;
+
+ SOAPProcessorServletOutputStream(final OutputStream os)
+ {
+ this.os = os ;
+ }
+
+ @Override
+ public void write(final int byteVal)
+ throws IOException
+ {
+ os.write(byteVal) ;
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Inquiry.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Inquiry.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Inquiry.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,35 @@
+/*
+ * 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.soa.esb.registry.rmi;
+
+import java.rmi.Remote;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+* @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+*/
+public interface Inquiry extends Remote
+{
+ Node inquire (Element request) throws java.rmi.RemoteException;
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/InquiryService.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/InquiryService.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/InquiryService.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,134 @@
+/*
+ * 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.soa.esb.registry.rmi;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.xerces.parsers.DOMParser;
+import org.jboss.soa.esb.http.mock.SOAPProcessorHttpServletRequest;
+import org.jboss.soa.esb.http.mock.SOAPProcessorHttpServletResponse;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+* @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+*/
+public class InquiryService extends UnicastRemoteObject
+ implements Inquiry
+{
+ private static final String SOAP_OPEN_TAGS = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ + "<soap:Body>";
+
+ private static final String SOAP_CLOSE_TAGS = "</soap:Body>"
+ + "</soap:Envelope>";
+
+ private static final long serialVersionUID = 1L;
+
+ private RegistrationService rs = null;
+
+ public RegistrationService getsetRegistrationService() {
+ return rs;
+ }
+
+ public void setRegistrationService(RegistrationService rs) {
+ this.rs = rs;
+ }
+
+ public InquiryService() throws RemoteException {
+ super();
+ }
+
+ private String convertElementToSOAPRequest (Element request)
+ throws TransformerConfigurationException, TransformerException {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer trans = tf.newTransformer();
+ StringWriter sw = new StringWriter();
+ trans.transform(new DOMSource(request), new StreamResult(sw));
+ return new String(SOAP_OPEN_TAGS
+ + sw.toString()
+ + SOAP_CLOSE_TAGS);
+ }
+
+ private Node marshalResult(String result) throws SAXException, IOException {
+ DOMParser parser = new DOMParser();
+ InputStream is = new ByteArrayInputStream(result.getBytes());
+ parser.parse(new InputSource(is));
+
+ Document document = parser.getDocument();
+ Element docelement = document.getDocumentElement();
+
+ Node bodyNode = docelement.getFirstChild();
+
+ return bodyNode;
+ }
+
+ public Node inquire(Element request) throws RemoteException {
+ SOAPProcessorHttpServletRequest soaprequest = null;
+ SOAPProcessorHttpServletResponse soapresponse = null;
+
+ try {
+ String soaprequeststring = convertElementToSOAPRequest(request);
+
+ Map<String, List<String>> headers = new HashMap<String, List<String>>();
+
+ soaprequest = new SOAPProcessorHttpServletRequest("/",
+ soaprequeststring.getBytes(), headers);
+ soapresponse = new SOAPProcessorHttpServletResponse();
+ soaprequest.setAttribute("org.apache.catalina.core.DISPATCHER_TYPE", Integer.valueOf(2));
+
+ rs.getServletConfig().getServletContext().getRequestDispatcher("/uddi/inquiry").forward(soaprequest,soapresponse);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ Node node = null;
+ try {
+ String content = new String(soapresponse.getContent());
+ if ((content != null) && (!"".equals(content))) {
+ node = marshalResult(content);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException("", e.fillInStackTrace());
+ }
+ return node;
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/JNDIRegistration.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/JNDIRegistration.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/JNDIRegistration.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,85 @@
+/*
+ * 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.soa.esb.registry.rmi;
+
+import java.util.Properties;
+
+import javax.naming.InitialContext;
+
+/**
+ * @author Tom Cunningham (tcunning at redhat.com)
+ */
+public class JNDIRegistration
+{
+ public static final String DEFAULT_JAVA_NAMING_FACTORY_INITIAL = "org.jnp.interfaces.NamingContextFactory";
+ public static final String DEFAULT_JAVA_NAMING_PROVIDER_URL = "jnp://localhost:1099";
+ public static final String DEFAULT_JAVA_NAMING_FACTORY_URL_PKGS = "org.jboss.naming";
+
+ public static final String PROPNAME_JAVA_NAMING_FACTORY_INITIAL = "java.naming.factory.initial";
+ public static final String PROPNAME_JAVA_NAMING_PROVIDER_URL = "java.naming.provider.url";
+ public static final String PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
+
+ public static Inquiry inquiryReg = null;
+ public static Publish publishReg = null;
+
+ public static String INQUIRY_SERVICE="/InquiryService";
+ public static String PUBLISH_SERVICE="/PublishService";
+
+ public static void register(RegistrationService regService)
+ {
+ try {
+ String factoryInitial = System.getProperty(PROPNAME_JAVA_NAMING_FACTORY_INITIAL);
+ String providerURL = System.getProperty(PROPNAME_JAVA_NAMING_PROVIDER_URL);
+ String factoryURLPkgs = System.getProperty(PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS);
+
+ if (factoryInitial == null) {
+ factoryInitial = DEFAULT_JAVA_NAMING_FACTORY_INITIAL;
+ }
+ if (providerURL == null) {
+ providerURL = DEFAULT_JAVA_NAMING_PROVIDER_URL;
+ }
+
+ if (factoryURLPkgs == null) {
+ factoryURLPkgs = DEFAULT_JAVA_NAMING_FACTORY_URL_PKGS;
+ }
+
+ Properties env = new Properties();
+ env.setProperty(PROPNAME_JAVA_NAMING_FACTORY_INITIAL, factoryInitial);
+ env.setProperty(PROPNAME_JAVA_NAMING_PROVIDER_URL, providerURL);
+ env.setProperty(PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS, factoryURLPkgs);
+
+ InitialContext context = new InitialContext(env);
+ Inquiry inquiry = new InquiryService();
+
+ ((InquiryService)inquiry).setRegistrationService(regService);
+ inquiryReg = inquiry;
+ context.rebind(INQUIRY_SERVICE, inquiry);
+ Publish publish = new PublishService();
+ ((PublishService)publish).setRegistrationService(regService);
+
+ publishReg = publish;
+ context.rebind(PUBLISH_SERVICE, publish);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Publish.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Publish.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/Publish.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,14 @@
+package org.jboss.soa.esb.registry.rmi;
+
+import java.rmi.Remote;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+* @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+*/
+public interface Publish extends Remote
+{
+ Node publish (Element request) throws java.rmi.RemoteException;
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/PublishService.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/PublishService.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/PublishService.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,133 @@
+/*
+ * 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.soa.esb.registry.rmi;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.xerces.parsers.DOMParser;
+import org.jboss.soa.esb.http.mock.SOAPProcessorHttpServletRequest;
+import org.jboss.soa.esb.http.mock.SOAPProcessorHttpServletResponse;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+* @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
+*/
+public class PublishService extends UnicastRemoteObject
+ implements Publish
+{
+ private static final String SOAP_OPEN_TAGS = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ + "<soap:Body>";
+
+ private static final String SOAP_CLOSE_TAGS = "</soap:Body>"
+ + "</soap:Envelope>";
+
+ private static final long serialVersionUID = 1L;
+
+ private RegistrationService rs = null;
+
+ public RegistrationService getsetRegistrationService() {
+ return rs;
+ }
+
+ public void setRegistrationService(RegistrationService rs) {
+ this.rs = rs;
+ }
+
+ public PublishService() throws RemoteException {
+ super();
+ }
+
+ private String convertElementToSOAPRequest (Element request)
+ throws TransformerConfigurationException, TransformerException {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer trans = tf.newTransformer();
+ StringWriter sw = new StringWriter();
+ trans.transform(new DOMSource(request), new StreamResult(sw));
+ return new String(SOAP_OPEN_TAGS
+ + sw.toString()
+ + SOAP_CLOSE_TAGS);
+ }
+
+ private Node marshalResult(String result) throws SAXException, IOException {
+ DOMParser parser = new DOMParser();
+ InputStream is = new ByteArrayInputStream(result.getBytes());
+ parser.parse(new InputSource(is));
+
+ Document document = parser.getDocument();
+ Element docelement = document.getDocumentElement();
+ Node bodyNode = docelement.getFirstChild();
+
+ return bodyNode;
+ }
+
+ public Node publish(Element request) throws RemoteException {
+ SOAPProcessorHttpServletRequest soaprequest = null;
+ SOAPProcessorHttpServletResponse soapresponse = null;
+
+ try {
+ String soaprequeststring = convertElementToSOAPRequest(request);
+
+ Map<String, List<String>> headers = new HashMap<String, List<String>>();
+
+ soaprequest = new SOAPProcessorHttpServletRequest("/",
+ soaprequeststring.getBytes(), headers);
+ soapresponse = new SOAPProcessorHttpServletResponse();
+ soaprequest.setAttribute("org.apache.catalina.core.DISPATCHER_TYPE", Integer.valueOf(2));
+
+ rs.getServletConfig().getServletContext().getRequestDispatcher("/uddi/publishing").forward(soaprequest,soapresponse);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ Node node = null;
+ try {
+ String content = new String(soapresponse.getContent());
+ if ((content != null) && (!"".equals(content))) {
+ node = marshalResult(content);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RemoteException("", e.fillInStackTrace());
+ }
+ return node;
+ }
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RegistrationService.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RegistrationService.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RegistrationService.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,45 @@
+/*
+ * 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.soa.esb.registry.rmi;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+
+/**
+ * @author Tom Cunningham (tcunning at redhat.com)
+ */
+public class RegistrationService extends HttpServlet
+{
+ public static Inquiry mInquery=null;
+ public static Publish mPublish=null;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public void init() throws ServletException
+ {
+ super.init();
+ JNDIRegistration.register(this);
+ }
+
+}
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RemoteHttpServlet.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RemoteHttpServlet.java (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/src/main/java/org/jboss/soa/esb/registry/rmi/RemoteHttpServlet.java 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,148 @@
+package org.jboss.soa.esb.registry.rmi;
+
+// Copyright (C) 1998 by Jason Hunter <jhunter at acm.org>. All rights reserved.
+// Use of this class is limited. Please see the LICENSE for more information.
+
+import java.io.*;
+import java.net.*;
+import java.rmi.*;
+import java.rmi.server.*;
+import java.rmi.registry.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+
+/**
+ * A superclass for any HTTP servlet that wishes to act as an RMI server.
+ * RemoteHttpServlet begins listening for RMI calls in its
+ * <tt>init()</tt> method and stops listening in its <tt>destroy()</tt>
+ * method. To register itself it uses the registry on the local machine
+ * on the port determined by <tt>getRegistryPort()</tt>. It registers
+ * under the name determined by <tt>getRegistryName()</tt>.
+ *
+ * @see com.oreilly.servlet.RemoteDaemonHttpServlet
+ *
+ * @author <b>Jason Hunter</b>, Copyright © 1998
+ * @version 1.0, 98/09/18
+ */
+public abstract class RemoteHttpServlet extends HttpServlet
+ implements Remote {
+ /**
+ * The registry for the servlet
+ */
+ protected Registry registry;
+
+ /**
+ * Begins the servlet's RMI operations. Causes the servlet to export
+ * itself and then bind itself to the registry. Logs any errors.
+ * Subclasses that override this method must be sure to first call
+ * <tt>super.init(config)</tt>.
+ *
+ * @param config the servlet config
+ * @exception ServletException if a servlet exception occurs
+ */
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ try {
+ UnicastRemoteObject.exportObject(this);
+ bind();
+ }
+ catch (RemoteException e) {
+ log("Problem binding to RMI registry: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Halts the servlet's RMI operations. Causes the servlet to
+ * unbind itself from the registry. Logs any errors. Subclasses that
+ * override this method must be sure to first call <tt>super.destroy()</tt>.
+ */
+ public void destroy() {
+ unbind();
+ }
+
+ /**
+ * Returns the name under which the servlet should be bound in the
+ * registry. By default the name is the servlet's class name. This
+ * can be overridden with the <tt>registryName</tt> init parameter.
+ *
+ * @return the name under which the servlet should be bound in the registry
+ */
+ protected String getRegistryName() {
+ // First name choice is the "registryName" init parameter
+ String name = getInitParameter("registryName");
+ if (name != null) return name;
+
+ // Fallback choice is the name of this class
+ return this.getClass().getName();
+ }
+
+ /**
+ * Returns the port where the registry should be running. By default
+ * the port is the default registry port (1099). This can be
+ * overridden with the <tt>registryPort</tt> init parameter.
+ *
+ * @return the port for the registry
+ */
+ protected int getRegistryPort() {
+ // First port choice is the "registryPort" init parameter
+ try { return Integer.parseInt(getInitParameter("registryPort")); }
+
+ // Fallback choice is the default registry port (1099)
+ catch (NumberFormatException e) { return Registry.REGISTRY_PORT; }
+ }
+
+ /**
+ * Binds the servlet to the registry. Creates the registry if necessary.
+ * Logs any errors.
+ */
+ protected void bind() {
+ // Try to find the appropriate registry already running
+ try {
+ registry = LocateRegistry.getRegistry(getRegistryPort());
+ registry.list(); // Verify it's alive and well
+ }
+ catch (Exception e) {
+ // Couldn't get a valid registry
+ registry = null;
+ }
+
+ // If we couldn't find it, we need to create it.
+ // (Equivalent to running "rmiregistry")
+ if (registry == null) {
+ try {
+ registry = LocateRegistry.createRegistry(getRegistryPort());
+ }
+ catch (Exception e) {
+ log("Could not get or create RMI registry on port " +
+ getRegistryPort() + ": " + e.getMessage());
+ return;
+ }
+ }
+
+ // If we get here, we must have a valid registry.
+ // Now register this servlet instance with that registry.
+ try {
+ registry.rebind(getRegistryName(), this);
+ }
+ catch (Exception e) {
+ log("Could not bind to RMI registry: " + e.getMessage());
+ return;
+ }
+ }
+
+ /**
+ * Unbinds the servlet from the registry.
+ * Logs any errors.
+ */
+ protected void unbind() {
+ try {
+ if (registry != null) registry.unbind(getRegistryName());
+ }
+ catch (Exception e) {
+ log("Problem unbinding from RMI registry: " + e.getMessage());
+ }
+ }
+}
+
Added: labs/jbossesb/workspace/systinet/product/tools/systinet/systinet.properties
===================================================================
--- labs/jbossesb/workspace/systinet/product/tools/systinet/systinet.properties (rev 0)
+++ labs/jbossesb/workspace/systinet/product/tools/systinet/systinet.properties 2009-06-27 00:43:57 UTC (rev 27169)
@@ -0,0 +1,2 @@
+systinet.reg.dir=/opt/hp/registry
+jboss.home.dir=/home/tcunning/jboss-4.2.2.GA
More information about the jboss-svn-commits
mailing list