You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by wi...@apache.org on 2005/06/09 17:03:21 UTC
svn commit: r189764 [1/3] - in /incubator/muse/trunk/src/ieeedemo/client: ./
lib/ lib/src/ src/ src/org/ src/org/apache/ src/org/apache/interop/
src/org/apache/interop/smgr/ src/org/apache/interop/wcdisplay/
src/org/apache/interop/wcmgr/ src/org/apache/ws/ src/org/apache/ws/muws/
src/org/apache/ws/muws/interop/ src/org/apache/ws/muws/interop/client/
src/org/apache/wsdm/ src/org/apache/wsdm/interop/
src/org/apache/wsdm/interop/wcm/ src/org/apache/wsdm/interop/wcm/impl/
src/org/apache/wsdm/interop/wcm/impl/ui/
src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/
src/org/apache/wsdm/interop/wcm/model/
src/org/apache/wsdm/interop/wcm/simulator/
Author: wire
Date: Thu Jun 9 08:03:19 2005
New Revision: 189764
URL: http://svn.apache.org/viewcvs?rev=189764&view=rev
Log: (empty)
Added:
incubator/muse/trunk/src/ieeedemo/client/.classpath
incubator/muse/trunk/src/ieeedemo/client/.cvsignore
incubator/muse/trunk/src/ieeedemo/client/.project
incubator/muse/trunk/src/ieeedemo/client/lib/
incubator/muse/trunk/src/ieeedemo/client/lib/gnujaxp.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/jcommon-1.0.0-pre2.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/jfreechart-1.0.0-pre2.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/jgraph.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/src/
incubator/muse/trunk/src/ieeedemo/client/lib/src/jgraph-5.5.1-lgpl-src.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/weather-client-config-xbeans.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-dir-xbeans.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-xbeans.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/src/
incubator/muse/trunk/src/ieeedemo/client/src/org/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BackberryJPanel.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/ConnectionListener.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageListener.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageWorker.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/NotificationListener.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/PortListen.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/SubsciberInfoJPanel.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/TestSubscribe.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/blackberry.gif (with props)
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/DisplayAppConnection.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJFrame.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/WcDisplayApp.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-ani.gif (with props)
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-still.gif (with props)
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/AbstractWsdmInteropTestCase.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/FaultException.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/ResourceStub.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/ServiceStub.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/SpecificServiceStub.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/TestWcConfigAccess.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/WcmMessage.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WcImpl.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WcmImpl.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/WsImpl.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/MessagesJPanel.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/StatusJPanel.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/TemperatureJPanel.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/WcJFrame.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/CustomCellViewFactory.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcGraphCell.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcView.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsGraphCell.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsView.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWc.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWcm.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWs.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/WcmFactory.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulator.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulatorTest.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/MessageSimulator.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/StatusSimulator.java
incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/TemperatureSimulator.java
incubator/muse/trunk/src/ieeedemo/client/wcclient.jar (with props)
incubator/muse/trunk/src/ieeedemo/client/wcclient.jardesc
Added: incubator/muse/trunk/src/ieeedemo/client/.classpath
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/.classpath?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/.classpath (added)
+++ incubator/muse/trunk/src/ieeedemo/client/.classpath Thu Jun 9 08:03:19 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/gnujaxp.jar"/>
+ <classpathentry kind="lib" path="lib/jcommon-1.0.0-pre2.jar"/>
+ <classpathentry kind="lib" path="lib/jfreechart-1.0.0-pre2.jar"/>
+ <classpathentry sourcepath="lib/src/jgraph-5.5.1-lgpl-src.jar" kind="lib" path="lib/jgraph.jar"/>
+ <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
+ <classpathentry kind="lib" path="lib/weather-client-config-xbeans.jar"/>
+ <classpathentry kind="lib" path="lib/weather-station-dir-xbeans.jar"/>
+ <classpathentry kind="lib" path="lib/weather-station-xbeans.jar"/>
+ <classpathentry kind="src" path="/muse"/>
+ <classpathentry kind="src" path="/apollo"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: incubator/muse/trunk/src/ieeedemo/client/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/.cvsignore?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/.cvsignore (added)
+++ incubator/muse/trunk/src/ieeedemo/client/.cvsignore Thu Jun 9 08:03:19 2005
@@ -0,0 +1 @@
+bin
Added: incubator/muse/trunk/src/ieeedemo/client/.project
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/.project?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/.project (added)
+++ incubator/muse/trunk/src/ieeedemo/client/.project Thu Jun 9 08:03:19 2005
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>wcm</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: incubator/muse/trunk/src/ieeedemo/client/lib/gnujaxp.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/gnujaxp.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/gnujaxp.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/jcommon-1.0.0-pre2.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/jcommon-1.0.0-pre2.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/jcommon-1.0.0-pre2.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/jfreechart-1.0.0-pre2.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/jfreechart-1.0.0-pre2.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/jfreechart-1.0.0-pre2.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/jgraph.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/jgraph.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/jgraph.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/src/jgraph-5.5.1-lgpl-src.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/src/jgraph-5.5.1-lgpl-src.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/src/jgraph-5.5.1-lgpl-src.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/weather-client-config-xbeans.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/weather-client-config-xbeans.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/weather-client-config-xbeans.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-dir-xbeans.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-dir-xbeans.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-dir-xbeans.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-xbeans.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-xbeans.jar?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/lib/weather-station-xbeans.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BackberryJPanel.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BackberryJPanel.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BackberryJPanel.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BackberryJPanel.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,136 @@
+package org.apache.interop.smgr;
+
+import javax.swing.JPanel;
+import javax.swing.JFrame;
+import javax.swing.Timer;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+
+
+/**
+* This code was generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* *************************************
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
+* for this machine, so Jigloo or this code cannot be used legally
+* for any corporate or commercial purpose.
+* *************************************
+*/
+import javax.swing.JLabel;
+import javax.swing.ImageIcon;
+import java.awt.BorderLayout;
+import javax.swing.SwingConstants;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+public class BackberryJPanel extends javax.swing.JPanel {
+ private JLabel jLabelBlackberry;
+ private Color color=Color.WHITE;
+ private float alpha=0.0f;
+ private Timer m_fadeTimer;
+
+ /**
+ * Auto-generated main method to display this
+ * JPanel inside a new JFrame.
+ */
+ public static void main(String[] args) {
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(new BackberryJPanel());
+ frame.pack();
+ frame.show();
+
+ }
+
+ public BackberryJPanel() {
+ super();
+ initGUI();
+
+ }
+
+ private void initGUI() {
+ try {
+ this.setPreferredSize(new java.awt.Dimension(400, 300));
+ this.setAutoscrolls(true);
+ BorderLayout thisLayout = new BorderLayout();
+ this.setLayout(thisLayout);
+ this.setBackground(new java.awt.Color(255,255,255));
+ {
+ jLabelBlackberry = new JLabel();
+ this.add(jLabelBlackberry, BorderLayout.CENTER);
+ jLabelBlackberry.setIcon(new ImageIcon(getClass().getClassLoader().getResource("org/apache/interop/smgr/blackberry.gif")));
+ jLabelBlackberry.setHorizontalAlignment(SwingConstants.CENTER);
+ jLabelBlackberry.addMouseListener(new MouseAdapter() {
+ public void mouseClicked(MouseEvent evt) {
+ System.out
+ .println("jLabelBlackberry.mouseClicked, event="
+ + evt);
+ //TODO add your code for jLabelBlackberry.mouseClicked
+ setColor(Color.BLUE,0.3f);
+ }
+ });
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ public void paint(Graphics g1) {
+
+
+ // Paint White Background
+ super.paint(g1);
+ Graphics2D g=(Graphics2D)g1;
+ Color c = color; // Opaque red; alpha = 1.0
+ g.setPaint(c); // Use this opaque color
+
+// Get and install an AlphaComposite to do transparent drawing
+ g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));//SRC_OVER
+
+ g.fillRect(0,0,getSize().width,getSize().height); // Start drawing with it
+
+ }
+ public void setColor(Color color,float alpha){
+ this.color=color;
+ this.alpha=alpha;
+ invalidate();
+ updateUI();
+ }
+
+ public void startTimer(){
+ m_fadeTimer=new Timer(200, new ActionListener(){
+ float fadeValue=0f;
+ boolean direction=true;
+ public void actionPerformed(ActionEvent e) {
+ setColor(color,fadeValue);
+ updateUI();
+ if(direction){
+ fadeValue+=.1;
+ } else {
+ fadeValue-=.1;
+ }
+ if(fadeValue<.1f||fadeValue>0.5f){
+ direction=!direction;
+ }
+ //System.out.println(fadeValue);
+ }});
+ m_fadeTimer.start();
+ }
+
+ public void stopTimer(){
+ m_fadeTimer.stop();
+ m_fadeTimer=null;
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,213 @@
+package org.apache.interop.smgr;
+
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+
+
+import org.apache.interop.smgr.SubsciberInfoJPanel;
+import org.apache.interop.smgr.BackberryJPanel;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
+import org.apache.ws.muws.interop.client.FaultException;
+import org.apache.ws.muws.interop.client.ResourceStub;
+import org.apache.ws.muws.interop.client.ServiceStub;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.soap.Envelope;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.impl.ManagementEventTypeImpl;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.ResourcePropertyValueChangeNotificationType.NewValue;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.ResourcePropertyValueChangeNotificationTypeImpl;
+import org.xmlsoap.schemas.soap.envelope.Body;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.BorderLayout;
+import java.io.IOException;
+
+import javax.swing.JSplitPane;
+import javax.xml.namespace.QName;
+/**
+* This code was generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* *************************************
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
+* for this machine, so Jigloo or this code cannot be used legally
+* for any corporate or commercial purpose.
+* *************************************
+*/
+public class BlackBerryApp extends javax.swing.JFrame implements ConnectionListener,MessageListener {
+ private SubsciberInfoJPanel subsciberInfoJPanel;
+ private JSplitPane jSplitPaneParts;
+ private BackberryJPanel backberryJPanel;
+ private NotificationListener m_listener;
+ private ResourceStub m_resource;
+ private StringBuffer m_buffer=new StringBuffer();
+ private MessageWorker m_messageWorker;
+
+
+ /**
+ * Auto-generated main method to display this JFrame
+ */
+ public static void main(String[] args) {
+ BlackBerryApp inst = new BlackBerryApp();
+ inst.setVisible(true);
+ }
+
+ public BlackBerryApp() {
+ super();
+ initGUI();
+ subsciberInfoJPanel.setConnectionListener(this);
+ }
+
+ private void initGUI() {
+ try {
+ setSize(400, 350);
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ {
+ jSplitPaneParts = new JSplitPane();
+ this.getContentPane().add(jSplitPaneParts, BorderLayout.CENTER);
+ jSplitPaneParts.setOrientation(JSplitPane.VERTICAL_SPLIT);
+ jSplitPaneParts.setDividerLocation(110);
+ jSplitPaneParts.setPreferredSize(new java.awt.Dimension(392, 319));
+ {
+ subsciberInfoJPanel = new SubsciberInfoJPanel();
+ jSplitPaneParts.add(subsciberInfoJPanel, JSplitPane.LEFT);
+ FlowLayout subsciberInfoJPanelLayout = new FlowLayout();
+ subsciberInfoJPanel.setLayout(subsciberInfoJPanelLayout);
+ }
+ {
+ backberryJPanel = new BackberryJPanel();
+ jSplitPaneParts.add(backberryJPanel, JSplitPane.RIGHT);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.interop.smgr.ConnectionListener#onConnect()
+ */
+ public void onConnect() {
+ try {
+ startListener();
+ // Subscribe
+ m_resource = new ResourceStub( getEpr(subsciberInfoJPanel.getResourceUrl(),null) );
+ EndpointReference response = m_resource.subscribe(subsciberInfoJPanel.getNotificationLister(),new QName(subsciberInfoJPanel.getTopicNamespace(),subsciberInfoJPanel.getTopicName()));
+
+
+ } catch (XmlException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (FaultException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ backberryJPanel.startTimer();
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.interop.smgr.ConnectionListener#onDisconnect()
+ */
+ public void onDisconnect() {
+ backberryJPanel.stopTimer();
+ backberryJPanel.setColor(Color.WHITE,0f);
+ m_resource = null;
+ m_messageWorker.stop();
+ m_listener.stop();
+
+ }
+
+ private EndpointReference getEpr(String URL, String Rid) throws XmlException{
+ XmlBeansEndpointReference x=new XmlBeansEndpointReference(URL,AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+ if(Rid!=null)
+ x.setReferenceProperties(new XmlObject[]{(XmlObject)XmlObject.Factory.parse("<svr:ResourceIdentifier xmlns:svr=\"http://wsdmdemo.org/service/weather-client-config\">"+Rid+"</svr:ResourceIdentifier>")});
+ return x;
+ }
+
+ public void startListener() throws IOException{
+ m_messageWorker=new MessageWorker(this,m_buffer);
+ m_listener=new NotificationListener(8000,600000,m_buffer);
+ m_messageWorker.start();
+ m_listener.start();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.interop.smgr.MessageListener#onMessage(java.lang.String)
+ */
+ public void onMessage(String messageText) {
+ // TODO Auto-generated method stub
+ System.err.println(messageText);
+ final String colorName=getColorFromMessage(messageText);
+
+ SwingUtilities.invokeLater(new Runnable(){
+
+ public void run() {
+ backberryJPanel.setColor(colorName2Color(colorName),0.5f);
+ }});
+
+ }
+ /**
+ * @param messageText
+ * @return
+ */
+ private String getColorFromMessage(String messageText) {
+ try {
+ EnvelopeDocument ed=(org.xmlsoap.schemas.soap.envelope.EnvelopeDocument)XmlObject.Factory.parse(messageText);
+ org.xmlsoap.schemas.soap.envelope.Envelope env = ed.getEnvelope();
+ Body body = env.getBody();
+ XmlObject[] arryStuff = XmlBeanUtils.getChildElements(body);
+ if(arryStuff.length==0)
+ return "Black";
+ NotifyDocument.Notify ele = (NotifyDocument.Notify) arryStuff[0];
+ NotificationMessageHolderType noteMess = ele.getNotificationMessageArray(0);
+ XmlAnyTypeImpl mess = (XmlAnyTypeImpl)noteMess.getMessage();
+ ManagementEventTypeImpl manEvt = (ManagementEventTypeImpl)XmlBeanUtils.getChildElements(mess)[0];
+ //manEvt.get
+ ResourcePropertyValueChangeNotificationTypeImpl propChngEvt = (ResourcePropertyValueChangeNotificationTypeImpl)XmlBeanUtils.getChildElements(manEvt)[0];
+ NewValue newValue = propChngEvt.getNewValue();
+// XmlObject complience = (XmlObject)XmlBeanUtils.getChildElements(newValue)[0];
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return "Black";
+ }
+
+ private Color colorName2Color(String colorName){
+ if(colorName.toLowerCase().equals("yellow")){
+ return Color.YELLOW;
+ }
+ if(colorName.toLowerCase().equals("green")){
+ return Color.GREEN;
+ }
+ if(colorName.toLowerCase().equals("red")){
+ return Color.RED;
+ }
+ if(colorName.toLowerCase().equals("blue")){
+ return Color.BLUE;
+ }
+ return Color.BLACK;
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/ConnectionListener.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/ConnectionListener.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/ConnectionListener.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/ConnectionListener.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,18 @@
+/*
+ * Created on Jun 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.smgr;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface ConnectionListener {
+ public void onConnect();
+ public void onDisconnect();
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageListener.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageListener.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageListener.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageListener.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,17 @@
+/*
+ * Created on Jun 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.smgr;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface MessageListener {
+ public void onMessage(String messageText);
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageWorker.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageWorker.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageWorker.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/MessageWorker.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,70 @@
+/*
+ * Created on Jun 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.smgr;
+
+import java.io.IOException;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class MessageWorker implements Runnable {
+
+ private MessageListener listener;
+ private StringBuffer messageBuffer;
+ private Thread worker;
+ /**
+ *
+ */
+ public MessageWorker(MessageListener listener,StringBuffer messageBuffer) {
+ super();
+ this.listener=listener;
+ this.messageBuffer=messageBuffer;
+ }
+
+ public void stop(){
+ worker.interrupt();
+
+ }
+
+ public void start() throws IOException{
+ // start listening and then return when the thread has officially gone live
+ // and the socket is ready to be accepted
+ worker = new Thread(this,"MessageWorker");
+
+// synchronized ( listenerStarted )
+// {
+ worker.start();
+// }
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ while(true){
+ try {
+ synchronized(messageBuffer){
+ messageBuffer.wait();
+ }
+ // I am now full
+ listener.onMessage(messageBuffer.toString());
+ messageBuffer.setLength(0);
+ } catch (InterruptedException e) {
+
+ e.printStackTrace();
+ return;
+ }
+ }
+
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/NotificationListener.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/NotificationListener.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/NotificationListener.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/NotificationListener.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,251 @@
+/*
+ * Created on Jun 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.smgr;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class NotificationListener implements Runnable {
+ private static final String HTTP_SERVER_NAME = "WS-NotificationConsumer/1.0";
+ private static final String HTTP_VERSION = "1.0";
+ private static final String HTTP_STATUS = "202 Accepted";
+ private ServerSocket server ;
+ int port;
+ int timeout;
+ final Object listenerStarted = new Object();
+ private static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat(
+ "EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US );
+ StringBuffer retIncomingMessage;
+ static
+ {
+ HTTP_DATE_FORMAT.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
+ }
+
+ /**
+ * the buffer to store the incoming message
+ */
+ private StringBuffer m_incomingMessage;
+ private Thread listener;
+ private BufferedReader bufIn;
+ private BufferedOutputStream bufOut;
+ public Object getMessageSemaphore(){
+ return listenerStarted;
+ }
+
+ /**
+ *
+ */
+ public NotificationListener(int port,int timeout,StringBuffer retIncomingMessage) {
+ super();
+ this.port=port;
+ this.timeout=timeout;
+ this.retIncomingMessage=retIncomingMessage;
+ }
+
+ public void stop(){
+ listener.interrupt();
+ if ( server != null )
+ {
+ try
+ {
+ if(bufIn!=null)
+ bufIn.close();
+ bufOut.close();
+ if(server!=null)
+ server.close();
+ }
+ catch ( IOException ignored )
+ {
+ }
+ }
+
+ }
+
+ public void start() throws IOException{
+ // start listening and then return when the thread has officially gone live
+ // and the socket is ready to be accepted
+ listener = new Thread(this,"Notification Listener");
+
+ synchronized ( listenerStarted )
+ {
+ listener.start();
+
+// try
+// {
+// listenerStarted.wait();
+// }
+// catch ( InterruptedException ignored )
+// {
+// }
+ //return controll to the caller
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+
+ server = null;
+ Socket sock=null;
+ bufIn = null;
+ bufOut = null;
+ byte[] responseBytes=null;
+ try {
+ server = new ServerSocket( port );
+ server.setSoTimeout( timeout );
+
+ // let the outer method know that we have started and just about to block on the accept
+ synchronized ( listenerStarted )
+ {
+ listenerStarted.notify();
+ }
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return;
+ }
+
+ while(true){
+
+ try
+ {
+ sock = server.accept();
+ sock.setSoTimeout( 300 );
+ bufIn = new BufferedReader(
+ new InputStreamReader( sock.getInputStream() ) );
+ bufOut = new BufferedOutputStream( sock.getOutputStream() );
+
+ responseBytes = buildResponse().toString().getBytes();
+ try
+ {
+
+ synchronized ( retIncomingMessage )
+ {
+ while ( !bufIn.readLine().equals( "" ) ) // skip empty lines
+ {
+ }
+ char[] buffer = new char[10240];
+ int length = -1;
+ while ( ( length = bufIn.read( buffer, 0, buffer.length ) ) != -1 )
+ {
+ retIncomingMessage.append( buffer, 0, length );
+ }
+ }
+ }
+ catch ( InterruptedIOException ignored )
+ {
+ }
+
+ bufOut.write( responseBytes, 0, responseBytes.length );
+ bufOut.flush();
+ bufIn.close();
+ bufOut.close();
+ }
+ catch ( InterruptedIOException ignored )
+ {
+ ignored.printStackTrace();
+ }
+ catch ( Throwable t )
+ {
+ synchronized ( retIncomingMessage )
+ {
+ retIncomingMessage.delete( 0,
+ retIncomingMessage.length() );
+ retIncomingMessage.append( "ERROR: " );
+ retIncomingMessage.append( t );
+ }
+ }
+ finally
+ {
+ synchronized ( retIncomingMessage )
+ {
+ // make sure something goes in the message, even if nothing was received
+ if ( retIncomingMessage.length() == 0 )
+ {
+ retIncomingMessage.append( "ERROR: incoming message was empty" );
+ }
+
+ retIncomingMessage.notify();
+ }
+
+ // if ( server != null )
+ // {
+ // try
+ // {
+ // server.close();
+ // }
+ // catch ( IOException ignored )
+ // {
+ // }
+ // }
+
+ // do this as a fail safe
+ synchronized ( listenerStarted )
+ {
+ listenerStarted.notify();
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Build a one-way HTTP response message that complies to the WS-I Basic Profile 1.0, section 5.6.10
+ * - see http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16651160
+ *
+ * @return a WS-I-compliant Notify response message
+ */
+ private String buildResponse()
+ {
+ Date timeNow = new Date();
+ Date sameTimeTomorrow = new Date( timeNow.getTime() + ( 24 * 60 * 60 * 1000 ) );
+ StringBuffer responseBuf = new StringBuffer( "HTTP/" );
+ responseBuf.append( HTTP_VERSION );
+ responseBuf.append( " " );
+ responseBuf.append( HTTP_STATUS );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Date: " );
+ responseBuf.append( HTTP_DATE_FORMAT.format( timeNow ) );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Server: " );
+ responseBuf.append( HTTP_SERVER_NAME );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Cache-Control: " );
+ responseBuf.append( "max-age=86400" );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Expires: " );
+ responseBuf.append( HTTP_DATE_FORMAT.format( sameTimeTomorrow ) );
+ responseBuf.append( "\r\n" );
+
+ return responseBuf.toString();
+ }
+
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/PortListen.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/PortListen.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/PortListen.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/PortListen.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,292 @@
+package org.apache.interop.smgr;
+
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * Single-message HTTP listener. When this object is instantiated, it will spawn
+ * a thread and listen for a message on the specified port. Call
+ * {@link #waitForIncomingMessage()} to block, waiting for the message.
+ *
+ * @author mazz
+ * @author ips
+ */
+public class PortListen
+{
+
+ private static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat(
+ "EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US );
+
+ static
+ {
+ HTTP_DATE_FORMAT.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
+ }
+
+ /**
+ * the buffer to store the incoming message
+ */
+ private StringBuffer m_incomingMessage;
+
+ /**
+ * Instantiates the object and immediately begins listening for a message.
+ *
+ * @param port the port to listen to; a value of <code>0</code> creates a socket on any free port
+ * @param timeout the time (in milliseconds) the socket accept() will wait for an incoming connection;
+ * a value of <code>0</code> indicates accept() should wait infinitely
+ */
+ public PortListen( int port,
+ int timeout )
+ {
+ m_incomingMessage = new StringBuffer();
+ // spawn the thread
+ getIncomingMessage( port, timeout, m_incomingMessage );
+ }
+
+ /**
+ * Waits for the incoming message.
+ * <p/>
+ * This method will block waiting for the incoming message to come in or for an error to occur.
+ *
+ * @return the incoming message as a string
+ */
+ public String waitForIncomingMessage()
+ {
+ synchronized ( m_incomingMessage )
+ {
+ while ( m_incomingMessage.length() == 0 )
+ {
+ try
+ {
+ m_incomingMessage.wait( 1000 );
+ }
+ catch ( InterruptedException ignored )
+ {
+ }
+ }
+ }
+
+ return m_incomingMessage.toString();
+ }
+
+ /**
+ * Listens for an incoming TCP/IP message. When an incoming message is received, it is stored in the
+ * <code>retIncomingMessage</code> string buffer and <code>notify</code> on that string buffer will be called to let
+ * the caller know that it is ready.
+ * <p/>
+ * The incoming message string buffer must be non-<code>null</code> and must be empty.
+ * <p/>
+ * If an error occurs, the string buffer will be filled with the string "ERROR:" followed by the exception message.
+ * Even on an error, <code>notify</code> will be called to let the caller know that something happened.
+ * <p/>
+ * Note that this method does not block - it spawns a thread to perform the listening and returns immediately.
+ * <p/>
+ * This will return an HTTP server-like response back to the client.
+ *
+ * @param port the port to listen to
+ * @param timeout the time (in milliseconds) the socket accept() will wait for an incoming connection
+ * @param retIncomingMessage the incoming message to be returned to the caller - this buffer will be filled in and
+ * <code>notify</code> will be called on it to let the caller know that it is ready
+ *
+ * @throws IllegalArgumentException if the given buffer was <code>null</code> or not empty
+ */
+ protected void getIncomingMessage( final int port,
+ final int timeout,
+ final StringBuffer retIncomingMessage )
+ throws IllegalArgumentException
+ {
+ if ( retIncomingMessage == null || retIncomingMessage.length() > 0 )
+ {
+ throw new IllegalArgumentException( "Must provide a non-null string buffer that is empty" );
+ }
+
+ // use as a monitor lock to determine when the thread has started
+ // this must be final to allow for the inner Runnable class to access it
+ final Object listenerStarted = new Object();
+
+ Thread listener =
+ new Thread( new Runnable()
+ {
+ private static final String HTTP_SERVER_NAME = "WS-NotificationConsumer/1.0";
+ private static final String HTTP_VERSION = "1.0";
+ private static final String HTTP_STATUS = "202 Accepted";
+
+ public void run()
+ {
+ ServerSocket server = null;
+
+ try
+ {
+ server = new ServerSocket( port );
+ server.setSoTimeout( timeout );
+
+ // let the outer method know that we have started and just about to block on the accept
+ synchronized ( listenerStarted )
+ {
+ listenerStarted.notify();
+ }
+
+ Socket sock = server.accept();
+ sock.setSoTimeout( 500 );
+ BufferedReader bufIn = new BufferedReader(
+ new InputStreamReader( sock.getInputStream() ) );
+ BufferedOutputStream bufOut = new BufferedOutputStream( sock.getOutputStream() );
+
+ byte[] responseBytes = buildResponse().toString().getBytes();
+
+ try
+ {
+ synchronized ( retIncomingMessage )
+ {
+ while ( !bufIn.readLine().equals( "" ) ) // skip empty lines
+ {
+ }
+ char[] buffer = new char[10240];
+ int length = -1;
+ while ( ( length = bufIn.read( buffer, 0, buffer.length ) ) != -1 )
+ {
+ retIncomingMessage.append( buffer, 0, length );
+ }
+ }
+ }
+ catch ( InterruptedIOException ignored )
+ {
+ }
+ bufOut.write( responseBytes, 0, responseBytes.length );
+ bufOut.flush();
+ bufIn.close();
+ bufOut.close();
+ }
+ catch ( Throwable t )
+ {
+ synchronized ( retIncomingMessage )
+ {
+ retIncomingMessage.delete( 0,
+ retIncomingMessage.length() );
+ retIncomingMessage.append( "ERROR: " );
+ retIncomingMessage.append( t );
+ }
+ }
+ finally
+ {
+ synchronized ( retIncomingMessage )
+ {
+ // make sure something goes in the message, even if nothing was received
+ if ( retIncomingMessage.length() == 0 )
+ {
+ retIncomingMessage.append( "ERROR: incoming message was empty" );
+ }
+
+ retIncomingMessage.notify();
+ }
+
+ if ( server != null )
+ {
+ try
+ {
+ server.close();
+ }
+ catch ( IOException ignored )
+ {
+ }
+ }
+
+ // do this as a fail safe
+ synchronized ( listenerStarted )
+ {
+ listenerStarted.notify();
+ }
+ }
+
+ }
+
+ /**
+ * Build a one-way HTTP response message that complies to the WS-I Basic Profile 1.0, section 5.6.10
+ * - see http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16651160
+ *
+ * @return a WS-I-compliant Notify response message
+ */
+ private String buildResponse()
+ {
+ Date timeNow = new Date();
+ Date sameTimeTomorrow = new Date( timeNow.getTime() + ( 24 * 60 * 60 * 1000 ) );
+ StringBuffer responseBuf = new StringBuffer( "HTTP/" );
+ responseBuf.append( HTTP_VERSION );
+ responseBuf.append( " " );
+ responseBuf.append( HTTP_STATUS );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Date: " );
+ responseBuf.append( HTTP_DATE_FORMAT.format( timeNow ) );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Server: " );
+ responseBuf.append( HTTP_SERVER_NAME );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Cache-Control: " );
+ responseBuf.append( "max-age=86400" );
+ responseBuf.append( "\r\n" );
+
+ responseBuf.append( "Expires: " );
+ responseBuf.append( HTTP_DATE_FORMAT.format( sameTimeTomorrow ) );
+ responseBuf.append( "\r\n" );
+
+ return responseBuf.toString();
+ }
+ } );
+
+ // start listening and then return when the thread has officially gone live
+ // and the socket is ready to be accepted
+ synchronized ( listenerStarted )
+ {
+ listener.start();
+
+ try
+ {
+ listenerStarted.wait();
+ }
+ catch ( InterruptedException ignored )
+ {
+ }
+ }
+ }
+
+ public static void main( String[] args )
+ {
+ int port = args.length >= 1 ? Integer.valueOf( args[0] ).intValue() : 0;
+ int timeout = args.length >= 2 ? Integer.valueOf( args[1] ).intValue() : 0;
+ PortListen portListen = new PortListen( port, timeout );
+ System.out.println( "Listening for notification on port " + port + "..." );
+ String msg = portListen.waitForIncomingMessage();
+ System.out.println( "Received notification! SOAP message follows..." );
+ System.out.println( msg );
+ System.out.println( "Listener stopped." );
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/SubsciberInfoJPanel.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/SubsciberInfoJPanel.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/SubsciberInfoJPanel.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/SubsciberInfoJPanel.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,135 @@
+package org.apache.interop.smgr;
+
+import javax.swing.JPanel;
+import javax.swing.JFrame;
+import java.awt.Dimension;
+
+
+/**
+* This code was generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* *************************************
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
+* for this machine, so Jigloo or this code cannot be used legally
+* for any corporate or commercial purpose.
+* *************************************
+*/
+import javax.swing.JLabel;
+import javax.swing.JToggleButton;
+import java.awt.FlowLayout;
+import javax.swing.JTextField;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+public class SubsciberInfoJPanel extends javax.swing.JPanel {
+ private JLabel jLabelResourceUrl;
+ private JToggleButton jToggleButtonConnect;
+ private JTextField jTextFieldNotificationListener;
+ private JLabel jLabelNotificationListener;
+ private JTextField jTextFieldTopicName;
+ private JTextField jTextFieldTopicNamespace;
+ private JLabel jLabelTopic;
+ private JTextField jTextFieldResourceURL;
+ private ConnectionListener listener;
+
+ /**
+ * Auto-generated main method to display this
+ * JPanel inside a new JFrame.
+ */
+ public static void main(String[] args) {
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(new SubsciberInfoJPanel());
+ frame.pack();
+ frame.show();
+ }
+
+ public SubsciberInfoJPanel() {
+ super();
+ initGUI();
+ }
+
+ private void initGUI() {
+ try {
+ FlowLayout thisLayout = new FlowLayout();
+ this.setPreferredSize(new java.awt.Dimension(1112, 80));
+ thisLayout.setAlignment(FlowLayout.LEFT);
+ this.setLayout(thisLayout);
+ {
+ jLabelResourceUrl = new JLabel();
+ this.add(jLabelResourceUrl);
+ jLabelResourceUrl.setText("Resource URL:");
+ }
+ {
+ jTextFieldResourceURL = new JTextField();
+ this.add(jTextFieldResourceURL);
+ jTextFieldResourceURL.setText("http://66.57.65.244:4400/ettk/wsdm/services/ADMSubscribePort");
+ }
+ {
+ jLabelTopic = new JLabel();
+ this.add(jLabelTopic);
+ jLabelTopic.setText("Topic:");
+ }
+ {
+ jTextFieldTopicNamespace = new JTextField();
+ this.add(jTextFieldTopicNamespace);
+ jTextFieldTopicNamespace.setText("http://rim.pda");
+ }
+ {
+ jTextFieldTopicName = new JTextField();
+ this.add(jTextFieldTopicName);
+ jTextFieldTopicName.setText("CodeModuleSize");
+ }
+ {
+ jLabelNotificationListener = new JLabel();
+ this.add(jLabelNotificationListener);
+ jLabelNotificationListener.setText("Notification Listener:");
+ }
+ {
+ jTextFieldNotificationListener = new JTextField();
+ this.add(jTextFieldNotificationListener);
+ jTextFieldNotificationListener.setText("http://12.35.246.160:8001/bogasendpoint");
+ }
+ {
+ jToggleButtonConnect = new JToggleButton();
+ this.add(jToggleButtonConnect);
+ jToggleButtonConnect.setText("Connect");
+ jToggleButtonConnect.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ System.out
+ .println("jToggleButtonConnect.actionPerformed, event="
+ + evt);
+ if(listener!=null){
+ if(jToggleButtonConnect.isSelected())
+ listener.onConnect();
+ else
+ listener.onDisconnect();
+ }
+ }
+ });
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getResourceUrl(){
+ return jTextFieldResourceURL.getText();
+ }
+ public String getTopicNamespace(){
+ return jTextFieldTopicNamespace.getText();
+ }
+ public String getTopicName(){
+ return jTextFieldTopicName.getText();
+ }
+ public String getNotificationLister(){
+ return jTextFieldNotificationListener.getText();
+ }
+ public void setConnectionListener(ConnectionListener listener){
+ this.listener=listener;
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/TestSubscribe.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/TestSubscribe.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/TestSubscribe.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/TestSubscribe.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,71 @@
+/*
+ * Created on Jun 7, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.smgr;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
+import org.apache.ws.muws.interop.client.AbstractWsdmInteropTestCase;
+import org.apache.ws.muws.interop.client.FaultException;
+import org.apache.ws.muws.interop.client.ResourceStub;
+import org.apache.ws.muws.interop.client.ServiceStub;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestSubscribe extends AbstractWsdmInteropTestCase {
+ private PortListen m_listener;
+ private ServiceStub m_service;
+ private ResourceStub m_resource;
+ private static final String ADM_URL = null;
+ private String URL="http://66.57.65.244:4400/ettk/wsdm/services/ADMSubscribePort";
+ private String Rid=null;
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ //m_service = new ServiceStub( new URL( ADM_URL ) );
+
+ m_resource = new ResourceStub( getEpr(URL, Rid) );
+ m_listener=new PortListen(8000,600000);
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSubscribe() throws FaultException{
+
+ EndpointReference response = m_resource.subscribe("http://12.35.246.160:8001/bogasendpoint",new QName("http://rim.pda","CodeModuleSize"));
+ assertNotNull(response);
+ System.out.println("Waiting for a message");
+ String mess = m_listener.waitForIncomingMessage();
+ assertNotNull(mess);
+ System.out.println("Message:\n"+mess);
+
+ }
+
+ private EndpointReference getEpr(String URL, String Rid) throws XmlException{
+ XmlBeansEndpointReference x=new XmlBeansEndpointReference(URL,AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+ if(Rid!=null)
+ x.setReferenceProperties(new XmlObject[]{(XmlObject)XmlObject.Factory.parse("<svr:ResourceIdentifier xmlns:svr=\"http://wsdmdemo.org/service/weather-client-config\">"+Rid+"</svr:ResourceIdentifier>")});
+ return x;
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/blackberry.gif
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/blackberry.gif?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/smgr/blackberry.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/DisplayAppConnection.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/DisplayAppConnection.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/DisplayAppConnection.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/DisplayAppConnection.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,139 @@
+/*
+ * Created on Jun 7, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.interop.wcdisplay;
+
+import java.util.Observer;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
+import org.apache.ws.muws.interop.client.FaultException;
+import org.apache.ws.muws.interop.client.ResourceStub;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.values.XmlIntImpl;
+import org.wsdmdemo.service.weatherStation.impl.TemperatureMetricTypeImpl;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.impl.EndpointReferenceTypeImpl;
+
+/**
+ * @author wire
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DisplayAppConnection {
+ private static final QName weatherStationReferenceQname= new QName("http://wsdmdemo.org/service/weather-client-config","WeatherStationReference");
+ private static final QName weatherStationRefreshIntervalQname= new QName("http://wsdmdemo.org/service/weather-client-config","WeatherDataRefreshInterval");
+ private static final QName weatherStationNameQname= new QName("http://wsdmdemo.org/service/weather-station", "Name", "tns");
+ private static final QName weatherStationTempQname= new QName("http://wsdmdemo.org/service/weather-station","Temperature");
+ private static final QName weatherStationPricepQname= new QName("http://wsdmdemo.org/service/weather-station","Price");
+ private static final QName weatherStationStatusQname= new QName("http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd", "OperationalStatus", "muws-p2-xs");
+
+ private EndpointReference m_eprConfig;
+ private ResourceStub m_ResourceConfig;
+ private ResourceStub m_ws;
+ private Observer m_messageObserver;
+
+ private String status;
+ private int temperature;
+ private String stationName;
+
+ /**
+ * @throws XmlException
+ *
+ */
+ public DisplayAppConnection(Observer obs,String URL, String Rid) throws XmlException {
+ super();
+
+ m_eprConfig = getEpr(URL,Rid);
+ m_ResourceConfig = new ResourceStub(m_eprConfig);
+ m_ResourceConfig.addObserver(obs);
+ m_messageObserver=obs;
+ }
+
+ int getDelay() throws XmlException, FaultException {
+ XmlObject[] refreshDocArry = m_ResourceConfig.getResourceProperty(weatherStationRefreshIntervalQname);
+ XmlIntImpl refreshDoc = (XmlIntImpl)refreshDocArry[0];
+ return refreshDoc.getIntValue()*1000;
+ }
+
+
+ private EndpointReference getEpr(String URL, String Rid) throws XmlException{
+ XmlBeansEndpointReference x=new XmlBeansEndpointReference(URL,AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+ x.setReferenceProperties(new XmlObject[]{(XmlObject)XmlObject.Factory.parse("<svr:ResourceIdentifier xmlns:svr=\"http://wsdmdemo.org/service/weather-client-config\">"+Rid+"</svr:ResourceIdentifier>")});
+ return x;
+
+ }
+
+ /**
+ *
+ */
+ public void deleteObservers() {
+ m_ResourceConfig.deleteObservers();
+ m_ws.deleteObservers();
+ }
+
+ /**
+ * Updates the Ws Epr by consulting with the WcConfig Resource.
+ * @throws FaultException
+ *
+ */
+ public void updateWsEpr() throws FaultException {
+ XmlObject[] refreshDocArry = m_ResourceConfig.getResourceProperty(weatherStationReferenceQname);
+ EndpointReferenceTypeImpl refreshDoc = (EndpointReferenceTypeImpl)refreshDocArry[0];
+
+ if(m_ws!=null){
+ m_ws.deleteObserver(m_messageObserver);
+ }
+ m_ws = new ResourceStub(new XmlBeansEndpointReference(refreshDoc));
+ m_ws.addObserver(m_messageObserver);
+
+ }
+
+ public String getStationName() throws FaultException {
+ XmlObject[] nameArry=m_ws.getResourceProperty(weatherStationNameQname);
+
+ if(nameArry.length>0){
+ XmlObject x=nameArry[0];
+ String value=x.newCursor().getTextValue();
+ return value;
+ }
+
+ return null;
+ }
+ public String getStatus() throws FaultException {
+ XmlObject[] statArry=m_ws.getResourceProperty(weatherStationStatusQname);
+ if(statArry.length>0){
+ XmlObject x=statArry[0];
+ String value=x.newCursor().getTextValue();
+ return value;
+ }
+ return null;
+ }
+ public int getTemperature() throws FaultException {
+ XmlObject[] tempArry=m_ws.getResourceProperty(weatherStationTempQname);
+ if(tempArry.length>0){
+ TemperatureMetricTypeImpl x=(TemperatureMetricTypeImpl)tempArry[0];
+
+ String value=x.newCursor().getTextValue();
+ return new Long(Math.round(x.doubleValue())).intValue();
+ }
+ return -1;
+ }
+
+ public String getPrice() throws FaultException{
+ XmlObject[] priceArry=m_ws.getResourceProperty(weatherStationPricepQname);
+ if(priceArry.length>0){
+ XmlObject x=priceArry[0];
+ String value=x.newCursor().getTextValue();
+ return value;
+ }
+ return null;
+ }
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJFrame.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJFrame.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJFrame.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/LocationJFrame.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,115 @@
+package org.apache.interop.wcdisplay;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.JToggleButton;
+import javax.swing.WindowConstants;
+import javax.swing.border.BevelBorder;
+
+
+/**
+* This code was generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* *************************************
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
+* for this machine, so Jigloo or this code cannot be used legally
+* for any corporate or commercial purpose.
+* *************************************
+*/
+public class LocationJFrame extends javax.swing.JFrame {
+ private JTextField jTextFieldRid;
+ private JToggleButton jToggleButtonGo;
+ private JLabel jLabelRid;
+ private JTextField jTextFieldUrl;
+ private JLabel jLabelLocation;
+ private JLabel jLabelAniStatus;
+
+ /**
+ * Auto-generated main method to display this JFrame
+ */
+ public static void main(String[] args) {
+ LocationJFrame inst = new LocationJFrame();
+ inst.setVisible(true);
+ }
+
+ public LocationJFrame() {
+ super();
+ initGUI();
+ }
+
+ private void initGUI() {
+ try {
+ setSize(400, 300);
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ FlowLayout jPanel1Layout = new FlowLayout();
+ setLayout(jPanel1Layout);
+ setBackground(new java.awt.Color(239,239,239));
+ jPanel1Layout.setAlignment(FlowLayout.LEFT);
+ //this.getContentPane().add(jPanelLocation, BorderLayout.NORTH);
+ jPanel1Layout.setAlignment(FlowLayout.LEFT);
+ {
+ jLabelLocation = new JLabel();
+ add(jLabelLocation);
+ jLabelLocation.setText("Location:");
+ }
+ {
+ jTextFieldUrl = new JTextField();
+ add(jTextFieldUrl);
+ jTextFieldUrl
+ .setText("http://12.35.246.160:8080/muse/services/WeatherClientConfig");
+ }
+ {
+ jLabelRid = new JLabel();
+ add(jLabelRid);
+ jLabelRid.setText("RId:");
+ }
+ {
+ jTextFieldRid = new JTextField();
+ add(jTextFieldRid);
+ jTextFieldRid.setText("weather-client-config-1");
+ }
+ {
+ jToggleButtonGo = new JToggleButton();
+ add(jToggleButtonGo);
+ jToggleButtonGo.setText("Connect");
+ jToggleButtonGo.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ System.out
+ .println("jToggleButtonGo.actionPerformed, event="
+ + evt);
+ // setConnectionState(jToggleButtonGo.isSelected());
+ }
+ });
+ }
+ {
+ jLabelAniStatus = new JLabel();
+ add(jLabelAniStatus);
+ jLabelAniStatus.setIcon(new ImageIcon(getClass().getClassLoader().getResource("org/apache/interop/wcdisplay/hp-still.gif")));
+ jLabelAniStatus.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, null, null, null, null));
+ }
+
+ }
+ public String getUrl(){
+ return jTextFieldUrl.getText();
+ }
+
+ public String getRid(){
+ return jTextFieldRid.getText();
+ }
+
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/WcDisplayApp.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/WcDisplayApp.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/WcDisplayApp.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/WcDisplayApp.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,242 @@
+package org.apache.interop.wcdisplay;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+import javax.swing.JTextField;
+import javax.swing.JToggleButton;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+import javax.swing.WindowConstants;
+import javax.swing.border.BevelBorder;
+
+import org.apache.ws.muws.interop.client.FaultException;
+import org.apache.wsdm.interop.wcm.impl.ui.MessagesJPanel;
+import org.apache.wsdm.interop.wcm.impl.ui.TemperatureJPanel;
+import org.apache.xmlbeans.XmlException;
+
+/**
+* This code was generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* *************************************
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
+* for this machine, so Jigloo or this code cannot be used legally
+* for any corporate or commercial purpose.
+* *************************************
+*/
+public class WcDisplayApp extends javax.swing.JFrame {
+ private JPanel jPanelLocation;
+ private JSplitPane jSplitPaneGraphMessage;
+ private TemperatureJPanel temperatureJPanel1;
+ private MessagesJPanel messagesJPanel;
+
+ private JTextField jTextFieldRid;
+ private JToggleButton jToggleButtonGo;
+ private JLabel jLabelRid;
+ private JTextField jTextFieldUrl;
+ private JLabel jLabelLocation;
+ private JLabel jLabelAniStatus;
+
+ private ActionListener m_taskPerformer;
+ private Timer m_timer;
+ private DisplayAppConnection m_connection;
+ private ImageIcon stillIcon=new ImageIcon(getClass().getClassLoader().getResource("org/apache/interop/wcdisplay/hp-still.gif"));
+ private ImageIcon aniIcon=new ImageIcon(getClass().getClassLoader().getResource("org/apache/interop/wcdisplay/hp-ani.gif"));
+ /**
+ * Auto-generated main method to display this JFrame
+ */
+ public static void main(String[] args) {
+ WcDisplayApp inst = new WcDisplayApp();
+ inst.setVisible(true);
+ }
+
+ public WcDisplayApp() {
+ super();
+ initGUI();
+ setTitle("WCDisplay ");
+ }
+
+ private void initGUI() {
+ try {
+ this.setSize(731, 558);
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ {
+ jPanelLocation = new JPanel();
+ FlowLayout jPanel1Layout = new FlowLayout();
+ jPanelLocation.setLayout(jPanel1Layout);
+ jPanelLocation.setBackground(new java.awt.Color(239,239,239));
+ jPanel1Layout.setAlignment(FlowLayout.LEFT);
+ this.getContentPane().add(jPanelLocation, BorderLayout.NORTH);
+ jPanel1Layout.setAlignment(FlowLayout.LEFT);
+ {
+ jLabelLocation = new JLabel();
+ jPanelLocation.add(jLabelLocation);
+ jLabelLocation.setText("Location:");
+ }
+ {
+ jTextFieldUrl = new JTextField();
+ jPanelLocation.add(jTextFieldUrl);
+ jTextFieldUrl
+ .setText("http://12.35.246.160:8080/muse/services/WeatherClientConfig");
+ }
+ {
+ jLabelRid = new JLabel();
+ jPanelLocation.add(jLabelRid);
+ jLabelRid.setText("RId:");
+ }
+ {
+ jTextFieldRid = new JTextField();
+ jPanelLocation.add(jTextFieldRid);
+ jTextFieldRid.setText("weather-client-config-1");
+ }
+ {
+ jToggleButtonGo = new JToggleButton();
+ jPanelLocation.add(jToggleButtonGo);
+ jToggleButtonGo.setText("Connect");
+ jToggleButtonGo.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ System.out
+ .println("jToggleButtonGo.actionPerformed, event="
+ + evt);
+ setConnectionState(jToggleButtonGo.isSelected());
+ }
+ });
+ }
+ {
+ jLabelAniStatus = new JLabel();
+ jPanelLocation.add(jLabelAniStatus);
+ jLabelAniStatus.setIcon(new ImageIcon(getClass().getClassLoader().getResource("org/apache/interop/wcdisplay/hp-still.gif")));
+ jLabelAniStatus.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, null, null, null, null));
+ }
+ }
+ {
+ jSplitPaneGraphMessage = new JSplitPane();
+ this.getContentPane().add(
+ jSplitPaneGraphMessage,
+ BorderLayout.CENTER);
+ jSplitPaneGraphMessage.setOrientation(JSplitPane.VERTICAL_SPLIT);
+ jSplitPaneGraphMessage.setDividerLocation(300);
+ jSplitPaneGraphMessage.setPreferredSize(new java.awt.Dimension(684, 590));
+ {
+ temperatureJPanel1 = new TemperatureJPanel();
+ jSplitPaneGraphMessage.add(temperatureJPanel1, JSplitPane.LEFT);
+ }
+ {
+ messagesJPanel = new MessagesJPanel();
+ jSplitPaneGraphMessage
+ .add(messagesJPanel, JSplitPane.RIGHT);
+ messagesJPanel.setPreferredSize(new java.awt.Dimension(669, 241));
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Sets the app to the connected and polling state if true, idle if false;
+ * @param b
+ * @throws XmlException
+ * @throws FaultException
+ */
+ public void setConnectionState(boolean b) {
+
+ if(b){
+ int delay; //milliseconds
+ SwingUtilities.invokeLater(new Runnable(){
+ public void run() {
+ jLabelAniStatus.setIcon(aniIcon);
+ messagesJPanel.clearMessages();
+ }})
+ ;
+
+ try {
+ m_connection=new DisplayAppConnection(messagesJPanel,jTextFieldUrl.getText(),jTextFieldRid.getText());// Builds EPR
+ delay = m_connection.getDelay();
+ } catch (XmlException e1) {
+ e1.printStackTrace();
+ // schdule a shutdown
+ SwingUtilities.invokeLater(new Runnable(){
+ public void run() {
+ jToggleButtonGo.doClick();
+ }})
+ ;
+ return;
+
+ } catch (FaultException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ // schdule a shutdown
+ SwingUtilities.invokeLater(new Runnable(){
+ public void run() {
+ jToggleButtonGo.doClick();
+ }});
+ return;
+ }
+ m_taskPerformer = new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ try {
+ updateDisplay();
+ } catch (FaultException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ };
+ m_timer=new Timer(delay, m_taskPerformer);
+ m_timer.start();
+ } else {
+ SwingUtilities.invokeLater(new Runnable(){
+ public void run() {
+ jLabelAniStatus.setIcon(stillIcon);
+ }})
+ ;
+ m_connection.deleteObservers();
+ m_connection=null;
+ if(m_timer!=null){
+ m_timer.stop();
+ m_timer=null; // Collect me
+ m_taskPerformer=null;
+ }
+ }
+
+
+ }
+
+
+ /**
+ * @throws FaultException
+ *
+ */
+ protected void updateDisplay() throws FaultException {
+
+ m_connection.updateWsEpr();
+
+ if(m_connection.getStatus()!=null){
+ temperatureJPanel1.setStatus(m_connection.getStatus());
+ }
+
+ if(m_connection.getPrice()!=null){
+ temperatureJPanel1.setCost(m_connection.getPrice());
+ }
+ if(m_connection.getStationName()!=null){
+ temperatureJPanel1.setStation(m_connection.getStationName());
+ }
+ if(m_connection.getTemperature()>-1){
+ temperatureJPanel1.addMeasurement(m_connection.getTemperature());
+ }
+
+ }
+}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-ani.gif
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-ani.gif?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-ani.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-still.gif
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-still.gif?rev=189764&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcdisplay/hp-still.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java?rev=189764&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java (added)
+++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java Thu Jun 9 08:03:19 2005
@@ -0,0 +1,44 @@
+package org.apache.interop.wcmgr;
+
+import javax.swing.WindowConstants;
+
+
+/**
+* This code was generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* *************************************
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
+* for this machine, so Jigloo or this code cannot be used legally
+* for any corporate or commercial purpose.
+* *************************************
+*/
+public class WcMgrApp extends javax.swing.JFrame {
+
+ /**
+ * Auto-generated main method to display this JFrame
+ */
+ public static void main(String[] args) {
+ WcMgrApp inst = new WcMgrApp();
+ inst.setVisible(true);
+ }
+
+ public WcMgrApp() {
+ super();
+ initGUI();
+ }
+
+ private void initGUI() {
+ try {
+ this.setSize(613, 605);
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org