oozie java api
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Properties;
public class GenerateLookupDirs {
/**
* @param args
*/
public static final long dayMillis = 1000 * 60 * 60 * 24;
private static final String OOZIE_ACTION_OUTPUT_PROPERTIES = "oozie.action.output.properties";
public static void main(String[] args) throws Exception {
Calendar curDate = new GregorianCalendar();
int year, month, date;
String propKey, propVal;
String oozieProp = System.getProperty(OOZIE_ACTION_OUTPUT_PROPERTIES);
if (oozieProp != null) {
File propFile = new File(oozieProp);
Properties props = new Properties();
for (int i = 0; I < 8; ++i) {
year = curDate.get(Calendar.YEAR);
month = curDate.get(Calendar.MONTH) + 1;
date = curDate.get(Calendar.DATE);
propKey = "dir"+i;
propVal = year + "-" +
(month < 10 ? "0" + month : month) + "-" +
(date < 10 ? "0" + date : date);
props.setProperty(propKey, propVal);
curDate.setTimeInMillis(curDate.getTimeInMillis() - dayMillis);
}
OutputStream os = new FileOutputStream(propFile);
props.store(os, "");
os.close();
} else
throw new RuntimeException(OOZIE_ACTION_OUTPUT_PROPERTIES
+ " System property not defined");
}
}
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Properties;
public class GenerateLookupDirs {
/**
* @param args
*/
public static final long dayMillis = 1000 * 60 * 60 * 24;
private static final String OOZIE_ACTION_OUTPUT_PROPERTIES = "oozie.action.output.properties";
public static void main(String[] args) throws Exception {
Calendar curDate = new GregorianCalendar();
int year, month, date;
String propKey, propVal;
String oozieProp = System.getProperty(OOZIE_ACTION_OUTPUT_PROPERTIES);
if (oozieProp != null) {
File propFile = new File(oozieProp);
Properties props = new Properties();
for (int i = 0; I < 8; ++i) {
year = curDate.get(Calendar.YEAR);
month = curDate.get(Calendar.MONTH) + 1;
date = curDate.get(Calendar.DATE);
propKey = "dir"+i;
propVal = year + "-" +
(month < 10 ? "0" + month : month) + "-" +
(date < 10 ? "0" + date : date);
props.setProperty(propKey, propVal);
curDate.setTimeInMillis(curDate.getTimeInMillis() - dayMillis);
}
OutputStream os = new FileOutputStream(propFile);
props.store(os, "");
os.close();
} else
throw new RuntimeException(OOZIE_ACTION_OUTPUT_PROPERTIES
+ " System property not defined");
}
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29754888/viewspace-1256485/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Apache Oozie 教程:使用 Oozie 排程 Hadoop 作業ApacheHadoop
- Oozie--安裝部署
- Apache Oozie學習筆記(一)Apache筆記
- oozie web頁面訪問To enable Oozie web console install the Ext JS libraryWebJS
- 工作流引擎Oozie(二):coordinator
- ElasticSearch—— Java APIElasticsearchJavaAPI
- java常用APIJavaAPI
- ElasticSearch Java APIElasticsearchJavaAPI
- Java 反射 APIJava反射API
- Java 日期 APIJavaAPI
- Maven-3.3.9 Install and Oozie-4.3.0 CompileMavenCompile
- 高可用Hadoop平臺-Oozie工作流Hadoop
- ElasticSearch Java API使用ElasticsearchJavaAPI
- Java之常用APIJavaAPI
- EasyExcel Java API 使用ExcelJavaAPI
- Zookeeper--Java APIJavaAPI
- Elastic Search Java ApiASTJavaAPI
- ZooKeeper 使用 Java APIJavaAPI
- Java Date API demoJavaAPI
- JAVA EE 中文APIJavaAPI
- Java API操作ESJavaAPI
- Java -fastjson apiJavaASTJSONAPI
- 使用 Java 持久化 APIJava持久化API
- 第6章 Java APIJavaAPI
- java api使用ElastichSearch指南JavaAPIAST
- 使用 Java API 操作 elasticsearchJavaAPIElasticsearch
- java8-Optional APIJavaAPI
- java常用Api總結JavaAPI
- java API 幫助文件JavaAPI
- JAVA核心API學習JavaAPI
- java的runtime APIJavaAPI
- [原始碼解析]Oozie來龍去脈之提交任務原始碼
- Java 8 Stream API 轉換到 Kotlin 集合APIJavaAPIKotlin
- java反射中有哪些APIJava反射API
- Java012-APIJavaAPI
- java內省api的操作JavaAPI
- Java 11字串API有更新Java字串API
- Java 8 常用時間 apiJavaAPI