Open main menu

CDOT Wiki β

Changes

Sudoku Generator (Example for the OSGi Lab)

845 bytes added, 19:02, 13 February 2011
Sudoku Generator (Example for the OSGi Lab)
Yes, I know my code (and lack of documentation) is sloppy. That's because I tried to focus on trying to figure out what goes into each bundle. I'm sure I got many things wrong but on the positive side, the code works and actually generates a 9x9 Sudoku puzzle, albeit on the console in text mode. Perhaps in the future I'll produce a GUI output - or maybe someone can do it for me?
 
== Design and Implementation ==
 
First, let me say that I followed Jordan's Voting System example, for both the code as well as the writeup on this wiki.
 
<h4>1. Define the Service</h4>
Create the bundle ''ca.on.senecac.scs.sudoku''
<h6>1.1 Create SudokuGenerator.java</h6>
<source lang="java">
package ca.on.senecac.scs.sudoku;
 
/**
* Defines the interface to the Sudoku Generator OSGi-based
* application.
*
* @author John Selmys
*
*/
public interface SudokuGenerator {
void generate(int row, int col);
}
</source>
<h6>1.2 Define the MANIFEST.MF for the service</h6>
<source lang="xml">
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sudoku
Bundle-SymbolicName: ca.on.senecac.scs.sudoku
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: ca.on.senecac.scs.sudoku
</source>
63
edits