Skip to main content

Can multiple applications use a single jmaki?

4 replies [Last post]
gwg
Offline
Joined: 2008-10-13
Points: 0

How can we install a single copy of jmaki that gets used at run time by multiple web applications?

Everything that I have seen on-line says that a separate copy of the jmaki components needs to be put into the resources directory of each web app. This is a problem for us (see below if you are interested).

The Dojo library allows run-time sharing very nicely: we just need to put the library into a web-addressable location in the server.

How can we do the same thing with jmaki?

Thanks for your help.
Glenn

Further Background:
Our environment is a little different from the usual web development shop. We have multiple web applications that are periodically packaged into a release rather than a continuous develop-deploy cycle. We would like to:
a) ensure that all of our web apps are using the same version of the library,
b) not have to update each web app individually when the library is updated,
c) not have multiple copies (one for each web app) of the same widget code in our CVS repository.

In other words, we would like to install a single copy of jmaki and have all of the applications use that same copy.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gwg
Offline
Joined: 2008-10-13
Points: 0

Thank you both for your answers. Unfortunately it seems that I do not know enough about the jmaki world to understand them.

sloanb: Where can I find out what "server side integration" and "HTML mode" are and their different architectures? I could not find any references in the documentation lists that looked relevant. We are using JSPs, but I'm not sure that is relevant to this point.

gmurray71:
What is the "runtime" and how is it different from the contents of the /resources directory? How would I get and install the runtime? Does it include the widgets? How do I reference that runtime from the web-app without needing any part of jmaki installed in a /resources directory under that web-app?

The only information that I can find about config.json and widget.json does not indicate where those files might exist except within the /resources directory. Do they have to be there, or can the app just point to someplace else in the server where they can be found? If so, how do I do that? Also, is there some place that describes the contents of these files (especially config.json) such that I can see what structures/labels/values are allowed and/or needed? (The reference you pointed me to contained a specific example, not a general desciption, and it assumed that everyone knew where that file resides.)

Regarding serving the widgets from a jar file, where can I get that jar? Do I have to create it, and if so, how? How do I reference that jar from the web-app? Does the web-app still need a /resources directory for any purpose?

The question that I am asking is: Is it possible to build a web-app that uses jmaki without a /resources directory? I.e. jmaki is installed somewhere in the server environment (a.k.a. it is "web accessible"), and the web-app just uses it.

Again, thanks for your help.

gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi,

I believe what you are asking is to have a different webroot directory (this is where jmaki looks for things)

See more here:

http://forums.java.net/jive/thread.jspa?messageID=315566

There is also a way to change the resourcesRoot directory within a web application:

This property is a context property : jmaki-resources

So if you set it to for example:

jmaki-resources bar

All widgets and config.json would be looked for in at /bar where / is the context root of your application.

For what you want I believe the webroot is best.

As for serving from a jar file I suggest looking at the ajax project tests directory where we have a few tests that do the jar file integration see:

/ajax/ws/jmaki/tests/widget

gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi gwg,

You can include the runtime in your JavaEE server's classpath which works alright.

The question I think you are asking is that you want to have your libraries not in the same domain. It can be done tough by loading resources from a CDN like the ones google and yahoo provide with their libraries.

The widget defaults to local files but they can be changed by remapping the domains in the widget.json files to the fully qualified hosted libraries.

The other option is to use the config.json which overrides the widget.json library definitions.

Here is a write up of how the overrides work:

https://ajax.dev.java.net/servlets/ReadMsg?listName=dev&msgNo=2592

The other option is to server the widgets from a jar file in the classpath.

There are some tests in the ajax.dev.java.net workspace that show how this works. I can point you at them if you like.

I would also suggest looking at how the samples for jMaki are built:

See:

http://ajax.dev.java.net/download.html

Basically we store our widgets in a shared / maven repository and bring down versioned widgets using some ant tasks that we wrote. The ant task can also install individual widgets + their dependencies in a target application.

This is more plumping code and thus there isn't as much documentation on it but the ant files are pretty easy to follow in the samples bundle. The source for the ant tasks are part of the widgets.dev.java.net project which I'd be more than happy to help you through if you are interested.

-Greg

sloanb
Offline
Joined: 2003-09-14
Points: 0

Which version of jMaki are you using? Meaning are you using the server side integration (java) or HTML mode?