chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1305762 [2/2] - in /chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client: ./ src/main/java/org/apache/chemistry/opencmis/client/filecopy/ src/main/java/org/apache/chemistry/opencmis/client/main/ src/main/java/org...
Date Tue, 27 Mar 2012 07:43:33 GMT
Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/resources/mapping.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/resources/mapping.properties?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/resources/mapping.properties (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/main/resources/mapping.properties Tue Mar 27 07:43:31 2012
@@ -0,0 +1,190 @@
+# 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.
+
+# configuration file how to map file metadata to CMIS types and properties
+
+mapping.contentTypes = image, mp3, pdf, office, email
+#default CMIS type id for those files/folders without a special mapping configured
+mapping.contentType.default.document = cmis:document
+mapping.contentType.default.folder = cmis:folder
+
+# configure the MIME types for each key in value of mapping.contentTypes 
+# syntax can be like image/jpeg or image/* or colon separated list image/jpeg:image/tiff:image/png
+mapping.contentType.mp3 = audio/mpeg
+mapping.contentType.image = image/jpeg
+mapping.contentType.pdf = application/pdf
+mapping.contentType.office = application/vnd.openxmlformats-officedocument.presentationml.presentation:application/vnd.openxmlformats-officedocument.presentationml.template:application/vnd.openxmlformats-officedocument.presentationml.slideshow:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:vnd.openxmlformats-officedocument.spreadsheetml.template:application/vnd.openxmlformats-officedocument.wordprocessingml.document:application/vnd.openxmlformats-officedocument.wordprocessingml.template
+mapping.contentType.email = application/vnd.ms-outlook:message/rfc822
+
+# CMIS type ids mapped to each key in value of mapping.contentTypes
+mapping.contentType.mp3.typeId = audioFile
+mapping.contentType.image.typeId = exifImage
+mapping.contentType.pdf.typeId = pdfDocument
+mapping.contentType.office.typeId = officeDocument
+mapping.contentType.email.typeId = emailDocument
+
+# classes for parsers and property mappers, usually MetadataParserTika and PropertyMapperTika
+# can be overridden with special implementations for other parsers, MetadataParserTika and
+# PropertyMapperTika are the default if not specified
+mapping.contentType.image.parserClass = org.apache.chemistry.opencmis.client.parser.MetadataParserExif
+mapping.contentType.image.mapperClass = org.apache.chemistry.opencmis.client.mapper.PropertyMapperExif
+mapping.contentType.mp3.parserClass = org.apache.chemistry.opencmis.client.parser.MetadataParserTika
+mapping.contentType.mp3.mapperClass = org.apache.chemistry.opencmis.client.mapper.PropertyMapperTika
+mapping.contentType.pdf.parserClass = org.apache.chemistry.opencmis.client.parser.MetadataParserTika
+mapping.contentType.pdf.mapperClass = org.apache.chemistry.opencmis.client.mapper.PropertyMapperTika
+mapping.contentType.office.parserClass = org.apache.chemistry.opencmis.client.parser.MetadataParserTika
+mapping.contentType.office.mapperClass = org.apache.chemistry.opencmis.client.mapper.PropertyMapperTika
+mapping.contentType.email.parserClass = org.apache.chemistry.opencmis.client.parser.MetadataParserTika
+mapping.contentType.email.mapperClass = org.apache.chemistry.opencmis.client.mapper.PropertyMapperTika
+
+# for content types that are not detected by Tika or that you want to treat differently
+# can be overridden depending on the file extension (.xyz to foo/bar)
+mapping.contentType.forceContentType.mp4 = video/mp4
+mapping.contentType.forceContentType.webm = video/webm
+
+# CMIS properties in use
+# a standard syntax for a Tika parser
+mapping.contentType.mp3.id.xmpDM\:artist = artist
+mapping.contentType.mp3.id.xmpDM\:album = album
+mapping.contentType.mp3.id.title = title
+mapping.contentType.mp3.id.xmpDM\:logComment = comment
+mapping.contentType.mp3.id.xmpDM\:genre = genre
+mapping.contentType.mp3.id.xxx = length
+mapping.contentType.mp3.id.xmpDM\:trackNumber = track
+mapping.contentType.mp3.id.xmpDM\:releaseDate = year
+mapping.contentType.mp3.id.xmpDM:composer = composer
+mapping.contentType.mp3.id.yyy = discNumber
+mapping.contentType.mp3.id.xmpDM\:audioCompressor = audioFormat
+mapping.contentType.mp3.id.xmpDM\:audioSampleRate = sampleRate
+mapping.contentType.mp3.id.xmpDM\:audioChannelType = audioChannelType
+mapping.contentType.mp3.id.channels = noChannels
+mapping.contentType.mp3.id.version = compressorVersion
+
+# images tags in exif directory
+# This is an example for a custom parser with a substructure in the tags
+mapping.contentType.image.exif.id.0x0100 = imageWidth
+mapping.contentType.image.exif.id.0x0101 = imageHeight
+mapping.contentType.image.exif.id.0x0102 = bitsPerSample
+mapping.contentType.image.exif.id.0x0103 = compression
+mapping.contentType.image.exif.id.0x0106 = photometricInterpretation
+mapping.contentType.image.exif.id.0x010e = imageDescription
+mapping.contentType.image.exif.id.0x010f = make
+mapping.contentType.image.exif.id.0x0110 = model
+mapping.contentType.image.exif.id.0x0112 = orientation       
+mapping.contentType.image.exif.id.0x011a = xResolution
+mapping.contentType.image.exif.id.0x011b = yResolution
+mapping.contentType.image.exif.id.0x0128 = resolutionUnit
+mapping.contentType.image.exif.id.0x0131 = software
+mapping.contentType.image.exif.id.0x0132 = dateTime
+mapping.contentType.image.exif.id.0x013b = artist
+mapping.contentType.image.exif.id.0x0213 = yCbCrPositioning  
+mapping.contentType.image.exif.id.0xa406 = sceneCaptureType
+mapping.contentType.image.exif.id.0x8298 = copyright
+mapping.contentType.image.exif.id.0x829a = exposureTime
+mapping.contentType.image.exif.id.0x829d = fNumber
+mapping.contentType.image.exif.id.0x8822 = exposureProgram
+mapping.contentType.image.exif.id.0x8827 = isoSpeed
+mapping.contentType.image.exif.id.0x8825 = gpsAltitudeRef-0x0005
+mapping.contentType.image.exif.id.0x882b = selfTimerMode
+mapping.contentType.image.exif.id.0x882a = timeZoneOffset
+mapping.contentType.image.exif.id.0x9003 = dateTimeOriginal
+mapping.contentType.image.exif.id.0x9004 = createDate
+mapping.contentType.image.exif.id.0x9201 = shutterSpeedValue
+mapping.contentType.image.exif.id.0x9202 = apertureValue
+mapping.contentType.image.exif.id.0x9203 = brightnessValue
+mapping.contentType.image.exif.id.0x9204 = exposureCompensation
+mapping.contentType.image.exif.id.0x9205 = maxApertureValue
+mapping.contentType.image.exif.id.0x9207 = meteringMode
+mapping.contentType.image.exif.id.0x9206 = subjectDistance
+mapping.contentType.image.exif.id.0x9208 = lightSource
+mapping.contentType.image.exif.id.0x9209 = flash
+mapping.contentType.image.exif.id.0x920a = focalLength
+mapping.contentType.image.exif.id.0x9286 = userComment
+mapping.contentType.image.exif.id.0xa001 = colorSpace
+mapping.contentType.image.exif.id.0xa002 = pixelXDimension
+mapping.contentType.image.exif.id.0xa003 = pixelYDimension
+mapping.contentType.image.exif.id.0xa402 = exposureMode
+mapping.contentType.image.exif.id.0xa403 = whiteBalance
+mapping.contentType.image.exif.id.0xa420 = imageUniqueId
+mapping.contentType.image.exif.id.0xa430 = ownerName
+mapping.contentType.image.exif.id.0xa431 = serialNumber
+mapping.contentType.image.exif.id.0x4746 = rating
+mapping.contentType.image.exif.id.0x4749 = ratingPercent
+# gps directory
+mapping.contentType.image.gps.id.0x0001 = gpsLatitudeRef
+mapping.contentType.image.gps.id.0x0002 = gpsLatitude
+mapping.contentType.image.gps.id.0x0003 = gpsLongitudeRef
+mapping.contentType.image.gps.id.0x0004 = gpsLongitude
+mapping.contentType.image.gps.id.0x0005 = gpsAltitudeRef
+mapping.contentType.image.gps.id.0x0006 = gpsAltitude
+# jpeg directory 
+mapping.contentType.image.jpeg.id.0x0000 = dataPrecision
+mapping.contentType.image.jpeg.id.0x0001 = imageHeight
+mapping.contentType.image.jpeg.id.0x0003 = imageWidth
+
+# PDF type
+mapping.contentType.pdf.id.xmpTPg\:NPages = noPages
+mapping.contentType.pdf.id.title = title
+mapping.contentType.pdf.id.author = author
+mapping.contentType.pdf.id.creator = creator
+mapping.contentType.pdf.id.Keywords = keywords
+mapping.contentType.pdf.id.producer = producer
+mapping.contentType.pdf.id.subject = subject
+mapping.contentType.pdf.id.Creation-Date = createdDate
+mapping.contentType.pdf.id.Last-Modified = modifiedDate
+mapping.contentType.pdf.id.trapped  = trapped
+
+# Office type
+mapping.contentType.office.id.Application-Name = applicationName
+mapping.contentType.office.id.Application-Version = applicationVersion
+mapping.contentType.office.id.Author = author
+mapping.contentType.office.id.Category = category
+mapping.contentType.office.id.Content-Status = contentStatus
+mapping.contentType.office.id.Comments = comments
+mapping.contentType.office.id.Company = company
+mapping.contentType.office.id.Keywords = keywords
+mapping.contentType.office.id.Last-Author = lastAuthor
+mapping.contentType.office.id.Manager = manager
+mapping.contentType.office.id.Notes = notes
+mapping.contentType.office.id.Presentation-Format = presentationFormat
+mapping.contentType.office.id.Revision-Number = revisionNumber
+mapping.contentType.office.id.Template = template
+mapping.contentType.office.id.Version = version
+mapping.contentType.office.id.Character-Count = characterCount
+mapping.contentType.office.id.Character-Count-With-Spaces = characterCountWithSpaces
+mapping.contentType.office.id.Word-Count = wordCount
+mapping.contentType.office.id.Line-Count = lineCount
+mapping.contentType.office.id.Page-Count = pageCount
+mapping.contentType.office.id.Slide-Count = slideCount
+mapping.contentType.office.id.Paragraph-Count = paragraphCount
+mapping.contentType.office.id.Total-Time = totalTime
+mapping.contentType.office.id.Edit-Time = editTime
+mapping.contentType.office.id.Creation-Date = creationDate
+mapping.contentType.office.id.Last-Save-Date = lastSaveDate
+mapping.contentType.office.id.Last-Printed = lastPrinted
+
+#email
+mapping.contentType.email.id.Message-Recipient-Address messageRecipientAddress
+mapping.contentType.email.id.Message-From = from
+mapping.contentType.email.id.Message-To = to
+mapping.contentType.email.tokenizer.to = ;
+mapping.contentType.email.id.Message-Cc = cc
+mapping.contentType.email.tokenizer.cc = ;
+mapping.contentType.email.id.Message-Bcc = bcc
+mapping.contentType.email.tokenizer.bcc = ;
+mapping.contentType.email.id.subject = subject
+mapping.contentType.email.id.Creation-Date = creationDate
+mapping.contentType.email.id.Last-Save-Date = lastSaveDate
+

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/java/org/apache/chemistry/opencmis/client/mapper/ConfiguratorTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/java/org/apache/chemistry/opencmis/client/mapper/ConfiguratorTest.java?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/java/org/apache/chemistry/opencmis/client/mapper/ConfiguratorTest.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/java/org/apache/chemistry/opencmis/client/mapper/ConfiguratorTest.java Tue Mar 27 07:43:31 2012
@@ -0,0 +1,203 @@
+/*
+ * 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.chemistry.opencmis.client.mapper;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Properties;
+
+import org.apache.chemistry.opencmis.client.parser.MetadataParser;
+import org.apache.chemistry.opencmis.client.parser.MetadataParserExif;
+import org.apache.chemistry.opencmis.client.parser.MetadataParserTika;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConfiguratorTest {
+
+    private static final Log LOG = LogFactory.getLog(ConfiguratorTest.class.getName());
+    Properties properties;
+    
+    @Before
+    public void setUp() throws Exception {
+        properties = new Properties();  
+        properties.setProperty(Configurator.PREFIX + "s", "image, audio");  
+        
+        properties.setProperty(Configurator.PREFIX + ".audio.typeId", "apache:audio");
+        properties.setProperty(Configurator.PREFIX + ".audio", "audio/mp3");  
+        properties.setProperty(Configurator.PREFIX + ".audio.class", "TikaPropertyMapper.class");  
+        properties.setProperty(Configurator.PREFIX + ".audio.id.artist", "artist");  
+        properties.setProperty(Configurator.PREFIX + ".audio.id.album", "album");  
+        properties.setProperty(Configurator.PREFIX + ".audio.id.title", "title");  
+        properties.setProperty(Configurator.PREFIX + ".audio.mapperClass",
+                "org.apache.chemistry.opencmis.client.mapper.PropertyMapperTika");
+        properties.setProperty(Configurator.PREFIX + ".audio.parserClass",
+                "org.apache.chemistry.opencmis.client.parser.MetadataParserTika");
+
+        properties.setProperty(Configurator.PREFIX + ".image", "image/jpeg");  
+        properties.setProperty(Configurator.PREFIX + ".image.typeId", "apache:image");
+        properties.setProperty(Configurator.PREFIX + ".image.id.model", "model");
+        properties.setProperty(Configurator.PREFIX + ".image.id.imageWidth", "width");
+        properties.setProperty(Configurator.PREFIX + ".image.id.imageHeight", "height");
+        properties.setProperty(Configurator.PREFIX + ".image.mapperClass",
+                "org.apache.chemistry.opencmis.client.mapper.PropertyMapperTika");
+        properties.setProperty(Configurator.PREFIX + ".image.parserClass",
+                "org.apache.chemistry.opencmis.client.parser.MetadataParserExif");
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void  testLoad() {
+        Configurator cfg = new Configurator(properties);        
+        assertTrue(cfg.getProperties().size() > 0);
+    }
+    
+    @Test
+    public void  testGetTypes() {
+        Configurator cfg = new Configurator(properties);        
+        String[] types = cfg.getTypeKeys();
+        assertEquals(2, types.length);
+        assertEquals("image", types[0]);
+        assertEquals("audio", types[1]);
+    }
+
+    @Test
+    public void  testLoadClass() {
+        Configurator cfg = new Configurator(properties);
+        PropertyMapper mapper = cfg.loadMapperClass("image");
+        assertNotNull(mapper);
+    }
+    
+    @Test
+    public void testLoadMaps() {
+        PropertyMapperTika mapper = new PropertyMapperTika();
+        String typeKey = "image";
+        String contentType = "image/jpeg";
+        assertTrue(mapper.initialize(Configurator.PREFIX, typeKey, properties));
+        mapper.buildIdMap(typeKey, properties);
+        assertEquals(3, mapper.getSize());
+        assertEquals(contentType, mapper.getContentTypes()[0]);
+        assertEquals("apache:image", mapper.getMappedTypeId());
+        assertEquals("model", mapper.getMappedPropertyId("model"));
+        assertEquals("width", mapper.getMappedPropertyId("imageWidth"));
+        assertEquals("height", mapper.getMappedPropertyId("imageHeight"));
+        
+        mapper = new PropertyMapperTika();
+        typeKey = "audio";
+        contentType = "audio/mp3";
+        assertTrue(mapper.initialize(Configurator.PREFIX, typeKey, properties));
+        mapper.buildIdMap(typeKey, properties);
+        assertEquals(3, mapper.getSize());
+        assertEquals(contentType, mapper.getContentTypes()[0]);
+        assertEquals("apache:audio", mapper.getMappedTypeId());
+        assertEquals("artist", mapper.getMappedPropertyId("artist"));
+        assertEquals("album", mapper.getMappedPropertyId("album"));
+        assertEquals("title", mapper.getMappedPropertyId("title"));
+    }
+    
+    @Test
+    public void testBuildMapperMap() {
+        Configurator cfg = new Configurator(properties);
+        cfg.buildMapperMap();
+        cfg.createParsers();
+        PropertyMapper mapper = cfg.getPropertyMapper("image/jpeg");
+        assertNotNull(mapper);
+        assertEquals("model", mapper.getMappedPropertyId("model"));
+        assertEquals("width", mapper.getMappedPropertyId("imageWidth"));
+        assertEquals("height", mapper.getMappedPropertyId("imageHeight"));
+        assertNull(mapper.getMappedPropertyId("artist"));
+        
+        mapper = cfg.getPropertyMapper("audio/mp3");
+        assertNotNull(mapper);
+        assertEquals("artist", mapper.getMappedPropertyId("artist"));
+        assertEquals("album", mapper.getMappedPropertyId("album"));
+        assertEquals("title", mapper.getMappedPropertyId("title"));
+        assertNull(mapper.getMappedPropertyId("model"));
+    }
+    
+    @Test
+    public void testParserMap() {
+        Configurator cfg = new Configurator(properties);
+        cfg.buildMapperMap();
+        cfg.createParsers();
+        MetadataParser parser = cfg.getParser("image/jpeg");
+        assertNotNull(parser);
+        assertEquals(MetadataParserExif.class, parser.getClass());
+        
+        parser = cfg.getParser("audio/mp3");
+        assertNotNull(parser);
+        assertEquals(MetadataParserTika.class, parser.getClass());
+    }
+
+    @Test
+    public void testParseContentTypeConfiguration() {
+        String typeId = "apache:image";
+        properties = new Properties();  
+        properties.setProperty(Configurator.PREFIX + "s", "image");          
+        properties.setProperty(Configurator.PREFIX + ".image", "image/jpeg");  
+        properties.setProperty(Configurator.PREFIX + ".image.typeId", typeId);
+        Configurator cfg = new Configurator(properties);
+        cfg.buildMapperMap();
+        cfg.createParsers();
+        assertNotNull(cfg.getParser("image/jpeg"));
+        assertEquals(typeId, cfg.getParser("image/jpeg").getMappedTypeId());
+        assertNull(cfg.getParser("audio/mp3"));
+        assertNull(cfg.getParser("image/x-something"));
+        
+        properties.setProperty(Configurator.PREFIX + ".image", "image/jpeg : image/tiff:image/png");  
+        cfg = new Configurator(properties);
+        cfg.buildMapperMap();
+        cfg.createParsers();
+        assertNotNull(cfg.getParser("image/jpeg"));
+        assertNotNull(cfg.getParser("image/tiff"));
+        assertNotNull(cfg.getParser("image/png"));
+        assertEquals(typeId, cfg.getParser("image/jpeg").getMappedTypeId());
+        assertEquals(typeId, cfg.getParser("image/tiff").getMappedTypeId());
+        assertEquals(typeId, cfg.getParser("image/png").getMappedTypeId());
+        assertNull(cfg.getParser("audio/mp3"));
+        assertNull(cfg.getParser("image/x-something"));
+        
+        properties.setProperty(Configurator.PREFIX + ".image", "image/*:audio/mpeg:audio/ogg");  
+        cfg = new Configurator(properties);
+        cfg.buildMapperMap();
+        cfg.createParsers();
+        assertNotNull(cfg.getParser("image/jpeg"));
+        assertEquals(typeId, cfg.getParser("image/jpeg").getMappedTypeId());
+        assertNotNull(cfg.getParser("image/tiff"));
+        assertEquals(typeId, cfg.getParser("image/tiff").getMappedTypeId());
+        assertNotNull(cfg.getParser("image/png"));
+        assertEquals(typeId, cfg.getParser("image/png").getMappedTypeId());
+        assertNotNull(cfg.getParser("image/x-something"));
+        assertEquals(typeId, cfg.getParser("image/x-something").getMappedTypeId());
+        assertNotNull(cfg.getParser("audio/mpeg"));
+        assertEquals(typeId, cfg.getParser("audio/mpeg").getMappedTypeId());
+        assertNotNull(cfg.getParser("audio/ogg"));
+        assertEquals(typeId, cfg.getParser("audio/ogg").getMappedTypeId());
+        assertNull(cfg.getParser("audio/mp3"));
+        assertNull(cfg.getParser("text/plain"));
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioPropertyDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioPropertyDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioPropertyDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioPropertyDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,90 @@
+#MP3 properties file
+string
+Artist
+artist
+Artist
+single, readwrite, optional
+
+string
+Album
+album
+title
+single, readwrite, optional
+
+string
+Title
+title
+Title
+single, readwrite, optional
+
+string
+Comment
+comment
+Comment
+single, readwrite, optional
+
+string
+Genre
+genre
+Genre
+single, readwrite, optional
+
+integer
+Length
+length
+Length in seconds
+single, readwrite, optional
+
+integer
+Track
+track
+Track in album
+single, readwrite, optional
+
+string
+Year
+year
+release date of albun
+single, readwrite, optional
+
+string
+Composer
+composer
+Composer
+single, readwrite, optional
+
+string
+Disc Number
+discNo
+number of disc / total discs
+single, readwrite, optional
+
+string
+Audio Format
+audioFormat
+Audio Format / compression scheme
+single, readwrite, optional
+
+integer
+Sample Rate
+sampleRate
+Sample Rate
+single, readwrite, optional
+
+string enum: Mono=Mono;Stereo=Stereo;5.1=5.1;7.1=7.1
+Audio Channel Type
+audioChannelType
+audio channel type
+single, readwrite, optional
+
+integer
+Number Channels
+noChannels
+number of audio channels
+single, readwrite, optional
+
+string
+Compressor Version
+compressorVersion
+version description of compressor
+single, readwrite, optional
\ No newline at end of file

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioTypeDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioTypeDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioTypeDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/AudioTypeDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,20 @@
+#EXIF type definition http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+document
+audioFile
+Audio File
+Audio Content (compressed or uncompressed)
+    Artist
+    Album
+    Title
+    Comment
+    Genre
+    Length
+    Track
+    Year
+    Composer
+    Disc Number
+    Audio Format
+    Sample Rate
+    Audio Channel Type
+    Number Channels
+    Compressor Version
\ No newline at end of file

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailPropertyDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailPropertyDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailPropertyDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailPropertyDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,48 @@
+#Email properties file
+string
+Message Recipient Address
+messageRecipientAddress
+Message Recipient Address
+single, readwrite, optional
+
+string
+From
+from
+sender of message
+single, readwrite, optional
+
+string
+To
+to
+recipients of message
+multi, readwrite, optional
+
+string
+Cc
+cc
+carbon copy recipients of message
+multi, readwrite, optional
+
+string
+Bcc
+bcc
+blind carbon copy recipients of message
+multi, readwrite, optional
+
+string
+Subject
+subject
+subjet of message
+single, readwrite, optional
+
+datetime
+Creation Date
+creationDate
+Creation Date
+single, readwrite, optional
+
+datetime
+Last Save Date
+lastSaveDate
+Last Save Date
+single, readwrite, optional

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailTypeDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailTypeDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailTypeDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/EmailTypeDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,13 @@
+#Email type definition
+document
+emailDocument
+Email Document
+Document of type Email
+    From
+    To
+    Cc
+    Bcc
+    Subject
+    Message Recipient Address
+    Creation Date
+    Last Save Date
\ No newline at end of file

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifPropertyDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifPropertyDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifPropertyDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifPropertyDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,324 @@
+#EXIF properties file
+integer
+Image Width
+imageWidth;0x0100
+Image Width
+single, oncreate, optional
+
+integer
+Image Height
+imageHeight;0x0101
+Image Height
+single, oncreate, optional
+
+integer
+Bits Per Sample
+bitsPerSample;0x0102
+Bits Per Sample
+single, oncreate, optional
+
+integer enum: 1=Uncompressed;2=CCITT 1D;3=T4/Group 3 Fax;4=T6/Group 4 Fax;5=LZW;6=JPEG (old-style);7=JPEG;8=Adobe Deflate;9=JBIG BW;10=JBIG Color;99=JPEG;262=Kodak 262;32766=Next;32767=Sony ARW Compressed;32769=Packed RAW;32770=Samsung SRW Compressed;32771=CCIRLEW;32773=PackBits;32809=Thunderscan;32867=Kodak KDC Compressed;32895=IT8CTPAD;32896=IT8LW;32897=IT8MP;32898=IT8BL;32908=PixarFilm;32909=PixarLog;32946=Deflate;32947=DCS;34661=JBIG;34676=SGILog;34677=SGILog24;34712=JPEG 2000;34713=Nikon NEF Compressed;34715=JBIG2 TIFF FX;34718=Microsoft Document Imaging (MDI) Binary Level Codec;34719=Microsoft Document Imaging (MDI) Progressive Transform Codec;34720=Microsoft Document Imaging (MDI) Vector;65000=Kodak DCR Compressed;65535=Pentax PEF Compressed
+Compression
+compression;0x0103
+Compression Format
+single, oncreate, optional
+
+integer enum: 0=WhiteIsZero;1=BlackIsZero;2=RGB;3=RGB Palette;4=Transparency Mask;5=CMYK;6=YCbCr;8=CIELab;9=ICCLab;10=ITULab;32803=Color Filter Array;32844=Pixar LogL;32845=Pixar LogLuv;34892=Linear Raw
+Photometric Interpretation
+photometricInterpretation;0x0106
+Color Format
+single, oncreate, optional
+
+string
+Image Description
+imageDescription;0x010e
+Description
+single, readwrite, optional
+	 
+string
+Make
+make;0x010f
+Camera Make
+single, readwrite, optional
+
+string
+Model
+model;0x0110
+Camera Model
+single, readwrite, optional
+
+integer enum: 1=Horizontal (normal);2=Mirror horizontal;3=Rotate 180;4=Mirror vertical;5=Mirror horizontal and rotate 270 CW;6=Rotate 90 CW;7=Mirror horizontal and rotate 90 CW;8=Rotate 270 CW
+Orientation
+orientation;0x0112
+Orientation
+single, readwrite, optional
+
+decimal
+X Resolution
+xResolution;0x011a
+x-resolution
+single, readwrite, optional
+
+decimal
+Y Resolution
+yResolution;0x011b
+y-resolution
+single, readwrite, optional
+
+integer enum: 1=None;2=inches;3=cm
+Resolution Unit
+resolutionUnit;0x0128
+Resolution Unit
+single, readwrite, optional
+
+string
+Software
+software;0x0131
+Software
+single, readwrite, optional
+
+datetime
+Modify Date
+dateTime;0x0132
+Modify Date
+single, readwrite, optional
+
+string
+Artist
+artist;0x013b
+Artist
+single, readwrite, optional
+
+integer enum: 1=Centered;2=Co-sited
+YCbCrPositioning
+yCbCrPositioning;0x0213
+YCbCr Positioning
+single, readwrite, optional
+
+string
+Copyright
+copyright;0x8298
+Copyright Notice
+single, readwrite, optional
+
+decimal
+Exposure Time
+exposureTime;0x829a
+Exposure Time
+single, oncreate, optional
+
+decimal
+F-Number
+fNumber;0x829d
+F-Stop Number
+single, oncreate, optional
+
+integer enum: 0=Not Defined;1=Manual;2=Program AE;3=Aperture-priority AE;4=Shutter speed priority AE;5=Creative (Slow speed);6=Action (High speed);7=Portrait;8=Landscape;9=Bulb
+Exposure Program
+exposureProgram;0x8822
+Exposure Program
+single, oncreate, optional
+
+integer
+ISO Speed
+isoSpeed;0x8827
+ISO Speed Setting
+single, oncreate, optional
+
+decimal
+GPS Latitude
+gpsLatitude;0x8825-0x0002
+GPS Latitude
+single, readwrite, optional
+
+string	enum: N=North;S=South
+GPS Latitude Ref
+gpsLatitudeRef;0x8825-0x0001
+GPS Latitude Reference (N/S)
+single, readwrite, optional
+
+decimal
+GPS Longitude
+gpsLongitude;0x8825-0x0004
+GPS Longitude
+single, readwrite, optional
+
+string enum: E=East;W=West
+GPS Longitude Ref
+gpsLongitudeRef;0x8825-0x0003
+GPS Longitude Reference (W/E)
+single, readwrite, optional
+
+decimal
+GPS Altitude
+gpsAltitude;0x8825-0x0006
+GPS Altitude
+single, readwrite, optional
+
+string enum: 0=Above Sea Level;1=Below Sea Level
+GPS Altitude Ref
+gpsAltitudeRef;0x8825-0x0005
+GPS Altitude Reference
+single, readwrite, optional
+
+integer
+Self Timer Mode
+selfTimerMode;0x882b
+Self Timer Mode
+single, readwrite, optional
+
+integer
+Time Zone Offset
+timeZoneOffset;0x882a
+Time Zone Offset (GMT offset in hours)
+multi, readwrite, optional
+	
+datetime
+Date Time Original
+dateTimeOriginal;0x9003
+date/time when original image was taken
+single, readwrite, optional
+
+datetime
+Create Date
+createDate;0x9004
+date/time digitized
+single, readwrite, optional
+
+decimal
+Shutter Speed Value
+shutterSpeedValue;0x9201
+shutter speed value
+single, readwrite, optional
+
+decimal
+Aperture Value
+apertureValue;0x9202
+Aperture Value
+single, readwrite, optional
+
+decimal
+Brightness Value
+brightnessValue;0x9203
+Brightness Value
+single, readwrite, optional
+
+decimal
+Exposure Compensation
+exposureCompensation;0x9204
+Exposure Compensation
+single, readwrite, optional
+
+decimal
+Max Aperture Value 	
+maxApertureValue;0x9205
+Max Aperture Value 	
+single, readwrite, optional
+
+integer enum:0=Unknown;1=Average;2=Center-weighted average;3=Spot;4=Multi-spot;5=Multi-segment;6=Partial;255=Other
+Metering Mode
+meteringMode;0x9207
+metering mode
+single, readwrite, optional
+
+decimal
+Subject Distance
+subjectDistance;0x9206
+subject distance
+single, readwrite, optional
+
+integer
+Light Source
+lightSource;0x9208
+light source value
+single, readwrite, optional
+
+integer
+Flash
+flash;0x9209
+Flash Setting
+single, readwrite, optional
+
+decimal
+Focal Length
+focalLength;0x920a
+focal length
+single, readwrite, optional
+
+string 
+User Comment
+userComment;0x9286
+user comment
+single, readwrite, optional
+
+integer enum: 1=sRGB;2=Adobe RGB;65533=Wide Gamut RGB;65534=ICC Profile;65535=Uncalibrated
+Color Space
+colorSpace;0xa001
+color space
+single, readwrite, optional
+
+integer
+PixelXDimension
+pixelXDimension;0xa002
+dimension in pixel x
+single, readwrite, optional
+
+integer
+PixelYDimension
+pixelYDimension;0xa003 
+dimension in pixel y
+single, readwrite, optional
+
+integer enum: 0=Auto;1=Manual;2=Auto bracket
+Exposure Mode
+exposureMode;0xa402
+Exposure Mode
+single, readwrite, optional
+
+integer enum: 0=Auto;1=Manual
+White Balance
+whiteBalance;0xa403
+white balance
+single, readwrite, optional
+
+integer enum: 0=Standard;1=Landscape;2=Portrait;3=Night
+Scene Capture Type
+sceneCaptureType;0xa406
+Scene Capture Type
+single, readwrite, optional
+
+id
+Image Unique Id
+imageUniqueId;0xa420
+Image Unique Id
+single, readwrite, optional
+
+string
+Owner Name
+ownerName;0xa430
+Owner Name
+single, readwrite, optional
+
+string
+Serial Number
+serialNumber;0xa431
+serial number
+single, readwrite, optional
+
+integer
+Rating
+rating;0x4746
+rating value
+single, readwrite, optional
+
+integer
+Rating Percent
+ratingPercent;0x4749
+rating percent
+single, readwrite, optional
+
+integer
+Data Precision
+dataPrecision;0x0000
+JPEG Data Precision
+single, readwrite, optional

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifTypeDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifTypeDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifTypeDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/ExifTypeDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,59 @@
+#EXIF type definition http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+document
+exifImage
+EXIF Image
+Image with EXIF tags
+    Image Width
+    Image Height
+    Bits Per Sample
+    Compression
+    Photometric Interpretation
+    Image Description
+    Make
+    Model
+    Orientation
+    X Resolution
+    Y Resolution
+    Resolution Unit
+    Software
+    Modify Date
+    Artist
+    YCbCrPositioning
+    Copyright
+    Exposure Time
+    F-Number
+    Exposure Program
+    ISO Speed
+    GPS Latitude
+    GPS Latitude Ref
+    GPS Longitude
+    GPS Longitude Ref
+    GPS Altitude
+    GPS Altitude Ref
+    Self Timer Mode
+    Time Zone Offset
+    Date Time Original
+    Create Date
+    Shutter Speed Value
+    Aperture Value
+    Brightness Value
+    Exposure Compensation
+    Max Aperture Value 	
+    Metering Mode
+    Subject Distance
+    Light Source
+    Flash
+    Focal Length
+    User Comment
+    Color Space
+    PixelXDimension
+    PixelYDimension
+    Exposure Mode
+    White Balance
+    Scene Capture Type
+    Image Unique Id
+    Owner Name
+    Serial Number
+    Rating
+    Rating Percent
+    Data Precision
\ No newline at end of file

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficePropertyDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficePropertyDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficePropertyDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficePropertyDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,162 @@
+#Office properties file
+string
+Application Name
+applicationName
+Application Name
+single, readwrite, optional
+
+string
+Application Version
+applicationVersion
+Application Version
+single, readwrite, optional
+
+string
+Author
+author
+Author
+single, readwrite, optional
+
+string
+Category
+category
+Category
+single, readwrite, optional
+
+string
+Content Status
+contentStatus
+Content Status
+single, readwrite, optional
+
+string
+Comments
+comments
+Comments
+single, readwrite, optional
+
+string
+Company
+company
+Company
+single, readwrite, optional
+
+string
+Keywords
+keywords
+Keywords
+multiple, readwrite, optional
+
+string
+Last Author
+lastAuthor
+Last Author
+single, readwrite, optional
+
+string
+Manager
+manager
+Manager
+single, readwrite, optional
+
+string
+Notes
+notes
+Notes
+single, readwrite, optional
+
+string
+Presentation Format
+presentationFormat
+Presentation Format
+single, readwrite, optional
+
+string
+Revision Number
+revisionNumber
+Revision Number
+single, readwrite, optional
+
+string
+Template
+template
+Template
+single, readwrite, optional
+
+string
+Version
+vsersion
+Version
+single, readwrite, optional
+
+integer
+Character Count
+characterCount
+Character Count
+single, readwrite, optional
+
+integer
+Character Count With Spaces
+characterCountWithSpaces
+Character Count With Spaces
+single, readwrite, optional
+
+integer
+Word Count
+wordCount
+Word Count
+single, readwrite, optional
+
+integer
+Line Count
+lineCount
+Line Count
+single, readwrite, optional
+
+integer
+Page Count
+pageCount
+Page Count
+single, readwrite, optional
+
+integer
+Slide Count
+slideCount
+Slide Count
+single, readwrite, optional
+
+integer
+Paragraph Count
+paragraphCount
+Paragraph Count
+single, readwrite, optional
+
+string
+Total Time
+totalTime
+Total Time
+single, readwrite, optional
+
+string
+Edit Time
+editTime
+Edit Time
+single, readwrite, optional
+
+datetime
+Creation Date
+creationDate
+Creation Date
+single, readwrite, optional
+
+datetime
+Last Save Date
+lastSaveDate
+Last Save Date
+single, readwrite, optional
+
+string
+Last Printed
+lastPrinted
+Last Printed
+single, readwrite, optional

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficeTypeDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficeTypeDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficeTypeDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/OfficeTypeDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,32 @@
+#Office type definition
+document
+officeDocument
+Office Document
+Document of type Office
+    Application Name
+    Application Version
+    Author
+    Category
+    Content Status
+    Comments
+    Company
+    Keywords
+    Last Author
+    Manager
+    Notes
+    Presentation Format
+    Revision Number
+    Template
+    Version
+    Character Count
+    Character Count With Spaces
+    Word Count
+    Line Count
+    Page Count
+    Slide Count
+    Paragraph Count
+    Total Time
+    Edit Time
+    Creation Date
+    Last Save Date
+    Last Printed
\ No newline at end of file

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFPropertyDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFPropertyDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFPropertyDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFPropertyDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,60 @@
+#PDF properties file
+integer
+No Pages
+noPages
+number of pages in document
+single, readwrite, optional
+
+string
+Title
+title
+titel of document
+single, readwrite, optional
+
+string
+Author
+author
+author of document
+single, readwrite, optional
+
+string
+Creator
+creator
+creator of document
+single, readwrite, optional
+
+string
+Keywords
+keywords
+keywords of document
+multi, readwrite, optional
+
+string
+Producer
+producer
+producer of document
+single, readwrite, optional
+
+string
+Subject
+subject
+subject of document
+single, readwrite, optional
+
+datetime
+Created Date
+createdDate
+creation date of document
+single, readwrite, optional
+
+datetime
+Modified Date
+modifiedDate
+date of last modification
+single, readwrite, optional
+
+string
+Trapped
+trapped
+trapped
+single, readwrite, optional

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFTypeDefinitions.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFTypeDefinitions.txt?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFTypeDefinitions.txt (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/PDFTypeDefinitions.txt Tue Mar 27 07:43:31 2012
@@ -0,0 +1,15 @@
+#PDF type definition
+document
+pdfDocument
+PDF Document
+Document of type PDF
+    No Pages
+    Title
+    Author
+    Creator
+    Keywords
+    Producer
+    Subject
+    Created Date
+    Modified Date
+    Trapped

Added: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/TypesXmlGenerator.groovy
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/TypesXmlGenerator.groovy?rev=1305762&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/TypesXmlGenerator.groovy (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-client/src/test/resources/TypesXmlGenerator.groovy Tue Mar 27 07:43:31 2012
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// 
+// Groovy script to generate a types.xml file from a text file in 
+// a simplified syntax
+// This script expects two files names TypeDefinitions.txt and 
+// PropertyDefinitions.txt in the same directory and generates
+// file types.xml that can be imported into the InMemoryServer
+// 
+////////////////////////////////////////////////////////////////////////
+
+def genCommons1(name, id, descr) {
+    def id1 = id
+    def localName = name
+    def ns = ""
+    
+    // allow syntax name;localName;namespace in property name line
+    if (id.contains(";")) {
+        names = id.tokenize(";")
+        if (names.size() > 0)
+            id1 = names[0];
+        if (names.size() > 1)
+            localName = names[1];
+        if (names.size() > 2)
+            ns = names[2];
+    }
+	outFile.println("        <id>" + id1 + "</id>")
+	outFile.println("        <localName>" + localName + "</localName>")
+	outFile.println("        <displayName>" + name + "</displayName>")
+	outFile.println("        <queryName>" + name.replaceAll(" ", "_").toUpperCase() + "</queryName>")
+	outFile.println("        <description>" + descr + "</description>")
+	outFile.println("        <localNamespace>" + ns + "</localNamespace>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genCommons2(choices, cardinality, updatability, required) {
+    def cardinalityStr 
+    def updatabilityStr
+    def requiredStr
+    
+    if (updatability.toLowerCase().startsWith("readonly"))  
+        updatabilityStr = "readonly"
+    else if (updatability.toLowerCase().startsWith("oncreate"))  
+        updatabilityStr = "oncreate"
+    else if (updatability.toLowerCase().startsWith("whencheckedout"))  
+        updatabilityStr = "whencheckedout"
+    else
+        updatabilityStr = "readwrite"
+    
+    if (required.toLowerCase().startsWith("true"))
+        requiredStr = "true"
+    else
+        requiredStr = "false"
+
+        if (cardinality.toLowerCase().startsWith("multi"))
+        cardinalityStr = "multi"
+    else
+        cardinalityStr = "single"
+    
+	outFile.println("        <cardinality>" +  cardinalityStr + "</cardinality>")
+	outFile.println("        <updatability>" + updatabilityStr + "</updatability>")
+	outFile.println("        <inherited>false</inherited>")
+	outFile.println("        <required>" + requiredStr + "</required>")
+	outFile.println("        <queryable>true</queryable>")
+	outFile.println("        <orderable>false</orderable>")
+    outFile.println("        <openChoice>false</openChoice>")
+	if (null != choices) 
+	    genChoices(choices)
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genBoolean (name, uuid, descr, choices, cardinality, updatability, required) {
+	outFile.println("    <propertyBooleanDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>boolean</propertyType>")
+	genCommons2(choices, cardinality, updatability, required)
+	outFile.println("    </propertyBooleanDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genDate (name, uuid, descr, choices, cardinality, updatability, required) {
+	outFile.println("    <propertyDateTimeDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>datetime</propertyType>")
+	genCommons2(choices, cardinality, updatability, required)
+	outFile.println("    </propertyDateTimeDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genId (name, uuid, descr, choices, cardinality, updatability, required) {
+	outFile.println("    <propertyIdDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>id</propertyType>")
+	genCommons2(choices, cardinality, updatability, required)
+	outFile.println("    </propertyIdDefinition>")
+}
+ 
+45//////////////////////////////////////////////////////////////////
+
+def genInteger (name, uuid, descr, choices, cardinality, updatability, required) {
+	outFile.println("    <propertyIntegerDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>integer</propertyType>")
+	genCommons2(choices, cardinality, updatability, required)
+	outFile.println("    </propertyIntegerDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genString (name, uuid, descr, choices, cardinality, updatability, required) {
+	outFile.println("    <propertyStringDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>string</propertyType>")
+	genCommons2(choices, cardinality, updatability, required)
+	outFile.println("    </propertyStringDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genDecimal (name, uuid, descr, choices, cardinality, updatability, required) {
+	outFile.println("    <propertyDecimalDefinition>")
+	genCommons1(name, uuid, descr)
+	outFile.println("        <propertyType>decimal</propertyType>")
+	genCommons2(choices, cardinality, updatability, required)
+	outFile.println("    </propertyDecimalDefinition>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genChoices (choices) {
+	   choices.each {
+	     keyValue = it.tokenize("=")
+		 String key = keyValue.get(0).trim()
+		 String value = keyValue.get(1).trim()
+		 // println("Found enum with key: " + key + " value: " + value)
+         outFile.println("        <choice displayName=\"" + value + "\">")
+         outFile.println("            <value>" + key + "</value>")
+         outFile.println("        </choice>")
+	   }
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genTypeDef (name, id, descr, typeKind, parentType, props) {
+
+    String xsiType
+    String baseId
+    
+    switch (typeKind) {
+        case "document":
+          xsiType = "cmisTypeDocumentDefinitionType"
+          baseId = "cmis:document"
+          break;
+        case "folder":
+          xsiType = "cmisTypeFolderDefinitionType"
+          baseId = "cmis:folder"
+          break;
+        default:
+           println("Error illegal type: " + typeKind)
+    }
+    if (parentType == null)
+      parentType = baseId
+      
+    def id1 = id
+    def localName = name
+    def ns = ""
+    
+    // allow syntax name;localName;namespace in property name line
+    if (id.contains(";")) {
+        names = id.tokenize(";")
+        if (names.size() > 0)
+            id1 = names[0];
+        if (names.length() > 1)
+            localName = names[1];
+            ns = names[2];
+    }
+
+	outFile.println("<cmisra:type xsi:type=\"" + xsiType + "\">")
+    outFile.println("    <id>" + id1 + "</id>")
+	outFile.println("    <localName>" + localName + "</localName>")
+	outFile.println("    <localNamespace>ns</localNamespace>")
+	outFile.println("    <parentId>" + parentType + "</parentId>")
+	outFile.println("    <displayName>" + name + "</displayName>")
+	outFile.println("    <queryName>" +  name.replaceAll(" ", "_").toUpperCase() + "</queryName>")
+	outFile.println("    <description>" + descr + "</description>")
+	outFile.println("    <baseId>" + baseId + "</baseId>")
+	outFile.println("    <creatable>true</creatable>")
+	outFile.println("    <fileable>true</fileable>")
+	outFile.println("    <queryable>true</queryable>")
+	outFile.println("    <fulltextIndexed>true</fulltextIndexed>")
+	outFile.println("    <includedInSupertypeQuery>true</includedInSupertypeQuery>")
+	outFile.println("    <controllablePolicy>false</controllablePolicy>")
+	outFile.println("    <controllableACL>true</controllableACL>")
+    if (typeKind == "document") {
+        outFile.println("    <versionable>false</versionable>")
+        outFile.println("    <contentStreamAllowed>notallowed</contentStreamAllowed>")
+    }
+    if (props != null)
+        props.each { 
+            def propDef = propDefsMap.get(it)
+            if (propDef != null)
+                genPropertyDef (propDef.type, propDef.name, propDef.id, propDef.descr, propDef.choices, 
+                   propDef.cardinality, propDef.updatability, propDef.required)
+             else
+                println ("Error: unknown property definition " + it + " in type definition " + name)
+        }
+	outFile.println("</cmisra:type>")
+    outFile.println()
+    outFile.flush()    
+}
+
+//////////////////////////////////////////////////////////////////
+
+def genPropertyDef(type, name, uuid, descr, choices, cardinality, updatability, required) {
+        
+    switch (type) {
+     case "boolean":
+       genBoolean(name, uuid, descr, choices, cardinality, updatability, required)
+       break
+     case "datetime":
+       genDate(name, uuid, descr, choices, cardinality, updatability, required)
+       break
+     case "id":
+       genId(name, uuid, descr, choices, cardinality, updatability, required)
+       break
+     case "integer":
+       genInteger(name, uuid, descr, choices, cardinality, updatability, required)
+       break
+     case "string":
+       genString(name, uuid, descr, choices, cardinality, updatability, required)
+       break
+     case "decimal":
+       genDecimal(name, uuid, descr, choices, cardinality, updatability, required)
+       break
+     default:
+       println("!!!Error: unknown property type " + type);
+    }
+    
+}
+
+//////////////////////////////////////////////////////////////////
+
+def readPropertiesFile(inputFile) {    
+    def propDefMap = [:]
+    def inFile = new File(inputFile).newReader() 
+    
+    while (inFile.readLine() != null) {   
+       def typeLine = inFile.readLine()
+       def name = inFile.readLine().trim()
+       println("Processing property: " + name + " type: " + typeLine)
+       def id = inFile.readLine().trim()
+       println("   id: " + id)
+       def descr = inFile.readLine().trim()
+       def attrs = inFile.readLine().trim()
+       def choices = null;
+       def cardinality, updatability, required
+       
+
+       type = typeLine.tokenize().get(0)
+       def arr = attrs.split(",")
+       cardinality = arr.length > 0 ? arr[0].trim() : null
+       updatability = arr.length > 1 ? arr[1].trim() : null
+       required = arr.length > 2 ? arr[2].trim() : null
+       
+       if (typeLine.contains("enum:")) {
+           choices = typeLine[typeLine.indexOf("enum:")+ 5..typeLine.length()-1].tokenize(";")
+       }
+       propDefMap.put(name, [name:name, id:id, descr:descr, type:type, choices:choices, cardinality:cardinality,
+               updatability:updatability, required:required])
+    }
+    
+    return propDefMap;  
+}
+
+//////////////////////////////////////////////////////////////////
+
+def readTypeDefinitions(inputFile) {
+    def typeDefMap = [:]
+    def inReader = new File(inputFile).newReader() 
+    // def inReader = new StringReader(typeDefInput)
+    def line = inReader.readLine()
+    while (line != null) {   
+       def kind = inReader.readLine().trim()
+       def idLine = inReader.readLine().trim()
+       def name = inReader.readLine().trim()
+       def descr = inReader.readLine().trim()
+       def arr = idLine.split(":")
+       def id = arr.length>0 ? arr[0].trim() : null
+       def superType = arr.length>1 ? arr[1].trim() : null
+
+       def propDefs = []
+       def readProperties = true;
+       while (readProperties) {
+           line = inReader.readLine()
+           if (line != null && line.size() > 0) 
+               propDefs.push(line.trim())
+           else
+              readProperties = false;
+       }
+       println("Reading type def " + name)
+       typeDefMap.put(name, [name: name, id: id, kind: kind, super: superType, descr: descr, props: propDefs])
+    }
+    return typeDefMap
+}
+
+//////////////////////////////////////////////////////////////////
+
+def writeTypes(typeDefsMap) {
+    outFile.println("<chem:typeDefinitions xmlns=\"http://docs.oasis-open.org/ns/cmis/core/200908/\"")
+    outFile.println("     xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\"")
+    outFile.println("     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"")
+    outFile.println("     xmlns:chem=\"http://chemistry.apache.org/schemas/TypeDefnitions\">")
+    for ( e in typeDefsMap   ) {
+        println("generating type" +  e.value.name)  
+        genTypeDef (e.value.name, e.value.id, e.value.descr, e.value.kind, e.value.super, e.value.props) 
+    }
+    outFile.println("</chem:typeDefinitions>")
+}
+
+//////////////////////////////////////////////////////////////////
+
+def writePropDefs(propDefsMap) {
+    for ( e in propDefsMap   ) {
+        println("generating property" +  e.value.name)  
+        
+        genPropertyDef (e.value.type, e.value.name, e.value.id, e.value.descr, e.value.choices,
+            e.value.cardinality, e.value.updatability, e.value.required) 
+    }
+}
+
+//////////////////////////////////////////////////////////////////
+//  Main program
+
+println("Starting...")
+
+outFile = new File("types.xml").newPrintWriter()
+typeDefsMap = readTypeDefinitions("TypeDefinitions.txt")
+propDefsMap = readPropertiesFile("PropertyDefinitions.txt")
+      
+outFile.println("<!-- Generated Output file with type definitions. Do not edit! -->")
+writeTypes(typeDefsMap)
+outFile.close()
+println("...Done.")



Mime
View raw message