1 package org
.argeo
.eclipse
.ui
.jcr
.browser
;
3 import javax
.jcr
.Repository
;
4 import javax
.jcr
.RepositoryException
;
5 import javax
.jcr
.Session
;
7 import org
.argeo
.ArgeoException
;
8 import org
.argeo
.eclipse
.ui
.TreeParent
;
9 import org
.argeo
.eclipse
.ui
.jcr
.JcrUiPlugin
;
10 import org
.eclipse
.swt
.graphics
.Image
;
12 public class RepositoryNode
extends TreeParent
{
13 private final String name
;
14 private final Repository repository
;
15 private Session defaultSession
= null;
16 public final static Image REPOSITORY_DISCONNECTED
= JcrUiPlugin
17 .getImageDescriptor("icons/repository_disconnected.gif")
19 public final static Image REPOSITORY_CONNECTED
= JcrUiPlugin
20 .getImageDescriptor("icons/repository_connected.gif").createImage();
22 public RepositoryNode(String name
, Repository repository
) {
25 this.repository
= repository
;
30 defaultSession
= repository
.login();
31 String
[] wkpNames
= defaultSession
.getWorkspace()
32 .getAccessibleWorkspaceNames();
33 for (String wkpName
: wkpNames
) {
34 if (wkpName
.equals(defaultSession
.getWorkspace().getName()))
35 addChild(new WorkspaceNode(repository
, wkpName
,
38 addChild(new WorkspaceNode(repository
, wkpName
));
40 } catch (RepositoryException e
) {
41 throw new ArgeoException("Cannot connect to repository " + name
, e
);
45 public Session
getDefaultSession() {
46 return defaultSession
;