Return-Path: Delivered-To: apmail-incubator-felix-commits-archive@www.apache.org Received: (qmail 48078 invoked from network); 7 Mar 2006 14:19:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Mar 2006 14:19:53 -0000 Received: (qmail 57304 invoked by uid 500); 7 Mar 2006 14:18:39 -0000 Delivered-To: apmail-incubator-felix-commits-archive@incubator.apache.org Received: (qmail 57287 invoked by uid 500); 7 Mar 2006 14:18:39 -0000 Mailing-List: contact felix-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: felix-dev@incubator.apache.org Delivered-To: mailing list felix-commits@incubator.apache.org Received: (qmail 57276 invoked by uid 99); 7 Mar 2006 14:18:39 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 07 Mar 2006 06:18:39 -0800 Received: (qmail 46991 invoked by uid 65534); 7 Mar 2006 14:17:49 -0000 Message-ID: <20060307141749.46951.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r383896 - in /incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice: DictionaryService.java SpellCheckService.java impl/Activator.java Date: Tue, 07 Mar 2006 14:17:16 -0000 To: felix-commits@incubator.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: akarasulu Date: Tue Mar 7 06:17:05 2006 New Revision: 383896 URL: http://svn.apache.org/viewcvs?rev=383896&view=rev Log: preparing for the next example Added: incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java - copied, changed from r383890, incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java Removed: incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java Modified: incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java Copied: incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java (from r383890, incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java) URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java?p2=incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java&p1=incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java&r1=383890&r2=383896&rev=383896&view=diff ============================================================================== --- incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/DictionaryService.java (original) +++ incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/SpellCheckService.java Tue Mar 7 06:17:05 2006 @@ -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 Felix Project Team */ -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 ); - } Modified: incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java?rev=383896&r1=383895&r2=383896&view=diff ============================================================================== --- incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java (original) +++ incubator/felix/trunk/org.apache.felix.examples.spellcheckservice/src/main/java/org/apache/felix/examples/spellcheckservice/impl/Activator.java Tue Mar 7 06:17:05 2006 @@ -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 Felix Project Team */ 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 ) - { - // 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 + public void stop( BundleContext arg0 ) throws Exception { - // 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; - } } }