Re: [Configuration] Is there any way to save my complex bean in XML resource and use it later ?
Hi Moein, Moein Enayati wrote: Dear all Hi Till now ,whenever I want to use Apache.Commons.Configuration API with an XML file , I’ve written down myBeans definition manually in XML resource. But now I have a new demand to use complex beans with complex property types and the ability to save them (their signature) automatically in the XML resource. I’ve just find apache.commons.betwixt. BeanWriter() having the ability , but it seems configuration-API has its own signature. Is there any way in Apache.commons.configuration to save my beans in an xml file which is compatible with configuration ? This is definitely out of scope for commons configuration. What you're looking for is a persistence layer that can turn a Java object into XML and restore it later. This is a classical task for JAXB or something like XStream. - Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: FTPClient hangs when downloading large files
On 16 February 2011 01:43, Daniel F. Savarese d...@savarese.org wrote: In message 56fc94a3326c66468ce73d751286ff23496...@nawespscez02v.nadsuswe.nads. navy.mil, Cysneros, Nelson A CIV SPAWARSYSCEN-PACIFIC, 56540 writes: I'm using the net-commons v2.2 FTPClient to download files from a server and it works great for files less then 250MB, but hangs with larger files. ... ftpClient.retrieveFile(ftpPath + / + files[i].getName(),fos); //Hangs here Try using retrieveFileStream and writing your own stream-copying loop (it should be only a few lines of code; but don't forget to call completePendingCommand afterward). If it works, then there's something wrong with org.apache.commons.net.io.Util.copyStream. If you still experience a mysterious hang, then it's probably not a Commons Net issue, but something to do with the network environment. BTW, I tried running your code with an ISO of 654604 KB and it worked fine for me. daniel - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Configuration] Is there any way to save my complex bean in XML resource and use it later ?
Dear Jörg You're ok! But have a look at this part of code : *BeanDeclaration bDecl = new XMLBeanDeclaration(xmlConfig, myBeanNameRootAddress);* *MyBean myBean = (MyBean ) BeanHelper.createBean(bDecl);* Here we have the ability to load a predefined bean out of an XML file. So I thought it must be a simple way to save that bean into the same file ! You know , I’m worry about using another library to save myBean into the file and I can’t load its XMLDeclaration later on. Am I right? On Wed, Feb 16, 2011 at 2:02 PM, Jörg Schaible joerg.schai...@scalaris.comwrote: Hi Moein, * Moein Enayati wrote: ..* This is definitely out of scope for commons configuration. What you're looking for is a persistence layer that can turn a Java object into XML and restore it later. This is a classical task for JAXB or something like XStream. - Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
RE: FTPClient hangs when downloading large files
Try it with some other FTP client software. If it doesn't work, then the problem isn't in your java class. -Original Message- From: Cysneros, Nelson A CIV SPAWARSYSCEN-PACIFIC, 56540 [mailto:nelson.cysne...@navy.mil] Sent: Tuesday, February 15, 2011 4:50 PM To: user@commons.apache.org Subject: FTPClient hangs when downloading large files I'm using the net-commons v2.2 FTPClient to download files from a server and it works great for files less then 250MB, but hangs with larger files. Wondering if there is anything I can do to get around this issue. I'm downloading files up to 500MB in size. Thanks in advance. Here is my source code: FTPClient ftpClient = new FTPClient(); File file = null; // // Grab all files from the FTP server and place them in the specified // folder for processing. // Log on to FTP server try { // FTP Server ftpClient.enterLocalPassiveMode(); ftpClient.connect(ftpServer); // After connection attempt, you should check the reply code to verify // success. int reply = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftpClient.disconnect(); logger.error(FTP server refused connection.); System.exit(1); } ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.login(m_sFTPCredUN, m_sFTPCredPW); } catch (java.net.ConnectException ex1) { logger.info(ex1.getMessage()); System.out.print(-FTP Connection problem: + ftpServer+\n); return; }catch (Exception ex1) { logger.info(ex1.getMessage()); System.out.print(-FTP Connection problem: +ftpServer+\n); return; } //Download files FileOutputStream fos=null; try { // List the files in the directory FTPFile[] files = ftpClient.listFiles(ftpPath); logger.info(Number of files in dir: + files.length); for (int i = 0; i files.length; i++) { String fileName = files[i].getName(); // // Get Files // logger.info(Getting file: + fileName); file = new File(m_sInputRapierPath + File.separator + files[i].getName()); fos = new FileOutputStream(file); ftpClient.retrieveFile(ftpPath + / + files[i].getName(),fos); //Hangs here logger.info(File transfer complete); fos.close(); } } catch (org.apache.commons.net.io.CopyStreamException e) { logger.info(FTP FETCH PROBLEM(1): + e.getMessage()); //System.out.println(FTP FETCH PROBLEM(1): + e.getMessage()); try { if (file != null){ fos.close(); file.delete(); } }//try catch(IOException ex){ logger.info(FTP Problem occured(4) : + ex.getMessage()); }//catch } catch (Exception ex) { logger.info(FTP FETCH PROBLEM(3): + ex.getMessage()); //System.out.println(FTP FETCH PROBLEM(3): + e.getMessage());
[email] 1.3 release
Are there any outstanding major or minor issues that are preventing the release of 1.3? Nathan
Re: [Configuration] Is there any way to save my complex bean in XML resource and use it later ?
Am 16.02.2011 11:50, schrieb Moein Enayati: Dear Jörg You're ok! But have a look at this part of code : *BeanDeclaration bDecl = new XMLBeanDeclaration(xmlConfig, myBeanNameRootAddress);* *MyBean myBean = (MyBean ) BeanHelper.createBean(bDecl);* Here we have the ability to load a predefined bean out of an XML file. So I thought it must be a simple way to save that bean into the same file ! You know , I’m worry about using another library to save myBean into the file and I can’t load its XMLDeclaration later on. Am I right? This support for loading beans in Commons Configuration is more like in the Spring framework (but in a very limited form). There you also define beans in configuration files which you can load at runtime, but you do not have the possibility to store beans and update your configuration files. As Jörg pointed out, you are really after a XML bean mapper. Commons Configuration does not support this use case, at least not in a convenient way. Sorry Oliver On Wed, Feb 16, 2011 at 2:02 PM, Jörg Schaible joerg.schai...@scalaris.comwrote: Hi Moein, * Moein Enayati wrote: ..* This is definitely out of scope for commons configuration. What you're looking for is a persistence layer that can turn a Java object into XML and restore it later. This is a classical task for JAXB or something like XStream. - Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [configuration] Testing against commons-lang 2.5 and 2.6
Am 16.02.2011 21:22, schrieb Holmes, Daniel: Is this project tested (or planned to be) against the latest releases of commons-lang According to this page it has not been yet http://commons.apache.org/configuration/dependencies.html Thanks Daniel Holmes Currently the trunk version in subversion uses commons-lang 2.5 as dependency without problems. I just ran the unit tests successfully with version 2.6 on my local machine. Because minor releases of Commons components take backwards compatibility very serious I do not expect any problems with these new versions of commons-lang. Oliver - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [configuration] Testing against commons-lang 2.5 and 2.6
Holmes, Daniel wrote: Is this project tested (or planned to be) against the latest releases of commons-lang According to this page it has not been yet http://commons.apache.org/configuration/dependencies.html Gump runs against lang 2.x trunk without problems. - Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[Net] Creating an FTPClient from a java.net.URL
If this has been raised before, I couldn't find it in the list archives or JIRA. It would be useful to configure an FTPClient using a URL, similar to how FtpURLConnection does in the JRE. Parsing a URL to extract host, port, user info and path seems like something that would be best implemented by the library, as opposed to any client code. If people agree, I'll have a go at submitting a patch for this. -- Thanks James Shaw - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org