Author |
Message
|
mqjeff |
Posted: Wed Nov 04, 2015 7:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Follow the appropriate and documented methods for creating a Java method that is callable from ESQL.
Your code does not appear to demonstrate that.
Otherwise, everything else being mentioned in this thread. File access from java code? Don't do that. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
chaitu |
Posted: Mon Nov 09, 2015 10:11 am Post subject: |
|
|
Voyager
Joined: 15 Apr 2014 Posts: 89
|
Hi All,
Thanks for all.
Now am able to unzip the file.
I am just passing the parameters of the unzip class from jcn.
Like
String fileName = (String) localEnv.getFirstElementByPath("WrittenDestination/File/Name").getValue();
//String msgStr = "c:/ZipFile/TEST.zip";
String msgStr = "c:/ZipFile"+ "\\" + fileName;
String destDir = "c:/ZipFileOutDir";
GBSUtils c = new GBSUtils();
c.unzip(msgStr,destDir);
Regards. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Nov 09, 2015 10:27 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
chaitu wrote: |
Hi All,
Thanks for all.
Now am able to unzip the file.
I am just passing the parameters of the unzip class from jcn.
Like
String fileName = (String) localEnv.getFirstElementByPath("WrittenDestination/File/Name").getValue();
//String msgStr = "c:/ZipFile/TEST.zip";
String msgStr = "c:/ZipFile"+ "\\" + fileName;
String destDir = "c:/ZipFileOutDir";
GBSUtils c = new GBSUtils();
c.unzip(msgStr,destDir);
Regards. |
Well done for that BUT you have ignored the advice that has been given about doing FILE IO from within a JCN. What happens is c:\Zipfile\ isn't there on the production system OR that the broker user does not have access to the directory?
What happens if your flow is deployed on a non windows OS?
You can do this using in-memory structures that make it totally portable. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
chaitu |
Posted: Mon Nov 09, 2015 9:11 pm Post subject: |
|
|
Voyager
Joined: 15 Apr 2014 Posts: 89
|
Hi All,
If the directory is not their, then the flow fails, i got it but i dont know how to use in-memory structures.
I want to know could you share any link or guide me this.
Thanks for your valuable suggestion. |
|
Back to top |
|
 |
darioo |
Posted: Tue Nov 10, 2015 12:57 am Post subject: |
|
|
Novice
Joined: 19 Mar 2009 Posts: 15
|
Few more things to think about.
What if there is more than one file in the zip file? Assuming that's the case, and you can handle it, what will happen if these files are placed in multiple directories in the zip file?
Unzipping isn't quite as straightforward when you go deeper into details. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Nov 10, 2015 1:07 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
chaitu wrote: |
Hi All,
If the directory is not their, then the flow fails, i got it but i dont know how to use in-memory structures.
I want to know could you share any link or guide me this.
Thanks for your valuable suggestion. |
Have you even googled for something like
Java unzip in memory
?????? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|