[opencms-dev] Struts integration

Kenneth Lewelling klewelling at curoalemanz.com
Mon Feb 10 17:47:46 CET 2003


Alex,

Thanks for your reply. I decided to not throw a CmsException from a
listener. I realized that event listeners are just notifications that
something has happened and it didn't make much sense to try and stop an
action that has already been performed.

Kenneth Lewelling
http://opencmsstruts.sourceforge.net

-----Original Message-----
From: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org]On Behalf Of Alexander
Kandzior
Sent: Monday, February 10, 2003 4:37 AM
To: opencms-dev at www.opencms.org
Subject: RE: [opencms-dev] Struts integration


Kenneth,

there is no specific reason why no Exception is thrown. You are free to
make suggestions or extensions.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org
> [mailto:owner-opencms-dev at www.opencms.org] On Behalf Of
> Kenneth Lewelling
> Sent: Saturday, February 08, 2003 9:18 PM
> To: opencms-dev at www.opencms.org
> Subject: RE: [opencms-dev] Struts integration
>
>
>
>
> Had a question about how the CmsEventListener is implemented.
> It would make things easier for me if
> CmsEventListener.cmsEvent could throw CmsExceptions, and I
> was wondering if there was a reason why it did not.
>
> Kenneth Lewelling
> http://opencmsstruts.sourceforge.net
>
> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org
> [mailto:owner-opencms-dev at www.opencms.org]On Behalf Of
> Alexander Kandzior
> Sent: Friday, February 07, 2003 5:19 AM
> To: opencms-dev at www.opencms.org
> Subject: RE: [opencms-dev] Struts integration
>
>
> Kenneth (and Anil),
>
> we already do have a default mechanism for events in OpenCms
> since the early 5.0 betas. You should use that one instead of
> inventing a new one.
>
>
> To check out how this works, have a look at the JavaDoc of:
>
> com.opencms.flex.CmsEventListener
> com.opencms.flex.CmsEvent
>
> Also check out methods:
>
> com.opencms.core.A_OpenCms.addCmsEventListener()
> com.opencms.core.A_OpenCms.removeCmsEventListener()
> com.opencms.core.A_OpenCms.fireCmsEvent()
>
> And for a use-case in the current core:
>
> com.opencms.flex.cache.CmsFlexCache.CmsFlexCache() line 167
> com.opencms.flex.cache.CmsFlexCache.cmsEvent() (method)
> com.opencms.file.CmsObject.pulishProject() line 2556
> com.opencms.file.CmsObject.fireEvent() (method)
>
> The only core change required would be to add a
> "fireEvent(...)" after a file save operation in general (a
> good idea anyway, probaly also for copy / move / delete
> operations etc.). Your struts class could just register to
> listen for this "save" or "change" event(s) and then perform
> any action as needed.
>
> Best Regards,
> Alex.
>
> Alexander Kandzior
> Alkacon Software - The OpenCms Experts
> http://www.alkacon.com
>
>
>
>
>
>
>
> > -----Original Message-----
> > From: owner-opencms-dev at www.opencms.org
> > [mailto:owner-opencms-dev at www.opencms.org] On Behalf Of Kenneth
> > Lewelling
> > Sent: Friday, February 07, 2003 5:47 AM
> > To: opencms-dev at www.opencms.org
> > Subject: RE: [opencms-dev] Struts integration
> >
> >
> > Anil,
> >
> > Wow that sounds like it would be perfect. I'll work around the
> > configuration editing untill your release.
> >
> > Thanks
> > Kenneth Lewelling
> > http://opencmsstruts.sourceforge.net
> >
> > -----Original Message-----
> > From: owner-opencms-dev at www.opencms.org
> > [mailto:owner-opencms-dev at www.opencms.org]On Behalf Of Anil K Patel
> > Sent: Thursday, February 06, 2003 8:41 PM
> > To: opencms-dev at www.opencms.org
> > Subject: Re: [opencms-dev] Struts integration
> >
> >
> > Kenneth,
> > We can make OpenCMS perfom specific action on file save.
> > I am very close(just few days) to Releasing a Applet Based
> Source code
> > and WYS... Editor integrated with OpenCMS. Also There is another
> > motivation for you to use this Editor, Source Editor is XML syntex
> > aware. If you want I can extend it to fire event on file Save.
> >
> > Regards
> > Anil K Patel
> > Aditisoft Inc
> > www.aditisoft.com
> >
> >
> >
> >
> >
> > not perform a specific action w
> > --- Kenneth Lewelling <klewelling at curoalemanz.com> wrote:
> > > Hello again.
> > >
> > > I am working on the Struts integration and ran into a small
> > problem.
> > > As far as I can tell there is no way to perform a specific
> > action when
> > > a document
> > > in the sourcecode editor is saved. If this is not the case please
> > > ignore the rest of this message and just let me know how.
> > >
> > > First I will present a little background on why I want to
> do this,
> > > then a possible solution I thought up. Struts uses a
> configuration
> > > file, usualy name struts-config.xml (Struts can have more
> than one
> > > configuration file you
> > > would just change the name or the namespace). For Struts to be
> > > integrated
> > > into OpenCms this file will need to be editable within OpenCms. My
> > > solution
> > > to this was add a new folder beneath the system folder in the VFS,
> > > where
> > > each Struts application in OpenCms has its own folder. Within the
> > > Struts
> > > folder is its configuration file. This file is not intended to be
> > > edited
> > > within the VFS, and I address this problem below in the possible
> > > solution.
> > > The file is suppose to be edited within the Struts item in the
> > > Administrative view.
> > >
> > > The sourcecode editor will work fine for editing the
> file, however
> > > once the file is saved I need a way to resync the "Action"
> > resouces in
> > > the VFS (If
> > > you are not sure what an "Action" resource is please refered to
> > > http://opencmsstruts.sourceforge.net/srs.html , pay special
> > attention
> > > to UC4
> > > and UC5). A corollary to syncing with the VFS is parsing the
> > > configuration file and check it against itd dtd, and if it isn't
> > > correct do not save the
> > > file and allow the user to fix the problem.
> > >
> > > Here is a possible solution:
> > >
> > > Add a new method to the I_CmsResourceType interface called
> > > resourceEdited()
> > > (or something) that informs the Resource that its contents
> > have been
> > > changed and are about to be saved. Then in the CmsEditor,
> > just before
> > > the file is
> > > saved, call the resourceChanged() method. If the method returns
> > > false, or throws an exception then the user is forwarded
> to an error
> > > page and told the
> > > file could not be saved for whatever reason, and then
> forwarded back
> > > to the
> > > editor page.
> > >
> > > With this additional method I could create a new Struts
> > Configuration
> > > resource type that implements the resourceEdited() method.
> > That method
> > > can parse the configuration file to make sure it is syntacticly
> > > correct then syncronize the "Action" resources in the VFS.
> > >
> > > I wanted to ask this because my solution requires a change
> > to a major
> > > interface and wanted to make sure it was the correct thing to do.
> > >
> > > Thank you for any comments
> > > Kenneth Lewelling
> > > http://opencmsstruts.sourceforge.net
> > >
> >
> >
> > =====
> > Regards
> > Anil K Patel
> > Aditisoft Inc
> > www.aditisoft.com
> >
>
>





More information about the opencms-dev mailing list