Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
'Parent' attribute on Beans - Please define
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
penny  
View profile  
 More options Jul 30 2008, 11:33 am
From: penny <kevin.pe...@gmail.com>
Date: Wed, 30 Jul 2008 08:33:14 -0700 (PDT)
Local: Wed, Jul 30 2008 11:33 am
Subject: 'Parent' attribute on Beans - Please define
Sorry if this has knowledge has already been conveyed, but I'm trying
to get the definition of what exactly the 'parent' attribute on the
Bean definition does - as I'm getting into a 'configSettings' bean
which contains dsn settings etc, and am currently having it be
injected into most all beans that need it - and trying to determine if
'parent=configsettings' is a better approach.

Thanks (awaiting the documentation update on this attribute)

Kevin Penny
Jobs2Web, Inc.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Kotek  
View profile  
 More options Jul 30 2008, 11:52 am
From: "Brian Kotek" <brian...@gmail.com>
Date: Wed, 30 Jul 2008 11:52:36 -0400
Local: Wed, Jul 30 2008 11:52 am
Subject: Re: [coldspring-users] 'Parent' attribute on Beans - Please define

The parent attributes lets you specify a parent bean definition to augment
dependency or configuration settings. So say you have a UserGateway and a
ProductGateway, and you want to inject a Config bean into both of them.
Instead of specifying a Config bean as a dependency to each one, you can
create a third bean definition (maybe named "ParentGateway" or
"AbstractGateway") with class="" and abstract="true", and specify the Config
bean there. Then your gateways can specify parent="AbstractGateway" and both
your gateways will have the Config bean wired into them.

In other words, it is simply a way to reduce XML by specifying common
properties in one place rather than having to duplicate them in all of the
necessary bean definitions. Make sense?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
penny  
View profile  
 More options Jul 30 2008, 12:07 pm
From: penny <kevin.pe...@gmail.com>
Date: Wed, 30 Jul 2008 09:07:33 -0700 (PDT)
Local: Wed, Jul 30 2008 12:07 pm
Subject: Re: 'Parent' attribute on Beans - Please define
Sure does - i'm going to paste an example here then and play with a
small implementation of it for a firm understanding.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
penny  
View profile  
 More options Jul 30 2008, 5:12 pm
From: penny <kevin.pe...@gmail.com>
Date: Wed, 30 Jul 2008 14:12:03 -0700 (PDT)
Local: Wed, Jul 30 2008 5:12 pm
Subject: Re: 'Parent' attribute on Beans - Please define
Ok I think I have it:

coldspring.xml definitions...
<!-- Regular Bean in need of some config settings (and specifies the
configGateway as the parent) -->
<bean id="regularBean" class="com.regularBean" parent="configGateway">

        </bean>
<!-- Configuration Bean which holds config settings -->
        <bean id="configSettings" class="com.configSettings">
                <constructor-arg name="dsn">
                        <value>odbcdsn</value>
                </constructor-arg>
        </bean>
<!-- mock configGateway which has reference to the ConfigSettings -->
        <bean id="configGateway" class="" abstract="true">
                <property name="configSettings">
              <ref bean="configSettings" />
            </property>
        </bean>

Then in my 'RegularBean' I need the methods for configSettings i.e.:
<!--- Author: penny - Date: 7/30/2008 --->
        <!--- getter and setter for configSettings --->
        <cffunction name="getconfigSettings" access="public" output="false"
returntype="com.configSettings">
                <cfreturn variables.instance.configSettings/>
        </cffunction>
        <cffunction name="setconfigSettings" access="public" output="false"
returntype="void">
                <cfargument name="configSettings" type="com.configSettings"
required="true"/>
                <cfset variables.instance.configSettings=arguments.configSettings/>
        </cffunction>

When calling Regular Bean -
application.serviceFactory.getBean('regularBean').getConfigSettings().getDS N()
for example - and voila I have the data -

This the best approach?  So I will still require the 'stubbed' getter/
setter for configSettings in the Objects - but it slims down the xml
declaration a bit.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google