myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r523589 - in /myfaces/tobago/trunk/example/addressbook/src: main/java/org/apache/myfaces/tobago/example/addressbook/ main/java/org/apache/myfaces/tobago/example/addressbook/web/ main/webapp/ main/webapp/WEB-INF/ test/ test/resources/
Date Thu, 29 Mar 2007 06:48:18 GMT
Author: bommel
Date: Wed Mar 28 23:48:18 2007
New Revision: 523589

URL: http://svn.apache.org/viewvc?view=rev&rev=523589
Log:
improve addressbook demo

Added:
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/DerbyShutdownServletContextListener.java
  (with props)
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/AdminController.java
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/jetty-web.xml
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/admin.jsp
    myfaces/tobago/trunk/example/addressbook/src/test/
    myfaces/tobago/trunk/example/addressbook/src/test/resources/
    myfaces/tobago/trunk/example/addressbook/src/test/resources/realm.properties
Modified:
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/web.xml
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp

Added: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/DerbyShutdownServletContextListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/DerbyShutdownServletContextListener.java?view=auto&rev=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/DerbyShutdownServletContextListener.java
(added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/DerbyShutdownServletContextListener.java
Wed Mar 28 23:48:18 2007
@@ -0,0 +1,47 @@
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * 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 org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import java.sql.DriverManager;
+
+/*
+ * User: bommel
+ * Date: Mar 17, 2007
+ * Time: 9:18:20 AM
+ */
+public class DerbyShutdownServletContextListener implements ServletContextListener {
+
+  private static final Log LOG = LogFactory.getLog(DerbyShutdownServletContextListener.class);
+
+  public void contextInitialized(ServletContextEvent servletContextEvent) {
+
+  }
+
+  public void contextDestroyed(ServletContextEvent servletContextEvent) {
+    try {
+      DriverManager.getConnection("jdbc:derby:target/addressDB;shutdown=true");
+    } catch (Exception e) {
+      LOG.error("", e); 
+    }
+  }
+}

Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/DerbyShutdownServletContextListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/AdminController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/AdminController.java?view=auto&rev=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/AdminController.java
(added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/web/AdminController.java
Wed Mar 28 23:48:18 2007
@@ -0,0 +1,39 @@
+package org.apache.myfaces.tobago.example.addressbook.web;
+
+/*
+ * 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 javax.swing.DefaultBoundedRangeModel;
+import javax.swing.BoundedRangeModel;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryUsage;
+
+/*
+ * Date: Mar 28, 2007
+ * Time: 11:20:53 PM
+ */
+public class AdminController {
+
+  public BoundedRangeModel getMemory() {
+    MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+    MemoryUsage memoryUsage = memoryBean.getHeapMemoryUsage();
+
+    return new DefaultBoundedRangeModel(Long.valueOf(memoryUsage.getUsed()/1024).intValue(),
+        0, 0, Long.valueOf(memoryUsage.getMax()/1024).intValue());
+  }
+}

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=523589&r1=523588&r2=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml Wed
Mar 28 23:48:18 2007
@@ -58,6 +58,12 @@
   </managed-bean>
 
   <managed-bean>
+    <managed-bean-name>admin</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.addressbook.web.AdminController</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+  </managed-bean>
+
+  <managed-bean>
     <managed-bean-name>countries</managed-bean-name>
     <managed-bean-class>org.apache.myfaces.tobago.example.addressbook.web.Countries</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>

Added: myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/jetty-web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/jetty-web.xml?view=auto&rev=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/jetty-web.xml (added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/jetty-web.xml Wed Mar
28 23:48:18 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0"  encoding="ISO-8859-1"?>
+<!--
+ * 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.
+-->
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<Configure class="org.mortbay.jetty.webapp.WebAppContext">
+  <Call class="org.mortbay.log.Log" name="debug">
+    <Arg>executing jetty-web.xml</Arg>
+  </Call>
+  <Get name="securityHandler">
+    <Set name="userRealm">
+      <New class="org.mortbay.jetty.security.HashUserRealm">
+	      <Set name="name">Test Realm</Set>
+	      <Set name="config"><SystemProperty name="jetty.home" default="."/>/src/test/resources/realm.properties</Set>
+      </New>
+    </Set>
+  </Get>
+</Configure>
+

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/web.xml?view=diff&rev=523589&r1=523588&r2=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/web.xml Wed Mar 28 23:48:18
2007
@@ -34,6 +34,10 @@
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
 
+  <listener>
+    <listener-class>org.apache.myfaces.tobago.example.addressbook.DerbyShutdownServletContextListener</listener-class>
+  </listener>
+
   <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>/WEB-INF/applicationContext.xml</param-value>

Added: myfaces/tobago/trunk/example/addressbook/src/main/webapp/admin.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/admin.jsp?view=auto&rev=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/admin.jsp (added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/admin.jsp Wed Mar 28 23:48:18
2007
@@ -0,0 +1,42 @@
+<%--
+ * 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.
+--%>
+
+<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<f:view locale="#{controller.language}">
+  <tc:loadBundle basename="resource" var="bundle" />
+
+  <tc:page label="#{bundle.editorTitle}"  state="#{layout}" width="#{layout.width}" height="#{layout.height}"
>
+
+    <tc:panel>
+      <f:facet name="reload">
+        <tc:reload frequency="5000" />
+      </f:facet>
+      <f:facet name="layout">
+        <tc:gridLayout margin="10px" rows="fixed;fixed;1*" columns="300px;1* "/>
+      </f:facet>
+      <tc:label value="Memory:" />
+      <tc:cell/>
+      <tc:progress value="#{admin.memory}" />   
+      <tc:cell/>
+      <tc:label value="Current: #{admin.memory.value}kB Max: #{admin.memory.maximum}kB"
/>
+      <tc:cell/>
+    </tc:panel>
+  </tc:page>
+</f:view>
\ No newline at end of file

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp?view=diff&rev=523589&r1=523588&r2=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp Wed Mar 28 23:48:18
2007
@@ -82,15 +82,15 @@
 
         <tc:sheet columns="1*;1*;1*" value="#{controller.currentAddressList}"
             var="address" state="#{controller.selectedAddresses}">
-          <tc:column label="#{bundle.listFirstName}" sortable="true"
+          <tc:column id="firstName" label="#{bundle.listFirstName}" sortable="true"
                      rendered="#{controller.renderFirstName}">
             <tc:out value="#{address.firstName}" />
           </tc:column>
-          <tc:column label="#{bundle.listLastName}" sortable="true"
+          <tc:column id="lastName" label="#{bundle.listLastName}" sortable="true"
                      rendered="#{controller.renderLastName}">
             <tc:out value="#{address.lastName}" />
           </tc:column>
-          <tc:column label="Birthday" sortable="true"
+          <tc:column id="dayOfBirth" label="Birthday" sortable="true"
                      rendered="#{controller.renderDayOfBirth}">
             <tc:out value="#{address.dayOfBirth}">
               <f:convertDateTime pattern="dd.MM.yyyy" />

Added: myfaces/tobago/trunk/example/addressbook/src/test/resources/realm.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/test/resources/realm.properties?view=auto&rev=523589
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/test/resources/realm.properties (added)
+++ myfaces/tobago/trunk/example/addressbook/src/test/resources/realm.properties Wed Mar 28
23:48:18 2007
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+guest: guest,read-only
+
+
+



Mime
View raw message