Push Data using Java

Hi All,
I want to write a program which keeps a look at a particular folder and when ever there is a update or a new file added in the folder it should push that file automatically to a file server using ftp. if any one has the code to do similar kind of thing please pass it to me. i am a novice in java!! Thanks in advance

Hi All,
I want to write a program which keeps a look at a
particular folder and when ever there is a update or
a new file added in the folder it should push that
file automatically to a file server using ftp.This is a relatively trivial program to write, but is there a reason you're wanting to do this in Java, and not with - say - a cron job and a shell script?
if any one has the code to do similar kind of thing please
pass it to me. i am a novice in java!! If you're a novice, I recommend you start with something even simpler. Check out the tutorials on this site, and get some practice before you start writing network applications.
Thanks in advanceIf you insist on writing this yourself in Java, look at the java.io.* package and the Timer class. You should also consider using the Jakarta Commons net packages in order to make life MUCH easier when it comes to FTP.

Similar Messages

  • How to get the context data using java script in interactive forms

    Hi All,
    How to get the context data using java script in interactive forms by adobe,  am using web dynpro java
    thanks.

    Hi venkat,
    Please Refer this link.
      Populating one Drop-Down list from the selection of another Drop-down list
    Thanks,
    Raju.

  • How to convert MS SQL Server data to XML data using Java

    Hi all!
    How do I generate XML document for SQL Server data using java / jsp.
    Thanks in advance

    http://www.fdsapi.com

  • Updating spatial data USING JAVA

    I want to update spatial data using java.Does anyone know how can i do this;;;
    for example i have created the following table.
    CREATE TABLE customers (
    customer_id NUMBER,
    last_name VARCHAR2(30),
    first_name VARCHAR2(30),
    street_address VARCHAR2(40),
    city VARCHAR2(30),
    state_province_code VARCHAR2(2),
    postal_code VARCHAR2(9),
    cust_geo_location SDO_GEOMETRY);
    HOW CAN I UPDATE THE FIELD:cust_geo_location,
    WHICH TYPE IS: SDO_GEOMETRY;;;;;
    I wrote a programm in java, which updates the FIELD CUSTOMER_ID.
    ( rset.absolute(3);
    rset.updateInt("CUSTOMER_ID",2222 );
    CUSTOMER_ID = rset.getInt("CUSTOMER_ID");
    rset.next();
    rset.updateRow(); ).
    ---------- THE FULL JAVA PROGRAMM
    import java.sql.*;
    import java.io.*;
    import java.util.Date;
    public class update{
    public static void main (String args [])
    throws SQLException, IOException
    System.out.println ("Loading Oracle driver");
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    catch (ClassNotFoundException e)
    System.out.println ("Could not load the driver");
    e.printStackTrace ();
    System.out.println ("Connecting to the local database");
    try{
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE", "sp", "spgianna");
    Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    // String LAST_NAME,FIRST_NAME ;
    int CUSTOMER_ID ;
    ResultSet rset = stmt.executeQuery("SELECT CUSTOMER_ID FROM CUSTOMERS");
    /* while ( rset.next() ) {
    CUSTOMER_ID = rset.getInt("CUSTOMER_ID");
    LAST_NAME = rset.getString("LAST_NAME");
    FIRST_NAME = rset.getString("FIRST_NAME");
    System.out.println( CUSTOMER_ID+""+LAST_NAME + " " +FIRST_NAME);
    rset.absolute(3);
    rset.updateInt("CUSTOMER_ID",2222 );
    CUSTOMER_ID = rset.getInt("CUSTOMER_ID");
    rset.next();
    rset.updateRow();
    System.out.println(CUSTOMER_ID);
    catch(SQLException sqle) {
    System.out.println("SQL Exception encountered: " );
    } catch(Exception e) {
    System.out.println("Unexpected Exception: " );
    HOW CAN I UPDATE THE FIELD:cust_geo_location,
    WHICH TYPE IS: SDO_GEOMETRY;;;;;;;;;;;;;;

    Hi Guys,
    Dont forget to close your stmt and connection after execution
    Use this as a template if you like:
    try{
         /**make connection**/
         ServerConnection sc = new ServerConnection();
    Statement stmt = sc.conn.createStatement();
    /**create statement & execute**/
    String insertstmt = "insert into .......";
    //execute
    stmt.execute(insertstmt);
    /**Close and catch exception**/
    stmt.close();
    sc.conn.close();
    catch(SQLException sqlE){
         sqlE.printStackTrace();
         System.out.println(sqlE.getMessage());
    As for the string "insertstmt" itself, this is where your standard SQL statement goes
    So get it working using a standard SQL editor first, then copy and paste it in to this string variable. The string should be a series of concatenated strings and variables to recreate the SQL atatement in Java. For example
    the SQL statement:
    insert into Mytable(SESSIONID, TIME1) values ('300', '4.45pm' );
    assuming the values are stored in variables called 'sessionnumber' and 'time'
    will become
    String stmt =
    "insert into Mytable(SESSIONID, TIME1) values ('"+sessionnumber+"', '"+time+"')";
    Hope this helps.
    E
    Ps. Do a system.out.println after you create the stmt. The statement printed out to the console should be a valid SQL statement that you can use in your editor. (minus the ;)
    ...keep working on the string until you can do this.

  • Best option to push Mass data using Java API

    Hi All,
    Can any one let me know how Java API push data to MDM? Is it a good option when ti comes to perfromance point of view? We have around 2000/5000 records to be imported every time using Java API and wondering what would be best way to acheive this using Java API?
    Is java API is best option than Web services?
    Thanks
    Rajeev

    Rajeev,
    It is perfectly fine to use API to push data into MDM, you just need to make sure that your API does all those tasks which import manager does by default. For example, it should know when to insert and when to update. if an error happens during insertion of record, you should be able to notify the users.
    Having said that, where does the number 2000/5000 comes in? will you be creating users in batch and then invoke MDM API to store these in a single shot or willl it be a delta insert/update from Java to MDM?
    Thanks
    Aamir

  • Nokia E61i Push Data using XML Cisco Objects?

    Hi:
    I have a Nokia E61 (wifi) suscribed to a Cisco Call Manager.
    Is there any posibility to Push Data to the device?, like XML Cisco Objects to IP Phone 7970.
    Could I send an SMS without use the mobile network?
    thanks in advance,
    marcelo

    Thanks for the reply. Yes, I did compile all the Java and it
    works OK with a simple Java program. It just will not work in a
    Flex application.
    The java classes are:
    RRA:
    package blah.myPackage;
    import java.util.List;
    import java.util.Collection;
    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;
    class RRA extends AbstractAssembler
    public Collection fill( List fillParameters )
    RRS service = new RRS();
    return service.getSome();
    RRS:
    package blah.myPackage;
    import java.util.ArrayList;
    import java.util.List;
    import java.sql.*;
    import flex.EORS.*;
    class RRS
    public List getSome()
    ArrayList list = new ArrayList();
    String str = "bob";
    RR rr = new RR(str);
    list.add(rr);
    return list;
    RR:
    package blah.myPackage;
    class RR
    private String name;
    public RR() { }
    public RR(String name)
    this.name = name;
    public String getName()
    return this.name;
    public void setName(String name)
    this.name = name;
    I started with something that retrieved data from a database
    but watered it down just to try and get some kind of communication
    between Flex and Java.

  • How to read azure storage data using JAVA with REST API

    Hi,
    We have a cloud service in our lab. We have enabled diagnostics
    in cloud services. So WADPerformanceCounterTable was created in storage account. Now , We want to read the WADPerformanceTable using
    JAVA with REST API. Is there any way to collect these details. please give me any
    sample code to connect azure storage using table service REST API.
    Thanks & Regards
    Rathidevi

    Hi,
    Please have a look at this article:
    https://convective.wordpress.com/2010/08/18/examples-of-the-windows-azure-storage-services-rest-api/, it demonstrate how to use table service Rest API, it also give us the code, hope this helps. Of course, the
    MSDN article could also help us coding.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to initiate a RFC fuction module from ABAP and push data to Java prgm

    I want to push the data from ABAP program to a java program, the RFC connection has to be initiated from ABAP. How can i do this.
    Kindly help me with a example program if possible.
    Thanks in advance.
    Sounder.

    Hi,
    If you are using JCo connector for the interface, then please look into this link
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    aRs

  • Problem with setting date using java 1.4.2

    Is this a bug?
    under java 1.4.2,
    executing System.out.println(new java.util.Date("01-JAN-1950")) displays
    Sun Jan 01 00:10:00 SGT 1950
    but under java 1.3.1 the same statement displays as Sun Jan 01 00:00:00 SGT 1950 which is the desired result.

    I'm just citing an example using Date().
    In fact, whether I use DateFormat or Calendar, it shows the same result.
    When I set the date to 1 Jan 1950 0 hours 0 minutes 0 seconds,
    jdk1.4.2 will always return me 1 Jan 1950 0 hours 10 minutes 0 seconds.
    It works correctly under jdk1.3.1

  • Is it possible to run Go URL SQL and return raw data using Java?

    Hi All,
    I just got GO URL SQL working in HTML, when i type the following URL on to the address bar.
    https://odsau.oraclecorp.com/analytics/saw.dll?Go&SQL=select+"MFG Serial Number"."Job Name","MFG Serial Number".Item+from+"Supply Chain Management"
    It prints out a table with all the data that query from the database in a HTML page. However, I want to be able to manipulate these data in a JAVA script.
    Is there a similar function i can use in Java script and return raw data so i can store them into a variable for data manipulation?
    Or is there a work around that someone has already done ?
    Thanks
    John Lau

    You can excute SQL statemetns throught JDBC, but that doesn't have a facility to read those statements from a file. You'd have to write code to read the file and create and execute statements through JDBC. That should be pretty straightforward though.
    It's conceivable that there's a third party library out there that does it, if you know what to look for.
    If you're not familiar with JDBC, check out http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • Displaying image from binary data using java

    hi there,
    i have created a swing applet displays me a url, what the url returns me is the image in binary format, and i want to show the complete image using that binary data
    so how do i do it.
    some thing like this :
    URL url = new URL("http://192.168.1.1:8086/file-storage/download/Zerg.jpg?version_id=35688");
    JEditorPane jep = new JEditorPane();
    jep.setPage(url);
    output is in binary on my applet window.

    Hey,
    This displays an image from a url, you could check if your url is and image or not using URL.getFileName() and see if it ends in gif jpeg etc. and then display it this way.
    hope it helps
    Nick Hanlon
    import java.awt.*;
    import java.awt.Image.*;
    import java.awt.Toolkit.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.text.html.*;
    public class SimpleApp extends JFrame {
    public static void main(String args[]) {
    SimpleApp aFrame = new SimpleApp();
    public SimpleApp() {
    super("Frame");
    /*JEditorPane jep = new JEditorPane();
    jep.*/
    try {
    HTMLEditorKit htmlKit = new HTMLEditorKit();
    JEditorPane ep = new JEditorPane();
    try {
    ep.setEditorKit(htmlKit);
    BufferedReader in = new BufferedReader(
    new StringReader(
    "<HTML><IMG SRC=\"http://developer.java.sun.com/images/chiclet.row.gif\"></HTML>"));
    htmlKit.read(in, ep.getDocument(),0);
    getContentPane().setLayout(new BorderLayout());
    setResizable(false);
    getContentPane().add(ep, "North");
    pack();
    show();
    } catch (javax.swing.text.BadLocationException e) {}
    } catch (IOException e) {}
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { System.exit(0); }
    }

  • Decompressing Data using Java from ZLIB

    hello all i really need your aid .
    we have a system that needs to be changed as soon as possible
    to receive a compress stream of data that was compressed using the
    ZLIB (a.k.a. gzip) from the http://www.zlib.net/
    and i can't manage to Decompress it
    i tried to use the
    1) java.util.zip.GZIPInputStream
    2) java.util.zip.Inflater
    3)com.jcraft.jzlib.ZInputStream
    all failed...
    does anybody can help me with ideas...

    have you tried with
    new InflaterInputStream(anInputStream, new Inflater(false));If it doesnt work, do you have a sample of the data you try to decompress?

  • Fill a pdf form with data using Java code

    Hi,
    Modern formats of Acrobat ".pdf" files allows to define form fields.
    I have a datasource, let's say in a database.
    I want to fill my ".pdf" with my database-stored data automatically, and want to write Java code for that.
    1. What is the best way to achieve this ?
    2. Is it necessary to install Acrobat Distiller server and if so what web services should I invoke ? Where is the doc ?
    3. Are there efficient Java libraries to do so ?
    Thank you for helping... As ever, this is kind of an emergency case
    Have a good day.
    Phil

    Take a look at the FDF Toolkit for Java:
    http://www.adobe.com/devnet/acrobat/fdftoolkit.html
    That will allow you to, through Java, construct an FDF that contains all your form data.  You then add a reference to your "template" PDF file in the FDF as well and send the FDF to the client.  Acrobat will open the FDF, see the reference to the PDF, open the PDF and then merge any data contained in the FDF with the PDF.

  • Accept RDF data using java code

    Hello,
    I am trying to write a java code that helps in accepting the RDF(resource description framework) data and finally output the file in csv format. Can I get some help regarding this?
    Regards

    General solution.
    1. Determine the exact format of the RDF. This has nothing to do with code.
    2. Determine the exact format of the csv. This has nothing to do with code.
    3. Write, find or buy a RDF parser.
    4. Write, find or buy a csv output routine (most likely write)
    5. Wrap 3 (RDF parser) in convienence class(es) to match what you have found in 1.
    6. Wrap 4 (csv output) in a convienence class(es) to match what you have found in 2.
    7. Write glue code that combines 5 and 6 into an application.

  • Problem sending Apple Push Notification using Java and REST.

    Hello there,
    Am using the javapns library to send an Apple Push Notification through a REST based web service...
    Here are the steps that I have completed:
    iPhone Developer Program Portal (IDPP):
    (1) Created the App ID and APNS based SSL Certificate and Keys.
    (2) Created and installed the provisioning profile.
    (3) Installed the SSL Certificate and Key on the server.
    (4) Set up my iPhone app to register for remote notifications.
    XCode:
    Was able to obtain my device token when I built and deployed my app onto my device.
    As soon as my iPhone app deployed, the dialog came up on my iPhone indicating that my app would like to send push notifications and also asked for permission to allow them.
    When I invoked my web service, through my Log4J statements, I was able to see that my REST based web service was indeed invoked but I never received a push notification on my iPhone app!
    ApnsManager class:
    public class ApnsManager {
        /** APNs Server Host **/
        private static final String HOST = "gateway.sandbox.push.apple.com";
        /** APNs Port */
        private static final int PORT = 2195;
        public void sendNotification(String deviceToken)
        throws Exception {
           try {
               PayLoad payLoad = new PayLoad();
               payLoad.addAlert("My alert message");
               payLoad.addBadge(45);
               payLoad.addSound("default");
               PushNotificationManager pushManager =
                  PushNotificationManager.getInstance();
               pushManager.addDevice("iPhone", deviceToken);
               log.warn("Initializing connectiong with APNS...");
               // Connect to APNs
               pushManager.initializeConnection(HOST, PORT,
               "/etc/Certificates.p12", "password",
               SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
               Device client = pushManager.getDevice("iPhone");
               // Send Push
               log.warn("Sending push notification...");
               pushManager.sendNotification(client, payLoad);
               pushManager.stopConnection();
           catch (Exception e) {
               e.printStackTrace("Unable to send push ");
    RESTful Web Service:
    @Path(ApnService.URL)
    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
    public class ApnService {
        public static final String URL = "/apns";
        @GET
        @Path("send")
        @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
        public String send() throws JSONException, IOException {
            String msg = "";
            try {
                log.debug("Inside ApnService.send() method.");
                log.debug("Sending notification to device");
                ApnManager.sendNotification("32b3bf28520b977ab8eec50b482
                25e14d07cd78 adb69949379609e40401d2d1de00000000738518e5c
                000000003850978c38509778000000000000000000398fe12800398f
                e2e0398fe1040000");
             } catch(Exception e ) {
                   e.printStackTrace();
                   msg = "fail";
             msg = "success";
             StringWriter sw = new StringWriter();
             JsonFactory f = new JsonFactory();
             JsonGenerator g = f.createJsonGenerator(sw);
             g.writeStartObject();
             g.writeStringField("status", msg);
             g.writeEndObject();
             g.close();
             return sw.toString();
    }Now, when I deploy my app to my app server and open up a rest client and type in:
    http: // localhost:8080/myapp/apns/send
    The rest client returns this:
    HTTP/1.1 200 OK
    The following log messages are outputted to my console:
    01:47:51,985 WARN  [ApnsManager] Initializing connectiong with APNS...
    01:47:52,318 WARN  [ApnsManager] Sending push notification... However, I don't receive the push notification on my app (residing on my iPhone)!
    Am really stumped at this point...
    What could I possibly be doing wrong? :(
    Is it a problem with the way I set up my RESTful web service (sorry I am a newbie to REST)?
    Would really appreciate it if someone could assist me with this...
    Thank you for taking the time to read this...

    Please show me where is answer for this..

Maybe you are looking for