You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/10/17 19:04:06 UTC
svn commit: r705672 [2/2] - in /felix/sandbox/clement/ipojo-tutorials:
10.minutes.tutorial/solution/spell.checker/
10.minutes.tutorial/solution/spell.checker/src/spell/check/
10.minutes.tutorial/solution/spell.checker/src/spell/checker/
10.minutes.tuto...
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/spell.english.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/spell.english.bnd?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/spell.english.bnd (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/spell.english.bnd Fri Oct 17 10:04:04 2008
@@ -0,0 +1 @@
+Private-Package: spell.english
\ No newline at end of file
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/src/spell/english/EnglishDictionary.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/src/spell/english/EnglishDictionary.java?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/src/spell/english/EnglishDictionary.java (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.english/src/spell/english/EnglishDictionary.java Fri Oct 17 10:04:04 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package spell.english;
+
+import spell.services.DictionaryService;
+
+/**
+ * An implementation of the Dictionary service containing English words
+ * see DictionaryService for details of the service.
+ **/
+public class EnglishDictionary implements DictionaryService {
+
+ // The set of words contained in the dictionary.
+ String[] m_dictionary = { "welcome", "to", "the", "ipojo", "tutorial" };
+
+ /**
+ * Implements DictionaryService.checkWord(). Determines
+ * if the passed in word is contained in the dictionary.
+ * @param word the word to be checked.
+ * @return true if the word is in the dictionary,
+ * false otherwise.
+ **/
+ public boolean checkWord(String word) {
+ word = word.toLowerCase();
+
+ // This is very inefficient
+ for (int i = 0; i < m_dictionary.length; i++) {
+ if (m_dictionary[i].equals(word)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Propchange: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 17 10:04:04 2008
@@ -0,0 +1 @@
+libs
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/build.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/build.xml?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/build.xml (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/build.xml Fri Oct 17 10:04:04 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<project name="spell.french" default="package" basedir=".">
+
+ <property name="src.dir" value="src"/>
+ <property name="lib.dir" value="libs"/>
+ <property name="build.dir" value="output/classes"/>
+ <property name="output.dir" value="output"/>
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties"
+ classpath="../tasks/bnd-0.0.223.jar"/>
+ <taskdef name="ipojo" classpath="../tasks/org.apache.felix.ipojo.ant-0.8.1.jar"
+ classname="org.apache.felix.ipojo.task.IPojoTask"/>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete dir="${output.dir}"/>
+ </target>
+
+ <target name="buildclasspath">
+ <copy file="../spell.services/output/spell.services.jar" todir="${lib.dir}"/>
+ </target>
+
+ <target name="compile" depends="clean, buildclasspath">
+ <mkdir dir="${output.dir}"/>
+ <mkdir dir="${build.dir}"/>
+
+ <javac srcdir="${src.dir}"
+ destdir="${build.dir}"
+ debug="on"
+ classpath="libs/spell.services.jar"
+ />
+
+ </target>
+
+ <target name="package" depends="compile">
+ <bnd
+ classpath="${build.dir}"
+ failok="false"
+ exceptions="true"
+ files="${ant.project.name}.bnd"
+ output="${output.dir}"/>
+
+ <ipojo
+ input="${output.dir}/${ant.project.name}.jar"
+ metadata="metadata.xml"
+ />
+ </target>
+
+</project>
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/metadata.xml?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/metadata.xml (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/metadata.xml Fri Oct 17 10:04:04 2008
@@ -0,0 +1,5 @@
+<ipojo>
+<component classname="spell.french.FrenchDictionary">
+ <provides/>
+</component>
+</ipojo>
\ No newline at end of file
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/spell.french.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/spell.french.bnd?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/spell.french.bnd (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/spell.french.bnd Fri Oct 17 10:04:04 2008
@@ -0,0 +1 @@
+Private-Package: spell.french
\ No newline at end of file
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/src/spell/french/FrenchDictionary.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/src/spell/french/FrenchDictionary.java?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/src/spell/french/FrenchDictionary.java (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.french/src/spell/french/FrenchDictionary.java Fri Oct 17 10:04:04 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package spell.french;
+
+import spell.services.DictionaryService;
+
+/**
+ * An implementation of the Dictionary service containing French words
+ * see DictionaryService for details of the service.
+ **/
+public class FrenchDictionary implements DictionaryService {
+
+ // The set of words contained in the dictionary.
+ String[] m_dictionary = { "bienvenue", "dans", "le", "ipojo", "tutorial", "d'ipojo" };
+
+ /**
+ * Implements DictionaryService.checkWord(). Determines
+ * if the passed in word is contained in the dictionary.
+ * @param word the word to be checked.
+ * @return true if the word is in the dictionary,
+ * false otherwise.
+ **/
+ public boolean checkWord(String word) {
+ word = word.toLowerCase();
+
+ // This is very inefficient
+ for (int i = 0; i < m_dictionary.length; i++) {
+ if (m_dictionary[i].equals(word)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/build.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/build.xml?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/build.xml (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/build.xml Fri Oct 17 10:04:04 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<project name="spell.services" default="package" basedir=".">
+
+ <property name="src.dir" value="src"/>
+ <property name="build.dir" value="output/classes"/>
+ <property name="output.dir" value="output"/>
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties"
+ classpath="../tasks/bnd-0.0.223.jar"/>
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete dir="${output.dir}"/>
+ </target>
+
+ <target name="compile" depends="clean">
+ <mkdir dir="${output.dir}"/>
+ <mkdir dir="${build.dir}"/>
+
+ <javac srcdir="${src.dir}"
+ destdir="${build.dir}"
+ debug="on"
+ />
+ </target>
+
+ <target name="package" depends="compile">
+ <bnd
+ classpath="${build.dir}"
+ failok="false"
+ exceptions="true"
+ files="${ant.project.name}.bnd"
+ output="${output.dir}"/>
+ </target>
+
+</project>
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/spell.services.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/spell.services.bnd?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/spell.services.bnd (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/spell.services.bnd Fri Oct 17 10:04:04 2008
@@ -0,0 +1 @@
+Export-Package: spell.services
\ No newline at end of file
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/DictionaryService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/DictionaryService.java?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/DictionaryService.java (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/DictionaryService.java Fri Oct 17 10:04:04 2008
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package spell.services;
+
+public interface DictionaryService {
+
+ /**
+ * Check for the existence of a word.
+ * @param word the word to be checked.
+ * @return true if the word is in the dictionary,
+ * false otherwise.
+ **/
+ public boolean checkWord(String word);
+
+}
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/SpellChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/SpellChecker.java?rev=705672&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/SpellChecker.java (added)
+++ felix/sandbox/clement/ipojo-tutorials/composite.tutorial/spell.services/src/spell/services/SpellChecker.java Fri Oct 17 10:04:04 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package spell.services;
+
+/**
+ * A simple service interface that defines a spell checker service.
+ * A spell checker service checks the spelling of all words in a
+ * given passage. A passage is any number of words separated by
+ * a space character and the following punctuation marks: comma,
+ * period, exclamation mark, question mark, semi-colon, and colon.
+**/
+public interface SpellChecker
+{
+ /**
+ * Checks a given passage for spelling errors. A passage is any
+ * number of words separated by a space and any of the following
+ * punctuation marks: comma (,), period (.), exclamation mark (!),
+ * question mark (?), semi-colon (;), and colon(:).
+ * @param passage the passage to spell check.
+ * @return An array of misspelled words or null if no
+ * words are misspelled.
+ **/
+ public String[] check(String passage);
+}
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/tasks/bnd-0.0.223.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/tasks/bnd-0.0.223.jar?rev=705672&view=auto
==============================================================================
Binary file - no diff available.
Propchange: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/tasks/bnd-0.0.223.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/tasks/org.apache.felix.ipojo.ant-0.8.1.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo-tutorials/composite.tutorial/tasks/org.apache.felix.ipojo.ant-0.8.1.jar?rev=705672&view=auto
==============================================================================
Binary file - no diff available.
Propchange: felix/sandbox/clement/ipojo-tutorials/composite.tutorial/tasks/org.apache.felix.ipojo.ant-0.8.1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: felix/sandbox/clement/ipojo-tutorials/junit4osgi.tutorial/Junit-Example/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Oct 17 10:04:04 2008
@@ -3,3 +3,4 @@
.project
.settings
target
+output
Propchange: felix/sandbox/clement/ipojo-tutorials/junit4osgi.tutorial/Junit-OSGi-Example/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Oct 17 10:04:04 2008
@@ -2,3 +2,4 @@
.settings
.classpath
.project
+output
Propchange: felix/sandbox/clement/ipojo-tutorials/junit4osgi.tutorial/felix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 17 10:04:04 2008
@@ -0,0 +1 @@
+cache