[opencms-dev] access opencms documents from java application

Christof Dallermassl ce-christof.dallermassl at bearingpoint.com
Thu Oct 20 08:46:46 CEST 2005


Hi!

> You don't want to use OpenCmsCore directly.  Use the class 'OpenCms' to
> get an instance of CmsObject, and then use the methods on CmsObject.
> You can do most things with CmsObject that you want to do with
> OpenCmsCore.  Like this:

> 	CmsObject session = null;
> 	session = OpenCms.initCmsObject("Guest");
> 	session.loginUser(userName, password);

I tried this, but I'll get a NullPointerException, as the security manager is 
not initialized in OpenCmsCore (line 1745, method 
initCmsObject(CmsContextInfo contextInfo)) when calling the line:
OpenCms.initCmsObject("Guest");

In CmsShell, the line 
_opencms = m_opencms.upgradeRunlevel(configuration);
is called after the OpenCmsCore is created and exactly this step is missing!

> I assume from the nature of your question that you are executing this
> code in an application that can call the OpenCms API directly, as I
> don't think there are any EJBs / JMX beans / Web Services that you can
> call from another application.

exactly: I tried to create an application that calls the API to read/write the 
contents of the VFS.

regards,
Christof

> > -----Original Message-----
> > From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-
> > bounces at opencms.org] On Behalf Of Christof Dallermassl
> > Sent: Wednesday, October 19, 2005 12:59 PM
> > To: The OpenCms mailing list
> > Subject: [opencms-dev] access opencms documents from java application
> >
> > Hi!
> >
> > Is it possible to access the content of the opencms from a "normal"
>
> java
>
> > application (and not from inside the webapplication)?
> >
> > I have a client application that retrieves information from a server
>
> that
>
> > should be put into some existing opencms xml contents.
> >
> > I thought that I'd do it like the CmsShell does, but found, that the
> > OpenCmsCore.getInstance() method is not accessible from outside.
> >
> > Is there a "clean" solution to this problem (except putting my
>
> application
>
> > class into the same packge as OpenCmsCore)?
> >
> > regards
> > Christof Dallermassl
> >
> >
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, please
>
> visit
>
> > http://mail.opencms.org/mailman/listinfo/opencms-dev
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list