]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/wizards/RegisterRepoWizard.java
Remove old license headers
[gpl/argeo-slc.git] / org.argeo.slc.client.ui.dist / src / org / argeo / slc / client / ui / dist / wizards / RegisterRepoWizard.java
index ead05c4cfd2756fca84f05ff8eb11d8c05533ca4..3cebd6862d936a1164c89e9b39187cd8265345ca 100644 (file)
@@ -1,22 +1,6 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 package org.argeo.slc.client.ui.dist.wizards;
 
 import java.net.URI;
-import java.util.Hashtable;
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
@@ -27,16 +11,14 @@ import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.nodetype.NodeType;
 
+import org.argeo.api.NodeUtils;
+import org.argeo.api.security.Keyring;
+import org.argeo.cms.ArgeoNames;
+import org.argeo.cms.ArgeoTypes;
 import org.argeo.eclipse.ui.dialogs.ErrorFeedback;
-import org.argeo.jcr.ArgeoJcrConstants;
-import org.argeo.jcr.ArgeoJcrUtils;
-import org.argeo.jcr.ArgeoNames;
-import org.argeo.jcr.ArgeoTypes;
 import org.argeo.jcr.JcrUtils;
-import org.argeo.jcr.UserJcrUtils;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.repo.RepoConstants;
-import org.argeo.util.security.Keyring;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.wizard.Wizard;
@@ -76,7 +58,7 @@ public class RegisterRepoWizard extends Wizard {
 
        // Default values
        private final static String DEFAULT_NAME = "Argeo Public Repository";
-       private final static String DEFAULT_URI = "http://repo.argeo.org/data/pub/java";
+       private final static String DEFAULT_URI = "https://forge.argeo.org/jcr/java";
        private final static String DEFAULT_USER_NAME = "anonymous";
        private final static boolean DEFAULT_ANONYMOUS = true;
 
@@ -106,7 +88,7 @@ public class RegisterRepoWizard extends Wizard {
                Session nodeSession = null;
                try {
                        nodeSession = nodeRepository.login();
-                       String reposPath = UserJcrUtils.getUserHome(nodeSession).getPath() + RepoConstants.REPOSITORIES_BASE_PATH;
+                       String reposPath = NodeUtils.getUserHome(nodeSession).getPath() + RepoConstants.REPOSITORIES_BASE_PATH;
 
                        Node repos = nodeSession.getNode(reposPath);
                        String repoNodeName = JcrUtils.replaceInvalidChars(name.getText());
@@ -256,20 +238,16 @@ public class RegisterRepoWizard extends Wizard {
                        if (uri.getText().startsWith("http")) {// http, https
                                URI checkedUri = new URI(uri.getText());
                                String checkedUriStr = checkedUri.toString();
-                               Hashtable<String, String> params = new Hashtable<String, String>();
-                               params.put(ArgeoJcrConstants.JCR_REPOSITORY_URI, checkedUriStr);
-                               Repository repository = ArgeoJcrUtils.getRepositoryByUri(repositoryFactory, checkedUriStr);
-                               // FIXME make it more generic
-                               String defaultWorkspace = "main";
+                               Repository repository = NodeUtils.getRepositoryByUri(repositoryFactory, checkedUriStr);
                                if (username.getText().trim().equals("")) {// anonymous
-                                       session = repository.login(defaultWorkspace);
+                                       session = repository.login(RepoConstants.DEFAULT_DEFAULT_WORKSPACE);
                                } else {
                                        char[] pwd = password.getTextChars();
                                        SimpleCredentials sc = new SimpleCredentials(username.getText(), pwd);
-                                       session = repository.login(sc, defaultWorkspace);
+                                       session = repository.login(sc, RepoConstants.DEFAULT_DEFAULT_WORKSPACE);
                                }
                        } else {// alias
-                               Repository repository = ArgeoJcrUtils.getRepositoryByAlias(repositoryFactory, uri.getText());
+                               Repository repository = NodeUtils.getRepositoryByAlias(repositoryFactory, uri.getText());
                                session = repository.login();
                        }
                        MessageDialog.openInformation(getShell(), "Success", "Connection to '" + uri.getText() + "' successful");