1. Shihab Hamid [Atlassian]
  2. mywork-tweets

Commits

Shihab Hamid [Atlassian]  committed 27157fd

another one

  • Participants
  • Parent commits b4c0448
  • Branches master

Comments (0)

Files changed (5)

File src/main/java/com/atlascamp/mywork/tweets/MyWorkTweetsLocaleService.java

-package com.atlascamp.mywork.tweets;
-
-import com.atlassian.confluence.languages.Language;
-import com.atlassian.confluence.languages.LanguageManager;
-import com.atlassian.confluence.languages.LocaleManager;
-import com.atlassian.mywork.service.LocaleService;
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-import java.util.Locale;
-
-/**
- * Unfortunately there isn't a way to get the list of configured locales in the system via SAL.
- */
-public class MyWorkTweetsLocaleService implements LocaleService
-{
-    private final LanguageManager languageManager;
-
-    public MyWorkTweetsLocaleService(LanguageManager languageManager)
-    {
-        this.languageManager = languageManager;
-    }
-
-    @Override
-    public Iterable<Locale> getLocales()
-    {
-        return Lists.transform(languageManager.getLanguages(), new Function<Language, Locale>()
-        {
-            @Override
-            public Locale apply(Language language)
-            {
-                return language.getLocale();
-            }
-        });
-    }
-
-    @Override
-    public Locale getDefaultLocale()
-    {
-        return LocaleManager.DEFAULT_LOCALE;
-    }
-}

File src/main/java/com/atlascamp/mywork/tweets/TweetsRegistrationProvider.java

View file
     @Override
     public String getPluginId()
     {
-        return getPackage() + ".mywork-tweets";
+        return "com.atlascamp.mywork.tweets.mywork-tweets";
     }
 }

File src/main/java/com/atlascamp/mywork/tweets/TwitterListener.java

View file
         System.out.println(status.getUser().getName() + " : " + status.getText());
 
         notificationService.createOrUpdate("admin", new NotificationBuilder()
-                            .application("com.atlascamp.mywork.tweets.mywork-tweets")
+                            .application("com.atlascamp.mywork.tweets")
                             .entity("twitter")
                             .action("tweet")
                             .title(status.getUser().getName())

File src/main/resources/META-INF/spring/myWorkTweets.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:osgi="http://www.springframework.org/schema/osgi"
-       xsi:schemaLocation="
-            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-            http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd ">
-
-    <osgi:service id="osgiLocaleService"
-                  ref="localeService"
-                  interface="com.atlassian.mywork.service.LocaleService"/>
-
-    <osgi:service ref="registrationProvider"
-                  interface="com.atlassian.mywork.service.RegistrationProvider"
-                  depends-on="osgiLocaleService"/>
-
-</beans>

File src/main/resources/atlassian-plugin.xml

View file
     </plugin-info>
 
     <component key="twitterListener" class="com.atlascamp.mywork.tweets.TwitterListener"/>
-    <component key="registrationProvider" class="com.atlascamp.mywork.tweets.TweetsRegistrationProvider"/>
-    <component key="localeService" class="com.atlascamp.mywork.tweets.MyWorkTweetsLocaleService"/>
+    <component key="registrationProvider" class="com.atlascamp.mywork.tweets.TweetsRegistrationProvider" public="true">
+        <interface>com.atlassian.mywork.service.RegistrationProvider</interface>
+    </component>
 
     <component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/>
     <component-import key="crowdService" interface="com.atlassian.crowd.embedded.api.CrowdService"/>