cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1067233 [4/7] - in /cxf/trunk: distribution/src/main/release/samples/ distribution/src/main/release/samples/logbrowser/ distribution/src/main/release/samples/logbrowser/src/ distribution/src/main/release/samples/logbrowser/src/demo/ distri...
Date Fri, 04 Feb 2011 17:34:28 GMT
Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/event/SignOutEventHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/event/SignOutEventHandler.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/event/SignOutEventHandler.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/event/SignOutEventHandler.java Fri Feb  4 17:34:24 2011
@@ -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.browser.client.event;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface SignOutEventHandler extends EventHandler {
+    void onSignOut(SignOutEvent event);
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/event/SignOutEventHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/event/SignOutEventHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/AbstractCallback.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/AbstractCallback.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/AbstractCallback.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/AbstractCallback.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,55 @@
+/**
+ * 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.browser.client.service;
+
+import javax.annotation.Nonnull;
+
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.Response;
+
+public abstract class AbstractCallback<T> implements RequestCallback {
+    private static final int OK = 200;
+    private static final int UNAUTHORIZED = 401;
+
+    public void onResponseReceived(@Nonnull final Request request, @Nonnull final Response response) {
+        if (OK == response.getStatusCode()) {
+            onSuccess(parse(response));
+        } else if (UNAUTHORIZED == response.getStatusCode()) {
+            onAccessDenied();
+        } else {
+            
+            // TODO add custom exception
+            onError(request, new RuntimeException("Undefined remote service error"));
+        }
+    }
+
+    public void onError(final Request request, final Throwable ex) {
+
+        // TODO add custom exception
+        throw new RuntimeException(ex);
+    }
+
+    public abstract void onAccessDenied();
+
+    public abstract void onSuccess(T obj);
+
+    protected abstract T parse(Response response);    
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/AbstractCallback.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/AbstractCallback.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Entry.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Entry.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Entry.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Entry.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,218 @@
+/**
+ * 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.browser.client.service.browser;
+
+import java.util.Date;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.xml.client.Element;
+import com.google.gwt.xml.client.Node;
+import com.google.gwt.xml.client.NodeList;
+
+import static com.google.gwt.xml.client.Node.*;
+
+/**
+ * The class represents log record, which is parsed from DOM representation of {@link LogRecord}.
+ * <p/>
+ * Log record is single piece of information log by logger. For example:
+ * <code>
+ * <p/>
+ * </code>
+ *
+ * @see FeedProxy
+ */
+public class Entry {
+
+    /**
+     * short message
+     */
+    private String title;
+
+    /**
+     * long message
+     */
+    private String message;
+
+    /**
+     * level: 'DEBUG', 'INFO', 'WARN', 'ERROR'
+     */
+    private String level;
+
+    /**
+     * error message and stack trace related with occured exception
+     */
+    private String throwable;
+
+    /**
+     * date of occured
+     */
+    private Date eventTimestamp;
+
+    @Nonnull
+    private final LazyXmlParser xmlParser;
+
+    /**
+     * Constructs a new <code>Entry</code> by convert DOM representation.
+     *
+     * @param entryNode XML node which represent entry (nonnull);
+     */
+    public Entry(@Nonnull final Node entryNode) {
+        xmlParser = new LazyXmlParser(entryNode);
+    }
+
+    /**
+     * Returns short message of the log record.
+     *
+     * @return short message (nonull)
+     */
+    @Nonnull
+    public String getTitle() {
+        if (title == null) {
+            title = avoidNull(xmlParser.getTitle());
+        }
+        return title;
+    }
+
+    /**
+     * Returns long message of the log record.
+     *
+     * @return long message (nonull)
+     */
+    @Nonnull
+    public String getMessage() {
+        if (message == null) {
+            message = avoidNull(xmlParser.getMessage());
+        }
+        return message;
+    }
+
+    /**
+     * Returns level of the log record. Possible values: 'DEBUG', 'INFO', 'WARN', 'ERROR'.
+     *
+     * @return level (nonull)
+     */
+    @Nonnull
+    public String getLevel() {
+        if (level == null) {
+            level = avoidNull(xmlParser.getLevel());
+        }
+
+        return level;
+    }
+
+    /**
+     * Returns error message and stack trace related with occured exception.
+     *
+     * @return error message and stack trace (nonull)
+     */
+    @Nonnull
+    public String getThrowable() {
+        if (throwable == null) {
+            throwable = avoidNull(xmlParser.getThrowable());
+        }
+        return throwable;
+    }
+
+    @Nullable
+    public Date getEventTimestamp() {
+        if (eventTimestamp == null) {
+            eventTimestamp = xmlParser.getEventTimestamp();
+        }
+        return eventTimestamp != null ? (Date)eventTimestamp.clone() : null;
+    }
+
+    @Nonnull
+    private String avoidNull(@Nullable final String value) {
+        return value != null ? value : "";
+    }
+
+    private static class LazyXmlParser {
+        private static final String TITLE_TAG = "title";
+        private static final String MESSAGE_TAG = "message";
+        private static final String LEVEL_TAG = "level";
+        private static final String THROWABLE_TAG = "throwable";
+        private static final String EVENT_TIMESTAMP_TAG = "eventTimestamp";
+
+        private static final DateTimeFormat DATETIME_FORMATTER =
+            DateTimeFormat.getFormat("yyyy-MM-ddTHH:mm:ss'.'SSSZ");
+
+        @Nonnull
+        private final Node entryNode;
+
+        public LazyXmlParser(@Nonnull final Node entryNode) {
+            assert "entry".equals(entryNode.getNodeName());
+            assert entryNode.getNodeType() == ELEMENT_NODE;
+
+            this.entryNode = entryNode;
+        }
+
+        @Nullable
+        private String getTagValue(@Nonnull final String tagName) {
+            Node node = getUniqueElementByTagName(tagName);
+
+            return node != null ? getTextValue(node) : null;
+        }
+
+        @Nullable
+        private Node getUniqueElementByTagName(@Nonnull final String tagName) {
+            NodeList nodes = ((Element)entryNode).getElementsByTagName(tagName);
+            return nodes.getLength() == 1 ? nodes.item(0) : null;
+        }
+
+        @Nullable
+        private String getTextValue(@Nonnull final Node node) {
+            Node child = node.getFirstChild();
+
+            if (child != null && child.getNodeType() == TEXT_NODE) {
+                return child.getNodeValue();
+            }
+
+            return null;
+        }
+
+        @Nullable
+        public String getTitle() {
+            return getTagValue(TITLE_TAG);
+        }
+
+        @Nullable
+        public String getMessage() {
+            return getTagValue(MESSAGE_TAG);
+        }
+
+        @Nullable
+        public String getLevel() {
+            return getTagValue(LEVEL_TAG);
+        }
+
+        @Nullable
+        public String getThrowable() {
+            return getTagValue(THROWABLE_TAG);
+        }
+
+        @Nullable
+        public Date getEventTimestamp() {
+            String value = getTagValue(EVENT_TIMESTAMP_TAG);
+            return value != null ? DATETIME_FORMATTER.parse(value) : null;
+        }
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Entry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Entry.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Feed.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Feed.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Feed.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Feed.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,88 @@
+/**
+ * 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.browser.client.service.browser;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+
+import com.google.gwt.xml.client.Document;
+import com.google.gwt.xml.client.Node;
+import com.google.gwt.xml.client.NodeList;
+
+import static com.google.gwt.xml.client.Node.ELEMENT_NODE;
+
+public class Feed {
+    public static final Feed EMPTY = new Feed();
+
+    @Nonnull
+    private final List<Entry> entries;
+
+    @Nonnull
+    private final Links links;
+
+    private Feed() {
+        entries = new ArrayList<Entry>();
+        links = Links.EMPTY;
+    }
+
+    public Feed(@Nonnull final Document document) {
+        entries = new ArrayList<Entry>();
+        new XmlParser().parseEntries(document);
+
+        links = new Links(document);
+    }
+
+    @Nonnull
+    public List<Entry> getEntries() {
+        return entries;
+    }
+
+    @Nonnull
+    public Links getLinks() {
+        return links;
+    }
+
+    private final class XmlParser {
+        private static final String ENTRY_TAG = "entry";
+
+        private XmlParser() {
+        }
+
+        private void parseEntries(@Nonnull final Document document) {
+            NodeList entryNodes = document.getElementsByTagName(ENTRY_TAG);
+
+            if (entryNodes != null) {
+                Node entryNode;
+                for (int i = 0; i < entryNodes.getLength(); i++) {
+                    entryNode = entryNodes.item(i);
+                    assert entryNode != null;
+                    
+                    if (entryNode.getNodeType() == ELEMENT_NODE) {
+                        entries.add(new Entry(entryNodes.item(i)));
+                    }
+                }
+                Collections.reverse(entries);
+            }
+        }
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Feed.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Feed.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxy.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxy.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxy.java Fri Feb  4 17:34:24 2011
@@ -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.browser.client.service.browser;
+
+import com.google.gwt.http.client.RequestCallback;
+
+public interface FeedProxy {
+    void getFeed(String url, RequestCallback callback);
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxyImpl.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxyImpl.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxyImpl.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,86 @@
+/**
+ * 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.browser.client.service.browser;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.xml.client.Document;
+import com.google.gwt.xml.client.XMLParser;
+
+import static com.google.gwt.http.client.RequestBuilder.GET;
+import static com.google.gwt.http.client.RequestBuilder.Method;
+
+import org.apache.cxf.management.web.browser.client.service.AbstractCallback;
+
+public class FeedProxyImpl implements FeedProxy {
+    private static final String CONTENT_TYPE_HEADER = "Content-Type";
+    private static final String ACCEPT_HEADER = "Accept";
+    private static final String ATOM_TYPE = "application/atom+xml";
+
+    public void getFeed(@Nonnull final String url, @Nonnull final RequestCallback callback) {
+        RequestBuilder builder = buildRequest(GET, url);
+
+        try {
+            builder.sendRequest(null, callback);
+        } catch (RequestException ex) {
+
+            // TODO add custom exception
+            throw new RuntimeException(ex);
+        }
+    }
+
+    @Nonnull
+    private RequestBuilder buildRequest(@Nonnull final Method method, @Nonnull final String url) {
+        assert !"".equals(url);
+        
+        RequestBuilder builder = new RequestBuilder(method, url);
+        builder.setHeader(CONTENT_TYPE_HEADER, ATOM_TYPE);
+        builder.setHeader(ACCEPT_HEADER, ATOM_TYPE);
+
+        return builder;
+    }
+
+    public abstract static class Callback extends AbstractCallback<Feed> {
+        
+        @Override @Nonnull
+        protected Feed parse(@Nonnull final Response response) {
+            Document document = convertFromXML(response);
+            if (document != null) {
+                return new Feed(document);
+            } else {
+                return Feed.EMPTY;
+            }
+        }
+
+        @Nullable
+        private Document convertFromXML(@Nonnull final Response response) {
+            if (response.getText() != null) {
+                return XMLParser.parse(response.getText());
+            } else {
+                return null;
+            }
+        }
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxyImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/FeedProxyImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Links.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Links.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Links.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Links.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,159 @@
+/**
+ * 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.browser.client.service.browser;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.gwt.xml.client.Document;
+import com.google.gwt.xml.client.Node;
+import com.google.gwt.xml.client.NodeList;
+
+public class Links {
+    public static final Links EMPTY = new Links();
+
+    @Nullable
+    private String first;
+
+    @Nullable
+    private String previous;
+
+    @Nullable
+    private String self;
+
+    @Nullable
+    private String next;
+
+    @Nullable
+    private String last;
+
+    private Links() {
+    }
+
+    public Links(@Nonnull final Document document) {
+        new XmlParser().parseLinks(document);
+    }
+
+    public boolean firstAvailable() {
+        return available(first);
+    }
+
+    public boolean previousAvailable() {
+        return available(previous);
+    }
+
+    public boolean selfAvailable() {
+        return available(self);
+    }
+
+    public boolean nextAvailable() {
+        return available(next);
+    }
+
+    public boolean lastAvailable() {
+        return available(last);
+    }
+
+    @Nullable
+    public String getFirst() {
+        return first;
+    }
+
+    @Nullable
+    public String getPrevious() {
+        return previous;
+    }
+
+    @Nullable
+    public String getSelf() {
+        return self;
+    }
+
+    @Nullable
+    public String getNext() {
+        return next;
+    }
+
+    @Nullable
+    public String getLast() {
+        return last;
+    }
+
+    private boolean available(@Nullable final String link) {
+        return link != null && !"".equals(link);
+    }
+
+    private final class XmlParser {
+        private static final String FEED_TAG = "feed";
+        private static final String LINK_TAG = "link";
+
+        private static final String TYPE_ATTRIBUTE = "rel";
+        private static final String URL_ATTRIBUTE = "href";
+
+        private static final String FIRST_LINK = "first";
+        private static final String PREVIOUS_LINK = "previous";
+        private static final String SELF_LINK = "self";
+        private static final String NEXT_LINK = "next";
+        private static final String LAST_LINK = "last";
+
+        private XmlParser() {
+        }
+
+        private void parseLinks(@Nonnull final Document document) {
+            NodeList linkNodes = document.getElementsByTagName(LINK_TAG);
+
+            if (linkNodes != null) {
+                Node linkNode;
+                for (int i = 0; i < linkNodes.getLength(); i++) {
+                    linkNode = linkNodes.item(i);
+                    if (isLinkBelongToFeed(linkNode)) {
+                        setLink(linkNode);
+                    }
+                }
+            }
+        }
+
+        private boolean isLinkBelongToFeed(@Nonnull final Node node) {
+            return node.getParentNode() != null && FEED_TAG.equals(node.getParentNode().getNodeName());
+        }
+
+        private void setLink(@Nonnull final Node node) {
+            Node typeNode = node.getAttributes().getNamedItem(TYPE_ATTRIBUTE);
+            Node urlNode = node.getAttributes().getNamedItem(URL_ATTRIBUTE);
+
+            if (typeNode != null && urlNode != null) {
+                String typeValue = typeNode.getNodeValue();
+                String urlValue = urlNode.getNodeValue();
+
+                if (FIRST_LINK.equals(typeValue)) {
+                    first = urlValue;
+                } else if (PREVIOUS_LINK.equals(typeValue)) {
+                    previous = urlValue;
+                } else if (SELF_LINK.equals(typeValue)) {
+                    self = urlValue;
+                } else if (NEXT_LINK.equals(typeValue)) {
+                    next = urlValue;
+                } else if (LAST_LINK.equals(typeValue)) {
+                    last = urlValue;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Links.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/browser/Links.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Base64.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Base64.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Base64.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Base64.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,79 @@
+/**
+ * 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.browser.client.service.settings;
+
+//TODO this class isn't mine write appropriate comment
+
+/**
+ * Custom Base64 encode/decode implementation suitable for use in GWT applications
+ * (uses only translatable classes).
+ */
+public final class Base64 {
+
+    private static final String ETAB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+    private Base64() {
+    }
+
+    public static String encode(String data) {
+        StringBuffer out = new StringBuffer();
+
+        int i = 0;
+        int r = data.length();
+        while (r > 0) {
+            byte d0;
+            byte d1;
+            byte d2;
+            byte e0;
+            byte e1;
+            byte e2;
+            byte e3;
+
+            d0 = (byte)data.charAt(i++);
+            --r;
+            e0 = (byte)(d0 >>> 2);
+            e1 = (byte)((d0 & 0x03) << 4);
+
+            if (r > 0) {
+                d1 = (byte)data.charAt(i++);
+                --r;
+                e1 += (byte)(d1 >>> 4);
+                e2 = (byte)((d1 & 0x0f) << 2);
+            } else {
+                e2 = 64;
+            }
+
+            if (r > 0) {
+                d2 = (byte)data.charAt(i++);
+                --r;
+                e2 += (byte)(d2 >>> 6);
+                e3 = (byte)(d2 & 0x3f);
+            } else {
+                e3 = 64;
+            }
+            out.append(ETAB.charAt(e0));
+            out.append(ETAB.charAt(e1));
+            out.append(ETAB.charAt(e2));
+            out.append(ETAB.charAt(e3));
+        }
+
+        return out.toString();
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Base64.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Base64.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Credentials.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Credentials.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Credentials.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Credentials.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,52 @@
+/**
+ * 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.browser.client.service.settings;
+
+import javax.annotation.Nonnull;
+
+public class Credentials {
+    public static final Credentials EMPTY = new Credentials();
+    
+    private final String username;
+    private final String password;
+
+    private Credentials() {
+        this.username = "";
+        this.password = "";
+    }
+
+    public Credentials(@Nonnull final String username, @Nonnull final String password) {
+        assert !"".equals(username);
+        assert !"".equals(password);
+        
+        this.username = username;
+        this.password = password;
+    }
+
+    @Nonnull
+    public String getUsername() {
+        return username;
+    }
+
+    @Nonnull
+    public String getPassword() {
+        return password;
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Credentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Credentials.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGenerator.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGenerator.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGenerator.java Fri Feb  4 17:34:24 2011
@@ -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.browser.client.service.settings;
+
+public interface IdentifierGenerator {
+    String generateUUID();
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGeneratorImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGeneratorImpl.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGeneratorImpl.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGeneratorImpl.java Fri Feb  4 17:34:24 2011
@@ -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.browser.client.service.settings;
+
+public class IdentifierGeneratorImpl implements IdentifierGenerator {
+
+    public final native String generateUUID() /*-{
+        return $wnd.Math.uuid();
+    }-*/;
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGeneratorImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/IdentifierGeneratorImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorage.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorage.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorage.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorage.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,31 @@
+/**
+ * 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.browser.client.service.settings;
+
+public interface LocalStorage {
+
+    boolean isAvailable();
+
+    void saveSettings(Settings settings);
+
+    Settings retrieveSettings();
+
+    void clear();
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorage.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorageImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorageImpl.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorageImpl.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorageImpl.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,259 @@
+/**
+ * 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.browser.client.service.settings;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.JsArray;
+
+public class LocalStorageImpl implements LocalStorage {
+    private static final String SETTINGS_KEY = "logBrowser.settings";
+
+    private Boolean isAvailable;
+
+    public boolean isAvailable() {
+        if (isAvailable == null) {
+            this.isAvailable = checkIsAvailable();
+        }
+        return this.isAvailable;
+    }
+
+    private native boolean checkIsAvailable() /*-{
+        var key = "isLocalStorageAvailable";
+        $wnd.$.jStorage.set(key, true);
+        return !($wnd.$.jStorage.get(key) == null);
+    }-*/;
+
+    public void saveSettings(@Nonnull final Settings settings) {
+        if (isAvailable()) {
+            put(SETTINGS_KEY, Converter.convertToLocalSettings(settings));
+        }
+    }
+
+    @Nullable
+    public Settings retrieveSettings() {
+        if (isAvailable()) {
+            LocalSettings localSettings = (LocalSettings) get(SETTINGS_KEY);
+            if (localSettings != null) {
+                return Converter.convertToSettings(localSettings);
+            }
+        }
+        return null;
+    }
+
+    public void clear() {
+        if (isAvailable()) {
+            remove(SETTINGS_KEY);
+        }
+    }
+
+    private native void put(@Nonnull final String key, @Nonnull final JavaScriptObject obj) /*-{
+        $wnd.$.jStorage.set(key, obj);
+    }-*/;
+
+    @Nullable
+    private native JavaScriptObject get(@Nonnull final String key) /*-{
+        return $wnd.$.jStorage.get(key);
+    }-*/;
+
+    private native void remove(@Nonnull final String key) /*-{
+        $wnd.$.jStorage.deleteKey(key);
+    }-*/;
+
+    private static final class Converter {
+
+        private Converter() { }
+
+        @Nullable
+        public static Settings convertToSettings(@Nullable final LocalSettings src) {
+            if (src == null) {
+                return null;
+            }
+
+            Settings dst = new Settings();
+            dst.setCredentials(convertToCredentials(src.getCredentials()));
+            JsArray<LocalSubscription> subscriptions = src.getSubscriptions();
+            for (int i = 0; i < subscriptions.length(); i++) {
+                Subscription subscription = convertToSubscription(subscriptions.get(i));
+                if (subscription != null) {
+                    dst.getSubscriptions().add(subscription);
+                }
+            }
+
+            return dst;
+        }
+
+        @Nullable
+        private static Credentials convertToCredentials(@Nullable final LocalCredentials src) {
+            if (src == null) {
+                return null;
+            }
+
+            return new Credentials(src.getUsername(), src.getPassword());
+        }
+
+        @Nullable
+        private static Subscription convertToSubscription(@Nullable final LocalSubscription src) {
+            if (src == null) {
+                return null;
+            }
+
+            return new Subscription(src.getId(), src.getName(), src.getURL());
+        }
+
+        @SuppressWarnings("unchecked") @Nullable
+        public static LocalSettings convertToLocalSettings(@Nullable final Settings src) {
+            if (src == null) {
+                return null;
+            }
+
+            LocalSettings dst = (LocalSettings) JavaScriptObject.createObject();
+
+            dst.setCredentials(convertToLocalCredentials(src.getCredentials()));
+
+            JsArray<LocalSubscription> dstSubscriptions =
+                (JsArray<LocalSubscription>) JavaScriptObject.createArray();
+
+            for (Subscription subscription : src.getSubscriptions()) {
+                dstSubscriptions.push(convertToLocalSubscription(subscription));
+            }
+
+            dst.setSubscriptions(dstSubscriptions);
+
+            return dst;
+
+        }
+
+        @Nullable
+        private static LocalCredentials convertToLocalCredentials(@Nullable final Credentials src) {
+            if (src == null) {
+                return null;
+            }
+
+            LocalCredentials dst = (LocalCredentials) JavaScriptObject.createObject();
+
+            dst.setUsername(src.getUsername());
+            dst.setPassword(src.getPassword());
+
+            return dst;
+        }
+
+        @Nullable
+        private static LocalSubscription convertToLocalSubscription(@Nullable final Subscription src) {
+            if (src == null) {
+                return null;
+            }
+
+            LocalSubscription dst = (LocalSubscription) JavaScriptObject.createObject();
+
+            dst.setId(src.getId());
+            dst.setName(src.getName());
+            dst.setURL(src.getUrl());
+
+            return dst;
+        }
+    }
+
+    public static class LocalSettings extends JavaScriptObject {
+
+        protected LocalSettings() { }
+    
+        public final native void setCredentials(@Nullable final LocalCredentials credentials) /*-{
+            this.credentials = credentials;
+        }-*/;
+
+        @Nullable
+        public final native LocalCredentials getCredentials() /*-{
+            return this.credentials;
+        }-*/;
+
+        public final native void setSubscriptions(@Nullable JsArray<LocalSubscription> subscriptions) /*-{
+            this.subscriptions = subscriptions;
+        }-*/;
+
+        @Nonnull
+        public final native JsArray<LocalSubscription> getSubscriptions() /*-{
+            if (this.subscriptions != null) {
+                return this.subscriptions;
+            } else {
+                return [];
+            }
+        }-*/;
+    }
+    @SuppressWarnings("unused")
+    private static class LocalCredentials extends JavaScriptObject {
+
+        protected LocalCredentials() { }
+
+        public final native void setUsername(@Nullable final String username) /*-{
+            this.username = username;
+        }-*/;
+
+        @Nullable
+        public final native String getUsername() /*-{
+            return this.username;
+        }-*/;
+
+        public final native void setPassword(@Nullable final String password) /*-{
+            this.password = password;
+        }-*/;
+
+        @Nullable
+        public final native String getPassword() /*-{
+             return this.password;
+        }-*/;
+    }
+
+    @SuppressWarnings("unused")
+    private static class LocalSubscription extends JavaScriptObject {
+
+        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;
+        }-*/;
+
+        @Nullable
+        public final native String getName() /*-{
+            return this.name;
+        }-*/;
+
+        public final native void setURL(@Nullable final String url) /*-{
+            this.url = url;
+        }-*/;
+
+        @Nullable
+        public final native String getURL() /*-{
+            return this.url;
+        }-*/;
+    }
+
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorageImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/LocalStorageImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxy.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxy.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxy.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,29 @@
+/**
+ * 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.browser.client.service.settings;
+
+import com.google.gwt.http.client.RequestCallback;
+
+public interface RemoteStorageProxy {
+    
+    void saveSettings(Credentials credentials, RequestCallback callback);
+
+    void retrieveSettings(Credentials credentials, Settings settings, RequestCallback callback);
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxyImpl.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxyImpl.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxyImpl.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,282 @@
+/**
+ * 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.browser.client.service.settings;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.JsArray;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.http.client.URL;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
+
+import org.apache.cxf.management.web.browser.client.service.AbstractCallback;
+
+public class RemoteStorageProxyImpl implements RemoteStorageProxy {
+    private static final String HOSTED_MODE_ENDPOINT_URL = "/log/browser/settings/";
+    private static final String RESOURCES_ENDPOINT_SUFFIX = "/resources/";
+    private static final String SETTINGS_ENDPOINT_SUFFIX = "/settings/";
+    
+    private static final String AUTHORIZATION_HEADER = "Authorization";
+    private static final String CONTENT_TYPE_HEADER = "Content-Type";
+    private static final String ACCEPT_HEADER = "Accept";    
+    private static final String JSON_TYPE = "application/json";
+
+    private static final String SETTINGS_KEY = "settings";
+
+    private String endpointURL;
+
+    public void saveSettings(@Nonnull final Credentials credentials,
+                             @Nonnull final RequestCallback callback) {
+        RequestBuilder builder = buildRequest(RequestBuilder.GET, buildURL(credentials), credentials);
+        execute(null, builder, callback);
+    }
+
+    public void retrieveSettings(@Nonnull final Credentials credentials, @Nonnull final Settings settings,
+                                 @Nonnull final RequestCallback callback) {
+        RequestBuilder builder = buildRequest(RequestBuilder.PUT, buildURL(credentials), credentials);
+        execute(Converter.convertToRemoteSettings(settings), builder, callback);
+    }
+
+    @Nonnull
+    private String buildURL(@Nonnull final Credentials credentials) {
+        assert credentials.getUsername() != null && !"".equals(credentials.getUsername());
+
+        String url = URL.encode(buildEndpointURL() + credentials.getUsername());
+        
+        assert !"".equals(url);
+        return url;
+    }
+
+    @Nonnull
+    private String buildEndpointURL() {
+        if (endpointURL == null) {
+            String baseURL = GWT.getHostPageBaseURL();
+            if (baseURL.endsWith(RESOURCES_ENDPOINT_SUFFIX)) {
+
+                // compute URL by replace "resources" suffix with "settings" suffix
+                endpointURL = cutResourcesSuffix(baseURL) + SETTINGS_ENDPOINT_SUFFIX;
+            } else {
+
+                // it ought to execute only in hosted mode, because there is diffrent base URL
+                endpointURL = HOSTED_MODE_ENDPOINT_URL;
+            }
+        }
+
+        return endpointURL;
+    }
+
+    @Nonnull
+    private String cutResourcesSuffix(@Nonnull final String url) {
+        return url.substring(0, url.lastIndexOf(RESOURCES_ENDPOINT_SUFFIX));
+    }
+
+    @Nonnull
+    private RequestBuilder buildRequest(@Nonnull final RequestBuilder.Method method,
+                                        @Nonnull final String url,
+                                        @Nonnull final Credentials credentials) {
+        assert !"".equals(url);
+        
+        RequestBuilder builder = new RequestBuilder(method, url);
+        builder.setHeader(CONTENT_TYPE_HEADER, JSON_TYPE);
+        builder.setHeader(ACCEPT_HEADER, JSON_TYPE);
+        
+        if (credentials != null) {
+            builder.setHeader(AUTHORIZATION_HEADER, getAuthorizationData(credentials));
+        }
+        
+        return builder;
+    }
+
+    @Nonnull
+    private String getAuthorizationData(@Nonnull final Credentials credentials) {
+        return "Basic " + Base64.encode(credentials.getUsername() + ":" + credentials.getPassword());
+    }
+
+    private void execute(@Nullable final RemoteSettings remoteSettings, @Nonnull final RequestBuilder builder,
+                         @Nonnull final RequestCallback callback) {
+        String json = null;
+        if (remoteSettings != null) {
+
+            // TODO add appropriate comment - wrap  
+            JSONObject rootElement = new JSONObject();
+            rootElement.put(SETTINGS_KEY, new JSONObject(remoteSettings));
+            json = rootElement.toString();
+        }
+
+        try {
+            builder.sendRequest(json, callback);
+        } catch (RequestException ex) {
+            
+            // TODO add custom exception
+            throw new RuntimeException(ex);
+        }
+    }
+
+    protected static class RemoteSettings extends JavaScriptObject {
+
+        protected RemoteSettings() {
+        }
+
+        public final native void setSubscriptions(@Nullable JsArray<RemoteSubscription> subscriptions) /*-{
+            this.subscriptions = subscriptions;
+        }-*/;
+
+        @Nonnull
+        public final native JsArray<RemoteSubscription> getSubscriptions() /*-{
+            if (this.subscriptions != null) {
+                return this.subscriptions;
+            } else {
+                return [];
+            }
+        }-*/;
+    }
+
+    protected static class RemoteSubscription extends JavaScriptObject {
+
+        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;
+        }-*/;
+
+        @Nullable
+        public final native String getUrl() /*-{
+            return this.url;
+        }-*/;        
+
+        public final native void setName(@Nullable final String name) /*-{
+            this.name = name;
+        }-*/;
+
+        @Nullable
+        public final native String getName() /*-{
+            return this.name;
+        }-*/;
+    }
+
+    protected static final class Converter {
+
+        private Converter() {
+        }
+
+        @Nonnull
+        public static Settings convertToSettings(@Nonnull final RemoteSettings remoteSettings) {
+            Settings settings = new Settings();
+
+            JsArray<RemoteSubscription> remoteSubscriptions = remoteSettings.getSubscriptions();
+            for (int i = 0; i < remoteSubscriptions.length(); i++) {
+                settings.getSubscriptions().add(convertToSubscription(remoteSubscriptions.get(i)));
+            }
+
+            return settings;
+        }
+
+        @Nonnull
+        public static Subscription convertToSubscription(@Nonnull RemoteSubscription remoteSubscription) {
+            return new Subscription(remoteSubscription.getId(),
+                remoteSubscription.getName(), remoteSubscription.getUrl());
+        }
+
+        @SuppressWarnings("unchecked") @Nonnull
+        public static RemoteSettings convertToRemoteSettings(@Nonnull final Settings settings) {
+            RemoteSettings remoteSettings = (RemoteSettings) JavaScriptObject.createObject();
+
+            JsArray<RemoteSubscription> remoteSubscriptions =
+                (JsArray<RemoteSubscription>) JavaScriptObject.createArray();
+
+            for (Subscription subscription : settings.getSubscriptions()) {
+                remoteSubscriptions.push(convertToRemoteSubscription(subscription));
+            }
+
+            remoteSettings.setSubscriptions(remoteSubscriptions);
+
+            return remoteSettings;
+        }
+
+        @Nonnull
+        public static RemoteSubscription convertToRemoteSubscription(@Nonnull Subscription subscription) {
+            RemoteSubscription remoteSubscription = (RemoteSubscription) JavaScriptObject.createObject();
+
+            remoteSubscription.setId(subscription.getId());
+            remoteSubscription.setName(subscription.getName());
+            remoteSubscription.setUrl(subscription.getUrl());
+
+            return remoteSubscription;
+        }
+    }
+
+    public abstract static class Callback extends AbstractCallback<Settings> {
+
+        @Override @Nullable
+        protected Settings parse(@Nonnull final Response response) {
+            RemoteSettings result = null;
+
+            if (response.getText() != null && !"".equals(response.getText())) {
+
+                // TODO add appropriate comment - unwrap
+                JSONValue rootElement = new JSONObject(convertFromJSON(response.getText())).get(SETTINGS_KEY);
+                if (rootElement != null && rootElement.isObject() != null) {
+                    result = (RemoteSettings) rootElement.isObject().getJavaScriptObject();
+                }
+            }
+
+            return result != null ? Converter.convertToSettings(result) : null;
+        }
+
+        // TODO check if this method must be final regardless to GWT's guidelines
+        // CHECKSTYLE:OFF
+        @Nonnull
+        private final native JavaScriptObject convertFromJSON(@Nonnull final String json) /*-{
+            return $wnd.JSON.parse(json);
+        }-*/;
+        // CHECKSTYLE:ON
+    }
+
+    public static class NoActionCallback extends AbstractCallback<Settings> {
+
+        @Override
+        public void onAccessDenied() { }
+
+        @Override
+        public void onSuccess(@Nullable final Settings obj) { }
+
+        @Override @Nullable
+        protected Settings parse(@Nonnull final Response response) {
+            return null;
+        }
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxyImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/RemoteStorageProxyImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Settings.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Settings.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Settings.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Settings.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.browser.client.service.settings;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+public class Settings {
+
+    @Nullable
+    private Credentials credentials;
+
+    @Nullable
+    private Set<Subscription> subscriptions;
+
+    @Nonnull
+    public Credentials getCredentials() {
+        if (credentials == null) {
+            credentials = Credentials.EMPTY;
+        }
+        return credentials;
+    }
+
+    public void setCredentials(@Nonnull final Credentials credentials) {
+        this.credentials = credentials;
+    }
+
+    @Nonnull
+    public Set<Subscription> getSubscriptions() {
+        if (subscriptions == null) {
+            subscriptions = new LinkedHashSet<Subscription>();
+        }
+        return subscriptions;
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Settings.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Settings.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/SettingsFacade.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/SettingsFacade.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/SettingsFacade.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/SettingsFacade.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,300 @@
+/**
+ * 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.browser.client.service.settings;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+import org.apache.cxf.management.web.browser.client.EventBus;
+import org.apache.cxf.management.web.browser.client.event.GoToBrowserEvent;
+import org.apache.cxf.management.web.browser.client.event.RemoteStorageAccessDeniedEvent;
+
+@Singleton
+public class SettingsFacade {
+
+    @Nonnull
+    private final RemoteStorageProxy remoteStorage;
+
+    @Nonnull
+    private final LocalStorage localStorage;
+
+    @Nonnull
+    private final EventBus eventBus;
+
+    @Nullable
+    private StorageLayer storageLayer;
+
+    @Nonnull
+    private final IdentifierGenerator identifierGenerator;
+
+    private boolean initialized;
+
+    public enum StorageStrategy {
+        LOCAL_AND_REMOTE,
+        REMOTE
+    }    
+
+    @Inject
+    public SettingsFacade(@Nonnull final RemoteStorageProxy remoteStorage,
+                          @Nonnull final LocalStorage localStorage,
+                          @Nonnull final EventBus eventBus,
+                          @Nonnull final IdentifierGenerator identifierGenerator) {
+        this.remoteStorage = remoteStorage;
+        this.localStorage = localStorage;
+        this.eventBus = eventBus;
+        this.identifierGenerator = identifierGenerator;
+    }
+
+    public boolean isSettingsAlreadyInLocalStorage() {
+        return localStorage.isAvailable() && localStorage.retrieveSettings() != null;
+    }    
+
+    public void initialize(@Nonnull final StorageStrategy strategy, @Nonnull final Credentials credentials) {
+        storageLayer = createStorageLayers(strategy);
+        storageLayer.initialize(credentials);
+        initialized = true;
+    }
+
+    public void clearMemoryAndLocalStorage() {
+        assert storageLayer != null;
+        storageLayer.clear();
+        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;
+        isValid();
+
+        storageLayer.getSettings().getSubscriptions().remove(subscription);
+        storageLayer.getSettings().getSubscriptions().add(subscription);
+        storageLayer.update();
+    }
+
+    public void removeSubscription(@Nonnull final Subscription subscription) {
+        assert subscription.getUrl() != null && !"".equals(subscription.getUrl());
+        assert storageLayer != null;
+        isValid();
+
+        storageLayer.getSettings().getSubscriptions().remove(subscription);
+        storageLayer.update();
+    }
+
+    @Nonnull
+    public List<Subscription> getSubscriptions() {
+        assert storageLayer != null;
+        isValid();
+
+        return new ArrayList<Subscription>(storageLayer.getSettings().getSubscriptions());
+    }
+
+    private void isValid() {
+        if (!initialized) {
+            throw new IllegalStateException("Storage layers not initialized");
+        }
+    }
+
+    @Nonnull
+    private StorageLayer createStorageLayers(@Nonnull final StorageStrategy storageStrategy) {
+        switch(storageStrategy) {
+        case LOCAL_AND_REMOTE:
+            return new RemoteStorageLayer(remoteStorage,
+                new LocalStorageLayer(localStorage, new MemoryStorageLayer()));
+        case REMOTE:
+            return new RemoteStorageLayer(remoteStorage, new MemoryStorageLayer());
+        default:
+            throw new IllegalArgumentException("Unknown storage strategy type");
+        }
+    }
+
+    private interface StorageLayer {
+
+        boolean initialize(Credentials credentials);
+
+        Settings getSettings();
+
+        void update(Settings settings);
+
+        void update();
+
+        void clear();
+    }
+
+    private static class MemoryStorageLayer implements StorageLayer {
+
+        @Nonnull
+        private Settings settings;
+
+        public boolean initialize(@Nonnull final Credentials credentials) {
+            this.settings = new Settings();
+            this.settings.setCredentials(credentials);
+            return false;
+        }
+
+        @Nonnull
+        public Settings getSettings() {
+            return this.settings;
+        }
+
+        public void update(@Nonnull final Settings newSettings) {
+            this.settings = newSettings;
+        }
+
+        public void update() {
+        }
+
+        public void clear() {
+            this.settings = new Settings();
+        }
+    }
+
+    private static class LocalStorageLayer implements StorageLayer {
+
+        @Nonnull
+        private final MemoryStorageLayer parent; // TODO change to StorageLayer interface
+
+        @Nonnull
+        private final LocalStorage localStorage;
+
+        public LocalStorageLayer(@Nonnull final LocalStorage localStorage,
+                                 @Nonnull final MemoryStorageLayer parent) {
+            this.parent = parent;
+            this.localStorage = localStorage;
+        }
+
+        public boolean initialize(@Nonnull final Credentials credentials) {
+            boolean isSuccess = parent.initialize(credentials);
+            
+            assert !isSuccess;
+
+            Settings settings = localStorage.retrieveSettings();
+            if (settings != null) {
+                parent.update(settings);
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        @Nonnull
+        public Settings getSettings() {
+            return parent.getSettings();
+        }
+
+        public void update(@Nonnull final Settings settings) {
+            parent.update(settings);
+            localStorage.saveSettings(settings);
+        }
+
+        public void update() {
+            update(parent.getSettings());
+        }
+
+        public void clear() {
+            parent.clear();
+            localStorage.clear();
+        }
+    }
+
+    private class RemoteStorageLayer implements StorageLayer {
+
+        @Nonnull
+        private final StorageLayer parent;
+
+        @Nonnull
+        private final RemoteStorageProxy remoteStorage;
+
+        public RemoteStorageLayer(@Nonnull final RemoteStorageProxy remoteStorage,
+                                  @Nonnull final StorageLayer parent) {
+            this.parent = parent;
+            this.remoteStorage = remoteStorage;
+        }
+
+        public boolean initialize(@Nonnull final Credentials credentials) {
+            assert credentials != null;
+
+            boolean isSuccess = parent.initialize(credentials);
+            
+            if (!isSuccess) {
+                remoteStorage.saveSettings(credentials, new RemoteStorageProxyImpl.Callback() {
+
+                    @Override
+                    public void onAccessDenied() {
+                        eventBus.fireEvent(new RemoteStorageAccessDeniedEvent());
+                    }
+
+                    @Override
+                    public void onSuccess(@Nullable final Settings retrievedSettings) {
+                        Settings settings = retrievedSettings != null ? retrievedSettings : new Settings();
+                        settings.setCredentials(credentials);
+
+                        parent.update(settings);
+
+                        eventBus.fireEvent(new GoToBrowserEvent());
+                    }
+                });
+            }
+
+            return true;
+        }
+
+        @Nonnull
+        public Settings getSettings() {
+            return parent.getSettings();
+        }
+
+        public void update(@Nonnull final Settings settings) {
+            assert settings != null;
+
+            parent.update(settings);
+
+            remoteStorage.retrieveSettings(settings.getCredentials(), settings,
+                new RemoteStorageProxyImpl.NoActionCallback());
+        }
+        
+        public void update() {
+            update(parent.getSettings());
+        }
+
+        public void clear() {
+            parent.clear();
+        }
+    }
+}
+

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/SettingsFacade.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/SettingsFacade.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Subscription.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Subscription.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Subscription.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Subscription.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,76 @@
+/**
+ * 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.browser.client.service.settings;
+
+import javax.annotation.Nonnull;
+
+public class Subscription {
+    private String id;
+    private String name;
+    private 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;
+    }
+
+    @Nonnull
+    public String getUrl() {
+        return url;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        Subscription that = (Subscription)o;
+
+        if (id != null ? !id.equals(that.id) : that.id != null) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return id != null ? id.hashCode() : 0;
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Subscription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/service/settings/Subscription.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/AbstractDialog.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/AbstractDialog.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/AbstractDialog.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/AbstractDialog.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,37 @@
+/**
+ * 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.browser.client.ui;
+
+import javax.annotation.Nonnull;
+
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public abstract class AbstractDialog extends DialogBox {
+
+    protected void init(@Nonnull final String title, @Nonnull final Widget widget) {
+        setGlassEnabled(true);
+        setAnimationEnabled(false);
+        setAutoHideEnabled(true);
+
+        setText(title);
+        setWidget(widget);
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/AbstractDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/AbstractDialog.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BasePresenter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BasePresenter.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BasePresenter.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BasePresenter.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,69 @@
+/**
+ * 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.browser.client.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Nonnull;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.HasWidgets;
+
+import org.apache.cxf.management.web.browser.client.EventBus;
+
+public abstract class BasePresenter implements Presenter {
+
+    @Nonnull
+    protected final EventBus eventBus;
+
+    @Nonnull
+    private final View view;
+
+    @Nonnull
+    private final BindStrategy bindStrategy;
+
+    @Nonnull
+    private final List<HandlerRegistration> handlerRegistrations;
+
+    public BasePresenter(@Nonnull final EventBus eventBus, @Nonnull final View view,
+                         @Nonnull final BindStrategy bindStrategy) {
+        this.eventBus = eventBus;
+        this.view = view;
+        this.bindStrategy = bindStrategy;
+        this.handlerRegistrations = new ArrayList<HandlerRegistration>();
+    }
+
+    public void go(HasWidgets container) {
+        bindStrategy.bind(container, view);
+    }
+
+    public void unbind() {
+        bindStrategy.unbind(view);
+        
+        for (HandlerRegistration handlerRegistration : handlerRegistrations) {
+            handlerRegistration.removeHandler();
+        }
+        handlerRegistrations.clear();
+    }
+
+    protected void registerHandler(@Nonnull final HandlerRegistration handlerRegistration) {
+        handlerRegistrations.add(handlerRegistration);
+    }
+}

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BasePresenter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BasePresenter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BindStrategy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BindStrategy.java?rev=1067233&view=auto
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BindStrategy.java (added)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/client/ui/BindStrategy.java Fri Feb  4 17:34:24 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.browser.client.ui;
+
+import javax.annotation.Nonnull;
+
+import com.google.gwt.user.client.ui.HasWidgets;
+
+//TODO view should decide how to present it - bindstrategy should be receive by View not inject to presenter
+public interface BindStrategy {
+    void bind(@Nonnull HasWidgets container, @Nonnull View view);
+    void unbind(@Nonnull View view);
+}



Mime
View raw message