From 8cb386b0d20ab4b79d199c983c44441ecaebdd21 Mon Sep 17 00:00:00 2001 From: ?? ? <ulysseskao@ximple.com.tw> Date: Thu, 07 Aug 2008 16:09:09 +0800 Subject: [PATCH] update for EOFM-141, EOFM-142 --- xdgnjobs/ximple-jobcarrier/pom.xml | 55 +++ .gitattributes | 2 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java | 4 xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard.properties | 23 + xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard_zh_TW.properties | 23 + xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java | 45 ++ xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java | 7 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java | 8 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java | 4 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java | 4 xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml | 12 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java | 73 +++- xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testElementFilter.xml | 5 xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobCarrier.java | 113 +++++++ xdgnjobs/pom.xml | 5 xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobWizard.java | 458 ++++++++++++++++++++++++++++- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java | 4 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java | 40 + 18 files changed, 788 insertions(+), 97 deletions(-) diff --git a/.gitattributes b/.gitattributes index 34b5988..30444fa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -44,6 +44,8 @@ xdgnjobs/ximple-jobcarrier/pom.xml svneol=native#text/xml xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobCarrier.java svneol=native#text/plain xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobWizard.java svneol=native#text/plain +xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard.properties svneol=native#text/plain +xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard_zh_TW.properties svneol=native#text/plain xdgnjobs/ximple-jobcarrier/src/main/resources/log4j.properties svneol=native#text/plain xdgnjobs/ximple-jobcarrier/src/main/resources/quartz.properties svneol=native#text/plain xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml svneol=native#text/xml diff --git a/xdgnjobs/pom.xml b/xdgnjobs/pom.xml index 907d946..cecea7c 100644 --- a/xdgnjobs/pom.xml +++ b/xdgnjobs/pom.xml @@ -161,6 +161,11 @@ <version>1.2</version> </dependency> <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.1</version> + </dependency> + <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.15</version> diff --git a/xdgnjobs/ximple-jobcarrier/pom.xml b/xdgnjobs/ximple-jobcarrier/pom.xml index c934ff7..ca2edd7 100644 --- a/xdgnjobs/ximple-jobcarrier/pom.xml +++ b/xdgnjobs/ximple-jobcarrier/pom.xml @@ -118,8 +118,13 @@ </dependency> <dependency> - <artifactId>velocity</artifactId> <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + </dependency> + + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> </dependency> <!-- ORACLE --> @@ -215,10 +220,10 @@ </executions> --> <configuration> - <!-- <mainClass>com.ximple.eofms.XQuartzJobCarrier</mainClass> + <!-- + <commandlineArgs>-wizard</commandlineArgs> --> - <mainClass>com.ximple.eofms.XQuartzJobWizard</mainClass> </configuration> <!-- <dependencies> @@ -243,8 +248,52 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>native2ascii-maven-plugin</artifactId> + <version>1.0-alpha-1</version> + <configuration> + <dest>target/classes/com/ximple/eofms</dest> + <src>src/main/resources/com/ximple/eofms</src> + </configuration> + <executions> + <execution> + <id>native2ascii-utf8</id> + <goals> + <goal>native2ascii</goal> + </goals> + <configuration> + <encoding>UTF8</encoding> + <includes>XQuartzJobWizard_zh*.properties</includes> + </configuration> + </execution> + </executions> + </plugin> </plugins> <resources> + <resource> + <directory>src/main/resources/com/ximple/eofms</directory> + <excludes> + <exclude>XQuartzJobWizard_zh*.properties</exclude> + </excludes> + <filtering>true</filtering> + </resource> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>log4j.properties</include> + <include>quartz.properties</include> + <include>quartz_jobs.xml</include> + </includes> + <!-- + <excludes> + <exclude>XQuartzJobWizard*.properties</exclude> + <exclude>quartz_jobs.xml</exclude> + <exclude>quartz_jobs_shapefiles.xml</exclude> + </excludes> + --> + <filtering>false</filtering> + </resource> </resources> </build> diff --git a/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobCarrier.java b/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobCarrier.java index 84a41e5..3e943ae 100644 --- a/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobCarrier.java +++ b/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobCarrier.java @@ -1,9 +1,20 @@ package com.ximple.eofms; import java.util.Date; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.apache.commons.cli.PosixParser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.awl.Wizard; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; @@ -19,11 +30,111 @@ public class XQuartzJobCarrier { static Log logger = LogFactory.getLog(XQuartzJobCarrier.class); + static Options options = new Options(); + + private static final String VERSION = "0.8.0"; public static void main(String[] args) { XQuartzJobCarrier instance = new XQuartzJobCarrier(); - instance.startScheduler(); + instance.initializeOption(); + instance.execute(args); + } + + private void initializeOption() + { + Option option; + option = OptionBuilder.create("help"); + option.setDescription("print this message"); + options.addOption(option); + + option = OptionBuilder.create("version"); + option.setDescription("print the version information and exit"); + options.addOption(option); + + option = OptionBuilder.create("wizard"); + option.setDescription("start wizard mode"); + options.addOption(option); + + option = OptionBuilder.create("verbose"); + option.setDescription("be extra verbose"); + options.addOption(option); + + option = OptionBuilder.create("debug"); + option.setDescription("print debugging information"); + options.addOption(option); + + option = OptionBuilder.create("jobfile"); + option.setDescription("use given jobfile"); + option.setArgName("file"); + options.addOption(option); + + } + + private void execute(String[] args) + { + // CommandLineParser parser = new GnuParser(); + CommandLineParser parser = new PosixParser(); + CommandLine commandLine = null; + try + { + // parse the command commandLine arguments + commandLine = parser.parse(options, args); + } + catch (ParseException exp) + { + // oops, something went wrong + System.err.println("Parsing failed. Reason: " + exp.getMessage()); + } + + if ((commandLine != null) && (commandLine.getOptions().length > 0)) + { + if (commandLine.hasOption("help")) + { + printHelpMessage(); + } else if (commandLine.hasOption("version")) + { + printVersionMessage(); + } else if (commandLine.hasOption("wizard")) + { + startWizardMode(); + } + return; + } + startScheduler(); + } + + private void printHelpMessage() + { + HelpFormatter formatter = new HelpFormatter(); + formatter.printHelp("XQuartzJobCarrier", options); + } + + private void printVersionMessage() + { + System.out.println("XQuartzJobCarrier - " + VERSION); + } + + public void startWizardMode() + { + Runnable runnable = new Runnable() + { + public void run() + { + Wizard wizard = new XQuartzJobWizard((JFrame) null); + + wizard.pack(); + wizard.setVisibleOnCenterOfScreen(); + } + }; + try + { + SwingUtilities.invokeLater(runnable); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } public void startScheduler() diff --git a/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobWizard.java b/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobWizard.java index bb620b2..659c739 100644 --- a/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobWizard.java +++ b/xdgnjobs/ximple-jobcarrier/src/main/java/com/ximple/eofms/XQuartzJobWizard.java @@ -1,48 +1,454 @@ package com.ximple.eofms; import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ResourceBundle; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JEditorPane; +import javax.swing.JFileChooser; import javax.swing.JFrame; -import javax.swing.WindowConstants; import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.JToolBar; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.awl.Wizard; import org.awl.DefaultWizard; import org.awl.DefaultWizardPageDescriptor; -import org.awl.WizardConstants; +import org.awl.NavigationAuthorization; +import org.awl.Wizard; +import org.awl.WizardPageDescriptor; +import org.awl.demo.AwlDemo; +import org.awl.header.AbstractWizardHeader; +import org.awl.header.EclipseWizardHeader; +import org.awl.message.MessageLevel; -public class XQuartzJobWizard +public class XQuartzJobWizard extends DefaultWizard { static Log logger = LogFactory.getLog(XQuartzJobWizard.class); - public static void main(String[] args) - { - Wizard wizard = new DefaultWizard((JFrame)null); - initializeWizardComponent(wizard); + /** + * header type none + */ + private static final String HEADER_NONE = "none"; - wizard.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - wizard.setTitle("Read a bad book..."); - wizard.setSize(new Dimension(430, 300)); - wizard.setVisible(true); + /** + * header type classic + */ + private static final String HEADER_CLASSIC = "classic"; + + /** + * header type eclipse + */ + private static final String HEADER_ECLIPSE = "eclipse"; + + /** + * first page + */ + private WizardPageDescriptor firstPage = null; + + /** + * second page + */ + private WizardPageDescriptor secondPage = null; + + /** + * third page + */ + private WizardPageDescriptor thirdPage = null; + + /** + * forth page + */ + private WizardPageDescriptor fourthPage = null; + + /** + * Creates a new instance of AwlDemo + */ + public XQuartzJobWizard(JFrame frame) + { + super(frame); + + AbstractWizardHeader header = new EclipseWizardHeader(); + header.getIconLabel().setIcon(new ImageIcon(AwlDemo.class.getResource("/org/awl/rc/install.png"))); + this.setHeader(header); + + final ResourceBundle rb = ResourceBundle.getBundle(XQuartzJobWizard.class.getName()); + + this.setTitle(rb.getString("title")); + + /** first page */ + this.firstPage = new DefaultWizardPageDescriptor(); + firstPage.setTitle(rb.getString("first.title")); + firstPage.setDescription(rb.getString("first.description")); + + JLabel firstLabel = new JLabel(rb.getString("first.label.text")); + firstLabel.setVerticalAlignment(SwingConstants.TOP); + firstLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + firstPage.setComponent(firstLabel); + + firstPage.setNextDescriptorId("2"); + + /** second page */ + this.secondPage = new DefaultWizardPageDescriptor(); + secondPage.setTitle(rb.getString("second.title")); + secondPage.setDescription(rb.getString("second.description")); + + secondPage.setMessage(rb.getString("second.messageContent"), MessageLevel.INFO); + + URL licenseUrl = null; + try + { + licenseUrl = new URL("http://www.gnu.org/licenses/lgpl-2.1.txt"); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + + JEditorPane licensePane = null; + if (licenseUrl == null) + { + licensePane = new JEditorPane(); + licensePane.setText("license LGPL 2.1"); + } else + { + try + { + licensePane = new JEditorPane(licenseUrl); + } + catch (IOException e) + { + licensePane = new JEditorPane(); + licensePane.setText("license LGPL 2.1"); + } + } + + licensePane.setPreferredSize(new Dimension(630, 350)); + + final JRadioButton radioAcceptLicense = new JRadioButton(rb.getString("second.licenseAccepted")); + final JRadioButton radioRefuseLicense = new JRadioButton(rb.getString("second.licenseRefused")); + + ButtonGroup licenseButtonGroup = new ButtonGroup(); + licenseButtonGroup.add(radioAcceptLicense); + licenseButtonGroup.add(radioRefuseLicense); + + ChangeListener changeListener = new ChangeListener() + { + public void stateChanged(ChangeEvent e) + { + secondPage.setNextPageAuthorization( + radioAcceptLicense.isSelected() ? NavigationAuthorization.DEFAULT : + NavigationAuthorization.FORBIDDEN); + } + }; + + radioAcceptLicense.addChangeListener(changeListener); + radioRefuseLicense.addChangeListener(changeListener); + + radioRefuseLicense.setSelected(true); + + JPanel secondPageComponent = new JPanel(); + GridBagLayout secondPageLayout = new GridBagLayout(); + secondPageComponent.setLayout(secondPageLayout); + + GridBagConstraints gbc = new GridBagConstraints(); + + gbc.gridx = 1; + gbc.gridy = 1; + gbc.fill = GridBagConstraints.BOTH; + gbc.weightx = 1.0f; + gbc.weighty = 1.0f; + JScrollPane scrollLicense = new JScrollPane(licensePane); + scrollLicense.setBorder(BorderFactory.createLoweredBevelBorder()); + secondPageComponent.add(scrollLicense, gbc); + + gbc.gridx = 1; + gbc.gridy = 2; + gbc.fill = GridBagConstraints.NONE; + gbc.weightx = 0.0f; + gbc.weighty = 0.0f; + secondPageComponent.add(new JToolBar.Separator(new Dimension(10, 10)), gbc); + + gbc.gridx = 1; + gbc.gridy = 3; + gbc.anchor = GridBagConstraints.WEST; + secondPageComponent.add(radioAcceptLicense, gbc); + + gbc.gridx = 1; + gbc.gridy = 4; + secondPageComponent.add(radioRefuseLicense, gbc); + + secondPageComponent.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + + secondPage.setComponent(secondPageComponent); + + secondPage.setPreviousDescriptorId("1"); + secondPage.setNextDescriptorId("3"); + + /** third page */ + final JTextField locationField = new JTextField(20); + final Action chooseLocation = new AbstractAction() + { + public void actionPerformed(ActionEvent e) + { + File current = null; + String text = locationField.getText(); + if (text != null && text.trim().length() > 0) + { + try + { + current = new File(text); + if (!current.exists()) + { + current = null; + } + } + catch (Exception ex) + { } + } + + JFileChooser chooser = new JFileChooser(current); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setFileFilter(new javax.swing.filechooser.FileFilter() + { + public boolean accept(File f) + { + boolean result = false; + + if (f != null && f.isDirectory()) + { + result = true; + } + + return result; + } + + public String getDescription() + { + return rb.getString("third.fileChooser.description"); + } + }); + chooser.setMultiSelectionEnabled(false); + int answer = chooser.showDialog(XQuartzJobWizard.this, rb.getString("third.fileChooser.selectLabel")); + + if (answer == JFileChooser.CANCEL_OPTION) + { + locationField.setText(""); + thirdPage.setMessage(rb.getString("third.messageContent"), MessageLevel.WARN); + } else // aprove + { + locationField.setText(chooser.getSelectedFile().getPath()); + } + } + }; + this.thirdPage = new DefaultWizardPageDescriptor() + { + public void displayingPanel(Wizard wizard) + { + /** open file dialog box */ + if (locationField.getText().trim().length() == 0) + { + chooseLocation.actionPerformed(null); + } + } + }; + chooseLocation.putValue(Action.SMALL_ICON, new ImageIcon(AwlDemo.class.getResource("/org/awl/rc/folder.png"))); + thirdPage.setNextPageAuthorization(NavigationAuthorization.FORBIDDEN); + + locationField.getDocument().addDocumentListener(new DocumentListener() + { + public void changedUpdate(DocumentEvent e) + { } + + public void insertUpdate(DocumentEvent e) + { + this.changeNavigation(); + } + + public void removeUpdate(DocumentEvent e) + { + this.changeNavigation(); + } + + private void changeNavigation() + { + thirdPage.setNextPageAuthorization(locationField.getText().trim().length() > 0 ? NavigationAuthorization.DEFAULT : + NavigationAuthorization.FORBIDDEN); + } + }); + + thirdPage.setTitle(rb.getString("third.title")); + thirdPage.setDescription(rb.getString("third.description")); + + JPanel thirdSubPanel = new JPanel(); + + JPanel thirdPanel = new JPanel(); + JLabel installLocationLabel = new JLabel(rb.getString("third.label.text")); + installLocationLabel.setHorizontalAlignment(SwingConstants.LEFT); + thirdSubPanel.add(installLocationLabel); + locationField.setEnabled(false); + locationField.setHorizontalAlignment(SwingConstants.LEFT); + thirdSubPanel.add(locationField); + JButton locationButton = new JButton(chooseLocation); + locationButton.setHorizontalAlignment(SwingConstants.LEFT); + Dimension buttonPrefSize = new Dimension(locationButton.getPreferredSize()); + buttonPrefSize.height = locationField.getPreferredSize().height; +// buttonPrefSize.width = ((Icon)chooseLocation.getValue(Action.SMALL_ICON)).getIconWidth() + 4; + locationButton.setPreferredSize(buttonPrefSize); + thirdSubPanel.add(locationButton); + + thirdSubPanel.setAlignmentX(0.0f); + thirdPanel.setAlignmentX(0.0f); + + thirdPanel.setLayout(new GridBagLayout()); + + gbc.gridx = 1; + gbc.gridy = 1; + gbc.weightx = 0.0f; + gbc.weighty = 0.0f; + gbc.fill = GridBagConstraints.NONE; + thirdPanel.add(thirdSubPanel, gbc); + + gbc.gridx = 2; + gbc.gridy = 2; + gbc.weightx = 1.0f; + gbc.weighty = 1.0f; + gbc.fill = GridBagConstraints.BOTH; + thirdPanel.add(new JToolBar.Separator(new Dimension(5, 5)), gbc); + + thirdPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + + thirdPage.setComponent(thirdPanel); + + thirdPage.setPreviousDescriptorId("2"); + thirdPage.setNextDescriptorId("4"); + + /** fourth page */ + final JProgressBar installProgressBar = new JProgressBar(); + final JLabel progressLabel = new JLabel(rb.getString("fourth.inProgress.text")); + + this.fourthPage = new DefaultWizardPageDescriptor() + { + public void displayingPanel(Wizard wizard) + { + /* begin installation */ + this.setPreviousPageAuthorization(NavigationAuthorization.FORBIDDEN); + this.setFinishAuthorization(NavigationAuthorization.FORBIDDEN); + + /* begin new thread */ + Runnable runnable = new Runnable() + { + public void run() + { + while (installProgressBar.getValue() < installProgressBar.getMaximum()) + { + Runnable r = new Runnable() + { + public void run() + { installProgressBar.setValue(installProgressBar.getValue() + 1); } + }; + SwingUtilities.invokeLater(r); + + try + { + Thread.sleep(50); + } + catch (InterruptedException e) + { + Runnable r1 = new Runnable() + { + public void run() + { installProgressBar.setValue(installProgressBar.getMaximum()); } + }; + SwingUtilities.invokeLater(r1); + + break; + } + } + + Runnable r2 = new Runnable() + { + public void run() + { progressLabel.setText(rb.getString("fourth.finished.text")); } + }; + SwingUtilities.invokeLater(r2); + + setFinishAuthorization(NavigationAuthorization.DEFAULT); + setCancelAuthorization(NavigationAuthorization.FORBIDDEN); + } + }; + + new Thread(runnable).start(); + } + }; + fourthPage.setTitle(rb.getString("fourth.title")); + fourthPage.setDescription(rb.getString("fourth.description")); + + JPanel fourthPanel = new JPanel(); + BoxLayout fourthLayout = new BoxLayout(fourthPanel, BoxLayout.PAGE_AXIS); + fourthPanel.setLayout(fourthLayout); + + fourthPanel.add(installProgressBar); + fourthPanel.add(progressLabel); + + fourthPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + + fourthPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + + fourthPage.setComponent(fourthPanel); + + fourthPage.setPreviousDescriptorId("3"); + + /** register */ + this.addPage(firstPage, "1"); + this.addPage(secondPage, "2"); + this.addPage(thirdPage, "3"); + this.addPage(fourthPage, "4"); } - private static void initializeWizardComponent(Wizard wizard) + public static void main(String[] args) { - DefaultWizardPageDescriptor page1 = new DefaultWizardPageDescriptor(); - page1.setComponent(new JLabel("this is my first page")); - page1.setDescription("my first page"); + Runnable runnable = new Runnable() + { + public void run() + { + Wizard wizard = new XQuartzJobWizard((JFrame) null); - DefaultWizardPageDescriptor page2 = new DefaultWizardPageDescriptor(); - page2.setComponent(new JLabel("this is my second page")); - page2.setDescription("my second page"); + wizard.pack(); + wizard.setVisibleOnCenterOfScreen(); + } + }; - page1.setNextDescriptorId("2"); - page2.setPreviousDescriptorId("1"); - page1.setPreviousDescriptorId(WizardConstants.STARTING_DESCRIPTOR_ID); - page2.setNextDescriptorId(WizardConstants.TERMINAL_DESCRIPTOR_ID); - - wizard.addPage(page1, "1"); - wizard.addPage(page2, "2"); + try + { + SwingUtilities.invokeLater(runnable); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } } diff --git a/xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard.properties b/xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard.properties new file mode 100644 index 0000000..4d7a272 --- /dev/null +++ b/xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard.properties @@ -0,0 +1,23 @@ +title=Ximple Quartz Job Wizard + +first.title=Convert +first.description=Installation introduction +first.label.text=<html>This wizard will not install anything on your computer.<br/>It only demonstrates <b>Awl</b> functionnalities.</html> + +second.title=License agreement +second.description=Accept the license of this software +second.licenseAccepted=I accept the terms of this license agreement +second.licenseRefused=I do not accept the terms of this license agreement +second.messageContent=Accept the terms of the license + +third.title=Install location +third.description=Select the location where to install this software +third.label.text=Install location +third.fileChooser.selectLabel=Select +third.fileChooser.description=Select +third.messageContent=You must choose a valid location + +fourth.title=Installation... +fourth.description=Installation progress +fourth.inProgress.text=Installation in progress... +fourth.finished.text=Installation finished diff --git a/xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard_zh_TW.properties b/xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard_zh_TW.properties new file mode 100644 index 0000000..0323202 --- /dev/null +++ b/xdgnjobs/ximple-jobcarrier/src/main/resources/com/ximple/eofms/XQuartzJobWizard_zh_TW.properties @@ -0,0 +1,23 @@ +title=Ximple Quartz Job Wizard + +first.title=�Ŷ�����ഫ +first.description=�Ŷ�����ഫ�N�|Ū�� OMS/CMMS �Ŷ���Ʈw���e�ഫ�� PostGIS �Ŷ���Ʈw +first.label.text=<html>This wizard will not install anything on your computer.<br/>It only demonstrates <b>Awl</b> functionnalities.</html> + +second.title=���v�n�� +second.description=Accept the license of this software +second.licenseAccepted=I accept the terms of this license agreement +second.licenseRefused=I do not accept the terms of this license agreement +second.messageContent=Accept the terms of the license + +third.title=�պA�]�w��m +third.description=Select the location where to install this software +third.label.text=Install location +third.fileChooser.selectLabel=Select +third.fileChooser.description=Select +third.messageContent=You must choose a valid location + +fourth.title=�}�l����... +fourth.description=Installation progress +fourth.inProgress.text=Installation in progress... +fourth.finished.text=Installation finished diff --git a/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml b/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml index 1bd55fc..6794715 100644 --- a/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml +++ b/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml @@ -18,7 +18,7 @@ <job-data-map allows-transient-data="true"> <entry> <key>JOBDATA_DIR</key> - <value>g:\temp\data</value> + <value>g:\temp\JobData</value> </entry> <!-- <entry> @@ -28,11 +28,11 @@ --> <entry> <key>PGHOST</key> - <value>192.168.11.200</value> + <value>192.168.11.119</value> </entry> <entry> <key>PGDDATBASE</key> - <value>tctpc</value> + <value>xtpcgis</value> </entry> <entry> <key>PGPORT</key> @@ -40,7 +40,7 @@ </entry> <entry> <key>PGSCHEMA</key> - <value>public</value> + <value>gisrepo1</value> </entry> <entry> <key>PGUSER</key> @@ -56,7 +56,7 @@ </entry> <entry> <key>ORAINST</key> - <value>tctpc</value> + <value>nntpc</value> </entry> <entry> <key>ORAPORT</key> @@ -108,7 +108,7 @@ </entry> <entry> <key>COPYCONNECTIVITYMODE</key> - <value>true</value> + <value>false</value> </entry> </job-data-map> </job-detail> diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java index 41ab334..561edc9 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java @@ -103,12 +103,9 @@ { MultiLineString mline = (MultiLineString) gobj; CoordinateList coordinateList = new CoordinateList(); - if (mline.getNumGeometries() == 1) + for (int i = 0; i < mline.getNumGeometries(); i++) { - for (int i = 0; i < mline.getNumGeometries(); i++) - { - coordinateList.add(mline.getGeometryN(i).getCoordinates(), true); - } + coordinateList.add(mline.getGeometryN(i).getCoordinates(), true); } gobj = geometryFactory.createLineString(coordinateList.toCoordinateArray()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java index 47e8f13..d38752e 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java @@ -114,7 +114,7 @@ } return oracleJobContext; */ - return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), filterPath); + return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), _pgSchema, filterPath); } protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException @@ -623,7 +623,7 @@ for (File dgnFile : dgnFiles) { IndexDgnConvertPostGISJobContext convertContext = - new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore()); + new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), _pgSchema); logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---"); try { @@ -763,7 +763,7 @@ for (File dgnFile : dgnFiles) { GeneralDgnConvertPostGISJobContext convertContext = - new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore()); + new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), _pgSchema); logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); try { @@ -946,7 +946,7 @@ for (File dgnFile : dgnFiles) { FeatureDgnConvertPostGISJobContext convertContext = - new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), _filterPath); + new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), _pgSchema, _filterPath); logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); try { diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java index f919f16..7ad36e8 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java @@ -125,15 +125,24 @@ protected static WKTWriter geometryWriter = new WKTWriter(); protected static JtsBinaryWriter binaryWriter = new JtsBinaryWriter(); - protected PostgisDataStore targetDataStore; + protected PostgisDataStore targetDataStore; + protected String targetSchema = "public"; + private Connection connection; protected boolean schemaEnabled = true; - public AbstractDgnToPostGISJobContext(String dataPath, DataStore targetDataStore) + public AbstractDgnToPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema) { super(dataPath); - this.targetDataStore = (PostgisDataStore) targetDataStore; this.connection = null; + if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) + { + this.targetDataStore = (PostgisDataStore) targetDataStore; + } else + { + getLogger().info("targetDataStore has wrong."); + } + setTargetSchema(targetSchema); } public PostgisDataStore getTargetDataStore() @@ -144,6 +153,16 @@ public void setTargetDataStore(PostgisDataStore targetDataStore) { this.targetDataStore = targetDataStore; + } + + public String getTargetSchema() + { + return targetSchema; + } + + public void setTargetSchema(String schemaName) + { + targetSchema = schemaName; } public Connection getConnection() @@ -194,7 +213,7 @@ Statement stmt = conn.createStatement(); StringBuilder sb = new StringBuilder(); sb.append("DELETE FROM \""); - sb.append(targetDataStore.getDatabaseSchemaName()); + sb.append(getTargetSchema()); sb.append("\".\""); sb.append(tableName); sb.append('\"'); @@ -209,7 +228,7 @@ Statement stmt = conn.createStatement(); StringBuilder sb = new StringBuilder(); sb.append("DROP TABLE \""); - sb.append(targetDataStore.getDatabaseSchemaName()); + sb.append(getTargetSchema()); sb.append("\".\""); sb.append(tableName); sb.append("\" CASCADE"); @@ -223,7 +242,7 @@ { Statement stmt = conn.createStatement(); StringBuilder sb = new StringBuilder(); - sb.append("SELECT DropGeometryColumn('','"); + sb.append("SELECT \"public\".DropGeometryColumn('','"); sb.append(tableName); sb.append("','"); sb.append(geomField); @@ -237,7 +256,7 @@ protected String dropGeometryColumn(String dbSchema, String tableName, String geomField) { StringBuilder sb = new StringBuilder(); - sb.append("SELECT DropGeometryColumn('"); + sb.append("SELECT \"public\".DropGeometryColumn('"); sb.append(dbSchema); sb.append("','"); sb.append(tableName); @@ -258,7 +277,7 @@ throw new RuntimeException("Error: " + geometryAttribute.getLocalName() + " unknown type!!!"); } - sql = new StringBuilder("SELECT AddGeometryColumn('"); + sql = new StringBuilder("SELECT \"public\".AddGeometryColumn('"); sql.append(dbSchema); sql.append("','"); sql.append(tableName); @@ -282,7 +301,6 @@ ArrayList<String> result = new ArrayList<String>(); AttributeType[] attributeType = featureType.getAttributeTypes(); - // String dbSchema = targetDataStore.getDatabaseSchemaName(); Connection con = getConnection(); @@ -691,8 +709,8 @@ public String encodeSchemaTableName(String tableName) { - return schemaEnabled ? ("\"" + targetDataStore.getDatabaseSchemaName() + "\".\"" + tableName + "\"") - : ("\"" + tableName + "\""); + return schemaEnabled ? ("\"" + getTargetSchema() + "\".\"" + tableName + "\"") + : ("\"" + tableName + "\""); } public String encodeSchemaColumnName(String columnName) diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java index bd4d0c8..dab6a9a 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java @@ -11,6 +11,7 @@ import java.util.HashMap; import java.util.Set; import java.util.ArrayList; +import java.util.Queue; import java.math.BigDecimal; import org.geotools.data.DataStore; @@ -124,11 +125,13 @@ protected static WKTWriter geometryWriter = new WKTWriter(); protected static JtsBinaryWriter binaryWriter = new JtsBinaryWriter(); - protected PostgisDataStore targetDataStore; + protected PostgisDataStore targetDataStore; + protected String targetSchema = "public"; + private Connection connection; protected boolean schemaEnabled = true; - public AbstractOracleToPostGISJobContext(String dataPath, DataStore targetDataStore) + public AbstractOracleToPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema) { if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) { @@ -138,6 +141,7 @@ getLogger().info("targetDataStore has wrong."); } setDataPath(dataPath); + setTargetSchema(targetSchema); } public PostgisDataStore getTargetDataStore() @@ -148,6 +152,16 @@ public void setTargetDataStore(PostgisDataStore targetDataStore) { this.targetDataStore = targetDataStore; + } + + public String getTargetSchema() + { + return targetSchema; + } + + public void setTargetSchema(String schemaName) + { + targetSchema = schemaName; } public Connection getConnection() @@ -193,12 +207,12 @@ } } - protected void deleteTable(Connection conn, String tableName) throws SQLException + protected void deleteTable(Connection conn, String schemaName, String tableName) throws SQLException { Statement stmt = conn.createStatement(); StringBuilder sb = new StringBuilder(); sb.append("DELETE FROM \""); - sb.append(targetDataStore.getDatabaseSchemaName()); + sb.append(schemaName); sb.append("\".\""); sb.append(tableName); sb.append('\"'); @@ -208,12 +222,12 @@ conn.commit(); } - protected void dropTable(Connection conn, String tableName) throws SQLException + protected void dropTable(Connection conn, String schemaName, String tableName) throws SQLException { Statement stmt = conn.createStatement(); StringBuilder sb = new StringBuilder(); sb.append("DROP TABLE \""); - sb.append(targetDataStore.getDatabaseSchemaName()); + sb.append(schemaName); sb.append("\".\""); sb.append(tableName); sb.append("\" CASCADE"); @@ -223,11 +237,13 @@ conn.commit(); } - protected void dropGeometryColumn(Connection conn, String tableName, String geomField) throws SQLException + protected void dropGeometryColumn(Connection conn, String dbSchema, String tableName, String geomField) throws SQLException { Statement stmt = conn.createStatement(); StringBuilder sb = new StringBuilder(); - sb.append("SELECT DropGeometryColumn('','"); + sb.append("SELECT \"public\".DropGeometryColumn('"); + sb.append(dbSchema); + sb.append("','"); sb.append(tableName); sb.append("','"); sb.append(geomField); @@ -241,14 +257,13 @@ protected String dropGeometryColumn(String dbSchema, String tableName, String geomField) { StringBuilder sb = new StringBuilder(); - sb.append("SELECT DropGeometryColumn('"); + sb.append("SELECT \"public\".DropGeometryColumn('"); sb.append(dbSchema); sb.append("','"); sb.append(tableName); sb.append("','"); sb.append(geomField); sb.append("')"); - getLogger().info("Execute-" + sb.toString()); return sb.toString(); } @@ -262,7 +277,7 @@ throw new RuntimeException("Error: " + geometryAttribute.getLocalName() + " unknown type!!!"); } - sql = new StringBuilder("SELECT AddGeometryColumn('"); + sql = new StringBuilder("SELECT \"public\".AddGeometryColumn('"); sql.append(dbSchema); sql.append("','"); sql.append(tableName); @@ -290,10 +305,22 @@ Connection con = getConnection(); - boolean shouldDrop = tablePresent(tableName, con); + boolean shouldDrop = tablePresent(getTargetSchema(), tableName, con); if (shouldDrop) { - String sqlStr = "DROP TABLE " + encodeSchemaTableName(tableName) + ";"; + String sqlStr; + for (AttributeType anAttributeType : attributeType) + { + if (!(anAttributeType instanceof GeometryAttributeType)) + { + continue; + } + GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType; + sqlStr = dropGeometryColumn(getTargetSchema(), tableName, geomAttribute.getLocalName()); + getLogger().info(sqlStr); + result.add(sqlStr); + } + sqlStr = "DROP TABLE " + encodeSchemaTableName(tableName) + ";"; getLogger().info(sqlStr); result.add(sqlStr); } @@ -315,13 +342,6 @@ continue; } GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType; - - if (shouldDrop) - { - sqlStr = dropGeometryColumn("", tableName, geomAttribute.getLocalName()); - getLogger().info(sqlStr); - result.add(sqlStr); - } CoordinateReferenceSystem refSys = geomAttribute.getCoordinateSystem(); int SRID; @@ -349,18 +369,19 @@ SRID = -1; } - sqlStr = addGeometryColumn("", tableName, geomAttribute, SRID); + sqlStr = addGeometryColumn(getTargetSchema(), tableName, geomAttribute, SRID); getLogger().info(sqlStr); result.add(sqlStr); String indexName = tableName.replace('-', '_'); //also build a spatial index on each geometry column. - sql = new StringBuffer("CREATE INDEX spatial_"); + sql = new StringBuffer("CREATE INDEX \""); + sql.append("spatial_"); sql.append(indexName); sql.append("_"); sql.append(anAttributeType.getLocalName().toLowerCase()); - sql.append(" ON "); + sql.append("\" ON "); sql.append(encodeSchemaTableName(tableName)); sql.append(" USING GIST ("); sql.append(encodeSchemaColumnName(anAttributeType.getLocalName())); @@ -375,7 +396,7 @@ return result; } - private boolean tablePresent(String table, Connection conn) throws IOException + private boolean tablePresent(String schema, String table, Connection conn) throws IOException { final int TABLE_NAME_COL = 3; @@ -386,7 +407,7 @@ DatabaseMetaData meta = conn.getMetaData(); String[] tableType = {"TABLE"}; ResultSet tables = meta.getTables(null, - targetDataStore.getDatabaseSchemaName(), "%", tableType); + schema, "%", tableType); while (tables.next()) { @@ -695,7 +716,7 @@ } public String encodeSchemaTableName(String tableName) { - return schemaEnabled ? ("\"" + targetDataStore.getDatabaseSchemaName() + "\".\"" + tableName + "\"") + return schemaEnabled ? ("\"" + getTargetSchema() + "\".\"" + tableName + "\"") : ("\"" + tableName + "\""); } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java index 7c48de5..a429deb 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java @@ -57,9 +57,9 @@ private String _filterConfig; private boolean withIndex = false; - public DummyFeatureConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String filterConfig) + public DummyFeatureConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, String filterConfig) { - super(dataPath, targetDataStore); + super(dataPath, targetDataStore, targetSchema); txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); _filterConfig = filterConfig; elementDispatcher = createElementDispatcher(); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java index 2ac1836..4e93c22 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java @@ -51,9 +51,9 @@ private String _filterConfig; private boolean withIndex = false; - public FeatureDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String filterConfig) + public FeatureDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, String filterConfig) { - super(dataPath, targetDataStore); + super(dataPath, targetDataStore, targetSchema); txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); _filterConfig = filterConfig; elementDispatcher = createElementDispatcher(); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java index 9e0e019..b10b4ce 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java @@ -61,9 +61,9 @@ private int accumulate = 0; - public GeneralDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore) + public GeneralDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema) { - super(dataPath, targetDataStore); + super(dataPath, targetDataStore, targetSchema); convertDecorator = new TWD97GeometryConverterDecorator(); } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java index 523d151..fb07f8c 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java @@ -57,9 +57,9 @@ private boolean dropTableMode = true; private int accumulate = 0; - public IndexDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore) + public IndexDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema) { - super(dataPath, targetDataStore); + super(dataPath, targetDataStore, targetSchema); } public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java index 348d2b3..6e7daae 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java @@ -31,6 +31,8 @@ import org.xml.sax.SAXException; import com.vividsolutions.jts.util.Assert; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.Geometry; import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; import com.ximple.eofms.filter.CreateFeatureTypeEventListener; @@ -40,6 +42,7 @@ import com.ximple.io.dgn7.ComplexElement; import com.ximple.io.dgn7.Element; import com.ximple.io.dgn7.FrammeAttributeData; +import com.ximple.io.dgn7.ComplexChainElement; public class OracleConvertPostGISJobContext extends AbstractOracleToPostGISJobContext implements CreateFeatureTypeEventListener @@ -75,9 +78,9 @@ private boolean dropTableMode = true; private int accumulate = 0; - public OracleConvertPostGISJobContext(String dataPath, DataStore pgDS, String filterConfig) + public OracleConvertPostGISJobContext(String dataPath, DataStore pgDS, String targetSchema, String filterConfig) { - super(dataPath, pgDS); + super(dataPath, pgDS, targetSchema); _filterConfig = filterConfig; elementDispatcher = createElementDispatcher(); elementDispatcher.addCreateFeatureTypeEventListener(this); @@ -146,7 +149,33 @@ ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size() + ":" + (linkage == null ? "NULL" : (linkage.getUfid()))); - isEmptySize = true; + if (complex.size() == 0) + isEmptySize = true; + } + + if (getElementLogging() && (!isEmptySize)) + { + getElementLogger().logElement(element, getCurrentSchema()); + } + return; + } + + if (feature.getDefaultGeometry().isEmpty()) + { + boolean isEmptySize = false; + FrammeAttributeData linkage = + AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); + logger.warn("Empty Geom Element:" + element.getElementType().toString() + + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + + (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID()))); + + if (element instanceof ComplexElement) + { + ComplexElement complex = (ComplexElement) element; + logger.warn("----Complex Element size=" + complex.size() + ":" + + (linkage == null ? "NULL" : (linkage.getUfid()))); + if (complex.size() == 0) + isEmptySize = true; } if (getElementLogging() && (!isEmptySize)) @@ -337,9 +366,9 @@ Connection conn = targetDataStore.getConnection(Transaction.AUTO_COMMIT); if (dropTableMode) { - dropGeometryColumn(conn, featureName, + dropGeometryColumn(conn, getTargetSchema(), featureName, featureType.getDefaultGeometry().getLocalName()); - dropTable(conn, featureName); + dropTable(conn, getTargetSchema(), featureName); ArrayList<String> schemaTexts = createNewSchemaTexts(featureType); for (String stmtText : schemaTexts) @@ -350,7 +379,7 @@ } } else { - deleteTable(conn, featureName); + deleteTable(conn, getTargetSchema(), featureName); } conn.close(); } catch (IOException e) @@ -362,6 +391,7 @@ } } else { + String tempStmt = null; try { Connection conn = targetDataStore.getConnection(Transaction.AUTO_COMMIT); @@ -369,15 +399,18 @@ for (String stmtText : schemaTexts) { Statement stmt = conn.createStatement(); + tempStmt = stmtText; stmt.execute(stmtText); stmt.close(); } conn.close(); } catch (IOException e) { + logger.warn("RUN--" + tempStmt); logger.warn(e.getMessage(), e); } catch (SQLException e) { + logger.warn("RUN--" + tempStmt); logger.warn(e.getMessage(), e); } } diff --git a/xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testElementFilter.xml b/xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testElementFilter.xml index 4721538..a187f52 100644 --- a/xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testElementFilter.xml +++ b/xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testElementFilter.xml @@ -813,7 +813,10 @@ <tid>210</tid> <cid>0</cid> <description>�C���a�U�ɽu</description> - <elmtype>12</elmtype> + <elementCriterion> + <elementType>4</elementType> + <elementType>12</elementType> + </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-210.C-1"> -- Gitblit v0.0.0-SNAPSHOT