Hi,
I was trying to work with the example given for IPC but with some custom code of mine. I
was not able to achieve any result. Please advice.
I have a myportal.sar where in i put the jboss-service.xml with the following code.
| <server>
| <mbean
| code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
| name="portal:service=ListenerService,type=PortalInitListener"
| xmbean-dd=""
|
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
| <xmbean/>
| <depends
| optional-attribute-name="Registry"
|
proxy-type="attribute">portal:service=ListenerRegistry</depends>
| <attribute
name="RegistryId">PortalInitListener</attribute>
| <attribute name="ListenerClassName">
| gov.sba.bgportal.jboss.examples.PortalInitService
| </attribute>
| </mbean>
| <mbean
|
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
| name="portal:service=ListenerService,type=NodeEventListener"
| xmbean-dd=""
|
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
| <xmbean/>
| <depends
| optional-attribute-name="Registry"
|
proxy-type="attribute">portal:service=ListenerRegistry</depends>
| <attribute
name="RegistryId">NodeEventListener</attribute>
| <attribute name="ListenerClassName">
| gov.sba.bgportal.jboss.examples.MyEventPortlet$Listener
| </attribute>
| </mbean>
| </server>
|
My first listener PortalInitListener is of type PortalEventListener and works good for
SessionEvents.
Second one is a PortalNodeEventListener. This never gets fired.
There are two portlets communicating the information through parameters.
FirstPortlet:
public class AlfrescoRenditionPrtlet extends GenericPortlet
| {
| protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws
PortletException, IOException, UnavailableException
| {
| String renditionFileURL =
rRequest.getPreferences().getValue("renditionFileURL",
"/AdminHome/404.html");
| String PropegatedValue = rRequest.getParameterMap().toString();
| String s = "parameterMAP AlfrescoRenditionPrtlet
---->"+PropegatedValue;
| String s1 = "fromContext AlfrescoRenditionPrtlet
---->"+getPortletContext().getAttribute("fromContext");
| rResponse.setContentType("text/html");
| PrintWriter writer = rResponse.getWriter();
| writer.println("<form action=\"" +
rResponse.createActionURL() + "\" method=\"post\">");
| writer.println("<input type=\"text\"
name=\"EventPropegatedValue\" value=\"Hidden value from
PortletItSelf\"/> ");
| writer.println("<input type=\"submit\"/>");
| writer.println("</form><br>");
| writer.println(s+"<br>"+s1);
| writer.close();
| }
| }
|
SecondPortlet:
| public void processAction(ActionRequest request, ActionResponse response) {
| String PropegatedValue = request.getParameter("EventPropegatedValue");
| response.setRenderParameter("PropegatedValue", PropegatedValue);
| }
|
| protected void doView(RenderRequest rRequest, RenderResponse response) throws
PortletException, IOException, UnavailableException
| {
| String PropegatedValue = rRequest.getParameterMap().toString();
| String s = "PropegatedValue MyEventPortlet ---->"+PropegatedValue;
| String renditionFileURL =
rRequest.getPreferences().getValue("renditionFileURL",
"/AdminHome/404.html");
| String s1 = "fromContext MyEventPortlet
---->"+getPortletContext().getAttribute("fromContext");
| response.setContentType("text/html");
| PrintWriter writer = response.getWriter();
| writer.println(s+"<br>"+s1);
| writer.close();
| }
|
Listener:
| public static class Listener implements PortalNodeEventListener{
| public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent
event) {
| PortalNode node = event.getNode();
| String nodeName = node.getName();
| WindowActionEvent newEvent = null;
| if (nodeName.equals("ARPWindow1") && event instanceof
WindowActionEvent)
| {
| WindowActionEvent wae = (WindowActionEvent)event;
| PortalNode window2 = node.resolve("../MEPWindow2");
| if (window2 != null)
| {
| newEvent = new WindowActionEvent(window2);
| Map map = new HashMap<Object,Object>();
| map.put("EventPropegatedValue", "~~~~~This is the
value~~~~");
| map.putAll(wae.getParameters());
| newEvent.setParameters(map);
| }
| }
| if (newEvent != null)
| {
| return newEvent;
| }
| else
| {
| return context.dispatch();
| }
| }
| }
|
I am unable to locate the problem. Any one there to advice me.
Any sort of help is thanked.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069838#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...