[opencms-dev] Using OpenCms objects in external Java application?
Andreas Haumer
andreas at xss.co.at
Thu Oct 5 20:11:04 CEST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
I'm working on a Java application which periodically
generates a HTML file which I then automatically want to
place in some OpenCMS VFS folder. This Java application
is executed outside any servlet container or application
server context, i.e. it's a typical Unix application running
on the same Linux box as OpenCms.
The OpenCMS API doc (JavaDoc) tells me, that this should be
possible with an object of class org.opencms.file.CmsObject
The JavaDoc explains how to get a CmsObject using OpenCms.initCmsObject()
and all methods available with this object.
The idea is at follows:
[...]
// prepare the new HTML data as byte[] array
// get the CmsObject
CmsObject cms = OpenCms.initCmsObject("Guest");
// log into OpenCms
cms.loginUser(username, password);
// set project, upload and publish the new file, etc.
cms.createResource();
cms.unlockResource();
cms.publishResource();
[...]
This all would be quite fine, alas I already get a
NullPointerException in OpenCms.initCmsObject() :-(
What am I missing here?
Also, on some installations we might have several OpenCms
instances running on the same servlet container (as different
webapps). Each OpenCms instance uses it's own database.
How can I select a specific OpenCms instance, i.e. a specific
OpenCms VFS, using the OpenCms API in my Java application?
Is this possible at all?
Thanks!
- - andreas
- --
Andreas Haumer | mailto:andreas at xss.co.at
*x Software + Systeme | http://www.xss.co.at/
Karmarschgasse 51/2/20 | Tel: +43-1-6060114-0
A-1100 Vienna, Austria | Fax: +43-1-6060114-71
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFJUq0xJmyeGcXPhERAjDNAJ0VO6Q8NXcV1CCcvc7PtsJE1yJLRACfan+5
lb58SsfCgomVkxkaPLZnZGU=
=ivaR
-----END PGP SIGNATURE-----
More information about the opencms-dev
mailing list