Hi Carey,

Thanks for your help. You've put me on the right track. 
Looks like I need to create JavaScript that uses setEventHandler 
Method. I didn't release that the server calls to the Java Module 
were indirect via the web session. I think I can understand there 
reasoning for doing it this way. It's a shame that there's very little
documentation on this good feature. 

Thanks,
Graham

 


-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Carey Matthew Black
Sent: 22 August 2007 15:03
To: arslist@ARSLIST.ORG
Subject: Re: Data Visualisation Event Handling using
PERFORM-ACTION-SEND-EVENT

Graham,

I have some of my own sample code working... and I must confess that
the model is still a bit confusing to me.So this is just a first read
over your code... testing should be done...


I think your problem is that you have an event handler set up for
"MidEvent" and you passing an event called "MYTESTEVENT".

Try sending PERFORM-ACTION-SEND-EVENT F536870916 MidEvent "$message$"

See if that shows up in your logs. If it does then you need to add an
event handler for "MYTESTEVENT" so that the browser knows what to do
with that JavaScript call.

Hope That Helps(HTH)

-- 
Carey Matthew Black
Remedy Skilled Professional (RSP)
ARS = Action Request System(Remedy)

Love, then teach
Solution = People + Process + Tools
Fast, Accurate, Cheap.... Pick two.


On 8/22/07, Averell, Graham <[EMAIL PROTECTED]> wrote:
> Hello All,
>
> Has any one had any luck using the special command
> "PERFORM-ACTION-SEND-EVENT F" to send events to their own custom Java
> module?
>
> From an active link on a button I action the following "Run Process"
> command.
> PERFORM-ACTION-SEND-EVENT F536870916 MYTESTEVENT "$message$"
>
> Checking the logs on my Java Module, Mid Tier DV and Tomcat I fail to
> see any thing happen when this command is run and think it could be a
> configuration issue on the server? Also I have had success when
sending
> events back to the parent form from the JavaScript calls created by
the
> Java module.
>
> The Data Visual Module/Definition Registration is similar to that of
the
> BMC's CIViewer. I'm running 7.0.1 patch 2, The midtier is running on
> IIS->Tomcat
> My source code below is a modified version of HelloWorldPlugin from
the
> Arswiki web site. I've added some logging and javascripts to send
events
> to
> The mid tier and parent form.
>
> Thanks,
> Graham
>
>
> /**
>  * Copyright (C) 2006 Axton Grams
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions
>  * are met:
>  *
>  * 1. Redistributions of source code must retain the above copyright
>  *    notice, this list of conditions and the following disclaimer.
>  * 2. Redistributions in binary form must reproduce the above
copyright
>  *    notice, this list of conditions and the following disclaimer in
>  *    the documentation and/or other materials provided with the
>  *    distribution.
>  * 3. The name of the author may not be used to endorse or promote
>  *    products derived from this software without specific prior
>  *    written permission.
>  *
>  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS
>  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
>  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
>  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
>  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
>  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
>  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
>  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
>  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
>  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  */
>
> package org.arswiki.dvplugin.helloworld;
> import com.remedy.arsys.plugincontainer.*;
> import java.io.IOException;
> import java.io.PrintWriter;
> import javax.servlet.http.HttpServletResponse;
> import java.util.logging.*;
>
> public class HelloWorldPlugin implements Plugin {
>
>         String mydata = "test";
>         Logger logger;
>     FileHandler fh;
>
>         /*
>          * methods to implement Plugin interface test 123
>          */
>
>         public void init(PluginConfig config) {
>                    try {
>                                   // Setup Log file handler
>                               LogManager lm =
> LogManager.getLogManager();
>                               // Log file can be found in the root of
> Tomcat
>                               FileHandler fh = new
> FileHandler("log_test.txt");
>                               logger =
> Logger.getLogger("LoggingExample1");
>                               lm.addLogger(logger);
>                               logger.setLevel(Level.INFO);
>                               fh.setFormatter(new XMLFormatter());
>                               logger.addHandler(fh);
>                               logger.log(Level.INFO, "init: Log file
> created");
>
>                             } catch (Exception e) {
>                               System.out.println("Exception thrown: "
+
> e);
>                               e.printStackTrace();
>                             }
>         }
>
>         public void processRequest ( PluginContext pc)
>                 throws IOException, NoPermissionException {
>                 PageService ps = pc.getPageService();
>                 HttpServletResponse response = pc.getResponse();
>                 response.setContentType("text/html;charset=UTF-8");
>                 PrintWriter writer = response.getWriter();
> //              writer.println("<html><head><title>Hello World Plugin
> Example</title></head>");
> //              writer.println("<body><h1>Hello again " + mydata + "
> </h1></body></html>");
>
>                 writer.println("<html><head>");
>                 writer.println(ps.getEventInfrastructureCode());
>
> // Java Script Function SendMidTierEvent(eventdata_mid), eventtype =
> "MidEvent"
> //              Tiggers handleEvent() code below
>                 writer.println("<script>function
> sendMidTierEvent(eventdata_mid) {");
>
>
writer.println(ps.getEventDispatcherName()+".sendEventToMidTier(\"MidEve
> nt\",eventdata_mid);");
>                 writer.println("};");
>                 writer.println("</script>");
>
> // Java Script Function SendParentFormEvent(eventdata_par), eventtype
=
> "ParentEvent"
> //              Sends an Event back to it's calling Remedy form
>                 writer.println("<script>function
> sendParentFormEvent(eventdata_par) {");
>
>
writer.println(ps.getEventDispatcherName()+".sendEventToParentForm(\"Par
> entEvent\",eventdata_par);");
>                 writer.println("};");
>                 writer.println("</script>");
>
> // HTML Body Starts
>                 writer.println("</head>");
>                 writer.println("<HTML><head><title>Hello World Plugin
> Example</title></head>");
>                 writer.println("<BODY><FORM>");
>
> // Eventdata field and Button for SendMidTierEvent Function
>                 writer.println("<INPUT NAME=\"eventdata_midtier\"
> TYPE=Text>");
>                 writer.println("<INPUT NAME=\"submit\" TYPE=Button
> VALUE=\"Send Event to MidTier\"");
>
>
writer.println("onClick=sendMidTierEvent(form.eventdata_midtier.value)><
> BR>");
>
> // Eventdata field and Button for SendParentFormEvent Function
>                 writer.println("<INPUT NAME=\"eventdata_parent\"
> TYPE=Text>");
>                 writer.println("<INPUT NAME=\"submit\" TYPE=Button
> VALUE=\"Send Event to Parent Form\"");
>
>
writer.println("onClick=sendParentFormEvent(form.eventdata_parent.value)
> ><BR>");
> // HTML Body Ends
>                 writer.println("</FORM></BODY></HTML>");
>                 logger.log(Level.INFO, "processRequest: "+ mydata);
>         }
>
>         public String handleEvent (
>                         PluginContext pc,
>                         String eventType,
>                         String eventData)
>                 throws IOException, NoPermissionException {
>                 mydata = eventData;
>
>                 logger.log(Level.INFO, "handleevent: EventType=" +
> eventType + " EventData="+eventData);
>                 return "alert(\"Got event data in Midtier as " +
> eventData + "\");";
>         }
>
>         public DefinitionFactory getDefinitionFactory() {
>                 return null;
>         }
>
>         public void cleanup() {
>                 logger.log(Level.INFO, "cleanup: log file closed");
>                 fh.close();
>         }
> }

________________________________________________________________________
_______
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
the Answers Are"
 
Please consider the environment before printing this e-mail or its attachments.
--------------------------------------------------------

This e-mail (and any attachments) contains information, which is confidential 
and intended solely for the attention and use of the named addressee(s). If you 
are not the intended recipient you must not copy, distribute or use it for any 
purpose or disclose the contents to any person. If you have received this 
e-mail in error, please notify us immediately at [EMAIL PROTECTED] The 
information contained in this e-mail (and any attachments) is supplied in good 
faith, but the sender shall not be under any liability in damages or otherwise 
for any reliance that may be placed upon it by the recipient. Any comments or 
opinions expressed are those of the originator not of NTT Europe Ltd. unless 
otherwise expressly stated.
 
NTT Europe Limited is a company registered in England and Wales with company 
number 2307625. Registered Address: NTT Europe Ltd. 3rd Floor, Devon house, 
58-60 St. Katharine's Way, London, E1W 1LB, UK. Telephone +44-20-7977-1000. 
Facsimile +44-20-7977-1001. Website Link: http://www.ntteurope.com

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the 
Answers Are"

Reply via email to