collections 3.3 SNAPSHOT ?

2010-01-05 Thread nicolas de loof
Hi

I'd like to use commons-collection 3.3 SNAPSHOT (to get Java5 syntax
support) but can't find it under
http://people.apache.org/repo/m2-snapshot-repository/ or *
http://repository.apache.org/snapshots http://repository.apache.org/*

did I miss something ?

Cheers,
Nicolas


FaltFile.jar

2010-01-05 Thread Emad Hamadaqa
Hi

I'd like to use FaltFile.jar but can't find it.

can any body help!

thanks.

Cheers,
Emad

-- 
Mit freundlichen Gren / With kind regards
Dipl Inf. Emad Hamadaqa
Goslarsche Str. 73
38118 Braunschweig

mailto: e...@hamadaqa.de

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: FaltFile.jar

2010-01-05 Thread Ben Short
Hi,

The project page [1] says that the code is unreleased.

So you will need to build it yourself. The instructions are here [2].

Ben

[1] http://commons.apache.org/sandbox/flatfile/index.html
[2] http://commons.apache.org/sandbox/flatfile/building.html


2010/1/5 Emad Hamadaqa e...@hamadaqa.de:
 Hi

 I'd like to use FaltFile.jar but can't find it.

 can any body help!

 thanks.

 Cheers,
 Emad

 --
 Mit freundlichen Gren / With kind regards
 Dipl Inf. Emad Hamadaqa
 Goslarsche Str. 73
 38118 Braunschweig

 mailto: e...@hamadaqa.de

 -
 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: FaltFile.jar

2010-01-05 Thread Matt Benson
FWIW, there is a [flatfile] M2 snapshot published at  
repository.apache.org.


-Matt

On Jan 5, 2010, at 6:44 AM, Ben Short wrote:


Hi,

The project page [1] says that the code is unreleased.

So you will need to build it yourself. The instructions are here [2].

Ben

[1] http://commons.apache.org/sandbox/flatfile/index.html
[2] http://commons.apache.org/sandbox/flatfile/building.html


2010/1/5 Emad Hamadaqa e...@hamadaqa.de:

Hi

I'd like to use FaltFile.jar but can't find it.

can any body help!

thanks.

Cheers,
Emad

--
Mit freundlichen Gren / With kind regards
Dipl Inf. Emad Hamadaqa
Goslarsche Str. 73
38118 Braunschweig

mailto: e...@hamadaqa.de

-
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




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: collections 3.3 SNAPSHOT ?

2010-01-05 Thread Matt Benson
It would probably be collections 4.0 and there hasn't yet been a  
snapshot published, due to the as-yet unresolved questions of package  
renaming, etc.


-Matt

On Jan 5, 2010, at 5:31 AM, nicolas de loof wrote:


Hi

I'd like to use commons-collection 3.3 SNAPSHOT (to get Java5 syntax
support) but can't find it under
http://people.apache.org/repo/m2-snapshot-repository/ or *
http://repository.apache.org/snapshots http:// 
repository.apache.org/*


did I miss something ?

Cheers,
Nicolas



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[MATH] New evolutionary algorithms framework

2010-01-05 Thread jfinkels

Hi everyone,

Since commons-math has a genetic algorithms package, I thought this might be
of interest to some of you.

I've been working on a new framework for evolutionary algorithms
(genetic algorithms, genetic programming, etc.) named jmona. For
now, the project information site is at
http://www.cs.tufts.edu/~jfinke02/jmona, and the source, some initial
tagged releases, and some more information on building it can be found
at the project's GitHub page at http://github.com/jfinkels/jmona. I'd
appreciate input from anyone who's willing to take a look.

Let me know what you think.

Thanks,
Jeffrey
-- 
View this message in context: 
http://n4.nabble.com/MATH-New-evolutionary-algorithms-framework-tp999082p999082.html
Sent from the Commons - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: FaltFile.jar

2010-01-05 Thread Jörg Schaible
Matt Benson wrote:

 FWIW, there is a [flatfile] M2 snapshot published at
 repository.apache.org.

Which should be definitely not there! Only official reelases can go to the 
repository.

- Jörg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Commons Configuration for i18n

2010-01-05 Thread Yogesh Rao
Hi,

I need to know if anyone has used configuration for internationalization 
purposes. Any pointers on how this has been achieved would be great. The two 
source where i think i would like to have this data configured would either be 
properties or database.

Thanks in advance.




Information transmitted by this e-mail is proprietary to MphasiS, its 
associated companies and/ or its customers and is intended 
for use only by the individual or entity to which it is addressed, and may 
contain information that is privileged, confidential or 
exempt from disclosure under applicable law. If you are not the intended 
recipient or it appears that this mail has been forwarded 
to you without proper authority, you are notified that any use or dissemination 
of this information in any manner is strictly 
prohibited. In such cases, please notify us immediately at 
mailmas...@mphasis.com and delete this mail from your records.


Re: [Jelly] Escaping variables

2010-01-05 Thread Oliver Heger

Am 05.01.2010 06:29, schrieb Paul Libbrecht:

Oliver,

an answer for you on:
http://commons.apache.org/jelly/faq.html #escapingJexl
the answer says to use double dollar signs.
paul


Many thanks, Paul! This works pretty well now!
Oliver




Le 04-janv.-10 à 22:35, Oliver Heger a écrit :


Hi,

I could not find the answer to the following question:

Jelly tags per default evaluate variables which appear in their body
as in the example shown in the overview page:

document time=${now}
Welcome ${user.name} to Jelly!
/document

How can I quote or escape the variable so that actually the text
${user.name} is passed to the tag? With other words: I want to
prevent that the variable is replaced.





-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Windows XP Compressed Folders doesn't recognize my VFS-based zip file

2010-01-05 Thread Stephen Huey
For posterity's sake, I meant to come back here and post the solution a
while ago.  I've got the full story here in this blog post:

http://stephenhuey.wordpress.com/2010/01/01/docxgae/

The relatively new Microsoft Office formats ending with extensions such as
.docx and .xlsx are zip files of directories of text files (XML) and images.
 Tried-and-true Java libraries for writing the old binary Microsoft Word and
Excel formats aren't yet supported on Google App Engine, so I was glad to
get this working since it was a required feature for our application.

My modified code for the zipDir and addDir methods is below.  As you can
see, I'm closing the ZipOutputStream rather than the OutputStream:


+ + + + + + + + + + + + + + + + + + + +


import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.FileType;

public class FileObjectHelper {

 public static FileObject createFolder(FileSystemManager fsManager, String
absolutePath) throws FileSystemException {
 FileObject theFolder = fsManager.resolveFile( absolutePath );
 if ( theFolder.exists() == false) {
 theFolder.createFolder();
 }
 return theFolder;
 }

 public static FileObject createFile(FileSystemManager fsManager, String
absolutePath) throws FileSystemException {
 FileObject theFile = fsManager.resolveFile( absolutePath );
 if ( theFile.exists() == false) {
 theFile.createFile();
 }
 return theFile;
 }

 public static void zipDir(FileObject docxZipFile, FileObject
directoryToZip) throws IOException {
 OutputStream out = docxZipFile.getContent().getOutputStream();
 ZipOutputStream zout = new ZipOutputStream(out);
 addDir(directoryToZip, zout, );
 zout.close(); // make sure you close the ZipOutputStream, not the
OutputStream!
 }

 public static void addDir(FileObject dirObj, ZipOutputStream zout, String
basePathSoFar) throws IOException {
 FileObject[] files = dirObj.getChildren();
 byte[] tmpBuf = new byte[1024];

 for (int i = 0; i  files.length; i++) {
 FileObject currentFile = files[i];
 String currentFileBaseName = currentFile.getName().getBaseName();

 if (currentFile.getType().equals(FileType.FOLDER)) {
 addDir(currentFile, zout, basePathSoFar + currentFileBaseName + /);

 } else { // else it's a file, not a directory
 BufferedInputStream bis = new
BufferedInputStream(currentFile.getContent().getInputStream());
 zout.putNextEntry(new ZipEntry(basePathSoFar + currentFileBaseName));
 int len;
 while ((len = bis.read(tmpBuf)) != -1) {
 zout.write(tmpBuf, 0, len);
 }
 zout.closeEntry();
 bis.close();
 } // end if
 } // end for loop
 } // end addDir
}


+ + + + + + + + + + + + + + + + + + + +





Happy New Year,
Stephen Huey




On Tue, Dec 15, 2009 at 1:54 AM, Stephen Huey stephen.h...@gmail.comwrote:

 I'm using GaeVFS which is based on Commons VFS, and I feel that my question
 is probably more relevant to Commons VFS than the Google App Engine layer on
 top of it.  My goal is to construct valid zip files on Google App Engine,
 and I successfully used GaeVFS to create zip files that Mac OS X can open
 and that Winzip on Windows can open, but Windows XP Compressed Folders
 refused to acknowledge files in subdirectories in the zip until I removed
 the leading forward slash from a ZipEntry whose name began with a
 directory.

 For example, the following basic class successfully generates a zip file
 containing a file in a subdirectory that Windows XP Compressed Folders will
 open:


 import java.util.zip.*;
 import java.io.*;
 public class ZipThis {
   public static void main(String args[]) throws IOException {
 if (args.length  1) {
   System.err.println(usage: java ZipThis Zip.zip);
   System.exit(-1);
 }
 File zipFile = new File(args[0]);
 if (zipFile.exists()) {
   System.err.println(Zip file already exists, please try another);
   System.exit(-2);
 }
 FileOutputStream fos = new FileOutputStream(zipFile);
 ZipOutputStream zos = new ZipOutputStream(fos);
 int bytesRead;
 String[] files = new String[] {D:/stylessub/styles.xml,
 D:/document.xml};
 String[] entryName = new String[] {stylessub/styles.xml,
 document.xml};
 byte[] buffer = new byte[1024];
 for (int i=0, n=files.length; i  n; i++) {
   String name = files[i];
   File file = new File(name);
   if (!file.exists()) {
 System.out.println(Skipping:  + name);
 continue;
   }
   BufferedInputStream bis = new BufferedInputStream(new
 FileInputStream(file));
   ZipEntry entry = new ZipEntry(entryName[i]);
   zos.putNextEntry(entry);
   while ((bytesRead = bis.read(buffer)) != -1) {
 zos.write(buffer, 0, bytesRead);
   }
   bis.close();
   zos.closeEntry();

 }
 zos.close();
   }
 }


 Now 

Re: Windows XP Compressed Folders doesn't recognize my VFS-based zip file

2010-01-05 Thread Mark Fortner
Hi Stephen,

Thanks for posting this. I read your blog entry as well. You mention
in passing that POI doesn't support the new formats. There's a
separate module that is supposed to support xlsx and docx formats. I
was able to use them in the past. Was there some particular gotcha
that people should keep an eye out for?

Regards,

Mark

On Tuesday, January 5, 2010, Stephen Huey stephen.h...@gmail.com wrote:
 For posterity's sake, I meant to come back here and post the solution a
 while ago.  I've got the full story here in this blog post:

 http://stephenhuey.wordpress.com/2010/01/01/docxgae/

 The relatively new Microsoft Office formats ending with extensions such as
 .docx and .xlsx are zip files of directories of text files (XML) and images.
  Tried-and-true Java libraries for writing the old binary Microsoft Word and
 Excel formats aren't yet supported on Google App Engine, so I was glad to
 get this working since it was a required feature for our application.

 My modified code for the zipDir and addDir methods is below.  As you can
 see, I'm closing the ZipOutputStream rather than the OutputStream:


 + + + + + + + + + + + + + + + + + + + +


 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;

 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileSystemManager;
 import org.apache.commons.vfs.FileType;

 public class FileObjectHelper {

  public static FileObject createFolder(FileSystemManager fsManager, String
 absolutePath) throws FileSystemException {
  FileObject theFolder = fsManager.resolveFile( absolutePath );
  if ( theFolder.exists() == false) {
  theFolder.createFolder();
  }
  return theFolder;
  }

  public static FileObject createFile(FileSystemManager fsManager, String
 absolutePath) throws FileSystemException {
  FileObject theFile = fsManager.resolveFile( absolutePath );
  if ( theFile.exists() == false) {
  theFile.createFile();
  }
  return theFile;
  }

  public static void zipDir(FileObject docxZipFile, FileObject
 directoryToZip) throws IOException {
  OutputStream out = docxZipFile.getContent().getOutputStream();
  ZipOutputStream zout = new ZipOutputStream(out);
  addDir(directoryToZip, zout, );
  zout.close(); // make sure you close the ZipOutputStream, not the
 OutputStream!
  }

  public static void addDir(FileObject dirObj, ZipOutputStream zout, String
 basePathSoFar) throws IOException {
  FileObject[] files = dirObj.getChildren();
  byte[] tmpBuf = new byte[1024];

  for (int i = 0; i  files.length; i++) {
  FileObject currentFile = files[i];
  String currentFileBaseName = currentFile.getName().getBaseName();

  if (currentFile.getType().equals(FileType.FOLDER)) {
  addDir(currentFile, zout, basePathSoFar + currentFileBaseName + /);

  } else { // else it's a file, not a directory
  BufferedInputStream bis = new
 BufferedInputStream(currentFile.getContent().getInputStream());
  zout.putNextEntry(new ZipEntry(basePathSoFar + currentFileBaseName));
  int len;
  while ((len = bis.read(tmpBuf)) != -1) {
  zout.write(tmpBuf, 0, len);
  }
  zout.closeEntry();
  bis.close();
  } // end if
  } // end for loop
  } // end addDir
 }


 + + + + + + + + + + + + + + + + + + + +





 Happy New Year,
 Stephen Huey




 On Tue, Dec 15, 2009 at 1:54 AM, Stephen Huey stephen.h...@gmail.comwrote:

 I'm using GaeVFS which is based on Commons VFS, and I feel that my question
 is probably more relevant to Commons VFS than the Google App Engine layer on
 top of it.  My goal is to construct valid zip files on Google App Engine,
 and I successfully used GaeVFS to create zip files that Mac OS X can open
 and that Winzip on Windows can open, but Windows XP Compressed Folders
 refused to acknowledge files in subdirectories in the zip until I removed
 the leading forward slash from a ZipEntry whose name began with a
 directory.

 For example, the following basic class successfully generates a zip file
 containing a file in a subdirectory that Windows XP Compressed Folders will
 open:


 import java.util.zip.*;
 import java.io.*;
 public class ZipThis {
   public static void main(String args[]) throws IOException {
     if (args.length  1) {
       System.err.println(usage: java ZipThis Zip.zip);
       System.exit(-1);
     }
     File zipFile = new File(args[0]);
     if (zipFile.exists()) {
       System.err.println(Zip file already exists, please try another);
       System.exit(-2);
     }
     FileOutputStream fos = new FileOutputStream(zipFile);
     ZipOutputStream zos = new ZipOutputStream(fos);
     int bytesRead;
     String[] files = new String[] {D:/stylessub/styles.xml,
 D:/document.xml};
     String[] entryName = new String[] {stylessub/styles.xml,
 document.xml};
     byte[] buffer = new byte[1024];
     for (int i=0, n=files.length; i  n; i++) {
       String name = files[i];
       File file = 

Re: Windows XP Compressed Folders doesn't recognize my VFS-based zip file

2010-01-05 Thread Stephen Huey
Apache POI is currently labeled as Incompatible on Google App Engine:

http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine

This post explains that awt references and maybe other similar issues are
the problem:
https://issues.apache.org/bugzilla/show_bug.cgi?id=47497

I'm not familiar with the separate module for xlsx and docx, so perhaps it
would run on GAE if it can be used independently of the modules that use
libraries not currently supported on GAE.  I'd be interested in knowing if
that's the case!

Thanks so much,
Stephen



On Tue, Jan 5, 2010 at 6:00 PM, Mark Fortner phidia...@gmail.com wrote:

 Hi Stephen,

 Thanks for posting this. I read your blog entry as well. You mention
 in passing that POI doesn't support the new formats. There's a
 separate module that is supposed to support xlsx and docx formats. I
 was able to use them in the past. Was there some particular gotcha
 that people should keep an eye out for?

 Regards,

 Mark

 On Tuesday, January 5, 2010, Stephen Huey stephen.h...@gmail.com wrote:
  For posterity's sake, I meant to come back here and post the solution a
  while ago.  I've got the full story here in this blog post:
 
  http://stephenhuey.wordpress.com/2010/01/01/docxgae/
 
  The relatively new Microsoft Office formats ending with extensions such
 as
  .docx and .xlsx are zip files of directories of text files (XML) and
 images.
   Tried-and-true Java libraries for writing the old binary Microsoft Word
 and
  Excel formats aren't yet supported on Google App Engine, so I was glad to
  get this working since it was a required feature for our application.
 
  My modified code for the zipDir and addDir methods is below.  As you can
  see, I'm closing the ZipOutputStream rather than the OutputStream:
 
 
  + + + + + + + + + + + + + + + + + + + +
 
 
  import java.io.BufferedInputStream;
  import java.io.IOException;
  import java.io.OutputStream;
  import java.util.zip.ZipEntry;
  import java.util.zip.ZipOutputStream;
 
  import org.apache.commons.vfs.FileObject;
  import org.apache.commons.vfs.FileSystemException;
  import org.apache.commons.vfs.FileSystemManager;
  import org.apache.commons.vfs.FileType;
 
  public class FileObjectHelper {
 
   public static FileObject createFolder(FileSystemManager fsManager,
 String
  absolutePath) throws FileSystemException {
   FileObject theFolder = fsManager.resolveFile( absolutePath );
   if ( theFolder.exists() == false) {
   theFolder.createFolder();
   }
   return theFolder;
   }
 
   public static FileObject createFile(FileSystemManager fsManager, String
  absolutePath) throws FileSystemException {
   FileObject theFile = fsManager.resolveFile( absolutePath );
   if ( theFile.exists() == false) {
   theFile.createFile();
   }
   return theFile;
   }
 
   public static void zipDir(FileObject docxZipFile, FileObject
  directoryToZip) throws IOException {
   OutputStream out = docxZipFile.getContent().getOutputStream();
   ZipOutputStream zout = new ZipOutputStream(out);
   addDir(directoryToZip, zout, );
   zout.close(); // make sure you close the ZipOutputStream, not the
  OutputStream!
   }
 
   public static void addDir(FileObject dirObj, ZipOutputStream zout,
 String
  basePathSoFar) throws IOException {
   FileObject[] files = dirObj.getChildren();
   byte[] tmpBuf = new byte[1024];
 
   for (int i = 0; i  files.length; i++) {
   FileObject currentFile = files[i];
   String currentFileBaseName = currentFile.getName().getBaseName();
 
   if (currentFile.getType().equals(FileType.FOLDER)) {
   addDir(currentFile, zout, basePathSoFar + currentFileBaseName + /);
 
   } else { // else it's a file, not a directory
   BufferedInputStream bis = new
  BufferedInputStream(currentFile.getContent().getInputStream());
   zout.putNextEntry(new ZipEntry(basePathSoFar + currentFileBaseName));
   int len;
   while ((len = bis.read(tmpBuf)) != -1) {
   zout.write(tmpBuf, 0, len);
   }
   zout.closeEntry();
   bis.close();
   } // end if
   } // end for loop
   } // end addDir
  }
 
 
  + + + + + + + + + + + + + + + + + + + +
 
 
 
 
 
  Happy New Year,
  Stephen Huey
 
 
 
 
  On Tue, Dec 15, 2009 at 1:54 AM, Stephen Huey stephen.h...@gmail.com
 wrote:
 
  I'm using GaeVFS which is based on Commons VFS, and I feel that my
 question
  is probably more relevant to Commons VFS than the Google App Engine
 layer on
  top of it.  My goal is to construct valid zip files on Google App
 Engine,
  and I successfully used GaeVFS to create zip files that Mac OS X can
 open
  and that Winzip on Windows can open, but Windows XP Compressed Folders
  refused to acknowledge files in subdirectories in the zip until I
 removed
  the leading forward slash from a ZipEntry whose name began with a
  directory.
 
  For example, the following basic class successfully generates a zip file
  containing a file in a subdirectory that Windows XP Compressed Folders
 will
  open:
 
 
  import java.util.zip.*;
  import java.io.*;
  public class 

Re: Commons Configuration for i18n

2010-01-05 Thread Ralph Goers
Funny you should ask.  This is on my list of things to do and I have a meeting 
on my calendar for later in the week to discuss this for one of our projects.

Basically, Commons Configuration provides a great foundation because of the way 
it can interpolate variables. Typical I18N implementations allow variable 
replacement, but only with values provided by the application, not with values 
defined in other keys.  In my use case we need to use tiering so that a 
default file can reference values specified for a particular client.  To do 
this the normal search algorithm has to change. java.util.ResourceBundle 
describes the search algorithm as:

baseName + _ + language1 + _ + country1 + _ + variant1
baseName + _ + language1 + _ + country1
baseName + _ + language1
baseName

In my case we need it to be

clientDir/baseName + _ + language1 + _ + country1 + _ + variant1
defaultDir/baseName + _ + language1 + _ + country1 + _ + variant1
clientDir/baseName + _ + language1 + _ + country1
defaultDir/baseName + _ + language1 + _ + country1
clientDir/baseName + _ + language1
defaultDir/baseName + _ + language1
clientDir/baseName
defaultDir/baseName

Since the bundles would all leverage the XML properties file format (because 
XML can specify the encoding while normal property files cannot) I was 
thinking of doing this by creating a factory class that returns a wrapper 
around a DynamicCompositeConfiguration (a new class that would be similar to 
DynamicCombinedConfiguration) with only the methods appropriate for I18N 
messages and then building adapters for GWT, Spring, etc. A dynamic 
configuration is needed so that the correct locale and client dir(s) are used 
on each request. I wouldn't want to use a CombinedConfiguration for this 
because message files can get to be quite large and because each instance 
includes all the data memory usage could get out of hand

Ralph

On Jan 5, 2010, at 10:51 AM, Yogesh Rao wrote:

 Hi,
 
 I need to know if anyone has used configuration for internationalization 
 purposes. Any pointers on how this has been achieved would be great. The two 
 source where i think i would like to have this data configured would either 
 be properties or database.
 
 Thanks in advance.
 
 
 
 
 Information transmitted by this e-mail is proprietary to MphasiS, its 
 associated companies and/ or its customers and is intended 
 for use only by the individual or entity to which it is addressed, and may 
 contain information that is privileged, confidential or 
 exempt from disclosure under applicable law. If you are not the intended 
 recipient or it appears that this mail has been forwarded 
 to you without proper authority, you are notified that any use or 
 dissemination of this information in any manner is strictly 
 prohibited. In such cases, please notify us immediately at 
 mailmas...@mphasis.com and delete this mail from your records.



Re: Windows XP Compressed Folders doesn't recognize my VFS-based zip file

2010-01-05 Thread Mark Fortner
Hi Stephen,
Here's a link to the POI Components page.
http://poi.apache.org/overview.html#components
If I remember correctly you need to add the poi-ooxml maven artifact to your
build.

There are some examples Here :
http://poi.apache.org/spreadsheet/examples.html

I'm not sure that this fixes the problem that GAE has with the AWT API.  The
main complaint in the bug report had to do with the usage of the Color
class, which may be used in a number of places to get or set the cell color.

The API was donated to the POI project, but started out as the OpenXML4j
project on sourceforge. https://sourceforge.net/projects/openxml4j/

That version may not have any POI dependencies and may suit your needs
better.

Mark


On Tue, Jan 5, 2010 at 4:28 PM, Stephen Huey stephenh...@gmail.com wrote:

 Apache POI is currently labeled as Incompatible on Google App Engine:


 http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine

 This post explains that awt references and maybe other similar issues are
 the problem:
 https://issues.apache.org/bugzilla/show_bug.cgi?id=47497

 I'm not familiar with the separate module for xlsx and docx, so perhaps it
 would run on GAE if it can be used independently of the modules that use
 libraries not currently supported on GAE.  I'd be interested in knowing if
 that's the case!

 Thanks so much,
 Stephen



 On Tue, Jan 5, 2010 at 6:00 PM, Mark Fortner phidia...@gmail.com wrote:

  Hi Stephen,
 
  Thanks for posting this. I read your blog entry as well. You mention
  in passing that POI doesn't support the new formats. There's a
  separate module that is supposed to support xlsx and docx formats. I
  was able to use them in the past. Was there some particular gotcha
  that people should keep an eye out for?
 
  Regards,
 
  Mark
 
  On Tuesday, January 5, 2010, Stephen Huey stephen.h...@gmail.com
 wrote:
   For posterity's sake, I meant to come back here and post the solution a
   while ago.  I've got the full story here in this blog post:
  
   http://stephenhuey.wordpress.com/2010/01/01/docxgae/
  
   The relatively new Microsoft Office formats ending with extensions such
  as
   .docx and .xlsx are zip files of directories of text files (XML) and
  images.
Tried-and-true Java libraries for writing the old binary Microsoft
 Word
  and
   Excel formats aren't yet supported on Google App Engine, so I was glad
 to
   get this working since it was a required feature for our application.
  
   My modified code for the zipDir and addDir methods is below.  As you
 can
   see, I'm closing the ZipOutputStream rather than the OutputStream:
  
  
   + + + + + + + + + + + + + + + + + + + +
  
  
   import java.io.BufferedInputStream;
   import java.io.IOException;
   import java.io.OutputStream;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipOutputStream;
  
   import org.apache.commons.vfs.FileObject;
   import org.apache.commons.vfs.FileSystemException;
   import org.apache.commons.vfs.FileSystemManager;
   import org.apache.commons.vfs.FileType;
  
   public class FileObjectHelper {
  
public static FileObject createFolder(FileSystemManager fsManager,
  String
   absolutePath) throws FileSystemException {
FileObject theFolder = fsManager.resolveFile( absolutePath );
if ( theFolder.exists() == false) {
theFolder.createFolder();
}
return theFolder;
}
  
public static FileObject createFile(FileSystemManager fsManager,
 String
   absolutePath) throws FileSystemException {
FileObject theFile = fsManager.resolveFile( absolutePath );
if ( theFile.exists() == false) {
theFile.createFile();
}
return theFile;
}
  
public static void zipDir(FileObject docxZipFile, FileObject
   directoryToZip) throws IOException {
OutputStream out = docxZipFile.getContent().getOutputStream();
ZipOutputStream zout = new ZipOutputStream(out);
addDir(directoryToZip, zout, );
zout.close(); // make sure you close the ZipOutputStream, not the
   OutputStream!
}
  
public static void addDir(FileObject dirObj, ZipOutputStream zout,
  String
   basePathSoFar) throws IOException {
FileObject[] files = dirObj.getChildren();
byte[] tmpBuf = new byte[1024];
  
for (int i = 0; i  files.length; i++) {
FileObject currentFile = files[i];
String currentFileBaseName = currentFile.getName().getBaseName();
  
if (currentFile.getType().equals(FileType.FOLDER)) {
addDir(currentFile, zout, basePathSoFar + currentFileBaseName + /);
  
} else { // else it's a file, not a directory
BufferedInputStream bis = new
   BufferedInputStream(currentFile.getContent().getInputStream());
zout.putNextEntry(new ZipEntry(basePathSoFar + currentFileBaseName));
int len;
while ((len = bis.read(tmpBuf)) != -1) {
zout.write(tmpBuf, 0, len);
}
zout.closeEntry();
bis.close();
} // end if
} // end for loop
} // end addDir
   }
  
  
   + + + + + + + + + + + + + + + 

Re: Windows XP Compressed Folders doesn't recognize my VFS-based zip file

2010-01-05 Thread Stephen Huey
That might work with some source code modifications.  I remember digging
through a bit of the Java example code here and realizing there were
scattered references to the File class:

http://openxmldeveloper.org/archive/category/1008.aspx

GAE does not provide access to a file system, but GaeVFS would probably fix
that issue with regard to the OpenXML4J code if I went into its source and
edited references to that.  However, I'd imagine there would still be
dependencies on unsupported libraries such as graphics for manipulating rich
text even though the resulting files are just XML.  We don't have to change
the design of our Word and Excel reports very much, so it's not too much
work for us if we just manually create a template by typing up something
pretty in each Microsoft Office application and then take that file and
replace pieces of it with our dynamic data.  Yes, we're writing from scratch
some code that POI already handles, but we already know our way works and
the requirements are fairly minimal and static, so it doesn't seem
worthwhile at this point to adapt POI to Google App Engine.

That doesn't mean I don't wish it worked on there!  I'd be interested in
hearing that it actually wouldn't be too difficult since all those classes
are already written...

Thanks,
Stephen



On Tue, Jan 5, 2010 at 8:05 PM, Mark Fortner phidia...@gmail.com wrote:

 Hi Stephen,
 Here's a link to the POI Components page.
 http://poi.apache.org/overview.html#components
 If I remember correctly you need to add the poi-ooxml maven artifact to
 your
 build.

 There are some examples Here :
 http://poi.apache.org/spreadsheet/examples.html

 I'm not sure that this fixes the problem that GAE has with the AWT API.
  The
 main complaint in the bug report had to do with the usage of the Color
 class, which may be used in a number of places to get or set the cell
 color.

 The API was donated to the POI project, but started out as the OpenXML4j
 project on sourceforge. https://sourceforge.net/projects/openxml4j/

 That version may not have any POI dependencies and may suit your needs
 better.

 Mark


 On Tue, Jan 5, 2010 at 4:28 PM, Stephen Huey stephenh...@gmail.com
 wrote:

  Apache POI is currently labeled as Incompatible on Google App Engine:
 
 
 
 http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine
 
  This post explains that awt references and maybe other similar issues are
  the problem:
  https://issues.apache.org/bugzilla/show_bug.cgi?id=47497
 
  I'm not familiar with the separate module for xlsx and docx, so perhaps
 it
  would run on GAE if it can be used independently of the modules that use
  libraries not currently supported on GAE.  I'd be interested in knowing
 if
  that's the case!
 
  Thanks so much,
  Stephen
 
 
 
  On Tue, Jan 5, 2010 at 6:00 PM, Mark Fortner phidia...@gmail.com
 wrote:
 
   Hi Stephen,
  
   Thanks for posting this. I read your blog entry as well. You mention
   in passing that POI doesn't support the new formats. There's a
   separate module that is supposed to support xlsx and docx formats. I
   was able to use them in the past. Was there some particular gotcha
   that people should keep an eye out for?
  
   Regards,
  
   Mark
  
   On Tuesday, January 5, 2010, Stephen Huey stephen.h...@gmail.com
  wrote:
For posterity's sake, I meant to come back here and post the solution
 a
while ago.  I've got the full story here in this blog post:
   
http://stephenhuey.wordpress.com/2010/01/01/docxgae/
   
The relatively new Microsoft Office formats ending with extensions
 such
   as
.docx and .xlsx are zip files of directories of text files (XML) and
   images.
 Tried-and-true Java libraries for writing the old binary Microsoft
  Word
   and
Excel formats aren't yet supported on Google App Engine, so I was
 glad
  to
get this working since it was a required feature for our application.
   
My modified code for the zipDir and addDir methods is below.  As you
  can
see, I'm closing the ZipOutputStream rather than the OutputStream:
   
   
+ + + + + + + + + + + + + + + + + + + +
   
   
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
   
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.FileType;
   
public class FileObjectHelper {
   
 public static FileObject createFolder(FileSystemManager fsManager,
   String
absolutePath) throws FileSystemException {
 FileObject theFolder = fsManager.resolveFile( absolutePath );
 if ( theFolder.exists() == false) {
 theFolder.createFolder();
 }
 return theFolder;
 }
   
 public static FileObject createFile(FileSystemManager fsManager,
  String
absolutePath) throws