import javax.jcr.Node;
import javax.jcr.RepositoryException;
-import javax.jcr.Session;
import org.argeo.cms.ui.workbench.WorkbenchUiPlugin;
import org.argeo.cms.ui.workbench.internal.jcr.model.SingleJcrNodeElem;
import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Canonically call JCR {@link Session#exportSystemView()} on the first element
- * returned by {@link HandlerUtil#getActiveWorkbenchWindow()}
+ * Canonically call JCR Session#exportSystemView() on the first element returned
+ * by HandlerUtil#getActiveWorkbenchWindow()
* (...getActivePage().getSelection()), if it is a {@link SingleJcrNodeElem},
- * with both skipBinary & noRecurse boolean flags set to false.
+ * with both skipBinary and noRecurse boolean flags set to false.
*
* Resulting stream is saved in a tmp file and opened via the {@link OpenFile}
* single-sourced command.
import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Canonically call JCR {@link Session#move(String, String)} on the first
- * element returned by {@link HandlerUtil#getActiveWorkbenchWindow()}
+ * Canonically call JCR Session#move(String, String) on the first element
+ * returned by HandlerUtil#getActiveWorkbenchWindow()
* (...getActivePage().getSelection()), if it is a {@link SingleJcrNodeElem}.
* The user must then fill a new name in and confirm
*/
public final static String ID = WorkbenchUiPlugin.PLUGIN_ID + ".renameNode";
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPage iwp = HandlerUtil.getActiveWorkbenchWindow(event)
- .getActivePage();
+ IWorkbenchPage iwp = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
ISelection selection = iwp.getSelection();
if (selection == null || !(selection instanceof IStructuredSelection))
String oldPath = null;
try {
newName = SingleValue.ask("New node name",
- "Please provide a new name for [" + node.getName()
- + "]");
+ "Please provide a new name for [" + node.getName() + "]");
// TODO sanity check and user feedback
newName = JcrUtils.replaceInvalidChars(newName);
oldPath = node.getPath();
session = node.getSession();
- session.move(oldPath, JcrUtils.parentPath(oldPath) + "/"
- + newName);
+ session.move(oldPath, JcrUtils.parentPath(oldPath) + "/" + newName);
session.save();
// Manually refresh the browser view. Must be enhanced
if (iwp.getActivePart() instanceof JcrBrowserView)
((JcrBrowserView) iwp.getActivePart()).refresh(sjn);
} catch (RepositoryException e) {
- throw new EclipseUiException("Unable to rename " + node
- + " to " + newName, e);
+ throw new EclipseUiException("Unable to rename " + node + " to " + newName, e);
}
}
}
/**
* UI Tree component that wraps a JCR {@link Repository}. It also keeps a reference
- * to its parent Tree Ui component; typically the unique {@link Repositories}
+ * to its parent Tree Ui component; typically the unique {@link RepositoriesElem}
* object of the current view to enable bi-directionnal browsing in the tree.
*/
protected Repository repository;
private Session defaultSession = null;
- /** Create a new repository with distinct name & alias */
+ /** Create a new repository with distinct name and alias */
public RepositoryElem(String alias, Repository repository, TreeParent parent) {
super(alias);
this.repository = repository;
/** Executes any JCR query. */
public abstract class AbstractJcrQueryEditor extends EditorPart {
- private final static Log log = LogFactory
- .getLog(AbstractJcrQueryEditor.class);
+ private final static Log log = LogFactory.getLog(AbstractJcrQueryEditor.class);
protected String initialQuery;
protected String initialQueryType;
protected abstract void createQueryForm(Composite parent);
@Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
JcrQueryEditorInput editorInput = (JcrQueryEditorInput) input;
initialQuery = editorInput.getQuery();
initialQueryType = editorInput.getQueryType();
sashForm.setWeights(getWeights());
viewer = new TableViewer(bottom);
- viewer.getTable().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
+ viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
viewer.getTable().setHeaderVisible(true);
viewer.setContentProvider(getQueryResultContentProvider());
viewer.setInput(getEditorSite());
if (log.isDebugEnabled())
log.debug("Query : " + statement);
- QueryResult qr = session.getWorkspace().getQueryManager()
- .createQuery(statement, initialQueryType).execute();
+ QueryResult qr = session.getWorkspace().getQueryManager().createQuery(statement, initialQueryType)
+ .execute();
// remove previous columns
for (TableViewerColumn tvc : tableViewerColumns)
}
} catch (RepositoryException e) {
- ErrorDialog.openError(null, "Error", "Cannot execute JCR query: "
- + statement, new Status(IStatus.ERROR,
- "org.argeo.eclipse.ui.jcr", e.getMessage()));
+ ErrorDialog.openError(null, "Error", "Cannot execute JCR query: " + statement,
+ new Status(IStatus.ERROR, "org.argeo.eclipse.ui.jcr", e.getMessage()));
}
}
/**
* To be overridden in order to configure the columns.
*
- * @deprecated use {@link
- * org.argeo.eclipse.ui.jcr.editors.AbstractJcrQueryEditor.
- * configureColumn(String jcrColumnName, TableViewerColumn
- * column, int columnIndex)} instead
+ * @deprecated use
+ * {@link AbstractJcrQueryEditor#configureColumn(String, TableViewerColumn , int )}
+ * instead
*/
- protected void configureColumn(String jcrColumnName,
- TableViewerColumn column) {
+ protected void configureColumn(String jcrColumnName, TableViewerColumn column) {
column.getColumn().setWidth(50);
column.getColumn().setText(jcrColumnName);
}
/** To be overridden in order to configure the columns. */
- protected void configureColumn(String jcrColumnName,
- TableViewerColumn column, int columnIndex) {
+ protected void configureColumn(String jcrColumnName, TableViewerColumn column, int columnIndex) {
column.getColumn().setWidth(50);
column.getColumn().setText(jcrColumnName);
}
- private class QueryResultContentProvider implements
- IStructuredContentProvider {
+ private class QueryResultContentProvider implements IStructuredContentProvider {
private static final long serialVersionUID = -5421095459600554741L;
public void dispose() {
* @param index
* @return
*/
- protected SelectionAdapter getSelectionAdapter(final TableColumn column,
- final int index) {
+ protected SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
// A comparator must be define
if (comparator == null)
getManagedForm().addPart(part);
}
- /** Filtered table with members. Has drag & drop ability */
+ /** Filtered table with members. Has drag and drop ability */
protected void appendMembersPart(Composite parent, Group group) {
FormToolkit tk = getManagedForm().getToolkit();
*
* Note: that this method should be called with a false show command flag to
* remove a contribution that have been previously contributed
- *
- * @param menuManager
- * @param locator
- * @param cmdId
- * @param label
- * @param icon
- * @param showCommand
*/
- public static void refreshCommand(IMenuManager menuManager,
- IServiceLocator locator, String cmdId, String label,
+ public static void refreshCommand(IMenuManager menuManager, IServiceLocator locator, String cmdId, String label,
ImageDescriptor icon, boolean showCommand) {
- refreshParameterizedCommand(menuManager, locator, cmdId, label, icon,
- showCommand, null);
+ refreshParameterizedCommand(menuManager, locator, cmdId, label, icon, showCommand, null);
}
/**
* parameters in a context menu
*
* The command ID is used has contribution item ID
- *
- * @param menuManager
- * @param locator
- * @param cmdId
- * @param label
- * @param iconPath
- * @param showCommand
*/
- public static void refreshParameterizedCommand(IMenuManager menuManager,
- IServiceLocator locator, String cmdId, String label,
- ImageDescriptor icon, boolean showCommand,
- Map<String, String> params) {
- refreshParameterizedCommand(menuManager, locator, cmdId, cmdId, label,
- icon, showCommand, params);
+ public static void refreshParameterizedCommand(IMenuManager menuManager, IServiceLocator locator, String cmdId,
+ String label, ImageDescriptor icon, boolean showCommand, Map<String, String> params) {
+ refreshParameterizedCommand(menuManager, locator, cmdId, cmdId, label, icon, showCommand, params);
}
/**
* @param showCommand
* @param params
*/
- public static void refreshParameterizedCommand(IMenuManager menuManager,
- IServiceLocator locator, String contributionId, String commandId,
- String label, ImageDescriptor icon, boolean showCommand,
+ public static void refreshParameterizedCommand(IMenuManager menuManager, IServiceLocator locator,
+ String contributionId, String commandId, String label, ImageDescriptor icon, boolean showCommand,
Map<String, String> params) {
IContributionItem ici = menuManager.find(contributionId);
if (ici != null)
menuManager.remove(ici);
if (showCommand) {
- CommandContributionItemParameter contributionItemParameter = new CommandContributionItemParameter(
- locator, null, commandId, SWT.PUSH);
+ CommandContributionItemParameter contributionItemParameter = new CommandContributionItemParameter(locator,
+ null, commandId, SWT.PUSH);
// Set Params
contributionItemParameter.label = label;
if (params != null)
contributionItemParameter.parameters = params;
- CommandContributionItem cci = new CommandContributionItem(
- contributionItemParameter);
+ CommandContributionItem cci = new CommandContributionItem(contributionItemParameter);
cci.setId(contributionId);
menuManager.add(cci);
}
}
/** Helper to call a command with a single parameter easily */
- public static void callCommand(String commandID, String parameterID,
- String parameterValue) {
+ public static void callCommand(String commandID, String parameterID, String parameterValue) {
Map<String, String> params = new HashMap<String, String>();
params.put(parameterID, parameterValue);
callCommand(commandID, params);
* a map that links various command IDs with corresponding String
* values.
*/
- public static void callCommand(String commandID,
- Map<String, String> paramMap) {
+ public static void callCommand(String commandID, Map<String, String> paramMap) {
try {
IWorkbench iw = WorkbenchUiPlugin.getDefault().getWorkbench();
- IHandlerService handlerService = (IHandlerService) iw
- .getService(IHandlerService.class);
- ICommandService cmdService = (ICommandService) iw
- .getActiveWorkbenchWindow().getService(
- ICommandService.class);
+ IHandlerService handlerService = (IHandlerService) iw.getService(IHandlerService.class);
+ ICommandService cmdService = (ICommandService) iw.getActiveWorkbenchWindow()
+ .getService(ICommandService.class);
Command cmd = cmdService.getCommand(commandID);
ArrayList<Parameterization> parameters = null;
Parameterization parameterization;
for (String id : paramMap.keySet()) {
- parameterization = new Parameterization(
- cmd.getParameter(id), paramMap.get(id));
+ parameterization = new Parameterization(cmd.getParameter(id), paramMap.get(id));
parameters.add(parameterization);
}
- pc = new ParameterizedCommand(cmd,
- parameters.toArray(new Parameterization[parameters
- .size()]));
+ pc = new ParameterizedCommand(cmd, parameters.toArray(new Parameterization[parameters.size()]));
} else
pc = new ParameterizedCommand(cmd, null);
// execute the command
handlerService.executeCommand(pc, null);
} catch (Exception e) {
- throw new EclipseUiException("Unexpected error while"
- + " calling the command " + commandID, e);
+ throw new EclipseUiException("Unexpected error while" + " calling the command " + commandID, e);
}
}
}
private static String AMPERSAND = "&";
/**
- * Cleans a String by replacing any '&' by its HTML encoding '&' to
+ * Cleans a String by replacing any '&' by its HTML encoding '&#38;' to
* avoid <code>SAXParseException</code> while rendering HTML with RWT
*/
public static String replaceAmpersand(String value) {
/** Read and write access to images. */
public interface CmsImageManager {
/** Load image in control */
- public Boolean load(Node node, Control control, Point size)
- throws RepositoryException;
+ public Boolean load(Node node, Control control, Point size) throws RepositoryException;
/** @return (0,0) if not available */
public Point getImageSize(Node node) throws RepositoryException;
/**
- * The related <img tag, with src, width and height set. @return null if not
- * available
+ * The related <img> tag, with src, width and height set.
+ *
+ * @return null if not available
*/
public String getImageTag(Node node) throws RepositoryException;
/**
- * The related <img tag, with url, width and height set. Caller must close
- * the tag (or add additional attributes). @return null if not available
+ * The related <img> tag, with url, width and height set. Caller must
+ * close the tag (or add additional attributes).
+ *
+ * @return null if not available
*/
- public StringBuilder getImageTagBuilder(Node node, Point size)
- throws RepositoryException;
+ public StringBuilder getImageTagBuilder(Node node, Point size) throws RepositoryException;
/**
* Returns the remotely accessible URL of the image (registering it if
public Image getSwtImage(Node node) throws RepositoryException;
/** @return URL */
- public String uploadImage(Node parentNode, String fileName, InputStream in)
- throws RepositoryException;
+ public String uploadImage(Node parentNode, String fileName, InputStream in) throws RepositoryException;
}
*
* @param parent
* the parent composite
- * @param a
- * context node or null
+ * @param context
+ * a context node (holding the JCR underlying session), or null
*/
- public Control createUi(Composite parent, Node context)
- throws RepositoryException;
+ public Control createUi(Composite parent, Node context) throws RepositoryException;
}
/**
* A composite that can populate itself based on {@link Callback}s. It can be
* used directly as a {@link CallbackHandler} or be used by one by calling the
- * {@link #createCallbackHandlers(Callback[])}.
- * <p>
- * Supported standard {@link Callback}s are:<br>
+ * {@link #createCallbackHandlers(Callback[])}. Supported standard
+ * {@link Callback}s are:<br>
* <ul>
* <li>{@link PasswordCallback}</li>
* <li>{@link NameCallback}</li>
* <li>{@link TextOutputCallback}</li>
* </ul>
- * </p>
- * <p>
* Supported Argeo {@link Callback}s are:<br>
* <ul>
* <li>{@link LocaleChoice}</li>
* </ul>
- * </p>
*/
-public class CompositeCallbackHandler extends Composite implements
- CallbackHandler {
+public class CompositeCallbackHandler extends Composite implements CallbackHandler {
private static final long serialVersionUID = -928223893722723777L;
private boolean wasUsedAlready = false;
}
@Override
- public synchronized void handle(final Callback[] callbacks)
- throws IOException, UnsupportedCallbackException {
+ public synchronized void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
// reset
if (wasUsedAlready && !isSubmitted() && !isCanceled()) {
cancel();
if (!wasUsedAlready)
wasUsedAlready = true;
-// while (!isSubmitted() && !isCanceled()) {
-// try {
-// wait(1000l);
-// } catch (InterruptedException e) {
-// // silent
-// }
-// }
+ // while (!isSubmitted() && !isCanceled()) {
+ // try {
+ // wait(1000l);
+ // } catch (InterruptedException e) {
+ // // silent
+ // }
+ // }
-// cleanCallbacksAfterCancel(callbacks);
+ // cleanCallbacksAfterCancel(callbacks);
}
- public void checkCallbackSupported(Callback callback)
- throws UnsupportedCallbackException {
- if (callback instanceof TextOutputCallback
- || callback instanceof NameCallback
- || callback instanceof PasswordCallback
- || callback instanceof LocaleChoice) {
+ public void checkCallbackSupported(Callback callback) throws UnsupportedCallbackException {
+ if (callback instanceof TextOutputCallback || callback instanceof NameCallback
+ || callback instanceof PasswordCallback || callback instanceof LocaleChoice) {
return;
} else {
throw new UnsupportedCallbackException(callback);
for (int i = 0; i < callbacks.length; i++) {
Callback callback = callbacks[i];
if (callback instanceof TextOutputCallback) {
- createLabelTextoutputHandler(composite,
- (TextOutputCallback) callback);
+ createLabelTextoutputHandler(composite, (TextOutputCallback) callback);
} else if (callback instanceof NameCallback) {
createNameHandler(composite, (NameCallback) callback);
} else if (callback instanceof PasswordCallback) {
}
}
- protected Text createNameHandler(Composite composite,
- final NameCallback callback) {
+ protected Text createNameHandler(Composite composite, final NameCallback callback) {
Label label = new Label(composite, SWT.NONE);
label.setText(callback.getPrompt());
- final Text text = new Text(composite, SWT.SINGLE | SWT.LEAD
- | SWT.BORDER);
+ final Text text = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER);
if (callback.getDefaultName() != null) {
// set default value, if provided
text.setText(callback.getDefaultName());
return text;
}
- protected Text createPasswordHandler(Composite composite,
- final PasswordCallback callback) {
+ protected Text createPasswordHandler(Composite composite, final PasswordCallback callback) {
Label label = new Label(composite, SWT.NONE);
label.setText(callback.getPrompt());
- final Text passwordText = new Text(composite, SWT.SINGLE | SWT.LEAD
- | SWT.PASSWORD | SWT.BORDER);
- passwordText
- .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ final Text passwordText = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.PASSWORD | SWT.BORDER);
+ passwordText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
passwordText.addModifyListener(new ModifyListener() {
private static final long serialVersionUID = -7099363995047686732L;
return passwordText;
}
- protected Combo createLocaleHandler(Composite composite,
- final LocaleChoice callback) {
+ protected Combo createLocaleHandler(Composite composite, final LocaleChoice callback) {
String[] labels = callback.getSupportedLocalesLabels();
if (labels.length == 0)
return null;
return combo;
}
- protected Label createLabelTextoutputHandler(Composite composite,
- final TextOutputCallback callback) {
+ protected Label createLabelTextoutputHandler(Composite composite, final TextOutputCallback callback) {
Label label = new Label(composite, SWT.NONE);
label.setText(callback.getMessage());
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
* Programatically configured VFS file system manager which can be declared as a
* bean and associated with a life cycle (methods
* {@link DefaultFileSystemManager#init()} and
- * {@link DefaultFileSystemManager#closet()}). Supports bz2, file, ram, gzip,
+ * {@link DefaultFileSystemManager#close()}). Supports bz2, file, ram, gzip,
* ftp, sftp
*/
public class BackupFileSystemManager extends DefaultFileSystemManager {
private final static Log log = LogFactory.getLog(AbstractSystemExecution.class);
private final Subject subject = new Subject();
- /**
- * Authenticate the calling thread to the underlying
- * {@link AuthenticationManager}
- */
+ /** Authenticate the calling thread */
protected void authenticateAsSystem() {
ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
/**
* TootlTip support is supported only for {@link AbstractTableViewer} in RAP
- *
- * @see ColumnViewerToolTipSupport#enableFor(AbstractTableViewer)
*/
public static void enableToolTipSupport(Viewer viewer) {
if (viewer instanceof AbstractTableViewer)
/**
* Creates an instance of a sorter for TableViewer.
*
- * @param defaultColumn
+ * @param defaultColumnIndex
* the default sorter column
*/
/**
* Implements a FileProvider for UI purposes. Note that it might not be very
- * reliable as long as we have not fixed login & multi repository issues that
+ * reliable as long as we have not fixed login and multi repository issues that
* will be addressed in the next version.
*
* NOTE: id used here is the real id of the JCR Node, not the JCR Path
* and thus have the ability to get the file node corresponding to a given
* file ID
*
- * FIXME : this introduces some concurrences ISSUES.
- *
- * @param repositoryNode
+ * @param refNode
*/
public void setReferenceNode(Node refNode) {
+ // FIXME : this introduces some concurrency ISSUES.
this.refNode = refNode;
}
- /**
- * Must be set in order for the provider to be able to search the repository
- * Provided object might be either JCR Nodes or UI RepositoryNode for the
- * time being.
- *
- * @param repositoryNode
- */
- // public void setRootNodes(Object[] rootNodes) {
- // List<Object> tmpNodes = new ArrayList<Object>();
- // for (int i = 0; i < rootNodes.length; i++) {
- // Object obj = rootNodes[i];
- // if (obj instanceof Node) {
- // tmpNodes.add(obj);
- // } else if (obj instanceof RepositoryRegister) {
- // RepositoryRegister repositoryRegister = (RepositoryRegister) obj;
- // Map<String, Repository> repositories = repositoryRegister
- // .getRepositories();
- // for (String name : repositories.keySet()) {
- // // tmpNodes.add(new RepositoryNode(name, repositories
- // // .get(name)));
- // }
- //
- // }
- // }
- // this.rootNodes = tmpNodes.toArray();
- // }
-
public byte[] getByteArrayFileFromId(String fileId) {
InputStream fis = null;
byte[] ba = null;
Node child = getFileNodeFromId(fileId);
try {
- fis = (InputStream) child.getProperty(Property.JCR_DATA)
- .getBinary().getStream();
+ fis = (InputStream) child.getProperty(Property.JCR_DATA).getBinary().getStream();
ba = IOUtils.toByteArray(fis);
} catch (Exception e) {
InputStream fis = null;
Node child = getFileNodeFromId(fileId);
- fis = (InputStream) child.getProperty(Property.JCR_DATA)
- .getBinary().getStream();
+ fis = (InputStream) child.getProperty(Property.JCR_DATA).getBinary().getStream();
return fis;
} catch (RepositoryException re) {
- throw new EclipseUiException("Cannot get stream from file node for Id "
- + fileId, re);
+ throw new EclipseUiException("Cannot get stream from file node for Id " + fileId, re);
}
}
throw new EclipseUiException("File node not found for ID" + fileId);
Node child = null;
-
+
boolean isValid = true;
- if (!result.isNodeType(NodeType.NT_FILE))
+ if (!result.isNodeType(NodeType.NT_FILE))
// useless: mandatory child node
- // || !result.hasNode(Property.JCR_CONTENT))
+ // || !result.hasNode(Property.JCR_CONTENT))
isValid = false;
else {
child = result.getNode(Property.JCR_CONTENT);
- if (!(child.isNodeType(NodeType.NT_RESOURCE) || child
- .hasProperty(Property.JCR_DATA)))
+ if (!(child.isNodeType(NodeType.NT_RESOURCE) || child.hasProperty(Property.JCR_DATA)))
isValid = false;
}
if (!isValid)
- throw new EclipseUiException(
- "ERROR: In the current implemented model, '"
- + NodeType.NT_FILE
- + "' file node must have a child node named jcr:content "
- + "that has a BINARY Property named jcr:data "
- + "where the actual data is stored");
+ throw new EclipseUiException("ERROR: In the current implemented model, '" + NodeType.NT_FILE
+ + "' file node must have a child node named jcr:content "
+ + "that has a BINARY Property named jcr:data " + "where the actual data is stored");
return child;
} catch (RepositoryException re) {
- throw new EclipseUiException("Erreur while getting file node of ID "
- + fileId, re);
+ throw new EclipseUiException("Erreur while getting file node of ID " + fileId, re);
}
}
}
}
/**
- * Copy the <b>content</b> of an {@link javax.naming.Attributes} to the
- * provided {@link Dictionary}.
+ * Copy the <b>content</b> of an {@link Attributes} to the provided
+ * {@link Dictionary}.
*/
public static void copy(Attributes attributes, Dictionary<String, Object> dictionary) {
AttributesDictionary ad = new AttributesDictionary(attributes);
}
/**
- * Copy a {@link Dictionary} into an {@link javax.naming.Attributes}.
+ * Copy a {@link Dictionary} into an {@link Attributes}.
*/
public static void copy(Dictionary<String, Object> dictionary, Attributes attributes) {
AttributesDictionary ad = new AttributesDictionary(attributes);
/**
* Creates a deep path based on a URL:
- * http://subdomain.example.com/to/content?args =>
+ * http://subdomain.example.com/to/content?args becomes
* com/example/subdomain/to/content
*/
public static String urlAsPath(String url) {
/**
* Creates a path from a FQDN, inverting the order of the component:
- * www.argeo.org => org.argeo.www
+ * www.argeo.org becomes org.argeo.www
*/
public static String hostAsPath(String host) {
StringBuffer path = new StringBuffer(host.length());
}
/**
- * Creates a path from a UUID (e.g. 6ebda899-217d-4bf1-abe4-2839085c8f3c =>
+ * Creates a path from a UUID (e.g. 6ebda899-217d-4bf1-abe4-2839085c8f3c becomes
* 6ebda899-217d/4bf1/abe4/2839085c8f3c/). '/' at the end, not the beginning
*/
public static String uuidAsPath(String uuid) {
/**
* Creates depth from a string (typically a username) by adding levels based
- * on its first characters: "aBcD",2 => a/aB
+ * on its first characters: "aBcD",2 becomes a/aB
*/
public static String firstCharsToPath(String str, Integer nbrOfChars) {
if (str.length() < nbrOfChars)
/**
* Estimate the sub tree size from current node. Computation is based on the
- * Jcr {@link Property.getLength()} method. Note : it is not the exact size
+ * Jcr {@link Property#getLength()} method. Note : it is not the exact size
* used on the disk by the current part of the JCR Tree.
*/
* @param msg
* any object as long as its toString() method returns the
* message
- * @param the
+ * @param exception
* exception in log4j ThrowableStrRep format
*/
public void appendLog(String username, Long timestamp, String level,
public class NodeUtils {
/**
* Wraps the call to the repository factory based on parameter
- * {@link NodeConstants#JCR_REPOSITORY_ALIAS} in order to simplify it and
+ * {@link NodeConstants#CN} in order to simplify it and
* protect against future API changes.
*/
public static Repository getRepositoryByAlias(RepositoryFactory repositoryFactory, String alias) {
/**
* Wraps the call to the repository factory based on parameter
- * {@link NodeConstants#JCR_REPOSITORY_URI} in order to simplify it and
+ * {@link NodeConstants#LABELED_URI} in order to simplify it and
* protect against future API changes.
*/
public static Repository getRepositoryByUri(RepositoryFactory repositoryFactory, String uri) {
/**
* Wraps the call to the repository factory based on parameter
- * {@link NodeConstants#JCR_REPOSITORY_URI} in order to simplify it and
+ * {@link NodeConstants#LABELED_URI} in order to simplify it and
* protect against future API changes.
*/
public static Repository getRepositoryByUri(RepositoryFactory repositoryFactory, String uri, String alias) {
return buf.append('/').append(cn).append('/').append(node.getSession().getWorkspace().getName())
.append(node.getPath()).toString();
}
-
- // public static Node getUserProfile(Session session, String username) {
- // try {
- // QueryObjectModelFactory qomf = session.getWorkspace()
- // .getQueryManager().getQOMFactory();
- // Selector userHomeSel = qomf.selector(ArgeoTypes.ARGEO_USER_PROFILE,
- // "userProfile");
- // DynamicOperand userIdDop = qomf.propertyValue(
- // userHomeSel.getSelectorName(), ArgeoNames.ARGEO_USER_ID);
- // StaticOperand userIdSop = qomf.literal(session.getValueFactory()
- // .createValue(username));
- // Constraint constraint = qomf.comparison(userIdDop,
- // QueryObjectModelFactory.JCR_OPERATOR_EQUAL_TO, userIdSop);
- // Query query = qomf.createQuery(userHomeSel, constraint, null, null);
- // return querySingleNode(query);
- // } catch (RepositoryException e) {
- // throw new RuntimeException(
- // "Cannot find profile for user " + username, e);
- // }
- // }
- //
}
*/
package org.argeo.node.security;
-
-
/**
- * Advanced keyring based on cryptography that can easily be centralized and
- * coordinated with {@link KeyringLoginModule} (since they ar ein the same
- * package)
+ * Marker interface for an advanced keyring based on cryptography.
*/
public interface CryptoKeyring extends Keyring {
}\r
\r
/**\r
- * @return ==0: versions are identical, <0: tested version is newer, >0:\r
+ * @return ==0: versions are identical, <0: tested version is newer, >0:\r
* currentVersion is newer.\r
*/\r
public static int compareVersions(String currentVersion, String testedVersion) {\r
* Given a pattern and a full path, determine the pattern-mapped part.\r
* <p>For example:\r
* <ul>\r
- * <li>'<code>/docs/cvs/commit.html</code>' and '<code>/docs/cvs/commit.html</code> -> ''</li>\r
- * <li>'<code>/docs/*</code>' and '<code>/docs/cvs/commit</code> -> '<code>cvs/commit</code>'</li>\r
- * <li>'<code>/docs/cvs/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>commit.html</code>'</li>\r
- * <li>'<code>/docs/**</code>' and '<code>/docs/cvs/commit</code> -> '<code>cvs/commit</code>'</li>\r
- * <li>'<code>/docs/**\/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>cvs/commit.html</code>'</li>\r
- * <li>'<code>/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>docs/cvs/commit.html</code>'</li>\r
- * <li>'<code>*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>/docs/cvs/commit.html</code>'</li>\r
- * <li>'<code>*</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>/docs/cvs/commit.html</code>'</li>\r
+ * <li>'<code>/docs/cvs/commit.html</code>' and '<code>/docs/cvs/commit.html</code> to ''</li>\r
+ * <li>'<code>/docs/*</code>' and '<code>/docs/cvs/commit</code> to '<code>cvs/commit</code>'</li>\r
+ * <li>'<code>/docs/cvs/*.html</code>' and '<code>/docs/cvs/commit.html</code> to '<code>commit.html</code>'</li>\r
+ * <li>'<code>/docs/**</code>' and '<code>/docs/cvs/commit</code> to '<code>cvs/commit</code>'</li>\r
+ * <li>'<code>/docs/**\/*.html</code>' and '<code>/docs/cvs/commit.html</code> to '<code>cvs/commit.html</code>'</li>\r
+ * <li>'<code>/*.html</code>' and '<code>/docs/cvs/commit.html</code> to '<code>docs/cvs/commit.html</code>'</li>\r
+ * <li>'<code>*.html</code>' and '<code>/docs/cvs/commit.html</code> to '<code>/docs/cvs/commit.html</code>'</li>\r
+ * <li>'<code>*</code>' and '<code>/docs/cvs/commit.html</code> to '<code>/docs/cvs/commit.html</code>'</li>\r
* </ul>\r
* <p>Assumes that {@link #match} returns <code>true</code> for '<code>pattern</code>'\r
* and '<code>path</code>', but does <strong>not</strong> enforce this.\r
* @author Rob Harrop\r
* @author Alex Ruiz\r
* @since 19.03.2004\r
- * @see org.apache.commons.lang.ObjectUtils\r
*/\r
@SuppressWarnings({ "rawtypes", "unchecked" })\r
public abstract class ObjectUtils {\r
* @author Rob Harrop\r
* @author Rick Evans\r
* @since 16 April 2001\r
- * @see org.apache.commons.lang.StringUtils\r
*/\r
@SuppressWarnings({ "rawtypes", "unchecked" })\r
public abstract class StringUtils {\r
* Quote the given String with single quotes.\r
* @param str the input String (e.g. "myString")\r
* @return the quoted String (e.g. "'myString'"),\r
- * or <code>null<code> if the input was <code>null</code>\r
+ * or <code>null</code> if the input was <code>null</code>\r
*/\r
public static String quote(String str) {\r
return (str != null ? "'" + str + "'" : null);\r
\r
/**\r
* Extract the filename from the given path,\r
- * e.g. "mypath/myfile.txt" -> "myfile.txt".\r
+ * e.g. "mypath/myfile.txt" to "myfile.txt".\r
* @param path the file path (may be <code>null</code>)\r
* @return the extracted filename, or <code>null</code> if none\r
*/\r
\r
/**\r
* Extract the filename extension from the given path,\r
- * e.g. "mypath/myfile.txt" -> "txt".\r
+ * e.g. "mypath/myfile.txt" to "txt".\r
* @param path the file path (may be <code>null</code>)\r
* @return the extracted filename extension, or <code>null</code> if none\r
*/\r
\r
/**\r
* Strip the filename extension from the given path,\r
- * e.g. "mypath/myfile.txt" -> "mypath/myfile".\r
+ * e.g. "mypath/myfile.txt" to "mypath/myfile".\r
* @param path the file path (may be <code>null</code>)\r
* @return the path with stripped filename extension,\r
* or <code>null</code> if none\r
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.argeo.commons</groupId>
<artifactId>argeo-commons</artifactId>
<connection>scm:git:http://git.argeo.org/apache2/argeo-commons.git</connection>
<url>http://git.argeo.org/?p=apache2/argeo-commons.git;a=summary</url>
<developerConnection>scm:git:https://code.argeo.org/git/apache2/argeo-commons.git</developerConnection>
- <tag>HEAD</tag>
- </scm>
+ <tag>HEAD</tag>
+ </scm>
<inceptionYear>2007</inceptionYear>
<licenses>
<license>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.1</version>
- </plugin>
+ <!-- <plugin> -->
+ <!-- <artifactId>maven-javadoc-plugin</artifactId> -->
+ <!-- <version>2.10.4</version> -->
+ <!-- </plugin> -->
<!-- Apache -->
<plugin>
<groupId>org.apache.felix</groupId>
<version>1.1.6</version>
</plugin>
<!-- Site -->
+
<plugin>
<artifactId>maven-site-plugin</artifactId>
- <version>3.4</version>
+ <version>3.6</version>
<configuration>
- <siteDirectory>doc/site</siteDirectory>
- <generateSitemap>true</generateSitemap>
- <skip>true</skip>
+ <!-- <siteDirectory>doc/site</siteDirectory> -->
+ <!-- <generateSitemap>true</generateSitemap> -->
+ <!-- <skip>false</skip> -->
<reportPlugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.8.1</version>
- <reportSets>
- <reportSet>
- <reports>
- <report>index</report>
- <report>summary</report>
- <report>license</report>
- <report>scm</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-project-info-reports-plugin</artifactId> -->
+ <!-- <version>2.8.1</version> -->
+ <!-- <reportSets> -->
+ <!-- <reportSet> -->
+ <!-- <reports> -->
+ <!-- <report>index</report> -->
+ <!-- <report>summary</report> -->
+ <!-- <report>license</report> -->
+ <!-- <report>scm</report> -->
+ <!-- </reports> -->
+ <!-- </reportSet> -->
+ <!-- </reportSets> -->
+ <!-- </plugin> -->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.3</version>
+ <version>2.10.4</version>
<configuration>
- <failOnError>false</failOnError>
<encoding>UTF-8</encoding>
- <excludePackageNames>*.demo.*:*.internal.*</excludePackageNames>
<detectLinks>true</detectLinks>
+ <sourcepath>src</sourcepath>
<links>
<!-- Java -->
- <link>http://docs.oracle.com/javase/6/docs/api</link>
+ <link>http://docs.oracle.com/javase/8/docs/api</link>
<!-- OSGi -->
- <link>http://www.osgi.org/javadoc/r4v42</link>
+ <link>http://www.osgi.org/javadoc/r5/core</link>
+ <link>http://www.osgi.org/javadoc/r5/enterprise</link>
<!-- Spring -->
- <link>http://static.springsource.org/spring/docs/2.5.x/api</link>
- <link>http://static.springsource.org/osgi/docs/1.2.x/api</link>
- <link>http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs</link>
+ <link>http://docs.spring.io/spring/docs/3.2.x/javadoc-api</link>
<!-- JCR -->
<link>http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0</link>
<!-- Eclipse -->
- <link>http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api</link>
+ <link>http://help.eclipse.org/neon/topic/org.eclipse.platform.doc.isv/reference/api</link>
</links>
</configuration>
<reportSets>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
- <configuration>
- <excludes>
- <exclude>**/demo/**/*</exclude>
- <exclude>**/internal/**/*</exclude>
- </excludes>
- </configuration>
<reportSets>
<reportSet>
<id>aggregate</id>
</filesets>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
+ <!-- <plugin> -->
+ <!-- <artifactId>maven-javadoc-plugin</artifactId> -->
+ <!-- <configuration> -->
+ <!-- <skip>true</skip> -->
+ <!-- </configuration> -->
+ <!-- </plugin> -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<artifactId>maven-site-plugin</artifactId>
<inherited>false</inherited>
<configuration>
- <skip>false</skip>
+ <skip>true</skip>
</configuration>
</plugin>
<plugin>
<url>dav:https://forge.argeo.org/data/java/argeo-${developmentCycle.argeo-commons}</url>
<uniqueVersion>false</uniqueVersion>
</repository>
+ <site>
+ <id>staging</id>
+ <url>dav:https://forge.argeo.org/data/docs/argeo-${developmentCycle.argeo-commons}</url>
+ </site>
</distributionManagement>
<profiles>
<profile>
</goals>
<configuration>
<target>
- <copy todir="${argeo.rpm.stagingRepository}" quiet="true" failonerror="false">
- <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+ <copy todir="${argeo.rpm.stagingRepository}" quiet="true"
+ failonerror="false">
+ <fileset dir="${project.build.directory}/rpm"
+ includes="*/RPMS/**/*.rpm" />
<flattenmapper />
</copy>
</target>
</goals>
<configuration>
<target>
- <copy todir="${argeo.rpm.stagingRepository}" quiet="true" failonerror="false">
- <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+ <copy todir="${argeo.rpm.stagingRepository}" quiet="true"
+ failonerror="false">
+ <fileset dir="${project.build.directory}/rpm"
+ includes="*/RPMS/**/*.rpm" />
<flattenmapper />
</copy>
</target>