Re: Data Visualisation Event Handling using PERFORM-ACTION-SEND-EVENT

2007-08-23 Thread Averell, Graham
ction SendParentFormEvent(eventdata_par), eventtype =
"ParentEvent"   
//  Sends an Event back to it's calling Remedy form
writer.println("function
sendParentFormEvent(eventdata_par) {");

writer.println(ps.getEventDispatcherName()+".sendEventToParentForm(\"Par
entEvent\",eventdata_par);");
writer.println("};"); 
writer.println("");

// HTML Body Starts 
writer.println("");
writer.println("Hello World Plugin
Example");
writer.println("");

// Eventdata field and Button for SendMidTierEvent Function 
writer.println("");
writer.println("<
BR>");

// Eventdata field and Button for SendParentFormEvent Function  
writer.println("");
writer.println("");
// HTML Body Ends   
writer.println("");
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();
}
}

-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
>  *produ

Re: Data Visualisation Event Handling using PERFORM-ACTION-SEND-EVENT

2007-08-22 Thread Averell, Graham
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
>

Re: Data Visualisation Event Handling using PERFORM-ACTION-SEND-EVENT

2007-08-22 Thread Carey Matthew Black
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();
>  

Data Visualisation Event Handling using PERFORM-ACTION-SEND-EVENT

2007-08-22 Thread Averell, Graham
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("Hello World Plugin
Example");
//  writer.println("Hello again " + mydata + "
");

writer.println("");
writer.println(ps.getEventInfrastructureCode());

// Java Script Function SendMidTierEvent(eventdata_mid), eventtype =
"MidEvent"
//  Tiggers handleEvent() code below 
writer.println("function
sendMidTierEvent(eventdata_mid) {");

writer.println(ps.getEventDispatcherName()+".sendEventToMidTier(\"MidEve
nt\",eventdata_mid);");
writer.println("};"); 
writer.println("");

// Java Script Function SendParentFormEvent(eventdata_par), eventtype =
"ParentEvent"   
//