Bryan S said the following on 9/4/2007 9:48 AM:
I'm hoping this is a stupid question. I'm having another problem with
the plugin. I'm sure it's something I'm doing wrong but I can't figure
out what.
I am following the example of machblog. The only difference between my
code and the machblog code is that in the mach-ii.xml I am having to
explicitly call the event invoker
<listener name="SecurityListener"
type="actionpacks.security.model.SecurityListener">
<invoker type="MachII.framework.invokers.CFCInvoker_Event "
/>
</listener>
where the machblog example just does this
<listener name="aggregatorListener"
type="machblog.org.machblog.listeners.AggregatorListener" />
This is because the CFCInvoker_Event was deprecated in 1.1.0. Use the
EventInvoker or the short hand notation that MachBlog uses (see the FAQs
document for all the details).
I'm guessing that has something to do with me not using the latest
mach-ii although I am using 1.1.
My problem is that my SecurityListener does not have access to my
SecurityService. It is undefined when getSecurityService is called.
The reason for that is setSecurityService is not being called even
though SecurityService is defined in my Coldspring.xml. The last time
I had this problem it was because I was overwriting my variable with a
different instance of the object but I checked and that isn't the case
this time.
The ColdSpring plugin doesn't wire in dependencies until after all the
configure() methods are called on your listeners.
I know that my Coldspring.xml is proper because if I do this in the
init of the SecurityService everything works just fine. I obviously
don't want this to be my permanent solution because it defeats the
purpose of using the mach-ii coldspring plugin.
<cffunction name="init" returntype="any" output="false"
hint="Constructor">
<cfargument name="appManager"
type="MachII.framework.AppManager " required="true" />
<cfargument name="parameters" type="struct" required="false"
default="#StructNew()#" />
<cfset super.init( arguments.appManager, arguments.parameters )>
<cfset variables.instance.BeanFactory =
createObject("component","coldspring.beans.DefaultXmlBeanFactory").init()
/>
<cfset
getBeanFactory().loadBeansFromXmlFile("/actionpacks/security/config/ColdSpring.xml",true)
/>
<cfreturn this />
</cffunction>
Listeners should not override the init() method as indicated in the hint
of the init() method of the MachII.framework.Listener. Use the
configure() method instead. I think this is where thing might be going
wrong...
Here is how I have the mach-ii plugin configured. It is the first
pluging defined.
<plugin name="coldSpringPlugin" type="
coldspring.machii.ColdspringPlugin">
<parameters>
<parameter name="beanFactoryPropertyName"
value="serviceFactory"/>
<parameter name="configFilePropertyName"
value="coldspringConfigFile"/>
<parameter name="configFilePathIsRelative" value="true"/>
<parameter name="resolveMachiiDependencies" value="true"/>
</parameters>
</plugin>
Any idea what I can check? Am I missing something you need to help me
figure out the problem?
Bryan