Create custom packagers!

839 views
Skip to first unread message

Chung vu

unread,
Mar 17, 2009, 3:57:21 AM3/17/09
to jpos-...@googlegroups.com
Hi all ,
I am reading our POS specification from my vendor.
I create custom packager for that based on specification .
My quesiton is
Would i create both of two file
1) /src/main/org/jpos/jso/packager/ newspec.java
2) /src/config/packager/ newspec.xml

Based on Andy Orrock blog , he taught creating xml file only ,

Would any body advise me ?  
Thanks

chhil

unread,
Mar 17, 2009, 4:32:18 AM3/17/09
to jpos-...@googlegroups.com
You define a packager for if and only if you the existing ones don't
match or tweaked to match.

There are 2 ways of defining a packager
1. xml file.
2. java file.

Preferable approach is to use the xml file. This xml file should be
passed into the generic packager and then used.

The other approach is to use the java file where you instantiate your
java object in your code.

If you take a look at the source you will see that there would be a
java file and and xml file for existing packagers.

Highly recommend you buy the programmers guide to make your life easier.

-chhil

Chung vu

unread,
Mar 17, 2009, 4:48:04 AM3/17/09
to jpos-...@googlegroups.com
Hi chihil,
Thanks so much !
I understand now and choose the xml file that i created before email group for asking.
I bought the jpos guide one year ago due to my limitation of java so i start until now.

You said that :

"his xml file should be
passed into the generic packager and then used."

I try to see the code but which place to pass into generic packager.
I have this question because i don't know call it from jpos.

I read the manual , this example code is :

import org.jpos.iso.ISOPackager;
import org.jpos.iso.packager.ISO87BPackager;

from my understand that it it used java file .
Would you give me a code for using xml file ?

I am not good in java but try to code it .
Thanks!
--
Vu Dinh Chung
IT CENTER - VPBANK
Address: No. 8 Le Thai To Street, Hoan Kiem Dist., Hanoi, Vietnam
Phone: (844) 9288858
Mobile: 0904.568388
Email: dinh...@vpb.com.vn
         dinhc...@gmai.com
         dinhc...@yahoo.com
Web: www.vpb.com.vn
        www.a4tranphu.com

Mark Salter

unread,
Mar 17, 2009, 5:24:52 AM3/17/09
to jpos-...@googlegroups.com
Chung vu wrote:

> I try to see the code but which place to pass into generic packager.
> I have this question because i don't know call it from jpos.
>
> I read the manual , this example code is :

It is probably worth you getting the latest release of this document?

>
> import org.jpos.iso.ISOPackager;
> import org.jpos.iso.packager.ISO87BPackager;
>
> from my understand that it it used java file .
> Would you give me a code for using xml file ?

The jpos-ee components will allow you to specify the configuration file
directly:-

Section 13.1.9 :-

<mux name="mux" logger="qsp" realm="mux" connect="yes">
<property name="tracenofield" value="11" />
<channel name="channel"
class="org.jpos.iso.channel.CSChannel"
packager="org.jpos.iso.packager.GenericPackager"
packager-config="cfg/newspec.xml"
logger="qsp" realm="channel">
<property name="host" value="192.168.0.1" />
<property name="port" value="8000" />
</channel>
<request-listener
class="org.jpos.apps.qsp.RequestDispatcher"
logger="qsp" realm="dispatcher">
<property name="prefix" value="my.company.jpos.Handler_" />
<property name="timeout" value="60000" />
</request-listener>
</mux>


But to use it from code (Example 3.4 in the current version of the guide:-

Example 3.4.

import org.jpos.iso.ISOPackager;
import org.jpos.iso.packager.GenericPackager;
import org.jpos.iso.packager.ISO87BPackager;
.
.
.
ISOPackager p = new GenericPackager ("newspec.xml");


>
> I am not good in java but try to code it .

Perhaps jpos-ee is a better option for you. It will depend on what you
are trying to implement, but with jpos-ee you can certainly write less code.

--
Mark

Chung vu

unread,
Mar 17, 2009, 5:41:43 AM3/17/09
to jpos-...@googlegroups.com
Thanks Mark so much !
You recommend me to use jpos-ee .
Our implementation is that
I code a client send to POS channel ( we use OPENWAY solution from Russion) :
+ balance inquiry
............
or
make a gateway that receive iso 8583 and use my oracle function to return value through this gateway.

Is it okie to use jpos-ee ?
Regards,
Chung

Mark Salter

unread,
Mar 17, 2009, 6:03:00 AM3/17/09
to jpos-...@googlegroups.com
Chung vu wrote:
> Thanks Mark so much !
> You recommend me to use jpos-ee .
This was to minimise the amount of java code you might need to write
because you indicated that you were not too familiar with java. Instead
of code, you would setup the jpos components via xml configuration
files, and write java code just for the application level message
building or handling.

> Our implementation is that
> I code a client send to POS channel ( we use OPENWAY solution from Russion)
> :
> + balance inquiry
> ............
> or
> make a gateway that receive iso 8583 and use my oracle function to return
> value through this gateway.
>
> Is it okie to use jpos-ee ?

I would think so, but I can't really offer guidance against the
description given, sorry.

--
Mark

vu dinh chung

unread,
Mar 17, 2009, 6:10:08 AM3/17/09
to jpos-...@googlegroups.com
Hi Mark ,
If you use code like Example 3.4 means that you also need create java.file  ( ISO87BPackager.java)
import org.jpos.iso.packager.ISO87BPackager
so you must create 2 file : xml and java file
Would you help me to explain ? It makes me confused
Thanks
Chung

Mark Salter

unread,
Mar 17, 2009, 6:19:09 AM3/17/09
to jpos-...@googlegroups.com
vu dinh chung wrote:
> Hi Mark ,
> If you use code like Example 3.4 means that you also need create
> java.file ( ISO87BPackager.java)
> import org.jpos.iso.packager.ISO87BPackager
> so you must create 2 file : xml and java file
I'm sorry, yes the example is confusing, we should fix that.

> Would you help me to explain ? It makes me confused

Define your newspec.xml file,
create a ISOPackager via :-

ISOPackager newspecpackager = new GenericPackager ("newspec.xml");

and then use this ISOPackager where needed...

ISOChannel channel = new YourChannel("localhost", 8000, newspecpackager);

or

ISOMsg m = new ISOMsg();
m.setPackager(newspecpackager);


--
Mark

Digambar Chavan

unread,
May 23, 2019, 1:55:28 AM5/23/19
to jPOS Users
As you guided, there is a way to define generic packager using java, my question is, is it possible 
to achieve the role of generic packager by using 100% java code.

example,

GenericPackager packager = new GenericPackager("src/main/resources/basic.xml");
GenericPackager packager = new GenericPackager(javaObject reference);
can we do any such things? If possible please help me out with an example.

chhil

unread,
May 23, 2019, 7:38:57 AM5/23/19
to jpos-...@googlegroups.com
Please start a new thread when you have a question, do not add to an old thread.
You can use existing java packager or define your own ones. The drawback of java is if field definitions get added pr changed you need to need new builds. With the xml files you can just change the xml without worrying about java code.  
List of packagers provided by jpos...
Both GenericPackager (takes an xml file as input) and java based packagers both extend ISOBasePackager so that means they can be used interchangeably.


-chhil  

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/21f75a65-7c93-4b1e-96f9-a5679135ad51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Victor Salaman

unread,
May 23, 2019, 7:39:47 AM5/23/19
to 'Ruchira Biyani' via jPOS Users
Use the xml file. Use it as a resource (move it src/main/resources/*) so it becomes part of your jar. Then reference it as "jar:packager/mypackager.xml".


--

Andrés Alcarraz

unread,
May 23, 2019, 7:41:07 AM5/23/19
to jpos-...@googlegroups.com

Hi Digambar the xml approach is easier, but if you prefer to create the packager pure java, you have to extend ISOBasePackager, hte whloe role of generic packager is to load an xml packager definition file.

You can see chapter 4 of jpos programmer's guide to see some examples better yet a good explanation, a whole read to that doc is recommendable for every jpos developer at least once.

Hope this point you in the right direction.

Andrés

--

Andrés Alcarraz

unread,
May 23, 2019, 3:35:52 PM5/23/19
to jpos-...@googlegroups.com

Hi Digambar the xml approach is easier, but if you prefer to create the packager pure java, you have to extend ISOBasePackager, hte whloe role of generic packager is to load an xml packager definition file.

You can see chapter 4 of jpos programmer's guide to see some examples better yet a good explanation, a whole read to that doc is recommendable for every jpos developer at least once.

Hope this point you in the right direction.

Andrés Alcarraz
Transactility, Inc. | skype: alcarraz1976 | @andresalcarraz
On 23/5/19 00:22, Digambar Chavan wrote:
--

Digambar Chavan

unread,
May 24, 2019, 1:10:28 AM5/24/19
to jPOS Users

Thanks for your support & clarification,actually I am new to this JPOS world.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages