If you write an MBean, the best way is to inject it into your MBean using :
| <mbean ...>
| ...
| <depends
| optional-attribute-name="InstanceContainer"
| proxy-type="attribute">portal:container=Instance</depends>
| ...
| <mbean>
|
If you want to do that from a Portlet component, you can inject an MBean
service into the servlet context attributes and then make a lookup from the
PortletContext. In that case you need to have in your jboss-portlet.xml :
| <portlet-app>
| ...
| <service>
| <service-name>InstanceContainer</service-name>
|
<service-class>org.jboss.portal.core.model.instance.InstanceContainer</service-class>
| <service-ref>:container=Instance</service-ref>
| </service>
| ...
| </portlet-app>
|
then in your portlet you can do, usually best placed into the init() method :
| InstanceContainer container =
(InstanceContainer)getPortletContext().getAttribute("InstanceContainer");
|
If you do use portal services, you should also declare the transactional
attribute in jboss-portlet.xml that will propagate the portal transaction to
the portlet or create a new one like :
| <portlet>
| <portlet-name>MyPortlet</portlet-name>
| <transaction>
| <trans-attribute>Required</trans-attribute>
| </transaction>
| </portlet>
|
or
| <portlet>
| <portlet-name>MyPortlet</portlet-name>
| <transaction>
| <trans-attribute>RequiresNew</trans-attribute>
| </transaction>
| </portlet>
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011305#4011305
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011305
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user