Package com.socrata.datasync.job

Examples of com.socrata.datasync.job.IntegrationJob


            jobTabsPane.setSelectedIndex(jobTabsPane.getTabCount() - 1);
    }
  }

    private IntegrationJob getNewIntegrationJob() {
        IntegrationJob newJob = new IntegrationJob();
        // set publishViaDi2Http to true as default (ONLY for GUI mode)
        newJob.setPublishViaDi2Http(true);
        return newJob;
    }
View Full Code Here


                        try {
                            int i = openedFileLocation.lastIndexOf('.');
                            if (i > 0) {
                                String openedFileExtension = openedFileLocation.substring(i+1);
                                if(openedFileExtension.equals(STANDARD_JOB_FILE_EXTENSION)) {
                                    addJobTab(new IntegrationJob(openedFileLocation));
                                } else if(openedFileExtension.equals(PORT_JOB_FILE_EXTENSION)) {
                                    addJobTab(new PortJob(openedFileLocation));
                                } else if (openedFileExtension.equals(METADATA_JOB_FILE_EXTENSION)) {
                                  addJobTab(new MetadataJob(openedFileLocation));
                                } else {
View Full Code Here

              //TODO BW: Follow how port jobs are run from command line?
              if (jobFileToRun.endsWith(MetadataJobTab.JOB_FILE_EXTENSION)) {
                job = new MetadataJob(jobFileToRun);
              }
              else {
                job = new IntegrationJob(jobFileToRun);
              }
                JobStatus status = job.run();
                if(status.isError()) {
                    System.err.print("Job completed with errors: ");
                    System.err.println(status.getMessage());
View Full Code Here

        //userPrefs.setSmtpPassword("SMTP_PASSWORD");
        //userPrefs.setFilesizeChunkingCutoffMB("10");
        //userPrefs.setNumRowsPerChunk("10000");

        // Set up job parameters
        IntegrationJob jobToRun = new IntegrationJob(userPrefs);
        jobToRun.setDatasetID("abcd-1234");
        jobToRun.setFileToPublish("data_file.csv");
        jobToRun.setPublishMethod(PublishMethod.replace);
        jobToRun.setFileToPublishHasHeaderRow(true);

        // Uncommend to do replace via FTP (SmartUpdate)
        //jobToRun.setPublishViaFTP(true);
        //jobToRun.setPathToFTPControlFile("control.json");

        JobStatus status = jobToRun.run();
        if(status.isError()) {
            System.err.println("Job failed: " + status.getMessage());
        } else {
            System.out.println("Job ran successfully!");
        }
View Full Code Here

    public JPanel getTabPanel() {
        return jobPanel;
    }

    public JobStatus runJobNow() {
        IntegrationJob jobToRun = new IntegrationJob();
        jobToRun.setDatasetID(datasetIDTextField.getText());
        jobToRun.setFileToPublish(fileToPublishTextField.getText());
        jobToRun.setPublishMethod(
                (PublishMethod) publishMethodComboBox.getSelectedItem());
        jobToRun.setFileToPublishHasHeaderRow(fileToPublishHasHeaderCheckBox.isSelected());
        jobToRun.setPublishViaFTP(ftpButton.isSelected());
        jobToRun.setPublishViaDi2Http(httpButton.isSelected());
        if (usingControlFile) {
            jobToRun.setPathToControlFile(controlFileTextField.getText());
        } else {
            jobToRun.setControlFileContent(controlFileContentTextArea.getText());
        }
        return jobToRun.run();
    }
View Full Code Here

        return jobToRun.run();
    }

    public void saveJob() {
        // Save job data
        IntegrationJob newIntegrationJob = new IntegrationJob();
        newIntegrationJob.setDatasetID(datasetIDTextField.getText());
        newIntegrationJob.setFileToPublish(fileToPublishTextField.getText());
        newIntegrationJob.setPublishMethod(
                (PublishMethod) publishMethodComboBox.getSelectedItem());
        newIntegrationJob.setFileToPublishHasHeaderRow(fileToPublishHasHeaderCheckBox.isSelected());
        newIntegrationJob.setPublishViaFTP(ftpButton.isSelected());
        newIntegrationJob.setPublishViaDi2Http(httpButton.isSelected());
        newIntegrationJob.setPathToControlFile(controlFileTextField.getText());
        newIntegrationJob.setControlFileContent(controlFileContentTextArea.getText());
        newIntegrationJob.setPathToSavedFile(jobFileLocation);

        // TODO If an existing file was selected WARN user of overwriting

        // if first time saving this job: Open dialog box to select "Save as..." location
        // otherwise save to existing file
        boolean updateJobCommandTextField = false;
        String selectedJobFileLocation = jobFileLocation;
        if(selectedJobFileLocation.equals("")) {
            JFileChooser savedJobFileChooser = new JFileChooser();
            FileNameExtensionFilter filter = new FileNameExtensionFilter(
                    JOB_FILE_NAME + " (*." + JOB_FILE_EXTENSION + ")", JOB_FILE_EXTENSION);
            savedJobFileChooser.setFileFilter(filter);
            int returnVal = savedJobFileChooser.showSaveDialog(mainFrame);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = savedJobFileChooser.getSelectedFile();
                selectedJobFileLocation = file.getAbsolutePath();
                if(!selectedJobFileLocation.endsWith("." + JOB_FILE_EXTENSION)) {
                    selectedJobFileLocation += "." + JOB_FILE_EXTENSION;
                }
                jobFileLocation = selectedJobFileLocation;
                newIntegrationJob.setPathToSavedFile(selectedJobFileLocation);
                jobTabTitleLabel.setText(newIntegrationJob.getJobFilename());
                updateJobCommandTextField = true;
            }
        }

        saveJobAsFile(newIntegrationJob, updateJobCommandTextField, selectedJobFileLocation);
View Full Code Here

        // Ensures dataset is in known state (1 row)
        File oneRowFile = new File("src/test/resources/log_dataset_one_row.csv");
        Soda2Publisher.replaceNew(producer, ddl, UNITTEST_LOG_DATASET_ID, oneRowFile, true);

        IntegrationJob job = new IntegrationJob();
        UpsertResult result = new UpsertResult(1, 1, 1, new ArrayList<UpsertError>());
        SocrataConnectionInfo connectionInfo = new SocrataConnectionInfo(DOMAIN, USERNAME, PASSWORD, API_KEY);
        String logPublishingErrorMessage = job.addLogEntry(
                UNITTEST_LOG_DATASET_ID, connectionInfo, job, JobStatus.INVALID_DATASET_ID, result);

        TestCase.assertEquals(null, logPublishingErrorMessage);
        TestCase.assertEquals(2, getTotalRows(UNITTEST_LOG_DATASET_ID));
    }
View Full Code Here

        TestCase.assertEquals(2, getTotalRows(UNITTEST_LOG_DATASET_ID));
    }

    @Test
    public void testAddLogEntryInvalidLogDatasetId() {
        IntegrationJob job = new IntegrationJob();
        UpsertResult result = new UpsertResult(1, 1, 1, new ArrayList<UpsertError>());
        SocrataConnectionInfo connectionInfo = new SocrataConnectionInfo(DOMAIN, USERNAME, PASSWORD, API_KEY);
        String logPublishingErrorMessage = job.addLogEntry(
                "xxxx-xxxx", connectionInfo, job, JobStatus.SUCCESS, result);

        TestCase.assertEquals("Not found", logPublishingErrorMessage);
    }
View Full Code Here

TOP

Related Classes of com.socrata.datasync.job.IntegrationJob

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.