preparing for the next example
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@383896 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java b/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java
similarity index 62%
rename from org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java
rename to org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java
index c38efcf..2553b1d 100644
--- a/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java
+++ b/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java
@@ -14,23 +14,13 @@
* limitations under the License.
*
*/
-package org.apache.felix.examples.dictionaryservice;
+package org.apache.felix.examples.spellcheckservice;
/**
- * A simple service interface that defines a dictionary service. A dictionary
- * service simply verifies the existence of a word.
*
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
-public interface DictionaryService
+public interface SpellCheckService
{
- /**
- * 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 );
-
}
diff --git a/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java b/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java
index 5da2ded..23cb275 100644
--- a/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java
+++ b/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java
@@ -14,82 +14,26 @@
* limitations under the License.
*
*/
-package org.apache.felix.examples.dictionaryservice.impl;
+package org.apache.felix.examples.spellcheckservice.impl;
-import java.util.Properties;
-
-import org.apache.felix.examples.dictionaryservice.DictionaryService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
- * This class implements a simple bundle that uses the bundle context to
- * register an English language dictionary service with the OSGi framework. The
- * dictionary service interface is defined in a separate class file and is
- * implemented by an inner class.
+ *
*
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
public class Activator implements BundleActivator
{
- /**
- * Implements BundleActivator.start(). Registers an instance of a dictionary
- * service using the bundle context; attaches properties to the service that
- * can be queried when performing a service look-up.
- *
- * @param context the framework context for the bundle.
- */
- public void start( BundleContext context )
+ public void start( BundleContext arg0 ) throws Exception
{
- Properties props = new Properties();
- props.put( "Language", "English" );
- context.registerService( DictionaryService.class.getName(), new DictionaryImpl(), props );
}
- /**
- * Implements BundleActivator.stop(). Does nothing since the framework will
- * automatically unregister any registered services.
- *
- * @param context the framework context for the bundle.
- */
- public void stop( BundleContext context )
+ public void stop( BundleContext arg0 ) throws Exception
{
- // NOTE: The service is automatically unregistered.
- }
-
-
- /**
- * A private inner class that implements a dictionary service; see
- * DictionaryService for details of the service.
- */
- private static class DictionaryImpl implements DictionaryService
- {
- // The set of words contained in the dictionary.
- String[] m_dictionary = { "welcome", "to", "the", "osgi", "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;
- }
}
}