cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1297314 - in /cxf/web: bin/update-site src/main/java/org/apache/cxf/cwiki/Page.java src/main/java/org/apache/cxf/cwiki/SiteExporter.java
Date Tue, 06 Mar 2012 01:14:55 GMT
Author: dkulp
Date: Tue Mar  6 01:14:55 2012
New Revision: 1297314

URL: http://svn.apache.org/viewvc?rev=1297314&view=rev
Log:
Some performance updates
Stop writing out the caches if nothing has changed to avoid hourly emails

Modified:
    cxf/web/bin/update-site
    cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java
    cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java

Modified: cxf/web/bin/update-site
URL: http://svn.apache.org/viewvc/cxf/web/bin/update-site?rev=1297314&r1=1297313&r2=1297314&view=diff
==============================================================================
--- cxf/web/bin/update-site (original)
+++ cxf/web/bin/update-site Tue Mar  6 01:14:55 2012
@@ -1,7 +1,5 @@
 #!/bin/sh
-mvn package -Pnochecks $@ 
-[ $? -eq 0 ] || exit -1
-mvn -Pconfluence,main,nochecks exec:java  $@
+mvn -Pconfluence,main,nochecks package exec:java  $@
 [ $? -eq 0 ] || exit -1
 mvn -Pconfluence,docs,nochecks exec:java  $@
 [ $? -eq 0 ] || exit -1

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java?rev=1297314&r1=1297313&r2=1297314&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java Tue Mar  6 01:14:55 2012
@@ -47,6 +47,7 @@ public class Page implements Serializabl
     transient String content;
     
     public Page(Document doc) throws Exception {
+        //org.apache.cxf.helpers.XMLUtils.printDOM(doc.getDocumentElement());
         id = DOMUtils.getChildContent(doc.getDocumentElement().getFirstChild(), "id");
         parent = DOMUtils.getChildContent(doc.getDocumentElement().getFirstChild(), "parentId");
         title = DOMUtils.getChildContent(doc.getDocumentElement().getFirstChild(), "title");

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java?rev=1297314&r1=1297313&r2=1297314&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java Tue Mar  6 01:14:55 2012
@@ -112,25 +112,17 @@ public class SiteExporter {
 
     String loginToken;
     Template template;
+    boolean debug;
     
     public SiteExporter(List<String> args) throws Exception {
         
-        Service service = Service.create(new QName(SOAPNS, "Service"));
-        service.addPort(new QName(SOAPNS, "Port"), 
-                        SOAPBinding.SOAP11HTTP_BINDING,
-                        ROOT + RPC_ROOT);
 
-        dispatch = service.createDispatch(new QName(SOAPNS, "Port"), 
-                                          Document.class, Service.Mode.PAYLOAD);
         
         ListIterator<String> it = args.listIterator();
         while (it.hasNext()) {
             String s = it.next();
             if ("-debug".equals(s)) {
-                ((org.apache.cxf.jaxws.DispatchImpl<?>)dispatch).getClient()
-                    .getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
-                ((org.apache.cxf.jaxws.DispatchImpl<?>)dispatch).getClient()
-                    .getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+                debug = true;
             } else if ("-d".equals(s)) {
                 outputDir = new File(it.next());
             } else if ("-user".equals(s)) {
@@ -170,6 +162,25 @@ public class SiteExporter {
         outputDir.mkdirs();
     }
     
+    public Dispatch<Document> getDispatch() {
+        if (dispatch == null) {
+            Service service = Service.create(new QName(SOAPNS, "Service"));
+            service.addPort(new QName(SOAPNS, "Port"), 
+                            SOAPBinding.SOAP11HTTP_BINDING,
+                            ROOT + RPC_ROOT);
+    
+            dispatch = service.createDispatch(new QName(SOAPNS, "Port"), 
+                                              Document.class, Service.Mode.PAYLOAD);
+            if (debug) {
+                ((org.apache.cxf.jaxws.DispatchImpl<?>)dispatch).getClient()
+                    .getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
+                ((org.apache.cxf.jaxws.DispatchImpl<?>)dispatch).getClient()
+                    .getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+            }
+        }
+        return dispatch;
+    }
+    
     public void run() throws Exception {
         loadPagesCache();
         
@@ -195,8 +206,10 @@ public class SiteExporter {
         }
 
         
-        renderPages();
-        savePages();
+        if (!modifiedPages.isEmpty()) {
+            renderPages();
+            savePages();
+        }
         
         if (commit) {
             File file = FileUtils.createTempFile("svncommit", "txt");
@@ -215,7 +228,7 @@ public class SiteExporter {
         URL url = new URL(ROOT + "/createrssfeed.action?types=page&types=blogpost&types=mail&"
                           //+ "types=comment&"  //cannot handle comment updates yet
                           + "types=attachment&statuses=created&statuses=modified"
-                          + "&spaces=" + spaceKey + "&rssType=atom&maxResults=20&timeSpan=60"
+                          + "&spaces=" + spaceKey + "&rssType=atom&maxResults=20&timeSpan=2"
                           + "&publicFeed=true");
         InputStream ins = url.openStream();
         Document doc = StaxUtils.read(ins);
@@ -313,7 +326,7 @@ public class SiteExporter {
         el.appendChild(el2);
         doc.appendChild(el);
 
-        doc = dispatch.invoke(doc);
+        doc = getDispatch().invoke(doc);
         el = DOMUtils.getFirstElement(DOMUtils.getFirstElement(doc.getDocumentElement()));
         while (el != null) {
             String filename = DOMUtils.getChildContent(el, "fileName");
@@ -472,7 +485,7 @@ public class SiteExporter {
 
         
         doc.appendChild(el);
-        doc = dispatch.invoke(doc);
+        doc = getDispatch().invoke(doc);
         
         String content = doc.getDocumentElement().getFirstChild().getTextContent().trim();
         content = updateContentLinks(p, content, id);
@@ -504,7 +517,7 @@ public class SiteExporter {
             el2.setTextContent(password);
         }
         doc.appendChild(el);
-        doc = dispatch.invoke(doc);
+        doc = getDispatch().invoke(doc);
         loginToken = doc.getDocumentElement().getFirstChild().getTextContent();
     }
 
@@ -527,10 +540,11 @@ public class SiteExporter {
         el.appendChild(el2);
         el2.setTextContent(spaceKey);
         doc.appendChild(el);
-        doc = dispatch.invoke(doc);
+        doc = getDispatch().invoke(doc);
         
         Set<String> allPages = new HashSet<String>(pages.keySet());
         
+        //XMLUtils.printDOM(doc.getDocumentElement());
         Node nd = doc.getDocumentElement().getFirstChild().getFirstChild();
         while (nd != null) {
             if (nd instanceof Element) {
@@ -563,7 +577,7 @@ public class SiteExporter {
         el.appendChild(el2);
         el2.setTextContent(DOMUtils.getChildContent(pageSumEl, "id"));
         doc.appendChild(el);
-        doc = dispatch.invoke(doc);
+        doc = getDispatch().invoke(doc);
         
         Page page = new Page(doc);
         Page oldPage = pages.get(page.getId());



Mime
View raw message