| jet template engine in standalone application [message #376642] |
Wed, 15 January 2003 05:35  |
Eclipse User |
|
|
|
Hi,
I have been using the JET template engine to generate some XML files. The
way I've used it is to write some templates and have them compiled to Java
classes with the JETBuilder (and Java Builder). The resulting class can
then be used standalone by invoking its generate method. All this is very
easy and straightforward.
I was wondering if it is possible to use the parts of JET which parse the
template and create a Java source file for it in a standalone application.
In other words, I'd like to use the JETBuilder outside Eclipse. Is this
possible? How would I do that? Would it even be possible to use the
dynamic templates in this fashion?
TIA,
--
knut
|
|
|
|
|
|
| Re: jet template engine in standalone application [message #376656 is a reply to message #376646] |
Fri, 17 January 2003 14:00  |
Eclipse User |
|
|
|
Knut,
First of all, you are right that we don't want to put a dependency on the ecore
plugin in JET. JET is a low level plugin that is also used independent of EMF.
The platformResourceMap is only used when EMF is running standalone. When
Eclipse is around (headless or not), the platform://resource scheme is
implemented using standard Eclipse APIs. In the standalone environment, you can
populate the platformResourceMap to provide the mapping of platform URI prefixes
(projects) to physical filesystem directories, where the serialized EMF
documents will be, so that cross document references, for example, can be
navigated in the standalone environment. If you don't want to use the same EMF
documents inside and outside eclipse, none of this is needed.
Back to JET, I think that for a pure standalone use, we can avoid this stuff
entirely. To use dynamic templates standalone, I think that avoiding the
platform project/resource stuff in the template path code is the main thing that
needs to be avoided. I think that overriding it with standard java File API
would be pretty easy.
Frank.
Knut Wannheden wrote:
> > I noticed that the JETCompiler class has some dependencies on the
> > org.eclipse.core.runtime plugin. It is used for dealing with URIs and
> > resolving URIs with the "platform" protocol. Also it uses the
> java.net.URL
> > implementation to deal with URLs. Wouldn't it be possible to rip those
> > parts out and replace it with the URI and URIConverter implementation of
> > EMF? Or would that create undesired dependencies?
> >
>
> OK, I had to give it a try. I tried to use the EMF URI and URIConverter
> instead, but ran into problems. The URIConverterImpl class uses the
> EcorePlugin.resolvePlatformResourcePath(String) method to create an
> InputStream or OutputStream for a platform URI. But the
> EcorePlugin#platformResourceMap which should contain mappings from project
> names to URIs is empty. Isn't this automatically initialized when *not* in
> headless environment? Further, the URIConverterImpl contains some commented
> test code in the default constructor to initialize this map. But as noted,
> it's commented out.
>
> This isn't really a serious problem for me, as I don't intend to work with
> platform URIs in headless environment. But I was surprised that
> EcorePlugin#platformResourceMap wasn't initialized when running in Eclipse.
>
> What would be required to use the dynamic templating mechanism in a headless
> environment? Can this be done?
>
> Cheers,
>
> --
> knut
|
|
|
Powered by
FUDForum. Page generated in 0.04408 seconds