tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelvingood...@apache.org
Subject svn commit: r572682 - in /incubator/tuscany/sandbox/kgoodson/events: impl/ impl/src/main/java/org/apache/tuscany/sdo/api/ impl/src/main/java/org/apache/tuscany/sdo/helper/ impl/src/main/java/org/apache/tuscany/sdo/impl/ lib/ lib/src/main/java/org/apach...
Date Tue, 04 Sep 2007 13:48:35 GMT
Author: kelvingoodson
Date: Tue Sep  4 06:48:33 2007
New Revision: 572682

URL: http://svn.apache.org/viewvc?rev=572682&view=rev
Log: (empty)

Added:
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/Event.java
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/ListenerBase.java
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
Modified:
    incubator/tuscany/sandbox/kgoodson/events/impl/pom.xml
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
    incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
    incubator/tuscany/sandbox/kgoodson/events/lib/pom.xml
    incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
    incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java

Modified: incubator/tuscany/sandbox/kgoodson/events/impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/pom.xml?rev=572682&r1=572681&r2=572682&view=diff
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/pom.xml (original)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/pom.xml Tue Sep  4 06:48:33 2007
@@ -27,6 +27,7 @@
     <artifactId>tuscany-sdo-impl</artifactId>
     <name>Tuscany SDO Implementation</name>
     <description>Tuscany implementation of SDO API.</description>
+    <version>kgoodson-sandbox</version>
 
     <repositories>
         <repository>

Added: incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/Event.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/Event.java?rev=572682&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/Event.java
(added)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/Event.java
Tue Sep  4 06:48:33 2007
@@ -0,0 +1,61 @@
+package org.apache.tuscany.sdo.api;
+
+import commonj.sdo.Property;
+
+public interface Event {
+
+    Object getNotifier();
+
+    int SET = 1;
+    int UNSET = 2;
+    int ADD = 3;
+    int REMOVE = 4;
+    int ADD_MANY = 5;
+    int REMOVE_MANY = 6;
+    int MOVE = 7;    
+
+    int getEventType();
+
+
+    int NO_FEATURE_ID = -1;
+
+
+    Property getProperty();
+    Object getOldValue();
+    Object getNewValue();
+    boolean wasSet();
+    boolean isTouch();
+
+
+    int NO_INDEX = -1;
+    int getPosition();
+
+
+    boolean getOldBooleanValue();
+    boolean getNewBooleanValue();
+
+    byte getOldByteValue();
+    byte getNewByteValue();
+
+    char getOldCharValue();
+    char getNewCharValue();
+
+    double getOldDoubleValue();
+    double getNewDoubleValue();
+
+    float getOldFloatValue();
+    float getNewFloatValue();
+
+    int getOldIntValue();
+    int getNewIntValue();
+
+    long getOldLongValue();
+    long getNewLongValue();
+
+    short getOldShortValue();
+    short getNewShortValue();
+
+    String getOldStringValue();
+    String getNewStringValue();
+  }
+

Added: incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/EventListener.java?rev=572682&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
(added)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
Tue Sep  4 06:48:33 2007
@@ -0,0 +1,8 @@
+package org.apache.tuscany.sdo.api;
+
+
+public interface EventListener  {
+  
+  public void eventNotification(Event e);
+
+}

Added: incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/ListenerBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/ListenerBase.java?rev=572682&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/ListenerBase.java
(added)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/api/ListenerBase.java
Tue Sep  4 06:48:33 2007
@@ -0,0 +1,13 @@
+package org.apache.tuscany.sdo.api;
+
+import org.apache.tuscany.sdo.impl.EventImpl;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+
+public abstract class ListenerBase extends AdapterImpl implements EventListener {
+
+  public void notifyChanged(Notification msg) {
+    Event e = new EventImpl(msg);
+    eventNotification(e);
+  }
+}

Modified: incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java?rev=572682&r1=572681&r2=572682&view=diff
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
(original)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
Tue Sep  4 06:48:33 2007
@@ -43,6 +43,8 @@
 import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
 import org.apache.tuscany.sdo.spi.SDOHelperBase;
 import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.common.util.UniqueEList;
 import org.eclipse.emf.ecore.EAnnotation;
@@ -476,6 +478,11 @@
         // TODO if (property.isMany()) ... // convert list of values
         String stringValue = convertToString(property.getType(), value);
         eAnnotation.getDetails().put(property.getName(), stringValue);
+    }
+
+    public void addChangeListener(DataObject quote, Object listener) {
+      Adapter l = (Adapter)listener;
+      ((Notifier)quote).eAdapters().add(listener);
     }
 
 }

Modified: incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java?rev=572682&r1=572681&r2=572682&view=diff
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
(original)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
Tue Sep  4 06:48:33 2007
@@ -31,6 +31,8 @@
 import org.apache.tuscany.sdo.util.DataObjectUtil;
 import org.apache.tuscany.sdo.util.VirtualSequence;
 import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList;
+import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EClass;
@@ -71,7 +73,8 @@
   protected int eContainerFeatureID;
   protected SDOChangeRecorder changeRecorder;
   protected Object location; // Resource.Internal (if object is directly contained in a resource)
or URI (if it is a proxy)
-
+  protected BasicEList eAdapters;
+  
   /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
@@ -1350,12 +1353,18 @@
 
   public boolean eNotificationRequired()
   {
-    return changeRecorder != null;
+    return changeRecorder != null || super.eNotificationRequired();
   }
 
+  public boolean eDeliver()
+  {
+    return true;
+  }
+  
   public void eNotify(Notification notification)
   {
-    changeRecorder.notifyChanged(notification);
+    if(changeRecorder != null) changeRecorder.notifyChanged(notification);
+    super.eNotify(notification);
   }
 
   public void setChangeRecorder(SDOChangeRecorder changeRecorder)
@@ -1489,6 +1498,20 @@
     return eOpenIsSet(DataObjectUtil.getOpenFeature(this, featureID));
   }
   
+  public EList eAdapters()
+  {
+    if (eAdapters == null)
+    {
+      eAdapters =  new EAdapterList(this);
+    }
+    return eAdapters;
+  }
+
+  public BasicEList eBasicAdapters()
+  {
+    return eAdapters;
+  }
+
   /*
   public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature)
   {

Added: incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java?rev=572682&view=auto
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
(added)
+++ incubator/tuscany/sandbox/kgoodson/events/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
Tue Sep  4 06:48:33 2007
@@ -0,0 +1,142 @@
+package org.apache.tuscany.sdo.impl;
+
+import org.apache.tuscany.sdo.api.Event;
+import org.eclipse.emf.common.notify.Notification;
+
+import commonj.sdo.Property;
+
+
+public class EventImpl implements Event {
+
+  protected Notification emfEvent;
+  protected Object notifier;
+
+  public EventImpl(Notification notification)
+  {
+    this.emfEvent = notification;
+  }
+  
+  public Object getNotifier()
+  {
+    return notifier == null ? emfEvent.getNotifier() : notifier;
+  }
+
+  public int getEventType()
+  {
+    return emfEvent.getEventType();
+  }
+
+
+  public Property getProperty()
+  {
+    return (Property)emfEvent.getFeature();
+  }
+
+  public Object getOldValue()
+  {
+    return emfEvent.getOldValue();
+  }
+
+  public Object getNewValue()
+  {
+    return emfEvent.getNewValue();
+  }
+
+  public boolean wasSet()
+  {
+    return emfEvent.wasSet();
+  }
+
+  public boolean isTouch()
+  {
+    return emfEvent.isTouch();
+  }
+
+  public int getPosition()
+  {
+    return emfEvent.getPosition();
+  }
+
+
+  public boolean getOldBooleanValue()
+  {
+    return emfEvent.getOldBooleanValue();
+  }
+
+  public boolean getNewBooleanValue()
+  {
+    return emfEvent.getNewBooleanValue();
+  }
+
+  public byte getOldByteValue()
+  {
+    return emfEvent.getOldByteValue();
+  }
+  public byte getNewByteValue()
+  {
+    return emfEvent.getNewByteValue();
+  }
+
+  public char getOldCharValue()
+  {
+    return emfEvent.getOldCharValue();
+  }
+  public char getNewCharValue()
+  {
+    return emfEvent.getNewCharValue();
+  }
+
+  public double getOldDoubleValue()
+  {
+    return emfEvent.getOldDoubleValue();
+  }
+  public double getNewDoubleValue()
+  {
+    return emfEvent.getNewDoubleValue();
+  }
+
+  public float getOldFloatValue()
+  {
+    return emfEvent.getOldFloatValue();
+  }
+  public float getNewFloatValue()
+  {
+    return emfEvent.getNewFloatValue();
+  }
+
+  public int getOldIntValue()
+  {
+    return emfEvent.getOldIntValue();
+  }
+  public int getNewIntValue()
+  {
+    return emfEvent.getNewIntValue();
+  }
+
+  public long getOldLongValue()
+  {
+    return emfEvent.getOldLongValue();
+  }
+  public long getNewLongValue()
+  {
+    return emfEvent.getNewLongValue();
+  }
+
+  public short getOldShortValue()
+  {
+    return emfEvent.getOldShortValue();
+  }
+  public short getNewShortValue()
+  {
+    return emfEvent.getNewShortValue();
+  }
+
+  public String getOldStringValue()
+  {
+    return emfEvent.getOldStringValue();
+  }
+  public String getNewStringValue()
+  {
+    return emfEvent.getNewStringValue();
+  }
+}

Modified: incubator/tuscany/sandbox/kgoodson/events/lib/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/lib/pom.xml?rev=572682&r1=572681&r2=572682&view=diff
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/lib/pom.xml (original)
+++ incubator/tuscany/sandbox/kgoodson/events/lib/pom.xml Tue Sep  4 06:48:33 2007
@@ -28,6 +28,7 @@
     <name>Tuscany SDO Library</name>
     <description>Tuscany SDO implementation library.</description>
     <packaging>jar</packaging>
+    <version>kgoodson-sandbox</version>
 
     <repositories>
         <repository>

Modified: incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java?rev=572682&r1=572681&r2=572682&view=diff
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
(original)
+++ incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
Tue Sep  4 06:48:33 2007
@@ -408,4 +408,6 @@
     final String XML_LOAD_UNKNOWN_PROPERTIES = "load unknown properties";
   }
 
+  public void addChangeListener(DataObject quote, Object listener);
+
 }

Modified: incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java?rev=572682&r1=572681&r2=572682&view=diff
==============================================================================
--- incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
(original)
+++ incubator/tuscany/sandbox/kgoodson/events/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
Tue Sep  4 06:48:33 2007
@@ -404,5 +404,10 @@
   {
     defaultSDOHelper.getMetaDataBuilder().addPropertyInstanceProperty(definedProperty, property,
value);
   }
+
+  public static void addChangeListener(DataObject quote, Object l) {
+    // TODO change to EventListener when imported
+    defaultSDOHelper.addChangeListener(quote, l);
+  }
   
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message