[ooxml-branch] Split the common ss interfaces into two sets - one that works with jdk 1.5 and has the full functionality, and another that works with jdk 1.4 and only has dummy functionality. Update build.xml to spit out two versions of the main classes, one for jdk 1.5 with the full interfaces, and one for jdk 1.4 with the dummy ones (but which is otherwise like the current behaviour). Also add readme explaining all this

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@613951 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-01-21 18:00:30 +00:00
parent f9814d58e6
commit 4bce8dfcd0
38 changed files with 445 additions and 24 deletions

View File

@ -45,6 +45,9 @@ under the License.
To build the documentation you will need to install forrest and set
the FORREST_HOME environment variable. Forrest 0.5.1 required.
You will need JDK 1.5 or newer to build much of POI. If all you want
is the core OLE2 support, then you only need JDK 1.4
TO BE COMPLETED:
@ -68,6 +71,7 @@ under the License.
<property name="main.src.test" location="src/testcases"/>
<property name="main.documentation" value="src/documentation"/>
<property name="main.output.dir" location="build/classes"/>
<property name="main14.output.dir" location="build/classes-jdk14"/>
<property name="main.output.test.dir" location="build/test-classes"/>
<property name="main.lib" location="lib"/>
<property name="ooxml.lib" location="ooxml-lib"/>
@ -120,6 +124,10 @@ under the License.
<property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
<property name="examples.testokfile" location="build/examples-testokfile.txt"/>
<!-- Common interfaces for ole2 and ooxml classes -->
<property name="interfaces.jdk14.src" location="src/ooxml/interfaces-jdk14"/>
<property name="interfaces.jdk15.src" location="src/ooxml/interfaces-jdk15"/>
<!-- Experimental OOXML support: -->
<property name="ooxml.src" location="src/ooxml/java"/>
<property name="ooxml.src.test" location="src/ooxml/testcases"/>
@ -161,18 +169,30 @@ under the License.
<property name="jar.name" value="poi"/>
<property name="version.id" value="3.0.2-beta1"/>
<property name="halt.on.test.failure" value="true"/>
<property name="jdk.version.source" value="1.3"
<property name="jdk.version.source" value="1.5"
description="JDK version of source code"/>
<property name="jdk.version.class" value="1.3"
<property name="jdk.version.class" value="1.5"
description="JDK version of generated class files"/>
<property name="jdk14.version.source" value="1.3"
description="JDK version of source code, when built on JDK 1.4"/>
<property name="jdk14.version.class" value="1.3"
description="JDK version of generated class files, when built on JDK 1.4"/>
<!-- normally use the jdk 1.5 stuff -->
<path id="main.classpath">
<pathelement location="${main.jar1.dir}"/>
<pathelement location="${main.jar2.dir}"/>
<pathelement location="${main.resource1.dir}"/>
</path>
<path id="main14.classpath">
<pathelement location="${main.jar1.dir}"/>
<pathelement location="${main.jar2.dir}"/>
<pathelement location="${main.resource1.dir}"/>
</path>
<path id="scratchpad.classpath">
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
@ -260,6 +280,7 @@ under the License.
<mkdir dir="build"/>
<mkdir dir="${main.output.dir}"/>
<mkdir dir="${main14.output.dir}"/>
<mkdir dir="${scratchpad.output.dir}"/>
<mkdir dir="${contrib.output.dir}"/>
<mkdir dir="${examples.output.dir}"/>
@ -386,8 +407,8 @@ under the License.
</xmlbean>
</target>
<target name="compile" depends="init, compile-main, compile-scratchpad,
compile-contrib, compile-examples"
<target name="compile" depends="init, compile-main, compile-main-14,
compile-scratchpad, compile-contrib, compile-examples"
description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
<target name="compile-main" depends="fail-unless-xslt-is-available">
@ -395,8 +416,9 @@ under the License.
<fileset dir="${main.resource1.dir}"/>
</copy>
<javac target="${jdk.version.class}" source="${jdk.version.source}"
failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
srcdir="${main.src}">
failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes">
<src path="${main.src}" />
<src path="${interfaces.jdk15.src}" />
<classpath refid="main.classpath"/>
</javac>
<javac target="${jdk.version.class}" source="${jdk.version.source}"
@ -410,6 +432,18 @@ under the License.
</javac>
</target>
<target name="compile-main-14" depends="fail-unless-xslt-is-available">
<copy todir="${main14.output.dir}">
<fileset dir="${main.resource1.dir}"/>
</copy>
<javac target="${jdk14.version.class}" source="${jdk14.version.source}"
failonerror="true" destdir="${main14.output.dir}" debug="on" fork="yes">
<src path="${main.src}" />
<src path="${interfaces.jdk14.src}" />
<classpath refid="main.classpath"/>
</javac>
</target>
<target name="compile-scratchpad" depends="init,compile-main">
<javac target="${jdk.version.class}" source="${jdk.version.source}"
failonerror="true" destdir="${scratchpad.output.dir}" debug="on"

View File

@ -0,0 +1,44 @@
Fun with Interfaces
-------------------
Let us consider a simple case
public Interface IFoo {}
public Interface IBar {
public IFoo getFoo();
}
public class RealFoo implements IFoo {}
public class RealBar implements IBar {
public RealFoo getFoo() { return new RealFoo(); }
}
Looks ok, doesn't it? If you access RealBar directly, you get back a
RealFoo. If you access RealBar via the IBar interface, you get back a
IFoo object instead. All looks good.
Only snag - this doesn't work with any JDK older than 1.5. If you're on
JDK 1.3 or JDK 1.4, you will get a compile time error about incompatible
return signatures.
At the moment, we're still committed to having the core of POI work on
JDK 1.3 / JDK 1.4. If you want the OOXML support, then you need to move
to JDK 1.5. This allows us a sort of work-around for the problems:
JDK 1.3 / JDK 1.4:
You can't use the OOXML stuff anyway, so you probably don't care about
the new interfaces
So, have the existing code (hssf) compile against dummy interfaces, which
don't actually provide any methods
You can't then use the interfaces, but you probably didn't want to anyway
These live in src/ooxml/interfaces-jdk14
JDK 1.5:
Compile the existing code (hssf) against full interfaces. Users can still
use the concrete HSSF classes if they want, or if they use the interfaces,
their code will work with the ooxml support too
Need to change any methods that take a concrete object (eg HSSFCell) to
take the interface (eg Cell), and cast, otherwise they're not compatible
with the interface contract (which specifies Cell not HSSFCell).
These live in src/ooxml/interfaces-jdk15

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Cell {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface CellStyle {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Color {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Comment {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface DataFormat {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Font {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Footer {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Header {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Name {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Palette {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Patriarch {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface PrintSetup {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface RichTextString {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Row {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface SharedStringSource {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Sheet {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Textbox {}

View File

@ -0,0 +1,20 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.usermodel;
public interface Workbook {}

View File

@ -19,23 +19,6 @@ package org.apache.poi.ss.usermodel;
import java.util.Iterator;
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
import org.apache.poi.hssf.util.PaneInformation;
import org.apache.poi.hssf.util.Region;
@ -724,4 +707,4 @@ public interface Sheet {
*/
Comment getCellComment(int row, int column);
}
}