You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/27 14:11:56 UTC

svn commit: r426039 - in /lenya/trunk/src: modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/ObservationTest.java modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java

Author: andreas
Date: Thu Jul 27 05:11:56 2006
New Revision: 426039

URL: http://svn.apache.org/viewvc?rev=426039&view=rev
Log:
When a meta data node is changed, send notification for the document node

Modified:
    lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/ObservationTest.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java

Modified: lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/ObservationTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/ObservationTest.java?rev=426039&r1=426038&r2=426039&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/ObservationTest.java (original)
+++ lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/ObservationTest.java Thu Jul 27 05:11:56 2006
@@ -81,9 +81,14 @@
     }
 
     protected void testListener(Document doc, TestListener listener) throws Exception {
+        listener.reset();
         NamespaceHelper xml = new NamespaceHelper("http://apache.org/lenya/test", "", "test");
         doc.getRepositoryNode().lock();
         SourceUtil.writeDOM(xml.getDocument(), doc.getSourceURI(), getManager());
+
+        String mimeType = doc.getMimeType();
+        doc.setMimeType("");
+        doc.setMimeType(mimeType);
         
         assertFalse(listener.wasNotified());
         
@@ -92,7 +97,6 @@
         Thread.currentThread().sleep(100);
         
         assertTrue(listener.wasNotified());
-        listener.reset();
     }
 
 }

Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java?rev=426039&r1=426038&r2=426039&view=diff
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java Thu Jul 27 05:11:56 2006
@@ -312,10 +312,31 @@
                     out.write(buf, 0, read);
                     read = in.read(buf);
                 }
+
+                Node node;
+                String sourceUri = getSourceURI();
+                if (sourceUri.endsWith(".meta")) {
+                    String documentSourceUri = sourceUri.substring(0, sourceUri.length() - ".meta".length());
+                    NodeFactory factory = null;
+                    try {
+                        factory = (NodeFactory) this.manager.lookup(NodeFactory.ROLE);
+                        node = (Node) factory.buildItem(getSession(), documentSourceUri);
+                    }
+                    finally {
+                        if (factory != null) {
+                            this.manager.release(factory);
+                        }
+                    }
+                }
+                else {
+                    node = this;
+                }
+                
                 
                 for (Iterator i = this.listeners.iterator(); i.hasNext(); ) {
                     NodeListener listener = (NodeListener) i.next();
-                    listener.nodeChanged(this, getSession().getIdentity());
+                    
+                    listener.nodeChanged(node, getSession().getIdentity());
                 }
 
             } catch (Exception e) {



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