You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:41:29 UTC

[sling-org-apache-sling-installer-console] 19/22: SLING-6176 expose the error persisted by the OSGi installer in the web console

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.installer.console-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-console.git

commit a76e9c7600a9e8057c223d9560c95ba43750e5ae
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Oct 21 09:20:50 2016 +0000

    SLING-6176 expose the error persisted by the OSGi installer in the web console
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/installer/console@1765969 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  4 ++--
 .../console/OsgiInstallerWebConsolePlugin.java     | 23 +++++++++++++++-------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5d10eaa..87f4698 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,8 +70,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.installer.api</artifactId>
-            <version>1.0.0</version>
+            <artifactId>org.apache.sling.installer.core</artifactId>
+            <version>3.7.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java b/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
index 33f02ec..19f07f0 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
@@ -104,6 +104,11 @@ public class OsgiInstallerWebConsolePlugin extends GenericServlet {
         }
         return stateInfo;
     }
+    
+    private String getError(final Resource rsrc) {
+        String error = rsrc.getError();
+        return error != null ? error : "";
+    }
 
     private String getInfo(final RegisteredResource rsrc) {
         return rsrc.getDigest() + '/' + String.valueOf(rsrc.getPriority());
@@ -146,14 +151,15 @@ public class OsgiInstallerWebConsolePlugin extends GenericServlet {
                 pw.printf("<span style='float: left; margin-left: 1em;'>Active Resources - %s</span>", getType(toActivate));
                 pw.println("</div>");
                 pw.println("<table class='nicetable'><tbody>");
-                pw.printf("<tr><th>Entity ID</th><th>Digest/Priority</th><th>URL (Version)</th><th>State</th></tr>");
+                pw.printf("<tr><th>Entity ID</th><th>Digest/Priority</th><th>URL (Version)</th><th>State</th><th>Error</th></tr>");
                 rt = toActivate.getType();
             }
             pw.printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
                     getEntityId(toActivate, group.getAlias()),
                     getInfo(toActivate),
                     getURL(toActivate),
-                    toActivate.getState());
+                    toActivate.getState(),
+                    getError(toActivate));
         }
         if ( rt != null ) {
             pw.println("</tbody></table>");
@@ -173,7 +179,7 @@ public class OsgiInstallerWebConsolePlugin extends GenericServlet {
                     pw.printf("<span style='float: left; margin-left: 1em;'>Processed Resources - %s</span>", getType(first));
                     pw.println("</div>");
                     pw.println("<table class='nicetable'><tbody>");
-                    pw.printf("<tr><th>Entity ID</th><th>Digest/Priority</th><th>URL (Version)</th><th>State</th></tr>");
+                    pw.printf("<tr><th>Entity ID</th><th>Digest/Priority</th><th>URL (Version)</th><th>State</th><th>Error</th></tr>");
                     rt = first.getType();
                 }
                 pw.print("<tr><td>");
@@ -191,22 +197,25 @@ public class OsgiInstallerWebConsolePlugin extends GenericServlet {
                         pw.print(formatDate(lastChange));
                     }
                 }
+                pw.print("</td><td>");
+                pw.print(getError(first));
                 pw.print("</td></tr>");
                 if ( first.getAttribute(TaskResource.ATTR_INSTALL_EXCLUDED) != null ) {
-                    pw.printf("<tr><td></td><td colspan='2'>%s</td><td></td></tr>",
+                    pw.printf("<tr><td></td><td colspan='2'>%s</td><td></td><td></td></tr>",
                             first.getAttribute(TaskResource.ATTR_INSTALL_EXCLUDED));
                 }
                 if ( first.getAttribute(TaskResource.ATTR_INSTALL_INFO) != null ) {
-                    pw.printf("<tr><td></td><td colspan='2'>%s</td><td></td></tr>",
+                    pw.printf("<tr><td></td><td colspan='2'>%s</td><td></td><td></td></tr>",
                             first.getAttribute(TaskResource.ATTR_INSTALL_INFO));
 
                 }
                 while ( iter.hasNext() ) {
                     final Resource resource = iter.next();
-                    pw.printf("<tr><td></td><td>%s</td><td>%s</td><td>%s</td></tr>",
+                    pw.printf("<tr><td></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
                             getInfo(resource),
                             getURL(resource),
-                            resource.getState());
+                            resource.getState(),
+                            getError(resource));
                 }
             }
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.