KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyBuild > maintversion2props


1 /*
2
3    Derby - Class org.apache.derbyBuild.classlister
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derbyBuild;
23
24 import java.io.*;
25 import java.util.*;
26
27 /**
28
29     A quick and dirty class for generating a properties file from the maint
30     property in DBMS.properties and release.properties. Useful for getting
31     the values of the third and fourth parts of the version number into Ant
32     as separate properties. It puts the third value into the output properties
33     as the property "interim", and the fourth value as "point".
34
35     Usage: java maintversion2props input_properties_file output_properties_file
36
37 **/

38     
39 public class maintversion2props
40 {
41     public static void main(String JavaDoc[] args) throws Exception JavaDoc
42     {
43         InputStream is = new FileInputStream(args[0]);
44         Properties p = new Properties();
45         p.load(is);
46     String JavaDoc maint = "";
47         if (args[0].indexOf("DBMS") > 0)
48         {
49           maint = p.getProperty("derby.version.maint");
50         } else if (args[0].indexOf("release") > 0)
51         {
52           maint = p.getProperty("maint");
53         }
54         Properties p2 = new Properties();
55         p2.setProperty("interim", Integer.toString(Integer.parseInt(maint) / 1000000));
56         p2.setProperty("point", Integer.toString(Integer.parseInt(maint) % 1000000));
57         OutputStream os = new FileOutputStream(args[1]);
58         p2.store(os, "");
59     }
60 }
61
Popular Tags