Examples of NexsmDocHandler


Examples of net.gridshield.nexsm.common.NexsmDocHandler

      // java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
      // java.net.SocketException: Unexpected end of file from server.
      // -- Post page not found --
      // java.io.FileNotFoundException: <<URL>>
      bInp = new BufferedReader(new InputStreamReader(urlConn.getInputStream ()));
      NexsmDocHandler pushHandler = new DHFilePush();
      QDParser.parse(pushHandler,bInp);
      PusherEvent pe = new PusherEvent(this, _destinationFileName);
     
      pe.setType(PusherEvent.PusherEventType.FINISHED);
      pe.setObject(pushHandler.getList());
      getPushManager().firePusherFinished(pe);
    }catch(Exception e){
      PusherEvent pe = new PusherEvent(this, _destinationFileName);
      pe.setType(PusherEvent.PusherEventType.ERROR);
      PushResult pr = new PushResult(PusherEvent.PusherEventType.ERROR, e.toString());
View Full Code Here

Examples of net.gridshield.nexsm.common.NexsmDocHandler

                BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        (InputStream)gzip));
                               
/* Parser  */
                NexsmDocHandler docHan = null;
                // after doing this
                // we should fire an event
                // with an specific action
                // the event is trapped by PullManager who fires
                // another event to its listeners (in this case Mapper)
                // Mapper should know what to do according to the event type

// This is only an example of how to fire the event
                PullerEvent pe = new PullerEvent(this, "Hmmm");
//                pe.setType(PullerEvent.PullerEventType.STATUS);
//                pe.setObject(docHan.getList());
//
//                fireEvent(pe);

                switch (type) {
                    case OBJECTS:
                        // maybe passing some params to the
                        // dochandler it could do some things happend
                        // Objects well add the objects
                        docHan = new DHObjects();
                        pe.setType(PullerEvent.PullerEventType.OBJECTS);
                        pe.setObject(docHan.getList());
                    break;
                    case STATUS:
                        // change the status things
                        docHan = new DHStatus();
                        pe.setType(PullerEvent.PullerEventType.STATUS);
                        pe.setObject(docHan.getList());
                    break;
                    case CONFIG:
                        // change the system config
                        docHan = new DHConfig();
                        pe.setType(PullerEvent.PullerEventType.CONFIG);
                        pe.setObject(docHan.getList());
                    break;
                    case TEST:
                        docHan = new DHConfig();
                    break;
                    default:
                        // error
                        throw new Exception("Invalid type");
                }
               
               
                long cur3 = System.currentTimeMillis();
                try {
                    QDParser.parse(docHan,in);
                } catch (Exception e) {
                    // TODO send a visual alert instead of a system output
                    System.err.println("Please send this output to the developer at sergio AT gridshield DOT net");
                    System.err.println("-----------Error URLPuller.java report------------");
                    System.err.println("Exception parsing... ");
                    e.printStackTrace();
                    System.err.println("-----------Error URLPuller.java report------------");
                }
/* Parser  */
                _procesedData = docHan.getList();
               
                int cleanTimes = 0;
                long cur4 = System.currentTimeMillis();
                in.close();
                gzip.close();
               
                if (type == URLPullerType.TEST) {
                    LinkedList <Object> l = docHan.getList();
                    _testData = l;
                    return;
                }
               
                // gets the Manager to fire an event
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.