You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by em...@apache.org on 2014/07/04 00:58:03 UTC
svn commit: r1607764 [4/7] - in /james/bond/trunk/src:
main/java/org/apache/james/bond/ main/java/org/apache/james/bond/client/
main/java/org/apache/james/bond/client/configure/
main/java/org/apache/james/bond/client/configure/dns/ main/java/org/apache...
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,96 @@
+/****************************************************************
+ * 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.james.bond.client.manage.user;
+
+import org.apache.james.bond.client.manage.user.ManageUsersTabView.Presenter;
+import org.apache.james.bond.client.serverconnection.UserProxy;
+
+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.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.PasswordTextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the user to change a password
+ */
+
+public class ChangePasswordView extends DialogBox {
+
+ private static ChangePasswordViewUiBinder uiBinder = GWT
+ .create(ChangePasswordViewUiBinder.class);
+ private Presenter listener;
+ private UserProxy user;
+
+ interface ChangePasswordViewUiBinder extends
+ UiBinder<Widget, ChangePasswordView> {
+ }
+
+ /**
+ * It creates a new {@link DialogBox} that is able to change the password of
+ * the user using the {@link Presenter}
+ *
+ * @param user
+ * @param listener
+ */
+ public ChangePasswordView(UserProxy user, Presenter listener) {
+ this.user = user;
+ this.listener = listener;
+
+ setHTML("Change password");
+ setWidget(uiBinder.createAndBindUi(this));
+ usernameLabel.setText(user.getUsername());
+ }
+
+ @UiField
+ Label usernameLabel;
+ @UiField
+ PasswordTextBox passwordTextBox;
+ @UiField
+ Button changeButton;
+ @UiField
+ Button cancelButton;
+
+ /**
+ * It changes the password of the user and closes the
+ * {@link ChangePasswordView}
+ *
+ * @param e
+ */
+ @UiHandler("changeButton")
+ void onChangeClick(ClickEvent e) {
+ listener.changePassword(user, passwordTextBox.getText());
+ this.hide();
+ }
+
+ /**
+ * Closes the {@link ChangePasswordView}
+ *
+ * @param e
+ */
+ @UiHandler("cancelButton")
+ void onCancelClick(ClickEvent e) {
+ this.hide();
+ }
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ChangePasswordView.ui.xml Thu Jul 3 22:57:59 2014
@@ -0,0 +1,38 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+ 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>
+ .important {
+ font-weight: bold;
+ }
+ </ui:style>
+
+ <g:HTMLPanel>
+ <g:Label>Username: </g:Label>
+ <g:Label ui:field="usernameLabel" addStyleNames="{style.important}">
+ </g:Label>
+ <g:Label>Password: </g:Label>
+ <g:PasswordTextBox ui:field="passwordTextBox"></g:PasswordTextBox>
+ <g:Label></g:Label>
+ <g:Button ui:field="cancelButton">Cancel</g:Button>
+ <g:Button ui:field="changeButton">Change Password</g:Button>
+ </g:HTMLPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,93 @@
+/****************************************************************
+ * 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.james.bond.client.manage.user;
+
+import org.apache.james.bond.client.manage.user.ManageUsersTabView.Presenter;
+import org.apache.james.bond.client.serverconnection.UserProxy;
+
+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.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the confirmation that the user must be
+ * deleted
+ */
+public class DeleteConfirmationView extends DialogBox {
+
+ private static DeleteConfirmationViewUiBinder uiBinder = GWT
+ .create(DeleteConfirmationViewUiBinder.class);
+ private UserProxy user;
+ private Presenter listener;
+
+ interface DeleteConfirmationViewUiBinder extends
+ UiBinder<Widget, DeleteConfirmationView> {
+ }
+
+ /**
+ * It creates a {@link DeleteConfirmationView} to confirm to delete the user
+ * through the listener
+ *
+ * @param user
+ * @param listener
+ */
+ public DeleteConfirmationView(UserProxy user, Presenter listener) {
+ this.user = user;
+ this.listener = listener;
+
+ setHTML("Delete user");
+ setWidget(uiBinder.createAndBindUi(this));
+ usernameLabel.setText(user.getUsername());
+ }
+
+ @UiField
+ Label usernameLabel;
+ @UiField
+ Button cancelButton;
+ @UiField
+ Button deleteButton;
+
+ /**
+ * It deletes the user from the server and closes the
+ * {@link DeleteConfirmationView}
+ *
+ * @param e
+ */
+ @UiHandler("deleteButton")
+ void onChangeClick(ClickEvent e) {
+ listener.deleteUser(user);
+ this.hide();
+ }
+
+ /**
+ * It closes the {@link DeleteConfirmationView}
+ *
+ * @param e
+ */
+ @UiHandler("cancelButton")
+ void onCancelClick(ClickEvent e) {
+ this.hide();
+ }
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/DeleteConfirmationView.ui.xml Thu Jul 3 22:57:59 2014
@@ -0,0 +1,34 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+ 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>
+ .important {
+ font-weight: bold;
+ }
+ </ui:style>
+
+ <g:HTMLPanel>
+ <g:Label>Username: </g:Label>
+ <g:Label ui:field="usernameLabel" addStyleNames="{style.important}"></g:Label>
+ <g:Button ui:field="cancelButton">Cancel</g:Button>
+ <g:Button ui:field="deleteButton">Delete</g:Button>
+ </g:HTMLPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabView.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,69 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.user;
+
+import org.apache.james.bond.client.serverconnection.UserProxy;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+/**
+ * It defines the methods to show, edit and save a users
+ */
+public interface ManageUsersTabView extends IsWidget {
+ /**
+ * It sets the {@link Presenter} that manages the view
+ *
+ * @param listener
+ */
+ void setPresenter(Presenter listener);
+
+ /**
+ * It reads the users from the server to update the information
+ */
+ void updateData();
+
+ /**
+ * It defines the behavior of the presenter that manages the
+ * {@link ManageUsersTabView}
+ */
+ public interface Presenter {
+ /**
+ * It deletes a user from the server
+ *
+ * @param user
+ */
+ void deleteUser(UserProxy user);
+
+ /**
+ * It changes the password of the user for the newPassword
+ *
+ * @param user
+ * @param newPassword
+ */
+ void changePassword(UserProxy user, String newPassword);
+
+ /**
+ * It adds a user to the server with the username and password received
+ *
+ * @param username
+ * @param password
+ */
+ void addUser(String username, String password);
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,240 @@
+/****************************************************************
+ * 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.james.bond.client.manage.user;
+
+import org.apache.james.bond.client.serverconnection.UserProxy;
+
+import com.google.gwt.cell.client.ButtonCell;
+import com.google.gwt.cell.client.FieldUpdater;
+import com.google.gwt.cell.client.TextCell;
+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.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.DataGrid;
+import com.google.gwt.user.cellview.client.Header;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
+import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Implementation of {@link ManageUsersTabView} that shows the users information
+ * in a {@link DataGrid} letting the user to update, add or delete the users or
+ * changes their password
+ */
+public class ManageUsersTabViewImpl extends Composite implements
+ ManageUsersTabView {
+
+ private static ManageUsersTabViewImplUiBinder uiBinder = GWT
+ .create(ManageUsersTabViewImplUiBinder.class);
+ private Presenter listener;
+ private UsersAsyncDataProvider dataProvider;
+
+ interface ManageUsersTabViewImplUiBinder extends
+ UiBinder<Widget, ManageUsersTabViewImpl> {
+ }
+
+ final String COLUMN_NAME_USERNAME = "Username";
+ final String COLUMN_NAME_CHANGE_PASSWORD = "Change Password";
+ final String COLUMN_NAME_DELETE = "Delete User";
+ final String EMPTY_MESSAGE = "No data to display";
+
+ @UiField
+ Button addUserButton;
+ @UiField
+ DataGrid<UserProxy> dataGrid;
+ @UiField(provided = true)
+ SimplePager pager;
+
+ /**
+ * It creates a {@link ManageUsersTabViewImpl} indicating the
+ * {@link UsersAsyncDataProvider} used by the dataGrid
+ *
+ * @param dataProvider
+ */
+ public ManageUsersTabViewImpl(UsersAsyncDataProvider dataProvider) {
+ this.dataProvider = dataProvider;
+ dataGrid = new DataGrid<UserProxy>();
+ dataGrid.setWidth("100%");
+
+ dataGrid.setAutoHeaderRefreshDisabled(true);
+ dataGrid.setEmptyTableWidget(new Label(EMPTY_MESSAGE));
+
+ SimplePager.Resources pagerResources = GWT
+ .create(SimplePager.Resources.class);
+ pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
+ pager.setDisplay(dataGrid);
+
+ initWidget(uiBinder.createAndBindUi(this));
+
+ AsyncHandler columnSortHandler = new AsyncHandler(dataGrid);
+ dataGrid.addColumnSortHandler(columnSortHandler);
+
+ buildUsersTable();
+ dataGrid.setPageSize(20);
+
+ this.setSize("100%", "100%");
+ }
+
+ /**
+ * It opens a new window to let the user add a new user
+ *
+ * @param e
+ */
+ @UiHandler("addUserButton")
+ void onAddUserClick(ClickEvent e) {
+ final AddUserView addUserView = new AddUserView(listener);
+ addUserView.center();
+ addUserView.show();
+ }
+
+ private void buildUsersTable() {
+ dataGrid.addColumn(buildColumnUsername(),
+ buildHeader(COLUMN_NAME_USERNAME), null);
+ dataGrid.addColumn(buildColumnDelete(), buildHeader(COLUMN_NAME_DELETE),
+ null);
+ dataGrid.addColumn(buildColumnChangePassword(),
+ buildHeader(COLUMN_NAME_CHANGE_PASSWORD), null);
+ setAsyncDataProvider();
+ }
+
+ /**
+ * It builds a column with the users
+ *
+ * @return
+ */
+ private Column<UserProxy, String> buildColumnUsername() {
+ Column<UserProxy, String> columnUserName = new TextColumn<UserProxy>() {
+ @Override
+ public String getValue(UserProxy user) {
+ return user.getUsername();
+ }
+ };
+
+ columnUserName.setDataStoreName(COLUMN_NAME_USERNAME);
+ columnUserName.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ columnUserName.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ columnUserName.setSortable(true);
+
+ return columnUserName;
+ }
+
+ /**
+ * It creates a column that is able to open a dialog to delete the user in the
+ * selected row
+ *
+ * @return
+ */
+ private Column<UserProxy, String> buildColumnDelete() {
+ Column<UserProxy, String> columnDelete = new Column<UserProxy, String>(
+ new ButtonCell()) {
+ @Override
+ public String getValue(UserProxy object) {
+ return "Delete";
+ }
+ };
+ columnDelete.setDataStoreName(COLUMN_NAME_DELETE);
+ columnDelete.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ columnDelete.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+
+ columnDelete.setFieldUpdater(new FieldUpdater<UserProxy, String>() {
+ public void update(int index, final UserProxy user, String value) {
+ final DeleteConfirmationView deleteConfirmationView = new DeleteConfirmationView(
+ user, listener);
+ deleteConfirmationView.center();
+ deleteConfirmationView.show();
+ }
+ });
+
+ return columnDelete;
+ }
+
+ /**
+ * It creates a column that is able to open a dialog to change the password of
+ * the user in the row
+ *
+ * @return
+ */
+ private Column<UserProxy, String> buildColumnChangePassword() {
+ Column<UserProxy, String> columnChangePassword = new Column<UserProxy, String>(
+ new ButtonCell()) {
+ @Override
+ public String getValue(UserProxy object) {
+ return "Change password";
+ }
+ };
+ columnChangePassword.setDataStoreName(COLUMN_NAME_CHANGE_PASSWORD);
+ columnChangePassword
+ .setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ columnChangePassword.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+
+ columnChangePassword.setFieldUpdater(new FieldUpdater<UserProxy, String>() {
+ public void update(int index, final UserProxy object, String value) {
+ final ChangePasswordView changePasswordView = new ChangePasswordView(
+ object, listener);
+ changePasswordView.center();
+ changePasswordView.show();
+ }
+ });
+
+ return columnChangePassword;
+ }
+
+ /**
+ * It creates a header with the text
+ *
+ * @param text
+ * @return
+ */
+ private Header<String> buildHeader(final String text) {
+ return new Header<String>(new TextCell()) {
+ @Override
+ public String getValue() {
+ return text;
+ }
+ };
+ }
+
+ /**
+ * It sets the {@link UsersAsyncDataProvider} for the {@link DataGrid}
+ */
+ private void setAsyncDataProvider() {
+ dataProvider.addDataDisplay(dataGrid);
+ dataProvider.updateRowCount(24, true);
+ }
+
+ @Override
+ public void setPresenter(Presenter listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public void updateData() {
+ dataProvider.onRangeChanged(dataGrid);
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/ManageUsersTabViewImpl.ui.xml Thu Jul 3 22:57:59 2014
@@ -0,0 +1,71 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+ 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"
+ xmlns:ct="urn:import:com.google.gwt.user.cellview.client">
+ <ui:style>
+ .panel {
+ width: 100%;
+ height: 100%;
+ }
+
+ .delete {
+ background: url(delete_button.png) no-repeat;
+ width: 30px;
+ height: 25px;
+ display: inline-block;
+ float: right;
+ cursor: pointer;
+ }
+
+ .delete:hover {
+ background-position: -30px 0px;
+ }
+
+ .button {
+ height: 30px;
+ width: 140px;
+ }
+ </ui:style>
+
+ <g:DockLayoutPanel unit="PX" addStyleNames="{style.panel}">
+ <g:north size="40">
+ <g:Button ui:field="addUserButton" addStyleNames="{style.button}">Add New
+ User</g:Button>
+ </g:north>
+ <g:center size="200">
+ <g:ResizeLayoutPanel>
+ <ct:DataGrid ui:field="dataGrid" />
+ </g:ResizeLayoutPanel>
+ </g:center>
+
+ <g:south size="40">
+ <g:HTMLPanel>
+ <table style="width:100%">
+ <tr>
+ <td align='center'>
+ <ct:SimplePager ui:field='pager' />
+ </td>
+ </tr>
+ </table>
+ </g:HTMLPanel>
+ </g:south>
+ </g:DockLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/UsersAsyncDataProvider.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/UsersAsyncDataProvider.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/UsersAsyncDataProvider.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/UsersAsyncDataProvider.java Thu Jul 3 22:57:59 2014
@@ -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.james.bond.client.manage.user;
+
+import java.util.List;
+
+import org.apache.james.bond.client.serverconnection.AppRequestFactory;
+import org.apache.james.bond.client.serverconnection.BasicReceiver;
+import org.apache.james.bond.client.serverconnection.UserProxy;
+
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.Range;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+
+/**
+ * An {@link AsyncDataProvider} that keeps the information about users
+ */
+public class UsersAsyncDataProvider extends AsyncDataProvider<UserProxy> {
+ private AppRequestFactory requestFactory;
+
+ /**
+ * It creates a {@link UsersAsyncDataProvider} defining the
+ * {@link AppRequestFactory} to use to get the data
+ *
+ * @param requestFactory
+ */
+ public UsersAsyncDataProvider(AppRequestFactory requestFactory) {
+ this.requestFactory = requestFactory;
+ }
+
+ @Override
+ protected void onRangeChanged(HasData<UserProxy> display) {
+ final Range range = display.getVisibleRange();
+ Receiver<List<UserProxy>> rec = new BasicReceiver<List<UserProxy>>() {
+ /**
+ * It updates the data with the users received
+ *
+ * @param users
+ */
+ public void onSuccess(List<UserProxy> users) {
+ updateRowData(range.getStart(), users);
+ updateRowCount(users.size(), true);
+ }
+ };
+ this.requestFactory.createUserRequest().listUsers().fire(rec);
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorActivity.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorActivity.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorActivity.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorActivity.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,95 @@
+/****************************************************************
+ * 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.james.bond.client.monitor;
+
+import org.apache.james.bond.client.CommonActivity;
+import org.apache.james.bond.client.CommonTabsView;
+import org.apache.james.bond.client.ioc.ClientFactory;
+import org.apache.james.bond.client.monitor.MonitorSummaryView.Presenter;
+import org.apache.james.bond.client.serverconnection.BasicReceiver;
+import org.apache.james.bond.client.serverconnection.MonitoringProxy;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+
+/**
+ * This {@link CommonActivity} manages all the views to monitor the server.
+ */
+public class MonitorActivity extends CommonActivity implements Presenter {
+ private MonitorSummaryView monitorSummaryView;
+ private Timer timer;
+
+ /**
+ * It creates a {@link MonitorActivity} setting it as a presenter for the
+ * views
+ *
+ * @see CommonActivity
+ *
+ * @param place
+ * @param clientFactory
+ */
+ public MonitorActivity(MonitorPlace place, ClientFactory clientFactory) {
+ super(place, clientFactory);
+ monitorSummaryView = clientFactory.getMonitorSummaryView();
+
+ getMonitoringInformation();
+ }
+
+ @Override
+ protected CommonTabsView createMainView(ClientFactory clientFactory,
+ String prefixPlace) {
+ return clientFactory.getMonitorView(prefixPlace);
+ }
+
+ @Override
+ public void start(AcceptsOneWidget panel, EventBus eventBus) {
+ super.start(panel, eventBus);
+ timer.scheduleRepeating(1500);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ timer.cancel();
+ }
+
+ @Override
+ public void getMonitoringInformation() {
+
+ final Receiver<MonitoringProxy> rec = new BasicReceiver<MonitoringProxy>() {
+ @Override
+ public void onSuccess(MonitoringProxy monitoring) {
+ if (monitoring != null)
+ monitorSummaryView.showInformation(monitoring);
+ }
+ };
+
+ timer = new Timer() {
+ @Override
+ public void run() {
+ MonitorActivity.this.requestFactory.createMonitoringRequest()
+ .getMonitoringInformation().fire(rec);
+ }
+ };
+
+ timer.scheduleRepeating(1500);
+ }
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorPlace.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorPlace.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorPlace.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorPlace.java Thu Jul 3 22:57:59 2014
@@ -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.james.bond.client.monitor;
+
+import org.apache.james.bond.client.CommonPlace;
+
+import com.google.gwt.place.shared.PlaceTokenizer;
+import com.google.gwt.place.shared.Prefix;
+
+/**
+ * This class is a {@link CommonPlace} with "MonitorPlace" as prefix
+ */
+public class MonitorPlace extends CommonPlace {
+ /**
+ * {@inheritDoc}
+ */
+ public MonitorPlace(String token) {
+ super(token);
+ }
+
+ @Override
+ public String getPrefixPlace() {
+ return "MonitorPlace";
+ }
+
+ @Prefix("MonitorPlace")
+ public static class Tokenizer implements PlaceTokenizer<MonitorPlace> {
+ @Override
+ public String getToken(MonitorPlace place) {
+ return place.getToken();
+ }
+
+ @Override
+ public MonitorPlace getPlace(String token) {
+ return new MonitorPlace(token);
+ }
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryView.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.james.bond.client.monitor;
+
+import org.apache.james.bond.client.serverconnection.MonitoringProxy;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+/**
+ * It defines the methods to show the main monitoring information
+ */
+public interface MonitorSummaryView extends IsWidget {
+ /**
+ * It fills the view with the information of the {@link MonitoringProxy}
+ *
+ * @param monitoring
+ */
+ void showInformation(MonitoringProxy monitoring);
+
+ /**
+ * It defines the behavior of the presenter that manages the
+ * {@link MonitorSummaryView}
+ */
+ public interface Presenter {
+ /**
+ * It retrieves the monitoring information from the server and updates the
+ * view periodically
+ */
+ public void getMonitoringInformation();
+ }
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryViewImpl.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryViewImpl.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryViewImpl.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorSummaryViewImpl.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,349 @@
+/****************************************************************
+ * 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.james.bond.client.monitor;
+
+import org.apache.james.bond.client.serverconnection.MonitoringProxy;
+
+import com.google.gwt.user.client.ui.CaptionPanel;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Implementation of {@link MonitorSummaryView} that shows all the summary
+ * monitoring information that the JAMES server allows
+ */
+public class MonitorSummaryViewImpl extends ScrollPanel implements
+ MonitorSummaryView {
+ private Label totalLoadedClasses, loadedClasses, unloadedClasses, initHeap,
+ usedHeap, committedHeap, maxHeap, initNonHeap, usedNonHeap,
+ committedNonHeap, maxNonHeap, objectsPending, threadCpuTime,
+ threadUserTime, threadDaemon, threadPeak, threadTotal, threadCreated,
+ bootClasspath, classpath, libraryClasspath, mgmSpecVersion, name,
+ specName, specVendor, specVersion, startTime, uptime, vmName, vmVendor,
+ vmVersion, architecture, availableProcessors, osName, systemLoad,
+ osVersion;
+
+ /**
+ * It creates a view that shows the monitoring information: heap memory,
+ * threads, operating system, class loading and runtime information
+ */
+ public MonitorSummaryViewImpl() {
+ super();
+
+ FlexTable flexTable = new FlexTable();
+ FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
+
+ flexTable.setWidget(0, 0, getHeapMemoryView());
+ flexTable.setWidget(0, 1, getThreadView());
+ flexTable.setWidget(1, 0, getOSView());
+ flexTable.setWidget(1, 1, getClassLoadingView());
+ flexTable.setWidget(2, 0, getRuntimeView());
+
+ cellFormatter.setColSpan(2, 0, 2);
+ this.add(flexTable);
+ }
+
+ /**
+ * It creates a view for the class loading information
+ *
+ * @return
+ */
+ private Widget getClassLoadingView() {
+ CaptionPanel captionPanel = new CaptionPanel("Class Loading");
+ FlexTable flexTable = new FlexTable();
+ FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
+ flexTable.setCellPadding(3);
+
+ totalLoadedClasses = new Label();
+ loadedClasses = new Label();
+ unloadedClasses = new Label();
+
+ flexTable.setWidget(0, 0, new Label("Total loaded class count:"));
+ flexTable.setWidget(1, 0, new Label("Loaded class count:"));
+ flexTable.setWidget(2, 0, new Label("Unloaded class count:"));
+
+ flexTable.setWidget(0, 1, totalLoadedClasses);
+ flexTable.setWidget(1, 1, loadedClasses);
+ flexTable.setWidget(2, 1, unloadedClasses);
+
+ cellFormatter.setWidth(0, 0, "200px");
+ cellFormatter.setWidth(0, 1, "200px");
+
+ captionPanel.add(flexTable);
+ captionPanel.setHeight("130px");
+ return captionPanel;
+ }
+
+ /**
+ * It creates a view for the heap memory information
+ *
+ * @return
+ */
+ private Widget getHeapMemoryView() {
+ CaptionPanel captionPanel = new CaptionPanel("Memory Use");
+ FlexTable flexTable = new FlexTable();
+ FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
+ flexTable.setCellPadding(3);
+
+ initHeap = new Label();
+ usedHeap = new Label();
+ committedHeap = new Label();
+ maxHeap = new Label();
+ initNonHeap = new Label();
+ usedNonHeap = new Label();
+ committedNonHeap = new Label();
+ maxNonHeap = new Label();
+ objectsPending = new Label();
+
+ flexTable.setWidget(0, 0, new Label("Heap memory init:"));
+ flexTable.setWidget(1, 0, new Label("Heap memory used:"));
+ flexTable.setWidget(2, 0, new Label("Heap memory committed:"));
+ flexTable.setWidget(3, 0, new Label("Heap memory max:"));
+
+ flexTable.setWidget(4, 0, new Label("Non heap memory init:"));
+ flexTable.setWidget(5, 0, new Label("Non heap memory used:"));
+ flexTable.setWidget(6, 0, new Label("Non heap memory committed:"));
+ flexTable.setWidget(7, 0, new Label("Non heap memory max:"));
+
+ flexTable.setWidget(8, 0, new Label("Objects pending finalization:"));
+
+ flexTable.setWidget(0, 1, initHeap);
+ flexTable.setWidget(1, 1, usedHeap);
+ flexTable.setWidget(2, 1, committedHeap);
+ flexTable.setWidget(3, 1, maxHeap);
+
+ flexTable.setWidget(4, 1, initNonHeap);
+ flexTable.setWidget(5, 1, usedNonHeap);
+ flexTable.setWidget(6, 1, committedNonHeap);
+ flexTable.setWidget(7, 1, maxNonHeap);
+
+ flexTable.setWidget(8, 1, objectsPending);
+
+ cellFormatter.setWidth(0, 0, "200px");
+ cellFormatter.setWidth(0, 1, "200px");
+
+ captionPanel.add(flexTable);
+ return captionPanel;
+ }
+
+ /**
+ * It creates a view for the thread information
+ *
+ * @return
+ */
+ private Widget getThreadView() {
+ CaptionPanel captionPanel = new CaptionPanel("Threads");
+ FlexTable flexTable = new FlexTable();
+ FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
+ flexTable.setCellPadding(3);
+
+ threadCpuTime = new Label();
+ threadUserTime = new Label();
+ threadDaemon = new Label();
+ threadPeak = new Label();
+ threadTotal = new Label();
+ threadCreated = new Label();
+
+ flexTable.setWidget(0, 0, new Label(
+ "Current thread CPU time (nanoseconds):"));
+ flexTable.setWidget(1, 0, new Label(
+ "Current thread user time (nanoseconds):"));
+ flexTable.setWidget(2, 0, new Label("Daemon threads:"));
+ flexTable.setWidget(3, 0, new Label("Peak threads:"));
+ flexTable.setWidget(4, 0, new Label("Total lived threads:"));
+ flexTable.setWidget(5, 0, new Label("Total threads created:"));
+
+ flexTable.setWidget(0, 1, threadCpuTime);
+ flexTable.setWidget(1, 1, threadUserTime);
+ flexTable.setWidget(2, 1, threadDaemon);
+ flexTable.setWidget(3, 1, threadPeak);
+ flexTable.setWidget(4, 1, threadTotal);
+ flexTable.setWidget(5, 1, threadCreated);
+
+ cellFormatter.setWidth(0, 0, "200px");
+ cellFormatter.setWidth(0, 1, "200px");
+
+ captionPanel.add(flexTable);
+ captionPanel.setHeight("222px");
+ return captionPanel;
+ }
+
+ /**
+ * It creates a view for the runtime information
+ *
+ * @return
+ */
+ private Widget getRuntimeView() {
+ CaptionPanel captionPanel = new CaptionPanel("Runtime JVM");
+ FlexTable flexTable = new FlexTable();
+ FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
+ flexTable.setCellPadding(3);
+
+ bootClasspath = new Label();
+ classpath = new Label();
+ libraryClasspath = new Label();
+ mgmSpecVersion = new Label();
+ name = new Label();
+ specName = new Label();
+ specVendor = new Label();
+ specVersion = new Label();
+ startTime = new Label();
+ uptime = new Label();
+ vmName = new Label();
+ vmVendor = new Label();
+ vmVersion = new Label();
+
+ flexTable.setWidget(0, 0, new Label("VM name:"));
+ flexTable.setWidget(1, 0, new Label("VM vendor:"));
+ flexTable.setWidget(2, 0, new Label("VM version:"));
+ flexTable.setWidget(3, 0, new Label("Management Specification Version:"));
+ flexTable.setWidget(4, 0, new Label("Start time (miliseconds):"));
+
+ flexTable.setWidget(0, 2, new Label("Name:"));
+ flexTable.setWidget(1, 2, new Label("Specification name:"));
+ flexTable.setWidget(2, 2, new Label("Specification vendor:"));
+ flexTable.setWidget(3, 2, new Label("Specification version:"));
+ flexTable.setWidget(4, 2, new Label("Uptime (miliseconds):"));
+
+ flexTable.setWidget(10, 0, new Label("Library path:"));
+ flexTable.setWidget(11, 0, new Label("Boot classpath:"));
+ flexTable.setWidget(12, 0, new Label("Classpath:"));
+
+ flexTable.setWidget(0, 1, vmName);
+ flexTable.setWidget(1, 1, vmVendor);
+ flexTable.setWidget(2, 1, vmVersion);
+ flexTable.setWidget(3, 1, mgmSpecVersion);
+ flexTable.setWidget(4, 1, startTime);
+
+ flexTable.setWidget(0, 3, name);
+ flexTable.setWidget(1, 3, specName);
+ flexTable.setWidget(2, 3, specVendor);
+ flexTable.setWidget(3, 3, specVersion);
+ flexTable.setWidget(4, 3, uptime);
+
+ flexTable.setWidget(10, 1, libraryClasspath);
+ flexTable.setWidget(11, 1, bootClasspath);
+ flexTable.setWidget(12, 1, classpath);
+
+ cellFormatter.setColSpan(10, 1, 6);
+ cellFormatter.setColSpan(11, 1, 6);
+ cellFormatter.setColSpan(12, 1, 6);
+
+ cellFormatter.setWidth(0, 0, "200px");
+ cellFormatter.setWidth(0, 1, "200px");
+ cellFormatter.setWidth(0, 2, "200px");
+ cellFormatter.setWidth(0, 3, "200px");
+
+ captionPanel.add(flexTable);
+ return captionPanel;
+ }
+
+ /**
+ * It creates a view for the operating system information
+ *
+ * @return
+ */
+ private Widget getOSView() {
+ CaptionPanel captionPanel = new CaptionPanel("Operating System");
+ FlexTable flexTable = new FlexTable();
+ FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
+ flexTable.setCellPadding(3);
+
+ architecture = new Label();
+ availableProcessors = new Label();
+ osName = new Label();
+ systemLoad = new Label();
+ osVersion = new Label();
+
+ flexTable.setWidget(0, 0, new Label("Architecture:"));
+ flexTable.setWidget(1, 0, new Label("Available processors:"));
+ flexTable.setWidget(2, 0, new Label("Name:"));
+ flexTable.setWidget(3, 0, new Label("System load average:"));
+ flexTable.setWidget(4, 0, new Label("Version:"));
+
+ flexTable.setWidget(0, 1, architecture);
+ flexTable.setWidget(1, 1, availableProcessors);
+ flexTable.setWidget(2, 1, osName);
+ flexTable.setWidget(3, 1, systemLoad);
+ flexTable.setWidget(4, 1, osVersion);
+
+ cellFormatter.setWidth(0, 0, "200px");
+ cellFormatter.setWidth(0, 1, "200px");
+
+ captionPanel.add(flexTable);
+ return captionPanel;
+ }
+
+ @Override
+ public void showInformation(MonitoringProxy monitoring) {
+ totalLoadedClasses.setText(Long.toString(monitoring
+ .getClassLoadingTotalLoadedClassCount()));
+ loadedClasses.setText(Long.toString(monitoring
+ .getClassLoadingLoadedClassCount()));
+ unloadedClasses.setText(Long.toString(monitoring
+ .getClassLoadingUnloadedClassCount()));
+
+ initHeap.setText(Long.toString(monitoring.getHeapMemoryUsageInit()));
+ usedHeap.setText(Long.toString(monitoring.getHeapMemoryUsageUsed()));
+ committedHeap
+ .setText(Long.toString(monitoring.getHeapMemoryUsageComitted()));
+ maxHeap.setText(Long.toString(monitoring.getHeapMemoryUsageMax()));
+
+ initNonHeap.setText(Long.toString(monitoring.getNonHeapMemoryUsageInit()));
+ usedNonHeap.setText(Long.toString(monitoring.getNonHeapMemoryUsageUsed()));
+ committedNonHeap.setText(Long.toString(monitoring
+ .getNonHeapMemoryUsageComitted()));
+ maxNonHeap.setText(Long.toString(monitoring.getNonHeapMemoryUsageMax()));
+ objectsPending.setText(Integer.toString(monitoring
+ .getMemoryObjectPendingFinalizationCount()));
+
+ threadCpuTime.setText(Long.toString(monitoring.getCurrentThreadCpuTime()));
+ threadUserTime
+ .setText(Long.toString(monitoring.getCurrentThreadUserTime()));
+ threadDaemon.setText(Integer.toString(monitoring.getDaemonThreadCount()));
+ threadPeak.setText(Integer.toString(monitoring.getPeakThreadCount()));
+ threadTotal.setText(Integer.toString(monitoring.getThreadCount()));
+ threadCreated
+ .setText(Long.toString(monitoring.getTotalStartedThreadCount()));
+
+ bootClasspath.setText(monitoring.getRuntimeBootClassPath());
+ classpath.setText(monitoring.getRuntimeClassPath());
+ libraryClasspath.setText(monitoring.getRuntimeLibraryPath());
+ mgmSpecVersion.setText(monitoring.getRuntimeManagementSpecVersion());
+ name.setText(monitoring.getRuntimeName());
+ specName.setText(monitoring.getRuntimeSpecName());
+ specVendor.setText(monitoring.getRuntimeSpecVendor());
+ specVersion.setText(monitoring.getRuntimeSpecVersion());
+ startTime.setText(Long.toString(monitoring.getRuntimeStartTime()));
+ uptime.setText(Long.toString(monitoring.getRuntimeUpTime()));
+ vmName.setText(monitoring.getRuntimeVmName());
+ vmVendor.setText(monitoring.getRuntimeVmVendor());
+ vmVersion.setText(monitoring.getRuntimeVmVersion());
+
+ architecture.setText(monitoring.getOSArch());
+ availableProcessors.setText(Integer.toString(monitoring
+ .getOSAvailableProcessors()));
+ osName.setText(monitoring.getOSName());
+ systemLoad.setText(Double.toString(monitoring.getOSSystemLoadAverage()));
+ osVersion.setText(monitoring.getOSVersion());
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorView.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.james.bond.client.monitor;
+
+import org.apache.james.bond.client.CommonTabsView;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+/**
+ * It defines the methods necessary to add all the necessary tabs to monitor the
+ * server
+ */
+public interface MonitorView extends CommonTabsView {
+ /**
+ * It defines the main tab for the {@link MonitorView}
+ *
+ * @param view
+ */
+ public void setSummaryTab(IsWidget view);
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorViewImpl.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorViewImpl.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorViewImpl.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/monitor/MonitorViewImpl.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.james.bond.client.monitor;
+
+import org.apache.james.bond.client.CommonTabsViewImpl;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+/**
+ * This class defines the view to monitor the James server
+ */
+public class MonitorViewImpl extends CommonTabsViewImpl implements MonitorView {
+ /**
+ * {@inheritDoc}
+ */
+ public MonitorViewImpl(String place) {
+ super(place);
+ }
+
+ @Override
+ public void setSummaryTab(IsWidget view) {
+ addTab(view, "Summary");
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppActivityMapper.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppActivityMapper.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppActivityMapper.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppActivityMapper.java Thu Jul 3 22:57:59 2014
@@ -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.james.bond.client.mvp;
+
+import org.apache.james.bond.client.configure.ConfigureActivity;
+import org.apache.james.bond.client.configure.ConfigurePlace;
+import org.apache.james.bond.client.ioc.ClientFactory;
+import org.apache.james.bond.client.manage.ManageActivity;
+import org.apache.james.bond.client.manage.ManagePlace;
+import org.apache.james.bond.client.monitor.MonitorActivity;
+import org.apache.james.bond.client.monitor.MonitorPlace;
+
+import com.google.gwt.activity.shared.Activity;
+import com.google.gwt.activity.shared.ActivityMapper;
+import com.google.gwt.place.shared.Place;
+
+/**
+ * This class maps the {@link Place} with the right {@link Activity}
+ */
+public class AppActivityMapper implements ActivityMapper {
+ private ClientFactory clientFactory;
+
+ /**
+ * It creates received the {@link ClientFactory} to get all the views and
+ * controllers from
+ *
+ * @param clientFactory
+ */
+ public AppActivityMapper(ClientFactory clientFactory) {
+ super();
+ this.clientFactory = clientFactory;
+ }
+
+ @Override
+ public Activity getActivity(Place place) {
+ if (place instanceof ManagePlace) {
+ return new ManageActivity((ManagePlace) place, clientFactory);
+ } else if (place instanceof ConfigurePlace) {
+ return new ConfigureActivity((ConfigurePlace) place, clientFactory);
+ } else if (place instanceof MonitorPlace) {
+ return new MonitorActivity((MonitorPlace) place, clientFactory);
+ }
+ return null;
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppPlaceHistoryMapper.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppPlaceHistoryMapper.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppPlaceHistoryMapper.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/mvp/AppPlaceHistoryMapper.java Thu Jul 3 22:57:59 2014
@@ -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.james.bond.client.mvp;
+
+import org.apache.james.bond.client.configure.ConfigurePlace;
+import org.apache.james.bond.client.manage.ManagePlace;
+import org.apache.james.bond.client.monitor.MonitorPlace;
+
+import com.google.gwt.place.shared.PlaceHistoryMapper;
+import com.google.gwt.place.shared.WithTokenizers;
+
+@WithTokenizers({ ManagePlace.Tokenizer.class, ConfigurePlace.Tokenizer.class,
+ MonitorPlace.Tokenizer.class })
+public interface AppPlaceHistoryMapper extends PlaceHistoryMapper {
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/AppRequestFactory.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/AppRequestFactory.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/AppRequestFactory.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/AppRequestFactory.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,280 @@
+/****************************************************************
+ * 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.james.bond.client.serverconnection;
+
+import java.util.List;
+
+import org.apache.james.bond.server.configure.dns.DNSService;
+import org.apache.james.bond.server.configure.dns.DNSServiceLocator;
+import org.apache.james.bond.server.configure.imap.ImapService;
+import org.apache.james.bond.server.configure.imap.ImapServiceLocator;
+import org.apache.james.bond.server.configure.lmtp.LmtpService;
+import org.apache.james.bond.server.configure.lmtp.LmtpServiceLocator;
+import org.apache.james.bond.server.configure.pop3.Pop3Service;
+import org.apache.james.bond.server.configure.pop3.Pop3ServiceLocator;
+import org.apache.james.bond.server.configure.smtp.SmtpService;
+import org.apache.james.bond.server.configure.smtp.SmtpServiceLocator;
+import org.apache.james.bond.server.manage.domain.DomainService;
+import org.apache.james.bond.server.manage.domain.DomainServiceLocator;
+import org.apache.james.bond.server.manage.mappings.MappingService;
+import org.apache.james.bond.server.manage.mappings.MappingServiceLocator;
+import org.apache.james.bond.server.manage.user.UserService;
+import org.apache.james.bond.server.manage.user.UserServiceLocator;
+import org.apache.james.bond.server.monitor.MonitoringService;
+import org.apache.james.bond.server.monitor.MonitoringServiceLocator;
+
+import com.google.web.bindery.requestfactory.shared.Request;
+import com.google.web.bindery.requestfactory.shared.RequestContext;
+import com.google.web.bindery.requestfactory.shared.RequestFactory;
+import com.google.web.bindery.requestfactory.shared.Service;
+
+/**
+ * {@link RequestFactory} that manages all the connections with the server
+ */
+public interface AppRequestFactory extends RequestFactory {
+
+ UserRequest createUserRequest();
+
+ @Service(value = UserService.class, locator = UserServiceLocator.class)
+ public interface UserRequest extends RequestContext {
+ /**
+ * It retrieves all the users from the server
+ *
+ * @return
+ */
+ Request<List<UserProxy>> listUsers();
+
+ /**
+ * It saves the user if it does not exist
+ *
+ * @param user
+ * @return
+ */
+ Request<Void> persist(UserProxy user);
+
+ /**
+ * It removes the user from the server
+ *
+ * @param user
+ * @return
+ */
+ Request<Void> remove(UserProxy user);
+
+ /**
+ *
+ * @param user
+ * @return
+ */
+ Request<Void> changePassword(UserProxy user);
+ }
+
+ DomainRequest createDomainRequest();
+
+ @Service(value = DomainService.class, locator = DomainServiceLocator.class)
+ public interface DomainRequest extends RequestContext {
+ /**
+ * It retrieves all the domains from the server
+ *
+ * @return
+ */
+ Request<List<DomainProxy>> listDomains();
+
+ /**
+ * It saves the domain in the server
+ *
+ * @param domain
+ * @return
+ */
+ Request<Void> persist(DomainProxy domain);
+
+ /**
+ * It removes the domain from the server
+ *
+ * @param domain
+ * @return
+ */
+ Request<Void> remove(DomainProxy domain);
+ }
+
+ MappingRequest createMappingRequest();
+
+ @Service(value = MappingService.class, locator = MappingServiceLocator.class)
+ public interface MappingRequest extends RequestContext {
+ /**
+ * It retrieves all the mappings from the server
+ *
+ * @return
+ */
+ Request<List<MappingProxy>> listMappings();
+
+ /**
+ * It adds a new address mapping to the user and domain received
+ *
+ * @param user
+ * @param domain
+ * @param address
+ * @return
+ */
+ Request<Void> addAddressMapping(String user, String domain, String address);
+
+ /**
+ * It removes the address mapping of the user and domain received
+ *
+ * @param user
+ * @param domain
+ * @param address
+ * @return
+ */
+ Request<Void> removeAddressMapping(String user, String domain,
+ String address);
+
+ /**
+ * It adds a new regular expression mapping to the user and domain received
+ *
+ * @param user
+ * @param domain
+ * @param regex
+ * @return
+ */
+ Request<Void> addRegexMapping(String user, String domain, String regex);
+
+ /**
+ * It removes the regular expression mapping of the user and domain received
+ *
+ * @param user
+ * @param domain
+ * @param regex
+ * @return
+ */
+ Request<Void> removeRegexMapping(String user, String domain, String regex);
+
+ }
+
+ DnsRequest createDnsRequest();
+
+ @Service(value = DNSService.class, locator = DNSServiceLocator.class)
+ public interface DnsRequest extends RequestContext {
+ /**
+ * It retrieves all the information of the DNS protocol
+ *
+ * @return
+ */
+ Request<DNSProxy> getAllDNSData();
+
+ /**
+ * It saves all the changes made on the {@link DNSProxy}
+ *
+ * @param dns
+ * @return
+ */
+ Request<Void> persist(DNSProxy dns);
+ }
+
+ Pop3Request createPop3Request();
+
+ @Service(value = Pop3Service.class, locator = Pop3ServiceLocator.class)
+ public interface Pop3Request extends RequestContext {
+ /**
+ * It retrieves all the information of the POP3 protocol
+ *
+ * @return
+ */
+ Request<Pop3Proxy> getAllPop3Data();
+
+ /**
+ * It saves all the changes made on the {@link Pop3Proxy}
+ *
+ * @param pop3
+ * @return
+ */
+ Request<Void> persist(Pop3Proxy pop3);
+ }
+
+ SmtpRequest createSmtpRequest();
+
+ @Service(value = SmtpService.class, locator = SmtpServiceLocator.class)
+ public interface SmtpRequest extends RequestContext {
+ /**
+ * It retrieves all the information of the SMTP protocol
+ *
+ * @return
+ */
+ Request<SmtpProxy> getAllSmtpData();
+
+ /**
+ * It saves all the changes made on the {@link SmtpProxy}
+ *
+ * @param smtp
+ * @return
+ */
+ Request<Void> persist(SmtpProxy smtp);
+ }
+
+ LmtpRequest createLmtpRequest();
+
+ @Service(value = LmtpService.class, locator = LmtpServiceLocator.class)
+ public interface LmtpRequest extends RequestContext {
+ /**
+ * It retrieves all the information of the LMTP protocol
+ *
+ * @return
+ */
+ Request<LmtpProxy> getAllLmtpData();
+
+ /**
+ * It saves all the changes made on the {@link LmtpProxy}
+ *
+ * @param lmtp
+ * @return
+ */
+ Request<Void> persist(LmtpProxy lmtp);
+ }
+
+ ImapRequest createImapRequest();
+
+ @Service(value = ImapService.class, locator = ImapServiceLocator.class)
+ public interface ImapRequest extends RequestContext {
+ /**
+ * It retrieves all the information of the IMAP protocol
+ *
+ * @return
+ */
+ Request<ImapProxy> getAllImapData();
+
+ /**
+ * It saves all the changes made on the {@link ImapProxy}
+ *
+ * @param imap
+ * @return
+ */
+ Request<Void> persist(ImapProxy imap);
+ }
+
+ MonitoringRequest createMonitoringRequest();
+
+ @Service(value = MonitoringService.class, locator = MonitoringServiceLocator.class)
+ public interface MonitoringRequest extends RequestContext {
+ /**
+ * It retrieves all the monitoring information that the server supply
+ *
+ * @return
+ */
+ Request<MonitoringProxy> getMonitoringInformation();
+ }
+}
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BaseProtocolProxy.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BaseProtocolProxy.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BaseProtocolProxy.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BaseProtocolProxy.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,75 @@
+/****************************************************************
+ * 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.james.bond.client.serverconnection;
+
+import com.google.web.bindery.requestfactory.shared.EntityProxy;
+
+public interface BaseProtocolProxy extends EntityProxy {
+ public boolean isEnabled();
+
+ public void setEnabled(boolean enabled);
+
+ public String getBind();
+
+ public void setBind(String bind);
+
+ public String getConnectionBacklog();
+
+ public void setConnectionBacklog(String connectionBacklog);
+
+ public String getConnectionTimeout();
+
+ public void setConnectionTimeout(String connectionTimeout);
+
+ public String getConnectionLimit();
+
+ public void setConnectionLimit(String connectionLimit);
+
+ public String getConnectionLimitPerIp();
+
+ public void setConnectionLimitPerIp(String connectionLimitPerIp);
+
+ public boolean isHelloNameAutodetect();
+
+ public void setHelloNameAutodetect(boolean autodetect);
+
+ public String getHelloNameValue();
+
+ public void setHelloNameValue(String value);
+
+ public boolean isTlsSocket();
+
+ public void setTlsSocket(boolean tlsSocket);
+
+ public boolean isTlsStart();
+
+ public void setTlsStart(boolean tlsStart);
+
+ public String getTlsKeystore();
+
+ public void setTlsKeystore(String tlsKeystore);
+
+ public String getTlsSecret();
+
+ public void setTlsSecret(String tlsSecret);
+
+ public String getTlsProvider();
+
+ public void setTlsProvider(String tlsProvider);
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BasicReceiver.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BasicReceiver.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BasicReceiver.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/BasicReceiver.java Thu Jul 3 22:57:59 2014
@@ -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.james.bond.client.serverconnection;
+
+import com.google.gwt.core.shared.GWT;
+import com.google.gwt.user.client.Window;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+/**
+ * It defines a {@link Receiver} that shows and error when the connection fails
+ *
+ * @param <T>
+ */
+public abstract class BasicReceiver<T> extends Receiver<T> {
+ /**
+ * It shows the error on a window in the client or in console in the server
+ *
+ * @param error
+ */
+ public void onFailure(ServerFailure error) {
+ String msg = error.getMessage();
+ if (GWT.isClient()) {
+ Window.alert(msg);
+ } else {
+ System.out.println(msg);
+ }
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ClientValidatorFactory.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ClientValidatorFactory.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ClientValidatorFactory.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ClientValidatorFactory.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.james.bond.client.serverconnection;
+
+import javax.validation.Validator;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.validation.client.AbstractGwtValidatorFactory;
+import com.google.gwt.validation.client.GwtValidation;
+import com.google.gwt.validation.client.impl.AbstractGwtValidator;
+
+/**
+ * {@link AbstractGwtValidatorFactory} that creates the specified
+ * {@link GwtValidator}.
+ */
+public final class ClientValidatorFactory extends AbstractGwtValidatorFactory {
+
+ /**
+ * Validator marker for the Validation Sample project. Only the classes listed
+ * in the {@link GwtValidation} annotation can be validated.
+ */
+ @GwtValidation(value = { BaseProtocolProxy.class, DNSProxy.class,
+ Pop3Proxy.class })
+ public interface GwtValidator extends Validator {
+ }
+
+ @Override
+ public AbstractGwtValidator createValidator() {
+ return GWT.create(GwtValidator.class);
+ }
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DNSProxy.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DNSProxy.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DNSProxy.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DNSProxy.java Thu Jul 3 22:57:59 2014
@@ -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.james.bond.client.serverconnection;
+
+import java.util.List;
+
+import org.apache.james.bond.server.configure.dns.DNS;
+import org.apache.james.bond.server.configure.dns.DNSLocator;
+
+import com.google.web.bindery.requestfactory.shared.EntityProxy;
+import com.google.web.bindery.requestfactory.shared.ProxyFor;
+
+@ProxyFor(value = DNS.class, locator = DNSLocator.class)
+public interface DNSProxy extends EntityProxy {
+ public List<String> getServersIp();
+
+ public void setServersIp(List<String> serversIp);
+
+ public boolean isAutodiscover();
+
+ public void setAutodiscover(boolean autodiscover);
+
+ public boolean isAuthoritative();
+
+ public void setAuthoritative(boolean authoritative);
+
+ public boolean isSingleIPperMX();
+
+ public void setSingleIPperMX(boolean singleIPperMX);
+
+ public String getMaxCacheSize();
+
+ public void setMaxCacheSize(String maxCacheSize);
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DomainProxy.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DomainProxy.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DomainProxy.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/DomainProxy.java Thu Jul 3 22:57:59 2014
@@ -0,0 +1,34 @@
+/****************************************************************
+ * 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.james.bond.client.serverconnection;
+
+import org.apache.james.bond.server.manage.domain.Domain;
+import org.apache.james.bond.server.manage.domain.DomainLocator;
+
+import com.google.web.bindery.requestfactory.shared.EntityProxy;
+import com.google.web.bindery.requestfactory.shared.ProxyFor;
+
+@ProxyFor(value = Domain.class, locator = DomainLocator.class)
+public interface DomainProxy extends EntityProxy {
+ String getId();
+
+ String getDomain();
+
+ void setDomain(String domain);
+}
\ No newline at end of file
Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ImapProxy.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ImapProxy.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ImapProxy.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/serverconnection/ImapProxy.java Thu Jul 3 22:57:59 2014
@@ -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. *
+ ****************************************************************/
+package org.apache.james.bond.client.serverconnection;
+
+import org.apache.james.bond.server.configure.imap.Imap;
+import org.apache.james.bond.server.configure.imap.ImapLocator;
+
+import com.google.web.bindery.requestfactory.shared.ProxyFor;
+
+@ProxyFor(value = Imap.class, locator = ImapLocator.class)
+public interface ImapProxy extends BaseProtocolProxy {
+ public boolean isCompress();
+
+ public void setCompress(boolean compress);
+
+ public String getMaxLinelength();
+
+ public void setMaxLinelength(String maxLinelength);
+
+ public String getInMemSizeLimit();
+
+ public void setInMemSizeLimit(String inMemSizeLimit);
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org