Retrieving the existing code:
svn checkout https://svn.java.net/svn/worldclock-application~svn/tags/application6-jigsaw-maven ~/dev/worldclock-hk2
And the new pom and module-info:
svn checkout https://svn.kenai.com/svn/lh-playground~svn/jigsaw/worldclock-hk2 ~/dev/worldclock-hk2-downloads
Panel
Overwrite the existing pom and module info for the panel:cp ~/dev/worldclock-hk2-downloads/panel/pom.xml ~/dev/worldclock-hk2/panel/(update the libraryDirectory path for your set up / username, gedit ~/dev/worldclock-hk2/panel/pom.xml & )
cp ~/dev/worldclock-hk2-downloads/panel/src/main/java/lh.worldclock.panel/module-info.java ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/Add the sample HK2 dependency injection contract:
mkdir -p ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/hk2/
gedit ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/hk2/PanelProvider.java &then add the content
package lh.worldclock.hk2;Add the sample HK2 dependency injection service:
import lh.worldclock.core.WorldClockBoard;
import org.jvnet.hk2.annotations.Contract;
@Contract
public interface PanelProvider
{
WorldClockBoard getPanel();
}
gedit ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/hk2/PanelProviderImpl.java &then add the content
package lh.worldclock.hk2;build
import lh.worldclock.core.WorldClockBoard;
import org.jvnet.hk2.annotations.Service;
@Service
public class PanelProviderImpl implements PanelProvider
{
@Override
public WorldClockBoard getPanel()
{
return new WorldClockBoard();
}
}
cd ~/dev/worldclock-hk2/panel/(if the build fail due to invalid characters, edit the file and remove the comments
mvn -Dmaven.test.skip=true clean install
gedit ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/core/WorldClockBoard.java & )
Application
Overwrite the existing pom and module info for the application:
cp ~/dev/worldclock-hk2-downloads/application/pom.xml ~/dev/worldclock-hk2/application/(update the libraryDirectory path for your set up / username, gedit ~/dev/worldclock-hk2/application/pom.xml & )
cp ~/dev/worldclock-hk2-downloads/application/src/main/java/lh.worldclock.application/module-info.java ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/
Adjust WorldClockPanel:
gedit ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/lh/worldclock/WorldClockPanel.java &
replace constructor start with:
public WorldClockPanel(final WorldClockBoard board)Adjust WorldClockFrame:
{
// board = new WorldClockBoard();
this.board = board;
gedit ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/lh/worldclock/WorldClockFrame.java &
add import
import lh.worldclock.core.WorldClockBoard;
remove the initialisation of pane
WorldClockPanel pane;
replace constructor start with:
public WorldClockFrame(ImageIcon icon, final WorldClockBoard board)Adjust WorldClock
{
pane = new WorldClockPanel(board);
gedit ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/lh/worldclock/WorldClock.java &
add imports
import com.sun.enterprise.module.bootstrap.ModuleStartup;
import com.sun.enterprise.module.bootstrap.StartupContext;
import org.jvnet.hk2.annotations.Inject;
import org.jvnet.hk2.annotations.Service;
import lh.worldclock.core.WorldClockBoard;
replace class declaration
@Service
public class WorldClock implements ModuleStartup
make the frame non static
/*static*/ WorldClockFrame frame = null;add the injection
@Injectmake main method non static
WorldClockBoard board;
make void showWindow() non static and change
frame = new WorldClockFrame(icon, board);
to add the board
make private PopupMenu createPopup() non static
add the following new methods
public void setStartupContext(StartupContext context)build
{
}
public void start()
{
main(new String[]{});
}
public void stop()
{
}
cd ~/dev/worldclock-hk2/application/
mvn -Dmaven.test.skip=true clean install
Time to run:
cd ~/dev/hk2-jigsaw/jigsaw-adapter/
mvn lh.jigsaw:jigsaw-maven-plugin:run
No comments:
Post a Comment