blob: 3d3d085308bcc61da65e9576f6198dc9bee22aa8 [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.
-->
==Which Way Should I Use To Register an Object in the Default Lookup?==
There are two ways to put something in the [[DevFaqLookupDefault|default Lookup]]:
{|- border=1 class="simple" cellpadding="7" cellspacing="0" style="background-color:#FFF9EF;"
! What
! When to Use It
! How
|-valign="top"
| Use the <code>@ServiceProvider</code> annotation
| Most of the time, unless you are building with Maven. This annotation relies on NetBeans' build infrastructure to generate flat files in <code>META-INF/services</code> described below, at compile time.
| Annotate your file with <code>@ServiceProvider(service=Something.class)</code>
|-valign="top"
| Put an <code>.instance</code> file in your module layer in <code>Services/Hidden</code>
| Rarely - useful if you are making services available dynamically on the fly, for example when [[DevFaqDynamicSystemFilesystem|dynamically changing layer contents]], or when [[DevFaqFileAttributes|specialized registration metadata]] or factory methods are needed
| Declare a [[DevFaqInstanceDataObject|.instance file]], a [[DevFaqDotSettingsFiles|.settings file]] or similar, or a [[DevFaqDotShadowFiles|.shadow file]] in your module's [[DevFaqModulesLayerFile|layer.xml file]]
|}
===Apache Migration Information===
The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqWaysToRegisterInDefaultLookup ,
that was last modified by NetBeans user Jglick
on 2010-06-14T22:28:44Z.