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 [3/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/view/BrowseView.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/BrowseView.ui.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseView.ui.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,176 @@
+<?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:image field='gradient' src='hborder.png' repeatStyle='Horizontal' />
+
+ <ui:style field='selectionStyle'
+ type='org.apache.cxf.management.web.logging.browser.client.view.BrowseViewImpl.SelectionStyle'>
+ .selectedRow {
+ background: #adcce7;
+ }
+
+ .selectedRow td {
+ border-top: 1px solid #88a4d6;
+ border-bottom: 1px solid #7b97d0;
+ }
+ </ui:style>
+
+ <ui:style>
+ .signOut {
+ padding-top: 0.3em;
+ padding-right: 0.5em;
+ position: absolute;
+ text-align: right;
+ }
+
+ .manageSubscriptions {
+ font-size: 11px;
+ color: #3366CC;
+ margin-left: 0.4em;
+ }
+
+ .outer {
+ border-left: 1px solid #999;
+ border-bottom: 1px solid #999;
+ cursor: pointer;
+ cursor: hand;
+ }
+
+ .header {
+ background: #E3E8F3 url(./hborder.png) repeat-x scroll 0 -2003px;
+ table-layout: fixed;
+ width: 100%;
+ height: 100%;
+ border-bottom: 2px solid #BBCDF3;
+ border-top: 3px solid #BBCDF3;
+ }
+
+ .header td {
+ text-shadow: #fff 0 2px 2px;
+ padding: 2px 0 1px 10px;
+ }
+
+ .table {
+ table-layout: fixed;
+ width: 100%;
+ }
+
+ .table td {
+ border-top: 1px solid #fff;
+ border-bottom: 1px solid #fff;
+ padding: 2px 0 2px 10px;
+ }
+
+ .detail {
+ border: 1px solid #666;
+ background-color: white;
+ }
+
+ .detailHeader {
+ background: #eee;
+ border-bottom: 1px solid #666;
+ padding: 0.5em;
+ }
+
+ .detailHeaderItem {
+ margin-bottom:0.5em;
+ }
+
+ .body {
+ line-height: 150%;
+ padding: 20px 40px 20px 10px;
+ font-family: 'Times New Roman', Times, serif;
+ }
+ </ui:style>
+ <g:RootLayoutPanel>
+ <g:layer>
+ <g:DockLayoutPanel unit='EM'>
+ <g:north size='2'>
+ <g:Hyperlink ui:field="signOutHyperlink" addStyleNames="{style.signOut}">
+ Sign out
+ </g:Hyperlink>
+ </g:north>
+
+ <g:center>
+ <g:SplitLayoutPanel>
+ <g:west size='192'>
+ <g:DockLayoutPanel unit="EM">
+ <g:north size="20">
+ <g:ScrollPanel>
+ <g:Tree ui:field="subscriptionsTree" />
+ </g:ScrollPanel>
+ </g:north>
+ <g:south size="2">
+ <g:Hyperlink ui:field="manageSubscriptionsHyperlink"
+ addStyleNames="{style.manageSubscriptions}">Manage endpoints
+ »
+ </g:Hyperlink>
+ </g:south>
+ </g:DockLayoutPanel>
+ </g:west>
+
+ <g:north size='200'>
+ <g:DockLayoutPanel styleName='{style.outer}'
+ unit='EM'>
+ <g:north size='2.2'>
+ <g:FlexTable ui:field='header' styleName='{style.header}'
+ cellSpacing='0' cellPadding='0' />
+ </g:north>
+
+ <g:center>
+ <g:FlexTable ui:field='table' styleName='{style.table}'
+ cellSpacing='0' cellPadding='0' />
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:north>
+
+ <g:center>
+ <g:DockLayoutPanel unit='EM' styleName='{style.detail}'>
+ <g:north size='6'>
+ <g:HTMLPanel styleName='{style.detailHeader}'>
+ <div class='{style.detailHeaderItem}'>
+ <b>Date:</b>
+ <span ui:field='dateElement' />
+ </div>
+ <div class='{style.detailHeaderItem}'>
+ <b>Level:</b>
+ <span ui:field='levelElement' />
+ </div>
+ </g:HTMLPanel>
+ </g:north>
+
+ <g:center>
+ <g:ScrollPanel>
+ <g:HTML styleName='{style.body}' ui:field='bodyHTML'
+ wordWrap='true' />
+ </g:ScrollPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:center>
+ </g:SplitLayoutPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:layer>
+ </g:RootLayoutPanel>
+
+</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/BrowseViewImpl.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/BrowseViewImpl.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/BrowseViewImpl.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,233 @@
+/**
+ * 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 com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.SpanElement;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.resources.client.CssResource;
+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.Composite;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HTMLTable.Cell;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.Hyperlink;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.Widget;
+
+import org.apache.cxf.management.web.logging.browser.client.browser.Entry;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+
+public class BrowseViewImpl extends Composite implements BrowseView {
+
+ @UiTemplate("BrowseView.ui.xml")
+ interface BrowseViewUiBinder extends UiBinder<Widget, BrowseViewImpl> {
+ }
+
+ private static BrowseViewUiBinder uiBinder = GWT.create(BrowseViewUiBinder.class);
+
+ interface SelectionStyle extends CssResource {
+ String selectedRow();
+ }
+
+ @UiField
+ Hyperlink signOutHyperlink;
+ @UiField
+ Hyperlink manageSubscriptionsHyperlink;
+ @UiField
+ Tree subscriptionsTree;
+ @UiField
+ FlexTable header;
+ @UiField
+ FlexTable table;
+ @UiField
+ SelectionStyle selectionStyle;
+ @UiField
+ SpanElement dateElement;
+ @UiField
+ SpanElement levelElement;
+ @UiField
+ HTML bodyHTML;
+
+ private List<Entry> logEntries;
+ private NavBar navBar = new NavBar(this);
+
+ private Presenter presenter;
+
+ private int startIndex;
+ private int selectedRow = -1;
+
+
+ public BrowseViewImpl() {
+ initWidget(uiBinder.createAndBindUi(this));
+
+ subscriptionsTree.addSelectionHandler(new SelectionHandler<TreeItem>() {
+
+ public void onSelection(SelectionEvent<TreeItem> event) {
+ if (presenter != null) {
+ presenter.onSubcriptionTreeItemClicked((Subscription)event.getSelectedItem()
+ .getUserObject());
+ }
+ }
+ });
+
+ initTable();
+ }
+
+ public void setSubscription(List<Subscription> subscriptions) {
+ TreeItem root = subscriptionsTree.addItem("Endpoints");
+ for (Subscription subscription : subscriptions) {
+ root.addItem(subscription.getName()).setUserObject(subscription);
+ }
+ }
+
+ public Widget asWidget() {
+ return this;
+ }
+
+ @UiHandler("signOutHyperlink")
+ void onSignOutHyperlinkClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onSignOutButtonClicked();
+ }
+ }
+
+ @UiHandler("manageSubscriptionsHyperlink")
+ void onManageSubscriptionsHyperlinkClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onManageSubscriptionsButtonClicked();
+ }
+ }
+
+ public void setPresenter(Presenter presenter) {
+ this.presenter = presenter;
+ }
+
+ @UiHandler("table")
+ void onTableClicked(ClickEvent event) {
+ Cell cell = table.getCellForEvent(event);
+ if (cell != null) {
+ int row = cell.getRowIndex();
+ selectRow(row);
+ }
+ }
+
+ private void selectRow(int row) {
+ if (logEntries == null) {
+ return;
+ }
+ Entry entry = logEntries.get(startIndex + row);
+ if (entry == null) {
+ return;
+ }
+
+ styleRow(selectedRow, false);
+ styleRow(row, true);
+
+ selectedRow = row;
+
+ setDetailsSection(entry);
+ }
+
+ private void styleRow(int row, boolean selected) {
+ if (row != -1) {
+ String style = selectionStyle.selectedRow();
+
+ if (selected) {
+ table.getRowFormatter().addStyleName(row, style);
+ } else {
+ table.getRowFormatter().removeStyleName(row, style);
+ }
+ }
+ }
+
+ private void initTable() {
+ // Initialize the header.
+ header.getColumnFormatter().setWidth(0, "160px");
+ header.getColumnFormatter().setWidth(1, "128px");
+ header.getColumnFormatter().setWidth(3, "256px");
+
+ header.setText(0, 0, "Date");
+ header.setText(0, 1, "Level");
+ header.setText(0, 2, "Message");
+ header.setWidget(0, 3, navBar);
+ header.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
+
+ // Initialize the table.
+ table.getColumnFormatter().setWidth(0, "160px");
+ table.getColumnFormatter().setWidth(1, "128px");
+
+ }
+
+ public void setLogEntries(List<Entry> entries) {
+ table.clear();
+
+ this.logEntries = entries;
+
+ DateTimeFormat fmt = DateTimeFormat.getFormat("HH:mm:ss dd.MM.yyyy");
+
+ int row = 0;
+ for (Entry entry : entries) {
+ if (entry.getEventTimestamp() != null) {
+ table.setText(row, 0, fmt.format(entry.getEventTimestamp()));
+ }
+ table.setText(row, 1, entry.getLevel());
+ table.setText(row, 2, entry.getMessage());
+ row++;
+ }
+
+ // Total mock
+ navBar.update(100, 1050, 130);
+
+ }
+
+ protected void older() {
+ if (presenter != null) {
+ presenter.onOlderButtonClicked();
+ }
+ }
+
+ protected void newer() {
+ if (presenter != null) {
+ presenter.onNewerButtonClicked();
+ }
+ }
+
+ private void setDetailsSection(Entry entry) {
+ if (entry == null) {
+ return;
+ }
+ if (entry.getEventTimestamp() != null) {
+ dateElement.setInnerText(entry.getEventTimestamp().toString());
+ }
+ levelElement.setInnerText(entry.getLevel());
+ bodyHTML.setHTML(entry.getMessage());
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/EditSubcriptionView.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/EditSubcriptionView.ui.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/EditSubcriptionView.ui.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/EditSubcriptionView.ui.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,91 @@
+<?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>
+ .add{margin:0.4em;}
+ .buttonsDecorator{text-align:right;}
+ </ui:style>
+
+ <g:HTMLPanel>
+ <table cellspacing="6">
+ <tr>
+ <td>
+ <g:Label>Name:</g:Label>
+ </td>
+ <td>
+ <g:TextBox ui:field="nameTextBox"></g:TextBox>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <g:Label>URL:</g:Label>
+ </td>
+ <td>
+ <g:TextBox ui:field="urlTextBox"></g:TextBox>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <g:DisclosurePanel>
+ <g:header>Security</g:header>
+ <g:HTMLPanel>
+ <table cellspacing="6">
+ <tr>
+ <td>
+ <g:Label>Enable:</g:Label>
+ </td>
+ <td>
+ <g:CheckBox ui:field="enabledCheckBox"></g:CheckBox>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <g:Label>Username:</g:Label>
+ </td>
+ <td>
+ <g:TextBox ui:field="usernameTextBox"></g:TextBox>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <g:Label>Password:</g:Label>
+ </td>
+ <td>
+ <g:PasswordTextBox ui:field="passwordTextBox"></g:PasswordTextBox>
+ </td>
+ </tr>
+ </table>
+ </g:HTMLPanel>
+ </g:DisclosurePanel>
+ </td>
+ </tr>
+ </table>
+ <g:FlowPanel addStyleNames="{style.buttonsDecorator}">
+ <g:Button ui:field="cancelButton">Cancel</g:Button>
+ <g:Button ui:field="saveButton" addStyleNames="{style.add}">Save
+ </g:Button>
+ </g:FlowPanel>
+
+ </g:HTMLPanel>
+
+</ui:UiBinder>
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/EditSubcriptionWidget.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/EditSubcriptionWidget.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/EditSubcriptionWidget.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/EditSubcriptionWidget.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,117 @@
+/**
+ * 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.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+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.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+import org.apache.cxf.management.web.logging.browser.client.model.AccessControl;
+import org.apache.cxf.management.web.logging.browser.client.model.Subscription;
+
+public abstract class EditSubcriptionWidget extends Composite {
+
+ @UiTemplate("EditSubcriptionView.ui.xml")
+ interface EditSubcriptionViewUiBinder extends UiBinder<Widget, EditSubcriptionWidget> {
+ }
+
+ private static EditSubcriptionViewUiBinder uiBinder = GWT.create(EditSubcriptionViewUiBinder.class);
+
+ @UiField
+ TextBox nameTextBox;
+ @UiField
+ TextBox urlTextBox;
+ @UiField
+ CheckBox enabledCheckBox;
+ @UiField
+ TextBox usernameTextBox;
+ @UiField
+ TextBox passwordTextBox;
+ @UiField
+ Button cancelButton;
+ @UiField
+ Button saveButton;
+
+ public EditSubcriptionWidget() {
+ initWidget(uiBinder.createAndBindUi(this));
+
+ setAccessForSecurityControls();
+
+ enabledCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
+
+ public void onValueChange(ValueChangeEvent<Boolean> event) {
+ setAccessForSecurityControls();
+ }
+ });
+ }
+
+ private void setAccessForSecurityControls() {
+ if (enabledCheckBox.getValue()) {
+ usernameTextBox.setEnabled(true);
+ passwordTextBox.setEnabled(true);
+
+ } else {
+ usernameTextBox.setEnabled(false);
+ usernameTextBox.setValue("");
+ passwordTextBox.setEnabled(false);
+ passwordTextBox.setValue("");
+ }
+ }
+
+ public void setData(final Subscription subscription) {
+ if (subscription == null) {
+ return;
+ }
+ nameTextBox.setValue(subscription.getName());
+ urlTextBox.setValue(subscription.getUrl());
+ if (subscription.getAccessControl() == AccessControl.SPECIFIED) {
+ enabledCheckBox.setValue(true);
+ if (subscription.getCredentials() != null) {
+ usernameTextBox.setValue(subscription.getCredentials().getUsername());
+ passwordTextBox.setValue(subscription.getCredentials().getPassword());
+ }
+ } else {
+ enabledCheckBox.setValue(false);
+ }
+ setAccessForSecurityControls();
+ }
+
+ @UiHandler("enabledCheckBox")
+ public void onEnabledCheckBoxClicked(ClickEvent event) {
+
+ }
+
+ @UiHandler("cancelButton")
+ public abstract void onCancelButtonClicked(ClickEvent event);
+
+ @UiHandler("saveButton")
+ public abstract void onSaveButtonClicked(ClickEvent event);
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.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/NavBar.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,70 @@
+/**
+ * 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.dom.client.Element;
+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.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A simple widget representing prev/next page navigation.
+ */
+class NavBar extends Composite {
+ @UiTemplate("NavBar.ui.xml")
+ interface Binder extends UiBinder<Widget, NavBar> {
+ }
+
+ private static final Binder BINDER = GWT.create(Binder.class);
+
+ @UiField
+ Element countLabel;
+ @UiField
+ Anchor newerButton;
+ @UiField
+ Anchor olderButton;
+
+ private final BrowseViewImpl outer;
+
+ public NavBar(BrowseViewImpl outer) {
+ initWidget(BINDER.createAndBindUi(this));
+ this.outer = outer;
+ }
+
+ public void update(int startIndex, int count, int max) {
+
+ }
+
+ @UiHandler("newerButton")
+ void onNewerClicked(ClickEvent event) {
+ outer.newer();
+ }
+
+ @UiHandler("olderButton")
+ void onOlderClicked(ClickEvent event) {
+ outer.older();
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.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/NavBar.ui.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/NavBar.ui.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,39 @@
+<!--
+ 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>
+ .anchor {
+ margin: 0 8px;
+ }
+ </ui:style>
+
+ <g:HTMLPanel>
+ <g:Anchor styleName='{style.anchor}' ui:field='newerButton'
+ href='javascript:;'>
+ < newer
+ </g:Anchor>
+ <span ui:field='countLabel' />
+ <g:Anchor styleName='{style.anchor}' ui:field='olderButton'
+ href='javascript:;'>
+ older > </g:Anchor>
+ </g:HTMLPanel>
+</ui:UiBinder>
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.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/SettingsView.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,43 @@
+/**
+ * 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.model.Subscription;
+
+public interface SettingsView extends View {
+
+ public interface Presenter {
+ void onAddSubscription(Subscription subscription);
+
+ void onEditSubscription(Subscription subscription);
+
+ void onRemoveSubscriptionButtonClicked(Subscription subscription);
+
+ void onBackHyperlinkClicked();
+
+ void onSingOutHyperlinkClicked();
+ }
+
+ void setSubscriptions(List<Subscription> subscriptions);
+
+ void setPresenter(Presenter presenter);
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.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/SettingsView.ui.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsView.ui.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,85 @@
+<?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>
+ .signOut {
+ padding-right:4em;
+ padding-top:0.3em;
+ text-align:right;
+ }
+ .settings {
+ background: #FFCC66 none repeat scroll 0 0;
+ margin: 2em auto;
+ width: 90%;
+ }
+
+ .back {
+ margin-top: 0.5em;
+ }
+
+ .title {
+ font-size: 140%;
+ margin: 0.1em 1.5em 0 0.3em;
+ font-weight: bold;
+ }
+
+ .subscriptions {
+ float: left;
+ width:100%;
+ padding-right:1em;
+ margin-top:1em;
+ }
+ </ui:style>
+
+ <g:HTMLPanel>
+ <div>
+ <g:Hyperlink ui:field="singOutHyperlink" addStyleNames="{style.signOut}">Sign
+ out</g:Hyperlink>
+ <g:VerticalPanel addStyleNames="{style.settings}">
+ <g:HorizontalPanel>
+ <g:Label addStyleNames="{style.title}">
+ Settings
+ </g:Label>
+ <g:Hyperlink ui:field="backHyperlink" addStyleNames="{style.back}">
+ « Back to browse
+ </g:Hyperlink>
+ </g:HorizontalPanel>
+
+ <g:TabLayoutPanel stylePrimaryName="settingsTabPanel"
+ barUnit="EM" barHeight="2" height="300px">
+ <g:tab>
+ <g:header>Endpoints</g:header>
+ <g:HTMLPanel>
+ <g:Button ui:field="addSubscriptionButton">
+ Add endpoint
+ </g:Button>
+ <g:FlexTable ui:field="subscriptionsFlexTable"
+ addStyleNames="{style.subscriptions}" />
+ </g:HTMLPanel>
+ </g:tab>
+ </g:TabLayoutPanel>
+ </g:VerticalPanel>
+ </div>
+ </g:HTMLPanel>
+
+</ui:UiBinder>
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsViewImpl.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/SettingsViewImpl.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsViewImpl.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SettingsViewImpl.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,185 @@
+/**
+ * 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 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.Composite;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Hyperlink;
+import com.google.gwt.user.client.ui.Widget;
+
+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.Subscription;
+
+public class SettingsViewImpl extends Composite implements SettingsView {
+
+ @UiTemplate("SettingsView.ui.xml")
+ interface SettingsViewUiBinder extends UiBinder<Widget, SettingsViewImpl> {
+ }
+
+ private static SettingsViewUiBinder uiBinder = GWT.create(SettingsViewUiBinder.class);
+
+ @UiField
+ Hyperlink singOutHyperlink;
+ @UiField
+ Hyperlink backHyperlink;
+ @UiField
+ Button addSubscriptionButton;
+ @UiField
+ FlexTable subscriptionsFlexTable;
+
+ private Presenter presenter;
+
+ public SettingsViewImpl() {
+ initWidget(uiBinder.createAndBindUi(this));
+ }
+
+ public void setSubscriptions(List<Subscription> subscriptions) {
+ subscriptionsFlexTable.clear();
+
+ int row = 0;
+ for (final Subscription subscription : subscriptions) {
+ SubscriptionEntryWidget widget = new SubscriptionEntryWidget() {
+
+ @Override
+ void onEditButtonClicked(ClickEvent event) {
+ final DialogBox db = getDialogBox("Edit endpoint");
+ final EditSubcriptionWidget widget = new EditSubcriptionWidget() {
+
+ @Override
+ public void onCancelButtonClicked(ClickEvent event) {
+ db.hide();
+ }
+
+ @Override
+ public void onSaveButtonClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onEditSubscription(createSubscription(this));
+ }
+ db.hide();
+ }
+
+ };
+ widget.setData(subscription);
+
+ db.setWidget(widget);
+ db.center();
+ db.show();
+ }
+
+ @Override
+ void onRemoveButtonClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onRemoveSubscriptionButtonClicked(subscription);
+ }
+ }
+
+ };
+ widget.nameLabel.setText(subscription.getName());
+ widget.urlLabel.setText(subscription.getUrl());
+
+ subscriptionsFlexTable.setWidget(row, 0, widget);
+
+ row++;
+ }
+ }
+
+ @UiHandler("singOutHyperlink")
+ void onSingOutHyperlinkClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onSingOutHyperlinkClicked();
+ }
+ }
+
+ @UiHandler("backHyperlink")
+ void onBackHyperlinkClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onBackHyperlinkClicked();
+ }
+ }
+
+ @UiHandler("addSubscriptionButton")
+ void onAddSubscriptionButtonClicked(ClickEvent event) {
+ final DialogBox db = getDialogBox("Add endpoint");
+ final EditSubcriptionWidget widget = new EditSubcriptionWidget() {
+
+ @Override
+ public void onCancelButtonClicked(ClickEvent event) {
+ db.hide();
+ }
+
+ @Override
+ public void onSaveButtonClicked(ClickEvent event) {
+ if (presenter != null) {
+ presenter.onAddSubscription(createSubscription(this));
+ }
+ db.hide();
+ }
+
+ };
+ db.setWidget(widget);
+ db.center();
+ db.show();
+ }
+
+ private Subscription createSubscription(final EditSubcriptionWidget widget) {
+ Subscription s = new Subscription();
+ s.setName(widget.nameTextBox.getValue());
+ s.setUrl(widget.urlTextBox.getValue());
+ if (widget.enabledCheckBox.getValue()) {
+ s.setAccessControl(AccessControl.SPECIFIED);
+ Credentials c = new Credentials();
+ c.setUsername(widget.usernameTextBox.getValue());
+ c.setPassword(widget.passwordTextBox.getValue());
+ s.setCredentials(c);
+ } else {
+ s.setAccessControl(AccessControl.NONE);
+ }
+ return s;
+ }
+
+ private DialogBox getDialogBox(String title) {
+ final DialogBox dialogBox = new DialogBox();
+ dialogBox.setText(title);
+ dialogBox.setGlassEnabled(true);
+ dialogBox.setAnimationEnabled(false);
+ dialogBox.setAutoHideEnabled(true);
+ return dialogBox;
+ }
+
+ public void setPresenter(Presenter presenter) {
+ this.presenter = presenter;
+ }
+
+ public Widget asWidget() {
+ return this;
+ }
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SubscriptionEntryWidget.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/SubscriptionEntryWidget.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SubscriptionEntryWidget.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SubscriptionEntryWidget.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.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.Composite;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+public abstract class SubscriptionEntryWidget extends Composite {
+
+ @UiTemplate("SubscriptionEntryWidget.ui.xml")
+ interface SubscriptionEntryWidgetUiBinder extends UiBinder<Widget, SubscriptionEntryWidget> {
+ }
+
+ private static SubscriptionEntryWidgetUiBinder uiBinder = GWT
+ .create(SubscriptionEntryWidgetUiBinder.class);
+
+ @UiField
+ Label nameLabel;
+ @UiField
+ Label urlLabel;
+ @UiField
+ Button editButton;
+ @UiField
+ Button removeButton;
+
+ public SubscriptionEntryWidget() {
+ initWidget(uiBinder.createAndBindUi(this));
+ }
+
+ @UiHandler("editButton")
+ abstract void onEditButtonClicked(ClickEvent event);
+
+ @UiHandler("removeButton")
+ abstract void onRemoveButtonClicked(ClickEvent event);
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SubscriptionEntryWidget.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/SubscriptionEntryWidget.ui.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SubscriptionEntryWidget.ui.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/SubscriptionEntryWidget.ui.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,72 @@
+<?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>
+ .widgets {
+ border-bottom:1px solid #FFCC66;
+ padding-bottom:0.5em;
+ width:100%;
+ }
+ .name {
+ font-weight: bold;
+ }
+ .url {
+ color: grey;
+ float: left;
+ }
+ .labels {
+ float:left;
+ }
+ .buttons {
+ text-align:right;
+ vertical-align:center;
+ }
+ .remove {
+ }
+ .edit {
+ margin-left: 0.5em;
+ margin-right: 1em;
+ }
+ </ui:style>
+
+ <g:HTMLPanel>
+ <table class="{style.widgets}">
+ <tr>
+ <td>
+ <g:Label ui:field="nameLabel" addStyleNames="{style.name}" />
+ <g:Label ui:field="urlLabel" addStyleNames="{style.url}" />
+ </td>
+ <td class="{style.buttons}">
+ <g:Button ui:field="removeButton" addStyleNames="{style.remove}">
+ Remove
+ </g:Button>
+ <g:Button ui:field="editButton" addStyleNames="{style.edit}">
+ Edit
+ </g:Button>
+ </td>
+ </tr>
+
+ </table>
+ </g:HTMLPanel>
+
+</ui:UiBinder>
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/View.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/View.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/View.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/View.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.view;
+
+import com.google.gwt.user.client.ui.Widget;
+
+public interface View {
+
+ Widget asWidget();
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/hborder.png
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/hborder.png?rev=959377&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/browser/client/view/hborder.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.css
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.css?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.css (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.css Wed Jun 30 17:07:14 2010
@@ -0,0 +1,34 @@
+.settingsTabPanel {
+ margin: 0.3em;
+}
+
+.settingsTabPanel .gwt-TabLayoutPanelTabs {
+
+}
+
+.settingsTabPanel .gwt-TabLayoutPanelContent {
+ /*border-color: #92C1F0;*/
+ border-color: #FFF7D7;
+ background: #FFF7D7 none repeat scroll 0 0;
+ border-style: solid;
+ border-width: 3px 2px 2px;
+ overflow: hidden;
+ padding: 6px;
+ height:100%;
+ width:100%;
+}
+
+.settingsTabPanel .gwt-TabLayoutPanelTab {
+ background: #FFF7D7 none repeat scroll 0 0;
+ color: black;
+ cursor: pointer;
+ font-weight: bold;
+ margin-left: 6px;
+ padding: 3px 6px;
+ text-align: center;
+}
+
+.settingsTabPanel .gwt-TabLayoutPanelTab-selected {
+ background: #FFF7D7 none repeat scroll 0 0;
+ cursor: default;
+}
\ No newline at end of file
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.html
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.html?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.html (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/LogBrowser.html Wed Jun 30 17:07:14 2010
@@ -0,0 +1,73 @@
+<!--
+ ~ * Licensed to the Apache Software Foundation (ASF) under one
+ ~ * or more contributor license agreements. See the NOTICE file
+ ~ * distributed with this work for additional information
+ ~ * regarding copyright ownership. The ASF licenses this file
+ ~ * to you under the Apache License, Version 2.0 (the
+ ~ * "License"); you may not use this file except in compliance
+ ~ * with the License. You may obtain a copy of the License at
+ ~ *
+ ~ * http://www.apache.org/licenses/LICENSE-2.0
+ ~ *
+ ~ * Unless required by applicable law or agreed to in writing,
+ ~ * software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ * KIND, either express or implied. See the License for the
+ ~ * specific language governing permissions and limitations
+ ~ * under the License.
+ -->
+
+<!doctype html>
+<!-- The DOCTYPE declaration above will set the -->
+<!-- browser's rendering engine into -->
+<!-- "Standards Mode". Replacing this declaration -->
+<!-- with a "Quirks Mode" doctype may lead to some -->
+<!-- differences in layout. -->
+
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+
+ <!-- -->
+ <!-- Consider inlining CSS to reduce the number of requested files -->
+ <!-- -->
+ <link type="text/css" rel="stylesheet" href="LogBrowser.css">
+
+ <!-- -->
+ <!-- Any title is fine -->
+ <!-- -->
+ <title>Web Application Starter Project</title>
+
+ <!-- -->
+ <!-- This script loads your compiled module. -->
+ <!-- If you add any GWT meta tags, they must -->
+ <!-- be added before this line. -->
+ <!-- -->
+
+ <script type="text/javascript" language="javascript" src="json2.min.js"></script>
+ <script type="text/javascript" language="javascript" src="jstorage.config.js"></script>
+ <script type="text/javascript" language="javascript" src="jstorage.min.js"></script>
+
+ <script type="text/javascript" language="javascript" src="logbrowser.nocache.js"></script>
+ </head>
+
+ <!-- -->
+ <!-- The body can have arbitrary html, or -->
+ <!-- you can leave the body empty if you want -->
+ <!-- to create a completely dynamic UI. -->
+ <!-- -->
+ <body>
+
+ <!-- OPTIONAL: include this if you want history support -->
+ <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
+
+ <!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
+ <noscript>
+ <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
+ Your web browser must have JavaScript enabled
+ in order for this application to display correctly.
+ </div>
+ </noscript>
+
+ </body>
+</html>
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/hborder.png
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/hborder.png?rev=959377&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/hborder.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/json2.min.js
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/json2.min.js?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/json2.min.js (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/json2.min.js Wed Jun 30 17:07:14 2010
@@ -0,0 +1,7 @@
+if(!this.JSON)this.JSON={};
+(function(){function l(b){return b<10?"0"+b:b}function o(b){p.lastIndex=0;return p.test(b)?'"'+b.replace(p,function(f){var c=r[f];return typeof c==="string"?c:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+b+'"'}function m(b,f){var c,d,g,j,i=h,e,a=f[b];if(a&&typeof a==="object"&&typeof a.toJSON==="function")a=a.toJSON(b);if(typeof k==="function")a=k.call(f,b,a);switch(typeof a){case "string":return o(a);case "number":return isFinite(a)?String(a):"null";case "boolean":case "null":return String(a);
+case "object":if(!a)return"null";h+=n;e=[];if(Object.prototype.toString.apply(a)==="[object Array]"){j=a.length;for(c=0;c<j;c+=1)e[c]=m(c,a)||"null";g=e.length===0?"[]":h?"[\n"+h+e.join(",\n"+h)+"\n"+i+"]":"["+e.join(",")+"]";h=i;return g}if(k&&typeof k==="object"){j=k.length;for(c=0;c<j;c+=1){d=k[c];if(typeof d==="string")if(g=m(d,a))e.push(o(d)+(h?": ":":")+g)}}else for(d in a)if(Object.hasOwnProperty.call(a,d))if(g=m(d,a))e.push(o(d)+(h?": ":":")+g);g=e.length===0?"{}":h?"{\n"+h+e.join(",\n"+h)+
+"\n"+i+"}":"{"+e.join(",")+"}";h=i;return g}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+l(this.getUTCMonth()+1)+"-"+l(this.getUTCDate())+"T"+l(this.getUTCHours())+":"+l(this.getUTCMinutes())+":"+l(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,h,n,r={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;if(typeof JSON.stringify!=="function")JSON.stringify=function(b,f,c){var d;n=h="";if(typeof c==="number")for(d=0;d<c;d+=1)n+=" ";else if(typeof c==="string")n=c;if((k=f)&&typeof f!=="function"&&(typeof f!=="object"||typeof f.length!=="number"))throw new Error("JSON.stringify");return m("",
+{"":b})};if(typeof JSON.parse!=="function")JSON.parse=function(b,f){function c(g,j){var i,e,a=g[j];if(a&&typeof a==="object")for(i in a)if(Object.hasOwnProperty.call(a,i)){e=c(a,i);if(e!==undefined)a[i]=e;else delete a[i]}return f.call(g,j,a)}var d;b=String(b);q.lastIndex=0;if(q.test(b))b=b.replace(q,function(g){return"\\u"+("0000"+g.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(b.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){d=eval("("+b+")");return typeof f==="function"?c({"":d},""):d}throw new SyntaxError("JSON.parse");}})();
\ No newline at end of file
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.config.js
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.config.js?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.config.js (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.config.js Wed Jun 30 17:07:14 2010
@@ -0,0 +1 @@
+$={};
\ No newline at end of file
Added: cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.min.js
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.min.js?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.min.js (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/resources/org/apache/cxf/management/web/logging/browser/public/jstorage.min.js Wed Jun 30 17:07:14 2010
@@ -0,0 +1,5 @@
+(function(f){function i(){try{d.jStorage=m(c);if(e){e.setAttribute("jStorage",d.jStorage);e.save("jStorage")}j=d.jStorage?String(d.jStorage).length:0}catch(a){}}function k(a){if(!a&&a!==0||typeof a!="string"&&typeof a!="number")throw new TypeError("Key name must be string or numeric");return true}if(!f||!(f.toJSON||Object.toJSON||window.JSON))throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!");var c={},d={jStorage:"{}"},e=null,j=0,m=f.toJSON||Object.toJSON||window.JSON&&
+(JSON.encode||JSON.stringify),n=f.evalJSON||window.JSON&&(JSON.decode||JSON.parse)||function(a){return String(a).evalJSON()},l={isXML:function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?a.nodeName!=="HTML":false},encode:function(a){if(!this.isXML(a))return false;try{return(new XMLSerializer).serializeToString(a)}catch(b){try{return a.xml}catch(g){}}return false},decode:function(a){var b="DOMParser"in window&&(new DOMParser).parseFromString||window.ActiveXObject&&function(g){var h=new ActiveXObject("Microsoft.XMLDOM");
+h.async="false";h.loadXML(g);return h};if(!b)return false;a=b.call("DOMParser"in window&&new DOMParser||window,a,"text/xml");return this.isXML(a)?a:false}};f.jStorage={version:"0.1.4.1",set:function(a,b){k(a);if(l.isXML(b))b={_is_xml:true,xml:l.encode(b)};c[a]=b;i();return b},get:function(a,b){k(a);if(a in c)return typeof c[a]=="object"&&c[a]._is_xml&&c[a]._is_xml?l.decode(c[a].xml):c[a];return typeof b=="undefined"?null:b},deleteKey:function(a){k(a);if(a in c){delete c[a];i();return true}return false},
+flush:function(){c={};i();try{window.localStorage.clear()}catch(a){}return true},storageObj:function(){function a(){}a.prototype=c;return new a},index:function(){var a=[],b;for(b in c)c.hasOwnProperty(b)&&a.push(b);return a},storageSize:function(){return j}};(function(){if("localStorage"in window)try{d=window.localStorage}catch(a){}else if("globalStorage"in window)try{d=window.globalStorage[window.location.hostname]}catch(b){}else{e=document.createElement("link");if(e.addBehavior){e.style.behavior=
+"url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(e);e.load("jStorage");var g="{}";try{g=e.getAttribute("jStorage")}catch(h){}d.jStorage=g}else{e=null;return}}if(d.jStorage)try{c=n(String(d.jStorage))}catch(o){d.jStorage="{}"}else d.jStorage="{}";j=d.jStorage?String(d.jStorage).length:0})()})(window.jQuery||window.$);
\ No newline at end of file
Added: cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockAtomPullServerApp.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockAtomPullServerApp.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockAtomPullServerApp.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockAtomPullServerApp.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,59 @@
+/**
+ * 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.atom;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.core.Application;
+
+import org.apache.cxf.jaxrs.provider.AtomEntryProvider;
+import org.apache.cxf.jaxrs.provider.AtomFeedProvider;
+
+public class MockAtomPullServerApp extends Application {
+ private static final AtomPullServer SERVICE;
+
+ static {
+ SERVICE = new AtomPullServer();
+ SERVICE.setPageSize(30);
+ SERVICE.setStorage(new MockReadableLogStorage());
+ SERVICE.init();
+ }
+
+ private static final AtomFeedProvider FEED = new AtomFeedProvider();
+ private static final AtomEntryProvider ENTRY = new AtomEntryProvider();
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ classes.add(AtomPullServer.class);
+ classes.add(AtomFeedProvider.class);
+ classes.add(AtomEntryProvider.class);
+ return classes;
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ Set<Object> classes = new HashSet<Object>();
+ classes.add(SERVICE);
+ classes.add(FEED);
+ classes.add(ENTRY);
+ return classes;
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/atom/MockReadableLogStorage.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,61 @@
+/**
+ * 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.atom;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.cxf.jaxrs.ext.search.SearchCondition;
+import org.apache.cxf.management.web.logging.LogLevel;
+import org.apache.cxf.management.web.logging.LogRecord;
+import org.apache.cxf.management.web.logging.ReadableLogStorage;
+
+public class MockReadableLogStorage implements ReadableLogStorage {
+
+ public void close() {
+
+ }
+
+ public int getSize() {
+ return -1;
+ }
+
+ public void load(List<LogRecord> list, SearchCondition<LogRecord> condition, int loadFrom,
+ int maxNumberOfRecords) {
+ list.add(getLog("1"));
+ list.add(getLog("2"));
+ list.add(getLog("3"));
+ list.add(getLog("4"));
+ list.add(getLog("5"));
+ list.add(getLog("6"));
+ list.add(getLog("7"));
+ list.add(getLog("8"));
+ list.add(getLog("9"));
+ }
+
+ private LogRecord getLog(String id) {
+ LogRecord result = new LogRecord(id);
+ result.setMessage("log message" + id);
+ result.setLevel(LogLevel.ERROR);
+ result.setEventTimestamp(new Date());
+ return result;
+ }
+
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockAuthenticationFilter.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockAuthenticationFilter.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockAuthenticationFilter.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockAuthenticationFilter.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,65 @@
+/**
+ * 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.bootstrapping;
+
+import java.util.logging.Logger;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.Provider;
+import static javax.ws.rs.core.Response.Status.UNAUTHORIZED;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.jaxrs.ext.RequestHandler;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.message.Message;
+
+@Provider
+public class MockAuthenticationFilter implements RequestHandler {
+ private static final Logger LOGGER = LogUtils.getL7dLogger(MockAuthenticationFilter.class);
+
+ private final String username;
+ private final String password;
+
+ public MockAuthenticationFilter(final String username, final String password) {
+ if (username == null) {
+ throw new IllegalArgumentException("'username' can't be null");
+ } else if (password == null) {
+ throw new IllegalArgumentException("'password' can't be null");
+ }
+ this.username = username;
+ this.password = password;
+ }
+
+ public Response handleRequest(final Message m, final ClassResourceInfo resourceClass) {
+ assert username != null;
+ assert password != null;
+ AuthorizationPolicy policy = (AuthorizationPolicy)m.get(AuthorizationPolicy.class);
+ if (policy == null) {
+ LOGGER.info("No authentication data'");
+ return Response.status(UNAUTHORIZED).build();
+ } else if (!username.equals(policy.getUserName()) || !password.equals(policy.getPassword())) {
+ LOGGER.info(String.format("Failed authentication, username='%s'", policy.getUserName()));
+ return Response.status(UNAUTHORIZED).build();
+ } else {
+ LOGGER.info(String.format("Successful authentication, username='%s'", policy.getUserName()));
+ return null;
+ }
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockBootstrapStorageApp.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockBootstrapStorageApp.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockBootstrapStorageApp.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockBootstrapStorageApp.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,51 @@
+/**
+ * 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.bootstrapping;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class MockBootstrapStorageApp extends Application {
+
+ private static final BootstrapStorageService SERVICE =
+ new BootstrapStorageServiceImpl(new MockXMLSettingsProvider());
+
+ private static final MockAuthenticationFilter AUTHENTICATION =
+ new MockAuthenticationFilter("admin", "admin");
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ classes.add(BootstrapStorageService.class);
+ classes.add(MockAuthenticationFilter.class);
+ return classes;
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ Set<Object> classes = new HashSet<Object>();
+ classes.add(SERVICE);
+ classes.add(AUTHENTICATION);
+ return classes;
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockXMLSettingsProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockXMLSettingsProvider.java?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockXMLSettingsProvider.java (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/java/org/apache/cxf/management/web/logging/bootstrapping/MockXMLSettingsProvider.java Wed Jun 30 17:07:14 2010
@@ -0,0 +1,206 @@
+/**
+ * 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.bootstrapping;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.thoughtworks.xstream.XStream;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+public class MockXMLSettingsProvider implements SettingsProvider {
+ private static final Logger LOGGER = LogUtils.getL7dLogger(MockXMLSettingsProvider.class);
+ private static final Settings DEFUALT_SETTINGS = new Settings();
+ private static final String DEFAULT_FILENAME = "logBrowserSettingsStorage.xml";
+
+ private Map<String, Entry> cache = new HashMap<String, Entry>();
+ private volatile boolean cached;
+ private String filename;
+
+ public MockXMLSettingsProvider() {
+ this.filename = DEFAULT_FILENAME;
+ }
+
+ public MockXMLSettingsProvider(final String filename) {
+ if (filename == null) {
+ throw new IllegalArgumentException("'filename' can't be null");
+ }
+ this.filename = filename;
+ }
+
+ public void setSettings(final String username, final Settings settings) {
+ assert cache != null;
+ if (username == null || "".equals(username)) {
+ throw new IllegalArgumentException("'username' can't be null or empty");
+ } else if (settings == null) {
+ throw new IllegalArgumentException("'settings' can't be null");
+ }
+ load();
+ synchronized (cache) {
+ Entry entry = cache.get(username);
+ if (entry != null) {
+ entry.setSettings(settings);
+ } else {
+ cache.put(username, new Entry(username, settings));
+ }
+ }
+ save();
+ }
+
+ public Settings getSettings(final String username) {
+ assert cache != null;
+ if (username == null || "".equals(username)) {
+ throw new IllegalArgumentException("'username' can't be null or empty");
+ }
+ load();
+ synchronized (cache) {
+ Entry entry = cache.get(username);
+ return entry != null && entry.getSettings() != null ? entry.getSettings() : DEFUALT_SETTINGS;
+ }
+ }
+
+ private void load() {
+ assert cache != null;
+ assert filename != null;
+ if (cached) {
+ return;
+ }
+ LOGGER.info(String.format("Load settings from file, filename='%s'", filename));
+ XStream xs = getConfiguredXStream();
+ Entries entries = null;
+ try {
+ FileReader fr = new FileReader(filename);
+ BufferedReader br = new BufferedReader(fr);
+ entries = (Entries)xs.fromXML(br);
+ br.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.SEVERE, "Error occur while loading settings", ex);
+ }
+ if (entries != null) {
+ for (Entry entry : entries.getEntries()) {
+ if (entry != null && entry.getUsername() != null) {
+ synchronized (cache) {
+ cache.put(entry.getUsername(), entry);
+ }
+ }
+ }
+ }
+ cached = true;
+ }
+
+ private void save() {
+ assert cache != null;
+ assert filename != null;
+ LOGGER.info(String.format("Persist settings to file, filename='%s'", filename));
+ XStream xs = getConfiguredXStream();
+ Entries entries;
+ synchronized (cache) {
+ entries = new Entries(cache.values());
+ }
+ try {
+ FileWriter fw = new FileWriter(filename);
+ BufferedWriter bw = new BufferedWriter(fw);
+ synchronized (cache) {
+ xs.toXML(entries, bw);
+ }
+ bw.flush();
+ bw.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.SEVERE, "Error occur while saving settings", ex);
+ }
+ }
+
+ private XStream getConfiguredXStream() {
+ XStream xs = new XStream();
+ xs.alias("settings", Settings.class);
+ xs.addImplicitCollection(Settings.class, "subscriptions");
+ xs.alias("subscription", Subscription.class);
+ xs.alias("entries", Entries.class);
+ xs.alias("entry", Entry.class);
+ xs.useAttributeFor(Entry.class, "username");
+ xs.useAttributeFor(Entry.class, "modified");
+ xs.addImplicitCollection(Entries.class, "entries");
+ return xs;
+ }
+
+ static class Entry {
+ private String username;
+ private Date modified;
+ private Settings settings;
+
+ Entry(String username, Settings settings) {
+ this.username = username;
+ this.modified = new Date();
+ this.settings = settings;
+ }
+
+ String getUsername() {
+ return username;
+ }
+
+ void setUsername(String username) {
+ this.username = username;
+ }
+
+ Date getModified() {
+ return modified;
+ }
+
+ Settings getSettings() {
+ return settings;
+ }
+
+ void setSettings(Settings settings) {
+ this.settings = settings;
+ this.modified = new Date();
+ }
+ }
+
+ static class Entries {
+ private List<Entry> entries;
+
+ Entries(Collection<Entry> entries) {
+ this.entries = new ArrayList<Entry>(entries);
+ }
+
+ List<Entry> getEntries() {
+ if (entries == null) {
+ entries = new ArrayList<Entry>();
+ }
+ return entries;
+ }
+
+ void setEntries(List<Entry> entries) {
+ this.entries = entries;
+ }
+ }
+}
Added: cxf/sandbox/logbrowser/rt/management-web/src/test/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/test/resources/WEB-INF/web.xml?rev=959377&view=auto
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/test/resources/WEB-INF/web.xml (added)
+++ cxf/sandbox/logbrowser/rt/management-web/src/test/resources/WEB-INF/web.xml Wed Jun 30 17:07:14 2010
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+ <welcome-file-list>
+ <welcome-file>logbrowser/LogBrowser.html</welcome-file>
+ </welcome-file-list>
+
+ <servlet>
+ <servlet-name>BootstrapStorage</servlet-name>
+ <display-name>BootstrapStorage</display-name>
+ <servlet-class>
+ org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
+ </servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>
+ org.apache.cxf.management.web.logging.bootstrapping.MockBootstrapStorageApp
+ </param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>BootstrapStorage</servlet-name>
+ <url-pattern>/rest/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>AtomPullServer</servlet-name>
+ <display-name>AtomPullServer</display-name>
+ <servlet-class>
+ org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
+ </servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>
+ org.apache.cxf.management.web.logging.atom.MockAtomPullServerApp
+ </param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>AtomPullServer</servlet-name>
+ <url-pattern>/log/*</url-pattern>
+ </servlet-mapping>
+</web-app>