You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by to...@apache.org on 2010/06/30 19:07:17 UTC
svn commit: r959377 [2/3] - in /cxf/sandbox/logbrowser/rt/management-web: ./
src/main/java/org/apache/cxf/management/web/logging/bootstrapping/
src/main/java/org/apache/cxf/management/web/logging/browser/
src/main/java/org/apache/cxf/management/web/log...
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/AccessControl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/AccessControl.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/AccessControl.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/AccessControl.java Wed Jun 30 17:07:14 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.browser.client.model;
+
+public enum AccessControl {
+ GLOBAL,
+ NONE,
+ SPECIFIED;
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Credentials.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Credentials.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Credentials.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Credentials.java Wed Jun 30 17:07:14 2010
@@ -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.logging.browser.client.model;
+
+import java.io.Serializable;
+
+public class Credentials implements Serializable {
+ private static final long serialVersionUID = 8374250693769719998L;
+
+ private String username;
+ private String password;
+
+ public Credentials() {
+ }
+
+ public Credentials(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Settings.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Settings.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Settings.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Settings.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.browser.client.model;
+
+import java.io.Serializable;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+public class Settings implements Serializable {
+ private static final long serialVersionUID = -5974005840345852594L;
+
+ private Credentials credentials;
+ private Set<Subscription> subscriptions;
+
+ public Credentials getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(Credentials credentials) {
+ this.credentials = credentials;
+ }
+
+ public Set<Subscription> getSubscriptions() {
+ if (subscriptions == null) {
+ subscriptions = new LinkedHashSet<Subscription>();
+ }
+ return subscriptions;
+ }
+
+ public void setSubscriptions(Set<Subscription> subscriptions) {
+ this.subscriptions = subscriptions;
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Subscription.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Subscription.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Subscription.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/model/Subscription.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,102 @@
+/**
+ * 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.browser.client.model;
+
+import java.io.Serializable;
+
+public class Subscription implements Serializable {
+ private static final long serialVersionUID = 8937465727379798835L;
+
+ private String name;
+ private String url;
+ private AccessControl accessControl;
+ private Credentials credentials;
+
+ public Subscription() {
+ }
+
+ public Subscription(String name, String url) {
+ this.name = name;
+ this.url = url;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public AccessControl getAccessControl() {
+ return accessControl;
+ }
+
+ public void setAccessControl(AccessControl accessControl) {
+ this.accessControl = accessControl;
+ }
+
+ public Credentials getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(Credentials credentials) {
+ this.credentials = credentials;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (url == null ? 0 : url.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Subscription other = (Subscription)obj;
+ if (url == null) {
+ if (other.url != null) {
+ return false;
+ }
+ } else if (!url.equals(other.url)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/place/Place.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/place/Place.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/place/Place.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/place/Place.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,112 @@
+/**
+ * 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.browser.client.place;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+public class Place {
+
+ public enum Type {
+ ACCESS_CONTROL,
+ BROWSE,
+ SETTINGS
+ }
+
+ private Type type;
+ private Map<String, String> attributes;
+
+ public Place(final String token) {
+ fromString(token);
+ }
+
+ public Place(final Type type) {
+ this(type, null);
+ }
+
+ public Place(final Type type, final Map<String, String> attributes) {
+ if (type == null) {
+ throw new IllegalArgumentException("'type' can't be null");
+ }
+ this.type = type;
+ this.attributes = attributes;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public Map<String, String> getAttributes() {
+ if (attributes == null) {
+ attributes = new LinkedHashMap<String, String>();
+ }
+ return attributes;
+ }
+
+ private void fromString(final String token) {
+ String[] tokens = token.split("\\?");
+
+ switch (tokens.length) {
+ case 1:
+ type = Type.valueOf(tokens[0]);
+ break;
+ case 2:
+ type = Type.valueOf(tokens[0]);
+ String[] pairs = tokens[1].split("&");
+ for (String attribute : pairs) {
+ String[] pair = attribute.split("=");
+ if (pair.length != 2) {
+ throw new IllegalArgumentException("Invalid format");
+ }
+ getAttributes().put(pair[0], pair[1]);
+ }
+ break;
+ default:
+ throw new IllegalStateException("Invalid format");
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(type);
+
+ if (attributes != null && !attributes.isEmpty()) {
+ sb.append("?");
+
+ boolean isFirst = true;
+ Set<Entry<String, String>> pairs = attributes.entrySet();
+
+ for (Entry<String, String> pair : pairs) {
+ if (isFirst) {
+ sb.append("&");
+ isFirst = false;
+ }
+ sb.append(pair.getKey()).append("=").append(pair.getValue());
+ }
+ }
+
+ return sb.toString();
+
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AccessControlPresenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AccessControlPresenter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AccessControlPresenter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AccessControlPresenter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,85 @@
+/**
+ * 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.browser.client.presenter;
+
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.inject.Inject;
+
+import org.apache.cxf.management.web.logging.browser.client.event.AccessDeniedEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.AccessDeniedEventHandler;
+import org.apache.cxf.management.web.logging.browser.client.event.BrowseEvent;
+import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
+import org.apache.cxf.management.web.logging.browser.client.settings.SettingsManager;
+import org.apache.cxf.management.web.logging.browser.client.settings.SettingsManager.StorageStrategy;
+import org.apache.cxf.management.web.logging.browser.client.view.AccessControlView;
+
+public class AccessControlPresenter extends BasePresenter implements AccessControlView.Presenter {
+ private final AccessControlView view;
+ private final SettingsManager settings;
+
+ @Inject
+ public AccessControlPresenter(final EventBus eventBus, final AccessControlView view,
+ final SettingsManager settings) {
+ super(eventBus);
+ this.view = view;
+ this.settings = settings;
+ this.view.setPresenter(this);
+ bind();
+ }
+
+ public void go(final HasWidgets container) {
+ if (settings.isFetched()) {
+ eventBus.fireEvent(new BrowseEvent());
+ } else {
+ container.clear();
+ container.add(view.asWidget());
+ }
+ }
+
+ public void onSignInButtonClicked() {
+ String username = view.getUsername().getValue();
+ String password = view.getPassword().getValue();
+
+ if (isNotEmpty(username) && isNotEmpty(password)) {
+ Boolean rememberMe = view.getRememberMe().getValue();
+ if (rememberMe != null && rememberMe) {
+ settings.setStorageStrategy(StorageStrategy.STORE_LOCALLY_AND_REMOTELY);
+ } else {
+ settings.setStorageStrategy(StorageStrategy.STORE_REMOTELY);
+ }
+ settings.fetchRemotely(new Credentials(username, password));
+ }
+ }
+
+ private void bind() {
+ registerHandler(eventBus.addHandler(AccessDeniedEvent.TYPE, new AccessDeniedEventHandler() {
+
+ public void onAccessDenied(AccessDeniedEvent event) {
+ view.showAccessDeniedMessage();
+ }
+
+ }));
+ }
+
+ private boolean isNotEmpty(final String str) {
+ return str != null && !"".equals(str);
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AppController.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AppController.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AppController.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/AppController.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,27 @@
+/**
+ * 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.browser.client.presenter;
+
+/**
+ *
+ */
+public class AppController {
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BasePresenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BasePresenter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BasePresenter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BasePresenter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,50 @@
+/**
+ * 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.browser.client.presenter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+
+public abstract class BasePresenter implements Presenter {
+
+ protected final EventBus eventBus;
+ private final List<HandlerRegistration> handlerRegistrations;
+
+ public BasePresenter(final EventBus eventBus) {
+ this.eventBus = eventBus;
+ handlerRegistrations = new ArrayList<HandlerRegistration>();
+ }
+
+ public void unbind() {
+ for (HandlerRegistration reg : handlerRegistrations) {
+ reg.removeHandler();
+ }
+ handlerRegistrations.clear();
+ }
+
+ protected void registerHandler(HandlerRegistration handlerRegistration) {
+ handlerRegistrations.add(handlerRegistration);
+ }
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/BrowsePresenter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,113 @@
+/**
+ * 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.browser.client.presenter;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.inject.Inject;
+
+import org.apache.cxf.management.web.logging.browser.client.browser.AtomPullServerProxy;
+import org.apache.cxf.management.web.logging.browser.client.browser.Feed;
+import org.apache.cxf.management.web.logging.browser.client.event.SettingsEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.SignOutEvent;
+import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+import org.apache.cxf.management.web.logging.browser.client.settings.AbstractCallback;
+import org.apache.cxf.management.web.logging.browser.client.settings.SettingsManager;
+import org.apache.cxf.management.web.logging.browser.client.view.BrowseView;
+
+/**
+ *
+ */
+public class BrowsePresenter extends BasePresenter implements BrowseView.Presenter {
+ private final BrowseView view;
+ private final AtomPullServerProxy proxy;
+ private Subscription subscription;
+ private int currentPage;
+
+ @Inject
+ public BrowsePresenter(final EventBus eventBus, final BrowseView view,
+ final SettingsManager settingsManager, final AtomPullServerProxy proxy) {
+ super(eventBus);
+ this.view = view;
+ this.view.setPresenter(this);
+ this.proxy = proxy;
+
+ view.setSubscription(settingsManager.getSubscriptions());
+ }
+
+ public void go(HasWidgets container) {
+ container.clear();
+ container.add(view.asWidget());
+ }
+
+ public void onManageSubscriptionsButtonClicked() {
+ eventBus.fireEvent(new SettingsEvent());
+ }
+
+ public void onSignOutButtonClicked() {
+ eventBus.fireEvent(new SignOutEvent());
+ }
+
+ public void onSubcriptionTreeItemClicked(Subscription s) {
+ this.subscription = s;
+ getFeed(s);
+ }
+
+ public void onNewerButtonClicked() {
+ if (currentPage == 0) {
+ return;
+ }
+ currentPage--;
+ getFeed(subscription);
+ }
+
+ public void onOlderButtonClicked() {
+ currentPage++;
+ getFeed(subscription);
+ }
+
+ private String getUrl(Subscription s) {
+ return s.getUrl() + currentPage;
+
+ }
+
+ private void getFeed(Subscription s) {
+ proxy.getFeed(getUrl(s), s.getCredentials(), new AbstractCallback(null) {
+
+ @Override
+ public void onSuccess(Object obj) {
+ Feed result = (Feed)obj;
+ if (result != null) {
+ view.setLogEntries(result.getEntries());
+ }
+ }
+
+ @Override
+ public void onAccessDenied() {
+ }
+
+ @Override
+ protected Object createResult(JavaScriptObject obj) {
+ return obj;
+ }
+ });
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/PlaceManager.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/PlaceManager.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/PlaceManager.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/PlaceManager.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,133 @@
+/**
+ * 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.browser.client.presenter;
+
+import java.util.Map;
+
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+import org.apache.cxf.management.web.logging.browser.client.event.AccessControlEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.AccessControlEventHandler;
+import org.apache.cxf.management.web.logging.browser.client.event.BrowseEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.BrowseEventHandler;
+import org.apache.cxf.management.web.logging.browser.client.event.SettingsEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.SettingsEventHandler;
+import org.apache.cxf.management.web.logging.browser.client.event.SignOutEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.SignOutEventHandler;
+import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.place.Place;
+import org.apache.cxf.management.web.logging.browser.client.settings.SettingsManager;
+
+public class PlaceManager implements ValueChangeHandler<String> {
+ private final EventBus eventBus;
+
+ private final Provider<AccessControlPresenter> accessControlProvider;
+ private final Provider<BrowsePresenter> browseProvider;
+ private final Provider<SettingsPresenter> settingsProvider;
+ private final SettingsManager settingsManager;
+ private Presenter currentPresenter;
+
+ @Inject
+ public PlaceManager(final EventBus eventBus, final SettingsManager settingsManager,
+ final Provider<AccessControlPresenter> accessControlProvider,
+ final Provider<BrowsePresenter> browseProvider,
+ final Provider<SettingsPresenter> settingsProvider) {
+ assert eventBus != null;
+
+ this.eventBus = eventBus;
+ this.accessControlProvider = accessControlProvider;
+ this.browseProvider = browseProvider;
+ this.settingsProvider = settingsProvider;
+ this.settingsManager = settingsManager;
+ bind();
+ }
+
+ public void onValueChange(ValueChangeEvent<String> event) {
+ if (event.getValue() != null) {
+ Place place = new Place(event.getValue());
+ switch (place.getType()) {
+ case ACCESS_CONTROL:
+ go(accessControlProvider.get(), place.getAttributes());
+ break;
+ case BROWSE:
+ go(browseProvider.get(), place.getAttributes());
+ break;
+ default:
+ throw new IllegalStateException("Unkown place type");
+ }
+ }
+ }
+
+ private void bind() {
+ History.addValueChangeHandler(this);
+
+ eventBus.addHandler(AccessControlEvent.TYPE, new AccessControlEventHandler() {
+ public void onAccessControl(final AccessControlEvent event) {
+ go(accessControlProvider.get());
+ }
+ });
+
+ eventBus.addHandler(BrowseEvent.TYPE, new BrowseEventHandler() {
+ public void onBrowse(final BrowseEvent event) {
+ go(browseProvider.get());
+ }
+ });
+
+ eventBus.addHandler(SettingsEvent.TYPE, new SettingsEventHandler() {
+
+ public void onSettings(SettingsEvent event) {
+ go(settingsProvider.get());
+ }
+ });
+
+ eventBus.addHandler(SignOutEvent.TYPE, new SignOutEventHandler() {
+
+ public void onSignOut(SignOutEvent event) {
+ settingsManager.flush();
+ go(accessControlProvider.get());
+
+ }
+ });
+ }
+
+ private void go(final Presenter presenter) {
+ go(presenter, null);
+ }
+
+ private void go(final Presenter presenter, final Map<String, String> attributes) {
+ assert presenter != null;
+
+ if (currentPresenter != null) {
+ currentPresenter.unbind();
+ }
+ currentPresenter = presenter;
+
+ presenter.go(RootPanel.get());
+ }
+
+ public void start() {
+ go(accessControlProvider.get());
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/Presenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/Presenter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/Presenter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/Presenter.java Wed Jun 30 17:07:14 2010
@@ -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.logging.browser.client.presenter;
+
+import com.google.gwt.user.client.ui.HasWidgets;
+
+/**
+ *
+ */
+public interface Presenter {
+ void go(final HasWidgets container);
+
+ void unbind();
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/SettingsPresenter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/SettingsPresenter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/SettingsPresenter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/presenter/SettingsPresenter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,83 @@
+/**
+ * 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.browser.client.presenter;
+
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.inject.Inject;
+
+import org.apache.cxf.management.web.logging.browser.client.event.BrowseEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.SignOutEvent;
+import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+import org.apache.cxf.management.web.logging.browser.client.settings.SettingsManager;
+import org.apache.cxf.management.web.logging.browser.client.view.SettingsView;
+
+public class SettingsPresenter extends BasePresenter implements SettingsView.Presenter {
+ private final SettingsView view;
+ private final SettingsManager settings;
+
+ @Inject
+ public SettingsPresenter(EventBus eventBus, SettingsView view, SettingsManager settings) {
+ super(eventBus);
+ this.view = view;
+ this.settings = settings;
+ this.view.setPresenter(this);
+
+ updateSubscriptions();
+ }
+
+ public void go(HasWidgets container) {
+ container.clear();
+ container.add(view.asWidget());
+ }
+
+ public void unbind() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onEditSubscription(Subscription subscription) {
+ settings.updateSubscription(subscription);
+ updateSubscriptions();
+ }
+
+ public void onRemoveSubscriptionButtonClicked(Subscription subscription) {
+ settings.removeSubscription(subscription);
+ updateSubscriptions();
+ }
+
+ public void onAddSubscription(Subscription subscription) {
+ settings.updateSubscription(subscription);
+ updateSubscriptions();
+ }
+
+ private void updateSubscriptions() {
+ view.setSubscriptions(settings.getSubscriptions());
+ }
+
+ public void onBackHyperlinkClicked() {
+ eventBus.fireEvent(new BrowseEvent());
+ }
+
+ public void onSingOutHyperlinkClicked() {
+ eventBus.fireEvent(new SignOutEvent());
+ }
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/AbstractCallback.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,78 @@
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
+
+public abstract class AbstractCallback implements RequestCallback {
+ private static final int OK = 200;
+ private static final int UNAUTHORIZED = 401;
+
+ protected String key;
+
+ public AbstractCallback(String key) {
+ this.key = key;
+ }
+
+ public abstract void onAccessDenied();
+
+ public abstract void onSuccess(Object obj);
+
+ protected abstract Object createResult(JavaScriptObject obj);
+
+ public void onResponseReceived(Request request, Response response) {
+ if (OK == response.getStatusCode()) {
+ JavaScriptObject result = null;
+ if (response.getText() != null && !"".equals(response.getText())) {
+ result = parse(response.getText());
+ if (key != null && result != null) { // unwrap
+ JSONObject wrapper = new JSONObject(result);
+ result = getValue(wrapper.get(key));
+ }
+ }
+ onSuccess(createResult(result));
+ } else if (UNAUTHORIZED == response.getStatusCode()) {
+ onAccessDenied();
+ } else {
+ new RuntimeException("Undefined remote service error");
+ }
+ }
+
+ public void onError(final Request request, final Throwable ex) {
+ throw new RuntimeException(ex);
+ }
+
+ private JavaScriptObject getValue(JSONValue value) {
+ if (value.isObject() != null) {
+ return value.isObject().getJavaScriptObject();
+ } else {
+ return null;
+ }
+ }
+
+ public final native JavaScriptObject parse(String json) /*-{
+ return $wnd.JSON.parse(json);
+ }-*/;
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxy.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxy.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxy.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxy.java Wed Jun 30 17:07:14 2010
@@ -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.logging.browser.client.settings;
+
+import com.google.gwt.http.client.RequestCallback;
+
+import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
+import org.apache.cxf.management.web.logging.browser.client.model.Settings;
+
+public interface BootstrapStorageProxy {
+ void getSettings(Credentials credentials, RequestCallback callback);
+
+ void setSettings(Credentials credentials, Settings settings, RequestCallback callback);
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxyImpl.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxyImpl.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/BootstrapStorageProxyImpl.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,64 @@
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.URL;
+
+import org.apache.cxf.management.web.logging.browser.client.helper.JSONWebService;
+import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
+import org.apache.cxf.management.web.logging.browser.client.model.Settings;
+
+public class BootstrapStorageProxyImpl implements BootstrapStorageProxy {
+ private static final String SERVICE_URL = "/rest/bootstrapstorage/";
+
+ private JSONWebService webservice = new JSONWebService();
+
+ public void getSettings(Credentials credentials, RequestCallback callback) {
+ isValid(credentials, callback);
+ RequestBuilder builder = webservice
+ .buildRequest(RequestBuilder.GET, getURL(credentials), credentials);
+ webservice.execute(builder, callback);
+ }
+
+ public void setSettings(Credentials credentials, Settings settings, RequestCallback callback) {
+ isValid(credentials, callback);
+ RequestBuilder builder = webservice
+ .buildRequest(RequestBuilder.PUT, getURL(credentials), credentials);
+ webservice.execute("settings", JSOConverter.convert(settings), builder, callback);
+ }
+
+ private void isValid(Credentials credentials, RequestCallback callback) {
+ if (credentials == null) {
+ throw new IllegalArgumentException("'credentials' can't be null");
+ } else if (credentials.getUsername() == null || "".equals(credentials.getUsername())) {
+ throw new IllegalArgumentException("'username' can't be null or empty");
+ } else if (callback == null) {
+ throw new IllegalArgumentException("'callback' can't be null");
+ }
+ }
+
+ private String getURL(final Credentials credentials) {
+ assert credentials != null && credentials.getUsername() != null
+ && !"".equals(credentials.getUsername());
+ return URL.encode(SERVICE_URL + credentials.getUsername());
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JOConverter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JOConverter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JOConverter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JOConverter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,82 @@
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.core.client.JsArray;
+
+import org.apache.cxf.management.web.logging.browser.client.model.AccessControl;
+import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
+import org.apache.cxf.management.web.logging.browser.client.model.Settings;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+
+public final class JOConverter {
+ private JOConverter() {
+
+ }
+
+ public static Settings convert(final JSOSettings src) {
+ if (src == null) {
+ return null;
+ }
+
+ Settings dst = new Settings();
+ dst.setCredentials(convert(src.getCredentials()));
+ JsArray<JSOSubscription> subscriptions = src.getSubscriptions();
+ for (int i = 0; i < subscriptions.length(); i++) {
+ Subscription subscription = convert(subscriptions.get(i));
+ if (subscription != null) {
+ dst.getSubscriptions().add(subscription);
+ }
+ }
+
+ return dst;
+ }
+
+ private static Credentials convert(final JSOCredentials src) {
+ if (src == null) {
+ return null;
+ }
+
+ Credentials dst = new Credentials();
+
+ dst.setUsername(src.getUsername());
+ dst.setPassword(src.getPassword());
+
+ return dst;
+ }
+
+ private static Subscription convert(final JSOSubscription src) {
+ if (src == null) {
+ return null;
+ }
+
+ Subscription dst = new Subscription();
+
+ dst.setName(src.getName());
+ dst.setUrl(src.getURL());
+ dst.setCredentials(convert(src.getCredentials()));
+
+ if (src.getAccessControl() != null) {
+ dst.setAccessControl(AccessControl.valueOf(src.getAccessControl()));
+ }
+
+ return dst;
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOConverter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOConverter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOConverter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOConverter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,84 @@
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.JsArray;
+
+import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
+import org.apache.cxf.management.web.logging.browser.client.model.Settings;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+
+public final class JSOConverter {
+ private JSOConverter() {
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static JSOSettings convert(final Settings src) {
+ if (src == null) {
+ return null;
+ }
+
+ JSOSettings dst = (JSOSettings)JavaScriptObject.createObject();
+
+ dst.setCredentials(convert(src.getCredentials()));
+
+ JsArray<JSOSubscription> dstSubscriptions = (JsArray<JSOSubscription>)JavaScriptObject.createArray();
+ for (Subscription subscription : src.getSubscriptions()) {
+ dstSubscriptions.push(convert(subscription));
+ }
+ dst.setSubscriptions(dstSubscriptions);
+
+ return dst;
+
+ }
+
+ private static JSOCredentials convert(final Credentials src) {
+ if (src == null) {
+ return null;
+ }
+
+ JSOCredentials dst = (JSOCredentials)JavaScriptObject.createObject();
+
+ dst.setUsername(src.getUsername());
+ dst.setPassword(src.getPassword());
+
+ return dst;
+ }
+
+ private static JSOSubscription convert(final Subscription src) {
+ if (src == null) {
+ return null;
+ }
+
+ JSOSubscription dst = (JSOSubscription)JavaScriptObject.createObject();
+
+ dst.setName(src.getName());
+ dst.setURL(src.getUrl());
+ dst.setCredentials(convert(src.getCredentials()));
+
+ if (src.getAccessControl() != null) {
+ dst.setAccessControl(src.getAccessControl().name());
+ }
+
+ return dst;
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOCredentials.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOCredentials.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOCredentials.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOCredentials.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,44 @@
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+public class JSOCredentials extends JavaScriptObject {
+
+ protected JSOCredentials() {
+ }
+
+ public final native void setUsername(String username) /*-{
+ this.username = username;
+ }-*/;
+
+ public final native String getUsername() /*-{
+ return this.username;
+ }-*/;
+
+ public final native void setPassword(String password) /*-{
+ this.password = password;
+ }-*/;
+
+ public final native String getPassword() /*-{
+ return this.password;
+ }-*/;
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSettings.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSettings.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSettings.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSettings.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,58 @@
+// CHECKSTYLE:OFF
+
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.JsArray;
+
+public class JSOSettings extends JavaScriptObject {
+
+ protected JSOSettings() {
+ }
+
+ public final native void setCredentials(JSOCredentials credentials) /*-{
+ this.credentials=credentials;
+ }-*/;
+
+ public final native JSOCredentials getCredentials() /*-{
+ return this.credentials;
+ }-*/;
+
+ public final native void setSubscriptions(JsArray<JSOSubscription> subscriptions) /*-{
+ this.subscriptions=subscriptions;
+ }-*/;
+
+ public final native JsArray<JSOSubscription> getSubscriptions() /*-{
+ if (this.subscriptions != null) {
+ try { //hack
+ this.subscriptions.concat([]);
+ } catch(err) {
+ var temp = this.subscriptions;
+ this.subscriptions = new Array();
+ this.subscriptions.push(temp);
+ }
+ return this.subscriptions;
+ } else {
+ return [];
+ }
+ }-*/;
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSubscription.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSubscription.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSubscription.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/JSOSubscription.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,60 @@
+/**
+ * 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.browser.client.settings;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+public class JSOSubscription extends JavaScriptObject {
+
+ protected JSOSubscription() {
+ }
+
+ public final native void setName(String name) /*-{
+ this.name = name;
+ }-*/;
+
+ public final native String getName() /*-{
+ return this.name;
+ }-*/;
+
+ public final native void setURL(String url) /*-{
+ this.url = url;
+ }-*/;
+
+ public final native String getURL() /*-{
+ return this.url;
+ }-*/;
+
+ public final native void setAccessControl(String accessControl) /*-{
+ this.accessControl = accessControl;
+ }-*/;
+
+ public final native String getAccessControl() /*-{
+ return this.accessControl;
+ }-*/;
+
+ public final native void setCredentials(JSOCredentials credentials) /*-{
+ this.credentials = credentials;
+ }-*/;
+
+ public final native JSOCredentials getCredentials() /*-{
+ return this.credentials;
+ }-*/;
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/LocalStorage.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/LocalStorage.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/LocalStorage.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/LocalStorage.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.management.web.logging.browser.client.settings;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+public class LocalStorage {
+ public native boolean isAvailable() /*-{
+ var key = "isLocalStorageAvailable";
+ $wnd.$.jStorage.set(key, true);
+ return !($wnd.$.jStorage.get(key) == null);
+ }-*/;
+
+ public native void set(String key, JavaScriptObject obj) /*-{
+ $wnd.$.jStorage.set(key, obj);
+ }-*/;
+
+ public native JavaScriptObject get(String key) /*-{
+ return $wnd.$.jStorage.get(key);
+ }-*/;
+
+ public native void deleteKey(String key) /*-{
+ $wnd.$.jStorage.deleteKey(key);
+ }-*/;
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/settings/SettingsManager.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,183 @@
+/**
+ * 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.browser.client.settings;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+import org.apache.cxf.management.web.logging.browser.client.event.AccessDeniedEvent;
+import org.apache.cxf.management.web.logging.browser.client.event.BrowseEvent;
+import org.apache.cxf.management.web.logging.browser.client.exception.SettingsUnavailableException;
+import org.apache.cxf.management.web.logging.browser.client.helper.EventBus;
+import org.apache.cxf.management.web.logging.browser.client.model.Credentials;
+import org.apache.cxf.management.web.logging.browser.client.model.Settings;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+
+@Singleton
+public class SettingsManager {
+ private static final String SETTINGS_KEY = "logBrowser.settings";
+
+ private BootstrapStorageProxy remoteStorage;
+ private Settings settings;
+ private LocalStorage localStorage;
+ private StorageStrategy strategy;
+ private EventBus eventBus;
+
+ public enum StorageStrategy {
+ STORE_LOCALLY_AND_REMOTELY,
+ STORE_REMOTELY
+ }
+
+ @Inject
+ public SettingsManager(BootstrapStorageProxy bootstrapStorage, LocalStorage localStorage,
+ EventBus eventBus) {
+ this.remoteStorage = bootstrapStorage;
+ this.localStorage = localStorage;
+ this.eventBus = eventBus;
+ strategy = localStorage.isAvailable()
+ ? StorageStrategy.STORE_LOCALLY_AND_REMOTELY : StorageStrategy.STORE_REMOTELY;
+ fetchLocally();
+ }
+
+ public void updateSubscription(final Subscription subscription) {
+ if (!isFetched()) {
+ throw new SettingsUnavailableException();
+ } else if (subscription == null) {
+ throw new IllegalArgumentException("'subscription' can't be null");
+ } else if (subscription.getUrl() == null) {
+ throw new IllegalArgumentException("'subscription.url' can't be null");
+ }
+ settings.getSubscriptions().remove(subscription);
+ settings.getSubscriptions().add(subscription);
+ saveSettings();
+ }
+
+ public void removeSubscription(final Subscription subscription) {
+ if (!isFetched()) {
+ throw new SettingsUnavailableException();
+ } else if (subscription == null) {
+ throw new IllegalArgumentException("'subscription' can't be null");
+ } else if (subscription.getUrl() == null) {
+ throw new IllegalArgumentException("'subscription.url' can't be null");
+ }
+ settings.getSubscriptions().remove(subscription);
+ saveSettings();
+ }
+
+ public void setGlobalCredentials(final Credentials credentials) {
+ if (!isFetched()) {
+ throw new SettingsUnavailableException();
+ }
+ settings.setCredentials(credentials);
+ saveSettings();
+ }
+
+ public Credentials getGlobalCredentials() {
+ if (!isFetched()) {
+ throw new SettingsUnavailableException();
+ }
+ return settings.getCredentials();
+ }
+
+ public List<Subscription> getSubscriptions() {
+ if (!isFetched()) {
+ throw new SettingsUnavailableException();
+ }
+ return new ArrayList<Subscription>(settings.getSubscriptions());
+ }
+
+ private void fetchLocally() {
+ if (localStorage.isAvailable()) {
+ JSOSettings jsoSettings = (JSOSettings)localStorage.get(SETTINGS_KEY);
+ if (jsoSettings != null) {
+ settings = JOConverter.convert(jsoSettings);
+ }
+ }
+ }
+
+ public void fetchRemotely(final Credentials credentials) {
+ remoteStorage.getSettings(credentials, new AbstractCallback("settings") {
+
+ @Override
+ public void onSuccess(Object result) {
+ settings = result != null ? (Settings)result : new Settings();
+ settings.setCredentials(credentials);
+ if (strategy == StorageStrategy.STORE_LOCALLY_AND_REMOTELY && localStorage.isAvailable()) {
+ localStorage.set(SETTINGS_KEY, JSOConverter.convert(settings));
+ }
+ eventBus.fireEvent(new BrowseEvent());
+ }
+
+ @Override
+ public void onAccessDenied() {
+ eventBus.fireEvent(new AccessDeniedEvent());
+ }
+
+ @Override
+ protected Object createResult(JavaScriptObject obj) {
+ return JOConverter.convert((JSOSettings)obj);
+ }
+ });
+ }
+
+ private void saveSettings() {
+ if (strategy == StorageStrategy.STORE_LOCALLY_AND_REMOTELY && localStorage.isAvailable()) {
+ localStorage.set(SETTINGS_KEY, JSOConverter.convert(settings));
+ }
+ remoteStorage.setSettings(settings.getCredentials(), settings, new AbstractCallback(null) {
+
+ @Override
+ public void onSuccess(Object result) {
+ }
+
+ @Override
+ public void onAccessDenied() {
+ }
+
+ @Override
+ protected Object createResult(JavaScriptObject obj) {
+ return obj;
+ }
+ });
+ }
+
+ public void flush() {
+ settings = null;
+ if (localStorage.isAvailable()) {
+ localStorage.deleteKey(SETTINGS_KEY);
+ }
+ }
+
+ public boolean isFetched() {
+ return settings != null;
+ }
+
+ public StorageStrategy getStorageStrategy() {
+ return strategy;
+ }
+
+ public void setStorageStrategy(StorageStrategy s) {
+ this.strategy = s;
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,38 @@
+/**
+ * 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.browser.client.view;
+
+import com.google.gwt.user.client.ui.HasValue;
+
+public interface AccessControlView extends View {
+ public interface Presenter {
+ void onSignInButtonClicked();
+ }
+
+ HasValue<String> getUsername();
+
+ HasValue<String> getPassword();
+
+ HasValue<Boolean> getRememberMe();
+
+ void showAccessDeniedMessage();
+
+ void setPresenter(Presenter presenter);
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.ui.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.ui.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.ui.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlView.ui.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+
+ <ui:style>
+ .error { color:red; }
+ .signInOuterTable { margin:50px auto;width:25em;}
+ .signInInnerTable { width:100%;}
+ </ui:style>
+ <g:DecoratorPanel addStyleNames="{style.signInOuterTable}">
+ <g:HTMLPanel>
+ <table class="{style.signInInnerTable}" cellspacing="6">
+ <tr>
+ <td>
+ <g:Label>Username:</g:Label>
+ </td>
+ <td align="right">
+ <g:TextBox ui:field='usernameTextBox'></g:TextBox>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <g:Label>Password:</g:Label>
+ </td>
+ <td align="right">
+ <g:PasswordTextBox ui:field='passwordTextBox'></g:PasswordTextBox>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <g:Label ui:field="accessDeniedLabel" visible="false"
+ addStyleNames="{style.error}">
+ The username or password you entered is incorrect.
+ </g:Label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <g:CheckBox ui:field='rememberMeCheckBox'>Remember me</g:CheckBox>
+ </td>
+ <td align="right">
+ <g:Button ui:field='signInButton'>Sign in</g:Button>
+ </td>
+ </tr>
+ </table>
+ </g:HTMLPanel>
+ </g:DecoratorPanel>
+
+</ui:UiBinder>
\ No newline at end of file
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlViewImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlViewImpl.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlViewImpl.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/AccessControlViewImpl.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,92 @@
+/**
+ * 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.browser.client.view;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.uibinder.client.UiTemplate;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.PasswordTextBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public class AccessControlViewImpl extends Composite implements AccessControlView {
+
+ @UiTemplate("AccessControlView.ui.xml")
+ interface AccessControlViewUiBinder extends UiBinder<Widget, AccessControlViewImpl> {
+ }
+
+ private static AccessControlViewUiBinder uiBinder = GWT.create(AccessControlViewUiBinder.class);
+
+ @UiField
+ Button signInButton;
+ @UiField
+ TextBox usernameTextBox;
+ @UiField
+ CheckBox rememberMeCheckBox;
+ @UiField
+ PasswordTextBox passwordTextBox;
+ @UiField
+ Label accessDeniedLabel;
+
+ private Presenter presenter;
+
+ public AccessControlViewImpl() {
+ initWidget(uiBinder.createAndBindUi(this));
+ }
+
+ @UiHandler("signInButton")
+ void onAddButtonClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onSignInButtonClicked();
+ }
+ }
+
+ public void setPresenter(Presenter presenter) {
+ this.presenter = presenter;
+ }
+
+ public Widget asWidget() {
+ return this;
+ }
+
+ public HasValue<String> getPassword() {
+ return passwordTextBox;
+ }
+
+ public HasValue<Boolean> getRememberMe() {
+ return rememberMeCheckBox;
+ }
+
+ public HasValue<String> getUsername() {
+ return usernameTextBox;
+ }
+
+ public void showAccessDeniedMessage() {
+ accessDeniedLabel.setVisible(true);
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,45 @@
+/**
+ * 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.browser.client.view;
+
+import java.util.List;
+
+import org.apache.cxf.management.web.logging.browser.client.browser.Entry;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+
+public interface BrowseView extends View {
+ public interface Presenter {
+ void onSignOutButtonClicked();
+
+ void onManageSubscriptionsButtonClicked();
+
+ void onSubcriptionTreeItemClicked(Subscription subscription);
+
+ void onOlderButtonClicked();
+
+ void onNewerButtonClicked();
+ }
+
+ void setLogEntries(List<Entry> entries);
+
+ void setSubscription(List<Subscription> subscriptions);
+
+ void setPresenter(Presenter presenter);
+}