DNA SVN: r1162 - in branches/eclipse/org.jboss.dna.publish.ui.swt: src/org/jboss/dna/web/jcr/rest/client/swt and 3 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-08-14 15:19:06 -0400 (Fri, 14 Aug 2009)
New Revision: 1162
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java
Removed:
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java
Log:
Now using the Eclipse Job API for publishing and unpublishing. Deleted PublishingResultsDialog since writing to Eclipse Console View seems to be enough. Added a test connection button on the ServerPage.
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -54,22 +54,28 @@
public static I18n newServerActionText;
public static I18n newServerActionToolTip;
+
+ public static I18n publishJobPublishCanceledMsg;
+ public static I18n publishJobConsoleName;
+ public static I18n publishJobPublish;
+ public static I18n publishJobPublishFile;
+ public static I18n publishJobPublishFileFailed;
+ public static I18n publishJobPublishFileInfo;
+ public static I18n publishJobPublishFileWarning;
+ public static I18n publishJobPublishFinishedMsg;
+ public static I18n publishJobPublishName;
+ public static I18n publishJobPublishTaskName;
+ public static I18n publishJobUnexpectedErrorMsg;
+ public static I18n publishJobUnpublish;
+ public static I18n publishJobUnpublishCanceledMsg;
+ public static I18n publishJobUnpublishFile;
+ public static I18n publishJobUnpublishFileFailed;
+ public static I18n publishJobUnpublishFileInfo;
+ public static I18n publishJobUnpublishFileWarning;
+ public static I18n publishJobUnpublishFinishedMsg;
+ public static I18n publishJobUnpublishName;
+ public static I18n publishJobUnpublishTaskName;
- public static I18n publishingResultsPublishNotAttemptedMsg;
- public static I18n publishingResultsTooManyResultsMsg;
- public static I18n publishingResultsUnknownSeverityMsg;
- public static I18n publishingResultsUnpublishNotAttemptedMsg;
-
- public static I18n publishOperationConsoleName;
- public static I18n publishOperationPublish;
- public static I18n publishOperationPublishFile;
- public static I18n publishOperationPublishFileFailed;
- public static I18n publishOperationPublishTaskName;
- public static I18n publishOperationUnpublish;
- public static I18n publishOperationUnpublishFile;
- public static I18n publishOperationUnpublishFileFailed;
- public static I18n publishOperationUnpublishTaskName;
-
public static I18n publishPagePublishTitle;
public static I18n publishPageLocationGroupTitle;
public static I18n publishPageMissingRepositoryStatusMsg;
@@ -97,19 +103,6 @@
public static I18n publishPageWorkspacePublishToolTip;
public static I18n publishPageWorkspaceUnpublishToolTip;
- public static I18n publishResultsDialogErrorIncompletePublishingMsg;
- public static I18n publishResultsDialogErrorIncompleteUnpublishingMsg;
- public static I18n publishResultsDialogErrorPublishingMsg;
- public static I18n publishResultsDialogErrorUnpublishingMsg;
- public static I18n publishResultsDialogFileHeader;
- public static I18n publishResultsDialogIncompletePublishMsg;
- public static I18n publishResultsDialogIncompleteUnpublishMsg;
- public static I18n publishResultsDialogMessageHeader;
- public static I18n publishResultsDialogPublishMsg;
- public static I18n publishResultsDialogStatisticsMsg;
- public static I18n publishResultsDialogTitle;
- public static I18n publishResultsDialogUnpublishMsg;
-
public static I18n publishWizardPublishErrorMsg;
public static I18n publishWizardPublishTitle;
public static I18n publishWizardUnpublishTitle;
@@ -128,6 +121,12 @@
public static I18n serverPageSavePasswordButton;
public static I18n serverPageSavePasswordLabel;
public static I18n serverPageSavePasswordToolTip;
+ public static I18n serverPageTestConnectionLabel;
+ public static I18n serverPageTestConnectionButton;
+ public static I18n serverPageTestConnectionButtonToolTip;
+ public static I18n serverPageTestConnectionDialogFailureMsg;
+ public static I18n serverPageTestConnectionDialogTitle;
+ public static I18n serverPageTestConnectionDialogSuccessMsg;
public static I18n serverPageTitle;
public static I18n serverPageUrlLabel;
public static I18n serverPageUrlToolTip;
@@ -141,6 +140,9 @@
public static I18n serverWizardNewServerErrorMsg;
public static I18n serverWizardNewServerTitle;
+ public static I18n testServerActionText;
+ public static I18n testServerActionToolTip;
+
static {
try {
I18n.initialize(RestClientI18n.class);
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties 2009-08-14 19:19:06 UTC (rev 1162)
@@ -31,7 +31,7 @@
deleteServerDialogErrorsOccurredMsg = There were errors deleting servers from the server registry. See log for more details.
deleteServerDialogMultipleServersMsg = Are you sure you want to delete these {0} servers?
-deleteServerDialogOneServerMsg = Are you sure you want to delete the "{0}" server?
+deleteServerDialogOneServerMsg = Are you sure you want to delete the server with URL of "{0}" and user "{1}?"
deleteServerDialogTitle = Confirm Delete Server
editServerActionText = Server Properties
@@ -44,21 +44,27 @@
newServerActionText = New Server
newServerActionToolTip = Create a new server
-publishingResultsPublishNotAttemptedMsg = Publishing not attempted
-publishingResultsTooManyResultsMsg = Adding a status to the results failed since there is not enough files involved in the publishing operation.
-publishingResultsUnknownSeverityMsg = "{0}" is an unknown status severity
-publishingResultsUnpublishNotAttemptedMsg = Unpublishing not attempted
+publishJobConsoleName = DNA
+publishJobPublish = Publishing {3} file(s) to server "{0}" (repository "{1}", workspace "{2}") ...
+publishJobPublishCanceledMsg = i Publishing to server "{0}" (repository "{1}", workspace "{2}") was canceled after {3} file(s) out of {4} were processed.
+publishJobPublishFile = \t+ Published file "{0}" to location "{1}"
+publishJobPublishFileFailed = \t* ERROR publishing file "{0}" to location "{1}"
+publishJobPublishFileInfo = \ti {0}
+publishJobPublishFileWarning = \tw {0}
+publishJobPublishFinishedMsg = Done publishing ({3} milliseconds) to server "{0}" (repository "{1}", workspace "{2}").
+publishJobPublishName = DNA Publish
+publishJobPublishTaskName = Publishing resources
+publishJobUnexpectedErrorMsg = Unexpected error occurred. See log for more details.
+publishJobUnpublish = Unpublishing {3} file(s) from server "{0}" (repository "{1}", workspace "{2}") ...
+publishJobUnpublishCanceledMsg = * Unpublishing from server "{0}" (repository "{1}", workspace "{2}") was canceled after {3} file(s) out of {4} were processed.
+publishJobUnpublishFile = \t- Unpublished file "{0}" from location "{1}"
+publishJobUnpublishFileFailed = \t* ERROR unpublished file "{0}" from location "{1}"
+publishJobUnpublishFileInfo = \ti {0}
+publishJobUnpublishFileWarning = \tw {0}
+publishJobUnpublishFinishedMsg = Done unpublishing ({3} milliseconds) from server "{0}" (repository "{1}", workspace "{2}").
+publishJobUnpublishName = DNA Unpublish
+publishJobUnpublishTaskName = Unpublishing resources
-publishOperationConsoleName = DNA
-publishOperationPublish = DNA publish to server "{0}", repository "{1}", workspace "{2}"
-publishOperationPublishFile = \t+ Published file "{0}" to location "{1}"
-publishOperationPublishFileFailed = \t* ERROR publishing file "{0}" to location "{1}"
-publishOperationPublishTaskName = Publishing resources
-publishOperationUnpublish = DNA unpublish from server "{0}", repository "{1}", workspace "{2}"
-publishOperationUnpublishFile = \t- Unpublished file "{0}" from location "{1}"
-publishOperationUnpublishFileFailed = \t* ERROR unpublished file "{0}" from location "{1}"
-publishOperationUnpublishTaskName = Unpublishing resources
-
publishPagePublishTitle = Publish the selected resources
publishPageLocationGroupTitle = Location
publishPageMissingRepositoryStatusMsg = A repository must be selected
@@ -70,7 +76,7 @@
publishPageNoAvailableWorkspacesStatusMsg = There are no workspaces available on that server and repository
publishPageNoResourcesToPublishStatusMsg = There are no files that can be published
publishPageNoResourcesToUnpublishStatusMsg = There are no files that can be unpublished
-publishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the selected resources will be published. Then click "Finish" to execute the publish operation.
+publishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the resources will be published. Click "Finish" to execute the publish operation.
publishPagePublishResourcesLabel = These resources will be uploaded to the specified DNA workspace:
publishPageRecurseCheckBox = Recurse folders and projects
publishPageRecurseCheckBoxToolTip = Add all files under folders recursively under selected projects and folders
@@ -79,26 +85,13 @@
publishPageRepositoryToolTip = The repository where the workspace is located
publishPageServerLabel = Server:
publishPageServerToolTip = The server where the repository is located
-publishPageUnpublishOkStatusMsg = Choose the server, repository, and workspace where the selected resources will be unpublished. Then click "Finish" to execute the unpublish operation.
+publishPageUnpublishOkStatusMsg = Choose the server, repository, and workspace where the resources will be unpublished. Click "Finish" to execute the unpublish operation.
publishPageUnpublishResourcesLabel = These resources will be removed from the specified DNA workspace:
publishPageUnpublishTitle = Unpublish the selected resources
publishPageWorkspaceLabel = Workspace:
publishPageWorkspacePublishToolTip = The workspace where the resources are being published
publishPageWorkspaceUnpublishToolTip = The workspace where the resources are being unpublished
-publishResultsDialogErrorIncompletePublishingMsg = There was a problem publishing some or all of the files. The publishing operation did not complete. See results below and the log for more details. Error message: "{0}."
-publishResultsDialogErrorIncompleteUnpublishingMsg = There was a problem publishing some or all of the files. The unpublishing operation did not complete. See results below and the log for more details. Error message: "{0}."
-publishResultsDialogErrorPublishingMsg = There was a problem publishing some or all of the files. See results below and the log for more details. Error message: "{0}."
-publishResultsDialogErrorUnpublishingMsg = There was a problem publishing some or all of the files. See results below and the log for more details. Error message: "{0}."
-publishResultsDialogFileHeader = File
-publishResultsDialogIncompletePublishMsg = {0} file(s) were successfully published (uploaded) to the DNA repository workspace but the publishing operation did not complete.
-publishResultsDialogIncompleteUnpublishMsg = {0} file(s) were successfully unpublished (removed) from the DNA repository workspace but the unpublishing operation did not complete.
-publishResultsDialogMessageHeader = Message
-publishResultsDialogPublishMsg = {0} file(s) were successfully published (uploaded) to the DNA repository workspace.
-publishResultsDialogStatisticsMsg = There were {1} error(s), {2} info(s), and {3} warning(s).
-publishResultsDialogTitle = Results
-publishResultsDialogUnpublishMsg = {0} file(s) were successfully unpublished (removed) from the DNA repository workspace.
-
publishWizardPublishErrorMsg = Error Publishing
publishWizardPublishTitle = Publish
publishWizardUnpublishErrorMsg = Error Unpublishing
@@ -117,6 +110,12 @@
serverPageSavePasswordButton = Save password
serverPageSavePasswordLabel = Saved secret data is stored on your computer in a file that's difficult, but not impossible, for an intruder to read.
serverPageSavePasswordToolTip = Indicates if the clear text password should be stored on the local file system
+serverPageTestConnectionLabel = Validate server connection:
+serverPageTestConnectionButton = Test
+serverPageTestConnectionButtonToolTip = Try to establish a connection to the server
+serverPageTestConnectionDialogFailureMsg = Unable to connect using the specified server properties. The server properties could be invalid or the server may be offline.
+serverPageTestConnectionDialogTitle = Test Server Connection
+serverPageTestConnectionDialogSuccessMsg = Successfully connected using the specified server properties.
serverPageTitle = Enter Server Information
serverPageUrlLabel = URL:
serverPageUrlToolTip = The URL used to connect to the server
@@ -129,3 +128,6 @@
serverWizardEditServerTitle = Edit Server
serverWizardNewServerErrorMsg = There were errors creating a new server. See log for more details.
serverWizardNewServerTitle = New Server
+
+testServerActionText = Connect
+testServerActionToolTip = Connect to the server identified by the abover URL, user, and password
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -44,14 +44,14 @@
/**
* Sizes the shell to the minimum of it's current size or the width and height display percentages.
*
- * @param shell the shell being resized if necessary and located
+ * @param shell the shell being resized (if necessary) and located
* @param widthPercentage a number between 1 and 100 indicating a percentage of the screen size (defaults to 50 if bad value)
* @param heightPercentage a number between 1 and 100 indicating a percentage of the screen size (defaults to 50 if bad value)
* @since 0.6
*/
- public static void sizeShellRelativeToDisplayAndCentery( Shell shell,
- int widthPercentage,
- int heightPercentage ) {
+ public static void centerAndSizeShellRelativeToDisplay( Shell shell,
+ int widthPercentage,
+ int heightPercentage ) {
if ((widthPercentage < 1) || (widthPercentage > 100)) {
widthPercentage = 50;
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -40,8 +40,9 @@
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
+import org.jboss.dna.web.jcr.rest.client.swt.Utils;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishWizard;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
/**
* @since 0.6
@@ -114,9 +115,10 @@
WizardDialog dialog = new WizardDialog(shell, new PublishWizard(this.type, resources,
Activator.getDefault().getServerManager())) {
@Override
- protected void configureShell( Shell newShell ) {
- super.configureShell(newShell);
- newShell.setImage(Activator.getDefault().getImage(DNA_IMAGE_16x));
+ protected void initializeBounds() {
+ super.initializeBounds();
+ getShell().setImage(Activator.getDefault().getImage(DNA_IMAGE_16x));
+ Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
}
};
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
/**
* The <code>PublishAction</code> controls the publishing of one or more {@link org.eclipse.core.resources.IResource}s to a DNA
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
/**
* The <code>UnpublishAction</code> controls the unpublishing of one or more {@link org.eclipse.core.resources.IResource}s from a
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -94,8 +94,8 @@
String msg;
if (this.serversBeingDeleted.size() == 1) {
- IDnaObject server = this.serversBeingDeleted.iterator().next();
- msg = RestClientI18n.deleteServerDialogOneServerMsg.text(server.getName());
+ Server server = this.serversBeingDeleted.iterator().next();
+ msg = RestClientI18n.deleteServerDialogOneServerMsg.text(server.getName(), server.getUser());
} else {
msg = RestClientI18n.deleteServerDialogMultipleServersMsg.text(this.serversBeingDeleted.size());
}
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -1,365 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.swt.dialogs;
-
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.CHECKMARK_IMAGE_PATH;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.swt.Utils;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishingResults;
-
-/**
- * The <code>PublishingResultsDialog</code> displays the results of a publishing operation.
- *
- * @since 0.6
- */
-public final class PublishingResultsDialog extends MessageDialog {
-
- // ===========================================================================================================================
- // Constants
- // ===========================================================================================================================
-
- /**
- * The table column index of the column where the file name is displayed.
- *
- * @since 0.6
- */
- private static final int FILE_COL = 0;
-
- /**
- * The table column index of the column where the status severity is displayed.
- *
- * @since 0.6
- */
- private static final int SEVERITY_COL = 1;
-
- /**
- * The table column index of the column where the error message is displayed.
- *
- * @since 0.6
- */
- private static final int MESSAGE_COL = 2;
-
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
- /**
- * An error caught during the publish operation (may be <code>null</code>).
- *
- * @since 0.6
- */
- private Throwable error;
-
- /**
- * The results of the publishing operation.
- *
- * @since 0.6
- */
- private final PublishingResults results;
-
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
- /**
- * @param parentShell the dialog parent
- * @param results the results being displayed (never <code>null</code>)
- * @since 0.6
- */
- public PublishingResultsDialog( Shell parentShell,
- PublishingResults results ) {
- super(parentShell, RestClientI18n.publishResultsDialogTitle.text(), Activator.getDefault().getImage(DNA_IMAGE_16x), null,
- MessageDialog.INFORMATION, new String[] {IDialogConstants.OK_LABEL}, 0);
- this.results = results;
-
- // make sure dialog is resizable
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- /**
- * @param parentShell the dialog parent
- * @param results the results being displayed (never <code>null</code>)
- * @param error an unexpected error caught during the publish operation
- * @since 0.6
- */
- public PublishingResultsDialog( Shell parentShell,
- PublishingResults results,
- Throwable error ) {
- super(parentShell, RestClientI18n.publishResultsDialogTitle.text(), Activator.getDefault().getImage(DNA_IMAGE_16x), null,
- MessageDialog.ERROR, new String[] {IDialogConstants.OK_LABEL}, 0);
- this.results = results;
- this.error = error;
-
- // make sure dialog is resizable
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.MessageDialog#configureShell(org.eclipse.swt.widgets.Shell)
- * @since 0.6
- */
- @Override
- protected void configureShell( Shell shell ) {
- super.configureShell(shell);
-
- // now set message
- int successCount = this.results.getFiles().size() - this.results.getErrorCount();
- boolean completed = this.results.isComplete();
-
- if (this.results.getType() == PublishOperation.Type.PUBLISH) {
- if (completed) {
- if ((this.error == null)) {
- this.message = RestClientI18n.publishResultsDialogPublishMsg.text(successCount);
- } else {
- this.message = RestClientI18n.publishResultsDialogErrorPublishingMsg.text(this.error.getLocalizedMessage());
- }
- } else {
- if ((this.error == null)) {
- this.message = RestClientI18n.publishResultsDialogIncompletePublishMsg.text(successCount);
- } else {
- this.message = RestClientI18n.publishResultsDialogErrorIncompletePublishingMsg.text(this.error.getLocalizedMessage());
- }
- }
- } else {
- if (completed) {
- if ((this.error == null)) {
- this.message = RestClientI18n.publishResultsDialogUnpublishMsg.text(successCount);
- } else {
- this.message = RestClientI18n.publishResultsDialogErrorUnpublishingMsg.text(this.error.getLocalizedMessage());
- }
- } else {
- if ((this.error == null)) {
- this.message = RestClientI18n.publishResultsDialogIncompleteUnpublishMsg.text(successCount);
- } else {
- this.message = RestClientI18n.publishResultsDialogErrorIncompleteUnpublishingMsg.text(this.error.getLocalizedMessage());
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.window.Window#constrainShellSize()
- * @since 0.6
- */
- @Override
- protected void constrainShellSize() {
- super.constrainShellSize();
- Utils.sizeShellRelativeToDisplayAndCentery(getShell(), 50, 50);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
- * @since 0.6
- */
- @Override
- protected Control createCustomArea( Composite parent ) {
- Composite pnl = new Composite(parent, SWT.NONE);
- pnl.setLayout(new GridLayout());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- pnl.setLayoutData(gd);
-
- TableViewer viewer = new TableViewer(pnl, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- ResultsProvider provider = new ResultsProvider();
- viewer.setContentProvider(provider);
- viewer.setLabelProvider(provider);
-
- Table table = viewer.getTable();
- table.setLayout(new GridLayout());
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- TableColumn col = new TableColumn(table, SWT.LEFT);
- col.setText(RestClientI18n.publishResultsDialogFileHeader.text());
-
- col = new TableColumn(table, SWT.CENTER);
- col.setResizable(false);
-
- col = new TableColumn(table, SWT.LEFT);
- col.setText(RestClientI18n.publishResultsDialogMessageHeader.text());
-
- // populate the table
- viewer.setInput(this);
-
- // size columns
- for (TableColumn column : table.getColumns()) {
- column.pack();
- column.setWidth(column.getWidth() + 2);
- }
-
- // add statistics label
- StyledText st = new StyledText(parent, SWT.READ_ONLY | SWT.MULTI | SWT.NO_FOCUS | SWT.WRAP);
- st.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- st.setCaret(null);
- gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessVerticalSpace = false;
- gd.horizontalIndent = ((GridLayout)pnl.getLayout()).horizontalSpacing * 5;
- st.setLayoutData(gd);
-
- // set message
- Object[] counts = new Object[] {this.results.getOksCount(), this.results.getErrorCount(), this.results.getInfoCount(),
- this.results.getWarningsCount()};
- String msg = RestClientI18n.publishResultsDialogStatisticsMsg.text(counts);
- st.setText(msg);
-
- return pnl;
- }
-
- /**
- * @return the files that were involved in the publishing operation
- * @since 0.6
- */
- List<IFile> getFiles() {
- return this.results.getFiles();
- }
-
- /**
- * @param file the file whose status is being requested
- * @return the status or <code>null</code> if not found
- * @since 0.6
- */
- Status getStatus( IFile file ) {
- return this.results.getStatus(file);
- }
-
- // ===========================================================================================================================
- // Inner Class
- // ===========================================================================================================================
-
- /**
- * The <code>ResultsProvider</code> class is the label provider and content provider for the table that is shown in the
- * dialog.
- *
- * @since 0.6
- */
- class ResultsProvider extends LabelProvider implements IStructuredContentProvider, ITableLabelProvider {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- * @since 0.6
- */
- @Override
- public Image getColumnImage( Object element,
- int columnIndex ) {
- if (columnIndex == SEVERITY_COL) {
- Status status = getStatus((IFile)element);
-
- if (status.isOk()) {
- return Activator.getDefault().getImage(CHECKMARK_IMAGE_PATH);
- }
-
- return Utils.getImage(status);
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- * @since 0.6
- */
- @Override
- public String getColumnText( Object element,
- int columnIndex ) {
- if (columnIndex == FILE_COL) {
- return ((IFile)element).getFullPath().toString();
- }
-
- if (columnIndex == MESSAGE_COL) {
- Status status = getStatus((IFile)element);
-
- if (!status.isOk()) {
- return status.getMessage();
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- * @since 0.6
- */
- @Override
- public Object[] getElements( Object inputElement ) {
- return getFiles().toArray();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object,
- * java.lang.Object)
- * @since 0.6
- */
- @Override
- public void inputChanged( Viewer viewer,
- Object oldInput,
- Object newInput ) {
- // nothing to do
- }
-
- }
-
-}
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -0,0 +1,342 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.wizards;
+
+import java.io.File;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.ServerManager;
+import org.jboss.dna.web.jcr.rest.client.Status;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+import org.jboss.dna.web.jcr.rest.client.swt.Activator;
+import org.jboss.dna.web.jcr.rest.client.swt.IUiConstants;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
+
+/**
+ * The <code>PublishJob</code> publishes or unpublishes one or more files using the {@link ServerManager}.
+ *
+ * @since 0.6
+ */
+public final class PublishJob extends Job {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ /**
+ * The job type.
+ *
+ * @since 0.6
+ */
+ public enum Type {
+ /**
+ * Indicates a publish job.
+ *
+ * @since 0.6
+ */
+ PUBLISH,
+
+ /**
+ * Indicates an unpublish job.
+ *
+ * @since 0.6
+ */
+ UNPUBLISH
+ }
+
+ /**
+ * The name of the message console that is written to.
+ *
+ * @since 0.6
+ */
+ private static final String CONSOLE_NAME = RestClientI18n.publishJobConsoleName.text();
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @param type the job type (never <code>null</code>)
+ * @return the job name
+ * @since 0.6
+ */
+ private static String getJobName( Type type ) {
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
+
+ if (Type.PUBLISH == type) {
+ return RestClientI18n.publishJobPublishName.text();
+ }
+
+ // unpublish
+ return RestClientI18n.publishJobUnpublishName.text();
+ }
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The files being published or unpublished.
+ *
+ * @since 0.6
+ */
+ private final List<IFile> files;
+
+ /**
+ * The job type.
+ *
+ * @since 0.6
+ */
+ private final Type type;
+
+ /**
+ * The workspace to use when publishing or unpublishing.
+ *
+ * @since 0.6
+ */
+ private final Workspace workspace;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * @param type the job type (never <code>null</code>)
+ * @param files the files being published or unpublished (never <code>null</code>)
+ * @param workspace the workspace to use when publishing or unpublishing (never <code>null</code>)
+ * @since 0.6
+ */
+ public PublishJob( Type type,
+ List<IFile> files,
+ Workspace workspace ) {
+ super(getJobName(type));
+
+ CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
+
+ this.type = type;
+ this.files = files;
+ this.workspace = workspace;
+
+ setUser(true); // allow user to run in background
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return <code>true</code> if a publishing job
+ * @since 0.6
+ */
+ private boolean isPublishing() {
+ return (this.type == Type.PUBLISH);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ * @since 0.6
+ */
+ @Override
+ protected IStatus run( IProgressMonitor monitor ) {
+ assert (this.workspace != null);
+ long startTime = System.currentTimeMillis();
+
+ try {
+ String name = (isPublishing() ? RestClientI18n.publishJobPublishTaskName.text() : RestClientI18n.publishJobUnpublishTaskName.text());
+ monitor.beginTask(name, this.files.size());
+ monitor.setTaskName(name);
+
+ // write initial message to console
+ if (isPublishing()) {
+ writeToConsole(RestClientI18n.publishJobPublish.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName(),
+ this.files.size()));
+ } else {
+ writeToConsole(RestClientI18n.publishJobUnpublish.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName(),
+ this.files.size()));
+ }
+
+ // process the files
+ int numProcessed = 0;
+
+ for (IFile eclipseFile : this.files) {
+ if (monitor.isCanceled()) {
+ String msg = null;
+
+ if (isPublishing()) {
+ msg = RestClientI18n.publishJobPublishCanceledMsg.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName(),
+ numProcessed,
+ this.files.size());
+ } else {
+ msg = RestClientI18n.publishJobUnpublishCanceledMsg.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName(),
+ numProcessed,
+ this.files.size());
+ }
+
+ writeToConsole(msg); // write cancel msg to console
+ throw new InterruptedException(msg);
+ }
+
+ File file = eclipseFile.getLocation().toFile();
+ Status status = null;
+
+ if (isPublishing()) {
+ status = Activator.getDefault().getServerManager().publish(this.workspace,
+ eclipseFile.getFullPath().toString(),
+ file);
+ } else {
+ status = Activator.getDefault().getServerManager().unpublish(this.workspace,
+ eclipseFile.getFullPath().toString(),
+ file);
+ }
+
+ ++numProcessed;
+ monitor.worked(1);
+
+ // write success msg to console
+ writeToConsole(file, eclipseFile.getParent().getFullPath().toString(), status);
+ }
+
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+ } catch (Exception e) {
+ String msg = null;
+
+ if (e instanceof InterruptedException) {
+ msg = e.getLocalizedMessage();
+ } else {
+ msg = RestClientI18n.publishJobUnexpectedErrorMsg.text();
+ }
+
+ return new org.eclipse.core.runtime.Status(IStatus.ERROR, IUiConstants.PLUGIN_ID, msg, e);
+ } finally {
+ monitor.done();
+ // add done msg
+ // TODO need to format this duration better
+ long duration = System.currentTimeMillis() - startTime;
+
+ if (isPublishing()) {
+ writeToConsole(RestClientI18n.publishJobPublishFinishedMsg.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName(),
+ duration));
+ } else {
+ writeToConsole(RestClientI18n.publishJobUnpublishFinishedMsg.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName(),
+ duration));
+ }
+ }
+ }
+
+ /**
+ * @param file the file involved in the publishing operation
+ * @param workspacePath the path in the workspace where the file is located
+ * @param status the status of the publishing operation
+ * @since 0.6
+ */
+ private void writeToConsole( File file,
+ String workspacePath,
+ Status status ) {
+ String msg = null;
+
+ if (status.isOk()) {
+ if (isPublishing()) {
+ msg = RestClientI18n.publishJobPublishFile.text(file.getAbsolutePath(), workspacePath);
+ } else {
+ msg = RestClientI18n.publishJobUnpublishFile.text(file.getAbsolutePath(), workspacePath);
+ }
+ } else if (status.isError()) {
+ if (isPublishing()) {
+ msg = RestClientI18n.publishJobPublishFileFailed.text(file.getAbsolutePath(), workspacePath);
+ } else {
+ msg = RestClientI18n.publishJobUnpublishFileFailed.text(file.getAbsolutePath(), workspacePath);
+ }
+ } else if (status.isWarning()) {
+ if (isPublishing()) {
+ msg = RestClientI18n.publishJobPublishFileWarning.text(status.getMessage());
+ } else {
+ msg = RestClientI18n.publishJobUnpublishFileWarning.text(status.getMessage());
+ }
+ } else if (status.isInfo()) {
+ if (isPublishing()) {
+ msg = RestClientI18n.publishJobPublishFileInfo.text(status.getMessage());
+ } else {
+ msg = RestClientI18n.publishJobUnpublishFileInfo.text(status.getMessage());
+ }
+ }
+
+ // TODO create hyperlink in console for the file
+ writeToConsole(msg);
+ }
+
+ /**
+ * @param message the message being written to the DNA console
+ * @since 0.6
+ */
+ private void writeToConsole( String message ) {
+ MessageConsole console = null;
+ IConsoleManager consoleMgr = ConsolePlugin.getDefault().getConsoleManager();
+ IConsole[] consoles = consoleMgr.getConsoles();
+
+ // see if DNA console already exists
+ for (int i = 0; i < consoles.length; ++i) {
+ if (CONSOLE_NAME.equals(consoles[i].getName())) {
+ console = (MessageConsole)consoles[i];
+ break;
+ }
+ }
+
+ // create DNA console if necessary
+ if (console == null) {
+ console = new MessageConsole(CONSOLE_NAME, null);
+ consoleMgr.addConsoles(new IConsole[] {console});
+ }
+
+ // show and focus console view
+ console.activate();
+
+ // write message
+ MessageConsoleStream out = console.newMessageStream();
+ out.println(message);
+ }
+
+}
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishJob.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -1,282 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.swt.wizards;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.console.MessageConsoleStream;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.web.jcr.rest.client.ServerManager;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
-import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-
-/**
- * The <code>PublishOperation</code> publishes or unpublishes one or more files using the {@link ServerManager}.
- *
- * @since 0.6
- */
-public final class PublishOperation {
-
- // ===========================================================================================================================
- // Constants
- // ===========================================================================================================================
-
- /**
- * The operation type.
- *
- * @since 0.6
- */
- public enum Type {
- /**
- * Indicates a publish operation.
- *
- * @since 0.6
- */
- PUBLISH,
-
- /**
- * Indicates an unpublish operation.
- *
- * @since 0.6
- */
- UNPUBLISH
- }
-
- /**
- * The name of the message console that is written to.
- *
- * @since 0.6
- */
- private static final String CONSOLE_NAME = RestClientI18n.publishOperationConsoleName.text();
-
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
- /**
- * The files being published or unpublished.
- *
- * @since 0.6
- */
- private final List<IFile> files;
-
- /**
- * The operation type.
- *
- * @since 0.6
- */
- private final Type type;
-
- /**
- * The results of the publishing operation.
- *
- * @since 0.6
- */
- private PublishingResults results;
-
- /**
- * The workspace to use when publishing or unpublishing.
- *
- * @since 0.6
- */
- private final Workspace workspace;
-
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
- /**
- * @param type the operation type (never <code>null</code>)
- * @param files the files being published or unpublished (never <code>null</code>)
- * @param workspace the workspace to use when publishing or unpublishing (never <code>null</code>)
- * @since 0.6
- */
- public PublishOperation( Type type,
- List<IFile> files,
- Workspace workspace ) {
- CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
- CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
- CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
-
- this.type = type;
- this.files = files;
- this.workspace = workspace;
- }
-
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
- /**
- * @return the results of the publishing operation or <code>null</code> if operation has not been executed
- * @since 0.6
- */
- public PublishingResults getResults() {
- return this.results;
- }
-
- /**
- * @return <code>true</code> if a publishing operation
- * @since 0.6
- */
- public boolean isPublishing() {
- return (this.type == Type.PUBLISH);
- }
-
- /**
- * @return <code>true</code> if an unpublishing operation
- * @since 0.6
- */
- public boolean isUnpublishing() {
- return this.type == Type.UNPUBLISH;
- }
-
- /**
- * @param monitor the progress monitor
- * @throws InvocationTargetException if an unexpected error occurs
- * @throws InterruptedException if the user cancels the monitor
- * @since 0.6
- */
- public void execute( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
- assert (this.workspace != null);
-
- this.results = new PublishingResults(this.type, this.files);
-
- try {
- String name = (isPublishing() ? RestClientI18n.publishOperationPublishTaskName.text() : RestClientI18n.publishOperationUnpublishTaskName.text());
- monitor.beginTask(name, this.files.size());
- monitor.setTaskName(name);
-
- // write initial message to console
- if (isPublishing()) {
- writeToConsole(RestClientI18n.publishOperationPublish.text(this.workspace.getServer().getUrl(),
- this.workspace.getRepository().getName(),
- this.workspace.getName()));
- } else {
- writeToConsole(RestClientI18n.publishOperationUnpublish.text(this.workspace.getServer().getUrl(),
- this.workspace.getRepository().getName(),
- this.workspace.getName()));
- }
-
- for (IFile eclipseFile : this.files) {
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
-
- File file = eclipseFile.getLocation().toFile();
- Status status = null;
-
- if (isPublishing()) {
- status = Activator.getDefault().getServerManager().publish(this.workspace,
- eclipseFile.getFullPath().toString(),
- file);
- } else {
- status = Activator.getDefault().getServerManager().unpublish(this.workspace,
- eclipseFile.getFullPath().toString(),
- file);
- }
-
- monitor.worked(1);
- this.results.addStatus(status);
-
- // write to console
- writeToConsole(file, eclipseFile.getParent().getFullPath().toString(), status);
- }
-
- // add a gap before next console message
- writeToConsole("\n"); //$NON-NLS-1$
- } catch (InterruptedException e) {
- throw e;
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- } finally {
- results.closeOut();
- monitor.done();
- }
- }
-
- /**
- * @param file the file involved in the publishing operation
- * @param workspacePath the path in the workspace where the file is located
- * @param status the status of the publishing operation
- * @since 0.6
- */
- private void writeToConsole( File file,
- String workspacePath,
- Status status ) {
- String msg = null;
-
- if (status.isError()) {
- msg = (isPublishing() ? RestClientI18n.publishOperationPublishFileFailed.text(file.getAbsolutePath(), workspacePath)
- : RestClientI18n.publishOperationUnpublishFileFailed.text(file.getAbsolutePath(), workspacePath));
- } else {
- msg = (isPublishing() ? RestClientI18n.publishOperationPublishFile.text(file.getAbsolutePath(), workspacePath)
- : RestClientI18n.publishOperationUnpublishFile.text(file.getAbsolutePath(), workspacePath));
- }
-
- // TODO create hyperlink in console for the file
- writeToConsole(msg);
- }
-
- /**
- * @param message the message being written to the DNA console
- * @since 0.6
- */
- private void writeToConsole( String message ) {
- MessageConsole console = null;
- IConsoleManager consoleMgr = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] consoles = consoleMgr.getConsoles();
-
- // see if DNA console already exists
- for (int i = 0; i < consoles.length; ++i) {
- if (CONSOLE_NAME.equals(consoles[i].getName())) {
- console = (MessageConsole)consoles[i];
- break;
- }
- }
-
- // create DNA console if necessary
- if (console == null) {
- console = new MessageConsole(CONSOLE_NAME, null);
- consoleMgr.addConsoles(new IConsole[] {console});
- }
-
- // show and focus console view
- console.activate();
-
- // write message
- MessageConsoleStream out = console.newMessageStream();
- out.println(message);
- }
-
-}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -63,7 +63,7 @@
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.actions.NewServerAction;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
/**
* The <code>PublishPage</code> is a UI for publishing or unpublishing one or more files to a DNA repository.
@@ -280,13 +280,6 @@
private List<IFile> files;
/**
- * The method in control of registering/unregistering combobox listners or <code>null</code>.
- *
- * @since 0.6
- */
- private String listenerControlLock = null;
-
- /**
* The control containing all the files being published or unpublished.
*
* @since 0.6
@@ -376,8 +369,7 @@
public PublishPage( Type type,
List<IResource> resources ) throws CoreException {
super(PublishPage.class.getSimpleName());
- setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text()
- : RestClientI18n.publishPageUnpublishTitle.text());
+ setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text() : RestClientI18n.publishPageUnpublishTitle.text());
setPageComplete(false);
this.type = type;
@@ -530,7 +522,6 @@
chkRecurse.removeSelectionListener(this);
}
});
-
}
}
@@ -548,6 +539,12 @@
constructResourcesPanel(pnlMain);
setControl(pnlMain);
+ // add combobox listeners
+ this.cbxRepository.addModifyListener(this);
+ this.cbxServer.addModifyListener(this);
+ this.cbxWorkspace.addModifyListener(this);
+
+ // load the UI with data
refreshServers();
}
@@ -577,8 +574,7 @@
* @since 0.6
*/
void updateInitialMessage() {
- String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
- : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text() : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
if (msg.equals(getMessage())) {
updateState();
@@ -633,8 +629,12 @@
*/
void handleRepositoryModified() {
int index = this.cbxRepository.getSelectionIndex();
- this.repository = this.repositories.get(index);
+ // make sure there is a selection
+ if (index != -1) {
+ this.repository = this.repositories.get(index);
+ }
+
// clear loaded workspaces
refreshWorkspaces();
@@ -663,23 +663,14 @@
* @since 0.6
*/
void handleWorkspaceModified() {
- this.workspace = this.workspaces.get(this.cbxWorkspace.getSelectionIndex());
- updateState();
- }
+ int index = this.cbxWorkspace.getSelectionIndex();
- /**
- * Installs the combobox listeners.
- *
- * @param listenerControlLock the method in control of registering/unregistering combobox listeners
- * @since 0.6
- */
- private void installLocationListeners( String listenerControlLock ) {
- if ((this.listenerControlLock == null) || this.listenerControlLock.equals(listenerControlLock)) {
- this.cbxRepository.addModifyListener(this);
- this.cbxServer.addModifyListener(this);
- this.cbxWorkspace.addModifyListener(this);
- this.listenerControlLock = null;
+ // make sure there is a selection
+ if (index != -1) {
+ this.workspace = this.workspaces.get(index);
}
+
+ updateState();
}
/**
@@ -740,7 +731,6 @@
* @since 0.6
*/
private void refreshRepositories() {
- final String LOCK_ID = "refreshRepositories"; //$NON-NLS-1$
this.repository = null;
if (this.server == null) {
@@ -759,9 +749,6 @@
}
}
- // uninstall listeners to prevent handling events
- uninstallLocationListeners(LOCK_ID);
-
// clear items
this.cbxRepository.removeAll();
@@ -794,9 +781,6 @@
// must reload workspaces
refreshWorkspaces();
-
- // reinstall listening
- installLocationListeners(LOCK_ID);
}
/**
@@ -806,13 +790,9 @@
* @since 0.6
*/
void refreshServers() {
- final String LOCK_ID = "refreshServers"; //$NON-NLS-1$
this.server = null;
this.servers = new ArrayList<Server>(getServerManager().getServers());
- // uninstall listeners to prevent handling events
- uninstallLocationListeners(LOCK_ID);
-
if (this.servers.size() == 0) {
// disable control if necessary
if (this.cbxServer.getEnabled()) {
@@ -841,9 +821,6 @@
// must reload repositories
refreshRepositories();
-
- // reinstall listening
- installLocationListeners(LOCK_ID);
}
/**
@@ -852,7 +829,6 @@
* @since 0.6
*/
private void refreshWorkspaces() {
- final String LOCK_ID = "refreshWorkspaces"; //$NON-NLS-1$
this.workspace = null;
if (this.repository == null) {
@@ -871,9 +847,6 @@
}
}
- // uninstall listeners to prevent handling events
- uninstallLocationListeners(LOCK_ID);
-
// clear items
this.cbxWorkspace.removeAll();
@@ -903,9 +876,6 @@
this.cbxWorkspace.setEnabled(true);
}
}
-
- // reinstall listening
- installLocationListeners(LOCK_ID);
}
/**
@@ -953,11 +923,10 @@
// set initial message
if (this.status.isOk()) {
- String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
- : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
- setMessage(msg);
+ String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text() : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ setMessage(msg, IMessageProvider.NONE);
} else {
- setErrorMessage(this.status.getMessage());
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
}
}
}
@@ -983,22 +952,6 @@
}
/**
- * Uninstalls the combobox listeners.
- *
- * @param listenerControlLock the method in control of registering/unregistering combobox listeners
- * @since 0.6
- */
- private void uninstallLocationListeners( String listenerControlLock ) {
- if (this.listenerControlLock == null) {
- this.listenerControlLock = listenerControlLock;
- this.cbxRepository.removeModifyListener(this);
- this.cbxServer.removeModifyListener(this);
- this.cbxWorkspace.removeModifyListener(this);
- this.listenerControlLock = listenerControlLock;
- }
- }
-
- /**
* Updates message, message icon, and OK button enablement based on validation results
*
* @since 0.6
@@ -1012,14 +965,14 @@
// update page message
if (this.status.isError()) {
- setErrorMessage(this.status.getMessage());
+ setMessage(this.status.getMessage(), IMessageProvider.ERROR);
} else {
if (this.status.isWarning()) {
setMessage(this.status.getMessage(), IMessageProvider.WARNING);
} else if (this.status.isInfo()) {
setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
} else {
- setMessage(this.status.getMessage());
+ setMessage(this.status.getMessage(), IMessageProvider.NONE);
}
}
}
@@ -1034,24 +987,19 @@
Severity severity = Severity.ERROR;
if ((this.resources == null) || this.resources.isEmpty() || this.files.isEmpty()) {
- msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text()
- : RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text() : RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
} else if (this.server == null) {
int count = this.cbxServer.getItemCount();
- msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableServersStatusMsg.text()
- : RestClientI18n.publishPageMissingServerStatusMsg.text());
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableServersStatusMsg.text() : RestClientI18n.publishPageMissingServerStatusMsg.text());
} else if (this.repository == null) {
int count = this.cbxRepository.getItemCount();
- msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text()
- : RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text() : RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
} else if (this.workspace == null) {
int count = this.cbxWorkspace.getItemCount();
- msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text()
- : RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text() : RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
} else {
severity = Severity.OK;
- msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
- : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text() : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
}
this.status = new Status(severity, msg, null);
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -24,25 +24,18 @@
package org.jboss.dna.web.jcr.rest.client.swt.wizards;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WIZARD_BANNER_IMAGE_PATH;
-import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.web.jcr.rest.client.ServerManager;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.swt.dialogs.PublishingResultsDialog;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
+import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishJob.Type;
/**
* @since 0.6
@@ -96,8 +89,7 @@
this.page = new PublishPage(type, resources);
this.serverManager = serverManager;
- setWindowTitle((type == Type.PUBLISH) ? RestClientI18n.publishWizardPublishTitle.text()
- : RestClientI18n.publishWizardUnpublishTitle.text());
+ setWindowTitle((type == Type.PUBLISH) ? RestClientI18n.publishWizardPublishTitle.text() : RestClientI18n.publishWizardUnpublishTitle.text());
setDefaultPageImageDescriptor(Activator.getDefault().getImageDescriptor(DNA_WIZARD_BANNER_IMAGE_PATH));
}
@@ -156,50 +148,11 @@
*/
@Override
public boolean performFinish() {
- Throwable error = null;
Workspace workspace = this.page.getWorkspace();
List<IFile> files = this.page.getFiles();
- final PublishOperation operation = new PublishOperation(this.type, files, workspace);
+ PublishJob job = new PublishJob(this.type, files, workspace);
+ job.schedule();
- // display progress dialog
- IRunnableWithProgress op = new IRunnableWithProgress() {
- @Override
- public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
- operation.execute(monitor);
- }
- };
-
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
-
- try {
- dialog.run(true, true, op);
- } catch (Throwable e) {
- if (!(e instanceof InterruptedException)) {
- error = e;
-
- if (e instanceof InvocationTargetException) {
- error = ((InvocationTargetException)e).getTargetException();
- }
-
- String message = (operation.isPublishing() ? RestClientI18n.publishWizardPublishErrorMsg.text()
- : RestClientI18n.publishWizardUnpublishErrorMsg.text());
- Activator.getDefault().log(new Status(Severity.ERROR, message, error));
- }
- } finally {
- dialog.getProgressMonitor().done();
-
- // show results
- PublishingResultsDialog resultsDialog = null;
-
- if (error == null) {
- resultsDialog = new PublishingResultsDialog(getShell(), operation.getResults());
- } else {
- resultsDialog = new PublishingResultsDialog(getShell(), operation.getResults(), error);
- }
-
- resultsDialog.open();
- }
-
return true;
}
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -1,264 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.swt.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Status.Severity;
-import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
-
-/**
- * @since 0.6
- */
-public final class PublishingResults {
-
- // ===========================================================================================================================
- // Constants
- // ===========================================================================================================================
-
- /**
- * Status indicating the file was not attempted to be published.
- *
- * @since 0.6
- */
- private static final Status PUBLISH_NOT_ATTEMPTED_STATUS = new Status(Severity.INFO,
- RestClientI18n.publishingResultsPublishNotAttemptedMsg.text(),
- null);
-
- /**
- * Status indicating the file was not attempted to be published.
- *
- * @since 0.6
- */
- private static final Status UNPUBLISH_NOT_ATTEMPTED_STATUS = new Status(Severity.INFO,
- RestClientI18n.publishingResultsUnpublishNotAttemptedMsg.text(),
- null);
-
- // ===========================================================================================================================
- // Fields
- // ===========================================================================================================================
-
- /**
- * Indicates if a status for each file has been added.
- *
- * @since 0.6
- */
- private boolean complete;
-
- /**
- * The files involved in the publishing operation.
- *
- * @since 0.6
- */
- private final List<IFile> files;
-
- /**
- * The number of {@link Status status} objects that have an {@link Severity#ERROR error} severity.
- *
- * @since 0.6
- */
- private int numErrors;
-
- /**
- * The number of {@link Status status} objects that have an {@link Severity#INFO info} severity.
- *
- * @since 0.6
- */
- private int numInfos;
-
- /**
- * The number of {@link Status status} objects that have an {@link Severity#OK OK} severity.
- *
- * @since 0.6
- */
- private int numOks;
-
- /**
- * The number of {@link Status status} objects that have a {@link Severity#WARNING warning} severity.
- *
- * @since 0.6
- */
- private int numWarnings;
-
- /**
- * When complete there will be one status for each file.
- *
- * @since 0.6
- */
- private final List<Status> statuses;
-
- /**
- * The type of publishing operation these results pertain to.
- *
- * @since 0.6
- */
- private final Type type;
-
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
- /**
- * @param type the type of publishing operation (never <code>null</code>)
- * @param files the files involved in the publishing operation (never <code>null</code>)
- * @since 0.6
- */
- public PublishingResults( Type type,
- List<IFile> files ) {
- CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
- CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
-
- this.type = type;
- this.files = files;
- this.statuses = new ArrayList<Status>(this.files.size());
- }
-
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
- /**
- * @param status the status being added (never <code>null</code>)
- * @throws RuntimeException if the number of status objects is greater than the number of files
- * @since 0.6
- */
- public void addStatus( Status status ) {
- CheckArg.isNotNull(status, "status"); //$NON-NLS-1$
-
- if (this.files.size() < (this.statuses.size() + 1)) {
- throw new RuntimeException(RestClientI18n.publishingResultsTooManyResultsMsg.text());
- }
-
- this.statuses.add(status);
-
- if (status.isError()) ++this.numErrors;
- else if (status.isInfo()) ++this.numInfos;
- else if (status.isOk()) ++this.numOks;
- else if (status.isWarning()) ++this.numWarnings;
- else throw new RuntimeException(RestClientI18n.publishingResultsUnknownSeverityMsg.text(status.getSeverity()));
-
- this.complete = (this.files.size() == this.statuses.size());
- }
-
- /**
- * Finalizes the results by making sure there is one status object for each file. No need to call if all files have a status.
- *
- * @since 0.6
- */
- public void closeOut() {
- if (this.files.size() != this.statuses.size()) {
- Status status = ((Type.PUBLISH == this.type) ? PUBLISH_NOT_ATTEMPTED_STATUS : UNPUBLISH_NOT_ATTEMPTED_STATUS);
-
- for (int count = this.files.size() - this.statuses.size(), i = 0; i < count; ++i) {
- addStatus(status);
- }
- }
- }
-
- /**
- * @return the number of errors in the result
- * @since 0.6
- */
- public int getErrorCount() {
- return this.numErrors;
- }
-
- /**
- * @return the files involved in the publishing operation (never <code>null</code>)
- * @since 0.6
- */
- public List<IFile> getFiles() {
- return this.files;
- }
-
- /**
- * @return the number of infos in the result
- * @since 0.6
- */
- public int getInfoCount() {
- return this.numInfos;
- }
-
- /**
- * @return the number of OKs in the result
- * @since 0.6
- */
- public int getOksCount() {
- return this.numOks;
- }
-
- /**
- * @param file the file whose status is being requested (never <code>null</code>)
- * @return the status or <code>null</code> if there is no status for the specified file
- * @since 0.6
- */
- public Status getStatus( IFile file ) {
- CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
- int index = this.files.indexOf(file);
-
- if (index == -1) {
- return null;
- }
-
- return this.statuses.get(index);
- }
-
- /**
- * @return the status of each file involved in the publishing operation (never <code>null</code> but can be incomplete)
- * @see #isComplete()
- * @since 0.6
- */
- public List<Status> getStatuses() {
- return this.statuses;
- }
-
- /**
- * @return the publishing operation type (never <code>null</code>)
- * @since 0.6
- */
- public Type getType() {
- return this.type;
- }
-
- /**
- * @return the number of warnings in the result
- * @since 0.6
- */
- public int getWarningsCount() {
- return this.numWarnings;
- }
-
- /**
- * @return <code>true</code> if there is one status object for each file
- * @since 0.6
- */
- public boolean isComplete() {
- return this.complete;
- }
-
-}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java 2009-08-14 16:29:03 UTC (rev 1161)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java 2009-08-14 19:19:06 UTC (rev 1162)
@@ -23,14 +23,18 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.wizards;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -55,11 +59,11 @@
// ===========================================================================================================================
/**
- * Indicates if the password should be persisted.
+ * The button used to test the connection to the server. Should only be enabled when server properties are valid.
*
* @since 0.6
*/
- private boolean savePassword;
+ private Button btnTestConnection;
/**
* The user password needed to login to the server.
@@ -69,6 +73,13 @@
private String password;
/**
+ * Indicates if the password should be persisted.
+ *
+ * @since 0.6
+ */
+ private boolean savePassword;
+
+ /**
* The server being editor or <code>null</code> if creating a new server.
*
* @since 0.6
@@ -232,6 +243,34 @@
}
}
+ private void constructTestConnectionPanel( Composite parent ) {
+ Composite pnl = new Composite(parent, SWT.NONE);
+ pnl.setLayout(new GridLayout(2, false));
+ pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label lbl = new Label(pnl, SWT.LEFT);
+ lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ lbl.setText(RestClientI18n.serverPageTestConnectionLabel.text());
+
+ this.btnTestConnection = new Button(pnl, SWT.PUSH);
+ this.btnTestConnection.setText(RestClientI18n.serverPageTestConnectionButton.text());
+ this.btnTestConnection.setToolTipText(RestClientI18n.serverPageTestConnectionButtonToolTip.text());
+
+ // add margins to the side of the text
+ GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = this.btnTestConnection.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ gd.widthHint = Math.max(widthHint, minSize.x + 10);
+ this.btnTestConnection.setLayoutData(gd);
+
+ this.btnTestConnection.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected( SelectionEvent e ) {
+ handleTestConnection();
+ }
+ });
+ }
+
private void constructUrlPanel( Composite parent ) {
Composite pnl = new Composite(parent, SWT.NONE);
pnl.setLayout(new GridLayout(2, false));
@@ -270,6 +309,7 @@
pnlMain.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
constructUrlPanel(pnlMain);
constructAuthenticationPanel(pnlMain);
+ constructTestConnectionPanel(pnlMain);
setControl(pnlMain);
}
@@ -292,7 +332,7 @@
* @return the server manager obtained from the wizard
* @since 0.6
*/
- private ServerManager getServerManager() {
+ ServerManager getServerManager() {
return ((ServerWizard)getWizard()).getServerManager();
}
@@ -316,6 +356,34 @@
}
/**
+ * Tests the connection of the server specified by the properties entered on this page. Precondition is that server properties
+ * are valid.
+ *
+ * @since 0.6
+ */
+ void handleTestConnection() {
+ final Server server = getServer();
+ final boolean[] success = new boolean[1];
+
+ BusyIndicator.showWhile(null, new Runnable() {
+ @Override
+ public void run() {
+ success[0] = getServerManager().ping(server).isOk();
+ }
+ });
+
+ if (success[0]) {
+ MessageDialog.openInformation(getShell(),
+ RestClientI18n.serverPageTestConnectionDialogTitle.text(),
+ RestClientI18n.serverPageTestConnectionDialogSuccessMsg.text());
+ } else {
+ MessageDialog.openError(getShell(),
+ RestClientI18n.serverPageTestConnectionDialogTitle.text(),
+ RestClientI18n.serverPageTestConnectionDialogFailureMsg.text());
+ }
+ }
+
+ /**
* Handler for when the URL control value is modified
*
* @param newUrl the new URL value
@@ -376,8 +444,9 @@
// get the current status
validate();
- // update OK/Finish button enablement
+ // update OK/Finish button and test button enablement
setPageComplete(!this.status.isError());
+ this.btnTestConnection.setEnabled(isPageComplete());
// update message
if (this.status.isError()) {
14 years, 8 months
DNA SVN: r1161 - in branches/eclipse/dna-web-jcr-rest-client: src/main/java/org/jboss/dna/web/jcr/rest/client and 6 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-08-14 12:29:03 -0400 (Fri, 14 Aug 2009)
New Revision: 1161
Added:
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types
branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java
branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java
branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
Removed:
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IMessages.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Logger.java
branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/Messages.properties
branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestExecutor.java
Modified:
branches/eclipse/dna-web-jcr-rest-client/
branches/eclipse/dna-web-jcr-rest-client/pom.xml
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java
branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
Log:
Now using dna-common's logger, I18n, CheckArg, and extension-based mime detector frameworks. Added a ServerAuthenticator that works with ServerManager's server registry for authentication. Added a "ping" method to ServerManager so that the client UI can test a connection before actually creating it. Added "Authorization" request property to the HTTPConnection. Did some work with javadocs.
Property changes on: branches/eclipse/dna-web-jcr-rest-client
___________________________________________________________________
Name: svn:ignore
+ target
Modified: branches/eclipse/dna-web-jcr-rest-client/pom.xml
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/pom.xml 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/pom.xml 2009-08-14 16:29:03 UTC (rev 1161)
@@ -18,11 +18,19 @@
those defined in the dependencyManagement section of the parent pom.
-->
<dependencies>
- <!--
- Testing (note the scope)
- -->
<dependency>
<groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
<artifactId>dna-web-jcr-rest-war</artifactId>
<type>war</type>
<version>${pom.version}</version>
Deleted: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IMessages.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IMessages.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IMessages.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -1,99 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import java.util.ResourceBundle;
-
-/**
- * The <code>IMessages</code> interface are the resource bundle keys used in the <code>Messages.properties</code> file.
- *
- * @since 0.6
- */
-public interface IMessages {
-
- ResourceBundle MESSAGES = ResourceBundle.getBundle(IMessages.class.getPackage().getName() + ".Messages"); //$NON-NLS-1$
-
- String ErrorDeletingServerRegistryFile = "ErrorDeletingServerRegistryFile"; //$NON-NLS-1$
-
- String ErrorRestoringServerRegistry = "ErrorRestoringServerRegistry"; //$NON-NLS-1$
-
- String ErrorSavingServerRegistry = "ErrorSavingServerRegistry"; //$NON-NLS-1$
-
- String NullArgumentMsg = "NullArgumentMsg"; //$NON-NLS-1$
-
- String RepositoryEmptyNameMsg = "RepositoryEmptyNameMsg"; //$NON-NLS-1$
-
- String RepositoryNullServerMsg = "RepositoryNullServerMsg"; //$NON-NLS-1$
-
- String RepositoryShortDescription = "RepositoryShortDescription"; //$NON-NLS-1$
-
- String ServerEmptyUrlMsg = "ServerEmptyUrlMsg"; //$NON-NLS-1$
-
- String ServerInvalidUrlMsg = "ServerInvalidUrlMsg"; //$NON-NLS-1$
-
- String ServerEmptyUserMsg = "ServerEmptyUserMsg"; //$NON-NLS-1$
-
- String ServerExistsMsg = "ServerExistsMsg"; //$NON-NLS-1$
-
- String ServerManagerRegistryAddUnexpectedError = "ServerManagerRegistryAddUnexpectedError"; //$NON-NLS-1$
-
- String ServerManagerRegistryListenerError = "ServerManagerRegistryListenerError"; //$NON-NLS-1$
-
- String ServerManagerRegistryListenerErrorsOccurred = "ServerManagerRegistryListenerErrorsOccurred"; //$NON-NLS-1$
-
- String ServerManagerRegistryRemoveUnexpectedError = "ServerManagerRegistryRemoveUnexpectedError"; //$NON-NLS-1$
-
- String ServerManagerRegistryUpdateAddError = "ServerManagerRegistryUpdateAddError"; //$NON-NLS-1$
-
- String ServerManagerRegistryUpdateRemoveError = "ServerManagerRegistryUpdateRemoveError"; //$NON-NLS-1$
-
- String ServerManagerUnregisteredServer = "ServerManagerUnregisteredServer"; //$NON-NLS-1$
-
- String ServerShortDescription = "ServerShortDescription"; //$NON-NLS-1$
-
- String WorkspaceEmptyNameMsg = "WorkspaceEmptyNameMsg"; //$NON-NLS-1$
-
- String WorkspaceNullRepositoryMsg = "WorkspaceNullRepositoryMsg"; //$NON-NLS-1$
-
- String WorkspaceShortDescription = "WorkspaceShortDescription"; //$NON-NLS-1$
-
- // JsonRestClient messages
-
- String ConnectionErrorMsg = "ConnectionErrorMsg"; //$NON-NLS-1$
-
- String CreateFileFailedMsg = "CreateFileFailedMsg"; //$NON-NLS-1$
-
- String CreateFolderFailedMsg = "CreateFolderFailedMsg"; //$NON-NLS-1$
-
- String GetRepositoriesFailedMsg = "GetRepositoriesFailedMsg"; //$NON-NLS-1$
-
- String GetWorkspacesFailedMsg = "GetWorkspacesFailedMsg"; //$NON-NLS-1$
-
- String PublishFailedMsg = "PublishFailedMsg"; //$NON-NLS-1$
-
- String UnpublishFailedMsg = "UnpublishFailedMsg"; //$NON-NLS-1$
-
- String UnpublishNeverPublishedMsg = "UnpublishNeverPublishedMsg"; //$NON-NLS-1$
-
-}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IRestClient.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -61,7 +61,7 @@
* Publishes, or uploads, a local file to the workspace at the specified path.
*
* @param workspace the workspace where the resource will be published (never <code>null</code>)
- * @param path the path to the folder where the file will be published (never <code>null</code>)
+ * @param path the unencoded path to the folder where the file will be published (never <code>null</code>)
* @param file the resource being published (never <code>null</code>)
* @return a status of the publishing operation outcome (never <code>null</code>)
* @since 0.6
@@ -75,7 +75,7 @@
* the workspace an {@link Severity#INFO info status} is returned.
*
* @param workspace the workspace where the resource will be unpublished (never <code>null</code>)
- * @param path the path to the folder where the file is published (never <code>null</code>)
+ * @param path the unencoded path to the folder where the file is published (never <code>null</code>)
* @param file the file being unpublished (never <code>null</code>)
* @return a status of the unpublishing operation outcome (never <code>null</code>)
* @since 0.6
Deleted: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Logger.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Logger.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Logger.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -1,249 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import java.text.MessageFormat;
-import org.slf4j.LoggerFactory;
-
-/**
- * The <code>Logger</code> class provides a basic interface into an Eclipse SLF4J implementation.
- *
- * @since 0.6
- */
-public final class Logger {
-
- // ===========================================================================================================================
- // Class Methods
- // ===========================================================================================================================
-
- /**
- * @param clazz the class whose logger will be used
- * @param message the localized message
- * @return the message prepended with the class name and a delimiter
- * @since 0.6
- */
- private static String getMessage( Class<?> clazz,
- String message ) {
- return (clazz.getSimpleName() + ": " + message); //$NON-NLS-1$
- }
-
- /**
- * @param clazz the class whose logger will be used
- * @param pattern the {@link MessageFormat} pattern
- * @param arguments the arguments being inserted into the pattern
- * @return the message
- * @since 0.6
- */
- private static String getMessage( Class<?> clazz,
- String pattern,
- Object... arguments ) {
- return getMessage(clazz, MessageFormat.format(pattern, arguments));
- }
-
- /**
- * @param clazz the class whose logger will be used
- * @param status the status whose message is a {@link MessageFormat} pattern
- * @param arguments the arguments being inserted into the pattern
- * @return the message
- * @since 0.6
- */
- private static String getMessage( Class<?> clazz,
- Status status,
- Object... arguments ) {
- return getMessage(clazz, status.getMessage(), arguments);
- }
-
- /**
- * @param clazz the class whose logger will be used (never <code>null</code>)
- * @param status the status being logged (never <code>null</code>)
- * @since 0.6
- */
- public static void log( Class<?> clazz,
- Status status ) {
- Utils.nullArgumentCheck("clazz", clazz); //$NON-NLS-1$
- Utils.nullArgumentCheck("status", status); //$NON-NLS-1$
-
- org.slf4j.Logger delegate = null;
-
- try {
- delegate = LoggerFactory.getLogger(clazz);
- } catch (Throwable e) {
- // adapter not found
- System.err.println(status.getMessage());
- return;
- }
-
- if (status.isError() && delegate.isErrorEnabled()) {
- if (status.getException() == null) {
- delegate.error(getMessage(clazz, status.getMessage()));
- } else {
- delegate.error(getMessage(clazz, status.getMessage()), status.getException());
- }
- } else if (status.isWarning() && delegate.isWarnEnabled()) {
- if (status.getException() == null) {
- delegate.warn(getMessage(clazz, status.getMessage()));
- } else {
- delegate.warn(getMessage(clazz, status.getMessage()), status.getException());
- }
- } else if (status.isInfo() && delegate.isInfoEnabled()) {
- if (status.getException() == null) {
- delegate.info(getMessage(clazz, status.getMessage()));
- } else {
- delegate.info(getMessage(clazz, status.getMessage()), status.getException());
- }
- } else {
- trace(clazz, null, status.getMessage());
- }
- }
-
- /**
- * @param clazz the class whose logger will be used (never <code>null</code>)
- * @param status the status being logged whose message is a {@link MessageFormat} pattern (never <code>null</code>)
- * @param arguments the arguments to be inserted into the pattern (never <code>null</code>)
- * @since 0.6
- */
- public static void log( Class<?> clazz,
- Status status,
- Object... arguments ) {
- Utils.nullArgumentCheck("clazz", clazz); //$NON-NLS-1$
- Utils.nullArgumentCheck("status", status); //$NON-NLS-1$
- Utils.nullArgumentCheck("arguments", arguments); //$NON-NLS-1$
-
- org.slf4j.Logger delegate = null;
-
- try {
- delegate = LoggerFactory.getLogger(clazz);
- } catch (Throwable e) {
- // adapter not found
- System.err.println(status.getMessage());
- return;
- }
-
- if (status.isError() && delegate.isErrorEnabled()) {
- String msg = getMessage(clazz, status, arguments);
-
- if (status.getException() == null) {
- delegate.error(msg);
- } else {
- delegate.error(msg, status.getException());
- }
- } else if (status.isWarning() && delegate.isWarnEnabled()) {
- String msg = getMessage(clazz, status, arguments);
-
- if (status.getException() == null) {
- delegate.warn(msg);
- } else {
- delegate.warn(msg, status.getException());
- }
- } else if (status.isInfo() && delegate.isInfoEnabled()) {
- String msg = getMessage(clazz, status, arguments);
-
- if (status.getException() == null) {
- delegate.info(msg);
- } else {
- delegate.info(msg, status.getException());
- }
- } else {
- trace(clazz, status.getException(), status.getMessage(), arguments);
- }
- }
-
- /**
- * @param clazz the class whose logger will be used
- * @param e the error being logged or <code>null</code>
- * @param msg the message being logged (never <code>null</code>)
- * @since 0.6
- */
- public static void trace( Class<?> clazz,
- Throwable e,
- String msg ) {
- Utils.nullArgumentCheck("clazz", clazz); //$NON-NLS-1$
- Utils.nullArgumentCheck("msg", msg); //$NON-NLS-1$
-
- org.slf4j.Logger delegate = null;
-
- try {
- delegate = LoggerFactory.getLogger(clazz);
- } catch (Throwable error) {
- // adapter not found
- System.err.println(msg);
- return;
- }
-
- if (delegate.isTraceEnabled()) {
- if (e == null) {
- delegate.trace(getMessage(clazz, msg));
- } else {
- delegate.trace(getMessage(clazz, msg), e);
- }
- }
- }
-
- /**
- * @param clazz the class whose logger will be used (never <code>null</code>)
- * @param e the error being logged or <code>null</code>
- * @param pattern the {@link MessageFormat} pattern (never <code>null</code>)
- * @param arguments the arguments to be inserted into the pattern (never <code>null</code>)
- * @since 0.6
- */
- public static void trace( Class<?> clazz,
- Throwable e,
- String pattern,
- Object... arguments ) {
- Utils.nullArgumentCheck("clazz", clazz); //$NON-NLS-1$
- Utils.nullArgumentCheck("pattern", pattern); //$NON-NLS-1$
- Utils.nullArgumentCheck("arguments", arguments); //$NON-NLS-1$
-
- org.slf4j.Logger delegate = null;
-
- try {
- delegate = LoggerFactory.getLogger(clazz);
- } catch (Throwable error) {
- // adapter not found
- System.err.println(MessageFormat.format(pattern, arguments));
- return;
- }
-
- if (delegate.isTraceEnabled()) {
- if (e == null) {
- delegate.trace(getMessage(clazz, pattern, arguments));
- } else {
- delegate.trace(getMessage(clazz, pattern, arguments), e);
- }
- }
- }
-
- // ===========================================================================================================================
- // Constructors
- // ===========================================================================================================================
-
- /**
- * Don't allow construction.
- *
- * @since 0.6
- */
- private Logger() {
- // nothing to do
- }
-}
Copied: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java (from rev 1148, branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IMessages.java)
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java (rev 0)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -0,0 +1,109 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client;
+
+import org.jboss.dna.common.i18n.I18n;
+
+/**
+ * The <code>RestClientI18n</code> class provides localized messages.
+ *
+ * @since 0.6
+ */
+public final class RestClientI18n {
+
+ public static I18n errorDeletingServerRegistryFile;
+
+ public static I18n errorRestoringServerRegistry;
+
+ public static I18n errorSavingServerRegistry;
+
+ public static I18n nullArgumentMsg;
+
+ public static I18n repositoryEmptyNameMsg;
+
+ public static I18n repositoryNullServerMsg;
+
+ public static I18n repositoryShortDescription;
+
+ public static I18n serverEmptyUrlMsg;
+
+ public static I18n serverEmptyUserMsg;
+
+ public static I18n serverExistsMsg;
+
+ public static I18n serverInvalidUrlMsg;
+
+ public static I18n serverManagerConnectionEstablishedMsg;
+
+ public static I18n serverManagerConnectionFailedMsg;
+
+ public static I18n serverManagerRegistryAddUnexpectedError;
+
+ public static I18n serverManagerRegistryListenerError;
+
+ public static I18n serverManagerRegistryListenerErrorsOccurred;
+
+ public static I18n serverManagerRegistryRemoveUnexpectedError;
+
+ public static I18n serverManagerRegistryUpdateAddError;
+
+ public static I18n serverManagerRegistryUpdateRemoveError;
+
+ public static I18n serverManagerUnregisteredServer;
+
+ public static I18n serverShortDescription;
+
+ public static I18n workspaceEmptyNameMsg;
+
+ public static I18n workspaceNullRepositoryMsg;
+
+ public static I18n workspaceShortDescription;
+
+ // JsonRestClient messages
+
+ public static I18n connectionErrorMsg;
+
+ public static I18n createFileFailedMsg;
+
+ public static I18n createFolderFailedMsg;
+
+ public static I18n getRepositoriesFailedMsg;
+
+ public static I18n getWorkspacesFailedMsg;
+
+ public static I18n publishFailedMsg;
+
+ public static I18n unpublishFailedMsg;
+
+ public static I18n unpublishNeverPublishedMsg;
+
+ static {
+ try {
+ I18n.initialize(RestClientI18n.class);
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+ }
+
+}
Property changes on: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerAuthenticator.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -25,8 +25,11 @@
import java.net.Authenticator;
import java.net.PasswordAuthentication;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
/**
+ * The <code>ServerAuthenticator</code> class provides user names and passwords to the HTTP connection.
+ *
* @since 0.6
*/
public class ServerAuthenticator extends Authenticator {
@@ -35,12 +38,21 @@
// Fields
// ===========================================================================================================================
+ /**
+ * The object managing the server registry.
+ *
+ * @since 0.6
+ */
private final ServerManager serverManager;
// ===========================================================================================================================
// Constructors
// ===========================================================================================================================
+ /**
+ * @param serverManager the server manager manages the server registry
+ * @since 0.6
+ */
public ServerAuthenticator( ServerManager serverManager ) {
this.serverManager = serverManager;
}
@@ -57,73 +69,8 @@
*/
@Override
protected PasswordAuthentication getPasswordAuthentication() {
- // URL url = getRequestingURL();
- return super.getPasswordAuthentication();
+ Server server = this.serverManager.getCurrentServer();
+ return new PasswordAuthentication(server.getUser(), server.getPassword().toCharArray());
}
- /*
- public final class DelegatingAuthenticator extends Authenticator {
-
- private static DelegatingAuthenticator m_INSTANCE;
-
- private Map m_authenticators;
-
- static public DelegatingAuthenticator getInstance() {
- synchronized (DelegatingAuthenticator.class) {
- if (m_INSTANCE == null) {
- m_INSTANCE = new DelegatingAuthenticator();
- Authenticator.setDefault(m_INSTANCE);
- }
- return m_INSTANCE;
- }
- }
-
- private DelegatingAuthenticator() {
- m_authenticators = new HashMap();
- }
-
- public void addTransitAuthenticator( TransitAuthenticator authenticator,
- RequestIdentifier id ) {
- synchronized (m_authenticators) {
- m_authenticators.put(id, authenticator);
- }
- }
-
- public void removeTransitAuthenticator( TransitAuthenticator authenticator ) {
- synchronized (m_authenticators) {
- Iterator list = m_authenticators.values().iterator();
- while (list.hasNext()) {
- Authenticator item = (Authenticator)list.next();
- if (item.equals(authenticator)) {
- list.remove();
- }
- }
- }
- }
-
- protected PasswordAuthentication getPasswordAuthentication() {
- try {
- String host = getRequestingHost();
- String protocol = getRequestingProtocol();
- String prompt = getRequestingPrompt();
- String scheme = getRequestingScheme();
- int port = getRequestingPort();
- InetAddress addr = getRequestingSite();
- if (addr == null) {
- addr = InetAddress.getByName(host);
- }
- RequestIdentifier id = new RequestIdentifier(addr, port, protocol, scheme, prompt);
- synchronized (m_authenticators) {
- TransitAuthenticator auth = (TransitAuthenticator)m_authenticators.get(id);
- if (auth == null) {
- return null;
- }
- return auth.resolvePasswordAuthentication(this);
- }
- } catch (UnknownHostException e) {
- return null;
- }
- }
- }
- */
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,9 +23,9 @@
*/
package org.jboss.dna.web.jcr.rest.client;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.MESSAGES;
import java.io.File;
import java.io.FileOutputStream;
+import java.net.Authenticator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -43,6 +43,8 @@
import javax.xml.transform.stream.StreamResult;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
@@ -109,6 +111,31 @@
private static final String USER_TAG = "user"; //$NON-NLS-1$
// ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ /**
+ * The java.net.Authenticator needs server information to complete the publish, unpublish, getRepositories(), and
+ * getWorkspaces() operations. Setting a thread variable was a way to do that.
+ *
+ * @see ServerAuthenticator
+ * @since 0.6
+ */
+ private static ThreadLocal<Server> currentServer = new ThreadLocal<Server>();
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the server set on the current thread or <code>null</code>
+ * @since 0.6
+ */
+ public static Server getCurrentServer() {
+ return ServerManager.currentServer.get();
+ }
+
+ // ===========================================================================================================================
// Fields
// ===========================================================================================================================
@@ -127,6 +154,13 @@
private final IRestClient delegate;
/**
+ * The logger.
+ *
+ * @since 0.6
+ */
+ private final Logger logger = Logger.getLogger(ServerManager.class);
+
+ /**
* The path where the server registry is persisted or <code>null</code> if not persisted.
*
* @since 0.6
@@ -155,20 +189,20 @@
/**
* @param stateLocationPath the directory where the {@link Server} registry} is persisted (may be <code>null</code> if
* persistence is not desired)
- * @param restExecutor the executor that will communicate with the DNA REST server (never <code>null</code>)
+ * @param restClient the client that will communicate with the DNA REST server (never <code>null</code>)
* @since 0.6
*/
public ServerManager( String stateLocationPath,
- IRestClient restExecutor ) {
- Utils.nullArgumentCheck("restExecutor", restExecutor); //$NON-NLS-1$
+ IRestClient restClient ) {
+ CheckArg.isNotNull(restClient, "restClient"); //$NON-NLS-1$
this.servers = new ArrayList<Server>();
this.stateLocationPath = stateLocationPath;
- this.delegate = restExecutor;
+ this.delegate = restClient;
this.listeners = new CopyOnWriteArrayList<IServerRegistryListener>();
- // TODO set authenticator here
- // Authenticator.setDefault(new ServerAuthenticator());
+ // set our authenticator that uses the server registry
+ Authenticator.setDefault(new ServerAuthenticator(this));
}
/**
@@ -194,7 +228,7 @@
* @since 0.6
*/
public boolean addRegistryListener( IServerRegistryListener listener ) {
- Utils.nullArgumentCheck("listener", listener); //$NON-NLS-1$
+ CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
return this.listeners.addIfAbsent(listener);
}
@@ -206,7 +240,7 @@
* @since 0.6
*/
public Status addServer( Server server ) {
- Utils.nullArgumentCheck("server", server); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
return internalAddServer(server, true);
}
@@ -241,21 +275,24 @@
* {@inheritDoc}
*
* @see org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
+ * @throws RuntimeException if the server is not registered
+ * @see #isRegistered(Server)
* @since 0.6
*/
public Collection<Repository> getRepositories( Server server ) throws Exception {
- Utils.nullArgumentCheck("server", server); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
try {
this.serverLock.readLock().lock();
if (isRegistered(server)) {
+ ServerManager.currentServer.set(server);
Collection<Repository> repositories = this.delegate.getRepositories(server);
return Collections.unmodifiableCollection(new ArrayList<Repository>(repositories));
}
// server must be registered in order to obtain it's repositories
- throw new RuntimeException(Utils.getMessage(IMessages.ServerManagerUnregisteredServer, server.getShortDescription()));
+ throw new RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
} finally {
this.serverLock.readLock().unlock();
}
@@ -265,22 +302,25 @@
* {@inheritDoc}
*
* @see org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
+ * @throws RuntimeException if the server is not registered
+ * @see #isRegistered(Server)
* @since 0.6
*/
public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
- Utils.nullArgumentCheck("repository", repository); //$NON-NLS-1$
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
try {
this.serverLock.readLock().lock();
if (isRegistered(repository.getServer())) {
+ ServerManager.currentServer.set(repository.getServer());
Collection<Workspace> workspaces = this.delegate.getWorkspaces(repository);
return Collections.unmodifiableCollection(new ArrayList<Workspace>(workspaces));
}
// a repository's server must be registered in order to obtain it's workspaces
- throw new RuntimeException(Utils.getMessage(IMessages.ServerManagerUnregisteredServer,
- repository.getServer().getShortDescription()));
+ String msg = RestClientI18n.serverManagerUnregisteredServer.text(repository.getServer().getShortDescription());
+ throw new RuntimeException(msg);
} finally {
this.serverLock.readLock().unlock();
}
@@ -318,7 +358,7 @@
}
// server already exists
- return new Status(Severity.ERROR, Utils.getMessage(IMessages.ServerExistsMsg, server.getShortDescription()), null);
+ return new Status(Severity.ERROR, RestClientI18n.serverExistsMsg.text(server.getShortDescription()), null);
}
/**
@@ -355,8 +395,8 @@
}
// server could not be removed
- return new Status(Severity.ERROR, Utils.getMessage(IMessages.ServerManagerRegistryRemoveUnexpectedError,
- server.getShortDescription()), null);
+ return new Status(Severity.ERROR,
+ RestClientI18n.serverManagerRegistryRemoveUnexpectedError.text(server.getShortDescription()), null);
}
/**
@@ -366,7 +406,7 @@
* @since 0.6
*/
public boolean isRegistered( Server server ) {
- Utils.nullArgumentCheck("server", server); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
try {
this.serverLock.readLock().lock();
@@ -430,24 +470,58 @@
}
for (Exception error : errors) {
- Logger.log(getClass(), new Status(Severity.ERROR, MESSAGES.getString(IMessages.ServerManagerRegistryListenerError),
- error));
+ this.logger.error(error, RestClientI18n.serverManagerRegistryListenerError);
}
- return new Status(Severity.WARNING, MESSAGES.getString(IMessages.ServerManagerRegistryListenerErrorsOccurred), null);
+ return new Status(Severity.WARNING, RestClientI18n.serverManagerRegistryListenerErrorsOccurred.text(), null);
}
/**
+ * Attempts to connect to the server. The server does <strong>NOT</strong> need to be registered.
+ *
+ * @param server the server being pinged (never <code>null</code>)
+ * @return a status indicating if the server can be connected to
+ * @see #isRegistered(Server)
+ * @since 0.6
+ */
+ public Status ping( Server server ) {
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+
+ try {
+ ServerManager.currentServer.set(server);
+ this.delegate.getRepositories(server);
+ return new Status(Severity.OK, RestClientI18n.serverManagerConnectionEstablishedMsg.text(), null);
+ } catch (Exception e) {
+ return new Status(Severity.ERROR, RestClientI18n.serverManagerConnectionFailedMsg.text(), null);
+ }
+ }
+
+ /**
* {@inheritDoc}
+ * <p>
+ * Only tries to unpublish if the workspace's {@link Server server} is registered.
*
* @see org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
* java.lang.String, java.io.File)
+ * @see #isRegistered(Server)
* @since 0.6
*/
public Status publish( Workspace workspace,
String path,
File file ) {
- return this.delegate.publish(workspace, path, file);
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+
+ Server server = workspace.getServer();
+
+ if (isRegistered(server)) {
+ ServerManager.currentServer.set(server);
+ return this.delegate.publish(workspace, path, file);
+ }
+
+ // server must be registered in order to publish
+ throw new RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
}
/**
@@ -456,7 +530,7 @@
* @since 0.6
*/
public boolean removeRegistryListener( IServerRegistryListener listener ) {
- Utils.nullArgumentCheck("listener", listener); //$NON-NLS-1$
+ CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
return this.listeners.remove(listener);
}
@@ -466,7 +540,7 @@
* @since 0.6
*/
public Status removeServer( Server server ) {
- Utils.nullArgumentCheck("server", server); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
return internalRemoveServer(server, true);
}
@@ -502,8 +576,7 @@
}
}
} catch (Exception e) {
- return new Status(Severity.ERROR,
- Utils.getMessage(IMessages.ErrorRestoringServerRegistry, getStateFileName()), e);
+ return new Status(Severity.ERROR, RestClientI18n.errorRestoringServerRegistry.text(getStateFileName()), e);
}
}
}
@@ -549,15 +622,14 @@
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
transformer.transform(source, resultXML);
} catch (Exception e) {
- return new Status(Severity.ERROR, Utils.getMessage(IMessages.ErrorSavingServerRegistry, getStateFileName()), e);
+ return new Status(Severity.ERROR, RestClientI18n.errorSavingServerRegistry.text(getStateFileName()), e);
}
} else if ((this.stateLocationPath != null) && stateFileExists()) {
// delete current registry file since all servers have been deleted
try {
new File(getStateFileName()).delete();
} catch (Exception e) {
- return new Status(Severity.ERROR,
- Utils.getMessage(IMessages.ErrorDeletingServerRegistryFile, getStateFileName()), e);
+ return new Status(Severity.ERROR, RestClientI18n.errorDeletingServerRegistryFile.text(getStateFileName()), e);
}
}
@@ -574,15 +646,30 @@
/**
* {@inheritDoc}
+ * <p>
+ * Only tries to unpublish if the workspace's {@link Server server} is registered.
*
* @see org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
* java.lang.String, java.io.File)
+ * @see #isRegistered(Server)
* @since 0.6
*/
public Status unpublish( Workspace workspace,
String path,
File file ) {
- return this.delegate.unpublish(workspace, path, file);
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+
+ Server server = workspace.getServer();
+
+ if (isRegistered(server)) {
+ ServerManager.currentServer.set(server);
+ return this.delegate.unpublish(workspace, path, file);
+ }
+
+ // server must be registered in order to unpublish
+ throw new RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
}
/**
@@ -595,8 +682,8 @@
*/
public Status updateServer( Server previousServerVersion,
Server newServerVersion ) {
- Utils.nullArgumentCheck("previousServerVersion", previousServerVersion); //$NON-NLS-1$
- Utils.nullArgumentCheck("newServerVersion", newServerVersion); //$NON-NLS-1$
+ CheckArg.isNotNull(previousServerVersion, "previousServerVersion"); //$NON-NLS-1$
+ CheckArg.isNotNull(newServerVersion, "newServerVersion"); //$NON-NLS-1$
Status status = null;
@@ -615,16 +702,15 @@
}
// unexpected problem adding new version of server to registry
- return new Status(Severity.ERROR, Utils.getMessage(IMessages.ServerManagerRegistryUpdateAddError,
- status.getMessage()), status.getException());
+ return new Status(Severity.ERROR, RestClientI18n.serverManagerRegistryUpdateAddError.text(status.getMessage()),
+ status.getException());
}
} finally {
this.serverLock.writeLock().unlock();
}
// unexpected problem removing server from registry
- return new Status(Severity.ERROR,
- Utils.getMessage(IMessages.ServerManagerRegistryUpdateRemoveError, status.getMessage()),
+ return new Status(Severity.ERROR, RestClientI18n.serverManagerRegistryUpdateRemoveError.text(status.getMessage()),
status.getException());
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
/**
@@ -76,7 +77,7 @@
* @since 0.6
*/
public static ServerRegistryEvent createNewEvent( Server newServer ) {
- Utils.nullArgumentCheck("newServer", newServer); //$NON-NLS-1$
+ CheckArg.isNotNull(newServer, "newServer"); //$NON-NLS-1$
return new ServerRegistryEvent(Type.NEW, newServer);
}
@@ -87,7 +88,7 @@
* @since 0.6
*/
public static ServerRegistryEvent createRemoveEvent( Server removedServer ) {
- Utils.nullArgumentCheck("removedServer", removedServer); //$NON-NLS-1$
+ CheckArg.isNotNull(removedServer, "removedServer"); //$NON-NLS-1$
return new ServerRegistryEvent(Type.REMOVE, removedServer);
}
@@ -100,8 +101,8 @@
*/
public static ServerRegistryEvent createUpdateEvent( Server previousServerVersion,
Server newServerVersion ) {
- Utils.nullArgumentCheck("previousServerVersion", previousServerVersion); //$NON-NLS-1$
- Utils.nullArgumentCheck("newServerVersion", newServerVersion); //$NON-NLS-1$
+ CheckArg.isNotNull(previousServerVersion, "previousServerVersion"); //$NON-NLS-1$
+ CheckArg.isNotNull(newServerVersion, "newServerVersion"); //$NON-NLS-1$
ServerRegistryEvent event = new ServerRegistryEvent(Type.UPDATE, previousServerVersion);
event.updatedServer = newServerVersion;
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Status.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -96,21 +96,21 @@
*
* @since 0.6
*/
- protected final Throwable exception;
+ private final Throwable exception;
/**
* The localized message of this status (can be <code>null</code>).
*
* @since 0.6
*/
- protected final String message;
+ private final String message;
/**
* The severity level of this status (never <code>null</code>).
*
* @since 0.6
*/
- protected final Severity severity;
+ private final Severity severity;
// ===========================================================================================================================
// Constructors
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/Utils.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,9 +23,10 @@
*/
package org.jboss.dna.web.jcr.rest.client;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.MESSAGES;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.NullArgumentMsg;
-import java.text.MessageFormat;
+import java.io.File;
+import java.io.InputStream;
+import java.util.Map;
+import org.jboss.dna.common.util.MimeTypeUtil;
/**
* The <code>Utils</code> class contains common utilities used by this project.
@@ -35,6 +36,13 @@
public final class Utils {
// ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ // utility to detect file mime type by using file extension
+ private static MimeTypeUtil mimeTypeUtils;
+
+ // ===========================================================================================================================
// Class Methods
// ===========================================================================================================================
@@ -56,30 +64,22 @@
}
/**
- * @param key the key of the pattern from the {@link IMessages#MESSAGES} resource bundle (never <code>null</code>)
- * @param arguments the values being inserted into the pattern
- * @return the localized text
+ * @param file the file whose mime type is being requested
+ * @return the mime type or the default mime type (<code>"application/octet-stream"</code>) if one can't be determined from
+ * the file extension (never <code>null</code>)
* @since 0.6
*/
- public static String getMessage( String key,
- Object... arguments ) {
- Utils.nullArgumentCheck("key", key); //$NON-NLS-1$
- String pattern = MESSAGES.getString(key);
- return MessageFormat.format(pattern, arguments);
- }
+ public static String getMimeType( File file ) {
+ // TODO write test for getMimeType(File)
+ if (mimeTypeUtils == null) {
- /**
- * @param name the argument name
- * @param value the argument value
- * @throws IllegalArgumentException if the value is <code>null</code>
- * @since 0.6
- */
- public static void nullArgumentCheck( String name,
- Object value ) throws IllegalArgumentException {
- if (value == null) {
- String pattern = MESSAGES.getString(NullArgumentMsg);
- throw new IllegalArgumentException(MessageFormat.format(pattern, name));
+ InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jboss/dna/web/jcr/rest/client/mime.types"); //$NON-NLS-1$
+ Map<String, String> customMap = MimeTypeUtil.load(stream, null);
+ mimeTypeUtils = new MimeTypeUtil(customMap, true);
}
+
+ String mimeType = mimeTypeUtils.mimeTypeOf(file);
+ return ((mimeType == null) ? "application/octet-stream" : mimeType); //$NON-NLS-1$
}
// ===========================================================================================================================
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,10 +23,10 @@
*/
package org.jboss.dna.web.jcr.rest.client.domain;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.RepositoryShortDescription;
import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.domain.validation.RepositoryValidator;
/**
@@ -72,8 +72,8 @@
*/
public Repository( String name,
Server server ) {
- Utils.nullArgumentCheck("name", name); //$NON-NLS-1$
- Utils.nullArgumentCheck("server", server); //$NON-NLS-1$
+ CheckArg.isNotNull(name, "name"); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
// validate inputs
Status status = RepositoryValidator.isValid(name, server);
@@ -132,7 +132,7 @@
* @since 0.6
*/
public String getShortDescription() {
- return Utils.getMessage(RepositoryShortDescription, this.name, this.server.getName());
+ return RestClientI18n.repositoryShortDescription.text(this.name, this.server.getName());
}
/**
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,8 +23,9 @@
*/
package org.jboss.dna.web.jcr.rest.client.domain;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.ServerShortDescription;
import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.domain.validation.RepositoryValidator;
@@ -89,7 +90,7 @@
String user,
String password,
boolean persistPassword ) {
- Utils.nullArgumentCheck("url", url); //$NON-NLS-1$
+ CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
// valid inputs
Status status = ServerValidator.isValid(url, user, password, persistPassword);
@@ -152,7 +153,7 @@
* @since 0.6
*/
public String getShortDescription() {
- return Utils.getMessage(ServerShortDescription, this.url, this.user);
+ return RestClientI18n.serverShortDescription.text(this.url, this.user);
}
/**
@@ -200,7 +201,7 @@
* @return <code>true</code> if the servers have the same key
*/
public boolean hasSameKey( Server otherServer ) {
- Utils.nullArgumentCheck("otherServer", otherServer); //$NON-NLS-1$
+ CheckArg.isNotNull(otherServer, "otherServer"); //$NON-NLS-1$
return (Utils.equivalent(this.url, otherServer.url) && Utils.equivalent(this.user, otherServer.user));
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,10 +23,10 @@
*/
package org.jboss.dna.web.jcr.rest.client.domain;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.WorkspaceShortDescription;
import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.domain.validation.WorkspaceValidator;
/**
@@ -70,8 +70,8 @@
*/
public Workspace( String name,
Repository repository ) {
- Utils.nullArgumentCheck("name", name); //$NON-NLS-1$
- Utils.nullArgumentCheck("repository", repository); //$NON-NLS-1$
+ CheckArg.isNotNull(name, "name"); //$NON-NLS-1$
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
// validate inputs
Status status = WorkspaceValidator.isValid(name, repository);
@@ -138,7 +138,7 @@
* @since 0.6
*/
public String getShortDescription() {
- return Utils.getMessage(WorkspaceShortDescription, this.name, this.repository.getName());
+ return RestClientI18n.workspaceShortDescription.text(this.name, this.repository.getName());
}
/**
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/RepositoryValidator.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,9 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.domain.validation;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.MESSAGES;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.RepositoryEmptyNameMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.RepositoryNullServerMsg;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
@@ -49,7 +47,7 @@
*/
public static Status isNameValid( String name ) {
if ((name == null) || (name.length() == 0)) {
- return new Status(Severity.ERROR, MESSAGES.getString(RepositoryEmptyNameMsg), null);
+ return new Status(Severity.ERROR, RestClientI18n.repositoryEmptyNameMsg.text(), null);
}
return Status.OK_STATUS;
@@ -62,7 +60,7 @@
*/
public static Status isServerValid( Server server ) {
if (server == null) {
- return new Status(Severity.ERROR, MESSAGES.getString(RepositoryNullServerMsg), null);
+ return new Status(Severity.ERROR, RestClientI18n.repositoryNullServerMsg.text(), null);
}
return Status.OK_STATUS;
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/ServerValidator.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,15 +23,10 @@
*/
package org.jboss.dna.web.jcr.rest.client.domain.validation;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.MESSAGES;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.ServerEmptyUrlMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.ServerEmptyUserMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.ServerExistsMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.ServerInvalidUrlMsg;
import java.net.URL;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.ServerManager;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
@@ -62,13 +57,13 @@
*/
public static Status isUrlValid( String url ) {
if ((url == null) || (url.length() == 0)) {
- return new Status(Severity.ERROR, MESSAGES.getString(ServerEmptyUrlMsg), null);
+ return new Status(Severity.ERROR, RestClientI18n.serverEmptyUrlMsg.text(), null);
}
try {
new URL(url);
} catch (Exception e) {
- return new Status(Severity.ERROR, Utils.getMessage(ServerInvalidUrlMsg, url), null);
+ return new Status(Severity.ERROR, RestClientI18n.serverInvalidUrlMsg.text(url), null);
}
return Status.OK_STATUS;
@@ -81,7 +76,7 @@
*/
public static Status isUserValid( String user ) {
if ((user == null) || (user.length() == 0)) {
- return new Status(Severity.ERROR, MESSAGES.getString(ServerEmptyUserMsg), null);
+ return new Status(Severity.ERROR, RestClientI18n.serverEmptyUserMsg.text(), null);
}
return Status.OK_STATUS;
@@ -139,7 +134,7 @@
Server newServer = new Server(url, user, password, persistPassword);
if (serverManager.isRegistered(newServer)) {
- status = new Status(Severity.ERROR, Utils.getMessage(ServerExistsMsg, newServer.getShortDescription()), null);
+ status = new Status(Severity.ERROR, RestClientI18n.serverExistsMsg.text(newServer.getShortDescription()), null);
}
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/WorkspaceValidator.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,9 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.domain.validation;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.MESSAGES;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.WorkspaceEmptyNameMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.WorkspaceNullRepositoryMsg;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
@@ -49,7 +47,7 @@
*/
public static Status isNameValid( String name ) {
if ((name == null) || (name.length() == 0)) {
- return new Status(Severity.ERROR, MESSAGES.getString(WorkspaceEmptyNameMsg), null);
+ return new Status(Severity.ERROR, RestClientI18n.workspaceEmptyNameMsg.text(), null);
}
return Status.OK_STATUS;
@@ -62,7 +60,7 @@
*/
public static Status isRepositoryValid( Repository repository ) {
if (repository == null) {
- return new Status(Severity.ERROR, MESSAGES.getString(WorkspaceNullRepositoryMsg), null);
+ return new Status(Severity.ERROR, RestClientI18n.workspaceNullRepositoryMsg.text(), null);
}
return Status.OK_STATUS;
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FileNode.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -36,6 +36,8 @@
import java.util.TimeZone;
import net.jcip.annotations.Immutable;
import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
import org.jboss.dna.web.jcr.rest.client.IJcrConstants;
import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
@@ -90,8 +92,8 @@
File file ) throws Exception {
super(file.getName());
- Utils.nullArgumentCheck("workspace", workspace); //$NON-NLS-1$
- Utils.nullArgumentCheck("path", path); //$NON-NLS-1$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
this.file = file;
this.path = path;
@@ -167,8 +169,8 @@
FolderNode folderNode = new FolderNode(this.workspace, getPath());
StringBuilder url = new StringBuilder(folderNode.getUrl().toString());
- // add file to path
- url.append('/').append(this.file.getName());
+ // add file to path and encode the name
+ url.append('/').append(JsonUtils.encode(this.file.getName()));
return new URL(url.toString());
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/FolderNode.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -26,8 +26,9 @@
import java.net.URL;
import net.jcip.annotations.Immutable;
import org.codehaus.jettison.json.JSONObject;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
import org.jboss.dna.web.jcr.rest.client.IJcrConstants;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
/**
@@ -64,8 +65,8 @@
String fullPath ) throws Exception {
super(fullPath);
- Utils.nullArgumentCheck("workspace", workspace); //$NON-NLS-1$
- Utils.nullArgumentCheck("fullPath", fullPath); //$NON-NLS-1$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(fullPath, "fullPath"); //$NON-NLS-1$
this.workspace = workspace;
@@ -100,19 +101,20 @@
WorkspaceNode workspaceNode = new WorkspaceNode(this.workspace);
StringBuilder url = new StringBuilder(workspaceNode.getUrl().toString());
- // add folder path
+ // make sure path starts with a '/'
String path = getPath();
- if (path.startsWith("/")) { //$NON-NLS-1$
- url.append(path);
- } else {
- url.append('/').append(path);
+ if (!path.startsWith("/")) { //$NON-NLS-1$
+ path = '/' + path;
}
-
- // strip off ending '/'
+
+ // make sure path does NOT end with a '/'
if (path.endsWith("/")) { //$NON-NLS-1$
- url.setLength(url.length() - 1);
+ path = path.substring(0, path.length() - 1);
}
+
+ // path needs to be encoded
+ url.append(JsonUtils.encode(path));
return new URL(url.toString());
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonNode.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -25,7 +25,7 @@
import java.net.URL;
import org.codehaus.jettison.json.JSONObject;
-import org.jboss.dna.web.jcr.rest.client.Utils;
+import org.jboss.dna.common.util.CheckArg;
/**
* The <code>JsonNode</code> class defines the API for interacing with JSON objects. Every <code>JsonNode</code> knows how to
@@ -55,7 +55,7 @@
* @since 0.6
*/
protected JsonNode( String id ) {
- Utils.nullArgumentCheck("id", id); //$NON-NLS-1$
+ CheckArg.isNotNull(id, "id"); //$NON-NLS-1$
this.id = id;
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClient.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -23,25 +23,17 @@
*/
package org.jboss.dna.web.jcr.rest.client.json;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.ConnectionErrorMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.CreateFileFailedMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.CreateFolderFailedMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.GetRepositoriesFailedMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.GetWorkspacesFailedMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.PublishFailedMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.UnpublishFailedMsg;
-import static org.jboss.dna.web.jcr.rest.client.IMessages.UnpublishNeverPublishedMsg;
import java.io.File;
-import java.net.Authenticator;
import java.net.HttpURLConnection;
-import java.net.PasswordAuthentication;
import java.net.URL;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
+import org.jboss.dna.common.util.Base64;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
import org.jboss.dna.web.jcr.rest.client.IRestClient;
-import org.jboss.dna.web.jcr.rest.client.Logger;
+import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
@@ -57,6 +49,17 @@
public final class JsonRestClient implements IRestClient {
// ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The logger.
+ *
+ * @since 0.6
+ */
+ private final Logger logger = Logger.getLogger(JsonRestClient.class);
+
+ // ===========================================================================================================================
// Methods
// ===========================================================================================================================
@@ -72,35 +75,27 @@
private void createFileNode( Workspace workspace,
String path,
File file ) throws Exception {
- Logger.trace(JsonRestClient.class,
- null,
- "createFileNode: workspace=" + workspace.getName() + ", path=" + path + ", file=" + file.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.logger.trace("createFileNode: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
FileNode fileNode = new FileNode(workspace, path, file);
HttpURLConnection connection = openConnection(workspace.getServer(), fileNode.getUrl(), RequestMethod.POST);
try {
- Logger.trace(JsonRestClient.class, null, "createFileNode: create node=" + fileNode); //$NON-NLS-1$
+ this.logger.trace("createFileNode: create node={0}", fileNode); //$NON-NLS-1$
connection.getOutputStream().write(fileNode.getContent());
// make sure node was created
if (connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
- // log
- Status status = new Status(Severity.ERROR, Utils.getMessage(ConnectionErrorMsg,
- connection.getResponseCode(),
- "createFileNode"), null); //$NON-NLS-1$
- Logger.log(JsonRestClient.class, status);
-
- // throw exception
- String msg = Utils.getMessage(CreateFileFailedMsg,
- file.getName(),
- path,
- workspace.getName(),
- connection.getResponseCode());
+ // node was not created
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "createFileNode"); //$NON-NLS-1$
+ String msg = RestClientI18n.createFileFailedMsg.text(file.getName(),
+ path,
+ workspace.getName(),
+ connection.getResponseCode());
throw new RuntimeException(msg);
}
} finally {
if (connection != null) {
- Logger.trace(JsonRestClient.class, null, "createFileNode: leaving"); //$NON-NLS-1$
+ this.logger.trace("createFileNode: leaving"); //$NON-NLS-1$
connection.disconnect();
}
}
@@ -116,29 +111,24 @@
*/
private void createFolderNode( Workspace workspace,
String path ) throws Exception {
- Logger.trace(JsonRestClient.class, null, "createFolderNode: workspace=" + workspace.getName() + ", path=" + path); //$NON-NLS-1$//$NON-NLS-2$
+ this.logger.trace("createFolderNode: workspace={0}, path={1}", workspace.getName(), path); //$NON-NLS-1$
FolderNode folderNode = new FolderNode(workspace, path);
HttpURLConnection connection = openConnection(workspace.getServer(), folderNode.getUrl(), RequestMethod.POST);
try {
- Logger.trace(JsonRestClient.class, null, "createFolderNode: create node=" + folderNode); //$NON-NLS-1$
+ this.logger.trace("createFolderNode: create node={0}", folderNode); //$NON-NLS-1$
connection.getOutputStream().write(folderNode.getContent());
// make sure node was created
if (connection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
- // log
- Status status = new Status(Severity.ERROR, Utils.getMessage(ConnectionErrorMsg,
- connection.getResponseCode(),
- "createFolderNode"), null); //$NON-NLS-1$
- Logger.log(JsonRestClient.class, status);
-
- // throw exception
- String msg = Utils.getMessage(CreateFolderFailedMsg, path, workspace.getName(), connection.getResponseCode());
+ // node was not created
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "createFolderNode"); //$NON-NLS-1$
+ String msg = RestClientI18n.createFolderFailedMsg.text(path, workspace.getName(), connection.getResponseCode());
throw new RuntimeException(msg);
}
} finally {
if (connection != null) {
- Logger.trace(JsonRestClient.class, null, "createFolderNode: leaving"); //$NON-NLS-1$
+ this.logger.trace("createFolderNode: leaving"); //$NON-NLS-1$
connection.disconnect();
}
}
@@ -154,7 +144,7 @@
*/
private void ensureFolderExists( Workspace workspace,
String folderPath ) throws Exception {
- Logger.trace(JsonRestClient.class, null, "ensureFolderExists: workspace=" + workspace.getName() + ", path=" + folderPath); //$NON-NLS-1$//$NON-NLS-2$
+ this.logger.trace("ensureFolderExists: workspace={0}, path={1}", workspace.getName(), folderPath); //$NON-NLS-1$
FolderNode folderNode = new FolderNode(workspace, folderPath);
if (!pathExists(workspace.getServer(), folderNode.getUrl())) {
@@ -193,8 +183,8 @@
* @since 0.6
*/
public Collection<Repository> getRepositories( Server server ) throws Exception {
- Utils.nullArgumentCheck("server", server); //$NON-NLS-1$
- Logger.trace(JsonRestClient.class, null, "getRepositories: server=" + server); //$NON-NLS-1$
+ CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
+ this.logger.trace("getRepositories: server={0}", server); //$NON-NLS-1$
ServerNode serverNode = new ServerNode(server);
HttpURLConnection connection = openConnection(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET);
@@ -204,18 +194,13 @@
return serverNode.getRepositories(JsonUtils.readInputStream(connection));
}
- // log
- Status status = new Status(Severity.ERROR, Utils.getMessage(ConnectionErrorMsg,
- connection.getResponseCode(),
- "getRepositories"), null); //$NON-NLS-1$
- Logger.log(JsonRestClient.class, status);
-
// not a good response code
- String msg = Utils.getMessage(GetRepositoriesFailedMsg, server.getName(), connection.getResponseCode());
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "getRepositories"); //$NON-NLS-1$
+ String msg = RestClientI18n.getRepositoriesFailedMsg.text(server.getName(), connection.getResponseCode());
throw new RuntimeException(msg);
} finally {
if (connection != null) {
- Logger.trace(JsonRestClient.class, null, "getRepositories: leaving"); //$NON-NLS-1$
+ this.logger.trace("getRepositories: leaving"); //$NON-NLS-1$
connection.disconnect();
}
}
@@ -228,8 +213,8 @@
* @since 0.6
*/
public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
- Utils.nullArgumentCheck("repository", repository); //$NON-NLS-1$
- Logger.trace(JsonRestClient.class, null, "getWorkspaces: repository=" + repository); //$NON-NLS-1$
+ CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
+ this.logger.trace("getWorkspaces: repository={0}", repository); //$NON-NLS-1$
RepositoryNode repositoryNode = new RepositoryNode(repository);
HttpURLConnection connection = openConnection(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET);
@@ -239,21 +224,15 @@
return repositoryNode.getWorkspaces(JsonUtils.readInputStream(connection));
}
- // log
- Status status = new Status(Severity.ERROR, Utils.getMessage(ConnectionErrorMsg,
- connection.getResponseCode(),
- "getWorkspaces"), null); //$NON-NLS-1$
- Logger.log(JsonRestClient.class, status);
-
// not a good response code
- String msg = Utils.getMessage(GetWorkspacesFailedMsg,
- repository.getName(),
- repository.getServer().getName(),
- connection.getResponseCode());
+ this.logger.error(RestClientI18n.connectionErrorMsg, connection.getResponseCode(), "getWorkspaces"); //$NON-NLS-1$
+ String msg = RestClientI18n.getWorkspacesFailedMsg.text(repository.getName(),
+ repository.getServer().getName(),
+ connection.getResponseCode());
throw new RuntimeException(msg);
} finally {
if (connection != null) {
- Logger.trace(JsonRestClient.class, null, "getWorkspaces: leaving"); //$NON-NLS-1$
+ this.logger.trace("getWorkspaces: leaving"); //$NON-NLS-1$
connection.disconnect();
}
}
@@ -270,12 +249,14 @@
private HttpURLConnection openConnection( Server server,
URL url,
RequestMethod method ) throws Exception {
- Logger.trace(JsonRestClient.class, null, "openConnection: url=" + url + ", method=" + method); //$NON-NLS-1$ //$NON-NLS-2$
- setAuthentication(server.getUser(), server.getPassword());
+ this.logger.trace("openConnection: url={0}, method={1}", url, method); //$NON-NLS-1$
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(true);
+ String encoding = Base64.encodeBytes((server.getUser() + ':' + server.getPassword()).getBytes());
+ connection.setRequestProperty("Authorization", "Basic " + encoding); //$NON-NLS-1$ //$NON-NLS-2$
connection.setRequestMethod(method.toString());
connection.setRequestProperty("Content-Type", MediaType.APPLICATION_JSON); //$NON-NLS-1$
+ connection.setUseCaches(false);
return connection;
}
@@ -288,14 +269,14 @@
*/
protected boolean pathExists( Server server,
URL url ) throws Exception {
- Logger.trace(JsonRestClient.class, null, "pathExists: url=" + url); //$NON-NLS-1$
+ this.logger.trace("pathExists: url={0}", url); //$NON-NLS-1$
HttpURLConnection connection = openConnection(server, url, RequestMethod.GET);
try {
return (connection.getResponseCode() == HttpURLConnection.HTTP_OK);
} finally {
if (connection != null) {
- Logger.trace(JsonRestClient.class, null, "pathExists: leaving"); //$NON-NLS-1$
+ this.logger.trace("pathExists: leaving"); //$NON-NLS-1$
connection.disconnect();
}
}
@@ -309,10 +290,11 @@
* @throws Exception if there is a problem checking the existence of the file
* @since 0.6
*/
- protected boolean pathExists( Workspace workspace,
- String path,
- File file ) throws Exception {
+ public boolean pathExists( Workspace workspace,
+ String path,
+ File file ) throws Exception {
FileNode fileNode = new FileNode(workspace, path, file);
+ this.logger.trace("pathExists: url={0}", fileNode.getUrl()); //$NON-NLS-1$
return pathExists(workspace.getServer(), fileNode.getUrl());
}
@@ -326,12 +308,10 @@
public Status publish( Workspace workspace,
String path,
File file ) {
- Utils.nullArgumentCheck("workspace", workspace); //$NON-NLS-1$
- Utils.nullArgumentCheck("path", path); //$NON-NLS-1$
- Utils.nullArgumentCheck("file", file); //$NON-NLS-1$
- Logger.trace(JsonRestClient.class,
- null,
- "publish: workspace=" + workspace.getName() + ", path=" + path + ", file=" + file.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+ this.logger.trace("publish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
try {
// first delete if file exists at that path
@@ -345,28 +325,13 @@
// publish file
createFileNode(workspace, path, file);
} catch (Exception e) {
- return new Status(Severity.ERROR, Utils.getMessage(PublishFailedMsg,
- file.getAbsolutePath(),
- path,
- workspace.getName()), e);
+ String msg = RestClientI18n.publishFailedMsg.text(file.getAbsolutePath(), path, workspace.getName());
+ return new Status(Severity.ERROR, msg, e);
}
return Status.OK_STATUS;
}
- private void setAuthentication( final String user,
- final String password ) {
- final String pswd = ((password == null) ? "" : password); //$NON-NLS-1$
-
- // TODO setAuthentication() make authenticator work with multi-threads
- Authenticator.setDefault(new Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(user, pswd.toCharArray());
- }
- });
- }
-
/**
* {@inheritDoc}
*
@@ -377,12 +342,10 @@
public Status unpublish( Workspace workspace,
String path,
File file ) {
- Utils.nullArgumentCheck("workspace", workspace); //$NON-NLS-1$
- Utils.nullArgumentCheck("path", path); //$NON-NLS-1$
- Utils.nullArgumentCheck("file", file); //$NON-NLS-1$
- Logger.trace(JsonRestClient.class,
- null,
- "unpublish: workspace=" + workspace.getName() + ", path=" + path + ", file=" + file.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
+ CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
+ this.logger.trace("unpublish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); //$NON-NLS-1$
HttpURLConnection connection = null;
@@ -394,30 +357,23 @@
if (responseCode != HttpURLConnection.HTTP_NO_CONTENT) {
// check to see if the file was never published
if (!pathExists(workspace.getServer(), fileNode.getUrl())) {
- return new Status(Severity.INFO, Utils.getMessage(UnpublishNeverPublishedMsg,
- file.getAbsolutePath(),
- workspace.getName(),
- path), null);
+ String msg = RestClientI18n.unpublishNeverPublishedMsg.text(file.getAbsolutePath(), workspace.getName(), path);
+ return new Status(Severity.INFO, msg, null);
}
// unexpected result
- Status status = new Status(Severity.ERROR, Utils.getMessage(ConnectionErrorMsg, responseCode, "unpublish"), null); //$NON-NLS-1$
- Logger.log(JsonRestClient.class, status);
-
- // throw exception
- String msg = Utils.getMessage(UnpublishFailedMsg, file.getName(), workspace.getName(), path, responseCode);
+ this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "unpublish"); //$NON-NLS-1$
+ String msg = RestClientI18n.unpublishFailedMsg.text(file.getName(), workspace.getName(), path, responseCode);
throw new RuntimeException(msg);
}
return Status.OK_STATUS;
} catch (Exception e) {
- return new Status(Severity.ERROR, Utils.getMessage(PublishFailedMsg,
- workspace.getName(),
- path,
- file.getAbsolutePath()), e);
+ String msg = RestClientI18n.publishFailedMsg.text(workspace.getName(), path, file.getAbsolutePath());
+ return new Status(Severity.ERROR, msg, e);
} finally {
if (connection != null) {
- Logger.trace(JsonRestClient.class, null, "unpublish: leaving"); //$NON-NLS-1$
+ this.logger.trace("unpublish: leaving"); //$NON-NLS-1$
connection.disconnect();
}
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/JsonUtils.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -29,7 +29,7 @@
import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;
-import org.jboss.dna.web.jcr.rest.client.Utils;
+import org.jboss.dna.common.util.CheckArg;
/**
* The <code>JsonUtils</code> class provides utilities needed to work with the DNA REST server JSON API.
@@ -54,25 +54,35 @@
// ===========================================================================================================================
/**
- * @param text the text whose escape sequences will be replaced with the actual characters (never <code>null</code>)
+ * @param text the text being URL decoded (never <code>null</code>)
* @return the decoded text
- * @throws UnsupportedEncodingException
+ * @throws UnsupportedEncodingException if the charset is not supported
* @since 0.6
*/
- public static String decodeEscaping( String text ) throws UnsupportedEncodingException {
- Utils.nullArgumentCheck("text", text); //$NON-NLS-1$
+ public static String decode( String text ) throws UnsupportedEncodingException {
+ CheckArg.isNotNull(text, "text"); //$NON-NLS-1$
return URLDecoder.decode(text, DEFAULT_CHARSET);
}
/**
- * @param text the text whose escape sequences will be replaced with the actual characters (never <code>null</code>)
+ * Forward slashes ('/') are not encoded.
+ *
+ * @param text the text being URL encoded (never <code>null</code>)
* @return the decoded text
- * @throws UnsupportedEncodingException
+ * @throws UnsupportedEncodingException if the charset is not supported
* @since 0.6
*/
- public static String encodeEscaping( String text ) throws UnsupportedEncodingException {
- Utils.nullArgumentCheck("text", text); //$NON-NLS-1$
- return URLEncoder.encode(text, DEFAULT_CHARSET);
+ public static String encode( String text ) throws UnsupportedEncodingException {
+ CheckArg.isNotNull(text, "text"); //$NON-NLS-1$
+
+ // don't encode '/' as it needs to stay that way in the URL
+ StringBuilder encoded = new StringBuilder();
+
+ for (char c : text.toCharArray()) {
+ encoded.append((c == '/') ? c : URLEncoder.encode(Character.toString(c), DEFAULT_CHARSET));
+ }
+
+ return encoded.toString();
}
/**
@@ -84,7 +94,7 @@
* @since 0.6
*/
public static String readInputStream( HttpURLConnection connection ) throws IOException {
- Utils.nullArgumentCheck("connection", connection); //$NON-NLS-1$
+ CheckArg.isNotNull(connection, "connection"); //$NON-NLS-1$
InputStream stream = connection.getInputStream();
int bytesRead;
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/RepositoryNode.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -28,7 +28,7 @@
import java.util.Collection;
import java.util.Iterator;
import org.codehaus.jettison.json.JSONObject;
-import org.jboss.dna.web.jcr.rest.client.Utils;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
@@ -82,7 +82,7 @@
StringBuilder url = new StringBuilder(serverNode.getUrl().toString());
// add repository path
- url.append('/').append(JsonUtils.encodeEscaping(repository.getName()));
+ url.append('/').append(JsonUtils.encode(repository.getName()));
return new URL(url.toString());
}
@@ -94,13 +94,13 @@
*/
@SuppressWarnings( "unchecked" )
public Collection<Workspace> getWorkspaces( String jsonResponse ) throws Exception {
- Utils.nullArgumentCheck("jsonResponse", jsonResponse); //$NON-NLS-1$
+ CheckArg.isNotNull(jsonResponse, "jsonResponse"); //$NON-NLS-1$
Collection<Workspace> workspaces = new ArrayList<Workspace>();
JSONObject jsonObj = new JSONObject(jsonResponse);
// keys are the repository names
for (Iterator<String> itr = jsonObj.keys(); itr.hasNext();) {
- String name = JsonUtils.decodeEscaping(itr.next());
+ String name = JsonUtils.decode(itr.next());
Workspace workspace = new Workspace(name, this.repository);
workspaces.add(workspace);
}
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/ServerNode.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -28,8 +28,8 @@
import java.util.Collection;
import java.util.Iterator;
import org.codehaus.jettison.json.JSONObject;
-import org.jboss.dna.web.jcr.rest.client.Logger;
-import org.jboss.dna.web.jcr.rest.client.Utils;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
@@ -46,6 +46,13 @@
// ===========================================================================================================================
/**
+ * The logger.
+ *
+ * @since 0.6
+ */
+ private final Logger logger = Logger.getLogger(ServerNode.class);
+
+ /**
* The server containing DNA repositories.
*
* @since 0.6
@@ -110,17 +117,17 @@
*/
@SuppressWarnings( "unchecked" )
public Collection<Repository> getRepositories( String jsonResponse ) throws Exception {
- Utils.nullArgumentCheck("jsonResponse", jsonResponse); //$NON-NLS-1$
+ CheckArg.isNotNull(jsonResponse, "jsonResponse"); //$NON-NLS-1$
Collection<Repository> repositories = new ArrayList<Repository>();
- Logger.trace(ServerNode.class, null, "getRepositories:jsonResponse=" + jsonResponse); //$NON-NLS-1$
+ this.logger.trace("getRepositories:jsonResponse={0}", jsonResponse); //$NON-NLS-1$
JSONObject jsonObj = new JSONObject(jsonResponse);
// keys are the repository names
for (Iterator<String> itr = jsonObj.keys(); itr.hasNext();) {
- String name = JsonUtils.decodeEscaping(itr.next());
+ String name = JsonUtils.decode(itr.next());
Repository repository = new Repository(name, this.server);
repositories.add(repository);
- Logger.trace(ServerNode.class, null, "getRepositories: adding repository=" + repository); //$NON-NLS-1$
+ this.logger.trace("getRepositories: adding repository={0}", repository); //$NON-NLS-1$
}
return repositories;
Modified: branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/json/WorkspaceNode.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -69,7 +69,7 @@
StringBuilder url = new StringBuilder(repositoryNode.getUrl().toString());
// add workspace path
- url.append('/').append(JsonUtils.encodeEscaping(workspace.getName())).append(IJsonConstants.WORKSPACE_CONTEXT);
+ url.append('/').append(JsonUtils.encode(workspace.getName())).append(IJsonConstants.WORKSPACE_CONTEXT);
return new URL(url.toString());
}
Deleted: branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/Messages.properties
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/Messages.properties 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/Messages.properties 2009-08-14 16:29:03 UTC (rev 1161)
@@ -1,61 +0,0 @@
-#
-# JBoss DNA (http://www.jboss.org/dna)
-# See the COPYRIGHT.txt file distributed with this work for information
-# regarding copyright ownership. Some portions may be licensed
-# to Red Hat, Inc. under one or more contributor license agreements.
-# See the AUTHORS.txt file in the distribution for a full listing of
-# individual contributors.
-#
-# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
-# is licensed to you under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# JBoss DNA is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this software; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-#
-ErrorDeletingServerRegistryFile = There was a problem deleting server registry file "{0}"
-ErrorRestoringServerRegistry = Error trying to restore the server registry from file "{0}"
-ErrorSavingServerRegistry = Error trying to save the server registry to "{0}"
-
-NullArgumentMsg = The argument "{0}" may not be null.
-
-RepositoryEmptyNameMsg = A repository name cannot be empty
-RepositoryNullServerMsg = A repository server cannot be null
-RepositoryShortDescription = DNA Repository - Name: {0}, Server: {1}
-
-ServerEmptyUserMsg = The user cannot be empty
-ServerEmptyUrlMsg = A server URL cannot be empty
-ServerExistsMsg = {0} already exists so it cannot be added
-ServerInvalidUrlMsg = The value "{0}" is not a valid server URL
-ServerShortDescription = DNA Server - URL: {0} User: {1}
-
-ServerManagerRegistryAddUnexpectedError = Unexpected error adding server to registry
-ServerManagerRegistryListenerError = This error was reported by an IServerRegistryListener
-ServerManagerRegistryListenerErrorsOccurred = Errors occurred processing a server registry event. Check error log for more details.
-ServerManagerRegistryRemoveUnexpectedError = {0} cannot be removed as it has not been registered
-ServerManagerRegistryUpdateAddError = There was an unexpected error updating the server in the registry. The old version of the server was successfully removed. However, the new version was not updated. Detail: {0}
-ServerManagerRegistryUpdateRemoveError = There was an unexpected error updating the server in the registry. The server has not been updated in the server registry. Detail: {0}
-ServerManagerUnregisteredServer = Server "{0}" is not registered so it's repositories and workspaces cannot be obtained.
-
-WorkspaceEmptyNameMsg = A workspace name cannot be empty
-WorkspaceNullRepositoryMsg = A workspace repository cannot be null
-WorkspaceShortDescription = DNA Workspace - Name: {0}, Repository: {1}
-
-# JsonRestClient messages
-
-ConnectionErrorMsg = response code={0}: {1}
-CreateFileFailedMsg = Creating the "{0}" file node in folder "{1}" in workspace "{2}" failed with HTTP response code of "{3}"
-CreateFolderFailedMsg = Creating the "{0}" folder node in workspace "{1}" failed with HTTP response code of "{2}"
-GetRepositoriesFailedMsg = Obtaining the repositories from server "{0}" failed with HTTP response code of "{1}"
-GetWorkspacesFailedMsg = Obtaining the workspaces from repository "{0}" at server "{1}" failed with HTTP response code of "{2}"
-PublishFailedMsg = Publishing file "{0}" to path "{1}" in workspace "{2}" failed.
-UnpublishFailedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}". The HTTP response code was "{3}".
-UnpublishNeverPublishedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}" because it could not be found.
Copied: branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties (from rev 1148, branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/Messages.properties)
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties (rev 0)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties 2009-08-14 16:29:03 UTC (rev 1161)
@@ -0,0 +1,63 @@
+#
+# JBoss DNA (http://www.jboss.org/dna)
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+# See the AUTHORS.txt file in the distribution for a full listing of
+# individual contributors.
+#
+# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+# is licensed to you under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# JBoss DNA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+errorDeletingServerRegistryFile = There was a problem deleting server registry file "{0}"
+errorRestoringServerRegistry = Error trying to restore the server registry from file "{0}"
+errorSavingServerRegistry = Error trying to save the server registry to "{0}"
+
+nullArgumentMsg = The argument "{0}" may not be null.
+
+repositoryEmptyNameMsg = A repository name cannot be empty
+repositoryNullServerMsg = A repository server cannot be null
+repositoryShortDescription = DNA Repository - Name: {0}, Server: {1}
+
+serverEmptyUserMsg = The user cannot be empty
+serverEmptyUrlMsg = A server URL cannot be empty
+serverExistsMsg = {0} already exists so it cannot be added
+serverInvalidUrlMsg = The value "{0}" is not a valid server URL
+serverShortDescription = DNA Server - URL: {0} User: {1}
+
+serverManagerConnectionEstablishedMsg = Connection established.
+serverManagerConnectionFailedMsg = Connection failed.
+serverManagerRegistryAddUnexpectedError = Unexpected error adding server to registry
+serverManagerRegistryListenerError = This error was reported by an IServerRegistryListener
+serverManagerRegistryListenerErrorsOccurred = Errors occurred processing a server registry event. Check error log for more details.
+serverManagerRegistryRemoveUnexpectedError = {0} cannot be removed as it has not been registered
+serverManagerRegistryUpdateAddError = There was an unexpected error updating the server in the registry. The old version of the server was successfully removed. However, the new version was not updated. Detail: {0}
+serverManagerRegistryUpdateRemoveError = There was an unexpected error updating the server in the registry. The server has not been updated in the server registry. Detail: {0}
+serverManagerUnregisteredServer = Server "{0}" is not registered so it's repositories and workspaces cannot be obtained and it cannot be involved in a publishing operation.
+
+workspaceEmptyNameMsg = A workspace name cannot be empty
+workspaceNullRepositoryMsg = A workspace repository cannot be null
+workspaceShortDescription = DNA Workspace - Name: {0}, Repository: {1}
+
+# JsonRestClient messages
+
+connectionErrorMsg = response code={0}: {1}
+createFileFailedMsg = Creating the "{0}" file node in folder "{1}" in workspace "{2}" failed with HTTP response code of "{3}"
+createFolderFailedMsg = Creating the "{0}" folder node in workspace "{1}" failed with HTTP response code of "{2}"
+getRepositoriesFailedMsg = Obtaining the repositories from server "{0}" failed with HTTP response code of "{1}"
+getWorkspacesFailedMsg = Obtaining the workspaces from repository "{0}" at server "{1}" failed with HTTP response code of "{2}"
+publishFailedMsg = Publishing file "{0}" to path "{1}" in workspace "{2}" failed.
+unpublishFailedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}". The HTTP response code was "{3}".
+unpublishNeverPublishedMsg = The file "{0}" could not be unpublished in workspace "{1}" at path "{2}" because it could not be found.
Property changes on: branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types (rev 0)
+++ branches/eclipse/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/mime.types 2009-08-14 16:29:03 UTC (rev 1161)
@@ -0,0 +1,9 @@
+# This file defines the Internet media types and extensions.
+# For more information about Internet media types,
+# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
+# registry is at <http://www.iana.org/assignments/media-types/>.
+
+# MIME type Extensions
+
+text/plain classpath debug epf ini lock mappings mf prefs properties readme svn-base
+application/xml launch project template xsd
Copied: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java (from rev 1159, branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestExecutor.java)
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java (rev 0)
+++ branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -0,0 +1,89 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client;
+
+import java.io.File;
+import java.util.Collection;
+import org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+
+/**
+ * The <code>MockRestExecutor</code> class is a test <code>IRestClient</code> implementation that does nothing.
+ *
+ * @since 0.6
+ */
+public final class MockRestClient implements IRestClient {
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
+ * @since 0.6
+ */
+ public Collection<Repository> getRepositories( Server server ) throws Exception {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
+ * @since 0.6
+ */
+ public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ * @since 0.6
+ */
+ public Status publish( Workspace workspace,
+ String path,
+ File file ) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ * @since 0.6
+ */
+ public Status unpublish( Workspace workspace,
+ String path,
+ File file ) {
+ return null;
+ }
+
+}
Property changes on: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestClient.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestExecutor.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestExecutor.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/MockRestExecutor.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -1,89 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import java.io.File;
-import java.util.Collection;
-import org.jboss.dna.web.jcr.rest.client.domain.Repository;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
-
-/**
- * The <code>MockRestExecutor</code> class is a test <code>IRestClient</code> implementation that does nothing.
- *
- * @since 0.6
- */
-public final class MockRestExecutor implements IRestClient {
-
- // ===========================================================================================================================
- // Methods
- // ===========================================================================================================================
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
- * @since 0.6
- */
- public Collection<Repository> getRepositories( Server server ) throws Exception {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
- * @since 0.6
- */
- public Collection<Workspace> getWorkspaces( Repository repository ) throws Exception {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
- * java.lang.String, java.io.File)
- * @since 0.6
- */
- public Status publish( Workspace workspace,
- String path,
- File file ) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
- * java.lang.String, java.io.File)
- * @since 0.6
- */
- public Status unpublish( Workspace workspace,
- String path,
- File file ) {
- return null;
- }
-
-}
Added: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java (rev 0)
+++ branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -0,0 +1,37 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client;
+
+import org.jboss.dna.common.AbstractI18nTest;
+
+/**
+ * @since 0.6
+ */
+public final class RestClientI18nTest extends AbstractI18nTest {
+
+ public RestClientI18nTest() {
+ super(RestClientI18n.class);
+ }
+
+}
Property changes on: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestClientI18nTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java (rev 0)
+++ branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -0,0 +1,114 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import org.jboss.dna.web.jcr.rest.client.domain.Repository;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
+import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
+import org.jboss.dna.web.jcr.rest.client.json.JsonRestClient;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public final class RestIntegrationTest {
+
+ // ===========================================================================================================================
+ // Constants
+ // ===========================================================================================================================
+
+ // user and password configured in pom
+ private static final String PSWD = "password"; //$NON-NLS-1$
+ private static final String USER = "dnauser"; //$NON-NLS-1$
+
+ private static final Server SERVER = new Server("http://localhost:8080", USER, PSWD, false); //$NON-NLS-1$
+ private static final String REPOSITORY_NAME = "dna:repository"; //$NON-NLS-1$
+ private static final Repository REPOSITORY = new Repository(REPOSITORY_NAME, SERVER);
+ private static final String WORKSPACE_NAME = "default"; //$NON-NLS-1$
+ private static final Workspace WORKSPACE = new Workspace(WORKSPACE_NAME, REPOSITORY);
+
+ private static final String WORKSPACE_PATH = "/myproject/myfolder/"; //$NON-NLS-1$
+ private static final String FILE_PATH = WORKSPACE_PATH + "document.txt"; //$NON-NLS-1$
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private JsonRestClient restClient;
+
+ private ServerManager serverManager;
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @Before
+ public void beforeEach() {
+ this.restClient = new JsonRestClient();
+ this.serverManager = new ServerManager(null, this.restClient);
+ this.serverManager.addServer(SERVER);
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ @Test
+ public void shouldGetRepositories() throws Exception {
+ Collection<Repository> repositories = this.serverManager.getRepositories(SERVER);
+ assertThat(repositories.size(), is(1));
+ }
+
+ @Test
+ public void shouldGetWorkspaces() throws Exception {
+ Collection<Workspace> workspaces = this.serverManager.getWorkspaces(REPOSITORY);
+ assertThat(workspaces.size(), is(1));
+ }
+
+ @Test
+ public void shouldPublish() throws Exception {
+ URL textFile = getClass().getResource(FILE_PATH);
+ assertThat(textFile, is(notNullValue()));
+
+ // publish
+ File file = new File(textFile.toURI());
+ assertThat(this.serverManager.publish(WORKSPACE, WORKSPACE_PATH, file).isOk(), is(true));
+
+ // confirm it exists in repository
+ assertThat((this.restClient).pathExists(WORKSPACE, WORKSPACE_PATH, file), is(true));
+ }
+
+ @Test
+ public void shouldUnpublish() {
+ // TODO implement shouldUnpublish()
+ }
+
+}
Property changes on: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -67,7 +67,7 @@
@Before
public void beforeEach() {
- this.serverManager = new ServerManager(null, new MockRestExecutor());
+ this.serverManager = new ServerManager(null, new MockRestClient());
}
// ===========================================================================================================================
Modified: branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
===================================================================
--- branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-08-10 21:31:32 UTC (rev 1160)
+++ branches/eclipse/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-08-14 16:29:03 UTC (rev 1161)
@@ -33,6 +33,7 @@
import java.net.URL;
import java.util.Collection;
import org.jboss.dna.web.jcr.rest.client.IRestClient;
+import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.domain.Repository;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
@@ -124,6 +125,11 @@
// TODO: get jcr:data and compare
}
+
+ @Test
+ public void shouldPublishFilesHavingNonLettersNonNumbersInName() {
+ // TODO implement shouldPublishFilesHavingNonLettersNonNumbersInName test
+ }
@Test
public void shouldPublishTextResource() throws Exception {
@@ -132,11 +138,17 @@
// publish
File file = new File(textFile.toURI());
- assertThat(this.restClient.publish(WORKSPACE1, WORKSPACE_PATH, file).isOk(), is(true));
+ Status status = this.restClient.publish(WORKSPACE1, WORKSPACE_PATH, file);
+ assertThat(status.getMessage(), status.isOk(), is(true));
// confirm it exists in repository
assertThat(((JsonRestClient)this.restClient).pathExists(WORKSPACE1, WORKSPACE_PATH, file), is(true));
}
+
+ @Test
+ public void shouldPublishToDirectoriesHavingNonLettersNonNumbersInName() {
+ // TODO implement shouldPublishToDirectoriesHavingNonLettersNonNumbersInName test
+ }
@Test
public void shouldUnpublish() throws Exception {
14 years, 8 months
DNA SVN: r1160 - in branches/eclipse/org.jboss.dna.publish.ui.swt: META-INF and 10 other directories.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-08-10 17:31:32 -0400 (Mon, 10 Aug 2009)
New Revision: 1160
Added:
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-common-0.6-SNAPSHOT-sources.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/dna_icon_16x.png
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/publish.png
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/unpublish.png
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/wizards/dna_wizard_banner.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/src/log4j.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/package-info.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/package-info.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLogger.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLoggerFactory.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/StaticLoggerBinder.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/package-info.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/package-info.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/package-info.java
Removed:
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/dna_window.png
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/wizards/dna_wizard_banner.png
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties
Modified:
branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/objects/server.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/icons/objects/workspace.gif
branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Activator.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/DeleteServerAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java
branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerWizard.java
Log:
Added dna-common as a dependency so I could start using it's I18n, logging, CheckArg, and file extension mime type detector frameworks. Added or modified some images. Many javadoc changes and removed all @author tags. Added logging to the Eclipse Console view. However, the slf4j logging is not working.
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/META-INF/MANIFEST.MF 2009-08-10 21:31:32 UTC (rev 1160)
@@ -8,7 +8,9 @@
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.core.resources
+ org.eclipse.core.resources,
+ org.eclipse.ui.console,
+ org.eclipse.jface.text
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar,
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/build.properties 2009-08-10 21:31:32 UTC (rev 1160)
@@ -12,7 +12,8 @@
plugin.xml,\
LEGAL.txt,\
AUTHORS.txt,\
- dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
+ dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar,\
+ src/log4j.properties
src.includes = src/,\
LEGAL.txt
source.dnaPublishUi.jar = src/
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/dna-common-0.6-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/dna-common-0.6-SNAPSHOT-sources.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-jar-with-dependencies.jar
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/dna-web-jcr-rest-client-0.6-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/objects/server.gif
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/objects/workspace.gif
===================================================================
(Binary files differ)
Copied: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/dna_icon_16x.png (from rev 1076, branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/dna_window.png)
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/dna_icon_16x.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/dna_window.png
===================================================================
(Binary files differ)
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/publish.png
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/publish.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/unpublish.png
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/views/unpublish.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/wizards/dna_wizard_banner.gif
===================================================================
(Binary files differ)
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/wizards/dna_wizard_banner.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/icons/wizards/dna_wizard_banner.png
===================================================================
(Binary files differ)
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/plugin.xml 2009-08-10 21:31:32 UTC (rev 1160)
@@ -13,7 +13,7 @@
label="%contextMenu.label"
path="additions">
<separator
- name="group1">
+ name="dna">
</separator>
</menu>
@@ -22,6 +22,7 @@
id="org.jboss.dna.web.jcr.rest.client.swt.unpublishAction"
label="%unpublishAction.label"
class="org.jboss.dna.web.jcr.rest.client.swt.actions.UnpublishAction"
+ icon="icons/views/unpublish.png"
menubarPath="org.jboss.dna.web.jcr.rest.client.swt.contextMenu/group1"
enablesFor="*">
<enablement>
@@ -41,6 +42,7 @@
id="org.jboss.dna.web.jcr.rest.client.swt.publishAction"
label="%publishAction.label"
class="org.jboss.dna.web.jcr.rest.client.swt.actions.PublishAction"
+ icon="icons/views/publish.png"
menubarPath="org.jboss.dna.web.jcr.rest.client.swt.contextMenu/group1"
enablesFor="*">
<enablement>
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/log4j.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/log4j.properties (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/log4j.properties 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,40 @@
+#
+# JBoss DNA (http://www.jboss.org/dna)
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+# See the AUTHORS.txt file in the distribution for a full listing of
+# individual contributors.
+#
+# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+# is licensed to you under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# JBoss DNA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# Root logger option
+log4j.rootLogger=TRACE, LOGFILE, CONSOLE
+
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=eclipse.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.Threshold=TRACE
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+# CONSOLE
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.Threshold=TRACE
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/log4j.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Activator.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Activator.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Activator.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -25,6 +25,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.log4j.BasicConfigurator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
@@ -32,7 +33,7 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.jboss.dna.web.jcr.rest.client.Logger;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.web.jcr.rest.client.ServerManager;
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
@@ -43,12 +44,12 @@
import org.osgi.framework.BundleContext;
/**
- * The activator class controls the plug-in life cycle.
+ * The <code>Activator</code> controls the plug-in life cycle, provides utility functions, and keeps track of the
+ * {@link ServerManager}.
*
- * @author Dan Florian
* @since 0.6
*/
-public class Activator extends AbstractUIPlugin implements IUiConstants {
+public final class Activator extends AbstractUIPlugin implements IUiConstants {
// ===========================================================================================================================
// Class Fields
@@ -95,12 +96,19 @@
// Methods
// ===========================================================================================================================
+ /**
+ * @param key the plugin relative path to the image (never <code>null</code>)
+ * @return the image or an image indicating the requested image could not be found
+ * @since 0.6
+ */
private ImageDescriptor createImageDescriptor( String key ) {
+ CheckArg.isNotNull(key, "key"); //$NON-NLS-1$
+
try {
URL url = new URL(getBundle().getEntry("/").toString() + key); //$NON-NLS-1$
return ImageDescriptor.createFromURL(url);
} catch (final MalformedURLException e) {
- log(new Status(Severity.ERROR, I18n.bind(I18n.MissingImage, key), e));
+ log(new Status(Severity.ERROR, RestClientI18n.missingImage.text(key), e));
return null;
}
}
@@ -118,23 +126,25 @@
}
/**
- * @param imageId the shared image identifier
- * @return the image or <code>null</code>
+ * @param imageId the shared image identifier (never <code>null</code>)
+ * @return the image or an image indicating the requested image could not be found
* @see ISharedImages
* @since 0.6
*/
public Image getSharedImage( String imageId ) {
+ CheckArg.isNotNull(imageId, "imageId"); //$NON-NLS-1$
Image result = PlatformUI.getWorkbench().getSharedImages().getImage(imageId);
return ((result == null) ? getMissingImage() : result);
}
/**
- * @param imageId the shared image identifier
- * @return the image descriptor or <code>null</code>
+ * @param imageId the shared image identifier (never <code>null</code>)
+ * @return the image descriptor or a descriptor indicating the requested descriptor could not be found
* @see ISharedImages
* @since 0.6
*/
public ImageDescriptor getSharedImageDescriptor( String imageId ) {
+ CheckArg.isNotNull(imageId, "imageId"); //$NON-NLS-1$
ImageDescriptor result = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imageId);
if (result != null) {
@@ -225,10 +235,11 @@
}
/**
- * @param status the status being logged
+ * @param status the status being logged (never <code>null</code>)
* @since 0.6
*/
public void log( Status status ) {
+ CheckArg.isNotNull(status, "status"); //$NON-NLS-1$
IStatus eclipseStatus = new org.eclipse.core.runtime.Status(Utils.convertSeverity(status.getSeverity()),
IUiConstants.PLUGIN_ID, status.getMessage(),
status.getException());
@@ -243,6 +254,8 @@
*/
@Override
public void start( BundleContext context ) throws Exception {
+ BasicConfigurator.configure();
+
super.start(context);
plugin = this;
@@ -251,7 +264,7 @@
// problem restoring server registry
if (!status.isOk()) {
- Logger.log(getClass(), status);
+ log(status);
}
}
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -1,138 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client.swt;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * The I18n class handles localization messages.
- *
- * @author Dan Florian
- * @since 0.6
- */
-public final class I18n extends NLS {
-
- public static String BasePublishingActionPublishingWizardErrorMsg;
- public static String BasePublishingActionUnpublishingWizardErrorMsg;
-
- public static String CollapseActionToolTip;
-
- public static String DeleteServerActionText;
- public static String DeleteServerActionToolTip;
-
- public static String DeleteServerDialogErrorsOccurredMsg;
- public static String DeleteServerDialogMultipleServersMsg;
- public static String DeleteServerDialogOneServerMsg;
- public static String DeleteServerDialogTitle;
-
- public static String EditServerActionText;
- public static String EditServerActionToolTip;
-
- public static String ErrorDialogTitle;
-
- public static String MissingImage;
-
- public static String NewServerActionText;
- public static String NewServerActionToolTip;
-
- public static String PublishingResultsPublishNotAttemptedMsg;
- public static String PublishingResultsTooManyResultsMsg;
- public static String PublishingResultsUnknownSeverityMsg;
- public static String PublishingResultsUnpublishNotAttemptedMsg;
-
- public static String PublishOperationPublishTaskName;
- public static String PublishOperationUnpublishTaskName;
-
- public static String PublishPagePublishTitle;
- public static String PublishPageLocationGroupTitle;
- public static String PublishPageMissingRepositoryStatusMsg;
- public static String PublishPageMissingServerStatusMsg;
- public static String PublishPageMissingWorkspaceStatusMsg;
- public static String PublishPageNewServerButton;
- public static String PublishPageNoAvailableRepositoriesStatusMsg;
- public static String PublishPageNoAvailableServersStatusMsg;
- public static String PublishPageNoAvailableWorkspacesStatusMsg;
- public static String PublishPageNoResourcesToPublishStatusMsg;
- public static String PublishPageNoResourcesToUnpublishStatusMsg;
- public static String PublishPagePublishOkStatusMsg;
- public static String PublishPagePublishResourcesLabel;
- public static String PublishPageRecurseCheckBox;
- public static String PublishPageRecurseCheckBoxToolTip;
- public static String PublishPageRecurseProcessingErrorMsg;
- public static String PublishPageRepositoryLabel;
- public static String PublishPageRepositoryToolTip;
- public static String PublishPageServerLabel;
- public static String PublishPageServerToolTip;
- public static String PublishPageUnpublishOkStatusMsg;
- public static String PublishPageUnpublishResourcesLabel;
- public static String PublishPageUnpublishTitle;
- public static String PublishPageWorkspaceLabel;
- public static String PublishPageWorkspacePublishToolTip;
- public static String PublishPageWorkspaceUnpublishToolTip;
-
- public static String PublishResultsDialogErrorPublishingMsg;
- public static String PublishResultsDialogErrorUnpublishingMsg;
- public static String PublishResultsDialogFileHeader;
- public static String PublishResultsDialogMessageHeader;
- public static String PublishResultsDialogPublishMsg;
- public static String PublishResultsDialogTitle;
- public static String PublishResultsDialogUnpublishMsg;
-
- public static String PublishWizardPublishErrorMsg;
- public static String PublishWizardPublishTitle;
- public static String PublishWizardUnpublishTitle;
- public static String PublishWizardUnpublishErrorMsg;
-
- public static String RefreshActionToolTip;
-
- public static String ServerManagerGetRepositoriesExceptionMsg;
- public static String ServerManagerGetWorkspacesExceptionMsg;
-
- public static String ServerPageAuthenticationGroupTitle;
- public static String ServerPageInvalidServerProperties;
- public static String ServerPageOkStatusMsg;
- public static String ServerPagePasswordLabel;
- public static String ServerPagePasswordToolTip;
- public static String ServerPageSavePasswordButton;
- public static String ServerPageSavePasswordLabel;
- public static String ServerPageSavePasswordToolTip;
- public static String ServerPageTitle;
- public static String ServerPageUrlLabel;
- public static String ServerPageUrlToolTip;
- public static String ServerPageUserLabel;
- public static String ServerPageUserToolTip;
-
- public static String ServerViewToolTip;
-
- public static String ServerWizardEditServerErrorMsg;
- public static String ServerWizardEditServerTitle;
- public static String ServerWizardNewServerErrorMsg;
- public static String ServerWizardNewServerTitle;
-
- static {
- // load message bundle
- NLS.initializeMessages(I18n.class.getPackage().getName() + ".i18n", I18n.class); //$NON-NLS-1$
- }
-
-}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/IUiConstants.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -24,7 +24,6 @@
package org.jboss.dna.web.jcr.rest.client.swt;
/**
- * @author Dan Florian
* @since 0.6
*/
public interface IUiConstants {
@@ -62,20 +61,24 @@
String DELETE_SERVER_IMAGE_PATH = VIEWS_ICON_FOLDER + "delete_server.gif"; //$NON-NLS-1$
- String DNA_WINDOW_IMAGE_PATH = VIEWS_ICON_FOLDER + "dna_window.png"; //$NON-NLS-1$
+ String DNA_IMAGE_16x = VIEWS_ICON_FOLDER + "dna_icon_16x.png"; //$NON-NLS-1$
String EDIT_SERVER_IMAGE_PATH = VIEWS_ICON_FOLDER + "edit_server.gif"; //$NON-NLS-1$
String NEW_SERVER_IMAGE_PATH = VIEWS_ICON_FOLDER + "new_server.gif"; //$NON-NLS-1$
+ String PUBLISH_IMAGE_PATH = VIEWS_ICON_FOLDER + "publish.png"; //$NON-NLS-1$
+
String REFRESH_IMAGE_PATH = VIEWS_ICON_FOLDER + "refresh.gif"; //$NON-NLS-1$
+ String UNPUBLISH_IMAGE_PATH = VIEWS_ICON_FOLDER + "unpublish.png"; //$NON-NLS-1$
+
//
// /icons/wizards/
//
String WIZARD_ICONS_FOLDER = ICON_PATH + "wizards/"; //$NON-NLS-1$
- String DNA_WIZARD_BANNER_IMAGE_PATH = WIZARD_ICONS_FOLDER + "dna_wizard_banner.png"; //$NON-NLS-1$
+ String DNA_WIZARD_BANNER_IMAGE_PATH = WIZARD_ICONS_FOLDER + "dna_wizard_banner.gif"; //$NON-NLS-1$
}
Copied: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java (from rev 1141, branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/I18n.java)
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,152 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt;
+
+import org.jboss.dna.common.i18n.I18n;
+
+/**
+ * The <code>RestClientI18n</code> class provides localized messages.
+ *
+ * @since 0.6
+ */
+public final class RestClientI18n {
+
+ public static I18n basePublishingActionPublishingWizardErrorMsg;
+ public static I18n basePublishingActionUnpublishingWizardErrorMsg;
+
+ public static I18n collapseActionToolTip;
+
+ public static I18n deleteServerActionText;
+ public static I18n deleteServerActionToolTip;
+
+ public static I18n deleteServerDialogErrorsOccurredMsg;
+ public static I18n deleteServerDialogMultipleServersMsg;
+ public static I18n deleteServerDialogOneServerMsg;
+ public static I18n deleteServerDialogTitle;
+
+ public static I18n editServerActionText;
+ public static I18n editServerActionToolTip;
+
+ public static I18n errorDialogTitle;
+
+ public static I18n missingImage;
+
+ public static I18n newServerActionText;
+ public static I18n newServerActionToolTip;
+
+ public static I18n publishingResultsPublishNotAttemptedMsg;
+ public static I18n publishingResultsTooManyResultsMsg;
+ public static I18n publishingResultsUnknownSeverityMsg;
+ public static I18n publishingResultsUnpublishNotAttemptedMsg;
+
+ public static I18n publishOperationConsoleName;
+ public static I18n publishOperationPublish;
+ public static I18n publishOperationPublishFile;
+ public static I18n publishOperationPublishFileFailed;
+ public static I18n publishOperationPublishTaskName;
+ public static I18n publishOperationUnpublish;
+ public static I18n publishOperationUnpublishFile;
+ public static I18n publishOperationUnpublishFileFailed;
+ public static I18n publishOperationUnpublishTaskName;
+
+ public static I18n publishPagePublishTitle;
+ public static I18n publishPageLocationGroupTitle;
+ public static I18n publishPageMissingRepositoryStatusMsg;
+ public static I18n publishPageMissingServerStatusMsg;
+ public static I18n publishPageMissingWorkspaceStatusMsg;
+ public static I18n publishPageNewServerButton;
+ public static I18n publishPageNoAvailableRepositoriesStatusMsg;
+ public static I18n publishPageNoAvailableServersStatusMsg;
+ public static I18n publishPageNoAvailableWorkspacesStatusMsg;
+ public static I18n publishPageNoResourcesToPublishStatusMsg;
+ public static I18n publishPageNoResourcesToUnpublishStatusMsg;
+ public static I18n publishPagePublishOkStatusMsg;
+ public static I18n publishPagePublishResourcesLabel;
+ public static I18n publishPageRecurseCheckBox;
+ public static I18n publishPageRecurseCheckBoxToolTip;
+ public static I18n publishPageRecurseProcessingErrorMsg;
+ public static I18n publishPageRepositoryLabel;
+ public static I18n publishPageRepositoryToolTip;
+ public static I18n publishPageServerLabel;
+ public static I18n publishPageServerToolTip;
+ public static I18n publishPageUnpublishOkStatusMsg;
+ public static I18n publishPageUnpublishResourcesLabel;
+ public static I18n publishPageUnpublishTitle;
+ public static I18n publishPageWorkspaceLabel;
+ public static I18n publishPageWorkspacePublishToolTip;
+ public static I18n publishPageWorkspaceUnpublishToolTip;
+
+ public static I18n publishResultsDialogErrorIncompletePublishingMsg;
+ public static I18n publishResultsDialogErrorIncompleteUnpublishingMsg;
+ public static I18n publishResultsDialogErrorPublishingMsg;
+ public static I18n publishResultsDialogErrorUnpublishingMsg;
+ public static I18n publishResultsDialogFileHeader;
+ public static I18n publishResultsDialogIncompletePublishMsg;
+ public static I18n publishResultsDialogIncompleteUnpublishMsg;
+ public static I18n publishResultsDialogMessageHeader;
+ public static I18n publishResultsDialogPublishMsg;
+ public static I18n publishResultsDialogStatisticsMsg;
+ public static I18n publishResultsDialogTitle;
+ public static I18n publishResultsDialogUnpublishMsg;
+
+ public static I18n publishWizardPublishErrorMsg;
+ public static I18n publishWizardPublishTitle;
+ public static I18n publishWizardUnpublishTitle;
+ public static I18n publishWizardUnpublishErrorMsg;
+
+ public static I18n refreshActionToolTip;
+
+ public static I18n serverManagerGetRepositoriesExceptionMsg;
+ public static I18n serverManagerGetWorkspacesExceptionMsg;
+
+ public static I18n serverPageAuthenticationGroupTitle;
+ public static I18n serverPageInvalidServerProperties;
+ public static I18n serverPageOkStatusMsg;
+ public static I18n serverPagePasswordLabel;
+ public static I18n serverPagePasswordToolTip;
+ public static I18n serverPageSavePasswordButton;
+ public static I18n serverPageSavePasswordLabel;
+ public static I18n serverPageSavePasswordToolTip;
+ public static I18n serverPageTitle;
+ public static I18n serverPageUrlLabel;
+ public static I18n serverPageUrlToolTip;
+ public static I18n serverPageUserLabel;
+ public static I18n serverPageUserToolTip;
+
+ public static I18n serverViewToolTip;
+
+ public static I18n serverWizardEditServerErrorMsg;
+ public static I18n serverWizardEditServerTitle;
+ public static I18n serverWizardNewServerErrorMsg;
+ public static I18n serverWizardNewServerTitle;
+
+ static {
+ try {
+ I18n.initialize(RestClientI18n.class);
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+ }
+
+}
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties (from rev 1141, branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties)
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,131 @@
+#
+# JBoss DNA (http://www.jboss.org/dna)
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+# See the AUTHORS.txt file in the distribution for a full listing of
+# individual contributors.
+#
+# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+# is licensed to you under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# JBoss DNA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+basePublishingActionPublishingWizardErrorMsg = Unexpected error running the publishing wizard. See log for more details.
+basePublishingActionUnpublishingWizardErrorMsg = Unexpected error running the unpublishing wizard. See log for more details.
+
+collapseActionToolTip = Collapse All
+
+deleteServerActionText = Delete Server
+deleteServerActionToolTip = Delete server from the server registry
+
+deleteServerDialogErrorsOccurredMsg = There were errors deleting servers from the server registry. See log for more details.
+deleteServerDialogMultipleServersMsg = Are you sure you want to delete these {0} servers?
+deleteServerDialogOneServerMsg = Are you sure you want to delete the "{0}" server?
+deleteServerDialogTitle = Confirm Delete Server
+
+editServerActionText = Server Properties
+editServerActionToolTip = Edit server properties
+
+errorDialogTitle = Error
+
+missingImage = The following image cannot be found "{0}"
+
+newServerActionText = New Server
+newServerActionToolTip = Create a new server
+
+publishingResultsPublishNotAttemptedMsg = Publishing not attempted
+publishingResultsTooManyResultsMsg = Adding a status to the results failed since there is not enough files involved in the publishing operation.
+publishingResultsUnknownSeverityMsg = "{0}" is an unknown status severity
+publishingResultsUnpublishNotAttemptedMsg = Unpublishing not attempted
+
+publishOperationConsoleName = DNA
+publishOperationPublish = DNA publish to server "{0}", repository "{1}", workspace "{2}"
+publishOperationPublishFile = \t+ Published file "{0}" to location "{1}"
+publishOperationPublishFileFailed = \t* ERROR publishing file "{0}" to location "{1}"
+publishOperationPublishTaskName = Publishing resources
+publishOperationUnpublish = DNA unpublish from server "{0}", repository "{1}", workspace "{2}"
+publishOperationUnpublishFile = \t- Unpublished file "{0}" from location "{1}"
+publishOperationUnpublishFileFailed = \t* ERROR unpublished file "{0}" from location "{1}"
+publishOperationUnpublishTaskName = Unpublishing resources
+
+publishPagePublishTitle = Publish the selected resources
+publishPageLocationGroupTitle = Location
+publishPageMissingRepositoryStatusMsg = A repository must be selected
+publishPageMissingServerStatusMsg = A server must be selected
+publishPageMissingWorkspaceStatusMsg = A workspace must be selected
+publishPageNewServerButton = New...
+publishPageNoAvailableRepositoriesStatusMsg = There are no repositories available on that server
+publishPageNoAvailableServersStatusMsg = A server must be created first
+publishPageNoAvailableWorkspacesStatusMsg = There are no workspaces available on that server and repository
+publishPageNoResourcesToPublishStatusMsg = There are no files that can be published
+publishPageNoResourcesToUnpublishStatusMsg = There are no files that can be unpublished
+publishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the selected resources will be published. Then click "Finish" to execute the publish operation.
+publishPagePublishResourcesLabel = These resources will be uploaded to the specified DNA workspace:
+publishPageRecurseCheckBox = Recurse folders and projects
+publishPageRecurseCheckBoxToolTip = Add all files under folders recursively under selected projects and folders
+publishPageRecurseProcessingErrorMsg = Unexpected error processing resources. See log for more details.
+publishPageRepositoryLabel = Repository:
+publishPageRepositoryToolTip = The repository where the workspace is located
+publishPageServerLabel = Server:
+publishPageServerToolTip = The server where the repository is located
+publishPageUnpublishOkStatusMsg = Choose the server, repository, and workspace where the selected resources will be unpublished. Then click "Finish" to execute the unpublish operation.
+publishPageUnpublishResourcesLabel = These resources will be removed from the specified DNA workspace:
+publishPageUnpublishTitle = Unpublish the selected resources
+publishPageWorkspaceLabel = Workspace:
+publishPageWorkspacePublishToolTip = The workspace where the resources are being published
+publishPageWorkspaceUnpublishToolTip = The workspace where the resources are being unpublished
+
+publishResultsDialogErrorIncompletePublishingMsg = There was a problem publishing some or all of the files. The publishing operation did not complete. See results below and the log for more details. Error message: "{0}."
+publishResultsDialogErrorIncompleteUnpublishingMsg = There was a problem publishing some or all of the files. The unpublishing operation did not complete. See results below and the log for more details. Error message: "{0}."
+publishResultsDialogErrorPublishingMsg = There was a problem publishing some or all of the files. See results below and the log for more details. Error message: "{0}."
+publishResultsDialogErrorUnpublishingMsg = There was a problem publishing some or all of the files. See results below and the log for more details. Error message: "{0}."
+publishResultsDialogFileHeader = File
+publishResultsDialogIncompletePublishMsg = {0} file(s) were successfully published (uploaded) to the DNA repository workspace but the publishing operation did not complete.
+publishResultsDialogIncompleteUnpublishMsg = {0} file(s) were successfully unpublished (removed) from the DNA repository workspace but the unpublishing operation did not complete.
+publishResultsDialogMessageHeader = Message
+publishResultsDialogPublishMsg = {0} file(s) were successfully published (uploaded) to the DNA repository workspace.
+publishResultsDialogStatisticsMsg = There were {1} error(s), {2} info(s), and {3} warning(s).
+publishResultsDialogTitle = Results
+publishResultsDialogUnpublishMsg = {0} file(s) were successfully unpublished (removed) from the DNA repository workspace.
+
+publishWizardPublishErrorMsg = Error Publishing
+publishWizardPublishTitle = Publish
+publishWizardUnpublishErrorMsg = Error Unpublishing
+publishWizardUnpublishTitle = Unpublish
+
+refreshActionToolTip = Refresh
+
+serverManagerGetRepositoriesExceptionMsg = There was a problem obtaining repositories for the server "{0}."
+serverManagerGetWorkspacesExceptionMsg = There was a problem obtaining workspaces for repository "{0}."
+
+serverPageAuthenticationGroupTitle = Authentication
+serverPageInvalidServerProperties = Cannot construct a server because all server properties are not valid
+serverPageOkStatusMsg = Define the server information where the DNA repositories are located.
+serverPagePasswordLabel = Password:
+serverPagePasswordToolTip = The password used to authenticate the user when connecting to the server
+serverPageSavePasswordButton = Save password
+serverPageSavePasswordLabel = Saved secret data is stored on your computer in a file that's difficult, but not impossible, for an intruder to read.
+serverPageSavePasswordToolTip = Indicates if the clear text password should be stored on the local file system
+serverPageTitle = Enter Server Information
+serverPageUrlLabel = URL:
+serverPageUrlToolTip = The URL used to connect to the server
+serverPageUserLabel = User:
+serverPageUserToolTip = The user login used when connecting to the server
+
+serverViewToolTip = Manages the DNA server registry
+
+serverWizardEditServerErrorMsg = There were errors editing a server. See log for more details.
+serverWizardEditServerTitle = Edit Server
+serverWizardNewServerErrorMsg = There were errors creating a new server. See log for more details.
+serverWizardNewServerTitle = New Server
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/RestClientI18n.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/Utils.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -33,7 +33,6 @@
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
/**
- * @author Dan Florian
* @since 0.6
*/
public final class Utils {
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/BasePublishingAction.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IResource;
@@ -39,12 +39,11 @@
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishWizard;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
- * @author Dan Florian
* @since 0.6
*/
public abstract class BasePublishingAction implements IObjectActionDelegate {
@@ -117,7 +116,7 @@
@Override
protected void configureShell( Shell newShell ) {
super.configureShell(newShell);
- newShell.setImage(Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH));
+ newShell.setImage(Activator.getDefault().getImage(DNA_IMAGE_16x));
}
};
@@ -126,13 +125,13 @@
String msg = null;
if (this.type == Type.PUBLISH) {
- msg = I18n.BasePublishingActionPublishingWizardErrorMsg;
+ msg = RestClientI18n.basePublishingActionPublishingWizardErrorMsg.text();
} else {
- msg = I18n.BasePublishingActionUnpublishingWizardErrorMsg;
+ msg = RestClientI18n.basePublishingActionUnpublishingWizardErrorMsg.text();
}
Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
- MessageDialog.openError(this.shell, I18n.ErrorDialogTitle, msg);
+ MessageDialog.openError(this.shell, RestClientI18n.errorDialogTitle.text(), msg);
}
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/DeleteServerAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/DeleteServerAction.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/DeleteServerAction.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -36,13 +36,12 @@
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.dialogs.DeleteServerDialog;
/**
* The DeleteServerAction deletes one or more servers from the server registry.
*
- * @author Dan Florian
* @since 0.6
*/
public final class DeleteServerAction extends BaseSelectionListenerAction {
@@ -83,8 +82,8 @@
*/
public DeleteServerAction( Shell shell,
ServerManager serverManager ) {
- super(I18n.DeleteServerActionText);
- setToolTipText(I18n.DeleteServerActionToolTip);
+ super(RestClientI18n.deleteServerActionText.text());
+ setToolTipText(RestClientI18n.deleteServerActionToolTip.text());
setImageDescriptor(Activator.getDefault().getImageDescriptor(DELETE_SERVER_IMAGE_PATH));
setEnabled(false);
@@ -123,7 +122,9 @@
}
if (errorsOccurred) {
- MessageDialog.openError(this.shell, I18n.ErrorDialogTitle, I18n.DeleteServerDialogErrorsOccurredMsg);
+ MessageDialog.openError(this.shell,
+ RestClientI18n.errorDialogTitle.text(),
+ RestClientI18n.deleteServerDialogErrorsOccurredMsg.text());
}
}
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/EditServerAction.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.EDIT_SERVER_IMAGE_PATH;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
@@ -32,11 +32,12 @@
import org.jboss.dna.web.jcr.rest.client.ServerManager;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.ServerWizard;
/**
- * @author Dan Florian
+ * The <code>EditServerAction</code> runs a UI that allows {@link Server server} properties to be changed.
+ *
* @since 0.6
*/
public final class EditServerAction extends BaseSelectionListenerAction {
@@ -77,8 +78,8 @@
*/
public EditServerAction( Shell shell,
ServerManager serverManager ) {
- super(I18n.EditServerActionText);
- setToolTipText(I18n.EditServerActionToolTip);
+ super(RestClientI18n.editServerActionText.text());
+ setToolTipText(RestClientI18n.editServerActionToolTip.text());
setImageDescriptor(Activator.getDefault().getImageDescriptor(EDIT_SERVER_IMAGE_PATH));
setEnabled(false);
@@ -103,10 +104,10 @@
@Override
protected void configureShell( Shell newShell ) {
super.configureShell(newShell);
- newShell.setImage(Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH));
+ newShell.setImage(Activator.getDefault().getImage(DNA_IMAGE_16x));
}
};
-
+
dialog.open();
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/NewServerAction.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -23,18 +23,20 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.actions;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.NEW_SERVER_IMAGE_PATH;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
import org.jboss.dna.web.jcr.rest.client.ServerManager;
+import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.ServerWizard;
/**
- * @author Dan Florian
+ * The <code>NewServerAction</code> runs a UI that allows the user to create a new {@link Server server}.
+ *
* @since 0.6
*/
public final class NewServerAction extends BaseSelectionListenerAction {
@@ -68,8 +70,8 @@
*/
public NewServerAction( Shell shell,
ServerManager serverManager ) {
- super(I18n.NewServerActionText);
- setToolTipText(I18n.NewServerActionToolTip);
+ super(RestClientI18n.newServerActionText.text());
+ setToolTipText(RestClientI18n.newServerActionToolTip.text());
setImageDescriptor(Activator.getDefault().getImageDescriptor(NEW_SERVER_IMAGE_PATH));
this.shell = shell;
@@ -93,7 +95,7 @@
@Override
protected void configureShell( Shell newShell ) {
super.configureShell(newShell);
- newShell.setImage(Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH));
+ newShell.setImage(Activator.getDefault().getImage(DNA_IMAGE_16x));
}
};
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/PublishAction.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -26,9 +26,9 @@
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
- * The PublishAction controls the publishing of one or more {@link org.eclipse.core.resources.IResource}s to a DNA repository.
+ * The <code>PublishAction</code> controls the publishing of one or more {@link org.eclipse.core.resources.IResource}s to a DNA
+ * repository.
*
- * @author Dan Florian
* @since 0.6
*/
public final class PublishAction extends BasePublishingAction {
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/UnpublishAction.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -26,10 +26,9 @@
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
- * The UnpublishAction controls the unpublishing of on or more {@link org.eclipse.core.resources.IResource}s from a DNA
- * repository.
+ * The <code>UnpublishAction</code> controls the unpublishing of one or more {@link org.eclipse.core.resources.IResource}s from a
+ * DNA repository.
*
- * @author Dan Florian
* @since 0.6
*/
public final class UnpublishAction extends BasePublishingAction {
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/package-info.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/package-info.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/package-info.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,27 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * The JBoss DNA REST Client Eclipse actions package defines the actions used to publish, unpublish, and manage the server registry.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.actions;
\ No newline at end of file
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/actions/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/DeleteServerDialog.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -23,11 +23,10 @@
*/
package org.jboss.dna.web.jcr.rest.client.swt.dialogs;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
import java.util.Collection;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -38,15 +37,14 @@
import org.jboss.dna.web.jcr.rest.client.domain.IDnaObject;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
/**
* The <code>DeleteServerDialog</code> class provides a UI for deleting a {@link Server server}.
*
- * @author Dan Florian
* @since 0.6
*/
-public class DeleteServerDialog extends MessageDialog {
+public final class DeleteServerDialog extends MessageDialog {
// ===========================================================================================================================
// Fields
@@ -70,10 +68,10 @@
*/
public DeleteServerDialog( Shell parentShell,
Collection<Server> serversBeingDeleted ) {
- super(parentShell, I18n.DeleteServerDialogTitle, Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH), null,
+ super(parentShell, RestClientI18n.deleteServerDialogTitle.text(), Activator.getDefault().getImage(DNA_IMAGE_16x), null,
MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
this.serversBeingDeleted = serversBeingDeleted;
-
+
// make sure dialog is resizable
setShellStyle(getShellStyle() | SWT.RESIZE);
}
@@ -97,9 +95,9 @@
if (this.serversBeingDeleted.size() == 1) {
IDnaObject server = this.serversBeingDeleted.iterator().next();
- msg = NLS.bind(I18n.DeleteServerDialogOneServerMsg, server.getName());
+ msg = RestClientI18n.deleteServerDialogOneServerMsg.text(server.getName());
} else {
- msg = NLS.bind(I18n.DeleteServerDialogMultipleServersMsg, this.serversBeingDeleted.size());
+ msg = RestClientI18n.deleteServerDialogMultipleServersMsg.text(this.serversBeingDeleted.size());
}
this.message = msg;
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/PublishingResultsDialog.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -24,7 +24,7 @@
package org.jboss.dna.web.jcr.rest.client.swt.dialogs;
import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.CHECKMARK_IMAGE_PATH;
-import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_WINDOW_IMAGE_PATH;
+import static org.jboss.dna.web.jcr.rest.client.swt.IUiConstants.DNA_IMAGE_16x;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -35,29 +35,29 @@
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.Utils;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishingResults;
/**
- * The <code>DeleteServerDialog</code> class provides a UI for deleting a {@link Server server}.
+ * The <code>PublishingResultsDialog</code> displays the results of a publishing operation.
*
- * @author Dan Florian
* @since 0.6
*/
-public class PublishingResultsDialog extends MessageDialog {
+public final class PublishingResultsDialog extends MessageDialog {
// ===========================================================================================================================
// Constants
@@ -113,7 +113,7 @@
*/
public PublishingResultsDialog( Shell parentShell,
PublishingResults results ) {
- super(parentShell, I18n.PublishResultsDialogTitle, Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH), null,
+ super(parentShell, RestClientI18n.publishResultsDialogTitle.text(), Activator.getDefault().getImage(DNA_IMAGE_16x), null,
MessageDialog.INFORMATION, new String[] {IDialogConstants.OK_LABEL}, 0);
this.results = results;
@@ -130,7 +130,7 @@
public PublishingResultsDialog( Shell parentShell,
PublishingResults results,
Throwable error ) {
- super(parentShell, I18n.PublishResultsDialogTitle, Activator.getDefault().getImage(DNA_WINDOW_IMAGE_PATH), null,
+ super(parentShell, RestClientI18n.publishResultsDialogTitle.text(), Activator.getDefault().getImage(DNA_IMAGE_16x), null,
MessageDialog.ERROR, new String[] {IDialogConstants.OK_LABEL}, 0);
this.results = results;
this.error = error;
@@ -154,15 +154,37 @@
super.configureShell(shell);
// now set message
- Object[] counts = new Object[] {this.results.getOksCount(), this.results.getErrorCount(), this.results.getInfoCount(),
- this.results.getWarningsCount()};
+ int successCount = this.results.getFiles().size() - this.results.getErrorCount();
+ boolean completed = this.results.isComplete();
if (this.results.getType() == PublishOperation.Type.PUBLISH) {
- this.message = ((this.error == null) ? I18n.bind(I18n.PublishResultsDialogPublishMsg, counts) : I18n.bind(I18n.PublishResultsDialogErrorPublishingMsg,
- this.error.getLocalizedMessage()));
+ if (completed) {
+ if ((this.error == null)) {
+ this.message = RestClientI18n.publishResultsDialogPublishMsg.text(successCount);
+ } else {
+ this.message = RestClientI18n.publishResultsDialogErrorPublishingMsg.text(this.error.getLocalizedMessage());
+ }
+ } else {
+ if ((this.error == null)) {
+ this.message = RestClientI18n.publishResultsDialogIncompletePublishMsg.text(successCount);
+ } else {
+ this.message = RestClientI18n.publishResultsDialogErrorIncompletePublishingMsg.text(this.error.getLocalizedMessage());
+ }
+ }
} else {
- this.message = ((this.error == null) ? I18n.bind(I18n.PublishResultsDialogUnpublishMsg, counts) : I18n.bind(I18n.PublishResultsDialogErrorUnpublishingMsg,
- this.error.getLocalizedMessage()));
+ if (completed) {
+ if ((this.error == null)) {
+ this.message = RestClientI18n.publishResultsDialogUnpublishMsg.text(successCount);
+ } else {
+ this.message = RestClientI18n.publishResultsDialogErrorUnpublishingMsg.text(this.error.getLocalizedMessage());
+ }
+ } else {
+ if ((this.error == null)) {
+ this.message = RestClientI18n.publishResultsDialogIncompleteUnpublishMsg.text(successCount);
+ } else {
+ this.message = RestClientI18n.publishResultsDialogErrorIncompleteUnpublishingMsg.text(this.error.getLocalizedMessage());
+ }
+ }
}
}
@@ -203,13 +225,13 @@
table.setLinesVisible(true);
TableColumn col = new TableColumn(table, SWT.LEFT);
- col.setText(I18n.PublishResultsDialogFileHeader);
+ col.setText(RestClientI18n.publishResultsDialogFileHeader.text());
col = new TableColumn(table, SWT.CENTER);
col.setResizable(false);
col = new TableColumn(table, SWT.LEFT);
- col.setText(I18n.PublishResultsDialogMessageHeader);
+ col.setText(RestClientI18n.publishResultsDialogMessageHeader.text());
// populate the table
viewer.setInput(this);
@@ -220,6 +242,21 @@
column.setWidth(column.getWidth() + 2);
}
+ // add statistics label
+ StyledText st = new StyledText(parent, SWT.READ_ONLY | SWT.MULTI | SWT.NO_FOCUS | SWT.WRAP);
+ st.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ st.setCaret(null);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.grabExcessVerticalSpace = false;
+ gd.horizontalIndent = ((GridLayout)pnl.getLayout()).horizontalSpacing * 5;
+ st.setLayoutData(gd);
+
+ // set message
+ Object[] counts = new Object[] {this.results.getOksCount(), this.results.getErrorCount(), this.results.getInfoCount(),
+ this.results.getWarningsCount()};
+ String msg = RestClientI18n.publishResultsDialogStatisticsMsg.text(counts);
+ st.setText(msg);
+
return pnl;
}
@@ -248,7 +285,6 @@
* The <code>ResultsProvider</code> class is the label provider and content provider for the table that is shown in the
* dialog.
*
- * @author Dan Florian
* @since 0.6
*/
class ResultsProvider extends LabelProvider implements IStructuredContentProvider, ITableLabelProvider {
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/package-info.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/package-info.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/package-info.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * The JBoss DNA REST Client Eclipse dialogs package defines the Eclipse dialogs used to publish, unpublish, and manage the
+ * server registry.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.dialogs;
\ No newline at end of file
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/dialogs/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/i18n.properties 2009-08-10 21:31:32 UTC (rev 1160)
@@ -1,119 +0,0 @@
-#
-# JBoss DNA (http://www.jboss.org/dna)
-# See the COPYRIGHT.txt file distributed with this work for information
-# regarding copyright ownership. Some portions may be licensed
-# to Red Hat, Inc. under one or more contributor license agreements.
-# See the AUTHORS.txt file in the distribution for a full listing of
-# individual contributors.
-#
-# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
-# is licensed to you under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# JBoss DNA is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this software; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-#
-BasePublishingActionPublishingWizardErrorMsg = Unexpected error running the publishing wizard. See log for more details.
-BasePublishingActionUnpublishingWizardErrorMsg = Unexpected error running the unpublishing wizard. See log for more details.
-
-CollapseActionToolTip = Collapse All
-
-DeleteServerActionText = Delete Server
-DeleteServerActionToolTip = Delete server from the server registry
-
-DeleteServerDialogErrorsOccurredMsg = There were errors deleting servers from the server registry. See log for more details.
-DeleteServerDialogMultipleServersMsg = Are you sure you want to delete these {0} servers?
-DeleteServerDialogOneServerMsg = Are you sure you want to delete the "{0}" server?
-DeleteServerDialogTitle = Confirm Delete Server
-
-EditServerActionText = Server Properties
-EditServerActionToolTip = Edit server properties
-
-ErrorDialogTitle = Error
-
-MissingImage = The following image cannot be found "{0}"
-
-NewServerActionText = New Server
-NewServerActionToolTip = Create a new server
-
-PublishingResultsPublishNotAttemptedMsg = Publishing not attempted
-PublishingResultsTooManyResultsMsg = Adding a status to the results failed since there is not enough files involved in the publishing operation.
-PublishingResultsUnknownSeverityMsg = "{0}" is an unknown status severity
-PublishingResultsUnpublishNotAttemptedMsg = Unpublishing not attempted
-
-PublishOperationPublishTaskName = Publishing resources
-PublishOperationUnpublishTaskName = Unpublishing resources
-
-PublishPagePublishTitle = Publish the selected resources
-PublishPageLocationGroupTitle = Location
-PublishPageMissingRepositoryStatusMsg = A repository must be selected
-PublishPageMissingServerStatusMsg = A server must be selected
-PublishPageMissingWorkspaceStatusMsg = A workspace must be selected
-PublishPageNewServerButton = New...
-PublishPageNoAvailableRepositoriesStatusMsg = There are no repositories available on that server
-PublishPageNoAvailableServersStatusMsg = A server must be created first
-PublishPageNoAvailableWorkspacesStatusMsg = There are no workspaces available on that server and repository
-PublishPageNoResourcesToPublishStatusMsg = There are no files that can be published
-PublishPageNoResourcesToUnpublishStatusMsg = There are no files that can be unpublished
-PublishPagePublishOkStatusMsg = Choose the server, repository, and workspace where the selected resources will be published. Then click "Finish" to execute the publish operation.
-PublishPagePublishResourcesLabel = These resources will be published to the specified DNA repository:
-PublishPageRecurseCheckBox = Recurse folders and projects
-PublishPageRecurseCheckBoxToolTip = Add all files under folders recursively under selected projects and folders
-PublishPageRecurseProcessingErrorMsg = Unexpected error processing resources. See log for more details.
-PublishPageRepositoryLabel = Repository:
-PublishPageRepositoryToolTip = The repository where the workspace is located
-PublishPageServerLabel = Server:
-PublishPageServerToolTip = The server where the repository is located
-PublishPageUnpublishOkStatusMsg = Choose the server, repository, and workspace where the selected resources will be unpublished. Then click "Finish" to execute the unpublish operation.
-PublishPageUnpublishResourcesLabel = These resources will be unpublished from the specified DNA repository:
-PublishPageUnpublishTitle = Unpublish the selected resources
-PublishPageWorkspaceLabel = Workspace:
-PublishPageWorkspacePublishToolTip = The workspace where the resources are being published
-PublishPageWorkspaceUnpublishToolTip = The workspace where the resources are being unpublished
-
-PublishResultsDialogErrorPublishingMsg = There was a problem publishing some or all of the files. See results below and the log for more details. Error message: "{0}."
-PublishResultsDialogErrorUnpublishingMsg = There was a problem publishing some or all of the files. See results below and the log for more details. Error message: "{0}."
-PublishResultsDialogFileHeader = File
-PublishResultsDialogMessageHeader = Message
-PublishResultsDialogPublishMsg = The operation completed with {0} file(s) being published. There were {1} error(s), {2} info(s), and {3} warning(s).
-PublishResultsDialogTitle = Results
-PublishResultsDialogUnpublishMsg = The operation completed with {0} file(s) being unpublished. There were {1} error(s), {2} info(s), and {3} warning(s).
-
-PublishWizardPublishErrorMsg = Error Publishing
-PublishWizardPublishTitle = Publish
-PublishWizardUnpublishErrorMsg = Error Unpublishing
-PublishWizardUnpublishTitle = Unpublish
-
-RefreshActionToolTip = Refresh
-
-ServerManagerGetRepositoriesExceptionMsg = There was a problem obtaining repositories for the server "{0}."
-ServerManagerGetWorkspacesExceptionMsg = There was a problem obtaining workspaces for repository "{0}."
-
-ServerPageAuthenticationGroupTitle = Authentication
-ServerPageInvalidServerProperties = Cannot construct a server because all server properties are not valid
-ServerPageOkStatusMsg = Define the server information where the DNA repositories are located.
-ServerPagePasswordLabel = Password:
-ServerPagePasswordToolTip = The password used to authenticate the user when connecting to the server
-ServerPageSavePasswordButton = Save password
-ServerPageSavePasswordLabel = Saved secret data is stored on your computer in a file that's difficult, but not impossible, for an intruder to read.
-ServerPageSavePasswordToolTip = Indicates if the clear text password should be stored on the local file system
-ServerPageTitle = Enter Server Information
-ServerPageUrlLabel = URL:
-ServerPageUrlToolTip = The URL used to connect to the server
-ServerPageUserLabel = User:
-ServerPageUserToolTip = The user login used when connecting to the server
-
-ServerViewToolTip = Manages the DNA server registry
-
-ServerWizardEditServerErrorMsg = There were errors editing a server. See log for more details.
-ServerWizardEditServerTitle = Edit Server
-ServerWizardNewServerErrorMsg = There were errors creating a new server. See log for more details.
-ServerWizardNewServerTitle = New Server
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLogger.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLogger.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLogger.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,822 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.log;
+
+import java.text.MessageFormat;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.jboss.dna.web.jcr.rest.client.swt.IUiConstants;
+import org.slf4j.Logger;
+import org.slf4j.Marker;
+
+/**
+ * The <code>EclipseLogger</code> class provides an <code>org.slf4j.Logger</code> implementation that uses the Eclipse logger.
+ *
+ * @since 0.6
+ */
+public final class EclipseLogger implements Logger {
+
+ // ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ private static ILog LOGGER = Platform.getLog(Platform.getBundle(IUiConstants.PLUGIN_ID));
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ private String name;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ EclipseLogger( String name ) {
+ this.name = name;
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void debug( String message ) {
+ if (isDebugEnabled()) info(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void debug( String pattern,
+ Object arg ) {
+ if (isDebugEnabled()) info(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void debug( String pattern,
+ Object[] arguments ) {
+ if (isDebugEnabled()) info(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void debug( String message,
+ Throwable e ) {
+ if (isDebugEnabled()) info(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void debug( Marker marker,
+ String message ) {
+ debug(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void debug( String pattern,
+ Object arg1,
+ Object arg2 ) {
+ if (isDebugEnabled()) info(pattern, arg1, arg2);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void debug( Marker marker,
+ String pattern,
+ Object arg ) {
+ debug(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void debug( Marker marker,
+ String pattern,
+ Object[] arguments ) {
+ debug(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void debug( Marker marker,
+ String message,
+ Throwable e ) {
+ debug(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void debug( Marker marker,
+ String pattern,
+ Object arg1,
+ Object arg2 ) {
+ debug(pattern, arg1, arg2);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void error( String message ) {
+ if (isErrorEnabled()) LOGGER.log(new Status(IStatus.ERROR, IUiConstants.PLUGIN_ID, message, null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void error( String pattern,
+ Object arg ) {
+ if (isErrorEnabled()) LOGGER.log(new Status(IStatus.ERROR, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern, arg),
+ null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void error( String pattern,
+ Object[] arguments ) {
+ if (isErrorEnabled()) LOGGER.log(new Status(IStatus.ERROR, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern,
+ arguments), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void error( String message,
+ Throwable e ) {
+ if (isErrorEnabled()) LOGGER.log(new Status(IStatus.ERROR, IUiConstants.PLUGIN_ID, message, e));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void error( Marker marker,
+ String message ) {
+ error(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void error( String pattern,
+ Object arg1,
+ Object arg2 ) {
+ if (isErrorEnabled()) LOGGER.log(new Status(IStatus.ERROR, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern,
+ arg1,
+ arg2), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void error( Marker marker,
+ String pattern,
+ Object arg ) {
+ error(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void error( Marker marker,
+ String pattern,
+ Object[] arguments ) {
+ error(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void error( Marker marker,
+ String message,
+ Throwable e ) {
+ error(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void error( Marker marker,
+ String pattern,
+ Object arg1,
+ Object arg2 ) {
+ error(pattern, arg1, arg2);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#getName()
+ * @since 0.6
+ */
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void info( String message ) {
+ if (isInfoEnabled()) LOGGER.log(new Status(IStatus.INFO, IUiConstants.PLUGIN_ID, message, null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void info( String pattern,
+ Object arg ) {
+ if (isInfoEnabled()) LOGGER.log(new Status(IStatus.INFO, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern, arg), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void info( String pattern,
+ Object[] arguments ) {
+ if (isInfoEnabled()) LOGGER.log(new Status(IStatus.INFO, IUiConstants.PLUGIN_ID,
+ MessageFormat.format(pattern, arguments), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void info( String message,
+ Throwable e ) {
+ if (isInfoEnabled()) LOGGER.log(new Status(IStatus.INFO, IUiConstants.PLUGIN_ID, message, e));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void info( Marker marker,
+ String message ) {
+ info(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void info( String pattern,
+ Object arg1,
+ Object arg2 ) {
+ if (isInfoEnabled()) LOGGER.log(new Status(IStatus.INFO, IUiConstants.PLUGIN_ID,
+ MessageFormat.format(pattern, arg1, arg2), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void info( Marker marker,
+ String pattern,
+ Object arg ) {
+ info(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void info( Marker marker,
+ String pattern,
+ Object[] arguments ) {
+ info(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void info( Marker marker,
+ String message,
+ Throwable e ) {
+ info(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void info( Marker marker,
+ String pattern,
+ Object arg1,
+ Object arg2 ) {
+ info(pattern, arg1, arg2);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isDebugEnabled()
+ * @since 0.6
+ */
+ @Override
+ public boolean isDebugEnabled() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isDebugEnabled(org.slf4j.Marker)
+ * @since 0.6
+ */
+ @Override
+ public boolean isDebugEnabled( Marker marker ) {
+ return isDebugEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isErrorEnabled()
+ * @since 0.6
+ */
+ @Override
+ public boolean isErrorEnabled() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isErrorEnabled(org.slf4j.Marker)
+ * @since 0.6
+ */
+ @Override
+ public boolean isErrorEnabled( Marker marker ) {
+ return isErrorEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isInfoEnabled()
+ * @since 0.6
+ */
+ @Override
+ public boolean isInfoEnabled() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isInfoEnabled(org.slf4j.Marker)
+ * @since 0.6
+ */
+ @Override
+ public boolean isInfoEnabled( Marker marker ) {
+ return isInfoEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isTraceEnabled()
+ * @since 0.6
+ */
+ @Override
+ public boolean isTraceEnabled() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isTraceEnabled(org.slf4j.Marker)
+ * @since 0.6
+ */
+ @Override
+ public boolean isTraceEnabled( Marker marker ) {
+ return isTraceEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isWarnEnabled()
+ * @since 0.6
+ */
+ @Override
+ public boolean isWarnEnabled() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#isWarnEnabled(org.slf4j.Marker)
+ * @since 0.6
+ */
+ @Override
+ public boolean isWarnEnabled( Marker marker ) {
+ return isWarnEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void trace( String message ) {
+ if (isTraceEnabled()) info(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void trace( String pattern,
+ Object arg ) {
+ if (isTraceEnabled()) info(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void trace( String pattern,
+ Object[] arguments ) {
+ if (isTraceEnabled()) info(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void trace( String message,
+ Throwable e ) {
+ if (isTraceEnabled()) info(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(org.slf4j.Marker, java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void trace( Marker marker,
+ String message ) {
+ trace(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void trace( String pattern,
+ Object arg1,
+ Object arg2 ) {
+ if (isTraceEnabled()) info(pattern, arg1, arg2);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(org.slf4j.Marker, java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void trace( Marker marker,
+ String pattern,
+ Object arg ) {
+ trace(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(org.slf4j.Marker, java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void trace( Marker marker,
+ String pattern,
+ Object[] arguments ) {
+ trace(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(org.slf4j.Marker, java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void trace( Marker marker,
+ String message,
+ Throwable e ) {
+ trace(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#trace(org.slf4j.Marker, java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void trace( Marker marker,
+ String pattern,
+ Object arg1,
+ Object arg2 ) {
+ trace(pattern, arg1, arg2);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void warn( String message ) {
+ if (isWarnEnabled()) LOGGER.log(new Status(IStatus.WARNING, IUiConstants.PLUGIN_ID, message, null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void warn( String pattern,
+ Object arg ) {
+ if (isWarnEnabled()) LOGGER.log(new Status(IStatus.WARNING, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern, arg),
+ null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void warn( String pattern,
+ Object[] arguments ) {
+ if (isWarnEnabled()) LOGGER.log(new Status(IStatus.WARNING, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern,
+ arguments), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void warn( String message,
+ Throwable e ) {
+ if (isWarnEnabled()) LOGGER.log(new Status(IStatus.WARNING, IUiConstants.PLUGIN_ID, message, e));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public void warn( Marker marker,
+ String message ) {
+ warn(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void warn( String pattern,
+ Object arg1,
+ Object arg2 ) {
+ if (isWarnEnabled()) LOGGER.log(new Status(IStatus.WARNING, IUiConstants.PLUGIN_ID, MessageFormat.format(pattern,
+ arg1,
+ arg2), null));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void warn( Marker marker,
+ String pattern,
+ Object arg ) {
+ warn(pattern, arg);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String, java.lang.Object[])
+ * @since 0.6
+ */
+ @Override
+ public void warn( Marker marker,
+ String pattern,
+ Object[] arguments ) {
+ warn(pattern, arguments);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String, java.lang.Throwable)
+ * @since 0.6
+ */
+ @Override
+ public void warn( Marker marker,
+ String message,
+ Throwable e ) {
+ warn(message, e);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String, java.lang.Object, java.lang.Object)
+ * @since 0.6
+ */
+ @Override
+ public void warn( Marker marker,
+ String pattern,
+ Object arg1,
+ Object arg2 ) {
+ warn(pattern, arg1, arg2);
+ }
+
+}
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLoggerFactory.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLoggerFactory.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLoggerFactory.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,98 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.log;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+/**
+ * @since 0.6
+ */
+public final class EclipseLoggerFactory implements ILoggerFactory {
+
+ // ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ /**
+ * The shared instance of the factory.
+ *
+ * @since 0.6
+ */
+ static final EclipseLoggerFactory INSTANCE = new EclipseLoggerFactory();
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * Map of loggers keyed by logger name.
+ *
+ * @since 0.6
+ */
+ private Map<String, Logger> loggerMap;
+
+ // ===========================================================================================================================
+ // Constructors
+ // ===========================================================================================================================
+
+ /**
+ * Constructs the factory.
+ *
+ * @since 0.6
+ */
+ public EclipseLoggerFactory() {
+ this.loggerMap = new HashMap<String, Logger>();
+ }
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.ILoggerFactory#getLogger(java.lang.String)
+ * @since 0.6
+ */
+ @Override
+ public Logger getLogger( String name ) {
+ Logger logger = null;
+
+ // protect against concurrent access of the loggerMap
+ synchronized (this) {
+ logger = this.loggerMap.get(name);
+
+ if (logger == null) {
+ logger = new EclipseLogger(name);
+ this.loggerMap.put(name, logger);
+ }
+ }
+
+ return logger;
+ }
+
+}
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/EclipseLoggerFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/StaticLoggerBinder.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/StaticLoggerBinder.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/StaticLoggerBinder.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,101 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.log;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+/**
+ * @since 0.6
+ */
+public final class StaticLoggerBinder implements LoggerFactoryBinder {
+
+ // ===========================================================================================================================
+ // Class Fields
+ // ===========================================================================================================================
+
+ /**
+ * The class name of the logger factory.
+ *
+ * @since 0.6
+ */
+ private static final String LOGGER_FACTORY_CLASS_NAME = EclipseLoggerFactory.class.getName();
+
+ /**
+ * The unique instance of this class.
+ *
+ * @since 0.6
+ */
+ private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+
+ // ===========================================================================================================================
+ // Class Methods
+ // ===========================================================================================================================
+
+ /**
+ * @return the static instance of the logger
+ * @since 0.6
+ */
+ public static final StaticLoggerBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ // ===========================================================================================================================
+ // Fields
+ // ===========================================================================================================================
+
+ /**
+ * The logger factory used.
+ *
+ * @since 0.6
+ */
+ private final ILoggerFactory loggerFactory = new EclipseLoggerFactory();
+
+ // ===========================================================================================================================
+ // Methods
+ // ===========================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.spi.LoggerFactoryBinder#getLoggerFactory()
+ * @since 0.6
+ */
+ @Override
+ public ILoggerFactory getLoggerFactory() {
+ return this.loggerFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.slf4j.spi.LoggerFactoryBinder#getLoggerFactoryClassStr()
+ * @since 0.6
+ */
+ @Override
+ public String getLoggerFactoryClassStr() {
+ return LOGGER_FACTORY_CLASS_NAME;
+ }
+
+}
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/log/StaticLoggerBinder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/package-info.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/package-info.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/package-info.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,27 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * The JBoss DNA REST Client Eclipse plugin is a UI that interfaces with the non-UI DNA REST client Maven project.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt;
\ No newline at end of file
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerContentProvider.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -37,12 +37,11 @@
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
/**
- * The ServerContentProvider is a content and label provider for DNA repositories.
+ * The <code>ServerContentProvider</code> is a content and label provider for DNA repositories.
*
- * @author Dan Florian
* @since 0.6
*/
public final class ServerContentProvider extends ColumnLabelProvider implements ITreeContentProvider {
@@ -118,11 +117,11 @@
return this.serverManager.getRepositories((Server)parentElement).toArray();
}
} catch (Exception e) {
- String msg = I18n.bind(I18n.ServerManagerGetRepositoriesExceptionMsg, ((Server)parentElement).getShortDescription());
+ String msg = RestClientI18n.serverManagerGetRepositoriesExceptionMsg.text(((Server)parentElement).getShortDescription());
Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
if (this.viewer.getControl().isVisible()) {
- MessageDialog.openError(this.viewer.getControl().getShell(), I18n.ErrorDialogTitle, msg);
+ MessageDialog.openError(this.viewer.getControl().getShell(), RestClientI18n.errorDialogTitle.text(), msg);
}
}
@@ -131,11 +130,11 @@
return this.serverManager.getWorkspaces((Repository)parentElement).toArray();
}
} catch (Exception e) {
- String msg = I18n.ServerManagerGetWorkspacesExceptionMsg;
+ String msg = RestClientI18n.serverManagerGetWorkspacesExceptionMsg.text();
Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
if (this.viewer.getControl().isVisible()) {
- MessageDialog.openError(this.viewer.getControl().getShell(), I18n.ErrorDialogTitle, msg);
+ MessageDialog.openError(this.viewer.getControl().getShell(), RestClientI18n.errorDialogTitle.text(), msg);
}
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/ServerView.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -47,15 +47,14 @@
import org.jboss.dna.web.jcr.rest.client.ServerRegistryEvent;
import org.jboss.dna.web.jcr.rest.client.domain.IDnaObject;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.actions.DeleteServerAction;
import org.jboss.dna.web.jcr.rest.client.swt.actions.EditServerAction;
import org.jboss.dna.web.jcr.rest.client.swt.actions.NewServerAction;
/**
- * The ServerView shows all defined servers and their DNA repositories.
+ * The <code>ServerView</code> shows all defined servers and their DNA repositories.
*
- * @author Dan Florian
* @since 0.6
*/
public final class ServerView extends ViewPart implements IServerRegistryListener {
@@ -127,7 +126,7 @@
}
};
- this.collapseAllAction.setToolTipText(I18n.CollapseActionToolTip);
+ this.collapseAllAction.setToolTipText(RestClientI18n.collapseActionToolTip.text());
this.collapseAllAction.setImageDescriptor(Activator.getDefault().getImageDescriptor(COLLAPSE_ALL_IMAGE_PATH));
// the refresh action is always enabled
@@ -138,7 +137,7 @@
}
};
- this.refreshAction.setToolTipText(I18n.RefreshActionToolTip);
+ this.refreshAction.setToolTipText(RestClientI18n.refreshActionToolTip.text());
this.refreshAction.setImageDescriptor(Activator.getDefault().getImageDescriptor(REFRESH_IMAGE_PATH));
// the shell used for dialogs that the actions display
@@ -226,7 +225,7 @@
constructToolBar();
constructContextMenu();
- setTitleToolTip(I18n.ServerViewToolTip);
+ setTitleToolTip(RestClientI18n.serverViewToolTip.text());
// register to receive changes to the server registry
getServerManager().addRegistryListener(this);
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/package-info.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/package-info.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/package-info.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * The JBoss DNA REST Client Eclipse views package defines the Eclipse views that are needed to publish, unpublish, and manage
+ * the server registry.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.views;
\ No newline at end of file
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/views/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishOperation.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -28,17 +28,24 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.web.jcr.rest.client.ServerManager;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
/**
- * @author Dan Florian
+ * The <code>PublishOperation</code> publishes or unpublishes one or more files using the {@link ServerManager}.
+ *
* @since 0.6
*/
-public class PublishOperation {
+public final class PublishOperation {
// ===========================================================================================================================
// Constants
@@ -65,6 +72,13 @@
UNPUBLISH
}
+ /**
+ * The name of the message console that is written to.
+ *
+ * @since 0.6
+ */
+ private static final String CONSOLE_NAME = RestClientI18n.publishOperationConsoleName.text();
+
// ===========================================================================================================================
// Fields
// ===========================================================================================================================
@@ -110,9 +124,9 @@
public PublishOperation( Type type,
List<IFile> files,
Workspace workspace ) {
- Utils.nullArgumentCheck("type", type); //$NON-NLS-1$
- Utils.nullArgumentCheck("files", files); //$NON-NLS-1$
- Utils.nullArgumentCheck("workspace", workspace); //$NON-NLS-1$
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
+ CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
+ CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
this.type = type;
this.files = files;
@@ -159,12 +173,22 @@
this.results = new PublishingResults(this.type, this.files);
try {
- String name = (isPublishing() ? I18n.PublishOperationPublishTaskName : I18n.PublishOperationUnpublishTaskName);
+ String name = (isPublishing() ? RestClientI18n.publishOperationPublishTaskName.text() : RestClientI18n.publishOperationUnpublishTaskName.text());
monitor.beginTask(name, this.files.size());
monitor.setTaskName(name);
+ // write initial message to console
+ if (isPublishing()) {
+ writeToConsole(RestClientI18n.publishOperationPublish.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName()));
+ } else {
+ writeToConsole(RestClientI18n.publishOperationUnpublish.text(this.workspace.getServer().getUrl(),
+ this.workspace.getRepository().getName(),
+ this.workspace.getName()));
+ }
+
for (IFile eclipseFile : this.files) {
-
if (monitor.isCanceled()) {
throw new InterruptedException();
}
@@ -172,7 +196,6 @@
File file = eclipseFile.getLocation().toFile();
Status status = null;
- // TODO call publisher here (timeout?)
if (isPublishing()) {
status = Activator.getDefault().getServerManager().publish(this.workspace,
eclipseFile.getFullPath().toString(),
@@ -183,9 +206,15 @@
file);
}
- results.addStatus(status);
monitor.worked(1);
+ this.results.addStatus(status);
+
+ // write to console
+ writeToConsole(file, eclipseFile.getParent().getFullPath().toString(), status);
}
+
+ // add a gap before next console message
+ writeToConsole("\n"); //$NON-NLS-1$
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
@@ -196,4 +225,58 @@
}
}
+ /**
+ * @param file the file involved in the publishing operation
+ * @param workspacePath the path in the workspace where the file is located
+ * @param status the status of the publishing operation
+ * @since 0.6
+ */
+ private void writeToConsole( File file,
+ String workspacePath,
+ Status status ) {
+ String msg = null;
+
+ if (status.isError()) {
+ msg = (isPublishing() ? RestClientI18n.publishOperationPublishFileFailed.text(file.getAbsolutePath(), workspacePath)
+ : RestClientI18n.publishOperationUnpublishFileFailed.text(file.getAbsolutePath(), workspacePath));
+ } else {
+ msg = (isPublishing() ? RestClientI18n.publishOperationPublishFile.text(file.getAbsolutePath(), workspacePath)
+ : RestClientI18n.publishOperationUnpublishFile.text(file.getAbsolutePath(), workspacePath));
+ }
+
+ // TODO create hyperlink in console for the file
+ writeToConsole(msg);
+ }
+
+ /**
+ * @param message the message being written to the DNA console
+ * @since 0.6
+ */
+ private void writeToConsole( String message ) {
+ MessageConsole console = null;
+ IConsoleManager consoleMgr = ConsolePlugin.getDefault().getConsoleManager();
+ IConsole[] consoles = consoleMgr.getConsoles();
+
+ // see if DNA console already exists
+ for (int i = 0; i < consoles.length; ++i) {
+ if (CONSOLE_NAME.equals(consoles[i].getName())) {
+ console = (MessageConsole)consoles[i];
+ break;
+ }
+ }
+
+ // create DNA console if necessary
+ if (console == null) {
+ console = new MessageConsole(CONSOLE_NAME, null);
+ consoleMgr.addConsoles(new IConsole[] {console});
+ }
+
+ // show and focus console view
+ console.activate();
+
+ // write message
+ MessageConsoleStream out = console.newMessageStream();
+ out.println(message);
+ }
+
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishPage.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -61,12 +61,13 @@
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.actions.NewServerAction;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
- * @author Dan Florian
+ * The <code>PublishPage</code> is a UI for publishing or unpublishing one or more files to a DNA repository.
+ *
* @since 0.6
*/
public final class PublishPage extends WizardPage implements IServerRegistryListener, ModifyListener {
@@ -375,7 +376,8 @@
public PublishPage( Type type,
List<IResource> resources ) throws CoreException {
super(PublishPage.class.getSimpleName());
- setTitle((type == Type.PUBLISH) ? I18n.PublishPagePublishTitle : I18n.PublishPageUnpublishTitle);
+ setTitle((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishTitle.text()
+ : RestClientI18n.publishPageUnpublishTitle.text());
setPageComplete(false);
this.type = type;
@@ -388,7 +390,7 @@
private void constructLocationPanel( Composite parent ) {
Group pnl = new Group(parent, SWT.NONE);
- pnl.setText(I18n.PublishPageLocationGroupTitle);
+ pnl.setText(RestClientI18n.publishPageLocationGroupTitle.text());
pnl.setLayout(new GridLayout(2, false));
pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
@@ -408,16 +410,16 @@
Label lblServer = new Label(pnlServer, SWT.LEFT);
lblServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblServer.setText(I18n.PublishPageServerLabel);
+ lblServer.setText(RestClientI18n.publishPageServerLabel.text());
this.cbxServer = new Combo(pnlServer, SWT.DROP_DOWN | SWT.READ_ONLY);
this.cbxServer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- this.cbxServer.setToolTipText(I18n.PublishPageServerToolTip);
+ this.cbxServer.setToolTipText(RestClientI18n.publishPageServerToolTip.text());
final IAction action = new NewServerAction(this.getShell(), getServerManager());
final Button btnNewServer = new Button(pnlServer, SWT.PUSH);
btnNewServer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- btnNewServer.setText(I18n.PublishPageNewServerButton);
+ btnNewServer.setText(RestClientI18n.publishPageNewServerButton.text());
btnNewServer.setToolTipText(action.getToolTipText());
btnNewServer.addSelectionListener(new SelectionAdapter() {
@Override
@@ -442,25 +444,25 @@
{ // row 2: repository row
Label lblRepository = new Label(pnl, SWT.LEFT);
lblRepository.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblRepository.setText(I18n.PublishPageRepositoryLabel);
+ lblRepository.setText(RestClientI18n.publishPageRepositoryLabel.text());
this.cbxRepository = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
this.cbxRepository.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- this.cbxRepository.setToolTipText(I18n.PublishPageRepositoryToolTip);
+ this.cbxRepository.setToolTipText(RestClientI18n.publishPageRepositoryToolTip.text());
}
{ // row 3: workspace row
Label lblWorkspace = new Label(pnl, SWT.LEFT);
lblWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblWorkspace.setText(I18n.PublishPageWorkspaceLabel);
+ lblWorkspace.setText(RestClientI18n.publishPageWorkspaceLabel.text());
this.cbxWorkspace = new Combo(pnl, SWT.DROP_DOWN | SWT.READ_ONLY);
this.cbxWorkspace.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
if (type == Type.PUBLISH) {
- this.cbxWorkspace.setToolTipText(I18n.PublishPageWorkspacePublishToolTip);
+ this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspacePublishToolTip.text());
} else {
- this.cbxWorkspace.setToolTipText(I18n.PublishPageWorkspaceUnpublishToolTip);
+ this.cbxWorkspace.setToolTipText(RestClientI18n.publishPageWorkspaceUnpublishToolTip.text());
}
}
}
@@ -480,9 +482,9 @@
lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
if (type == Type.PUBLISH) {
- lbl.setText(I18n.PublishPagePublishResourcesLabel);
+ lbl.setText(RestClientI18n.publishPagePublishResourcesLabel.text());
} else {
- lbl.setText(I18n.PublishPageUnpublishResourcesLabel);
+ lbl.setText(RestClientI18n.publishPageUnpublishResourcesLabel.text());
}
}
@@ -510,8 +512,8 @@
{ // row 3
final Button chkRecurse = new Button(pnl, SWT.CHECK);
chkRecurse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- chkRecurse.setText(I18n.PublishPageRecurseCheckBox);
- chkRecurse.setToolTipText(I18n.PublishPageRecurseCheckBoxToolTip);
+ chkRecurse.setText(RestClientI18n.publishPageRecurseCheckBox.text());
+ chkRecurse.setToolTipText(RestClientI18n.publishPageRecurseCheckBoxToolTip.text());
chkRecurse.setSelection(this.recurse);
chkRecurse.addSelectionListener(new SelectionAdapter() {
@Override
@@ -575,7 +577,8 @@
* @since 0.6
*/
void updateInitialMessage() {
- String msg = ((this.type == Type.PUBLISH) ? I18n.PublishPagePublishOkStatusMsg : I18n.PublishPageUnpublishOkStatusMsg);
+ String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
if (msg.equals(getMessage())) {
updateState();
@@ -613,10 +616,12 @@
this.files = processResources(this.resources, isRecursing());
loadFiles();
} catch (CoreException e) {
- Activator.getDefault().log(new Status(Severity.ERROR, I18n.PublishPageRecurseProcessingErrorMsg, e));
+ Activator.getDefault().log(new Status(Severity.ERROR, RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
if (getControl().isVisible()) {
- MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, I18n.PublishPageRecurseProcessingErrorMsg);
+ MessageDialog.openError(getShell(),
+ RestClientI18n.errorDialogTitle.text(),
+ RestClientI18n.publishPageRecurseProcessingErrorMsg.text());
}
}
}
@@ -745,11 +750,11 @@
this.repositories = new ArrayList<Repository>(getServerManager().getRepositories(this.server));
} catch (Exception e) {
this.repositories = Collections.emptyList();
- String msg = I18n.bind(I18n.ServerManagerGetRepositoriesExceptionMsg, this.server.getShortDescription());
+ String msg = RestClientI18n.serverManagerGetRepositoriesExceptionMsg.text(this.server.getShortDescription());
Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
if (getControl().isVisible()) {
- MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, msg);
+ MessageDialog.openError(getShell(), RestClientI18n.errorDialogTitle.text(), msg);
}
}
}
@@ -857,11 +862,11 @@
this.workspaces = new ArrayList<Workspace>(getServerManager().getWorkspaces(this.repository));
} catch (Exception e) {
this.workspaces = Collections.emptyList();
- String msg = I18n.ServerManagerGetWorkspacesExceptionMsg;
+ String msg = RestClientI18n.serverManagerGetWorkspacesExceptionMsg.text();
Activator.getDefault().log(new Status(Severity.ERROR, msg, e));
if (getControl().isVisible()) {
- MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, msg);
+ MessageDialog.openError(getShell(), RestClientI18n.errorDialogTitle.text(), msg);
}
}
}
@@ -922,9 +927,8 @@
public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
// should only be a new server event
if (event.isNew()) {
- Server newServer = event.getServer();
- this.servers.add(newServer);
- this.cbxServer.add(newServer.getName());
+ refreshServers();
+ updateState();
}
return null;
@@ -949,7 +953,8 @@
// set initial message
if (this.status.isOk()) {
- String msg = ((this.type == Type.PUBLISH) ? I18n.PublishPagePublishOkStatusMsg : I18n.PublishPageUnpublishOkStatusMsg);
+ String msg = ((this.type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
setMessage(msg);
} else {
setErrorMessage(this.status.getMessage());
@@ -973,7 +978,7 @@
try {
this.files = processResources(this.resources, this.recurse);
} catch (CoreException e) {
- Activator.getDefault().log(new Status(Severity.ERROR, I18n.PublishPageRecurseProcessingErrorMsg, e));
+ Activator.getDefault().log(new Status(Severity.ERROR, RestClientI18n.publishPageRecurseProcessingErrorMsg.text(), e));
}
}
@@ -1007,7 +1012,7 @@
// update page message
if (this.status.isError()) {
- setMessage(this.status.getMessage(), IMessageProvider.ERROR);
+ setErrorMessage(this.status.getMessage());
} else {
if (this.status.isWarning()) {
setMessage(this.status.getMessage(), IMessageProvider.WARNING);
@@ -1029,19 +1034,24 @@
Severity severity = Severity.ERROR;
if ((this.resources == null) || this.resources.isEmpty() || this.files.isEmpty()) {
- msg = ((type == Type.PUBLISH) ? I18n.PublishPageNoResourcesToPublishStatusMsg : I18n.PublishPageNoResourcesToUnpublishStatusMsg);
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPageNoResourcesToPublishStatusMsg.text()
+ : RestClientI18n.publishPageNoResourcesToUnpublishStatusMsg.text());
} else if (this.server == null) {
int count = this.cbxServer.getItemCount();
- msg = ((count == 0) ? I18n.PublishPageNoAvailableServersStatusMsg : I18n.PublishPageMissingServerStatusMsg);
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableServersStatusMsg.text()
+ : RestClientI18n.publishPageMissingServerStatusMsg.text());
} else if (this.repository == null) {
int count = this.cbxRepository.getItemCount();
- msg = ((count == 0) ? I18n.PublishPageNoAvailableRepositoriesStatusMsg : I18n.PublishPageMissingRepositoryStatusMsg);
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableRepositoriesStatusMsg.text()
+ : RestClientI18n.publishPageMissingRepositoryStatusMsg.text());
} else if (this.workspace == null) {
int count = this.cbxWorkspace.getItemCount();
- msg = ((count == 0) ? I18n.PublishPageNoAvailableWorkspacesStatusMsg : I18n.PublishPageMissingWorkspaceStatusMsg);
+ msg = ((count == 0) ? RestClientI18n.publishPageNoAvailableWorkspacesStatusMsg.text()
+ : RestClientI18n.publishPageMissingWorkspaceStatusMsg.text());
} else {
severity = Severity.OK;
- msg = ((type == Type.PUBLISH) ? I18n.PublishPagePublishOkStatusMsg : I18n.PublishPageUnpublishOkStatusMsg);
+ msg = ((type == Type.PUBLISH) ? RestClientI18n.publishPagePublishOkStatusMsg.text()
+ : RestClientI18n.publishPageUnpublishOkStatusMsg.text());
}
this.status = new Status(severity, msg, null);
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishWizard.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -34,18 +34,17 @@
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.web.jcr.rest.client.ServerManager;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.dialogs.PublishingResultsDialog;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
- * @author Dan Florian
* @since 0.6
*/
public final class PublishWizard extends Wizard {
@@ -89,15 +88,16 @@
public PublishWizard( Type type,
List<IResource> resources,
ServerManager serverManager ) throws CoreException {
- Utils.nullArgumentCheck("type", type); //$NON-NLS-1$
- Utils.nullArgumentCheck("resources", resources); //$NON-NLS-1$
- Utils.nullArgumentCheck("serverManager", serverManager); //$NON-NLS-1$
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
+ CheckArg.isNotNull(resources, "resources"); //$NON-NLS-1$
+ CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
this.type = type;
this.page = new PublishPage(type, resources);
this.serverManager = serverManager;
- setWindowTitle((type == Type.PUBLISH) ? I18n.PublishWizardPublishTitle : I18n.PublishWizardUnpublishTitle);
+ setWindowTitle((type == Type.PUBLISH) ? RestClientI18n.publishWizardPublishTitle.text()
+ : RestClientI18n.publishWizardUnpublishTitle.text());
setDefaultPageImageDescriptor(Activator.getDefault().getImageDescriptor(DNA_WIZARD_BANNER_IMAGE_PATH));
}
@@ -181,7 +181,8 @@
error = ((InvocationTargetException)e).getTargetException();
}
- String message = (operation.isPublishing() ? I18n.PublishWizardPublishErrorMsg : I18n.PublishWizardUnpublishErrorMsg);
+ String message = (operation.isPublishing() ? RestClientI18n.publishWizardPublishErrorMsg.text()
+ : RestClientI18n.publishWizardUnpublishErrorMsg.text());
Activator.getDefault().log(new Status(Severity.ERROR, message, error));
}
} finally {
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/PublishingResults.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -26,14 +26,13 @@
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.Utils;
import org.jboss.dna.web.jcr.rest.client.Status.Severity;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
import org.jboss.dna.web.jcr.rest.client.swt.wizards.PublishOperation.Type;
/**
- * @author Dan Florian
* @since 0.6
*/
public final class PublishingResults {
@@ -48,7 +47,8 @@
* @since 0.6
*/
private static final Status PUBLISH_NOT_ATTEMPTED_STATUS = new Status(Severity.INFO,
- I18n.PublishingResultsPublishNotAttemptedMsg, null);
+ RestClientI18n.publishingResultsPublishNotAttemptedMsg.text(),
+ null);
/**
* Status indicating the file was not attempted to be published.
@@ -56,7 +56,8 @@
* @since 0.6
*/
private static final Status UNPUBLISH_NOT_ATTEMPTED_STATUS = new Status(Severity.INFO,
- I18n.PublishingResultsUnpublishNotAttemptedMsg, null);
+ RestClientI18n.publishingResultsUnpublishNotAttemptedMsg.text(),
+ null);
// ===========================================================================================================================
// Fields
@@ -123,14 +124,14 @@
// ===========================================================================================================================
/**
- * @param type the type of publishing operation
+ * @param type the type of publishing operation (never <code>null</code>)
* @param files the files involved in the publishing operation (never <code>null</code>)
* @since 0.6
*/
public PublishingResults( Type type,
List<IFile> files ) {
- Utils.nullArgumentCheck("type", type); //$NON-NLS-1$
- Utils.nullArgumentCheck("files", files); //$NON-NLS-1$
+ CheckArg.isNotNull(type, "type"); //$NON-NLS-1$
+ CheckArg.isNotNull(files, "files"); //$NON-NLS-1$
this.type = type;
this.files = files;
@@ -142,13 +143,15 @@
// ===========================================================================================================================
/**
- * @param status the status being added
+ * @param status the status being added (never <code>null</code>)
* @throws RuntimeException if the number of status objects is greater than the number of files
* @since 0.6
*/
public void addStatus( Status status ) {
+ CheckArg.isNotNull(status, "status"); //$NON-NLS-1$
+
if (this.files.size() < (this.statuses.size() + 1)) {
- throw new RuntimeException(I18n.PublishingResultsTooManyResultsMsg);
+ throw new RuntimeException(RestClientI18n.publishingResultsTooManyResultsMsg.text());
}
this.statuses.add(status);
@@ -157,7 +160,7 @@
else if (status.isInfo()) ++this.numInfos;
else if (status.isOk()) ++this.numOks;
else if (status.isWarning()) ++this.numWarnings;
- else throw new RuntimeException(I18n.bind(I18n.PublishingResultsUnknownSeverityMsg, status.getSeverity()));
+ else throw new RuntimeException(RestClientI18n.publishingResultsUnknownSeverityMsg.text(status.getSeverity()));
this.complete = (this.files.size() == this.statuses.size());
}
@@ -186,7 +189,7 @@
}
/**
- * @return the files involved in the publishing operation
+ * @return the files involved in the publishing operation (never <code>null</code>)
* @since 0.6
*/
public List<IFile> getFiles() {
@@ -215,7 +218,7 @@
* @since 0.6
*/
public Status getStatus( IFile file ) {
- Utils.nullArgumentCheck("file", file); //$NON-NLS-1$
+ CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
int index = this.files.indexOf(file);
if (index == -1) {
@@ -226,7 +229,8 @@
}
/**
- * @return the status of each file involved in the publishing operation
+ * @return the status of each file involved in the publishing operation (never <code>null</code> but can be incomplete)
+ * @see #isComplete()
* @since 0.6
*/
public List<Status> getStatuses() {
@@ -234,7 +238,7 @@
}
/**
- * @return the publishing operation type
+ * @return the publishing operation type (never <code>null</code>)
* @since 0.6
*/
public Type getType() {
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerPage.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -43,10 +43,9 @@
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.domain.validation.ServerValidator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
/**
- * @author Dan Florian
* @since 0.6
*/
public final class ServerPage extends WizardPage {
@@ -108,7 +107,7 @@
*/
public ServerPage() {
super(ServerPage.class.getSimpleName());
- setTitle(I18n.ServerPageTitle);
+ setTitle(RestClientI18n.serverPageTitle.text());
setPageComplete(false);
}
@@ -120,7 +119,7 @@
*/
public ServerPage( Server server ) {
super(ServerPage.class.getSimpleName());
- setTitle(I18n.ServerPageTitle);
+ setTitle(RestClientI18n.serverPageTitle.text());
this.server = server;
this.url = server.getUrl();
@@ -135,18 +134,18 @@
private void constructAuthenticationPanel( Composite parent ) {
Group pnl = new Group(parent, SWT.NONE);
- pnl.setText(I18n.ServerPageAuthenticationGroupTitle);
+ pnl.setText(RestClientI18n.serverPageAuthenticationGroupTitle.text());
pnl.setLayout(new GridLayout(2, false));
pnl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
{ // user row
Label lblUser = new Label(pnl, SWT.LEFT);
lblUser.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblUser.setText(I18n.ServerPageUserLabel);
+ lblUser.setText(RestClientI18n.serverPageUserLabel.text());
Text txtUser = new Text(pnl, SWT.BORDER);
txtUser.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- txtUser.setToolTipText(I18n.ServerPageUserToolTip);
+ txtUser.setToolTipText(RestClientI18n.serverPageUserToolTip.text());
// set initial value
if (this.user != null) {
@@ -164,11 +163,11 @@
{ // password row
Label lblPassword = new Label(pnl, SWT.LEFT);
lblPassword.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblPassword.setText(I18n.ServerPagePasswordLabel);
+ lblPassword.setText(RestClientI18n.serverPagePasswordLabel.text());
Text txtPassword = new Text(pnl, SWT.BORDER);
txtPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- txtPassword.setToolTipText(I18n.ServerPagePasswordToolTip);
+ txtPassword.setToolTipText(RestClientI18n.serverPagePasswordToolTip.text());
txtPassword.setEchoChar('*');
// set initial value before hooking up listener
@@ -189,8 +188,8 @@
final Button btn = new Button(pnl, SWT.CHECK | SWT.LEFT);
btn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
((GridData)btn.getLayoutData()).horizontalSpan = 2;
- btn.setText(I18n.ServerPageSavePasswordButton);
- btn.setToolTipText(I18n.ServerPageSavePasswordToolTip);
+ btn.setText(RestClientI18n.serverPageSavePasswordButton.text());
+ btn.setToolTipText(RestClientI18n.serverPageSavePasswordToolTip.text());
// set initial value before hooking up listeners
if (this.savePassword) {
@@ -221,7 +220,7 @@
lblImage.setImage(Display.getDefault().getSystemImage(SWT.ICON_INFORMATION));
StyledText st = new StyledText(pnl, SWT.READ_ONLY | SWT.MULTI | SWT.NO_FOCUS | SWT.WRAP);
- st.setText(I18n.ServerPageSavePasswordLabel);
+ st.setText(RestClientI18n.serverPageSavePasswordLabel.text());
st.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
st.setCaret(null);
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
@@ -240,11 +239,11 @@
Label lblUrl = new Label(pnl, SWT.LEFT);
lblUrl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- lblUrl.setText(I18n.ServerPageUrlLabel);
+ lblUrl.setText(RestClientI18n.serverPageUrlLabel.text());
Text txtUrl = new Text(pnl, SWT.BORDER);
txtUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- txtUrl.setToolTipText(I18n.ServerPageUrlToolTip);
+ txtUrl.setToolTipText(RestClientI18n.serverPageUrlToolTip.text());
// set initial value
if (this.url != null) {
@@ -286,7 +285,7 @@
}
// should never be called if error status
- throw new RuntimeException(I18n.ServerPageInvalidServerProperties);
+ throw new RuntimeException(RestClientI18n.serverPageInvalidServerProperties.text());
}
/**
@@ -344,7 +343,7 @@
* @since 0.6
*/
void updateInitialMessage() {
- if (I18n.ServerPageOkStatusMsg.equals(getMessage())) {
+ if (RestClientI18n.serverPageOkStatusMsg.text().equals(getMessage())) {
updateState();
}
}
@@ -364,7 +363,7 @@
validate();
// set initial message
- setMessage(I18n.ServerPageOkStatusMsg);
+ setMessage(RestClientI18n.serverPageOkStatusMsg.text());
}
}
@@ -389,7 +388,7 @@
} else if (this.status.isInfo()) {
setMessage(this.status.getMessage(), IMessageProvider.INFORMATION);
} else {
- setMessage(I18n.ServerPageOkStatusMsg);
+ setMessage(RestClientI18n.serverPageOkStatusMsg.text());
}
}
}
Modified: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerWizard.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerWizard.java 2009-08-10 18:34:03 UTC (rev 1159)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/ServerWizard.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -30,10 +30,9 @@
import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.domain.Server;
import org.jboss.dna.web.jcr.rest.client.swt.Activator;
-import org.jboss.dna.web.jcr.rest.client.swt.I18n;
+import org.jboss.dna.web.jcr.rest.client.swt.RestClientI18n;
/**
- * @author Dan Florian
* @since 0.6
*/
public final class ServerWizard extends Wizard {
@@ -78,7 +77,7 @@
this.serverManager = serverManager;
setDefaultPageImageDescriptor(Activator.getDefault().getImageDescriptor(DNA_WIZARD_BANNER_IMAGE_PATH));
- setWindowTitle(I18n.ServerWizardNewServerTitle);
+ setWindowTitle(RestClientI18n.serverWizardNewServerTitle.text());
}
/**
@@ -93,7 +92,7 @@
this.page = new ServerPage(server);
this.serverManager = serverManager;
this.existingServer = server;
- setWindowTitle(I18n.ServerWizardEditServerTitle);
+ setWindowTitle(RestClientI18n.serverWizardEditServerTitle.text());
}
// ===========================================================================================================================
@@ -134,13 +133,17 @@
status = this.serverManager.addServer(server);
if (status.isError()) {
- MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, I18n.ServerWizardEditServerErrorMsg);
+ MessageDialog.openError(getShell(),
+ RestClientI18n.errorDialogTitle.text(),
+ RestClientI18n.serverWizardEditServerErrorMsg.text());
}
} else if (!this.existingServer.equals(server)) {
status = this.serverManager.updateServer(this.existingServer, server);
if (status.isError()) {
- MessageDialog.openError(getShell(), I18n.ErrorDialogTitle, I18n.ServerWizardNewServerErrorMsg);
+ MessageDialog.openError(getShell(),
+ RestClientI18n.errorDialogTitle.text(),
+ RestClientI18n.serverWizardNewServerErrorMsg.text());
}
}
Added: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/package-info.java
===================================================================
--- branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/package-info.java (rev 0)
+++ branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/package-info.java 2009-08-10 21:31:32 UTC (rev 1160)
@@ -0,0 +1,28 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ * The JBoss DNA REST Client Eclipse wizards package defines the Eclipse wizards that are needed to publish, unpublish, and manage
+ * the server registry.
+ */
+package org.jboss.dna.web.jcr.rest.client.swt.wizards;
\ No newline at end of file
Property changes on: branches/eclipse/org.jboss.dna.publish.ui.swt/src/org/jboss/dna/web/jcr/rest/client/swt/wizards/package-info.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
DNA SVN: r1159 - in trunk/extensions: dna-web-jcr-rest-war and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-08-10 14:34:03 -0400 (Mon, 10 Aug 2009)
New Revision: 1159
Modified:
trunk/extensions/dna-web-jcr-rest-war/pom.xml
trunk/extensions/dna-web-jcr-rest/pom.xml
Log:
DNA-500 Corrected the POM file for the REST projects, which specified the version of SLF4J explicitly (rather than inheriting them from the parent POM
Modified: trunk/extensions/dna-web-jcr-rest/pom.xml
===================================================================
--- trunk/extensions/dna-web-jcr-rest/pom.xml 2009-08-06 23:11:43 UTC (rev 1158)
+++ trunk/extensions/dna-web-jcr-rest/pom.xml 2009-08-10 18:34:03 UTC (rev 1159)
@@ -49,7 +49,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.4.3</version>
+ <version>1.5.8</version>
<scope>runtime</scope>
</dependency>
<!--
Modified: trunk/extensions/dna-web-jcr-rest-war/pom.xml
===================================================================
--- trunk/extensions/dna-web-jcr-rest-war/pom.xml 2009-08-06 23:11:43 UTC (rev 1158)
+++ trunk/extensions/dna-web-jcr-rest-war/pom.xml 2009-08-10 18:34:03 UTC (rev 1159)
@@ -21,7 +21,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.4.3</version>
+ <version>1.5.8</version>
<scope>runtime</scope>
</dependency>
14 years, 9 months
DNA SVN: r1158 - trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-08-06 19:11:43 -0400 (Thu, 06 Aug 2009)
New Revision: 1158
Modified:
trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java
Log:
Fixed casing in test so that the test might possibly pass on a case-sensitive FS.
Modified: trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java 2009-08-06 22:08:01 UTC (rev 1157)
+++ trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java 2009-08-06 23:11:43 UTC (rev 1158)
@@ -149,7 +149,7 @@
System.out.println("Created new folder at: " + newFolder.getCanonicalPath());
graph.create("/testFolder/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
- graph.create("/testFolder/testfile/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
+ graph.create("/testFolder/testFile/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
TEST_CONTENT.getBytes()).orReplace().and();
File newFile = new File(testWorkspaceRoot, "testFolder/testFile");
14 years, 9 months
DNA SVN: r1157 - in trunk/extensions/dna-connector-filesystem/src: test/java/org/jboss/dna/connector/filesystem and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-08-06 18:08:01 -0400 (Thu, 06 Aug 2009)
New Revision: 1157
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java
Log:
Cleaned up exception handling, added debug message
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 20:41:42 UTC (rev 1156)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 22:08:01 UTC (rev 1157)
@@ -353,9 +353,9 @@
File parent = getExistingFileFor(workspace, parentPath, request.under(), request);
if (parent == null) {
- System.out.println(workspace.getPath() + " <=> " + parentPath.getString());
+ // Error was already set on request in getExistingFileFor
+ return;
}
- assert parent != null : workspace.getPath() + " <=> " + parentPath.getString();
NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
String newName = request.named().getString(registry);
Modified: trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java 2009-08-06 20:41:42 UTC (rev 1156)
+++ trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemConnectorWritableTest.java 2009-08-06 22:08:01 UTC (rev 1157)
@@ -46,15 +46,24 @@
public static final String ARBITRARY_PROPERTIES_NOT_SUPPORTED = "This connector does not support setting arbitrary properties";
- private static final String REPO_PATH = "./src/test/resources/repositories/";
+ private static final String REPO_PATH = "./target/repositories/";
+ private static final String REPO_SOURCE_PATH = "./src/test/resources/repositories/";
private final String TEST_CONTENT = "Test content";
protected File testWorkspaceRoot;
protected File otherWorkspaceRoot;
protected File newWorkspaceRoot;
+ protected File scratchDirectory;
@Override
- protected RepositorySource setUpSource() {
+ protected RepositorySource setUpSource() throws Exception {
+ // Copy the directories into the target ...
+ File sourceRepo = new File(REPO_SOURCE_PATH);
+ scratchDirectory = new File(REPO_PATH);
+ scratchDirectory.mkdirs();
+ FileUtil.delete(scratchDirectory);
+ FileUtil.copy(sourceRepo, scratchDirectory);
+
// Set the connection properties to be use the content of "./src/test/resources/repositories" as a repository ...
String[] predefinedWorkspaceNames = new String[] {"test", "otherWorkspace", "airplanes", "cars"};
FileSystemSource source = new FileSystemSource();
@@ -67,7 +76,7 @@
testWorkspaceRoot = new File(REPO_PATH, "test");
testWorkspaceRoot.mkdir();
-
+
otherWorkspaceRoot = new File(REPO_PATH, "otherWorkspace");
otherWorkspaceRoot.mkdir();
@@ -84,9 +93,8 @@
@Override
public void afterEach() throws Exception {
- FileUtil.delete(testWorkspaceRoot);
- FileUtil.delete(otherWorkspaceRoot);
- FileUtil.delete(newWorkspaceRoot);
+ FileUtil.delete(scratchDirectory);
+
super.afterEach();
}
@@ -132,13 +140,14 @@
}
@Test
- public void shouldBeAbleToAddChildrenToFolder() {
+ public void shouldBeAbleToAddChildrenToFolder() throws Exception {
graph.create("/testFolder").orReplace().and();
File newFolder = new File(testWorkspaceRoot, "testFolder");
assertThat(newFolder.exists(), is(true));
assertThat(newFolder.isDirectory(), is(true));
-
+ System.out.println("Created new folder at: " + newFolder.getCanonicalPath());
+
graph.create("/testFolder/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
graph.create("/testFolder/testfile/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
TEST_CONTENT.getBytes()).orReplace().and();
@@ -350,7 +359,7 @@
assertContents(newFile, TEST_CONTENT);
File newFile2 = new File(testWorkspaceRoot, "testFolder/testFile2");
assertContents(newFile2, TEST_CONTENT);
-
+
graph.move("/testFolder/testFile2").before("/testFolder/testFile");
}
@@ -418,7 +427,7 @@
newFile = new File(newWorkspaceRoot, "testFile");
assertContents(newFile, TEST_CONTENT);
-
+
}
@Test
14 years, 9 months
DNA SVN: r1156 - trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-08-06 16:41:42 -0400 (Thu, 06 Aug 2009)
New Revision: 1156
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
Log:
DNA-503 File system connector unit tests are failing
Manually merged DNA-503.patch to attempt to address Hudson failures.
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 17:42:22 UTC (rev 1155)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 20:41:42 UTC (rev 1156)
@@ -457,6 +457,7 @@
} finally {
try {
+ if (checkForContents != null) checkForContents.close();
checkForContents.close();
} catch (Exception ignore) {
}
@@ -535,10 +536,12 @@
if (!newFile.mkdir()) {
I18n msg = FileSystemI18n.couldNotCreateFile;
- request.setError(new RepositorySourceException(getSourceName(), msg.text(parent.getPath(),
- request.inWorkspace(),
- getSourceName(),
- primaryType.getString(registry))));
+ request.setError(new RepositorySourceException(
+ getSourceName(),
+ msg.text(parent.getPath(),
+ request.inWorkspace(),
+ getSourceName(),
+ primaryType == null ? "null" : primaryType.getString(registry))));
return;
}
} else {
14 years, 9 months
DNA SVN: r1155 - trunk/dna-graph/src/main/java/org/jboss/dna/graph.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-08-06 13:42:22 -0400 (Thu, 06 Aug 2009)
New Revision: 1155
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
Log:
Removed simulated synthetic access error by changing private variable to protected
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-08-06 15:31:03 UTC (rev 1154)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-08-06 17:42:22 UTC (rev 1155)
@@ -163,7 +163,7 @@
private final String sourceName;
private final RepositoryConnectionFactory connectionFactory;
- private final ExecutionContext context;
+ protected final ExecutionContext context;
protected final RequestBuilder requests;
protected final Conjunction<Graph> nextGraph;
private Workspace currentWorkspace;
@@ -4225,7 +4225,7 @@
* @return the interface for additional requests or actions
*/
Next as( Name newName );
-
+
/**
* Finish the request by specifying the name of the new child node. This method indicates that the child should be added
* as a new node with the given name at the end of the parents children
@@ -4233,7 +4233,7 @@
* @param newName the new name
* @return the interface for additional requests or actions
*/
- Next as( String newName );
+ Next as( String newName );
}
/**
14 years, 9 months
DNA SVN: r1154 - trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-08-06 11:31:03 -0400 (Thu, 06 Aug 2009)
New Revision: 1154
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
Log:
Expanded error message to get more info about Hudson failure
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 15:29:02 UTC (rev 1153)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 15:31:03 UTC (rev 1154)
@@ -352,6 +352,9 @@
assert workspace != null;
File parent = getExistingFileFor(workspace, parentPath, request.under(), request);
+ if (parent == null) {
+ System.out.println(workspace.getPath() + " <=> " + parentPath.getString());
+ }
assert parent != null : workspace.getPath() + " <=> " + parentPath.getString();
NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
14 years, 9 months
DNA SVN: r1153 - in trunk/extensions/dna-connector-filesystem/src/main: resources/org/jboss/dna/connector/filesystem and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-08-06 11:29:02 -0400 (Thu, 06 Aug 2009)
New Revision: 1153
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties
Log:
Expanded error message to get more info about Hudson failure
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 15:02:52 UTC (rev 1152)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java 2009-08-06 15:29:02 UTC (rev 1153)
@@ -1040,7 +1040,8 @@
if (len > maxPathLength - delta) {
String msg = FileSystemI18n.maxPathLengthExceeded.text(this.maxPathLength,
this.getSourceName(),
- root.getCanonicalPath());
+ root.getCanonicalPath(),
+ delta);
throw new RepositorySourceException(this.getSourceName(), msg);
}
Modified: trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties 2009-08-06 15:02:52 UTC (rev 1152)
+++ trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties 2009-08-06 15:29:02 UTC (rev 1153)
@@ -55,4 +55,4 @@
deleteFailed = Could not delete file at path "{0}" in workspace "{1}" in {2}
copyFailed = Could not copy file at path "{0}" in workspace "{1}" to path "{2}" in workspace "{3}" in {4}
getCanonicalPathFailed = Could not determine canonical path
-maxPathLengthExceeded = The maximum absolute path length ({0}) for source "{1}" was exceeded by the node at: {2}
+maxPathLengthExceeded = The maximum absolute path length ({0}) for source "{1}" was exceeded by the node at: {2} ({3})
14 years, 9 months