blob: c7aa17c51cff1d330cbaaaa88580a35ee56ab56d [file] [log] [blame]
//
// 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.
//
= DevFaqApiSpi
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqApiSpi
:description: Apache NetBeans wiki DevFaqApiSpi
:toc: left
:toc-title:
:syntax: true
== What is an SPI? How is it different from an API?
link:http://en.wikipedia.org/wiki/Api[API] is a general term - an acronym for _Application Programming Interface_ - it means something (in Java, usually some Java classes) a piece of software exposes, which allows other software to communicate with it.
SPI stands for _Service Provider Interface_. It is a subset of all things that can be API specific to situations where a library is providing classes which are *called by* the application (or API library), and which typically change the things the application is able to do.
The classic example is link:http://java.sun.com/products/javamail/[JavaMail]. Its API has two sides:
* The _API side_ — which you call if you are writing a mail client or want to read a mailbox
* The _SPI side_ if you are providing a wire-protocol handler to allow JavaMail to talk to a new kind of server, such as a news or IMAP server
Users of the API rarely need to see or talk to the SPI classes, and vice-versa.
In NetBeans, when you see the term SPI, it is usually talking about classes that a module can inject at runtime which allow NetBeans to do new things. For example, there is a general SPI for implementing version control systems. Different modules provide implementations of that SPI for CVS, Subversion, Mercurial and other revision control systems. However, the code that deals with files (the API side) does not need to care if there is a version control system, or what it is.
link:http://weblogs.java.net/blog/2008/08/11/capability-pattern-future-proof-your-apis[More on API and SPI]
=== Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.
This page was exported from link:http://wiki.netbeans.org/DevFaqApiSpi[http://wiki.netbeans.org/DevFaqApiSpi] ,
that was last modified by NetBeans user Jglick
on 2010-06-11T20:10:31Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.