2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.dist
.views
;
18 import java
.util
.ArrayList
;
19 import java
.util
.HashMap
;
20 import java
.util
.List
;
23 import javax
.jcr
.Credentials
;
24 import javax
.jcr
.NoSuchWorkspaceException
;
25 import javax
.jcr
.Node
;
26 import javax
.jcr
.NodeIterator
;
27 import javax
.jcr
.Property
;
28 import javax
.jcr
.Repository
;
29 import javax
.jcr
.RepositoryException
;
30 import javax
.jcr
.RepositoryFactory
;
31 import javax
.jcr
.Session
;
32 import javax
.jcr
.nodetype
.NodeType
;
34 import org
.apache
.commons
.logging
.Log
;
35 import org
.apache
.commons
.logging
.LogFactory
;
36 import org
.argeo
.ArgeoMonitor
;
37 import org
.argeo
.eclipse
.ui
.EclipseArgeoMonitor
;
38 import org
.argeo
.eclipse
.ui
.ErrorFeedback
;
39 import org
.argeo
.eclipse
.ui
.TreeParent
;
40 import org
.argeo
.jcr
.ArgeoJcrUtils
;
41 import org
.argeo
.jcr
.ArgeoNames
;
42 import org
.argeo
.jcr
.ArgeoTypes
;
43 import org
.argeo
.jcr
.JcrUtils
;
44 import org
.argeo
.jcr
.UserJcrUtils
;
45 import org
.argeo
.slc
.SlcException
;
46 import org
.argeo
.slc
.client
.ui
.dist
.DistPlugin
;
47 import org
.argeo
.slc
.client
.ui
.dist
.commands
.CopyWorkspace
;
48 import org
.argeo
.slc
.client
.ui
.dist
.commands
.CreateWorkspace
;
49 import org
.argeo
.slc
.client
.ui
.dist
.commands
.DeleteWorkspace
;
50 import org
.argeo
.slc
.client
.ui
.dist
.commands
.ManageWorkspaceAuth
;
51 import org
.argeo
.slc
.client
.ui
.dist
.commands
.NormalizeDistribution
;
52 import org
.argeo
.slc
.client
.ui
.dist
.editors
.DistributionEditor
;
53 import org
.argeo
.slc
.client
.ui
.dist
.editors
.DistributionEditorInput
;
54 import org
.argeo
.slc
.client
.ui
.dist
.utils
.CommandHelpers
;
55 import org
.argeo
.slc
.jcr
.SlcNames
;
56 import org
.argeo
.slc
.repo
.RepoConstants
;
57 import org
.argeo
.slc
.repo
.RepoUtils
;
58 import org
.argeo
.util
.security
.Keyring
;
59 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
60 import org
.eclipse
.core
.runtime
.IStatus
;
61 import org
.eclipse
.core
.runtime
.Status
;
62 import org
.eclipse
.core
.runtime
.jobs
.Job
;
63 import org
.eclipse
.jface
.action
.IMenuListener
;
64 import org
.eclipse
.jface
.action
.IMenuManager
;
65 import org
.eclipse
.jface
.action
.MenuManager
;
66 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
67 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
68 import org
.eclipse
.jface
.viewers
.DoubleClickEvent
;
69 import org
.eclipse
.jface
.viewers
.IDoubleClickListener
;
70 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
71 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
72 import org
.eclipse
.jface
.viewers
.TreeViewer
;
73 import org
.eclipse
.jface
.viewers
.TreeViewerColumn
;
74 import org
.eclipse
.jface
.viewers
.Viewer
;
75 import org
.eclipse
.jface
.viewers
.ViewerDropAdapter
;
76 import org
.eclipse
.swt
.SWT
;
77 import org
.eclipse
.swt
.dnd
.DND
;
78 import org
.eclipse
.swt
.dnd
.DragSourceAdapter
;
79 import org
.eclipse
.swt
.dnd
.DragSourceEvent
;
80 import org
.eclipse
.swt
.dnd
.TextTransfer
;
81 import org
.eclipse
.swt
.dnd
.Transfer
;
82 import org
.eclipse
.swt
.dnd
.TransferData
;
83 import org
.eclipse
.swt
.widgets
.Composite
;
84 import org
.eclipse
.swt
.widgets
.Menu
;
85 import org
.eclipse
.swt
.widgets
.Tree
;
86 import org
.eclipse
.ui
.IWorkbenchWindow
;
87 import org
.eclipse
.ui
.PartInitException
;
88 import org
.eclipse
.ui
.part
.ViewPart
;
91 * Browse and manipulate distributions (like merge, rename, etc.). Only support
92 * one single repository currently.
94 public class DistributionsView
extends ViewPart
implements SlcNames
, ArgeoNames
{
95 private final static Log log
= LogFactory
.getLog(DistributionsView
.class);
96 public final static String ID
= DistPlugin
.ID
+ ".distributionsView";
98 private Repository nodeRepository
;
99 private RepositoryFactory repositoryFactory
;
100 private Keyring keyring
;
102 private TreeViewer viewer
;
105 public void createPartControl(Composite parent
) {
106 // Define the TableViewer
107 viewer
= new TreeViewer(parent
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
108 | SWT
.FULL_SELECTION
| SWT
.BORDER
);
110 TreeViewerColumn col
= new TreeViewerColumn(viewer
, SWT
.NONE
);
111 col
.getColumn().setWidth(200);
112 col
.setLabelProvider(new ColumnLabelProvider() {
114 public String
getText(Object element
) {
115 if (element
instanceof RepoElem
)
116 return ((RepoElem
) element
).getLabel();
117 return element
.toString();
121 final Tree table
= viewer
.getTree();
122 table
.setHeaderVisible(false);
123 table
.setLinesVisible(false);
125 viewer
.setContentProvider(new DistributionsContentProvider());
126 viewer
.addDoubleClickListener(new DistributionsDCL());
129 Transfer
[] tt
= new Transfer
[] { TextTransfer
.getInstance() };
130 int operations
= DND
.DROP_COPY
| DND
.DROP_MOVE
;
131 viewer
.addDragSupport(operations
, tt
, new ViewDragListener());
132 viewer
.addDropSupport(operations
, tt
, new ViewDropListener(viewer
));
134 MenuManager menuManager
= new MenuManager();
135 Menu menu
= menuManager
.createContextMenu(viewer
.getTree());
136 menuManager
.addMenuListener(new IMenuListener() {
137 public void menuAboutToShow(IMenuManager manager
) {
138 contextMenuAboutToShow(manager
);
141 viewer
.getTree().setMenu(menu
);
142 getSite().registerContextMenu(menuManager
, viewer
);
144 Session nodeSession
= null;
146 nodeSession
= nodeRepository
.login();
148 // make sure base directory is available
149 Node repos
= JcrUtils
.mkdirs(nodeSession
,
150 UserJcrUtils
.getUserHome(nodeSession
).getPath()
151 + RepoConstants
.REPOSITORIES_BASE_PATH
);
154 // register default local java repository
155 String alias
= RepoConstants
.DEFAULT_JAVA_REPOSITORY_ALIAS
;
156 Repository javaRepository
= ArgeoJcrUtils
.getRepositoryByAlias(
157 repositoryFactory
, alias
);
158 if (javaRepository
!= null) {
159 if (!repos
.hasNode(alias
)) {
160 Node repoNode
= repos
.addNode(alias
,
161 ArgeoTypes
.ARGEO_REMOTE_REPOSITORY
);
162 repoNode
.setProperty(ARGEO_URI
, "vm:///" + alias
);
163 repoNode
.addMixin(NodeType
.MIX_TITLE
);
164 repoNode
.setProperty(Property
.JCR_TITLE
, "Internal "
165 + alias
+ " repository");
169 } catch (RepositoryException e
) {
170 throw new SlcException("Cannot register repository", e
);
172 JcrUtils
.logoutQuietly(nodeSession
);
175 viewer
.setInput(nodeRepository
);
179 /** Programatically configure the context menu */
180 protected void contextMenuAboutToShow(IMenuManager menuManager
) {
181 IWorkbenchWindow window
= DistPlugin
.getDefault().getWorkbench()
182 .getActiveWorkbenchWindow();
183 // Get Current selected item :
184 Object firstElement
= ((IStructuredSelection
) viewer
.getSelection())
187 if (firstElement
instanceof TreeParent
) {
188 TreeParent tp
= (TreeParent
) firstElement
;
189 String wsName
= tp
.getName();
191 // Build conditions depending on element type (repo or distribution
192 // for the time being)
193 boolean isDistribElem
= false; // , isRepoElem = false;
195 // if (tp instanceof RepositoryElem){
196 // isRepoElem = true;
198 if (tp
instanceof DistributionElem
) {
199 isDistribElem
= true;
203 CommandHelpers
.refreshCommand(menuManager
, window
,
204 CreateWorkspace
.ID
, CreateWorkspace
.DEFAULT_LABEL
,
205 CreateWorkspace
.DEFAULT_ICON_PATH
, !isDistribElem
);
207 // Normalize workspace
208 Map
<String
, String
> params
= new HashMap
<String
, String
>();
209 params
.put(NormalizeDistribution
.PARAM_WORKSPACE
, wsName
);
210 CommandHelpers
.refreshParameterizedCommand(menuManager
, window
,
211 NormalizeDistribution
.ID
,
212 NormalizeDistribution
.DEFAULT_LABEL
,
213 NormalizeDistribution
.DEFAULT_ICON_PATH
, isDistribElem
,
217 params
= new HashMap
<String
, String
>();
218 params
.put(CopyWorkspace
.PARAM_WORKSPACE_NAME
, wsName
);
219 CommandHelpers
.refreshParameterizedCommand(menuManager
, window
,
220 CopyWorkspace
.ID
, CopyWorkspace
.DEFAULT_LABEL
,
221 CopyWorkspace
.DEFAULT_ICON_PATH
, isDistribElem
, params
);
224 params
= new HashMap
<String
, String
>();
225 params
.put(DeleteWorkspace
.PARAM_WORKSPACE_NAME
, wsName
);
226 CommandHelpers
.refreshParameterizedCommand(menuManager
, window
,
227 DeleteWorkspace
.ID
, DeleteWorkspace
.DEFAULT_LABEL
,
228 DeleteWorkspace
.DEFAULT_ICON_PATH
, isDistribElem
, params
);
230 // Manage workspace authorizations
231 params
= new HashMap
<String
, String
>();
232 params
.put(ManageWorkspaceAuth
.PARAM_WORKSPACE_NAME
, wsName
);
233 CommandHelpers
.refreshParameterizedCommand(menuManager
, window
,
234 ManageWorkspaceAuth
.ID
, ManageWorkspaceAuth
.DEFAULT_LABEL
,
235 ManageWorkspaceAuth
.DEFAULT_ICON_PATH
, isDistribElem
,
241 public void setFocus() {
242 viewer
.getTree().setFocus();
246 * DEPENDENCY INJECTION
249 * Force refresh of the whole view
251 public void refresh() {
252 viewer
.setContentProvider(new DistributionsContentProvider());
255 public void setNodeRepository(Repository repository
) {
256 this.nodeRepository
= repository
;
259 public void setRepositoryFactory(RepositoryFactory repositoryFactory
) {
260 this.repositoryFactory
= repositoryFactory
;
263 public void setKeyring(Keyring keyring
) {
264 this.keyring
= keyring
;
270 /** Content provider */
271 private class DistributionsContentProvider
implements ITreeContentProvider
{
273 List
<RepoElem
> repositories
= new ArrayList
<RepoElem
>();
275 public Object
[] getElements(Object input
) {
276 Repository nodeRepository
= (Repository
) input
;
278 if (nodeSession
!= null)
280 nodeSession
= nodeRepository
.login();
282 String reposPath
= UserJcrUtils
.getUserHome(nodeSession
)
283 .getPath() + RepoConstants
.REPOSITORIES_BASE_PATH
;
284 NodeIterator repos
= nodeSession
.getNode(reposPath
).getNodes();
285 while (repos
.hasNext()) {
286 Node repoNode
= repos
.nextNode();
287 if (repoNode
.isNodeType(ArgeoTypes
.ARGEO_REMOTE_REPOSITORY
)) {
288 repositories
.add(new RepoElem(repoNode
));
291 } catch (RepositoryException e
) {
292 throw new SlcException("Cannot get base elements", e
);
294 return repositories
.toArray();
297 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
301 public Object
[] getChildren(Object parentElement
) {
302 if (parentElement
instanceof RepoElem
) {
303 return ((RepoElem
) parentElement
).getChildren();
304 } else if (parentElement
instanceof DistributionElem
) {
305 return ((DistributionElem
) parentElement
).getChildren();
310 public Object
getParent(Object element
) {
311 // TODO register repo elem in distirbution elem?
315 public boolean hasChildren(Object element
) {
316 if (element
instanceof RepoElem
) {
318 } else if (element
instanceof DistributionElem
) {
324 public void dispose() {
325 for (RepoElem repoElem
: repositories
)
327 repositories
= new ArrayList
<RepoElem
>();
328 JcrUtils
.logoutQuietly(nodeSession
);
333 /** A software repository */
334 private class RepoElem
{
335 private Node repoNode
;
337 private Repository repository
;
338 private Credentials credentials
;
340 public RepoElem(Node repoNode
) {
341 this.repoNode
= repoNode
;
344 /** Lazily connects to repository */
345 protected void connect() {
346 if (repository
!= null)
348 repository
= RepoUtils
.getRepository(repositoryFactory
, keyring
,
350 credentials
= RepoUtils
.getRepositoryCredentials(keyring
, repoNode
);
353 public String
getLabel() {
355 if (repoNode
.isNodeType(NodeType
.MIX_TITLE
)) {
356 return repoNode
.getProperty(Property
.JCR_TITLE
).getString();
358 return repoNode
.getName();
360 } catch (RepositoryException e
) {
361 throw new SlcException("Cannot read label of " + repoNode
, e
);
365 public String
toString() {
366 return repoNode
.toString();
369 public Object
[] getChildren() {
371 Session session
= null;
373 session
= repository
.login(credentials
);
374 String
[] workspaceNames
= session
.getWorkspace()
375 .getAccessibleWorkspaceNames();
376 List
<DistributionElem
> distributionElems
= new ArrayList
<DistributionElem
>();
377 for (String workspace
: workspaceNames
)
378 distributionElems
.add(new DistributionElem(this, workspace
,
380 // FIXME remove deleted workspaces
381 return distributionElems
.toArray();
382 } catch (RepositoryException e
) {
383 throw new SlcException(
384 "Cannot list workspaces for " + repoNode
, e
);
386 JcrUtils
.logoutQuietly(session
);
390 public void dispose() {
393 public Node
getRepoNode() {
397 public String
getRepoPath() {
399 return repoNode
.getPath();
400 } catch (RepositoryException e
) {
401 throw new SlcException("Cannot get path for " + repoNode
, e
);
405 public Repository
getRepository() {
411 /** Abstracts a distribution, that is a workspace */
412 private static class DistributionElem
extends TreeParent
{
413 private final RepoElem repoElem
;
414 private final Node workspaceNode
;
415 private final String workspaceName
;
416 private final Credentials credentials
;
418 public DistributionElem(RepoElem repoElem
, String workspaceName
,
419 Credentials credentials
) {
420 super(workspaceName
);
421 this.repoElem
= repoElem
;
423 // TODO move it to repo elem
424 this.workspaceNode
= repoElem
.getRepoNode().hasNode(
425 workspaceName
) ? repoElem
.getRepoNode().getNode(
426 workspaceName
) : repoElem
.getRepoNode().addNode(
428 repoElem
.getRepoNode().getSession().save();
429 } catch (RepositoryException e
) {
430 throw new SlcException("Cannot get or add workspace node "
433 this.workspaceName
= workspaceName
;
434 this.credentials
= credentials
;
437 public Node
getWorkspaceNode() {
438 return workspaceNode
;
441 public String
getWorkspaceName() {
442 return workspaceName
;
445 public String
getWorkspacePath() {
447 return workspaceNode
.getPath();
448 } catch (RepositoryException e
) {
449 throw new SlcException("Cannot get or add workspace path "
454 public String
getRepoPath() {
456 return workspaceNode
.getParent().getPath();
457 } catch (RepositoryException e
) {
458 throw new SlcException("Cannot get or add workspace path "
463 public RepoElem
getRepoElem() {
467 public Credentials
getCredentials() {
472 /** Listens to drag */
473 class ViewDragListener
extends DragSourceAdapter
{
474 public void dragSetData(DragSourceEvent event
) {
475 IStructuredSelection selection
= (IStructuredSelection
) viewer
477 if (selection
.getFirstElement() instanceof DistributionElem
) {
478 DistributionElem de
= (DistributionElem
) selection
480 if (TextTransfer
.getInstance().isSupportedType(event
.dataType
)) {
481 event
.data
= de
.getWorkspacePath();
487 /** Listens to drop */
488 class ViewDropListener
extends ViewerDropAdapter
{
490 public ViewDropListener(Viewer viewer
) {
495 public boolean performDrop(Object data
) {
496 DistributionElem sourceDist
= (DistributionElem
) getSelectedObject();
497 RepoElem targetRepo
= (RepoElem
) getCurrentTarget();
499 Boolean ok
= MessageDialog
.openConfirm(getSite().getShell(),
500 "Confirm distribution merge", "Do you want to merge "
501 + sourceDist
.getWorkspaceName() + " (from repo "
502 + sourceDist
.getRepoElem().getLabel()
503 + ") to repo " + targetRepo
.getLabel() + "?");
508 String sourceWorkspace
= sourceDist
.getWorkspaceName();
509 Repository sourceRepository
= RepoUtils
.getRepository(
510 repositoryFactory
, keyring
, sourceDist
511 .getWorkspaceNode().getParent());
512 Credentials sourceCredentials
= RepoUtils
513 .getRepositoryCredentials(keyring
, sourceDist
514 .getWorkspaceNode().getParent());
516 String targetWorkspace
= sourceWorkspace
;
517 Repository targetRepository
= RepoUtils
.getRepository(
518 repositoryFactory
, keyring
, targetRepo
.getRepoNode());
519 Credentials targetCredentials
= RepoUtils
520 .getRepositoryCredentials(keyring
,
521 targetRepo
.getRepoNode());
523 // Open sessions here since the background thread
524 // won't necessarily be authenticated.
525 // Job should close the sessions.
526 Session sourceSession
= sourceRepository
.login(
527 sourceCredentials
, sourceWorkspace
);
528 Session targetSession
;
530 targetSession
= targetRepository
.login(targetCredentials
,
532 } catch (NoSuchWorkspaceException e
) {
533 Session defaultSession
= targetRepository
534 .login(targetCredentials
);
536 defaultSession
.getWorkspace().createWorkspace(
538 } catch (Exception e1
) {
539 throw new SlcException("Cannot create new workspace "
540 + targetWorkspace
, e
);
542 JcrUtils
.logoutQuietly(defaultSession
);
544 targetSession
= targetRepository
.login(targetCredentials
,
548 Job workspaceMergeJob
= new WorkspaceMergeJob(sourceSession
,
550 workspaceMergeJob
.setUser(true);
551 workspaceMergeJob
.schedule();
553 } catch (RepositoryException e
) {
554 throw new SlcException("Cannot process drop from " + sourceDist
555 + " to " + targetRepo
, e
);
560 public boolean validateDrop(Object target
, int operation
,
561 TransferData transferType
) {
562 if (target
instanceof RepoElem
) {
563 if (getSelectedObject() instanceof DistributionElem
) {
564 // check if not same repository
565 String srcRepoPath
= ((DistributionElem
) getSelectedObject())
567 String targetRepoPath
= ((RepoElem
) target
).getRepoPath();
568 return !targetRepoPath
.equals(srcRepoPath
);
575 private static class WorkspaceMergeJob
extends Job
{
576 private Session sourceSession
;
577 private Session targetSession
;
579 public WorkspaceMergeJob(Session sourceSession
, Session targetSession
) {
580 super("Workspace merge");
581 this.sourceSession
= sourceSession
;
582 this.targetSession
= targetSession
;
586 protected IStatus
run(IProgressMonitor eclipseMonitor
) {
587 long begin
= System
.currentTimeMillis();
589 // Not implemented in Davex Jackrabbit v2.2
590 // Query countQuery = sourceSession.getWorkspace()
591 // .getQueryManager()
592 // .createQuery("//element(*, nt:file)", Query.XPATH);
593 // QueryResult result = countQuery.execute();
594 // Long expectedCount = result.getNodes().getSize();
596 Long expectedCount
= JcrUtils
.countFiles(sourceSession
598 if (log
.isDebugEnabled())
599 log
.debug("Will copy " + expectedCount
+ " files...");
601 ArgeoMonitor monitor
= new EclipseArgeoMonitor(eclipseMonitor
);
603 .beginTask("Copy files", expectedCount
.intValue());
605 Long count
= JcrUtils
.copyFiles(sourceSession
.getRootNode(),
606 targetSession
.getRootNode(), true, monitor
);
609 long duration
= (System
.currentTimeMillis() - begin
) / 1000;// in
611 if (log
.isDebugEnabled())
612 log
.debug("Copied " + count
+ " files in "
613 + (duration
/ 60) + "min " + (duration
% 60) + "s");
615 return Status
.OK_STATUS
;
616 } catch (RepositoryException e
) {
617 return new Status(IStatus
.ERROR
, DistPlugin
.ID
, "Cannot merge",
620 JcrUtils
.logoutQuietly(sourceSession
);
621 JcrUtils
.logoutQuietly(targetSession
);
626 /** Listen to double-clicks */
627 private class DistributionsDCL
implements IDoubleClickListener
{
629 public void doubleClick(DoubleClickEvent event
) {
630 if (event
.getSelection() == null || event
.getSelection().isEmpty())
632 Object obj
= ((IStructuredSelection
) event
.getSelection())
634 if (obj
instanceof DistributionElem
) {
635 DistributionElem distributionElem
= (DistributionElem
) obj
;
636 DistributionEditorInput dei
= new DistributionEditorInput(
637 distributionElem
.getName(), distributionElem
638 .getRepoElem().getRepository(),
639 distributionElem
.getWorkspaceName(),
640 distributionElem
.getCredentials());
642 DistPlugin
.getDefault().getWorkbench()
643 .getActiveWorkbenchWindow().getActivePage()
644 .openEditor(dei
, DistributionEditor
.ID
);
645 } catch (PartInitException e
) {
646 ErrorFeedback
.show("Cannot open editor for "
647 + distributionElem
.getWorkspaceName(), e
);
655 // nodeSession = nodeRepository.login();
656 // NodeIterator repos = JcrUtils.mkdirs(
658 // UserJcrUtils.getUserHome(nodeSession).getPath()
659 // + RepoConstants.REPOSITORIES_BASE_PATH).getNodes();
660 // while (repos.hasNext()) {
661 // Node repository = repos.nextNode();
662 // String label = null;
663 // if (repository.isNodeType(NodeType.MIX_TITLE)) {
664 // label = repository.getProperty(Property.JCR_TITLE)
668 // if (repository.isNodeType(ArgeoTypes.ARGEO_REMOTE_REPOSITORY)) {
669 // String uri = repository.getProperty(ARGEO_URI).getString();
670 // Credentials credentials = null;
671 // if (repository.hasProperty(ARGEO_USER_ID)) {
672 // String userId = repository.getProperty(ARGEO_USER_ID)
674 // credentials = new SimpleCredentials(userId,
675 // "".toCharArray());
677 // Repository remoteRepository = ArgeoJcrUtils
678 // .getRepositoryByUri(repositoryFactory, uri);
679 // if (label == null)
680 // label = repository.getName();
681 // repositories.add(new RepositoryElem(label,
682 // remoteRepository, credentials));
685 // } catch (RepositoryException e) {
686 // throw new ArgeoException("Cannot read registered repositories", e);
690 // String uri = null;
691 // Credentials credentials = null;
692 // Repository remoteRepository = null;
695 // uri = "http://dev.argeo.org/org.argeo.jcr.webapp/pub/java";
696 // credentials = new GuestCredentials();
697 // remoteRepository =
698 // ArgeoJcrUtils.getRepositoryByUri(repositoryFactory, uri);
699 // repositories.add(new RepositoryElem("anonymous@dev.argeo.org//java",
700 // remoteRepository, credentials));
701 // } catch (Exception e) {
702 // e.printStackTrace();
705 // uri = "http://localhost:7070/org.argeo.jcr.webapp/pub/java";
706 // credentials = new GuestCredentials();
707 // remoteRepository =
708 // ArgeoJcrUtils.getRepositoryByUri(repositoryFactory, uri);
709 // repositories.add(new RepositoryElem("anonymous@localhost//java",
710 // remoteRepository, credentials));
712 // uri = "http://localhost:7070/org.argeo.jcr.webapp/remoting/java";
713 // credentials = new SimpleCredentials(System.getProperty("user.name"),
714 // "".toCharArray());
715 // remoteRepository =
716 // ArgeoJcrUtils.getRepositoryByUri(repositoryFactory, uri);
717 // repositories.add(new RepositoryElem("@localhost//java",
718 // remoteRepository, credentials));