Package com.socrata.datasync.job

Examples of com.socrata.datasync.job.PortJob


                            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 {
                                    throw new Exception("unrecognized file extension (" + openedFileExtension + ")");
                                }
View Full Code Here


        return newJob;
    }

    private class NewPortJobListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            addJobTab(new PortJob());
            jobTabsPane.setSelectedIndex(jobTabsPane.getTabCount() - 1);
        }
View Full Code Here

    public JPanel getTabPanel() {
        return jobPanel;
    }

    public JobStatus runJobNow() {
        PortJob jobToRun = new PortJob();
        jobToRun.setPortMethod((PortMethod) portMethodComboBox
                .getSelectedItem());
        jobToRun.setSourceSiteDomain(sourceSiteDomainTextField.getText());
        jobToRun.setSourceSetID(sourceSetIDTextField.getText());
        jobToRun.setSinkSiteDomain(sinkSiteDomainTextField.getText());
        if (publishMethodComboBox.isEnabled()) {
            jobToRun.setPublishMethod((PublishMethod) publishMethodComboBox
                    .getSelectedItem());
        }
        if (publishDatasetComboBox.isEnabled()) {
            jobToRun.setPublishDataset((PublishDataset)
                    publishDatasetComboBox.getSelectedItem());
        }
        if (sinkSetIDTextField.isEditable()) {
            jobToRun.setSinkSetID(sinkSetIDTextField.getText());
        }

        JobStatus status = jobToRun.run();
        if (!status.isError()) {
            sinkSetIDTextField.setText(jobToRun.getSinkSetID());
        }
        return status;
    }
View Full Code Here

        return status;
    }

    public void saveJob() {
        // Save job data
        PortJob newPortJob = new PortJob();
        newPortJob.setPortMethod((PortMethod) portMethodComboBox
                .getSelectedItem());
        newPortJob.setSourceSiteDomain(sourceSiteDomainTextField.getText());
        newPortJob.setSourceSetID(sourceSetIDTextField.getText());
        newPortJob.setSinkSiteDomain(sinkSiteDomainTextField.getText());
        newPortJob.setSinkSetID(sinkSetIDTextField.getText());
        newPortJob.setPublishMethod((PublishMethod) publishMethodComboBox
                .getSelectedItem());
        newPortJob.setPublishDataset((PublishDataset) publishDatasetComboBox
                .getSelectedItem());
        newPortJob.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
        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;
                newPortJob.setPathToSavedFile(selectedJobFileLocation);
                jobTabTitleLabel.setText(newPortJob.getJobFilename());
            }
        }

        // actually save the job file (may overwrite)
        try {
            newPortJob.writeToFile(selectedJobFileLocation);

            // Update job tab title label
            jobTabTitleLabel.setText(newPortJob.getJobFilename());
        } catch (IOException e) {
            JOptionPane.showMessageDialog(mainFrame,
                    "Error saving " + selectedJobFileLocation + ": " + e.getMessage());
        }
    }
View Full Code Here

            String jobTypeFlag = options.JOB_TYPE_FLAG;
            String jobType = cmd.getOptionValue(jobTypeFlag, options.DEFAULT_JOBTYPE);

            Job jobToRun = new com.socrata.datasync.job.IntegrationJob(userPrefs);
            if(jobType.equals(Jobs.PORT_JOB.toString())) {
                jobToRun = new PortJob(userPrefs);
            } else if(jobType.equals(Jobs.LOAD_PREFERENCES_JOB.toString())) {
                jobToRun = new LoadPreferencesJob(userPrefs);
            } else if (!jobType.equals(Jobs.INTEGRATION_JOB.toString())){
                System.err.println("Invalid " + jobTypeFlag + ": " + cmd.getOptionValue(jobTypeFlag) +
                        " (must be " + Arrays.toString(Jobs.values()) + ")");
View Full Code Here

TOP

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

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.