Bug 52905 - PrivilegedTemplates customization not possible
PrivilegedTemplates customization not possible
Status: RESOLVED FIXED
Product: projects
Classification: Unclassified
Component: Ant Freeform
4.x
PC Linux
: P2 (vote)
: 4.x
Assigned To: David Konecny
issues@projects
: API, API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-04 14:51 UTC by Martin Adamek
Modified: 2005-01-17 17:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
solution (18.84 KB, patch)
2005-01-07 08:24 UTC, David Konecny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Adamek 2005-01-04 14:51:14 UTC
There is Java-specific implementation of
PrivilegedTemplates
(FreeformProject.PrivilegedTemplatesImpl) in
freeform project. Other freeform types (web, ejb)
don't have possibility to change it or register
new one.
Comment 1 David Konecny 2005-01-04 15:13:14 UTC
I will move it to where it belongs (i.e. java/freeform) and ensure
that all templates defined by natures as priviledged will be merged
and shown.

This is related to fix of issue 52498 which is still on my radar:
should freeform project merge impls of the same interface comming from
different natures or should it be documented that >1 impls are allowed
in project's lookup. I will resolve that as part of this issue.
Comment 2 David Konecny 2005-01-07 08:24:58 UTC
Created attachment 19542 [details]
solution
Comment 3 David Konecny 2005-01-07 08:29:26 UTC
As said earlier there exist following problem: freeform natures can
enhance project lookup and this can result in situation where project
lookup contains two entries, but lookup contract says that there will
be only one. Example can be PrivilegedTemplates or ClassPathProvider
which are implemented both by Java freeform nature and Web freeform
nature.

The solution I propose is to add support for merging of lookup
entries. Mergining is domain knowledge and therefore cannot be done by
the freeform core without help of project natures.

Attached is diff of API and impl which works. No unit tests at the
moment. Please review. Questions/suggestions welcome. LookupMerger may
not be the best name.
Comment 4 Jesse Glick 2005-01-10 18:32:37 UTC
getMergableClasses should be getMergeableClasses.


This is definitely a good place to have unit tests; the lookup merging
code is not obvious.


BTW: clazz.equals(X.class) can be simplified to clazz == X.class.


getMerg[e]ableClasses Javadoc should emphasize that the Class's are
for the interfaces, not implementations. Probably obvious but can't
hurt to state it.


LookupMergerImpl.PrivilegedTemplatesImpl should probably remove
duplicates, e.g. using a LinkedHashSet rather than an ArrayList.


Otherwise, looks good to me.
Comment 5 David Konecny 2005-01-17 15:41:10 UTC
Fixed for all freeforms. madamek, please see the diff and verify or
update web/j2ee nature as needed.

Commit:
ant/freeform/manifest.mf;
new revision: 1.6; previous revision: 1.5
ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java;
new revision: 1.32; previous revision: 1.31
ant/freeform/src/org/netbeans/modules/ant/freeform/LookupMergerImpl.java;
initial revision: 1.1
ant/freeform/src/org/netbeans/modules/ant/freeform/spi/LookupMerger.java;
initial revision: 1.1
ant/freeform/test/unit/src/META-INF/services/org.netbeans.modules.ant.freeform.spi.ProjectNature;
initial revision: 1.1
ant/freeform/test/unit/src/org/netbeans/modules/ant/freeform/spi/ProjectNatureTest.java;
initial revision: 1.1
java/freeform/nbproject/project.xml;
new revision: 1.4; previous revision: 1.3
java/freeform/src/org/netbeans/modules/java/freeform/JavaProjectNature.java;
new revision: 1.3; previous revision: 1.2
java/freeform/src/org/netbeans/modules/java/freeform/LookupMergerImpl.java;
initial revision: 1.1
java/project/src/org/netbeans/modules/java/project/ProjectClassPathProvider.java;
new revision: 1.4; previous revision: 1.3
web/freeform/nbproject/project.xml;
new revision: 1.4; previous revision: 1.3
web/freeform/src/org/netbeans/modules/web/freeform/WebProjectNature.java;
new revision: 1.3; previous revision: 1.2
j2ee/ejbfreeform/nbproject/project.xml;
new revision: 1.5; previous revision: 1.4
j2ee/ejbfreeform/src/org/netbeans/modules/j2ee/ejbfreeform/EJBProjectNature.java;
new revision: 1.5; previous revision: 1.4
Comment 6 Martin Adamek 2005-01-17 17:42:59 UTC
Looks fine for EJB.


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