KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > load > ExportWriteDataAbstract


1 /*
2
3    Derby - Class org.apache.derby.impl.load.ExportWriteDataAbstract
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.load;
23
24 abstract class ExportWriteDataAbstract {
25
26   protected ControlInfo controlFileReader;
27   protected int[] columnLengths;
28
29   protected String JavaDoc fieldSeparator;
30   protected String JavaDoc recordSeparator;
31   protected String JavaDoc nullString;
32   protected String JavaDoc columnDefinition;
33   protected String JavaDoc format;
34   protected String JavaDoc fieldStartDelimiter;
35   protected String JavaDoc fieldStopDelimiter;
36   protected String JavaDoc dataCodeset;
37   protected String JavaDoc dataLocale;
38   protected boolean hasDelimiterAtEnd;
39   protected boolean doubleDelimiter=true;
40
41   //load properties locally for faster reference to them periodically
42
protected void loadPropertiesInfo() throws Exception JavaDoc {
43     fieldSeparator = controlFileReader.getFieldSeparator();
44     recordSeparator = controlFileReader.getRecordSeparator();
45     nullString = controlFileReader.getNullString();
46     columnDefinition = controlFileReader.getColumnDefinition();
47     format = controlFileReader.getFormat();
48     fieldStartDelimiter = controlFileReader.getFieldStartDelimiter();
49     fieldStopDelimiter = controlFileReader.getFieldEndDelimiter();
50     dataCodeset = controlFileReader.getDataCodeset();
51     hasDelimiterAtEnd = controlFileReader.getHasDelimiterAtEnd();
52   }
53
54   //if control file says true for column definition, write it as first line of the
55
//data file
56
abstract void writeColumnDefinitionOptionally(String JavaDoc[] columnNames,
57                                                        String JavaDoc[] columnTypes)
58                                             throws Exception JavaDoc;
59
60   //used in case of fixed format
61
public void setColumnLengths(int[] columnLengths) {
62     this.columnLengths = columnLengths;
63   }
64
65   //write the passed row into the data file
66
public abstract void writeData(String JavaDoc[] oneRow, boolean[] isNumeric) throws Exception JavaDoc;
67
68   //if nothing more to write, then close the file and write a message of completion
69
//in message file
70
public abstract void noMoreRows() throws Exception JavaDoc;
71 }
72
Popular Tags