Home | History | Annotate | Download | only in spi
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 /**
     18  * @author Rustem V. Rafikov
     19  * @version $Revision: 1.3 $
     20  */
     21 
     22 package javax.imageio.spi;
     23 
     24 import java.util.Locale;
     25 
     26 /**
     27  * The IIOServiceProvider abstract class provides base functionality for ImageIO
     28  * service provider interfaces (SPIs).
     29  *
     30  * @since Android 1.0
     31  */
     32 public abstract class IIOServiceProvider implements RegisterableService {
     33 
     34     /**
     35      * The vendor name of this service provider.
     36      */
     37     protected String vendorName;
     38 
     39     /**
     40      * The version of this service provider.
     41      */
     42     protected String version;
     43 
     44     /**
     45      * Instantiates a new IIOServiceProvider.
     46      *
     47      * @param vendorName
     48      *            the vendor name of service provider.
     49      * @param version
     50      *            the version of service provider.
     51      */
     52     public IIOServiceProvider(String vendorName, String version) {
     53         if (vendorName == null) {
     54             throw new NullPointerException("vendor name cannot be NULL");
     55         }
     56         if (version == null) {
     57             throw new NullPointerException("version name cannot be NULL");
     58         }
     59         this.vendorName = vendorName;
     60         this.version = version;
     61     }
     62 
     63     /**
     64      * Instantiates a new IIOServiceProvider.
     65      */
     66     public IIOServiceProvider() {
     67         throw new UnsupportedOperationException("Not supported yet");
     68     }
     69 
     70     public void onRegistration(ServiceRegistry registry, Class<?> category) {
     71         // the default impl. does nothing
     72     }
     73 
     74     public void onDeregistration(ServiceRegistry registry, Class<?> category) {
     75         throw new UnsupportedOperationException("Not supported yet");
     76     }
     77 
     78     /**
     79      * Gets the vendor name of this service provider.
     80      *
     81      * @return the vendor name of this service provider.
     82      */
     83     public String getVendorName() {
     84         return vendorName;
     85     }
     86 
     87     /**
     88      * Gets the version of this service provider.
     89      *
     90      * @return the version of this service provider.
     91      */
     92     public String getVersion() {
     93         return version;
     94     }
     95 
     96     /**
     97      * Gets a description of this service provider. The result string should be
     98      * localized for the specified Locale.
     99      *
    100      * @param locale
    101      *            the specified Locale.
    102      * @return the description of this service provider.
    103      */
    104     public abstract String getDescription(Locale locale);
    105 }
    106