Author: wire
Date: Thu Jun 16 07:48:41 2005
New Revision: 190928

URL: http://svn.apache.org/viewcvs?rev=190928&view=rev
Log:
New

Added:
    
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/HttpHeader.java
    
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/CommandListener.java
    
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WsImplTest.java

Added: 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/HttpHeader.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/HttpHeader.java?rev=190928&view=auto
==============================================================================
--- 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/HttpHeader.java
 (added)
+++ 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/HttpHeader.java
 Thu Jun 16 07:48:41 2005
@@ -0,0 +1,132 @@
+package org.apache.interop.smgr;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * HttpHeader
+ *
+ * This class is used to parse a String containing the Http Headers pulled 
from a Socket.
+ *
+ * <p/>
+ * User: SACAM
+ * Date: Jun 13, 2005
+ */
+public class HttpHeader
+{
+    /**
+     * Internal Map to hold the parsed headers
+     */
+    private Map m_headers = new HashMap();
+
+    /**
+     * Header Constants to be used as a reference for header lookups
+     */
+    public static final String ACCEPT = "Accept";
+    public static final String ACCEPT_CHARSET = "Accept-Charset";
+    public static final String ACCEPT_ENCODING = "Accept-Encoding";
+    public static final String ACCEPT_LANGUAGE = "Accept-Language";
+    public static final String AUTHORIZATION = "Authorization";
+    public static final String CACHE_CONTROL = "Cache-Control";
+    public static final String CONNECTION = "Connection";
+    public static final String CONTENT_LENGTH = "Content-Length";
+    public static final String DATE = "Date";
+    public static final String EXPECT = "Expect";
+    public static final String FROM = "From";
+    public static final String HOST = "Host";
+    public static final String IF_MATCH = "If-Match";
+    public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
+    public static final String IF_NONE_MATCH = "If-None-Match";
+    public static final String IF_RANGE = "If-Range";
+    public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
+    public static final String MAX_FORWARDS = "Max-Forwards";
+    public static final String PRAGMA = "Pragma";
+    public static final String PROXY_AUTHORIZATION = "Proxy-Authorization";
+    public static final String RANGE = "Range";
+    public static final String REFERER = "Referer";
+    public static final String TE = "TE";
+    public static final String TRAILER = "Trailer";
+    public static final String TRANSFER_ENCODING = "Transfer-Encoding";
+    public static final String UPGRADE = "Upgrade";
+    public static final String USER_AGENT = "User-Agent";
+    public static final String VIA = "Via";
+    public static final String WARNING = "Warning";
+
+
+    public HttpHeader(String headersString)
+    {
+        parseHeaders(headersString);
+    }
+
+    /**
+     * This method tokenizes and parses the incoming header String
+     *
+     * @param headersString
+     */
+    private void parseHeaders(String headersString)
+    {
+        //System.out.println("Entered headers: " + headersString);
+        //parse the header string into a map
+
+        String[] strings = headersString.split("\n");
+        for (int i = 0; i < strings.length; i++)
+        {
+            String header = strings[i];
+            String[] values = header.split(": ");
+            m_headers.put(values[0].trim(), values[1].trim());
+        }
+
+        //System.out.println("Parsed Headers: " +toString());//debug only
+    }
+
+    /**
+     * Returns the header given a header name.
+     *
+     * @param headerName The name of the header to be retrieved.
+     * @return The header value
+     */
+    public String getHeader(String headerName)
+    {
+        if (m_headers.containsKey(headerName))
+        {
+            return (String) m_headers.get(headerName);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    /**
+     * Overrideen toString() to dump the parsed headers.
+     *
+     * @return The parsed headers.
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        Iterator iterator = m_headers.keySet().iterator();
+        while (iterator.hasNext())
+        {
+            String key = (String) iterator.next();
+            sb.append(key + " : " + m_headers.get(key));
+        }
+        return sb.toString();
+    }
+    public static void main(String[] args)
+    {
+        HttpHeader header = new HttpHeader("Content-Type: text/xml; 
charset=utf-8\n" +
+                " Accept: application/soap+xml, application/dime, 
multipart/related, text/*\n" +
+                " User-Agent: Axis/1.2\n" +
+                " Host: 192.168.2.120:8001\n" +
+                " Cache-Control: no-cache\n" +
+                " Pragma: no-cache\n" +
+                " SOAPAction: \"\"\n" +
+                " Content-Length: 2950\n");
+        String content_length = header.getHeader(HttpHeader.CONTENT_LENGTH);
+        int i = Integer.parseInt(content_length);
+        //System.out.println(content_length);
+    }
+}

Added: 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/CommandListener.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/CommandListener.java?rev=190928&view=auto
==============================================================================
--- 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/CommandListener.java
 (added)
+++ 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/CommandListener.java
 Thu Jun 16 07:48:41 2005
@@ -0,0 +1,18 @@
+/*
+ * Created on Jun 10, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.wcmgr;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface CommandListener {
+       public void recalibrate(String stationName);
+
+}

Added: 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WsImplTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WsImplTest.java?rev=190928&view=auto
==============================================================================
--- 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WsImplTest.java
 (added)
+++ 
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WsImplTest.java
 Thu Jun 16 07:48:41 2005
@@ -0,0 +1,41 @@
+/*
+ * Created on Jun 13, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.wsdm.interop.wcm.impl;
+
+import java.util.Observer;
+
+import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.impl.RelationshipTypeImpl;
+
+import junit.framework.TestCase;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class WsImplTest extends TestCase {
+
+       /*
+        * @see TestCase#setUp()
+        */
+       protected void setUp() throws Exception {
+               super.setUp();
+       }
+
+       /*
+        * @see TestCase#tearDown()
+        */
+       protected void tearDown() throws Exception {
+               super.tearDown();
+       }
+       
+       public void testGetPrice(){
+               
+       }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to