On Sat, Oct 8, 2011 at 6:17 AM, Devin Han <[email protected]> wrote: > I added licence information for all of the ODF documents with the following > code written by Simple API. > > public static void main(String[] args) { > String patch = "C:\\resources"; > File directry = new File(patch); > File[] files = directry.listFiles(new FilenameFilter() { > @Override > public boolean accept(File path, String name) { > if (name.contains(".od")||name.contains(".ot")) { > return true; > } else { > return false; > } > } > }); > String license = "Licensed to the Apache Software Foundation (ASF) > under one \n"+ > "or more contributor license agreements. See the > NOTICE file \n"+ > "distributed with this work for additional > information \n"+ > "regarding copyright ownership. The ASF licenses > this file \n"+ > "to you under the Apache License, Version 2.0 (the > \n"+ > "\"License\"); you may not use this file except in > compliance \n"+ > "with the License. You may obtain a copy of the > License at \n"+ > "\n"+ > " http://www.apache.org/licenses/LICENSE-2.0 \n"+ > "\n"+ > "Unless required by applicable law or agreed to in > writing, \n"+ > "software distributed under the License is > distributed on an \n"+ > "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS > OF ANY \n"+ > "KIND, either express or implied. See the License > for the \n"+ > "specific language governing permissions and > limitations \n"+ > "under the License."; > for (File file : files) { > try { > Document doc = Document.loadDocument(file); > OdfFileDom metadom = doc.getMetaDom(); > Meta metadata = new Meta(metadom); > String key = "License"; > metadata.removeUserDefinedDataByName(key); > // > org.odftoolkit.odfdom.dom.attribute.meta.MetaValueTypeAttribute.Value > metadata.setUserDefinedData(key, Value.STRING.toString(), > license); > doc.save(file); > } catch (Exception e) { > e.printStackTrace(); > } > } > } > > Simple API is so cool, isn't it? ;) >
Yes, it is cool. This will be a useful function to have in the future as well, I think. As we add new unit tests and new test files, we will need to add license info to those files. This could be done manually, in the word processor UI, or via code like this. It might be code to have this class in a SVN, so we can use it in the future. Maybe even a 2nd class that will test an ODF file to see if it has the license in it, or one that will return the license. In the future, after we release, we could share some code with the Apache RAT project, so they could automate the testing of ODF files in projects, rather than treat them like binaries, as they do today. This would help other projects that use ODF documents, like the OpenOffice project. -Rob > 2011/9/23 Rob Weir <[email protected]> > >> I grepped for all files with IBM or Oracle copyrights. I then looked >> at what files remained that went beyond minor config files, pom.xml, >> etc. >> >> The files that remained are listed below. We'll need to make some >> effort to understand these files. For example, we can check their >> version history in Mercurial and see who checked them, and what the >> comment was. >> >> 1) If a file was an original work by an IBM employee, then IBM has the >> copyright, and an IBM project member can add the required Apache >> license and remove the IBM copyright statement >> >> 2) If a file was an original work by an Oracle employee, then Oracle >> has the copyright, and we'll look to have that file included in >> Oracle's SGA >> >> 3) If the file came from somewhere else, from another OSS project for >> example, then we should discuss further. >> >> >> trunk/odfdom/src/test/resources/xslt/concatfiles.xsl >> trunk/simple/src/test/resources/xslt/concatfiles.xsl >> >> >> trunk/odfdom/src/main/java/org/odftoolkit/odfdom/type/NonNegativeDecimal.java >> trunk/odfdom/src/main/java/org/odftoolkit/odfdom/type/OdfDataType.java >> trunk/odfdom/src/main/java/org/odftoolkit/odfdom/type/OdfFieldDataType.java >> >> trunk/odfdom/src/main/java/org/odftoolkit/odfdom/type/SignedZeroToHundredPercent.java >> >> trunk/odfdom/src/main/java/org/odftoolkit/odfdom/type/ZeroToHundredPercent.java >> trunk/odfdom/src/main/java/org/odftoolkit/odfdom/type/ZeroToOneDecimal.java >> trunk/odfdom/src/test/java/org/odftoolkit/odfdom/doc/GetTextTest.java >> >> trunk/odfdom/src/test/java/org/odftoolkit/odfdom/doc/draw/OdfDrawImageTest.java >> >> trunk/odfdom/src/test/java/org/odftoolkit/odfdom/dom/example/WikiExampleTest.java >> >> trunk/odfdom/src/test/java/org/odftoolkit/odfdom/integrationtest/PerformanceIT.java >> trunk/odfdom/src/test/java/org/odftoolkit/odfdom/pkg/PackagePathTest.java >> >> trunk/old-generator/codegen-maven-plugin/src/main/java/org/odftoolkit/odfdom/codegen_maven_plugin/CodegenMojo.java >> trunk/simple/src/main/java/org/odftoolkit/simple/text/Span.java >> >> trunk/simple/src/test/java/org/odftoolkit/simple/draw/AbstractTextboxContainerTest.java >> trunk/simple/src/test/java/org/odftoolkit/simple/draw/ImageTest.java >> >> trunk/simple/src/test/java/org/odftoolkit/simple/integrationtest/PerformanceIT.java >> >> trunk/simple/src/test/java/org/odftoolkit/simple/table/TableRowColumnTest.java >> >> trunk/validator/src/main/webapp/jsp/common/footer.jsp >> trunk/validator/src/main/webapp/jsp/common/header.jsp >> trunk/validator/src/main/webapp/jsp/common/supporter.jsp >> trunk/validator/src/main/webapp/jsp/index.jsp >> trunk/validator/src/main/webapp/jsp/info/index.jsp >> trunk/validator/src/main/webapp/jsp/info/info.jsp >> trunk/validator/src/main/webapp/jsp/validate.jsp >> > > > > -- > -Devin >
