MoreDeclarativeRegistrationUsingAnnotations

(Difference between revisions)
Line 1: Line 1:
-
Starting point: [[DeclarativeRegistrationUsingAnnotations#Potential_Layer_Annotations]]
+
Background: [[DeclarativeRegistrationUsingAnnotations#Potential_Layer_Annotations]]
-
MIME resolvers, data loaders, startup tasks, Navigator panels, tasklist & quick search providers, ...
+
=MIME resolvers=
 +
 
 +
Easy: link to an XML file in the current DTD, similar to @HelpSetRegistration.
 +
 
 +
Trickier: provide similar functionality entirely in annotations.
 +
 
 +
Should be possible to register also on a nondeclarative resolver.
 +
 
 +
=Data loaders=
 +
 
 +
For traditional <tt>DataLoader</tt>-extending modules:
 +
 
 +
<pre>
 +
@DataObject.Factory.Registration(mimeTypes="text/html", label="#PROP_HtmlLoader_Name",
 +
                                icon="org/netbeans/modules/html/htmlObject.png")
 +
public class HtmlLoader extends UniFileLoader {...}
 +
</pre>
 +
 
 +
For those skipping the loader and using <tt>DataLoaderPool.factory</tt>:
 +
 
 +
<pre>
 +
@DataObject.Factory.Registration(mimeTypes="text/html", label="#PROP_HtmlLoader_Name",
 +
                                icon="org/netbeans/modules/html/htmlObject.png")
 +
public class HtmlDataObject extends MultiDataObject {...}
 +
</pre>
 +
 
 +
==Loader actions==
 +
 
 +
TBD how to handle context menu actions. See [[DeclarativeRegistrationUsingAnnotations#Problems_with_actions]] for discussion.
 +
 
 +
=Startup tasks=
 +
 
 +
Most simply: an annotation to register ModuleInstall implementations.
 +
 
 +
More ambitiously, an annotation to cover parallelizable startup tasks, perhaps replacing ModuleInstall as well as other hooks: #200636.
 +
 
 +
Either would supersede #163937 (refactoring hook).
 +
 
 +
=Navigator panels=
 +
 
 +
Registered per MIME type. Should be simple.
 +
 
 +
=Task list providers=
 +
 
 +
Two kinds of provider, both should be simple to register.
 +
 
 +
=Quick search providers=
 +
 
 +
Should be simple.
 +
 
 +
=XML catalogs=
 +
 
 +
<pre>
 +
@CatalogReader.Registration
 +
public class HibernateCatalog implements CatalogReader, CatalogDescriptor, EntityResolver {...}
 +
</pre>
 +
 
 +
Registration of these is so straightforward
 +
that it is worth asking why <tt>CatalogReader</tt>s are not simply searched for in global lookup. #192595 has a fuller discussion.

Revision as of 16:33, 9 November 2011

Background: DeclarativeRegistrationUsingAnnotations#Potential_Layer_Annotations

Contents

MIME resolvers

Easy: link to an XML file in the current DTD, similar to @HelpSetRegistration.

Trickier: provide similar functionality entirely in annotations.

Should be possible to register also on a nondeclarative resolver.

Data loaders

For traditional DataLoader-extending modules:

@DataObject.Factory.Registration(mimeTypes="text/html", label="#PROP_HtmlLoader_Name",
                                 icon="org/netbeans/modules/html/htmlObject.png")
public class HtmlLoader extends UniFileLoader {...}

For those skipping the loader and using DataLoaderPool.factory:

@DataObject.Factory.Registration(mimeTypes="text/html", label="#PROP_HtmlLoader_Name",
                                 icon="org/netbeans/modules/html/htmlObject.png")
public class HtmlDataObject extends MultiDataObject {...}

Loader actions

TBD how to handle context menu actions. See DeclarativeRegistrationUsingAnnotations#Problems_with_actions for discussion.

Startup tasks

Most simply: an annotation to register ModuleInstall implementations.

More ambitiously, an annotation to cover parallelizable startup tasks, perhaps replacing ModuleInstall as well as other hooks: #200636.

Either would supersede #163937 (refactoring hook).

Navigator panels

Registered per MIME type. Should be simple.

Task list providers

Two kinds of provider, both should be simple to register.

Quick search providers

Should be simple.

XML catalogs

@CatalogReader.Registration
public class HibernateCatalog implements CatalogReader, CatalogDescriptor, EntityResolver {...}

Registration of these is so straightforward that it is worth asking why CatalogReaders are not simply searched for in global lookup. #192595 has a fuller discussion.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo