Hi Aslak,

Thank you for detailed information, but I think this was not the only
palce where I had patch.

I changed the method like follows:

    /**
     * It applies package substitutions.
     *
     * @param packageName
     * @param withSubstitution
     * @return                  The package name after substitutions.
     */
    public static String getPackageNameFor(String packageName, boolean
withSubstitution)
    {
        ArrayList packageSubstitutions =
getPackageSubstitutions(DocletContext.getInstance().getActiveSubTask().g
etSubTaskName());

        if (packageSubstitutions == null || !withSubstitution) {
            return packageName;
        }

        for (int i = 0; i < packageSubstitutions.size(); i++) {
            PackageSubstitution ps = (PackageSubstitution)
packageSubstitutions.get(i);
            StringTokenizer st = new StringTokenizer(ps.getPackages(),
",", false);

            while (st.hasMoreTokens()) {
                String packageSubString = st.nextToken();
                                logger.info("apply packageSubstitution "
+ packageSubString + " => " + ps.getSubstituteWith());
                                packageName =
packageName.replaceAll(packageSubString, ps.getSubstituteWith());
            }
        }
                logger.info("  returnung " + packageName);
        return packageName;
    }

And xdoclet printed the logging statements as assumed like this:

...
[ejbdoclet] Generating Home interface for
'sportbet.server.config.OptionControllerBean'.
[ejbdoclet] 11:36:17,459 INFO  [PackageTagsHandler] apply
packageSubstitution server => common
[ejbdoclet] 11:36:17,469 INFO  [PackageTagsHandler]   returnung
sportbet.common.config
...

But after a "ant clean" the classes still were generated to
sportbet/server/config and not to sportbet/common/config.

Do you have any further ideas?

Thomas



> -----Urspr�ngliche Nachricht-----
> Von: Aslak Helles�y [mailto:[EMAIL PROTECTED]]
> Gesendet: Sonntag, 5. Januar 2003 17:06
> An: Thomas Louis; [EMAIL PROTECTED]
> Betreff: RE: [Xdoclet-user] packageSubstitution in the middle
> of the package-name?
>
>
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf
> Of Thomas
> > Louis
> > Sent: 5. januar 2003 16:22
> > To: [EMAIL PROTECTED]
> > Subject: AW: [Xdoclet-user] packageSubstitution in the
> middle of the
> > package-name?
> >
> >
> > > Try
> > >
> > > <packageSubstitution packages="server.one"
> > > substituteWith="common.one"/> <packageSubstitution
> > > packages="server.two" substituteWith="common.two"/>
> > >
> > > packageSubstitution is a bit limited. It can only substitute
> > > suffixes. (Or is it suffices?)
> >
> > This is what I assumed. Of course I don't have only the
> packages "one"
> > and "two" but much more wich are growing during
> development. Is there
> > any alternative? Perhaps can I iterate over all packges with any
>
> The best alternative would be to improve the code in the
> xdoclet.tagshandler.PackageTagsHandler.getPackageNameFor(java.
> lang.String,bo
> olean) method and send us a patch. You'd want to modify the
> code in the while loop and use String.indexOf() in stead of
> String.endsWith()
>
> > ant-tasks?
> > Whats the reason why xdoclet doesn't replace any package
> names "in the
> > middle"?
> >
>
> The reason is probably that it was easier to implement that
> way (Using String endsWith()) and was sufficient for the
> scenario that made it necessary to introduce the feature. The
> person who wrote it (Ara?) was doing "DTSTTCPW".
> http://xp.c2.com/DoTheSimplestThingThatCouldPossiblyWork.html
>
> Aslak
>
> > Thomas
> >
> > >
> > > Aslak
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED]]On Behalf
> > > Of Thomas
> > > > Louis
> > > > Sent: 5. januar 2003 15:20
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [Xdoclet-user] packageSubstitution in the
> middle of the
> > > > package-name?
> > > >
> > > >
> > > > Hello,
> > > >
> > > > Is it right, that xdoclet doesn't allow me to substitute my
> > > > package name like this:
> > > >
> > > > myapp.server.one to myapp.common.one
> > > > Myapp.server.two to myapp.common.two
> > > >
> > > > I tried <packageSubstitution packages="server"
> > > > substituteWith="common"/>
> > > >
> > > > But it didn't work.
> > > >
> > > > Thank you for advice,
> > > > Thomas
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This sf.net email is sponsored by:ThinkGeek
> > > > Welcome to geek heaven.
> > > > http://thinkgeek.com/sf
> > > > _______________________________________________
> > > > Xdoclet-user mailing list [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > _______________________________________________
> > > Xdoclet-user mailing list [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Xdoclet-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to