Package sos.spooler

Examples of sos.spooler.Order


 
 
   
  public boolean spooler_process_after( boolean rc ) throws Exception {
   
        Order order     = null;
        String orderId  = "(none)";
       
        String to = "";
        String cc = "";
        String bcc = "";
        String subject = "";
        String body = "";
        String contentType = "text/plain";
        String encoding = "Base64";
       
        String attachmentCharset = "iso-8859-1";
        String attachmentContentType = "application/octet-stream";
        String attachmentEncoding = "Base64";
        boolean cleanupAttachment = false;
        String[] attachments = {};
      
       
        String host     = spooler_log.mail().smtp();
        int port        = 25;
        String queueDir = spooler_log.mail().queue_dir();
        String from     = spooler_log.mail().from();
       
        try {
          spooler_log.info(".. Calling ProcessSendMailOrderMonitor.spooler_task_after()");
         
            try {
                if (spooler_job.order_queue() != null) {
                    order = spooler_task.order();
                   
                    String names = order.params().names();
                   
                    orderId = order.id();
               
                    if (order.params().value("configuration_path") != null && order.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(order.params().value("configuration_path"));
                    } else if (spooler_task.params().value("configuration_path") != null && spooler_task.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(spooler_task.params().value("configuration_path"));
                    }

                    if (order.params().value("configuration_file") != null && order.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(order.params().value("configuration_file"));
                    } else if (spooler_task.params().value("configuration_file") != null && spooler_task.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(spooler_task.params().value("configuration_file"));
                    }

                    // load and assign configuration
                    this.initConfiguration();
                    this.prepareConfiguration();
                }


            } catch (Exception e) {
                throw new Exception("error occurred preparing order: " + e.getMessage());
            }
           
            if (doSendMail() ){
             
              try {
                if ( !SOSString.isEmpty ( order.params().value("to") ) ) {
                  to = order.params().value("to");
                } else {
                  throw new Exception("no value was specified for mandatory parameter [to]");
                }
               
                if ( !SOSString.isEmpty ( order.params().value("subject") ) ) {
                  subject = order.params().value("subject");
                } else {
                  throw new Exception("no value was specified for mandatory parameter [subject]");
                }
               
               
                if (   !SOSString.isEmpty ( order.params().value("host") )  ) {
                  host = order.params().value("host");
                }
               
               
                if ( !SOSString.isEmpty ( order.params().value("port") ) ) {
                  try {
                    port = Integer.parseInt( order.params().value("port") );
                  } catch (Exception e) {
                    throw new Exception("illegal, non-numeric value [" + order.params().value("port") + "] for parameter [port]: " + e.getMessage());
                  }
                }

               
                if (   !SOSString.isEmpty ( order.params().value("queue_directory") )  ) {
                  queueDir = order.params().value("queue_directory");
                }
               

                if (   !SOSString.isEmpty ( order.params().value("from") )  ) {
                  from = order.params().value("from");
                }
               
               
                if (   !SOSString.isEmpty ( order.params().value("cc") )  ) {
                  cc = order.params().value("cc");
                }
               
               
                if (   !SOSString.isEmpty ( order.params().value("bcc") )  ) {
                  bcc = order.params().value("bcc");
                }
               
                if (   !SOSString.isEmpty ( order.params().value("body") )  ) {
                  body = order.params().value("body");
                }
               
                if (   !SOSString.isEmpty ( order.params().value("content_type") )  ) {
                  contentType = order.params().value("content_type");
                }
               

                if (   !SOSString.isEmpty ( order.params().value("encoding") )  ) {
                  encoding = order.params().value("encoding");
                }


                if (   !SOSString.isEmpty ( order.params().value("attachment_charset") )  ) {
                  attachmentCharset = order.params().value("attachment_charset");
                }
               

                if (   !SOSString.isEmpty ( order.params().value("attachment_content_type") )  ) {
                  attachmentContentType = order.params().value("attachment_content_type");
                }


                if (   !SOSString.isEmpty ( order.params().value("attachment_encoding") )  ) {
                  attachmentEncoding = order.params().value("attachment_encoding");
                }
               

                if (   !SOSString.isEmpty ( order.params().value("attachment") )  ) {
                  attachments = order.params().value("attachment").split(";");
                }
               
                if (   !SOSString.isEmpty ( order.params().value("cleanup_attachment") )  ) {
                  if ( order.params().value("cleanup_attachment").equals("1") || order.params().value("cleanup_attachment").equalsIgnoreCase("true") || order.params().value("cleanup_attachment").equalsIgnoreCase("yes") ) {
                            cleanupAttachment = true;
                          }
                }
               
View Full Code Here


//        System.out.println("addEvent:" + event);
//    }
   
    public void newEvent(Object order)
    {
        Order order1 = (Order)order;
        System.out.println("newEvent, order.title:" + order1.title());
    }
View Full Code Here

public class JobSchedulerProcessSendMailJob extends ProcessOrderJob {


    public boolean spooler_process() {

        Order order = null;
        String orderId = "(none)";
       
        String host = spooler_log.mail().smtp();
        int port = 25;
        String queueDir = spooler_log.mail().queue_dir();

        String from = spooler_log.mail().from();
        String to = "";
        String cc = "";
        String bcc = "";
        String subject = "";
        String body = "";
        String contentType = "text/plain";
        String encoding = "Base64";
       
        String attachmentCharset = "iso-8859-1";
        String attachmentContentType = "application/octet-stream";
        String attachmentEncoding = "Base64";
        boolean cleanupAttachment = false;
        String[] attachments = {};
       
       
        try {

            try {
                if (spooler_job.order_queue() != null) {
                    order = spooler_task.order();
                    orderId = order.id();
               
                    if (order.params().value("configuration_path") != null && order.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(order.params().value("configuration_path"));
                    } else if (spooler_task.params().value("configuration_path") != null && spooler_task.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(spooler_task.params().value("configuration_path"));
                    }

                    if (order.params().value("configuration_file") != null && order.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(order.params().value("configuration_file"));
                    } else if (spooler_task.params().value("configuration_file") != null && spooler_task.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(spooler_task.params().value("configuration_file"));
                    }

                    // load and assign configuration
View Full Code Here

   
    public boolean spooler_process() {

        try {
            String xml_document = "";
            Order order = spooler_task.order();

            Web_service_operation operation = order.web_service_operation();
            if (operation == null) throw new Exception( "no web service operation available" );
           
            Web_service_request request = operation.request();
            if (request == null) throw new Exception( "no web service request available" );
            spooler_log.debug3( "content of web service request:\n" + request.string_content() );

            // should the request be previously transformed ...
            if (spooler_task.params().value("request_stylesheet") != null && spooler_task.params().value("request_stylesheet").length() > 0) {
              Xslt_stylesheet stylesheet = spooler.create_xslt_stylesheet();
              stylesheet.load_file(spooler_task.params().value("request_stylesheet"));
              xml_document = stylesheet.apply_xml(request.string_content());
              spooler_log.debug3( "content of request transformation:\n" + xml_document );
            } else {
              xml_document = request.string_content();
            }

            Variable_set params = spooler.create_variable_set();
           
            // add order parameters from request xml element /params
            SOSXMLXPath xpath = new sos.xml.SOSXMLXPath(new StringBuffer(xml_document));
            String xmlParams = xpath.selectDocumentText("//params");
            if (xmlParams != null && xmlParams.length() > 0) {
                params.set_xml( xmlParams );
            }

            order.set_params( params );

            // altenatively you could add any xml structure of the request to the xml payload of this order
            // order.set_xml_payload( xpath.selectDocumentText("//xml_payload/*") );
      
            spooler_log.info( "web service request accepted for order \"" + order.id() + "\"" );

            return true;
        } catch (Exception e) {
            spooler_log.warn("error occurred processing web service request: " + e.getMessage());
            return false;
View Full Code Here

     * Verarbeitung
     * @see sos.spooler.Job_impl#spooler_process()
     */
    public boolean spooler_process() {

        Order order = null;
        String orderId = "(none)";
       
        try {

            try { // to assign a configuration to this order
                if (spooler_job.order_queue() != null) {
                    order = spooler_task.order();
                    orderId = order.id();

                    if (order.params().value("configuration_path") != null && order.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(order.params().value("configuration_path"));
                    } else if (spooler_task.params().value("configuration_path") != null && spooler_task.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(spooler_task.params().value("configuration_path"));
                    }

                    if (order.params().value("configuration_file") != null && order.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(order.params().value("configuration_file"));
                    } else if (spooler_task.params().value("configuration_file") != null && spooler_task.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(spooler_task.params().value("configuration_file"));
                    }
                }

View Full Code Here

     */
    public boolean spooler_process_before() {
       
        try { // to map order configuration to this job
            this.setLogger(new SOSSchedulerLogger(spooler_log));           
            Order order = spooler_task.order();
           
            if (order.params().value("configuration_path") != null && order.params().value("configuration_path").length() > 0) {
                this.setConfigurationPath(order.params().value("configuration_path"));
            } else if (spooler_task.params().value("configuration_path") != null && spooler_task.params().value("configuration_path").length() > 0) {
                this.setConfigurationPath(spooler_task.params().value("configuration_path"));
            } else {
                this.setConfigurationPath(new File(spooler.ini_path()).getParent());
                this.getLogger().debug1(".. parameter [configuration_path]: " + this.getConfigurationPath());
            }

            if (order.params().value("configuration_file") != null && order.params().value("configuration_file").length() > 0) {
                this.setConfigurationFilename(order.params().value("configuration_file"));
            } else if (spooler_task.params().value("configuration_file") != null && spooler_task.params().value("configuration_file").length() > 0) {
                this.setConfigurationFilename(spooler_task.params().value("configuration_file"));
            } else {
                if (spooler_job.order_queue() != null) {
                    // this.setConfigurationFilename("scheduler_" + spooler_task.order().job_chain().name() + "_" + order.id() + ".config.xml");
View Full Code Here

    public boolean spooler_process_after(boolean rc) throws Exception {
       
        try { // to map order configuration to this job
            this.setLogger(new SOSSchedulerLogger(spooler_log));           

            Order order = spooler_task.order();

            if (rc == false) {
                if (order.params() != null && order.params().value("setback") != null
                        && order.params().value("setback").equalsIgnoreCase("false")
                           || order.params().value("setback").equalsIgnoreCase("no")
                           || order.params().value("setback").equals("0")
                        )) {
                    // nop
                } else {
                    spooler_task.order().setback();
                }
View Full Code Here

            this.setLogger(new SOSSchedulerLogger(spooler_log));           
           
            if (!super.spooler_process_before()) return false;
           
            String xml_document = "";
            Order order = spooler_task.order();

            Web_service_operation operation = order.web_service_operation();
            if (operation == null) throw  new Exception( "no web service operation available" );
           
            Web_service_request request = operation.request();
            if (request == null) throw new Exception( "no web service request available" );
            spooler_log.debug3( "content of web service request:\n" + request.string_content() );

            // should the request be previously transformed ...
            if (spooler_task.params().value("request_stylesheet") != null && spooler_task.params().value("request_stylesheet").length() > 0) {
              Xslt_stylesheet stylesheet = spooler.create_xslt_stylesheet();
              stylesheet.load_file(spooler_task.params().value("request_stylesheet"));
              xml_document = stylesheet.apply_xml(request.string_content());
              spooler_log.debug3( "content of request transformation:\n" + xml_document );
            } else {
              xml_document = request.string_content();
            }
         
            SOSXMLXPath xpath = new sos.xml.SOSXMLXPath(new StringBuffer(xml_document));
            // add order parameters from request xml element /params
            Variable_set params = spooler.create_variable_set();
            params.set_xml( xpath.selectDocumentText("//params") );
            order.set_payload( params );

            spooler_log.info( "web service request accepted for order \"" + order.id() + "\"" );

            return true;
           
        } catch (Exception e) {
            spooler_log.warn("error occurred in spooler_process_before(): " + e.getMessage());
View Full Code Here

     * Verarbeitung
     * @see sos.spooler.Job_impl#spooler_process()
     */
    public boolean spooler_process() {

        Order order    = null;
        String orderId = "(none)";
        boolean rc     = true;
       
        try {

            try {
                this.setLogger(new SOSSchedulerLogger(spooler_log));
                if (spooler_job.order_queue() != null) {
                    order = spooler_task.order();
                    orderId = order.id();
               
                    if (order.params().value("configuration_path") != null && order.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(order.params().value("configuration_path"));
                    } else if (spooler_task.params().value("configuration_path") != null && spooler_task.params().value("configuration_path").length() > 0) {
                        this.setConfigurationPath(spooler_task.params().value("configuration_path"));
                    }

                    if (order.params().value("configuration_file") != null && order.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(order.params().value("configuration_file"));
                    } else if (spooler_task.params().value("configuration_file") != null && spooler_task.params().value("configuration_file").length() > 0) {
                        this.setConfigurationFilename(spooler_task.params().value("configuration_file"));
                    }

                    // load and assign configuration
View Full Code Here

            this.setLogger(new SOSSchedulerLogger(spooler_log));           

            if (rc == false) spooler_task.order().setback();
           
            String xml_document = "";
            Order order = spooler_task.order();
            Web_service_operation operation = order.web_service_operation();
           
            if (operation == null) throw  new Exception( "no web service operation available" );
           
            Web_service_request request = operation.request();
            if (request == null) throw new Exception( "no web service request available" );
           
            Web_service_response response = operation.response();
            if (response == null) throw new Exception( "no web service response available" );

            if (spooler_task.params().value("response_stylesheet") != null && spooler_task.params().value("response_stylesheet").length() > 0) {
                // .. either transform the response from order parameters and payload
                Xslt_stylesheet stylesheet = spooler.create_xslt_stylesheet();
                stylesheet.load_file( spooler_task.params().value("response_stylesheet") );
                xml_document = stylesheet.apply_xml( order.xml() );
                spooler_log.debug3( "content of response transformation:\n" + xml_document );
                response.set_string_content( xml_document );
            } else {
                // .. or send an individual response (use order.params().xml() or order.xml_payload() to access order data)
                response.set_string_content( "<response state=\"success\">" + order.params().xml() + "</response>" );
            }

            response.send();
            spooler_log.info( "web service response successfully processed for order \"" + order.id() + "\"" );

            if (!super.spooler_process_after(rc)) return false;
           
            return rc;
View Full Code Here

TOP

Related Classes of sos.spooler.Order

Copyright © 2018 www.massapicom. 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.