Bug 72014 - Editor/MimeLookup's MimePath API Review
Editor/MimeLookup's MimePath API Review
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: -- Other --
5.x
All All
: P1 (vote)
: 6.x
Assigned To: issues@editor
issues@editor
: API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-30 14:37 UTC by Martin Roskanin
Modified: 2007-11-05 13:44 UTC (History)
4 users (show)

See Also:
Issue Type: TASK
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Roskanin 2006-01-30 14:37:47 UTC
An API change is needed to MimeLookup API - introducing MimePath.

Problem:
Now, when declaring MimeLookup for embeded language (for example a scriptlet) a
creation of parent MimeLookup [text/x-jsp] and its child MimeLookup
[text/x-java] retrieving is needed. It also brings an inconvenience to use such
structures in client's code.

MimePath should solve this problem via easy "content-type path" declaration, for
example MimePath.parse("text/x-jsp/text/x-java") and succeeding MimeLookup
retrieval [MimeLookup.getLookup(MimePath path)]
Comment 1 Martin Roskanin 2006-02-01 15:16:51 UTC
Please, review the following API change.

The change considers a creation of MimePath class in API, MimeDataProvider in
SPI and addition of new method in MimeLookup - static Lookup getLookup(MimePath
mimePath)

MimePath is in fact a string path consisting of a root mime-type
and zero or more embedded mime-types. MimePath implementation should replace
inconvenient MimeLookup.childLookup method usage. It will also make the fact
that "MimeLookup extends Lookup" unnecessary.

MimeDataProvider will replace MimeLookupInitializer. The both interfaces are
almost identical, but the omitted child method. Also usage and registration of
MimeDataProvider is similar to MimeLookupInitializer.

There was a branch created with the name "mimepath". You can find there (in the
module editor/mimelookup) newly created classes as well as implementation of
MimePath, tests (tests on MimePath were added and other tests were rewritten to
use a new MimePath impl.) and arch document with further details of this API change.

Once we implement the change and rewrite the existing clients we will deprecate
the affected part of functionality that will become obsolete.

We decided to start a fast-track review as the MimePath was already discussed in
the previous API review, thus basic concepts should be already clear. If there
will be any objections, of course, there is no problem to start a standard review.

Thanks.
Comment 2 Jaroslav Tulach 2006-02-01 16:43:18 UTC
Is the change compatible or incompatible? Will the old methods still work? I 
am asking due to your comment: 
 
"other tests were rewritten to use a new MimePath" 
 
I believe the change should be compatible and then I do not think you should 
rewrite tests. Clone them. Let the old one test the old behaviour and ensure 
it stays compatible, let the clones test the new API. 
Comment 3 Martin Roskanin 2006-02-01 16:46:39 UTC
Yes, change is compatible. I will clone the tests as you suggested
Comment 4 Martin Roskanin 2006-02-02 12:59:19 UTC
Tests cloned:
Checking in Depr_MimeLookupInheritanceTest.java;
Checking in Depr_MimeLookupPerformanceTest.java;
Checking in Depr_MimeLookupPopupItemsChangeTest.java;
Checking in Depr_MimeLookupTest.java;
Checking in Depr_MimeLookupWeakRefTest.java;
Comment 5 Miloslav Metelka 2006-06-07 09:59:20 UTC
Reassigning back to editor for implementation.
Comment 6 Miloslav Metelka 2006-06-07 10:09:34 UTC
The change allows to simplify the mimelookup API by having a universal MimePath
key as the identifier of the retrieved lookup so the whole API of the MimeLookup
will in fact be just a single static method

public final class MimeLookup {

    public static Lookup getLookup(MimePath mimePath) { ... }

}

The SPI will also be simpler (will in fact mirror the API for multiple data
providers) thank to this change.
Comment 7 Vitezslav Stejskal 2006-06-09 11:29:54 UTC
Merged into trunk.

Checking in mimelookup/arch/arch-editor-mimelookup.xml;
/cvs/editor/mimelookup/arch/arch-editor-mimelookup.xml,v  <-- 
arch-editor-mimelookup.xml
new revision: 1.8; previous revision: 1.7
done
Checking in
mimelookup/src/META-INF/services/org.netbeans.spi.editor.mimelookup.MimeDataProvider;
/cvs/editor/mimelookup/src/META-INF/services/org.netbeans.spi.editor.mimelookup.MimeDataProvider,v
 <--  org.netbeans.spi.editor.mimelookup.MimeDataProvider
new revision: 1.2; previous revision: 1.1
done
Removing
mimelookup/src/META-INF/services/org.netbeans.spi.editor.mimelookup.MimeLookupInitializer;
/cvs/editor/mimelookup/src/META-INF/services/org.netbeans.spi.editor.mimelookup.MimeLookupInitializer,v
 <--  org.netbeans.spi.editor.mimelookup.MimeLookupInitializer
new revision: delete; previous revision: 1.2
done
Checking in mimelookup/src/org/netbeans/api/editor/mimelookup/MimeLookup.java;
/cvs/editor/mimelookup/src/org/netbeans/api/editor/mimelookup/MimeLookup.java,v
 <--  MimeLookup.java
new revision: 1.6; previous revision: 1.5
done
Checking in mimelookup/src/org/netbeans/api/editor/mimelookup/MimePath.java;
/cvs/editor/mimelookup/src/org/netbeans/api/editor/mimelookup/MimePath.java,v 
<--  MimePath.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/src/org/netbeans/modules/editor/mimelookup/LayerMimeDataProvider.java;
/cvs/editor/mimelookup/src/org/netbeans/modules/editor/mimelookup/LayerMimeDataProvider.java,v
 <--  LayerMimeDataProvider.java
new revision: 1.2; previous revision: 1.1
done
Checking in mimelookup/src/org/netbeans/spi/editor/mimelookup/MimeDataProvider.java;
/cvs/editor/mimelookup/src/org/netbeans/spi/editor/mimelookup/MimeDataProvider.java,v
 <--  MimeDataProvider.java
new revision: 1.2; previous revision: 1.1
done
Checking in mimelookup/test/cfg-unit.xml;
/cvs/editor/mimelookup/test/cfg-unit.xml,v  <--  cfg-unit.xml
new revision: 1.3; previous revision: 1.2
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupInheritanceTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupInheritanceTest.java,v
 <--  Depr_MimeLookupInheritanceTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupPerformanceTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupPerformanceTest.java,v
 <--  Depr_MimeLookupPerformanceTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupPopupItemsChangeTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupPopupItemsChangeTest.java,v
 <--  Depr_MimeLookupPopupItemsChangeTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupTest.java,v
 <--  Depr_MimeLookupTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupWeakRefTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/Depr_MimeLookupWeakRefTest.java,v
 <--  Depr_MimeLookupWeakRefTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupInheritanceTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupInheritanceTest.java,v
 <--  MimeLookupInheritanceTest.java
new revision: 1.8; previous revision: 1.7
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupPerformanceTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupPerformanceTest.java,v
 <--  MimeLookupPerformanceTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupPopupItemsChangeTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupPopupItemsChangeTest.java,v
 <--  MimeLookupPopupItemsChangeTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupTest.java,v
 <--  MimeLookupTest.java
new revision: 1.6; previous revision: 1.5
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupWeakRefTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimeLookupWeakRefTest.java,v
 <--  MimeLookupWeakRefTest.java
new revision: 1.6; previous revision: 1.5
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimePathTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/MimePathTest.java,v
 <--  MimePathTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/StandardLookupTest.java;
/cvs/editor/mimelookup/test/unit/src/org/netbeans/modules/editor/mimelookup/StandardLookupTest.java,v
 <--  StandardLookupTest.java
new revision: 1.4; previous revision: 1.3
done


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