import org.argeo.ArgeoException;
import org.argeo.jcr.JcrUtils;
+import org.argeo.slc.SlcConstants;
import org.argeo.slc.client.ui.dist.DistPlugin;
import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
import org.argeo.slc.repo.RepoUtils;
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/addItem.gif");
-// public final static String DEFAULT_ICON_PATH = "icons/addItem.gif";
-
// DEPENDENCY INJECTION
private RepositoryFactory repositoryFactory;
private Keyring keyring;
private Repository nodeRepository;
- private String slcRole = "ROLE_SLC";
-
public Object execute(ExecutionEvent event) throws ExecutionException {
String targetRepoPath = event.getParameter(PARAM_TARGET_REPO_PATH);
Node newRootNode = newSession.getRootNode();
RepoUtils.copy(srcRootNode, newRootNode);
newSession.save();
- JcrUtils.addPrivilege(newSession, "/", slcRole, Privilege.JCR_ALL);
+ JcrUtils.addPrivilege(newSession, "/", SlcConstants.ROLE_SLC,
+ Privilege.JCR_ALL);
CommandHelpers.callCommand(RefreshDistributionsView.ID);
} catch (RepositoryException re) {
throw new ArgeoException(
import org.apache.commons.logging.LogFactory;
import org.argeo.eclipse.ui.ErrorFeedback;
import org.argeo.jcr.JcrUtils;
+import org.argeo.slc.SlcConstants;
import org.argeo.slc.client.ui.dist.DistPlugin;
import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
import org.argeo.slc.repo.RepoUtils;
public class CreateWorkspace extends AbstractHandler {
private static final Log log = LogFactory.getLog(CreateWorkspace.class);
+
+ // Exposes commands meta-info
public final static String ID = DistPlugin.ID + ".createWorkspace";
- public final static String PARAM_TARGET_REPO_PATH = "targetRepoPath";
- public final static String PARAM_WORKSPACE_PREFIX = "workspacePrefix";
public final static String DEFAULT_LABEL = "Create workspace...";
-
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/addItem.gif");
- // public final static String DEFAULT_ICON_PATH = "icons/addItem.gif";
-
- private String slcRole = "ROLE_SLC";
+ // Parameters
+ public final static String PARAM_TARGET_REPO_PATH = "targetRepoPath";
+ public final static String PARAM_WORKSPACE_PREFIX = "workspacePrefix";
// DEPENDENCY INJECTION
private RepositoryFactory repositoryFactory;
JcrUtils.logoutQuietly(session);
// init new workspace
session = repository.login(credentials, workspaceName);
- JcrUtils.addPrivilege(session, "/", slcRole, Privilege.JCR_ALL);
+ JcrUtils.addPrivilege(session, "/", SlcConstants.ROLE_SLC,
+ Privilege.JCR_ALL);
CommandHelpers.callCommand(RefreshDistributionsView.ID);
if (log.isTraceEnabled())
log.trace("WORKSPACE " + workspaceName + " CREATED");
/**
* Delete chosen artifacts from the current workspace.
*/
-
public class DeleteArtifacts extends AbstractHandler {
// private static final Log log = LogFactory.getLog(DeleteWorkspace.class);
+
public final static String ID = DistPlugin.ID + ".deleteArtifacts";
public final static String DEFAULT_LABEL = "Delete selected items";
- // public final static String DEFAULT_ICON_PATH = "icons/removeItem.gif";
-
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/removeItem.gif");
-
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IWorkbenchPart activePart = DistPlugin.getDefault().getWorkbench()
String msg = "Your are about to definitively remove the "
+ ((IStructuredSelection) selector).size()
+ " selected artifacts.\n"
- + "Are you sure you want to proceed ?";
+ + "Are you sure you want to proceed?";
boolean result = MessageDialog.openConfirm(DistPlugin
.getDefault().getWorkbench().getDisplay()
- .getActiveShell(), "Confirm Delete", msg);
+ .getActiveShell(), "Confirm Deletion", msg);
if (result) {
while (it.hasNext()) {
* removing all nodes of type {@code NodeType.NT_FOLDER} and
* {@code NodeType.NT_UNSTRUCTURED}
*/
-
public class DeleteWorkspace extends AbstractHandler {
// private static final Log log = LogFactory.getLog(DeleteWorkspace.class);
public final static String ID = DistPlugin.ID + ".deleteWorkspace";
public final static String DEFAULT_LABEL = "Clear";
- // public final static String DEFAULT_ICON_PATH = "icons/removeItem.gif";
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/removeItem.gif");
Session nodeSession = null;
Session session = null;
-
try {
nodeSession = nodeRepository.login();
Node repoNode = nodeSession.getNode(targetRepoPath);
keyring, repoNode);
String msg = "Your are about to completely delete workspace ["
- + workspaceName + "].\n Do you really want to proceed ?";
+ + workspaceName + "].\n Do you really want to proceed?";
boolean result = MessageDialog.openConfirm(DistPlugin.getDefault()
.getWorkbench().getDisplay().getActiveShell(),
"Confirm workspace deletion", msg);
// msg =
// "There is no possible turning back, are your REALLY sure you want to proceed ?";
msg = "WARNING: \nCurrent Jackrabbit version used does "
- + "not support workspace management.\n"
+ + "not support workspace deletion.\n"
+ "Thus, the workspace will only be cleaned so "
+ "that you can launch fetch process again.\n\n"
- + "Do you still want to proceed ?";
+ + "Do you still want to proceed?";
result = MessageDialog.openConfirm(DistPlugin.getDefault()
.getWorkbench().getDisplay().getActiveShell(),
"Confirm workspace deletion", msg);
if (result) {
session = repository.login(credentials, workspaceName);
-
// TODO use this with a newer version of Jackrabbit
// Workspace wsp = session.getWorkspace();
// wsp.deleteWorkspace(workspaceName);
-
NodeIterator nit = session.getRootNode().getNodes();
while (nit.hasNext()) {
Node node = nit.nextNode();
import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Create a new empty workspace in the current repository.
+ * Opens a popup that displays various information on the current reppository.
*/
-
public class DisplayRepoInformation extends AbstractHandler {
public final static String ID = DistPlugin.ID + ".displayRepoInformation";
- public final static String DEFAULT_LABEL = "Repository infos...";
+ public final static String DEFAULT_LABEL = "Repository infos";
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/help.gif");
- // public final static String DEFAULT_ICON_PATH = "icons/help.gif";
-
public Object execute(ExecutionEvent event) throws ExecutionException {
-
IStructuredSelection iss = (IStructuredSelection) HandlerUtil
.getActiveSite(event).getSelectionProvider().getSelection();
-
if (iss.getFirstElement() instanceof RepoElem) {
RepoElem re = (RepoElem) iss.getFirstElement();
InformationDialog inputDialog = new InformationDialog(HandlerUtil
inputDialog.readOnlyBtn.setSelection(re.isReadOnly());
} catch (RepositoryException e) {
throw new SlcException("Unexpected error while "
- + "getting repository infos.", e);
+ + "getting repository information.", e);
} finally {
JcrUtils.logoutQuietly(session);
}
return null;
}
- public class InformationDialog extends Dialog {
+ private class InformationDialog extends Dialog {
Text nameTxt;
Text uriTxt;
Text loginTxt;
}
protected Control createDialogArea(Composite parent) {
-
Composite dialogarea = (Composite) super.createDialogArea(parent);
dialogarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
true));
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
-/** Wraps a {@link RepoSync} as an Eclipse command. */
+/**
+ * Wrap a {@link RepoSync} as an Eclipse command. Open a wizard that enable
+ * definition of the fetch process parameters
+ */
public class Fetch extends AbstractHandler {
// private final static Log log = LogFactory.getLog(Fetch.class);
public final static String ID = DistPlugin.ID + ".fetch";
- public final static String PARAM_TARGET_REPO_PATH = "targetRepoPath";
public final static String DEFAULT_LABEL = "Fetch...";
- // public final static String DEFAULT_ICON_PATH = "icons/fetchRepo.png";
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/fetchRepo.png");
+ public final static String PARAM_TARGET_REPO_PATH = "targetRepoPath";
+
// DEPENDENCY INJECTION
private Keyring keyring;
private RepositoryFactory repositoryFactory;
CommandHelpers.callCommand(RefreshDistributionsView.ID);
return null;
} catch (RepositoryException e) {
- throw new SlcException("Unexpected error while fetching data", e);
+ throw new SlcException("Unable te retrieve repo node from path", e);
} finally {
JcrUtils.logoutQuietly(currSession);
}
import javax.jcr.Session;
import org.argeo.ArgeoException;
+import org.argeo.jcr.JcrUtils;
import org.argeo.slc.client.ui.dist.DistPlugin;
import org.argeo.slc.client.ui.dist.wizards.ChangeRightsWizard;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Open a dialog to change rights on the root node of the current workspace.
+ * Open a dialog to manage rights on the current workspace's root node.
*/
-
public class ManageWorkspaceAuth extends AbstractHandler {
// private static final Log log =
// LogFactory.getLog(ManageWorkspaceAuth.class);
public final static String ID = DistPlugin.ID + ".manageWorkspaceAuth";
- public final static String PARAM_WORKSPACE_NAME = DistPlugin.ID
- + ".workspaceName";
public final static String DEFAULT_LABEL = "Manage Rights";
- // public final static String DEFAULT_ICON_PATH = "icons/changeRights.gif";
public final static ImageDescriptor DEFAULT_ICON = DistPlugin
.getImageDescriptor("icons/changeRights.gif");
+ public final static String PARAM_WORKSPACE_NAME = DistPlugin.ID
+ + ".workspaceName";
/* DEPENDENCY INJECTION */
private Repository repository;
-
private Session session;
public Object execute(ExecutionEvent event) throws ExecutionException {
dialog.open();
return null;
} catch (RepositoryException re) {
- throw new ArgeoException(
- "Unexpected error while creating the new workspace.", re);
+ throw new ArgeoException("Cannot log in the repository "
+ + repository + " in workspace " + workspaceName, re);
} finally {
- if (session != null)
- session.logout();
+ JcrUtils.logoutQuietly(session);
}
}
/**
* Merge two workspaces
*/
-
public class MergeWorkspaces extends AbstractHandler {
private final static Log log = LogFactory.getLog(MergeWorkspaces.class);
public final static String ID = DistPlugin.ID + ".mergeWorkspaces";
public final static String DEFAULT_LABEL = "Merge";
+
public final static String PARAM_SOURCE_WORKSPACE_NAME = "srcWkspName";
public final static String PARAM_SOURCE_REPO_PATH = "srcRepoPath";
public final static String PARAM_TARGET_WORKSPACE_NAME = "targetWkspName";
private Repository nodeRepository;
public Object execute(ExecutionEvent event) throws ExecutionException {
-
String targetRepoPath = event.getParameter(PARAM_TARGET_REPO_PATH);
String targetWkspName = event.getParameter(PARAM_TARGET_WORKSPACE_NAME);
String sourceRepoPath = event.getParameter(PARAM_SOURCE_REPO_PATH);