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"

Reply via email to