[jboss-svn-commits] JBL Code SVN: r8062 - labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 5 06:04:00 EST 2006
Author: noel.rocher at jboss.com
Date: 2006-12-05 06:03:58 -0500 (Tue, 05 Dec 2006)
New Revision: 8062
Added:
labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/CopyPDFToDirEveryNmin.java
Modified:
labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/SendPDFByMail.java
Log:
Added: labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/CopyPDFToDirEveryNmin.java
===================================================================
--- labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/CopyPDFToDirEveryNmin.java 2006-12-05 11:03:25 UTC (rev 8061)
+++ labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/CopyPDFToDirEveryNmin.java 2006-12-05 11:03:58 UTC (rev 8062)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.reporting.client;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.jboss.reporting.api.Report;
+import org.jboss.reporting.api.ReportTask;
+import org.jboss.reporting.api.distribute.DistributeByMail;
+import org.jboss.reporting.api.impl.ReportTaskFactory;
+
+/**
+ * A simple example that is copying the report result into a directory. The report is
+ * executed every N minutes.
+ * Default are used for PDF output.
+ *
+ * @author noel
+ */
+public class CopyPDFToDirEveryNmin
+{
+
+ /**
+ * arg[0] = report name to launch (the name used by reporting-services. For ex: reports/MyReport)
+ * arg[1] = directory name where results are to be copied
+ * arg[2] = number of minute for the periode
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ if (args.length != 3)
+ {
+ System.out.println("usage : java CopyPDFToDirEveryNmin arg0 arg1 arg2 \n" +
+ "\twith:\n" +
+ "\targ0 = report name to launch (the name used by reporting-services. For ex: reports/MyReport)\n" +
+ "\targ1 = directory name where results are to be copied\n" +
+ "\targ2 = number of minute for the periode" );
+ }
+ else
+ {
+ process(args[0], args[1], args[2]);
+ }
+
+ }
+
+
+
+ public static void process(String in_reportName, String in_directoryName, int in_numberOfMinute)
+ {
+ try
+ {
+ ReportTask rt = ReportTaskFactory.getInstance();
+ Report r = new Report(in_reportName);
+ rt.setReport( r );
+ rt.setDistribute(new DistributeByFileCopy(in_directoryName));
+ rt.setSchedule(new SchedulePeriodic(Calendar.getInstance(),in_numberOfMinute, SchedulePeriodic.PERIODE_UNIT_MINUTE));
+
+ rt.submit();
+
+ } catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
Modified: labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/SendPDFByMail.java
===================================================================
--- labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/SendPDFByMail.java 2006-12-05 11:03:25 UTC (rev 8061)
+++ labs/reportingservices/trunk/dev/modules/client/impl/src/main/java/org/jboss/reporting/client/SendPDFByMail.java 2006-12-05 11:03:58 UTC (rev 8062)
@@ -26,7 +26,7 @@
{
/**
- * arg[0] = report name to launch (the name used by reporting-services. For ex: /reports/MyReport)
+ * arg[0] = report name to launch (the name used by reporting-services. For ex: reports/MyReport)
* arg[1] = email address for sent from
* arg[2] = email address for send to
* @param args
@@ -37,10 +37,10 @@
{
System.out.println("usage : java SendPDFByMail arg0 arg1 arg2 \n" +
"\twith:\n" +
- "\targ0 = report name to launch (the name used by reporting-services. For ex: /reports/MyReport)\n" +
+ "\targ0 = report name to launch (the name used by reporting-services. For ex: reports/MyReport)\n" +
"\targ1 = email address for sent from\n" +
"\targ2 = email address for send to" +
- "\n\n Note : Don't forget to set up the mail server in your JBoss AS.");
+ "\n\n Note : Don't forget to set up the mail service in your JBoss AS.");
}
else
{
More information about the jboss-svn-commits
mailing list