RE: Building a GUI around a JPOS ISOServer

337 views
Skip to first unread message

mwyc...@gmail.com

unread,
Oct 9, 2008, 8:44:07 AM10/9/08
to jPOS Users
Good day all,

hoping you are doing fine.

Well I need some assistance,
How can I build a simple GUI around my JPOS ISOServer application so
that I can use it to
manage functions such as ;
1 - Sign off (disconnection) from Switch as opposed to mere clicking
of the Close button on the JPOS Black screen

2 - Display Messages e.g. in the form
Messages
- Received
Cash Withdrawal
Balance Inquiry
Mini-Statements
Deposits
Bill Payments
- Processed
Success
Failure

I know that clicking on the Isometer screen gives info close to that
of (2) above in the form
1200 -->
<-- 1210,
However,this info may not be easily understood by a normal user. Thats
why I was thinking of building such a control GUI around it.

Please help me out, any one with a similar piece of code or advice on
how to incorporate such functionality in a JPOS IsoServer app.

thanks

Alejandro Revilla

unread,
Oct 9, 2008, 6:51:17 PM10/9/08
to jpos-...@googlegroups.com
>
> How can I build a simple GUI around my JPOS ISOServer application so
> that I can use it to
> manage functions such as ;
>
> 1 - Sign off (disconnection) from Switch as opposed to mere clicking
> of the Close button on the JPOS Black screen
>
> 2 - Display Messages e.g. in the form
> Messages
> - Received
> Cash Withdrawal
> Balance Inquiry
> Mini-Statements
> Deposits
> Bill Payments
> - Processed
> Success
> Failure
>
I sometimes use the org.jpos.ui component, here is a sample configuration:

<?xml version='1.0' encoding="iso-8859-1" ?>

<qbean class="org.jpos.q2.ui.UI" name="UI" logger="Q2"
look-and-feel="com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"
provider="org.jpos.bsh.BSHUI">

<ui width="800" height="600" full-screen="false" undecorated="false" close="true">
<caption>jPOS</caption>

<menubar id="MAIN">
<menu id="Actions" accesskey="f">
<menuitem id="Echo-Test" accesskey="E" action="bsh" command="cfg/echotest.bsh" />
<menuitem id="Sign-on" accesskey="O" action="bsh" command="cfg/signon.bsh" />
<menuitem id="Sign-off" accesskey="F" action="bsh" command="cfg/signoff.bsh" />
<menuseparator />
<menuitem id="Quit" accesskey="Q" action="exit" />
</menu>
</menubar>

<components>
<border-layout>
<center>
<vsplit divider="110">
<top>
<grid rows="1" columns="1">
<cell>
<iso-meter refresh="250" idref="channel.channel">Remote Host</iso-meter>
</cell>
</grid>
</top>
<bottom>
<log-listener scrollable="true"
logger="Q2" font="fixed-normal-12" max-events="1000" max-lines="50" />
</bottom>
</vsplit>
</center>
<south>
<label font="helvetica-bold-8">jPOS</label>
</south>
</border-layout>
</components>
</ui>
<object class="org.jpos.ui.action.Exit" id="exit" />
<object class="org.jpos.bsh.BSHAction" id="bsh" />
</qbean>

Then cfg/echotest.bsh looks like this:

import org.jpos.iso.*;
import org.jpos.space.*;

Space sp = SpaceFactory.getSpace("jdbm:stan");
long stan = SpaceUtil.nextLong (sp, "stan");

ISOMsg m = new ISOMsg();
m.set (0, "0800");
m.set (7, ISODate.getDateTime(new Date()));
m.set (11, ISOUtil.zeropad (Long.toString(stan % 1000000), 6));
m.set (70, "301");
sp.out ("send", m);

You can add more cells and monitor channels as well as servers.

>
> I know that clicking on the Isometer screen gives info close to that
> of (2) above in the form
> 1200 -->
> <-- 1210,
> However,this info may not be easily understood by a normal user. Thats
> why I was thinking of building such a control GUI around it.
>

You can certainly create your own component, you can use ours as a sample starting point.

--Alejandro

rado

unread,
Oct 10, 2008, 8:29:44 AM10/10/08
to jPOS Users
Hi Alejandro,

I have tested the script and it is good for monitoring the server,
thanks.
And with my couriousity i have a few questions:
- is there a way to make the log listener area (bottom area) to
running in auto-scroll when the message comes?
- I have dblogger which save the status of messages into database. Can
I add a new cell to show the database's record? maybe in JSP or
something..

B' Rgds,
gusto

mwyc...@gmail.com

unread,
Oct 10, 2008, 1:28:06 PM10/10/08
to jPOS Users
Hi Alejandro,

Thanks so much for this piece of code,it's really a good starting
point.
I still can't believe that this could be achieved in just the ISometer
file, am so happy its possible.

Unfortunately, I have not succeeded in testing the echotest.bsh
First, my isometer couldn't start, so I thought that may be this was
due to the version of JPOS i was using(jpos-1.5.0.jar)
so I changed it and pasted in my lib folder the jpos.jar file that is
generated when you build jpos-1.6.2.
With the above change, the ISometer was able to start.

Then I got another error on clicking the echotest menu, I really don't
know why.
Could this be because am using windows?
Or the q2.jar that am using to start my isoserver is missing some
files?
Because in my case i start my isoserver with java -jar q2.jar, how can
I make a q2.jar based on jpos-1.6.2?

<warn>
start
<iso-exception>
org.jpos.bsh.BSHUI
<nested-exception>
javax.management.ReflectionException: null nested exception is
java.lang.ClassNotFoundException: org.jpos.bsh.BSHUI
java.lang.ClassNotFoundException: org.jpos.bsh.BSHUI
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
mx4j.server.interceptor.InvokerMBeanServerInterceptor.instantiate(InvokerMBeanServerInterceptor.java:
100)
at
mx4j.server.interceptor.DefaultMBeanServerInterceptor.instantiate(DefaultMBeanServerInterceptor.java:
106)
...............................................
org.jpos.core.ConfigurationException: org.jpos.bsh.BSHUI
(javax.management.ReflectionException: null nested exception is
java.lang.ClassNotFoundException: org.jpos.bsh.BSHUI)
at org.jpos.q2.QFactory.newInstance(QFactory.java:341)

Please advise,

Rado, since you have got it right, may be you can give me some clue on
any extra steps you took to make it work.

thanks
> --Alejandro- Hide quoted text -
>
> - Show quoted text -

Alejandro Revilla

unread,
Oct 10, 2008, 2:35:59 PM10/10/08
to jpos-...@googlegroups.com
>
> Because in my case i start my isoserver with java -jar q2.jar, how can
> I make a q2.jar based on jpos-1.6.2?
>
Get the latest svn version and call 'ant'

org.jpos.ui.BSHUI is there in modules/jpos/src/org/jpos/bsh/BSHUI.java

Alejandro Revilla

unread,
Oct 10, 2008, 2:41:12 PM10/10/08
to jpos-...@googlegroups.com
>
> I have tested the script and it is good for monitoring the server,
> thanks.
>
Good to know you like it.

>
> And with my couriousity i have a few questions:
> - is there a way to make the log listener area (bottom area) to
> running in auto-scroll when the message comes?
>

Ha! Yeah.. I want that too, I guess you could have a look at
modules/jpos/src/org/jpos/ui/factory/LogListenerFactory.java and give it
a shot. It has been some time since my last Swing based project so I
don't know exactly how to deal with the slider in realtime, but I'm sure
it's doable.

>
> - I have dblogger which save the status of messages into database. Can
> I add a new cell to show the database's record? maybe in JSP or
> something..
>

You can create a custom UI factory and integrate your own components
into the UI (any JFrame). There's a very interesting one, the
HtmlFactory that lets you put a mini browser inside the jPOS UI.

--Alejandro

mwyc...@gmail.com

unread,
Oct 10, 2008, 3:28:42 PM10/10/08
to jPOS Users


Alejandro,

so you mean the problem is due to the q2.jar or the jpos.jar or both?

Yes, the BSHUI.java is in available and i would expect the jpos.jar
created from the build would have it.
But am wondering why i throws that error/exception.

Please help me understand this stmt
> Get the latest svn version and call 'ant'
I didn't quite understand it and how to go about it.
Where can I get the latest svn version?

I also realise that if I modify the isometer and remove some portions
like;
provider="org.jpos.bsh.BSHUI">
and
<object class="org.jpos.bsh.BSHAction" id="bsh" />

I am able to launch the isometer with jpos-1.5.0.jar and can even
access the Actions menu - Only the Quit functions works fine.
Now my challenge is on the format for the .bsh files
<menuitem id="Echo-Test" accesskey="E" action="bsh" command="cfg/
echotest.bsh" />
<menuitem id="Sign-on" accesskey="O" action="bsh" command="cfg/
signon.bsh" />
<menuitem id="Sign-off" accesskey="F" action="bsh" command="cfg/
signoff.bsh" />

Whats the secret in the action files above being .bsh files? Is it
possible to have them defined in a different format?
At first I thought echotest.bsh was a java file, but then i realised
there was no class definition.
So how does JPOS running on a windows env interprete and run/execute
these files once i click on the respective action menu.

In the definition of echotest.bsh, i dont' see any reference to the
server ip or port, how is it possible
that it can send an echo test?

regards,

Alejandro Revilla

unread,
Oct 10, 2008, 3:52:01 PM10/10/08
to jpos-...@googlegroups.com
>
> Where can I get the latest svn version?
>
go to http://jpos.org/resources
I think Mark explained how to use TortoiseSVN.

>
> I also realise that if I modify the isometer and remove some portions
> like;
> provider="org.jpos.bsh.BSHUI">
> and
> <object class="org.jpos.bsh.BSHAction" id="bsh" />
>
> I am able to launch the isometer with jpos-1.5.0.jar and can even
> access the Actions menu - Only the Quit functions works fine.
>

Exactly, that makes sense, because BSHUI is not available and you can't
run the BSH scripts.

>
> Whats the secret in the action files above being .bsh files? Is it
> possible to have them defined in a different format?
>
> At first I thought echotest.bsh was a java file, but then i realised
> there was no class definition.
>

It's a BeanShell script (see http://www.beanshell.org)

>
> So how does JPOS running on a windows env interprete and run/execute
> these files once i click on the respective action menu.
>

BeanShell

>
> In the definition of echotest.bsh, i dont' see any reference to the
> server ip or port, how is it possible
> that it can send an echo test?
>

It uses the already defined channel and send the message through the
jPOS Space, our coordination infrastructure.

mwyc...@gmail.com

unread,
Oct 11, 2008, 8:56:03 AM10/11/08
to jPOS Users

Good day,

Thanks for all the clarifications.

Now I have a bit of challenge on the BeanShell,
the link http://www.beanshell.org seems to be unavailable, is there
any alternate link i can use?

regards,

On Oct 10, 10:52 pm, Alejandro Revilla <a...@jpos.org> wrote:
> > Where can I get the latest svn version?
>
> go tohttp://jpos.org/resources
> I think Mark explained how to use TortoiseSVN.
>
>
>
> > I also realise that if I modify the isometer and remove some portions
> > like;
> > provider="org.jpos.bsh.BSHUI">
> > and
> > <object class="org.jpos.bsh.BSHAction"  id="bsh"  />
>
> > I am able to launch the isometer with jpos-1.5.0.jar and can even
> > access the Actions menu - Only the Quit functions works fine.
>
> Exactly, that makes sense, because BSHUI is not available and you can't
> run the BSH scripts.
>
>
>
> > Whats the secret in the action files above being  .bsh files? Is it
> > possible to have them defined in a different format?
>
> > At first I thought echotest.bsh was a java file, but then i realised
> > there was no class definition.
>
> It's a BeanShell script (seehttp://www.beanshell.org)

Alejandro Revilla

unread,
Oct 11, 2008, 12:56:16 PM10/11/08
to jpos-...@googlegroups.com
Probably a transient issue with their site, try to google for Beanshell
and use Google's cache. There's also info on Wikipedia.

Mark Salter

unread,
Oct 11, 2008, 1:46:55 PM10/11/08
to jpos-...@googlegroups.com
Alejandro Revilla wrote:
> Probably a transient issue with their site, try to google for Beanshell
> and use Google's cache. There's also info on Wikipedia.
All good suggestions.

The site has been absent for about a week now, I imagine though it will
be back shortly.

I will ask on their mailing list.

--
Mark

mwyc...@gmail.com

unread,
Oct 12, 2008, 8:14:57 AM10/12/08
to jPOS Users
Thanks.

Let me in the meantime try out the Alejandro's google option.
May be the site will be on shortly.

Mark Salter

unread,
Oct 12, 2008, 10:38:22 AM10/12/08
to jpos-...@googlegroups.com
mwyc...@gmail.com wrote:
> Thanks.
No response to my mailing list question yet.

Perhaps I should have asked before...
... what are you trying to get from the site?


--
Mark

mwyc...@gmail.com

unread,
Oct 13, 2008, 6:05:39 AM10/13/08
to jPOS Users
Actually I thought needed to get this library if my isometer was to
work
with such entries.
<menuitem id="Echo-Test" accesskey="E" action="bsh" command="cfg/
echotest.bsh" />
<menuitem id="Sign-on" accesskey="O" action="bsh" command="cfg/
signon.bsh" />
<menuitem id="Sign-off" accesskey="F" action="bsh" command="cfg/
signoff.bsh" />

It was clarification from Alejendro to me that .bsh files are
BeanShell scripts and he had asked me to see (http://
www.beanshell.org) .
So I was curious to visit this site.

I realised that I already have bsh-2.0b4.jar in my jpos-ee build
folder. So I wouldn't really need
the api any more and I have pasted it in the jre/lib/ext folder.Hope
this is all I need.

Let me ask, whats the difference between running Dave's "bsh.bat" and
running
"java bsh.Interpreter" at the cmd prompt

regards,


On Oct 12, 5:38 pm, Mark Salter <marksal...@talktalk.net> wrote:

Mark Salter

unread,
Oct 13, 2008, 8:03:31 AM10/13/08
to jpos-...@googlegroups.com
mwyc...@gmail.com wrote:

> Let me ask, whats the difference between running Dave's "bsh.bat" and
> running
> "java bsh.Interpreter" at the cmd prompt

Not much, the bsh.bat mainly sets up the classpath before making the
same call to bsh.Interpretor.

--
Mark

mwyc...@gmail.com

unread,
Oct 13, 2008, 10:34:56 AM10/13/08
to jPOS Users
Ok, I understand.

Actually when you look at it's contents, it just set the classpath and
then calls the bsh interpreter.
But why is it that windows doesn't recognize it?

C:\Projects\jposee>bin\bsh.bat
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

thanks.

On Oct 13, 3:03 pm, Mark Salter <marksal...@talktalk.net> wrote:

Mark Salter

unread,
Oct 13, 2008, 1:39:59 PM10/13/08
to jpos-...@googlegroups.com
mwyc...@gmail.com wrote:

> But why is it that windows doesn't recognize it?
>
> C:\Projects\jposee>bin\bsh.bat
> 'C:\Program' is not recognized as an internal or external command,
> operable program or batch file.
>

There really is a space following C:\Program in the command generated.
If you can't see it, then there is not much more I can do for you?

You are trying to run a command called 'Program' on the root of your c
drive; it probably does not exist.

Put quotes around the command it will work.

--
Mark

mwyc...@gmail.com

unread,
Oct 14, 2008, 12:20:18 PM10/14/08
to jPOS Users
Thanks Mark,

Actually the problem was due to that space.
After enclosing the path in quotes, the bsh shell now comes up.

regards,


On Oct 13, 8:39 pm, Mark Salter <marksal...@talktalk.net> wrote:

mwyc...@gmail.com

unread,
Oct 15, 2008, 5:25:18 AM10/15/08
to jPOS Users
Hellos,

I am failing to understand the effect of running
cfg/echotest.bsh from the IsoMeter GUI (via Actions -> Echo - Test).

The process of clicking on "Actions -> Echo - Test" only creates two
files stan.lg and stan.db
and no activity on the isoserver screen. Is that what I should expect?
or there is something wrong.

thanks


On Oct 10, 1:51 am, Alejandro Revilla <a...@jpos.org> wrote:

Alejandro Revilla

unread,
Oct 15, 2008, 12:49:52 PM10/15/08
to jpos-...@googlegroups.com
>
> I am failing to understand the effect of running
> cfg/echotest.bsh from the IsoMeter GUI (via Actions -> Echo - Test).
>
Is your ISO/Meter red or green? If it's red (unconnected), then there's
no effect. If it's green, you should see the message going out.

mwyc...@gmail.com

unread,
Oct 16, 2008, 6:12:45 PM10/16/08
to jPOS Users
Actually what happens is that,
when i click on the Echo -Test item under the Actions menu on the
ISOMeter,

two files stan.db and stan.lg are created inside the root dir of the
ISOServer,
but the ISOMeter remains Red and no messages go out accross the
ISOMeter.

I expected to see some messages go out, but nothing happens on the
ISOMeter at all,
apart from theose two files that are created.
Only the Quit item is working fine, when i click on it, it exits/
shutsdown the application.

Any one with a sample signon.bsh or signoff.bsh that I could use to
test?

thanks

David Bergert

unread,
Oct 16, 2008, 6:19:20 PM10/16/08
to jpos-...@googlegroups.com
Actually what happens is that the echo-test bsh code, places an 800 message
in a queue/space that is also persisted to a jdbm space your lg. and ,db
files, there is not anther process that picks the 800 from the space, and
processes it over a connected channel.

The red meaning there is no channel connection for the 800 to be sent, and
probably nothing that will response to the 800 message with an 810.. Look
at the echo-test.bsh code, that was provided as an example, it is not a full
implementation.

Dave Bergert
http://www.paymentsystemsblog.com

Alejandro Revilla

unread,
Oct 16, 2008, 6:20:03 PM10/16/08
to jpos-...@googlegroups.com
If the ISOMeter remains red it means that it is not connecting to the
remote host. Please see your q2.log, you probably have a connection
refused message, no route to host, or something like that.

mwyc...@gmail.com

unread,
Oct 17, 2008, 3:20:14 PM10/17/08
to jPOS Users
The q2.log only contains the following details;

<log realm="simtel.server" at="Fri Oct 17 21:53:53 EAT 2008.297">
<iso-server>
listening on port 7002
</iso-server>
</log>

No refused message.

Since my packager is based on ISO 8583:1993 , I tried changing
echotest.bsh as below but still couldn't see any thing.

import org.jpos.iso.*;
import org.jpos.space.*;

Space sp = SpaceFactory.getSpace("jdbm:stan");
long stan = SpaceUtil.nextLong (sp, "stan");

ISOMsg m = new ISOMsg();
m.set (0, "1800");
m.set (7, ISODate.getDateTime(new Date()));
m.set (11, ISOUtil.zeropad (Long.toString(stan % 1000000), 6));
m.set (70, "301");
sp.out ("send", m);

Could the problem be because am using jpos-1.5.0?
May be some classes are missing, but i think its only bsh classes.
space classes seem to be available in jpos-1.5.0.

Do I need to worry about the created stan.lg and stan.db, or thats
fine?

Instead of using the sp, how else can i make it point to the server ip
and port?

regards,
> > > no effect. If it's green, you should see the message going out.- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages