Re: Newbie question: How do I use localization with deferred parsing?
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
BTW, I just verified that deferred parsing works along with Barracuda
localization. I set up the config app to use deferred parsing. It not
only worked, but there is another *huge* benefit (and this is actually why
deferred parsing was created in the first place); the barracuda-config.jar
is *much* smaller. The old jar where we compiled without deferred parsing
was 960k. The new barracuda-config.jar is 289k. That is a 671k reduction
in jar size!!! And we even copy more files into the jar (all the .html and
deferred parsing-generated .xmlc files). I'm setting up everything to use
deferred parsing. It will be checked in in not too long.
hmm.... I just ran into one issue with specifying -xcatalog in the XMLC
metadata file. It gets compile fine (like always), but then deferred
parsing can't resolve the location of tutorials.xcat at runtime. It
expects to find it in a location relative to where the JVM was
started. So, since I run Tomcat as a service, it tries to look for it here...
C:\WINDOWS\system32\org\enhydra\barracuda\tutorials\xmlc\tutorials.xcat
I sent a message about this to the XMLC list. If anyone has ideas on how
to solve this issue, that would be great! Otherwise, I might have to
revert the tutorials back to using XMLCStdFactory to load XMLC
classes. Not a huge deal since I can still use deferred parsing for
everything else that doesn't use an xcatalog (everything but the
tutorials), but it would have been nice to make the switch to using
DefaultDOMLoader which uses the deferred parsing dom factory by default.
Jake
At 01:31 PM 8/14/2003 -0500, you wrote:
>At 11:00 AM 8/14/2003 +0200, you wrote:
>>Thanks a lot!
>>
>>That got me a bit further but now I get a compile error. I have the files
>>
>>LocalizationExample.java
>>LocalizationExample.html
>>LocalizationExample.properties
>>LocalizationExample_da.properties
>>
>>When I run the localize task-def on the project, it (as expected) generates
>>the files
>>
>>LocalizationExample_da.html
>>LocalizationExampleHTML.java
>>LocalizationExampleHTML_da.java
>>
>>The problem is that LocalizationExampleHTML_da attempts to implement (!)
>>LocalizationExampleHTML which is a class. So, javac balks. The .xmlc files
>>generated contains
>>
>>-implements LocalizationExampleHTML
>>
>>which seems wrong. What am I missing?
>
>All this seems right to me. What is the compile error you are
>getting? The <Localize> taskdef generates some .xmlc files. Take a look
>at their contents. You should seem something like...
>
>**LocalizationExample.xmlc**
>-generate both
>
>**LocalizationExample_da.xmlc***
>-implements com.mypackage.xmlc.LocalizationExampleHTML
>
>BTW, your XMLC files are being compile to a particular package,
>right? Not the default one. If your classes don't have a package, then
>that may be causing the error.
>
>Also note that if you want to use deferred parsing, make sure to add the
>following to your options.xmlc file...
>-for-deferred-parsing
>
>And then look where your generated .java files are and you should notice
>some generated .xmlc files. These are separate from those generated by
>the <Localize> taskdef. The will be named something like
>LocalizationExampleHTML.xmlc and LocalizationExampleHTML_en.xmlc. These
>files will be in XML format. Copy these files to the location where your
>class files are compiled, such as.... classes/com/mypackage/xmlc/.
>
>Jake
>
>>TIA
>>Jacob
>>
>>
>>On Wednesday 13 August 2003 23:31, Jacob Kjome wrote:
>> > DefaultDOMLoader uses deferred parsing by default so you don't need to
>> > specify anything about the deferred parsing factory specifically. Just
>> > make sure you copy all the generated .html and .xmlc files that match up
>> > with your localized XMLC DOM classes to the same package as those DOM
>> > classes. Continue using DefaultDOMLoader like normal.
>> >
>> > Note that, optionally, if you want to specify resource directories for the
>> > deferred parsing factory, these can be specified in the web.xml with the
>> > same options as XMLCContext takes. You will have to apply the same
>> > scripting in the object repository assember to set this up, though....
>> >
>> > <!-- Set the default dom factory for the global instance of the
>> default dom
>> > loader -->
>> > <object name="$this">
>> > <method name="getServletContext" return="$sc"/>
>> > </object>
>> > <object name="$df"
>> > class="org.enhydra.barracuda.core.util.dom.XMLCDeferredParsingDOMFactory">
>> > <!-- set the servlet context so that the dom factory can read
>> > web.xml context params -->
>> > <method name="setServletContext" arg1="$sc" />
>> > </object>
>> > <object class="org.enhydra.barracuda.core.util.dom.DefaultDOMLoader">
>> > <method name="getGlobalInstance" return="$dl" />
>> > </object>
>> > <object name="$dl">
>> > <method name="setDefaultDOMFactory" arg1="$df" />
>> > </object>
>> >
>> >
>> > Jake
>> >
>> > At 02:56 PM 8/13/2003 +0200, you wrote:
>> > >Hi,
>> > >
>> > >I'm investigating the localization facilities in Barracuda and need some
>> > >help.
>> > >How do I combine deferred parsing (XMLC re-load) with localization?
>> > >
>> > >I have both things running nicely but cannot seem to find the right
>> way to
>> > >combine them.
>> > >
>> > >The localization example (HelloWorld4) in the Component Model Tutorial
>> > > uses the DefaultDOMLoader class to indicate the desired Locale when
>> > > creating the XMLC page object. However, the deferred parsing hints given
>> > > on the News and Status page tells me to use something along the lines of
>> > >
>> > >...
>> > >
>> > >if (xmlcFactory == null)
>> > >{
>> > > xmlcFactory = new XMLCDeferredParsingFactory(
>> > > new DocumentLoaderImpl(),
>> > > this.getClass().getClassLoader(),
>> > > new StreamXMLCLogger()
>> > > );
>> > >}
>> > >
>> > > SimpleExampleHTML page =
>> > > (SimpleExampleHTML)xmlcFactory.create(SimpleExampleHTML.class);
>> > >
>> > >How do I pass in the Locale in this case?
>> > >
>> > >TIA,
>> > >Jacob
>> > >
>> > >_______________________________________________
>> > >Barracuda mailing list
>> > >[email protected]
>> > >http://barracudamvc.org/lists/listinfo/barracuda
>> >
>> > _______________________________________________
>> > Barracuda mailing list
>> > [email protected]
>> > http://barracudamvc.org/lists/listinfo/barracuda
>>
>>_______________________________________________
>>Barracuda mailing list
>>[email protected]
>>http://barracudamvc.org/lists/listinfo/barracuda
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda