[opencms-dev] I_CmsModuleAction

ruben malchow r_malchow at web.de
Sun Nov 5 09:13:40 CET 2006


hello andy, ...

the core of opencms is a singleton, and thus it is only instantiated 
once, and it only creates one instance of the module class, too. it also 
holds a reference to the module action object, so it will not disappear.

a.) to store the reference to CmsObject that is being passed to the 
initialize() method, you could do something like this:

      
    public class BlahAction extends A_CmsModuleAction {
      
        private CmsObject co;

        [...]

        public void initialize(
            CmsObject _co,
            CmsConfigurationManager _ccm,
            CmsModule _cm) {
           this.co = _co;
        }
    }

b.) to get a reference to the module's instance, you could simply do 
something like this:

    public class BlahAction extends A_CmsModuleAction {
      
        private static BlahAction instance;

        public void initialize(...) {
            instance=this; 
        }
      
        public static BlahAction getBlahAction() {
            return instance; 
        }
    }
  
you will have to check the return value of getBlahAction, though. if the 
modules hasn't been initialized properly, it will be null.

this concludes our lesson for today. in the next session, we will try to 
combine a.) and b.) ...

:)

.rm



Andy Bicksbo schrieb:
> Hi
> Does somebody may now how or where to store these instantiated Object (at
> initialize of ModuleActionHandler) for later use?
> That whould help me alot
> thx
> andy
>
>
> 2006/11/4, Jonathan Woods <jonathan.woods at scintillance.com>:
>>
>> Or if you're not packaging up the module as a JAR, the XML which Ruben
>> gives
>> may be incorporated directly in opencms-modules.xml.
>>
>> Jon
>>
>> -----Original Message-----
>> From: opencms-dev-bounces at opencms.org
>> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of ruben malchow
>> Sent: 04 November 2006 18:44
>> To: The OpenCms mailing list; schlachtzeuger at gmail.com
>> Subject: Re: [opencms-dev] I_CmsModuleAction
>>
>>
>> hi andy,
>>
>> try putting this in your module's manifest file:
>>
>> [...]
>>    <module>
>>        <name>youModuleName</name>
>>        <nicename>Your Nice Module Name</nicename>
>>        <class>com.foo.bar.bar.YourCmsModuleActionImpl</class>
>>        [..]
>>    </module>
>> [...]
>>
>> .rm
>>
>> > Hi all
>> > Has anybody some expirience with this and could explain some basics?
>> > I made a new Module in Opencms called com.me.doit i have several
>> > package in the jar file, but the package with Class, which implements
>> > the I_CmsModuleAction is called "com.me.doit" and the class
>> > "AtStartup"
>> > The imput field called Action class at the Module edit screen i set to
>> > com.me.doit.AtStartup AtStartup implements this interface and at the
>> > initialize Method i try to mkdir something, but somehow the initialize
>> > method is never invoked.
>> > Can anybody plz help me...
>> > -How to name packages and the Module
>> > -How to set the right stuff for Action class in the Module -Do i have
>> > to import or install the Module first or what else do i have to do?
>> >
>> > thx
>> > Andy
>> >
>> > ----------------------------------------------------------------------
>> > --
>> >
>> >
>> > _______________________________________________
>> > This mail is sent to you from the opencms-dev mailing list To change
>> > your list options, or to unsubscribe from the list, please visit
>> > http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list To change 
>> your
>> list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>>
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please 
>> visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20061105/a0a0fab4/attachment.htm>


More information about the opencms-dev mailing list