1 /* 2 * Copyright (C) 2012 The Libphonenumber Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.i18n.phonenumbers.buildtools; 18 19 import com.google.i18n.phonenumbers.Command; 20 21 import java.io.File; 22 import java.io.IOException; 23 import java.util.logging.Level; 24 import java.util.logging.Logger; 25 26 /** 27 * Entry point class used to invoke the generation of the binary time zone data files. 28 * 29 * @author Walter Erquinigo 30 * @author Philippe Liard 31 */ 32 public class GenerateTimeZonesMapDataEntryPoint extends Command { 33 private static final Logger logger = Logger.getLogger(GenerateTimeZonesMapData.class.getName()); 34 35 @Override getCommandName()36 public String getCommandName() { 37 return "GenerateTimeZonesMapData"; 38 } 39 40 @Override start()41 public boolean start() { 42 String[] args = getArgs(); 43 44 if (args.length != 3) { 45 logger.log(Level.SEVERE, 46 "usage: GenerateTimeZonesMapData /path/to/input/text_file " 47 + "/path/to/output/directory"); 48 return false; 49 } 50 try { 51 GenerateTimeZonesMapData generateTimeZonesMapData = new GenerateTimeZonesMapData( 52 new File(args[1]), new PhonePrefixDataIOHandler(new File(args[2]))); 53 generateTimeZonesMapData.run(); 54 } catch (IOException e) { 55 logger.log(Level.SEVERE, e.getMessage()); 56 return false; 57 } 58 return true; 59 } 60 } 61