<commit_before>/*******************************************************************************
 * Copyright (c) 2005, 2006 svnClientAdapter project and others.
 *
 * 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.
 *
 * Contributors:
 *     svnClientAdapter project committers - initial API and implementation
 ******************************************************************************/
package org.tigris.subversion.svnclientadapter.svnkit;

import java.io.File;

import org.tigris.subversion.javahl.ClientException;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
import org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNStatusUnversioned;
import org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter;
import org.tigris.subversion.svnclientadapter.javahl.JhlNotificationHandler;
import org.tigris.subversion.svnclientadapter.javahl.JhlProgressListener;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.javahl.SVNClientImpl;

/**
 * The SVNKit Adapter works by providing an implementation of the
 * JavaHL SVNClientInterface.  This allows to provide a common
 * JavaHL implementation (AbstractJhlClientAdapter) where the specific
 * adapters just need to initialize the correct underlying classes.
 *
 */
public class SvnKitClientAdapter extends AbstractJhlClientAdapter {

    public SvnKitClientAdapter() {
        svnClient = SVNClientImpl.newInstance();
        notificationHandler = new JhlNotificationHandler();
        progressListener = new JhlProgressListener();
        svnClient.notification2(notificationHandler);        
        svnClient.setPrompt(new DefaultPromptUserPassword());
        svnClient.setProgressListener(progressListener);
    }

	public boolean isThreadsafe() {
		return false;
	}

    public void createRepository(File path, String repositoryType)
            throws SVNClientException {
    	if (REPOSITORY_FSTYPE_BDB.equalsIgnoreCase(repositoryType))
    		throw new SVNClientException("SVNKit only supports fsfs repository type.");
    	try {
    		boolean force = false;
    		boolean enableRevisionProperties = false;
			SVNRepositoryFactory.createLocalRepository(path, enableRevisionProperties, force);
		} catch (SVNException e) {
            notificationHandler.logException(e);
            throw new SVNClientException(e);
		}
     }
    
 
    public void addPasswordCallback(ISVNPromptUserPassword callback) {
        if (callback != null) {<commit_msg>Add an extension point so that a plug-in can provide a custom SSH provider for SVNKit.<commit_after>/*******************************************************************************
 * Copyright (c) 2005, 2006 svnClientAdapter project and others.
 *
 * 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.
 *
 * Contributors:
 *     svnClientAdapter project committers - initial API and implementation
 ******************************************************************************/
package org.tigris.subversion.svnclientadapter.svnkit;

import java.io.File;

import org.tigris.subversion.javahl.ClientException;
import org.tigris.subversion.javahl.SVNClient;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
import org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNStatusUnversioned;
import org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter;
import org.tigris.subversion.svnclientadapter.javahl.JhlNotificationHandler;
import org.tigris.subversion.svnclientadapter.javahl.JhlProgressListener;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.io.dav.http.IHTTPConnectionFactory;
import org.tmatesoft.svn.core.internal.io.svn.ISVNConnectorFactory;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.javahl.SVNClientImpl;

/**
 * The SVNKit Adapter works by providing an implementation of the
 * JavaHL SVNClientInterface.  This allows to provide a common
 * JavaHL implementation (AbstractJhlClientAdapter) where the specific
 * adapters just need to initialize the correct underlying classes.
 *
 */
public class SvnKitClientAdapter extends AbstractJhlClientAdapter {

    public SvnKitClientAdapter() {
        this(null, null, null);
    }

    public SvnKitClientAdapter(SVNClient owner,
                               IHTTPConnectionFactory httpConnectionFactory,
                               ISVNConnectorFactory svnConnectorFactory) {
        svnClient = SVNClientImpl.newInstance(owner, httpConnectionFactory, svnConnectorFactory);
        notificationHandler = new JhlNotificationHandler();
        progressListener = new JhlProgressListener();
        svnClient.notification2(notificationHandler);        
        svnClient.setPrompt(new DefaultPromptUserPassword());
        svnClient.setProgressListener(progressListener);
    }

	public boolean isThreadsafe() {
		return false;
	}

    public void createRepository(File path, String repositoryType)
            throws SVNClientException {
    	if (REPOSITORY_FSTYPE_BDB.equalsIgnoreCase(repositoryType))
    		throw new SVNClientException("SVNKit only supports fsfs repository type.");
    	try {
    		boolean force = false;
    		boolean enableRevisionProperties = false;
			SVNRepositoryFactory.createLocalRepository(path, enableRevisionProperties, force);
		} catch (SVNException e) {
            notificationHandler.logException(e);
            throw new SVNClientException(e);
		}
     }
    
 
    public void addPasswordCallback(ISVNPromptUserPassword callback) {
        if (callback != null) {
{'fraction_non_alphanumeric': 0.11414213926776741, 'fraction_numerical': 0.0037329504666188083, 'mean_word_length': 4.5728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1796759', 'n_tokens_mistral': 1898, 'n_tokens_neox': 1819, 'n_words': 477}