summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-12-17 11:41:28 (EST)
committerSteffen Pingel2011-12-17 11:41:28 (EST)
commitfa13071531ed2df29b14a7b33a6297ff78a6fe45 (patch)
treea9007ef64bd0175f6512f75fc9b99213a91fcae2
parent526277af173d41cca1cfe6602fa1be276724eaa5 (diff)
downloadorg.eclipse.mylyn.commons-fa13071531ed2df29b14a7b33a6297ff78a6fe45.zip
org.eclipse.mylyn.commons-fa13071531ed2df29b14a7b33a6297ff78a6fe45.tar.gz
org.eclipse.mylyn.commons-fa13071531ed2df29b14a7b33a6297ff78a6fe45.tar.bz2
NEW - bug 367003: expose identity model as OSGi service
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367003 Change-Id: Idab5972f3e5d1485a1d926d07c57926f5c7a785d
-rw-r--r--org.eclipse.mylyn.commons.identity.core/.project5
-rw-r--r--org.eclipse.mylyn.commons.identity.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.commons.identity.core/OSGI-INF/component.xml7
-rw-r--r--org.eclipse.mylyn.commons.identity.core/build.properties18
-rw-r--r--org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/IIdentityService.java25
-rw-r--r--org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/spi/AbstractIdentityService.java21
-rw-r--r--org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityModel.java3
-rw-r--r--org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityService.java39
-rw-r--r--org.eclipse.mylyn.commons.identity.ui/plugin.xml18
-rw-r--r--org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/IdentityUiPlugin.java17
-rw-r--r--org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/PeopleContentProvider.java8
-rw-r--r--org.eclipse.mylyn.commons.sdk-feature/feature.xml2
-rw-r--r--pom.xml2
13 files changed, 135 insertions, 31 deletions
diff --git a/org.eclipse.mylyn.commons.identity.core/.project b/org.eclipse.mylyn.commons.identity.core/.project
index fe5d2b0..5b21922 100644
--- a/org.eclipse.mylyn.commons.identity.core/.project
+++ b/org.eclipse.mylyn.commons.identity.core/.project
@@ -25,6 +25,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/org.eclipse.mylyn.commons.identity.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.commons.identity.core/META-INF/MANIFEST.MF
index 39b8a74..fafc843 100644
--- a/org.eclipse.mylyn.commons.identity.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.commons.identity.core/META-INF/MANIFEST.MF
@@ -13,3 +13,4 @@ Export-Package: org.eclipse.mylyn.commons.identity.core;x-internal:=true,
org.eclipse.mylyn.commons.identity.core.spi;x-internal:=true,
org.eclipse.mylyn.internal.commons.identity.core;x-internal:=true,
org.eclipse.mylyn.internal.commons.identity.core.gravatar;x-internal:=true
+Service-Component: OSGI-INF/component.xml
diff --git a/org.eclipse.mylyn.commons.identity.core/OSGI-INF/component.xml b/org.eclipse.mylyn.commons.identity.core/OSGI-INF/component.xml
new file mode 100644
index 0000000..3f11db9
--- /dev/null
+++ b/org.eclipse.mylyn.commons.identity.core/OSGI-INF/component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.mylyn.commons.identity.core">
+ <implementation class="org.eclipse.mylyn.internal.commons.identity.core.IdentityService"/>
+ <service>
+ <provide interface="org.eclipse.mylyn.commons.identity.core.IIdentityService"/>
+ </service>
+</scr:component>
diff --git a/org.eclipse.mylyn.commons.identity.core/build.properties b/org.eclipse.mylyn.commons.identity.core/build.properties
index 87800b1..4e00880 100644
--- a/org.eclipse.mylyn.commons.identity.core/build.properties
+++ b/org.eclipse.mylyn.commons.identity.core/build.properties
@@ -1,19 +1,9 @@
-###############################################################################
-# Copyright (c) 2010 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
-###############################################################################
-
bin.includes = .,\
META-INF/,\
plugin.properties,\
- about.html
-jars.compile.order = .
-source.. = src/
+ about.html,\
+ OSGI-INF/
output.. = bin/
+jars.compile.order = .
src.includes = about.html
+source.. = src/
diff --git a/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/IIdentityService.java b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/IIdentityService.java
new file mode 100644
index 0000000..d5b0ee9
--- /dev/null
+++ b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/IIdentityService.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.commons.identity.core;
+
+/**
+ * @author Steffen Pingel
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IIdentityService {
+
+ public abstract IIdentity getIdentity(Account account);
+
+ public abstract IIdentity[] getIdentities();
+
+}
diff --git a/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/spi/AbstractIdentityService.java b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/spi/AbstractIdentityService.java
new file mode 100644
index 0000000..aa89ac9
--- /dev/null
+++ b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/spi/AbstractIdentityService.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.commons.identity.core.spi;
+
+import org.eclipse.mylyn.commons.identity.core.IIdentityService;
+
+/**
+ * @author spingel
+ */
+public abstract class AbstractIdentityService implements IIdentityService {
+
+}
diff --git a/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityModel.java b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityModel.java
index 3b8fc79..647d43f 100644
--- a/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityModel.java
+++ b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityModel.java
@@ -11,7 +11,6 @@
package org.eclipse.mylyn.internal.commons.identity.core;
-import java.io.File;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@@ -40,7 +39,7 @@ public final class IdentityModel implements Serializable {
private final Map<UUID, Identity> identityById;
- public IdentityModel(File cacheDirectory) {
+ public IdentityModel() {
connectors = new CopyOnWriteArrayList<IdentityConnector>();
identityById = new WeakHashMap<UUID, Identity>();
}
diff --git a/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityService.java b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityService.java
new file mode 100644
index 0000000..a1be0af
--- /dev/null
+++ b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/internal/commons/identity/core/IdentityService.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.commons.identity.core;
+
+import org.eclipse.mylyn.commons.identity.core.Account;
+import org.eclipse.mylyn.commons.identity.core.IIdentity;
+import org.eclipse.mylyn.commons.identity.core.spi.AbstractIdentityService;
+import org.eclipse.mylyn.internal.commons.identity.core.gravatar.GravatarConnector;
+
+/**
+ * @author Steffen Pingel
+ */
+public class IdentityService extends AbstractIdentityService {
+
+ private final IdentityModel model;
+
+ public IdentityService() {
+ model = new IdentityModel();
+ model.addConnector(new GravatarConnector());
+ }
+
+ public IIdentity getIdentity(Account account) {
+ return model.getIdentity(account);
+ }
+
+ public IIdentity[] getIdentities() {
+ return model.getIdentities();
+ }
+
+}
diff --git a/org.eclipse.mylyn.commons.identity.ui/plugin.xml b/org.eclipse.mylyn.commons.identity.ui/plugin.xml
index 4fd3f0a..4cd236a 100644
--- a/org.eclipse.mylyn.commons.identity.ui/plugin.xml
+++ b/org.eclipse.mylyn.commons.identity.ui/plugin.xml
@@ -9,14 +9,14 @@
category="org.eclipse.mylyn.ui"
class="org.eclipse.mylyn.internal.commons.identity.ui.PeopleView"
icon="icons/obj16/people.gif"
- id="org.eclipse.mylyn.commons.ui.identity.navigator.People"
+ id="org.eclipse.mylyn.commons.identity.ui.navigator.People"
name="People">
</view>
</extension>
<extension
point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding
- viewerId="org.eclipse.mylyn.commons.ui.identity.navigator.People">
+ viewerId="org.eclipse.mylyn.commons.identity.ui.navigator.People">
<includes>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.linkHelper">
@@ -24,18 +24,18 @@
</includes>
</viewerContentBinding>
<viewerContentBinding
- viewerId="org.eclipse.mylyn.commons.ui.identity.navigator.People">
+ viewerId="org.eclipse.mylyn.commons.identity.ui.navigator.People">
<includes>
<contentExtension
- pattern="org.eclipse.mylyn.commons.ui.identity.navigator.*">
+ pattern="org.eclipse.mylyn.commons.identity.ui.navigator.*">
</contentExtension>
</includes>
</viewerContentBinding>
<viewerActionBinding
- viewerId="org.eclipse.mylyn.commons.ui.identity.navigator.People">
+ viewerId="org.eclipse.mylyn.commons.identity.ui.navigator.People">
<includes>
<actionExtension
- pattern="org.eclipse.mylyn.commons.ui.identity.navigator.*">
+ pattern="org.eclipse.mylyn.commons.identity.ui.navigator.*">
</actionExtension>
</includes>
</viewerActionBinding>
@@ -46,7 +46,7 @@
activeByDefault="true"
contentProvider="org.eclipse.mylyn.internal.commons.identity.ui.PeopleContentProvider"
icon="icons/obj16/person.gif"
- id="org.eclipse.mylyn.commons.ui.identity.navigator.People"
+ id="org.eclipse.mylyn.commons.identity.ui.navigator.People"
labelProvider="org.eclipse.mylyn.internal.commons.identity.ui.PersonLabelProvider"
name="People">
<possibleChildren>
@@ -67,7 +67,7 @@
<extension
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="toolbar:org.eclipse.mylyn.commons.ui.identity.navigator.People">
+ locationURI="toolbar:org.eclipse.mylyn.commons.identity.ui.navigator.People">
<command
commandId="org.eclipse.ui.file.refresh"
style="push">
@@ -81,7 +81,7 @@
commandId="org.eclipse.ui.file.refresh">
<activeWhen>
<with variable="activePartId">
- <equals value="org.eclipse.mylyn.commons.ui.identity.navigator.People"/>
+ <equals value="org.eclipse.mylyn.commons.identity.ui.navigator.People"/>
</with>
</activeWhen>
</handler>
diff --git a/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/IdentityUiPlugin.java b/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/IdentityUiPlugin.java
index b911f8b..2d4dc71 100644
--- a/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/IdentityUiPlugin.java
+++ b/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/IdentityUiPlugin.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.mylyn.internal.commons.identity.ui;
+import org.eclipse.mylyn.commons.identity.core.IIdentityService;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
/**
* @author Steffen Pingel
@@ -22,6 +24,8 @@ public class IdentityUiPlugin extends AbstractUIPlugin {
private static IdentityUiPlugin plugin;
+ private ServiceTracker identityServiceTracker;
+
public IdentityUiPlugin() {
}
@@ -33,6 +37,10 @@ public class IdentityUiPlugin extends AbstractUIPlugin {
@Override
public void stop(BundleContext context) throws Exception {
+ if (identityServiceTracker != null) {
+ identityServiceTracker.close();
+ identityServiceTracker = null;
+ }
plugin = null;
super.stop(context);
}
@@ -46,4 +54,13 @@ public class IdentityUiPlugin extends AbstractUIPlugin {
return plugin;
}
+ public IIdentityService getIdentityService() {
+ if (identityServiceTracker == null) {
+ identityServiceTracker = new ServiceTracker(getBundle().getBundleContext(),
+ IIdentityService.class.getName(), null);
+ identityServiceTracker.open();
+ }
+ return (IIdentityService) identityServiceTracker.getService();
+ }
+
}
diff --git a/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/PeopleContentProvider.java b/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/PeopleContentProvider.java
index 722473a..f8871e6 100644
--- a/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/PeopleContentProvider.java
+++ b/org.eclipse.mylyn.commons.identity.ui/src/org/eclipse/mylyn/internal/commons/identity/ui/PeopleContentProvider.java
@@ -14,7 +14,7 @@ package org.eclipse.mylyn.internal.commons.identity.ui;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.commons.identity.core.IIdentity;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.commons.identity.core.IIdentityService;
/**
* @author Steffen Pingel
@@ -36,7 +36,11 @@ public class PeopleContentProvider implements ITreeContentProvider {
}
public Object[] getElements(Object inputElement) {
- return TasksUiPlugin.getDefault().getIdentityModel().getIdentities();
+ IIdentityService identityService = IdentityUiPlugin.getDefault().getIdentityService();
+ if (identityService != null) {
+ return identityService.getIdentities();
+ }
+ return null;
}
public Object[] getChildren(Object parentElement) {
diff --git a/org.eclipse.mylyn.commons.sdk-feature/feature.xml b/org.eclipse.mylyn.commons.sdk-feature/feature.xml
index 29a990e..3181072 100644
--- a/org.eclipse.mylyn.commons.sdk-feature/feature.xml
+++ b/org.eclipse.mylyn.commons.sdk-feature/feature.xml
@@ -125,14 +125,12 @@
version="0.0.0"
unpack="false"/>
- <!--
<plugin
id="org.eclipse.mylyn.commons.identity.ui.source"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
- -->
<plugin
id="org.eclipse.mylyn.commons.net.source"
diff --git a/pom.xml b/pom.xml
index 105e82d..9ada259 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,9 +57,7 @@
<module>org.eclipse.mylyn.commons.activity.ui</module>
<module>org.eclipse.mylyn.commons.identity-feature</module>
<module>org.eclipse.mylyn.commons.identity.core</module>
- <!--
<module>org.eclipse.mylyn.commons.identity.ui</module>
- -->
<module>org.eclipse.mylyn.commons.notifications-feature</module>
<module>org.eclipse.mylyn.commons.notifications.core</module>
<module>org.eclipse.mylyn.commons.notifications.feed</module>