Java Code Examples for org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory#setup()

The following examples show how to use org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory#setup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SvnKitProcessor.java    From StatSVN with GNU Lesser General Public License v3.0 6 votes vote down vote up
public SVNClientManager getManager()
{
    if (manager==null) 
    {
        // initialize 
        DAVRepositoryFactory.setup();
        SVNRepositoryFactoryImpl.setup();
        FSRepositoryFactory.setup();
        
        //readonly - configuration options are available only for reading
        DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true);
        options.setAuthStorageEnabled(false);
                
        // Creates an instance of SVNClientManager providing an options driver & username & password 
        if (SvnConfigurationOptions.getSvnUsername()!=null && SvnConfigurationOptions.getSvnPassword()!=null)
            manager = SVNClientManager.newInstance(options, SvnConfigurationOptions.getSvnUsername(), SvnConfigurationOptions.getSvnPassword());
        else
            manager = SVNClientManager.newInstance(options);
    }
    return manager;
}
 
Example 2
Source File: SubversionRepositoryInitializer.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
public SVNRepository initRepository(boolean cached) throws SVNException, MalformedURLException {
	SVNRepository repo = null;
	SVNURL svnUrl = SVNURL.parseURIEncoded(url);
	if (url.startsWith(HTTP_SCHEME + SCHEME_SEPARATOR) || url.startsWith(HTTPS_SCHEME + SCHEME_SEPARATOR)) {
		DAVRepositoryFactory.setup();
		repo = DAVRepositoryFactory.create(svnUrl);
		repo.testConnection();
		if(cached) {
			TmpDirCreator tmpDirCreator = new TmpDirCreator(url);
			File tempDir = tmpDirCreator.getLocalTempDir();
			SVNURL cachedRepoPath = SVNURL.parseURIEncoded(FILE_SCHEME + SCHEME_SEPARATOR + tempDir);
			if(!tempDir.exists()){
				messageOutputStream.println("Caching subversion repository " + svnUrl + " This can take a while...");
				tempDir.mkdirs();
				cachedRepoPath = SVNRepositoryFactory.createLocalRepository(tempDir, true, true);
				tmpDirCreator.writeIdFileToTempDir();
				SVNRepository targetRepo = SVNRepositoryFactory.create(cachedRepoPath);
				SVNRepositoryReplicator replicator = SVNRepositoryReplicator.newInstance();
				replicator.setReplicationHandler(new ProgressBarReplicationHandler(repo.getLatestRevision()));
				replicator.replicateRepository(repo, targetRepo, -1, -1);
				messageOutputStream.println("\nCaching finished succesfully...");
			}
			svnUrl = cachedRepoPath;
			FSRepositoryFactory.setup();
			repo = FSRepositoryFactory.create(svnUrl);
		}
	} else if (url.startsWith(SVN_SCHEME + SCHEME_SEPARATOR)) {
		SVNRepositoryFactoryImpl.setup();
		repo = SVNRepositoryFactoryImpl.create(svnUrl);
	} else if (url.startsWith(FILE_SCHEME + SCHEME_SEPARATOR)) {
		FSRepositoryFactory.setup();
		repo = FSRepositoryFactory.create(svnUrl);
	} else
		throw new MalformedURLException(String.format("URL %s is not an supported SVN url!", url));
	repo.testConnection();
	return repo;
}
 
Example 3
Source File: TestCheckOut.java    From klask-io with GNU General Public License v3.0 5 votes vote down vote up
public void checkoutTest() throws SVNException {
    String checkoutPath = "svn://localhost";
    String username = "integration";
    String password = "integration";
    String checkoutRootPath = new File("/home/jeremie/Developpement/checkoutsvn").getAbsolutePath();

    DAVRepositoryFactory.setup();

    final SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(checkoutPath));
    repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(username, password));

    final SVNClientManager clientManager = SVNClientManager.newInstance(null, repository.getAuthenticationManager());
    final SVNUpdateClient updateClient = clientManager.getUpdateClient();

    updateClient.setIgnoreExternals(false);

    final SVNNodeKind nodeKind = repository.checkPath("", -1);

    if (nodeKind == SVNNodeKind.NONE) {
        System.err.println("There is no entry at '" + checkoutPath + "'.");
        System.exit(1);
    } else if (nodeKind == SVNNodeKind.FILE) {
        System.err.println("The entry at '" + checkoutPath + "' is a file while a directory was expected.");
        System.exit(1);
    }
    System.out.println("*** CHECKOUT SVN Trunk/Branches ***");
    System.out.println("Checkout source: " + checkoutPath);
    System.out.println("Checkout destination: " + checkoutRootPath);
    System.out.println("...");
    try {
        traverse(updateClient, repository, checkoutPath, checkoutRootPath, "", true);
    } catch (final Exception e) {
        System.err.println("ERROR : " + e.getMessage());
        e.printStackTrace(System.err);
        System.exit(-1);
    }
    System.out.println("");
    System.out.println("Repository latest revision: " + repository.getLatestRevision());
}
 
Example 4
Source File: SvnUtil.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
public static void setupLibrary() {
    DAVRepositoryFactory.setup();
    SVNRepositoryFactoryImpl.setup();
    FSRepositoryFactory.setup();
}