Author: kelvingoodson
Date: Wed Jan 30 10:18:15 2008
New Revision: 616827
URL: http://svn.apache.org/viewvc?rev=616827&view=rev
Log:
TUSCANY-1527 I added something very similar to the interface that I had
proposed in my sandbox, and added a test case. I flagged the interfaces as
"Experimental" in the javadoc, since it would be good to have experience with
their suitability for use before giving users the feeling that these are well
established interfaces that are guaranteed not to vary in the future.
Added:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/NotificationTestCase.java
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java
(with props)
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
(with props)
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java?rev=616827&r1=616826&r2=616827&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
(original)
+++
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
Wed Jan 30 10:18:15 2008
@@ -36,6 +36,7 @@
import org.apache.tuscany.sdo.SimpleAnyTypeDataObject;
import org.apache.tuscany.sdo.api.SDOHelper;
import org.apache.tuscany.sdo.api.XMLStreamHelper;
+import org.apache.tuscany.sdo.api.EventListener;
import org.apache.tuscany.sdo.impl.ClassImpl;
import org.apache.tuscany.sdo.impl.DataGraphImpl;
import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl;
@@ -43,6 +44,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;
@@ -66,7 +69,6 @@
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.xmi.XMLResource;
-import commonj.sdo.impl.HelperProvider;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
@@ -75,9 +77,11 @@
import commonj.sdo.helper.CopyHelper;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.impl.HelperProvider;
public class SDOHelperImpl extends SDOHelperBase implements SDOHelper,
SDOHelper.MetaDataBuilder {
- public DataObject createDataTypeWrapper(Type dataType, Object value) {
+
+ public DataObject createDataTypeWrapper(Type dataType, Object value) {
SimpleAnyTypeDataObject simpleAnyType =
SDOFactory.eINSTANCE.createSimpleAnyTypeDataObject();
simpleAnyType.setInstanceType((EDataType)dataType);
simpleAnyType.setValue(value);
@@ -482,4 +486,15 @@
eAnnotation.getDetails().put(property.getName(), stringValue);
}
+
+ public void addChangeListener(DataObject dob, EventListener listener) {
+ // Adapter l = (Adapter)listener;
+ ((Notifier)dob).eAdapters().add(listener);
+ }
+
+ public void removeChangeListener(DataObject dob, EventListener listener) {
+ ((Notifier)dob).eAdapters().remove(listener);
+ }
+
+
}
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java?rev=616827&r1=616826&r2=616827&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
(original)
+++
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
Wed Jan 30 10:18:15 2008
@@ -34,6 +34,7 @@
import org.apache.tuscany.sdo.util.VirtualSequence;
import org.apache.tuscany.sdo.util.DataObjectUtil.Accessor;
import org.eclipse.emf.common.notify.Notification;
+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;
@@ -75,7 +76,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 -->
@@ -1359,12 +1361,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)
@@ -1497,6 +1505,21 @@
{
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/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java?rev=616827&view=auto
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
(added)
+++
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
Wed Jan 30 10:18:15 2008
@@ -0,0 +1,78 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+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();
+ }
+}
Added:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java?rev=616827&view=auto
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java
(added)
+++
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java
Wed Jan 30 10:18:15 2008
@@ -0,0 +1,33 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.impl;
+
+import org.apache.tuscany.sdo.api.Event;
+import org.apache.tuscany.sdo.api.EventListener;
+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/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java?rev=616827&r1=616826&r2=616827&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
(original)
+++
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
Wed Jan 30 10:18:15 2008
@@ -67,6 +67,7 @@
suite.addTestSuite(XMLUnknownPropertiesTestCase.class);
suite.addTestSuite(ExpectedExceptionsTestCase.class);
suite.addTestSuite(TypeHelperTestCase.class);
+ suite.addTestSuite(NotificationTestCase.class);
return suite;
}
Added:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/NotificationTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/NotificationTestCase.java?rev=616827&view=auto
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/NotificationTestCase.java
(added)
+++
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/NotificationTestCase.java
Wed Jan 30 10:18:15 2008
@@ -0,0 +1,186 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.Event;
+import org.apache.tuscany.sdo.impl.ListenerBase;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * Test DataObject Property value change notification
+ */
+public class NotificationTestCase extends TestCase {
+
+ HelperContext hc;
+ TypeHelper th;
+
+ private class Observer extends ListenerBase {
+
+ private int notificationCount;
+ private Event lastEvent;
+
+ public int getNotificationCount() {
+ return notificationCount;
+ }
+
+ public Event getLastEvent() {
+ return lastEvent;
+ }
+
+ public Observer() {
+ notificationCount = 0;
+ }
+
+ public void eventNotification(Event e) {
+
+ if (e.getEventType() != Event.REMOVE_LISTENER) {
+ notificationCount++;
+ lastEvent = e;
+ }
+ }
+
+ }
+
+ public void testTransitions() throws IOException {
+ final String TEST_MODEL = "/simple.xsd";
+ final String TEST_NAMESPACE = "http://www.example.com/simple";
+
+ // Populate the meta data for the test (Stock Quote) model
+ URL url = getClass().getResource(TEST_MODEL);
+ InputStream inputStream = url.openStream();
+ hc.getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+
+ Type quoteType = th.getType(TEST_NAMESPACE, "Quote");
+ DataObject quote = hc.getDataFactory().create(quoteType);
+ Observer o = new Observer();
+ SDOUtil.addChangeListener(quote, o);
+
+ Event e;
+
+ String firstName = "FlyByNightTechnology";
+
+ int changeCount = 0;
+
+ quote.setString("companyName", firstName);
+ assertEquals(++changeCount, o.getNotificationCount());
+ e = o.getLastEvent();
+ assertEquals(Event.SET, e.getEventType());
+ assertEquals(null, e.getOldValue());
+ assertFalse(e.wasSet());
+
+ quote.setString("companyName", "FBNT");
+ e = o.getLastEvent();
+ assertTrue(e.wasSet());
+
+ assertEquals(firstName, e.getOldValue());
+ assertEquals(++changeCount, o.getNotificationCount());
+ assertEquals("companyName", e.getProperty().getName());
+
+ SDOUtil.removeChangeListener(quote, o);
+
+ quote.setString("companyName", "3rdValue");
+ e = o.getLastEvent();
+
+ assertEquals(firstName, e.getOldValue());
+ assertEquals(changeCount /* no ++ */, o.getNotificationCount());
+
+ SDOUtil.addChangeListener(quote, o);
+
+ quote.setString("companyName", "3rdValue");
+ assertEquals(++changeCount, o.getNotificationCount());
+ e = o.getLastEvent();
+ assertTrue(e.isTouch());
+ assertTrue(e.wasSet());
+
+ quote.unset("companyName");
+ assertEquals(++changeCount, o.getNotificationCount());
+ e = o.getLastEvent();
+ assertTrue(e.wasSet());
+
+
+ quote.set("companyName", "4thValue");
+ assertEquals(++changeCount, o.getNotificationCount());
+ e = o.getLastEvent();
+ assertFalse(e.wasSet());
+
+ assertEquals(Event.NO_INDEX, e.getPosition());
+
+ DataObject child = quote.createDataObject("quotes");
+ assertEquals(++changeCount, o.getNotificationCount());
+ e = o.getLastEvent();
+ assertFalse(e.wasSet());
+ assertEquals(0, e.getPosition());
+ assertEquals(Event.ADD, e.getEventType());
+
+ DataObject child2 = quote.createDataObject("quotes");
+ assertEquals(++changeCount, o.getNotificationCount());
+ e = o.getLastEvent();
+ assertTrue(e.wasSet()); // the quotes property was previously set to a
non empty list
+ assertEquals(1, e.getPosition());
+
+ child2.setString("companyName", "subsidiary");
+
+ assertEquals(changeCount /* no ++ */, o.getNotificationCount()); // not
monitoring the child
+
+ quote.getList("quotes").clear();
+ e = o.getLastEvent();
+ assertEquals(++changeCount, o.getNotificationCount());
+ assertEquals(Event.REMOVE_MANY, e.getEventType());
+
+ List newList = new ArrayList();
+
+ newList.add(hc.getDataFactory().create(quoteType));
+ newList.add(hc.getDataFactory().create(quoteType));
+
+ quote.getList("quotes").addAll(newList);
+ e = o.getLastEvent();
+ assertEquals(++changeCount, o.getNotificationCount());
+ assertEquals(Event.ADD_MANY, e.getEventType());
+
+
+
+
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ hc = SDOUtil.createHelperContext();
+ th = hc.getTypeHelper();
+
+ }
+
+}
Added:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java?rev=616827&view=auto
==============================================================================
---
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java
(added)
+++
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java
Wed Jan 30 10:18:15 2008
@@ -0,0 +1,63 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.api;
+
+import commonj.sdo.Property;
+
+/**
+ * An experimental Tuscany API interface, subject to possible change,
+ * to permit notification of change events on a DataObject instance
+ */
+public interface Event {
+
+ Object getNotifier();
+
+ /**
+ * constants returned from getEventType()
+ */
+ int SET = 1;
+ int UNSET = 2;
+ int ADD = 3;
+ int REMOVE = 4;
+ int ADD_MANY = 5;
+ int REMOVE_MANY = 6;
+ int MOVE = 7;
+ int REMOVE_LISTENER = 8;
+
+ int getEventType();
+
+ /**
+ * get the Property for which the value changed
+ */
+ Property getProperty();
+ Object getOldValue();
+ Object getNewValue();
+
+ /*
+ * returns true if the Property value was in state "set" before this
change occurred.
+ */
+ boolean wasSet();
+ boolean isTouch();
+
+ int NO_INDEX = -1;
+ int getPosition();
+
+ }
+
Propchange:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/Event.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java?rev=616827&view=auto
==============================================================================
---
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
(added)
+++
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
Wed Jan 30 10:18:15 2008
@@ -0,0 +1,33 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tuscany.sdo.api;
+
+/**
+ * An experimental Tuscany API interface, subject to possible change.
+ * Can be registered with a DataObject instance to permit change
+ * notifications for Property values of the DataObject.
+ * @see SDOHelper#addChangeListener(commonj.sdo.DataObject, EventListener)
+ *
+ */
+public interface EventListener {
+
+ public void eventNotification(Event e);
+
+}
Propchange:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/EventListener.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java?rev=616827&r1=616826&r2=616827&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
(original)
+++
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOHelper.java
Wed Jan 30 10:18:15 2008
@@ -27,7 +27,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
+import commonj.sdo.helper.XSDHelper;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
@@ -271,11 +271,28 @@
* @return a MetaDataBuilder instance
*/
public MetaDataBuilder getMetaDataBuilder();
+
+ /**
+ * An experimental interface, subject to possible change that permits
+ * registration of an event listener with a DataObject instance
+ * @param dob DataObject
+ * @param listener EventListener
+ */
+ public void addChangeListener(DataObject dob, EventListener listener);
+
+ /**
+ * An experimental interface, subject to possible change that permits
+ * deregistration of an event listener with a DataObject instance
+ * @param dob DataObject
+ * @param listener EventListener
+ */
+ public void removeChangeListener(DataObject dob, EventListener listener);
/**
* This interface provides methods which can be used to programatically
create SDO Types and Properties.
* It provides a lower level and more efficient API then the
DataObject-based one of TypeHelper.define().
*/
+
public interface MetaDataBuilder
{
Modified:
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java?rev=616827&r1=616826&r2=616827&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
(original)
+++
incubator/tuscany/java/sdo/lib/src/main/java/org/apache/tuscany/sdo/api/SDOUtil.java
Wed Jan 30 10:18:15 2008
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Map;
+import org.apache.tuscany.sdo.api.EventListener;
import org.apache.tuscany.sdo.spi.HelperProviderBase;
import commonj.sdo.DataGraph;
@@ -412,5 +413,25 @@
{
defaultSDOHelper.getMetaDataBuilder().addPropertyInstanceProperty(definedProperty,
property, value);
}
+
+
+ /**
+ * @see SDOHelper#addChangeListener(DataObject, EventListener)
+ * @param dob
+ * @param l
+ */
+ public static void addChangeListener(DataObject dob, EventListener l) {
+ defaultSDOHelper.addChangeListener(dob, l);
+ }
+
+ /**
+ * @see SDOHelper#addChangeListener(DataObject, EventListener)
+ * @param dob
+ * @param l
+ */
+ public static void removeChangeListener(DataObject dob, EventListener l) {
+ defaultSDOHelper.removeChangeListener(dob, l);
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]