diff options
10 files changed, 310 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF index 39d8ba946..0fe8f2f6d 100644 --- a/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF @@ -8,3 +8,5 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.core.runtime, org.eclipse.mylyn.tasks.core;bundle-version="3.8.0" Bundle-Localization: plugin +Export-Package: org.eclipse.mylyn.internal.tasks.activity.core;x-internal:=true, + org.eclipse.mylyn.tasks.activity.core;x-internal:=true diff --git a/org.eclipse.mylyn.tasks.activity.core/src/.placeholder b/org.eclipse.mylyn.tasks.activity.core/src/.placeholder deleted file mode 100644 index e69de29bb..000000000 --- a/org.eclipse.mylyn.tasks.activity.core/src/.placeholder +++ /dev/null diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java new file mode 100644 index 000000000..78fbc93d8 --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityCoreInternal.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 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.internal.tasks.activity.core; + + +/** + * @author Steffen Pingel + */ +public class ActivityCoreInternal { + + private static ActivityManager activityManager = new ActivityManager(); + + public static ActivityManager getActivityManager() { + return activityManager; + } + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java new file mode 100644 index 000000000..fc3664a1e --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2012 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.internal.tasks.activity.core; + +import org.eclipse.mylyn.tasks.activity.core.ActivityScope; +import org.eclipse.mylyn.tasks.activity.core.IActivityManager; +import org.eclipse.mylyn.tasks.activity.core.IActivityStream; + +/** + * @author Steffen Pingel + */ +public class ActivityManager implements IActivityManager { + + public IActivityStream getStream(ActivityScope scope) { + return new ActivityStream(this, scope); + } + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java new file mode 100644 index 000000000..6535573cf --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2012 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.internal.tasks.activity.core; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.mylyn.tasks.activity.core.ActivityEvent; +import org.eclipse.mylyn.tasks.activity.core.ActivityScope; +import org.eclipse.mylyn.tasks.activity.core.IActivityManager; +import org.eclipse.mylyn.tasks.activity.core.IActivityStream; + +/** + * @author Steffen Pingel + */ +public class ActivityStream implements IActivityStream { + + private final List<ActivityEvent> events; + + private final ActivityScope scope; + + private final IActivityManager manager; + + public ActivityStream(IActivityManager manager, ActivityScope scope) { + Assert.isNotNull(manager); + Assert.isNotNull(scope); + this.manager = manager; + this.scope = scope; + this.events = new CopyOnWriteArrayList<ActivityEvent>(); + } + + public void addEvent(ActivityEvent event) { + events.add(event); + } + + public List<ActivityEvent> getEvents() { + return events; + } + + public IActivityManager getManager() { + return manager; + } + + public ActivityScope getScope() { + return scope; + } + + public void removeEvent(ActivityEvent event) { + events.remove(event); + } + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java new file mode 100644 index 000000000..018bc1bf0 --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityCore.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2012 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.activity.core; + +import org.eclipse.mylyn.internal.tasks.activity.core.ActivityCoreInternal; + +/** + * @author Steffen Pingel + */ +public class ActivityCore { + + public static IActivityManager getActivityManager() { + return ActivityCoreInternal.getActivityManager(); + } + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java new file mode 100644 index 000000000..05a81dd9d --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityEvent.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2012 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.activity.core; + +import java.util.Date; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; + +/** + * @author Steffen Pingel + */ +public class ActivityEvent { + + private final String handle; + + private final String kind; + + private final String summary; + + private final Date date; + + private final Map<String, String> attributes; + + public ActivityEvent(String handle, String kind, String summary, Date date, Map<String, String> attributes) { + Assert.isNotNull(handle); + Assert.isNotNull(kind); + Assert.isNotNull(summary); + Assert.isNotNull(date); + this.handle = handle; + this.kind = kind; + this.summary = summary; + this.date = date; + this.attributes = attributes; + } + + public String getKind() { + return kind; + } + + public String getSummary() { + return summary; + } + + public String getHandle() { + return handle; + } + + public Date getDate() { + return date; + } + + public Map<String, String> getAttributes() { + return attributes; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((handle == null) ? 0 : handle.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ActivityEvent other = (ActivityEvent) obj; + if (handle == null) { + if (other.handle != null) { + return false; + } + } else if (!handle.equals(other.handle)) { + return false; + } + return true; + } + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java new file mode 100644 index 000000000..ee0fc5d3c --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/ActivityScope.java @@ -0,0 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2012 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.activity.core; + +public class ActivityScope { + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java new file mode 100644 index 000000000..7b05b3c7c --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityManager.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2012 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.activity.core; + +/** + * @author Steffen Pingel + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public interface IActivityManager { + + /** + * Returns the activity stream for <code>scope</code>. + * + * @param scope + * the scope, must not be <code>null</code> + */ + IActivityStream getStream(ActivityScope scope); + +} diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java new file mode 100644 index 000000000..c48d588df --- /dev/null +++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/IActivityStream.java @@ -0,0 +1,27 @@ +package org.eclipse.mylyn.tasks.activity.core; + +import java.util.List; + +/******************************************************************************* + * Copyright (c) 2012 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 + *******************************************************************************/ + +/** + * Defines a stream of {@link ActivityEvent}s that + * + * @author spingel + */ +public interface IActivityStream { + + List<ActivityEvent> getEvents(); + + ActivityScope getScope(); + +} |