cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomek...@apache.org
Subject svn commit: r983373 - in /cxf/sandbox/logbrowser: distribution/src/main/release/samples/logbrowser/ distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/ distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/ dist...
Date Sun, 08 Aug 2010 09:47:25 GMT
Author: tomekopo
Date: Sun Aug  8 09:47:23 2010
New Revision: 983373

URL: http://svn.apache.org/viewvc?rev=983373&view=rev
Log:
- Added ID to Subscription class (on the client and server side). ID is UUID. It fixed bug
with adding or editing subscription on settings tab;
- Removed milliseconds in datetime;
- Removed Generate class (in sample) and related piece of code;
- Added more logging in CustomerService (in sample) with wide range of levels: DEBUG, INFO,
WARNING and ERROR;
- Fixed AtomPullServer logging configuration to log only log entries from sample (and block
anything else);
- Fixed bug with parallel registering services as per request and as singletons;
- Invert order of presenting log entries in browser tab;

Added:
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGenerator.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGeneratorImpl.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/resources/uuid.min.js
Removed:
    cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/Generate.java
Modified:
    cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/logging.properties
    cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/App.java
    cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/CustomerService.java
    cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/WEB-INF/web.xml
    cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/generate.html
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/LogBrowser.gwt.xml
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/SimpleXMLSettingsStorage.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/Subscription.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/browser/Feed.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/LocalStorageImpl.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/RemoteStorageProxyImpl.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/SettingsFacade.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/Subscription.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SettingsPresenter.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialog.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialogImpl.java

Modified: cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/logging.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/logging.properties?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/logging.properties
(original)
+++ cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/logging.properties
Sun Aug  8 09:47:23 2010
@@ -22,6 +22,6 @@ handlers = java.util.logging.ConsoleHand
 java.util.logging.ConsoleHandler.level = FINE
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
 
-demo.logbrowser.servlet.Generate.level = FINE
+demo.logbrowser.level = FINE
 org.apache.cxf.interceptor.LoggingInInterceptor.level = INFO
 org.apache.cxf.interceptor.LoggingOutInterceptor.level = INFO

Modified: cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/App.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/App.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/App.java
(original)
+++ cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/App.java
Sun Aug  8 09:47:23 2010
@@ -19,6 +19,7 @@
 
 package demo.logbrowser;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
@@ -38,7 +39,7 @@ public class App extends Application {
 
     static {
         LOGS = new AtomPullServer();
-        LOGS.setLoggers("demo, org.apache.cxf");
+        LOGS.setLoggers("demo.logbrowser:DEBUG,org.apache.cxf.interceptor:INFO");
         LOGS.init();
     }
 
@@ -63,15 +64,7 @@ public class App extends Application {
 
     @Override
     public Set<Class<?>> getClasses() {
-        Set<Class<?>> classes = new HashSet<Class<?>>();
-        classes.add(AtomPullServer.class);
-        classes.add(AtomFeedProvider.class);
-        classes.add(AtomEntryProvider.class);
-        classes.add(BootstrapStorage.class);
-        classes.add(SimpleAuthenticationFilter.class);
-        classes.add(BootstrapStorage.StaticFileProvider.class);
-        classes.add(BootstrapStorage.SettingsProvider.class);
-        return classes;
+        return Collections.emptySet();
     }
 
     @Override

Modified: cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/CustomerService.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/CustomerService.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/CustomerService.java
(original)
+++ cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/src/demo/logbrowser/servlet/CustomerService.java
Sun Aug  8 09:47:23 2010
@@ -22,7 +22,7 @@ package demo.logbrowser.servlet;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Logger;
-import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.*;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -49,9 +49,15 @@ public class CustomerService {
         Validate.notNull(id);
         Validate.notEmpty(id);
         
-        LOGGER.log(INFO, "Invoking 'getCustomer', id='{0}'", id);
+        LOGGER.log(FINE, "Invoking getCustomer, id={0}", id);
 
-        return customers.get(Long.parseLong(id));
+        Customer customer = customers.get(Long.parseLong(id));
+
+        if (customer == null) {
+            LOGGER.log(SEVERE, "Specified customer does not exist, id={0}", id);    
+        }
+
+        return customer;
     }
 
     @POST
@@ -59,15 +65,17 @@ public class CustomerService {
     public Response updateCustomer(final Customer customer) {
         Validate.notNull(customer);
 
-        LOGGER.log(INFO, "Invoking 'updateCustomer', customer='{0}'", customer);
+        LOGGER.log(FINE, "Invoking updateCustomer, customer={0}", customer);
 
         if (isCustomerExisted(customer)) {
-            LOGGER.log(INFO, "Specified customer exists, update data, customer='{0}'", customer);
+            LOGGER.log(FINE, "Specified customer exists, update data, customer={0}", customer);
         } else {
-            LOGGER.log(INFO, "Specified customer doesn't exist, add data, customer='{0}'",
customer);
+            LOGGER.log(WARNING, "Specified customer does not exist, add data, customer={0}",
customer);
         }
 
         customers.put(customer.getId(), customer);
+
+        LOGGER.log(INFO, "Customer was updated successful, customer={0}", customer);
         return Response.ok().build();
     }
 
@@ -77,16 +85,19 @@ public class CustomerService {
         Validate.notNull(id);
         Validate.notEmpty(id);
         
-        LOGGER.log(INFO, "Invoking 'deleteCustomer', id='{0}'", id);
+        LOGGER.log(FINE, "Invoking deleteCustomer, id={0}", id);
 
         long identifier = Long.parseLong(id);
 
         Response response;
 
         if (isCustomerExisted(identifier)) {
-            response = Response.ok().build();
+            LOGGER.log(FINE, "Specified customer exists, remove data, id={0}", id);
             customers.remove(identifier);
+            LOGGER.log(INFO, "Customer was removed successful, id={0}", id);
+            response = Response.ok().build();
         } else {
+            LOGGER.log(SEVERE, "Specified customer does not exist, remove fail, id={0}",
id);
             response = Response.notModified().build();
         }
 

Modified: cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/WEB-INF/web.xml?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/WEB-INF/web.xml
(original)
+++ cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/WEB-INF/web.xml
Sun Aug  8 09:47:23 2010
@@ -25,43 +25,19 @@
 <!-- START SNIPPET: webxml -->
 <web-app>
 
-	<servlet>
-		<servlet-name>Generate</servlet-name>
-		<display-name>Generate log entry</display-name>
-		<servlet-class>
-			demo.logbrowser.servlet.Generate
-		</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-
-	<servlet>
-		<servlet-name>App</servlet-name>
-		<display-name>App</display-name>
-		<servlet-class>
-			org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
-		</servlet-class>
-		<init-param>
-			<param-name>javax.ws.rs.Application</param-name>
-			<param-value>
-                demo.logbrowser.App
-            </param-value>
-		</init-param>
-
-		<load-on-startup>2</load-on-startup>
-	</servlet>
-
-	<servlet>
-		<servlet-name>CustomerService</servlet-name>
-		<display-name>CustomerService</display-name>
-		<servlet-class>
-			org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
-		</servlet-class>
-		<init-param>
-			<param-name>jaxrs.serviceClasses</param-name>
-			<param-value>
+    <servlet>
+        <servlet-name>CustomerService</servlet-name>
+        <display-name>CustomerService</display-name>
+        <servlet-class>
+            org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
+        </servlet-class>
+        <init-param>
+            <param-name>jaxrs.serviceClasses</param-name>
+            <param-value>
                 demo.logbrowser.servlet.CustomerService
             </param-value>
-		</init-param>
+        </init-param>
+
         <init-param>
             <param-name>jaxrs.inInterceptors</param-name>
             <param-value>
@@ -76,13 +52,25 @@
             </param-value>
         </init-param>
 
-		<load-on-startup>3</load-on-startup>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+	<servlet>
+		<servlet-name>App</servlet-name>
+		<display-name>App</display-name>
+		<servlet-class>
+			org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
+		</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>
+                demo.logbrowser.App
+            </param-value>
+		</init-param>
+
+		<load-on-startup>2</load-on-startup>
 	</servlet>
 
-	<servlet-mapping>
-		<servlet-name>Generate</servlet-name>
-		<url-pattern>/generate.do</url-pattern>
-	</servlet-mapping>
 
 	<servlet-mapping>
 		<servlet-name>App</servlet-name>

Modified: cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/generate.html
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/generate.html?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/generate.html
(original)
+++ cxf/sandbox/logbrowser/distribution/src/main/release/samples/logbrowser/webapp/generate.html
Sun Aug  8 09:47:23 2010
@@ -171,40 +171,5 @@
         <p class="submit"><a id="deleteCustomerButton" href="#">Delete</a></p>
     </form>
 </div>
-
-<hr/>
-
-<div>
-    <h1>Generate custom log entry</h1>
-    <form action="generate.do" method="get">
-        <p>
-            <label for="level">Level:</label>
-            <select id="level" name="level">
-                <option value="debug">DEBUG</option>
-                <option value="info">INFO</option>
-                <option value="warning">WARNING</option>
-                <option value="error">ERROR</option>
-            </select>
-        </p>
-
-        <p>
-            <label >Copies:</label>
-            <input name="copies" class="digits" type="text" size="2" value="1"/>
-        </p>
-
-        <p>
-            <label for="message">Message:</label>
-            <textarea id="message" name="message" rows="10" cols="50"></textarea>
-        </p>
-
-        <p>
-            <label for="exceptionMessage">Exception message:</label>
-            <textarea id="exceptionMessage" name="exceptionMessage" rows="5" cols="50"></textarea>
-        </p>
-
-        <p class="submit"><input type="submit" value="Generate"/></p>
-    </form>
-</div>
-
 </body>
 </html>
\ No newline at end of file

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/LogBrowser.gwt.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/LogBrowser.gwt.xml?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/LogBrowser.gwt.xml
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/LogBrowser.gwt.xml
Sun Aug  8 09:47:23 2010
@@ -27,6 +27,7 @@
     <inherits name="com.google.gwt.xml.XML"/>
     <inherits name='com.google.gwtexpui.user.User'/>
 
+    <script src="uuid.min.js" />
     <script src="json2.min.js" />
     <script src="jstorage.config.js" />
     <script src="jstorage.min.js" />

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/SimpleXMLSettingsStorage.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/SimpleXMLSettingsStorage.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/SimpleXMLSettingsStorage.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/SimpleXMLSettingsStorage.java
Sun Aug  8 09:47:23 2010
@@ -22,6 +22,7 @@ package org.apache.cxf.management.web.lo
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.GregorianCalendar;
 import java.util.List;
@@ -98,12 +99,23 @@ public class SimpleXMLSettingsStorage im
             entries.getEntries().add(new Entry(username, getCurrentTime(), settings));
         }
 
+        FileOutputStream outputStream = null;
+
         try {
-            marshaller.marshal(entries, new FileOutputStream(filename));
+            outputStream = new FileOutputStream(filename);
+            marshaller.marshal(entries, outputStream);
         } catch (JAXBException e) {
             throw new RuntimeException(e);
         } catch (FileNotFoundException e) {
             throw new RuntimeException(e);
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+            }
         }
     }
 
@@ -147,8 +159,7 @@ public class SimpleXMLSettingsStorage im
         private String username;
         private XMLGregorianCalendar modified;
 
-        Entry() {
-        }
+        private Entry() { }
 
         Entry(final String username, final XMLGregorianCalendar modified, final Settings
settings) {
             this.settings = settings;

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/Subscription.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/Subscription.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/Subscription.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/bootstrapping/Subscription.java
Sun Aug  8 09:47:23 2010
@@ -21,10 +21,20 @@ package org.apache.cxf.management.web.lo
 
 import javax.xml.bind.annotation.XmlElement;
 
-public class Subscription {    
+public class Subscription {
+    private String id;
     private String name;
     private String url;
-                
+
+    @XmlElement(required = true, namespace = "http://cxf.apache.org/log")
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
     @XmlElement(required = true, namespace = "http://cxf.apache.org/log")
     public String getName() {
         return name;

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/Module.java
Sun Aug  8 09:47:23 2010
@@ -21,6 +21,8 @@ package org.apache.cxf.management.web.lo
 
 import com.google.gwt.inject.client.AbstractGinModule;
 
+import org.apache.cxf.management.web.logging.logbrowser.client.service.settings.IdentifierGenerator;
+import org.apache.cxf.management.web.logging.logbrowser.client.service.settings.IdentifierGeneratorImpl;
 import org.apache.cxf.management.web.logging.logbrowser.client.service.settings.LocalStorage;
 import org.apache.cxf.management.web.logging.logbrowser.client.service.settings.LocalStorageImpl;
 import org.apache.cxf.management.web.logging.logbrowser.client.service.settings.RemoteStorageProxy;
@@ -39,6 +41,7 @@ public class Module extends AbstractGinM
     @Override
     protected void configure() {
         bind(EventBus.class).to(DefaultEventBus.class);
+        bind(IdentifierGenerator.class).to(IdentifierGeneratorImpl.class);
         bind(AccessControlView.class).to(AccessControlViewImpl.class);
         bind(SettingsView.class).to(SettingsViewImpl.class);
         bind(SubscriptionDialog.class).to(SubscriptionDialogImpl.class);

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/browser/Feed.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/browser/Feed.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/browser/Feed.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/browser/Feed.java
Sun Aug  8 09:47:23 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.management.web.logging.logbrowser.client.service.browser;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import javax.annotation.Nonnull;
@@ -80,6 +81,7 @@ public class Feed {
                         entries.add(new Entry(entryNodes.item(i)));
                     }
                 }
+                Collections.reverse(entries);
             }
         }
     }

Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGenerator.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGenerator.java?rev=983373&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGenerator.java
(added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGenerator.java
Sun Aug  8 09:47:23 2010
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.management.web.logging.logbrowser.client.service.settings;
+
+public interface IdentifierGenerator {
+    String generateUUID();
+}

Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGeneratorImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGeneratorImpl.java?rev=983373&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGeneratorImpl.java
(added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/IdentifierGeneratorImpl.java
Sun Aug  8 09:47:23 2010
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.management.web.logging.logbrowser.client.service.settings;
+
+public class IdentifierGeneratorImpl implements IdentifierGenerator {
+
+    public final native String generateUUID() /*-{
+        return $wnd.Math.uuid();
+    }-*/;
+}

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/LocalStorageImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/LocalStorageImpl.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/LocalStorageImpl.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/LocalStorageImpl.java
Sun Aug  8 09:47:23 2010
@@ -81,8 +81,7 @@ public class LocalStorageImpl implements
 
     private static final class Converter {
 
-        private Converter() {
-        }
+        private Converter() { }
 
         @Nullable
         public static Settings convertToSettings(@Nullable final LocalSettings src) {
@@ -118,11 +117,10 @@ public class LocalStorageImpl implements
                 return null;
             }
 
-            return new Subscription(src.getName(), src.getURL());
+            return new Subscription(src.getId(), src.getName(), src.getURL());
         }
 
-        @SuppressWarnings("unchecked")
-        @Nullable
+        @SuppressWarnings("unchecked") @Nullable
         public static LocalSettings convertToLocalSettings(@Nullable final Settings src)
{
             if (src == null) {
                 return null;
@@ -167,6 +165,7 @@ public class LocalStorageImpl implements
 
             LocalSubscription dst = (LocalSubscription) JavaScriptObject.createObject();
 
+            dst.setId(src.getId());
             dst.setName(src.getName());
             dst.setURL(src.getUrl());
 
@@ -176,8 +175,7 @@ public class LocalStorageImpl implements
 
     public static class LocalSettings extends JavaScriptObject {
 
-        protected LocalSettings() {
-        }
+        protected LocalSettings() { }
     
         public final native void setCredentials(@Nullable final LocalCredentials credentials)
/*-{
             this.credentials = credentials;
@@ -204,8 +202,7 @@ public class LocalStorageImpl implements
 
     private static class LocalCredentials extends JavaScriptObject {
 
-        protected LocalCredentials() {
-        }
+        protected LocalCredentials() { }
 
         public final native void setUsername(@Nullable final String username) /*-{
             this.username = username;
@@ -228,8 +225,16 @@ public class LocalStorageImpl implements
 
     private static class LocalSubscription extends JavaScriptObject {
 
-        protected LocalSubscription() {
-        }
+        protected LocalSubscription() { }
+
+        public final native void setId(@Nullable final String id) /*-{
+            this.id = id;
+        }-*/;
+
+        @Nullable
+        public final native String getId() /*-{
+            return this.id;
+        }-*/;
 
         public final native void setName(@Nullable final String name) /*-{
             this.name = name;

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/RemoteStorageProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/RemoteStorageProxyImpl.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/RemoteStorageProxyImpl.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/RemoteStorageProxyImpl.java
Sun Aug  8 09:47:23 2010
@@ -160,6 +160,15 @@ public class RemoteStorageProxyImpl impl
         protected RemoteSubscription() {
         }
 
+        public final native void setId(@Nullable final String id) /*-{
+            this.id = id;
+        }-*/;
+
+        @Nullable
+        public final native String getId() /*-{
+            return this.id;
+        }-*/;
+
         public final native void setUrl(@Nullable final String url) /*-{
             this.url = url;
         }-*/;
@@ -198,7 +207,8 @@ public class RemoteStorageProxyImpl impl
 
         @Nonnull
         public static Subscription convertToSubscription(@Nonnull RemoteSubscription remoteSubscription)
{
-            return new Subscription(remoteSubscription.getName(), remoteSubscription.getUrl());
+            return new Subscription(remoteSubscription.getId(),
+                remoteSubscription.getName(), remoteSubscription.getUrl());
         }
 
         @SuppressWarnings("unchecked") @Nonnull
@@ -221,6 +231,7 @@ public class RemoteStorageProxyImpl impl
         public static RemoteSubscription convertToRemoteSubscription(@Nonnull Subscription
subscription) {
             RemoteSubscription remoteSubscription = (RemoteSubscription) JavaScriptObject.createObject();
 
+            remoteSubscription.setId(subscription.getId());
             remoteSubscription.setName(subscription.getName());
             remoteSubscription.setUrl(subscription.getUrl());
 
@@ -258,12 +269,10 @@ public class RemoteStorageProxyImpl impl
     public static class NoActionCallback extends AbstractCallback<Settings> {
 
         @Override
-        public void onAccessDenied() {
-        }
+        public void onAccessDenied() { }
 
         @Override
-        public void onSuccess(@Nullable final Settings obj) {
-        }
+        public void onSuccess(@Nullable final Settings obj) { }
 
         @Override @Nullable
         protected Settings parse(@Nonnull final Response response) {

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/SettingsFacade.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/SettingsFacade.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/SettingsFacade.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/SettingsFacade.java
Sun Aug  8 09:47:23 2010
@@ -46,7 +46,10 @@ public class SettingsFacade {
 
     @Nullable
     private StorageLayer storageLayer;
-    
+
+    @Nonnull
+    private final IdentifierGenerator identifierGenerator;
+
     private boolean initialized;
 
     public enum StorageStrategy {
@@ -57,10 +60,12 @@ public class SettingsFacade {
     @Inject
     public SettingsFacade(@Nonnull final RemoteStorageProxy remoteStorage,
                           @Nonnull final LocalStorage localStorage,
-                          @Nonnull final EventBus eventBus) {
+                          @Nonnull final EventBus eventBus,
+                          @Nonnull final IdentifierGenerator identifierGenerator) {
         this.remoteStorage = remoteStorage;
         this.localStorage = localStorage;
         this.eventBus = eventBus;
+        this.identifierGenerator = identifierGenerator;
     }
 
     public boolean isSettingsAlreadyInLocalStorage() {
@@ -79,6 +84,19 @@ public class SettingsFacade {
         initialized = false;
     }
 
+    public void addSubscription(@Nonnull final String name, @Nonnull final String url) {
+        assert !"".equals(name);
+        assert !"".equals(url);
+        assert storageLayer != null;
+        isValid();
+
+        String id = identifierGenerator.generateUUID();
+        assert id != null && !"".equals(id);
+
+        storageLayer.getSettings().getSubscriptions().add(new Subscription(id, name, url));
+        storageLayer.update();
+    }
+
     public void updateSubscription(@Nonnull final Subscription subscription) {
         assert subscription.getUrl() != null && !"".equals(subscription.getUrl());
         assert storageLayer != null;

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/Subscription.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/Subscription.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/Subscription.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/service/settings/Subscription.java
Sun Aug  8 09:47:23 2010
@@ -22,18 +22,26 @@ package org.apache.cxf.management.web.lo
 import javax.annotation.Nonnull;
 
 public class Subscription {
+    private String id;
     private String name;
     private String url;
 
-    public Subscription(@Nonnull final String name, @Nonnull final String url) {
+    public Subscription(@Nonnull final String id, @Nonnull final String name, @Nonnull final
String url) {
+        assert !"".equals(id);
         assert !"".equals(name);
         assert !"".equals(url);
 
+        this.id = id;
         this.name = name;
         this.url = url;
     }
 
     @Nonnull
+    public String getId() {
+        return id;
+    }
+
+    @Nonnull
     public String getName() {
         return name;
     }
@@ -52,9 +60,9 @@ public class Subscription {
             return false;
         }
 
-        Subscription that = (Subscription) o;
+        Subscription that = (Subscription)o;
 
-        if (url != null ? !url.equals(that.url) : that.url != null) {
+        if (id != null ? !id.equals(that.id) : that.id != null) {
             return false;
         }
 
@@ -63,6 +71,6 @@ public class Subscription {
 
     @Override
     public int hashCode() {
-        return url != null ? url.hashCode() : 0;
+        return id != null ? id.hashCode() : 0;
     }
 }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/BrowseViewImpl.java
Sun Aug  8 09:47:23 2010
@@ -51,7 +51,7 @@ import static org.apache.cxf.management.
 
 public class BrowseViewImpl extends Composite implements BrowseView {
     private static final DateTimeFormat DT_FORMATTER =
-        DateTimeFormat.getFormat("HH:mm:ss.SSS dd.MM.yyyy");
+        DateTimeFormat.getFormat("HH:mm:ss dd.MM.yyyy");
 
     @UiTemplate("BrowseView.ui.xml")
     interface BrowseViewUiBinder extends UiBinder<Widget, BrowseViewImpl> { }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SettingsPresenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SettingsPresenter.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SettingsPresenter.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SettingsPresenter.java
Sun Aug  8 09:47:23 2010
@@ -88,15 +88,21 @@ public class SettingsPresenter extends B
         updateSubscriptions();
     }
 
-    public void onSaveButtonClicked(@Nonnull final HasValue<String> name,
+    public void onSaveButtonClicked(@Nullable final String id,
+                                    @Nonnull final HasValue<String> name,
                                     @Nonnull final HasValue<String> url) {
         Map<HasValue, String> errors = validate(name, url);
 
         if (errors.isEmpty()) {
             String nameValue = name.getValue();
             String urlValue = url.getValue();
-            
-            settingsFacade.updateSubscription(new Subscription(nameValue, urlValue));
+
+            if (id == null) {
+                settingsFacade.addSubscription(nameValue, urlValue);
+            } else {
+                settingsFacade.updateSubscription(new Subscription(id, nameValue, urlValue));
+            }
+
             updateSubscriptions();
             subscriptionDialog.hide();
         } else {

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialog.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialog.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialog.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialog.java
Sun Aug  8 09:47:23 2010
@@ -29,7 +29,7 @@ public interface SubscriptionDialog {
 
     public interface Presenter {
 
-        void onSaveButtonClicked(HasValue<String> name, HasValue<String> url);
+        void onSaveButtonClicked(String id, HasValue<String> name, HasValue<String>
url);
 
         void onCancelButtonClicked();
     }

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialogImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialogImpl.java?rev=983373&r1=983372&r2=983373&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialogImpl.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/settings/SubscriptionDialogImpl.java
Sun Aug  8 09:47:23 2010
@@ -47,6 +47,9 @@ public class SubscriptionDialogImpl exte
     @Nullable
     private Presenter presenter;
 
+    @Nullable
+    private String subscriptionId;
+
     public SubscriptionDialogImpl() {
         form = new Form();
         form.nameErrorLabel.setVisible(false);
@@ -63,7 +66,7 @@ public class SubscriptionDialogImpl exte
 
             public void onClick(@Nonnull final ClickEvent clickEvent) {
                 assert presenter != null;
-                presenter.onSaveButtonClicked(form.nameTextBox, form.urlTextBox);
+                presenter.onSaveButtonClicked(subscriptionId, form.nameTextBox, form.urlTextBox);
             }
         });
 
@@ -98,9 +101,11 @@ public class SubscriptionDialogImpl exte
         if (subscription == null) {
             form.nameTextBox.setValue("");
             form.urlTextBox.setValue("");
+            subscriptionId = null;
         } else {
             form.nameTextBox.setValue(subscription.getName());
             form.urlTextBox.setValue(subscription.getUrl());
+            subscriptionId = subscription.getId();
         }
     }
 

Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/resources/uuid.min.js
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/resources/uuid.min.js?rev=983373&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/resources/uuid.min.js
(added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/resources/uuid.min.js
Sun Aug  8 09:47:23 2010
@@ -0,0 +1,9 @@
+/*
+Math.uuid.js (v1.4)
+http://www.broofa.com
+mailto:robert@broofa.com
+
+Copyright (c) 2010 Robert Kieffer
+Dual licensed under the MIT and GPL licenses.
+*/
+(function(){var c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");Math.uuid=function(f,d){var
a=[];d=d||c.length;if(f)for(var b=0;b<f;b++)a[b]=c[0|Math.random()*d];else{var e;a[8]=a[13]=a[18]=a[23]="-";a[14]="4";for(b=0;b<36;b++)if(!a[b]){e=0|Math.random()*16;a[b]=c[b==19?e&3|8:e]}}return
a.join("")}})();
\ No newline at end of file



Mime
View raw message