diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src')
3 files changed, 94 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java index 0acbe7520..65ba2e22d 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java @@ -615,4 +615,22 @@ public abstract class AbstractRepositoryConnector { throw new UnsupportedOperationException(); } + /** + * Validates the connection to {@code repository} and returns information about the repository. This typically + * requires connecting to the repository. + * <p> + * Throws {@link UnsupportedOperationException} if not implemented by clients. + * + * @param repository + * the repository + * @param monitor + * a progress monitor + * @throws CoreException + * thrown in case the operation fails + * @since 3.11 + */ + public RepositoryInfo validateRepository(TaskRepository repository, IProgressMonitor monitor) throws CoreException { + throw new UnsupportedOperationException(); + } + } diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java new file mode 100644 index 000000000..739978cba --- /dev/null +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2014 Tasktop Technologies and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.tasks.core; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * Provides information about a {@link TaskRepository} such as the version of the repository. + * + * @noextend This class is not intended to be subclassed by clients. + * @see AbstractRepositoryConnector#validate(TaskRepository, org.eclipse.core.runtime.IProgressMonitor) + * @since 3.11 + */ +public class RepositoryInfo { + + private final RepositoryVersion version; + + public RepositoryInfo(@NonNull RepositoryVersion version) { + this.version = checkNotNull(version); + } + + @NonNull + public RepositoryVersion getVersion() { + return version; + } + +} diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java new file mode 100644 index 000000000..21f7297de --- /dev/null +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2014 Tasktop Technologies and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.tasks.core; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.eclipse.jdt.annotation.NonNull; + +/** + * Represents the version of a {@link TaskRepository}. + * + * @since 3.11 + * @noextend This class is not intended to be subclassed by clients. + */ +// FIXME bug 425593 make this class more generic +public class RepositoryVersion { + + private final String version; + + public RepositoryVersion(@NonNull String version) { + this.version = checkNotNull(version); + } + + @Override + public String toString() { + return version; + } + +} |