Thursday, April 8, 2010

Where is DS Annotation?

I used Declarative Service in my application, JAM Circle.
Declarative Service is cool stuff.
It makes to solve bundles startup order.
But I confused a thing.
How do I inject the service at startup time?
I think services needs to initialize at startup.
So I choosed the way to solve by singleton class like below.

scr.xml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.kompiro.jamcircle.kanban.ui.KanbanUIContext">
<implementation class="org.kompiro.jamcircle.kanban.ui.KanbanUIContext"/>
<reference bind="setKanbanService" cardinality="1..1" interface="org.kompiro.jamcircle.kanban.service.KanbanService" name="KanbanService" policy="static"/>
<reference bind="setScriptingService" cardinality="1..1" interface="org.kompiro.jamcircle.scripting.ScriptingService" name="ScriptingService" policy="static"/>
</scr:component>

and implementation of Context class(The name inspired from "ApplicationContext")

package org.kompiro.jamcircle.kanban.ui;

import org.kompiro.jamcircle.kanban.service.KanbanService;
import org.kompiro.jamcircle.scripting.ScriptingService;

public class KanbanUIContext {

private static KanbanUIContext context;
private KanbanService kanbanService;
private ScriptingService scriptingService;

public KanbanUIContext() {
KanbanUIContext.context = this;
}

public static KanbanUIContext getDefault(){
return context;
}

public KanbanService getKanbanService() {
return kanbanService;
}

public void setKanbanService(KanbanService kanbanService) {
this.kanbanService = kanbanService;
}

public ScriptingService getScriptingService() {
return scriptingService;
}

public void setScriptingService(ScriptingService scriptService) {
this.scriptingService = scriptService;
}

}


It's not good way(T_T)... KanbanUIContext is a singleton class and be used to call ServiceLocator Pattern. It is not easy to test by code...
I haven't know there is no way to inject to use annotation for field injection.
Is there any way to use annotation and field injection?

Wednesday, April 7, 2010

JAM Circle 0.8.0 released

Hi all!

I'm glad to announce to release my RCP application JAM Circle 0.8.0!
Download site
https://sourceforge.net/projects/jamcircle/files/

Project Page
http://kompiro.org/jamcircle

These are New Feature.
* Migrated p2 base Eclipse platform
* Added some Board customize extension point
* JRuby Scripting Console
* improved figures design
* added Japanese resource
* added Eclipes Plug-in Edition
* fixed some bugs