You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2011/09/18 21:41:13 UTC

svn commit: r1172329 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/ webapp/ webapp/WEB-INF/

Author: bommel
Date: Sun Sep 18 19:41:13 2011
New Revision: 1172329

URL: http://svn.apache.org/viewvc?rev=1172329&view=rev
Log:
(TOBAGO-1030)
Listing of the included libraries in the demo application
Thanks to Pascal for the patch

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestEntry.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestEntry.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestEntry.java?rev=1172329&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestEntry.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestEntry.java Sun Sep 18 19:41:13 2011
@@ -0,0 +1,44 @@
+package org.apache.myfaces.tobago.example.demo;
+
+/*
+ * 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.
+ */
+
+public class ManifestEntry {
+  private String url;
+  private String content;
+
+  public ManifestEntry(String url, String content) {
+    this.url = url;
+    this.content = content;
+  }
+
+  public String getUrl() {
+    return url;
+  }
+
+  public void setUrl(String url) {
+    this.url = url;
+  }
+
+  public String getContent() {
+    return content;
+  }
+
+  public void setContent(String content) {
+    this.content = content;
+  }
+}

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java?rev=1172329&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ManifestReader.java Sun Sep 18 19:41:13 2011
@@ -0,0 +1,65 @@
+package org.apache.myfaces.tobago.example.demo;
+
+/*
+ * 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.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Map;
+
+public class ManifestReader {
+  ArrayList<ManifestEntry> manifestList = new ArrayList<ManifestEntry>();
+
+  public ManifestReader(){
+    try {
+      Enumeration<URL> ul = this.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
+      ManifestEntry mie;
+      String line;
+      StringBuilder content;
+      BufferedReader in;
+      URL url;
+
+      while (ul.hasMoreElements()) {
+        url = ul.nextElement();
+        in = new BufferedReader(new InputStreamReader(url.openStream()));
+        content  = new StringBuilder();
+        Map.Entry<String, String> e;
+
+        while((line= in.readLine()) != null){
+          content.append(line+"\r\n");
+        }
+        in.close();
+
+        manifestList.add(new ManifestEntry(url.toString(), content.toString()));
+      }
+    } catch (IOException e) {
+      e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+    }
+  }
+
+  public ArrayList<ManifestEntry> getManifestList() {
+    return manifestList;
+  }
+
+  public void setManifestList(ArrayList<ManifestEntry> manifestList) {
+    this.manifestList = manifestList;
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=1172329&r1=1172328&r2=1172329&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml Sun Sep 18 19:41:13 2011
@@ -99,6 +99,12 @@
   </managed-bean>
 
   <managed-bean>
+    <managed-bean-name>manifestReader</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.demo.ManifestReader</managed-bean-class>
+    <managed-bean-scope>application</managed-bean-scope>
+  </managed-bean>
+
+  <managed-bean>
     <managed-bean-name>pageDeclarationLanguage</managed-bean-name>
     <managed-bean-class>org.apache.myfaces.tobago.example.demo.PageDeclarationLanguageBean</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml?rev=1172329&r1=1172328&r2=1172329&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/server-info.xhtml Sun Sep 18 19:41:13 2011
@@ -91,5 +91,22 @@
       </tc:sheet>
     </tc:panel>
 
+    <tc:panel>
+      <f:facet name="layout">
+        <tc:gridLayout columns="auto;*"/>
+      </f:facet>
+
+      <tc:label value="Manifest"/>
+
+      <tc:sheet value="#{manifestReader.manifestList}" var="manifest">
+        <tc:column label="URL">
+          <tc:out value="#{manifest.url}"/>
+        </tc:column>
+        <tc:column label="Content">
+          <tc:out value="#{manifest.content}"/>
+        </tc:column>
+      </tc:sheet>
+    </tc:panel>
+
   </tc:panel>
 </ui:composition>