Case Studies

How to use ant tasks.

acorn3-extras-x.x.x.jar has some ant tasks which help to do continuous integration. In your build.xml, you can use them as followings.

<taskdef name="collect-libs" classname="jp.co.lumber_mill.ant.CollectLibrariesTask" />
<collect-libs todir="dist/lib"/>

How to use ReleaseNotes frameworks.

Including in acorn3-commons. It provides unified Release Note writing method. First, you write your app's release note in an XML file as followings(If you want to know details, see the DTD).

/res/release-notes.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE release-notes SYSTEM "http://lumber-mill.co.jp/dtds/release-notes-1.1.dtd">
<release-notes version="1.1">
  <information>
    <appname>myapp</appname>
    <vendor>lumber-mill.co.jp</vendor>
    <base-url></base-url>
  </information>
  <releases major_version="1.0">
    <release minor_version="00" date="2011.03.22">
      <item>Initial revision.</item>
    </release>
  </releases>
  <roadmap major_version="2.0" date="2011.11.11">
  </roadmap>
</release-notes>

And then, create new class that extends AbstractReleaseNotes class. Override getResource method to determine release note's entity.

public class ReleaseNotes extends AbstractReleaseNotes {

  @Override
  protected URL getResource() {
    return getClass().getResource("/res/release-notes.xml");
  }
}

Now, You can access various version information via this release note.

  String v = new ReleaseNotes().getCurrentMajorVersion();
  System.out.println(v); // 1.0

How to use Csv class.

commons.Csv class helps you to save and load data as csv format file.
  String title[] = {"A","B","C","D","E","F"};
  int keys[] = {0,1,2};
  String row1[] = {"22","1234567890","2011/07/22","1","2","3"};
  String row2[] = {"22","1234567890","2011/07/24","4","5","6"};
  String row1u[] = {"22","1234567890","2011/07/22","7","8","9"};
  
  File f = new File("temp/csvtest.csv");
  Csv csv = new Csv(title,keys,f,Charset.forName("utf8"));

  csv.setTitle(title);

  csv.put(row1); // Insert.
  csv.put(row2); // Insert.
  csv.put(row1u); // Update.

  csv.close();
  File f = new File("temp/csvtest.csv");
  Csv csv = new Csv(title,keys,f,Charset.forName("utf8"));
  if(csv.exists()){
    int nRow = csv.getRowCount(); // 2
    int nColumn = csv.getColumnCount(); // 6
    String row[]; 
    row = csv.getTitle(); // A,B,C,D,E,F
    row = csv.get(new String[]{"22","1234567890","2011/07/22"}); // Equals to row1u.
    row = csv.get(new String[]{"xx","1234567890","2011/07/22"}); // null
  }
  // If you don't make any changes, need not to close.
Managed by LumberMill, Inc.