Skip to Content.
Sympa Menu

notify-dpml - r855 - in trunk/main/metro: part/api/src/main/net/dpml/part runtime/src/main/net/dpml/metro/runtime

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r855 - in trunk/main/metro: part/api/src/main/net/dpml/part runtime/src/main/net/dpml/metro/runtime
  • Date: Wed, 4 Jan 2006 21:46:49 +0100

Author: mcconnell
Date: 2006-01-04 21:46:48 +0100 (Wed, 04 Jan 2006)
New Revision: 855

Added:
trunk/main/metro/part/api/src/main/net/dpml/part/ContextEvent.java
trunk/main/metro/part/api/src/main/net/dpml/part/ContextListener.java
Modified:
trunk/main/metro/part/api/src/main/net/dpml/part/Context.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
Log:
progress on the part api (in progress)

Modified: trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
2006-01-04 18:36:48 UTC (rev 854)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/Context.java
2006-01-04 20:46:48 UTC (rev 855)
@@ -36,5 +36,19 @@
* @return the context map
*/
Map getContextMap();
+
+ /**
+ * Add a context listener to the component provider.
+ * @param listener the context listener to add
+ * @exception NullPointerException if the supplied listener argument is
null
+ */
+ void addContextListener( ContextListener listener ) throws
NullPointerException;
+
+ /**
+ * Remove a context listener from the component provider.
+ * @param listener the context listener to remove
+ * @exception NullPointerException if the supplied listener argument is
null
+ */
+ void removeContextListener( ContextListener listener ) throws
NullPointerException;
}


Added: trunk/main/metro/part/api/src/main/net/dpml/part/ContextEvent.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/ContextEvent.java
2006-01-04 18:36:48 UTC (rev 854)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/ContextEvent.java
2006-01-04 20:46:48 UTC (rev 855)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * 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.
+ */
+
+package net.dpml.part;
+
+import java.util.EventObject;
+
+/**
+ * Event triggered as a result of change to the value of a context entry.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class ContextEvent extends EventObject
+{
+ /**
+ * Serial version identifier.
+ */
+ static final long serialVersionUID = 1L;
+
+ private final String m_key;
+ private final Object m_from;
+ private final Object m_to;
+
+ /**
+ * Construct a new <code>ContextEvent</code>.
+ *
+ * @param source the source provider
+ * @param key the context entry key
+ * @param from the original value
+ * @param to the new value
+ */
+ public ContextEvent( final Provider source, String key, Object from,
Object to )
+ {
+ super( source );
+
+ m_key = key;
+ m_from = from;
+ m_to = to;
+ }
+
+ /**
+ * Return the feature name.
+ * @return the name of the modified feature
+ */
+ public String getKey()
+ {
+ return m_key;
+ }
+
+ /**
+ * Return the old value.
+ * @return the original value
+ */
+ public Object getOldValue()
+ {
+ return m_from;
+ }
+
+ /**
+ * Return the new value.
+ * @return the new current value
+ */
+ public Object getNewValue()
+ {
+ return m_to;
+ }
+
+ /**
+ * Return the component model that initiating the event.
+ * @return the source model
+ */
+ public Provider getProvider()
+ {
+ return (Provider) super.getSource();
+ }
+}
+

Added: trunk/main/metro/part/api/src/main/net/dpml/part/ContextListener.java
===================================================================
--- trunk/main/metro/part/api/src/main/net/dpml/part/ContextListener.java
2006-01-04 18:36:48 UTC (rev 854)
+++ trunk/main/metro/part/api/src/main/net/dpml/part/ContextListener.java
2006-01-04 20:46:48 UTC (rev 855)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * 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.
+ */
+
+package net.dpml.part;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.EventListener;
+
+/**
+ * Interface implementated by local listeners to context entry changes.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public interface ContextListener extends EventListener, Remote
+{
+ /**
+ * Notify the listener of a change to a context entry.
+ *
+ * @param event the context change event
+ * @exception RemoteException if a remote transport error occurs
+ */
+ void entryChanged( final ContextEvent event ) throws RemoteException;
+}
+

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
2006-01-04 18:36:48 UTC (rev 854)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentHandler.java
2006-01-04 20:46:48 UTC (rev 855)
@@ -53,6 +53,8 @@
import net.dpml.part.Context;
import net.dpml.part.ModelEvent;
import net.dpml.part.ModelListener;
+import net.dpml.part.ContextEvent;
+import net.dpml.part.ContextListener;

import net.dpml.state.State;

@@ -262,7 +264,7 @@
catch( Exception e )
{
final String error =
- "Internal error while atrempting to create a subsidiary
part ["
+ "Internal error while attempting to create a subsidiary
part ["
+ key
+ "] in component ["
+ m_path
@@ -304,6 +306,26 @@
return m_cache;
}

+ /**
+ * Add a context listener to the component provider.
+ * @param listener the context listener to add
+ * @exception NullPointerException if the supplied listener argument is
null
+ */
+ public void addContextListener( ContextListener listener ) throws
NullPointerException
+ {
+ super.addListener( listener );
+ }
+
+ /**
+ * Remove a context listener from the component provider.
+ * @param listener the context listener to remove
+ * @exception NullPointerException if the supplied listener argument is
null
+ */
+ public void removeContextListener( ContextListener listener ) throws
NullPointerException
+ {
+ super.removeListener( listener );
+ }
+

//--------------------------------------------------------------------------
// Component

//--------------------------------------------------------------------------
@@ -590,6 +612,7 @@
*/
protected void processEvent( EventObject event )
{
+ // TODO
}


//--------------------------------------------------------------------------




  • r855 - in trunk/main/metro: part/api/src/main/net/dpml/part runtime/src/main/net/dpml/metro/runtime, mcconnell at BerliOS, 01/04/2006

Archive powered by MHonArc 2.6.24.

Top of Page