*/
package org.argeo.slc.client.ui.dist;
-import org.argeo.slc.client.ui.dist.views.ArtifactsBrowser;
import org.argeo.slc.client.ui.dist.views.DistributionsView;
-import org.argeo.slc.client.ui.dist.views.QueryArtifactsForm;
-import org.argeo.slc.client.ui.dist.views.QueryArtifactsText;
-import org.argeo.slc.client.ui.dist.views.QueryBundlesForm;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
IFolderLayout main = layout.createFolder("main", IPageLayout.LEFT,
0.5f, editorArea);
main.addView(DistributionsView.ID);
- main.addView(ArtifactsBrowser.ID);
- main.addView(QueryArtifactsForm.ID);
- main.addView(QueryBundlesForm.ID);
- main.addView(QueryArtifactsText.ID);
+// main.addView(ArtifactsBrowser.ID);
+// main.addView(QueryArtifactsForm.ID);
+// main.addView(QueryBundlesForm.ID);
+// main.addView(QueryArtifactsText.ID);
main.addView("org.eclipse.ui.views.ProgressView");
}
}
String[] workspaceNames = session.getWorkspace()
.getAccessibleWorkspaceNames();
List<DistributionElem> distributionElems = new ArrayList<DistributionElem>();
- for (String workspace : workspaceNames)
- distributionElems.add(new DistributionElem(this, workspace,
- credentials));
- // FIXME remove deleted workspaces
+ for (String workspaceName : workspaceNames) {
+ Node workspaceNode = repoNode.hasNode(workspaceName) ? repoNode
+ .getNode(workspaceName) : repoNode
+ .addNode(workspaceName);
+ repoNode.getSession().save();
+ distributionElems.add(new DistributionElem(this,
+ workspaceNode));
+ // FIXME remove deleted workspaces
+ }
return distributionElems.toArray();
} catch (RepositoryException e) {
throw new SlcException(
connect();
return repository;
}
+
+ public Credentials getCredentials() {
+ return credentials;
+ }
+
}
/** Abstracts a distribution, that is a workspace */
private static class DistributionElem extends TreeParent {
private final RepoElem repoElem;
private final Node workspaceNode;
- private final String workspaceName;
- private final Credentials credentials;
- public DistributionElem(RepoElem repoElem, String workspaceName,
- Credentials credentials) {
- super(workspaceName);
+ public DistributionElem(RepoElem repoElem, Node workspaceNode) {
+ super(JcrUtils.getNameQuietly(workspaceNode));
this.repoElem = repoElem;
- try {
- // TODO move it to repo elem
- this.workspaceNode = repoElem.getRepoNode().hasNode(
- workspaceName) ? repoElem.getRepoNode().getNode(
- workspaceName) : repoElem.getRepoNode().addNode(
- workspaceName);
- repoElem.getRepoNode().getSession().save();
- } catch (RepositoryException e) {
- throw new SlcException("Cannot get or add workspace node "
- + workspaceName, e);
- }
- this.workspaceName = workspaceName;
- this.credentials = credentials;
+ this.workspaceNode = workspaceNode;
}
public Node getWorkspaceNode() {
}
public String getWorkspaceName() {
- return workspaceName;
+ return JcrUtils.getNameQuietly(workspaceNode);
}
public String getWorkspacePath() {
return workspaceNode.getPath();
} catch (RepositoryException e) {
throw new SlcException("Cannot get or add workspace path "
- + workspaceName, e);
+ + getWorkspaceName(), e);
}
}
return workspaceNode.getParent().getPath();
} catch (RepositoryException e) {
throw new SlcException("Cannot get or add workspace path "
- + workspaceName, e);
+ + getWorkspaceName(), e);
}
}
}
public Credentials getCredentials() {
- return credentials;
+ return repoElem.getCredentials();
}
}
// QueryResult result = countQuery.execute();
// Long expectedCount = result.getNodes().getSize();
- Long expectedCount = JcrUtils.countFiles(sourceSession
- .getRootNode());
+ Long expectedCount = JcrUtils.countFiles(sourceSession
+ .getRootNode());
if (log.isDebugEnabled())
log.debug("Will copy " + expectedCount + " files...");