You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2011/11/02 09:49:46 UTC

svn commit: r1196504 [4/7] - in /chemistry/playground/moreq2010/moreq2010: main/ main/java/ main/java/org/ main/java/org/apache/ main/java/org/apache/chemistry/ main/java/org/apache/chemistry/moreq2010/ main/java/org/apache/chemistry/moreq2010/util/ ma...

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Main.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Main.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Main.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Main.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,145 @@
+/*
+ * 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.moreq2010.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.chemistry.moreq2010.jaxb.Export;
+import org.apache.chemistry.moreq2010.jaxb.RecordTYPE;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
+
+public class Main {
+
+    static final Log LOG = LogFactory.getLog(Main.class);
+    
+    public static void main( String[] args ) {
+
+        LOG.info("Main starting...");
+        String inputFileName = "src/test/resources/example1.xml";
+        try {
+            MoreqParserCallback cmisClient = ParserCallbackFactory.createParserCallback(CmisClient.class.getName());
+            MoreqXmlParser parser = new MoreqXmlParser(cmisClient);
+            try {
+                cmisClient.init();
+                parser.parse(inputFileName);
+            } catch (CmisBaseException e) {
+                System.err.println("Error connecting to CMIS repository :\n" + e.getErrorContent());
+            }
+            System.out.println();
+        } catch (Exception e) {
+            System.err.println("Error during parsing file: " + e);
+            e.printStackTrace();
+        }
+        LOG.debug("...Main ended.");
+    }
+    
+    public static void main2( String[] args ) {
+
+        String inputFileName = "src/test/resources/example1.xml";
+        try {
+            Main main = new Main();
+            Export export = main.parseMemory(inputFileName);
+            Dump dump = new Dump();
+            dump.dumpInfo(export, inputFileName);
+        } catch (Exception e) {
+            System.err.println("Error during parsing file: " + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    
+    public static void main3( String[] args ) {
+
+        String inputFileName = "src/test/resources/example2.xml";
+        try {
+            Main main = new Main();
+            Export export = main.parseMemory(inputFileName);
+            inputFileName = "src/test/resources/example2.xml";
+            export = main.parseMemory(inputFileName);
+            Dump dump = new Dump();
+            dump.dumpInfo(export, inputFileName);
+        } catch (Exception e) {
+            System.err.println("Error during parsing file: " + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    
+    private Export parseMemory( String inputFileName ) throws JAXBException, SAXException
+    {
+        JAXBContext jc = JAXBContext.newInstance("org.apache.chemistry.moreq2010.jaxb");
+        Unmarshaller unmarshaller = jc.createUnmarshaller();
+        File inputFile = new File(inputFileName);
+        Export export = (Export) unmarshaller.unmarshal(inputFile);
+        System.gc(); System.gc();
+        System.out.println("Parsed object from XML file: " + inputFileName);
+        return export;
+    }
+    
+    private void parseStreaming( String inputFileName ) throws FileNotFoundException, XMLStreamException, JAXBException {
+        // Parse the data, filtering out the start elements
+        XMLInputFactory xmlif = XMLInputFactory.newInstance();
+        FileReader fr = new FileReader(inputFileName);
+        XMLEventReader xmler = xmlif.createXMLEventReader(fr);
+        EventFilter filter = new EventFilter() {
+            public boolean accept(XMLEvent event) {
+                boolean result = false;
+                if (event.isStartElement()) {
+                    System.out.println("Received XML parse event: " + event.asStartElement().getName());
+                    result = event.asStartElement().getName().getLocalPart().equals("Record");
+                }
+                return result;
+            }
+        };
+        XMLEventReader xmlfer = xmlif.createFilteredReader(xmler, filter);    
+        JAXBContext ctx = JAXBContext.newInstance("org.apache.chemistry.moreq2010.jaxb");
+        Unmarshaller um = ctx.createUnmarshaller();
+        Dump dump = new Dump();
+        XMLEvent event;
+        while ((event = xmlfer.peek()) != null) {
+            String eventElementName = event.asStartElement().getName().getLocalPart();
+            System.out.println("Received XML parse event: " + eventElementName);
+            if (eventElementName.equals("Record")) {
+                Object o = um.unmarshal(xmler);
+//                System.out.println("Found: " + o.getClass().getSimpleName());
+                JAXBElement<RecordTYPE> je = (JAXBElement<RecordTYPE>) o;
+                RecordTYPE record = je.getValue();
+                dump.dump(record, 0);
+            } else {
+                xmlfer.nextEvent();
+            }
+        }
+        
+        System.gc(); System.gc();
+        System.out.println("Parsed object from XML file: " + inputFileName);
+    }
+}
\ No newline at end of file

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ModuleDescription.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ModuleDescription.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ModuleDescription.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ModuleDescription.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,70 @@
+/*
+ * 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.moreq2010.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+class ModuleDescription {
+    
+    private final String name;
+    private final UUID id;
+    public static enum ModuleEnum {
+        GUI_MODULE, API_MODULE, HIERARCICAL_CLASSIFICATION_MODULE,  HIERARCICAL_CLASS_MODULE,
+        ELECTRONIC_COMPONENT_MODULE
+    };
+    
+    private final ModuleEnum key;
+    
+    private static Map<String, ModuleDescription> MAP = new HashMap<String, ModuleDescription>() {{
+            put(Constants.GUI_MODULE, new ModuleDescription("Graphical User Interface (GUI)", Constants.GUI_MODULE,
+                    ModuleEnum.GUI_MODULE));
+            put(Constants.API_MODULE, new ModuleDescription("Application Programming Interface (API)", Constants.API_MODULE,
+                    ModuleEnum.API_MODULE));
+            put(Constants.HIERARCICAL_CLASSIFICATION_MODULE, new ModuleDescription("Hierarchical Classification",
+                    Constants.HIERARCICAL_CLASSIFICATION_MODULE, ModuleEnum.HIERARCICAL_CLASSIFICATION_MODULE));
+            put(Constants.HIERARCICAL_CLASS_MODULE, new ModuleDescription("Hierarchical Class", Constants.HIERARCICAL_CLASS_MODULE,
+                    ModuleEnum.HIERARCICAL_CLASS_MODULE));
+            put(Constants.ELECTRONIC_COMPONENT_MODULE, new ModuleDescription("Electronic Components",
+                    Constants.ELECTRONIC_COMPONENT_MODULE, ModuleEnum.ELECTRONIC_COMPONENT_MODULE));
+    }};
+    
+    public static final ModuleDescription getModuleInfo(String id) {
+        return MAP.get(id);
+    }
+    
+    public ModuleDescription (String name, String id, ModuleEnum key) {
+        this.name = name;
+        this.id = UUID.fromString(id);
+        this.key = key;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public String getId() {
+        return id.toString();
+    }
+    
+    ModuleEnum getKey() {
+        return key;
+    }
+}

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqParserCallback.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqParserCallback.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqParserCallback.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqParserCallback.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,65 @@
+/*
+ * 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.moreq2010.util;
+
+import org.apache.chemistry.moreq2010.jaxb.AggregationTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ClassTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualdefinitionTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalholdTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalscheduleTYPE;
+import org.apache.chemistry.moreq2010.jaxb.EventTYPE;
+import org.apache.chemistry.moreq2010.jaxb.Export;
+import org.apache.chemistry.moreq2010.jaxb.GroupTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RecordTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RoleTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplateTYPE;
+import org.apache.chemistry.moreq2010.jaxb.UserTYPE;
+
+public interface MoreqParserCallback {
+    
+    Object[] getContext();
+    
+    void init();
+    
+    void onExportBegin(Export export, Object... context);
+        
+    void onExportEnd(Export export, Object... context);
+
+    void onAggregation(AggregationTYPE agg, Object... context);
+
+    void onRecord(RecordTYPE records, Object... context);
+
+    void onClass(ClassTYPE clazz, Object... context);
+    
+    void onTemplate(TemplateTYPE templ, Object... context);
+    
+    void onDisposalHold(DisposalholdTYPE hold, Object... context);
+    
+    void onDisposalSchedule(DisposalscheduleTYPE schedule, Object... context);
+    
+    void onRole(RoleTYPE role, Object... context);
+    
+    void onUser(UserTYPE user, Object... context);
+    
+    void onGroup(GroupTYPE group, Object... context);
+    
+    void onContextualDefinition(ContextualdefinitionTYPE ctx, Object... context);
+    
+    void onEvent(EventTYPE event, Object... context);
+}

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqXmlParser.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqXmlParser.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqXmlParser.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/MoreqXmlParser.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,186 @@
+/*
+ * 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.moreq2010.util;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.chemistry.moreq2010.jaxb.AggregationTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ClassTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ComplianceTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualdefinitionTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualmetadataTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalholdTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalscheduleTYPE;
+import org.apache.chemistry.moreq2010.jaxb.EventTYPE;
+import org.apache.chemistry.moreq2010.jaxb.Export;
+import org.apache.chemistry.moreq2010.jaxb.GroupTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RecordTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RoleTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplateTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TextualTYPE;
+import org.apache.chemistry.moreq2010.jaxb.UserTYPE;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class MoreqXmlParser {
+    
+    static final Log LOG = LogFactory.getLog(MoreqXmlParser.class);
+
+    private static String NAMESPACE_MOREQ2010 = "http://moreq2010.eu/export";
+    private static Set<QName> SET = new HashSet<QName>() {{
+        add(new QName(NAMESPACE_MOREQ2010, "Export"));
+        add(new QName(NAMESPACE_MOREQ2010, "Class"));
+        add(new QName(NAMESPACE_MOREQ2010, "Record"));
+        add(new QName(NAMESPACE_MOREQ2010, "Aggregation"));
+        add(new QName(NAMESPACE_MOREQ2010, "ContextualDefinition"));
+        add(new QName(NAMESPACE_MOREQ2010, "DisposalHold"));
+        add(new QName(NAMESPACE_MOREQ2010, "DisposalSchedule"));
+        add(new QName(NAMESPACE_MOREQ2010, "Event"));
+        add(new QName(NAMESPACE_MOREQ2010, "Group"));
+        add(new QName(NAMESPACE_MOREQ2010, "Record"));
+        add(new QName(NAMESPACE_MOREQ2010, "Role"));
+        add(new QName(NAMESPACE_MOREQ2010, "User"));
+        add(new QName(NAMESPACE_MOREQ2010, "Template"));
+        // sub elements on top level to fill export object:
+        add(new QName(NAMESPACE_MOREQ2010, "ExportComment"));
+        add(new QName(NAMESPACE_MOREQ2010, "ExportCommencing"));
+        add(new QName(NAMESPACE_MOREQ2010, "Compliance"));
+        add(new QName(NAMESPACE_MOREQ2010, "ContextualMetadataDefinitions"));
+        add(new QName(NAMESPACE_MOREQ2010, "ExportId"));
+        add(new QName(NAMESPACE_MOREQ2010, "ExportCompleted"));
+    }};
+    
+    private MoreqParserCallback callback;
+    private Object[] context;
+    
+    public MoreqXmlParser(MoreqParserCallback cb) {
+        callback = cb;
+        context = cb.getContext();
+    }
+    
+    public void parse( String inputFileName ) throws FileNotFoundException, XMLStreamException, JAXBException {
+        // Parse the data, filtering out the start elements
+        XMLInputFactory xmlif = XMLInputFactory.newInstance();
+        FileReader fr = new FileReader(inputFileName);
+        XMLEventReader xmler = xmlif.createXMLEventReader(fr);
+        EventFilter filter = new EventFilter() {
+            public boolean accept(XMLEvent event) {
+                boolean result = false;
+                if (event.isStartElement()) {
+                    result = SET.contains(event.asStartElement().getName()); 
+                }
+                return result;
+            }
+        };
+        XMLEventReader xmlfer = xmlif.createFilteredReader(xmler, filter);    
+        JAXBContext ctx = JAXBContext.newInstance("org.apache.chemistry.moreq2010.jaxb");
+        Unmarshaller um = ctx.createUnmarshaller();
+        XMLEvent event;
+        Export export = new Export();
+        while ((event = xmlfer.peek()) != null) {
+            QName eventElementName = event.asStartElement().getName();
+//            LOG.debug("Received XML parse event: " + eventElementName);
+            if (SET.contains(eventElementName)) {
+                Object o = null;
+                String tagName = event.asStartElement().getName().getLocalPart();
+                if (tagName.equals("Export")) {
+                    event = xmlfer.nextEvent();
+                } else if (tagName.equals("ExportComment")) {
+                    JAXBElement<TextualTYPE> j1 = um.unmarshal(xmler, TextualTYPE.class);
+                    export.setExportComment(j1.getValue());
+                } else if (tagName.equals("ExportCommencing")) {
+                    JAXBElement<XMLGregorianCalendar> j2 = um.unmarshal(xmler, XMLGregorianCalendar.class);
+                    export.setExportCommencing(j2.getValue());
+                } else if (tagName.equals("Compliance")) {
+                    JAXBElement<ComplianceTYPE> j3 = um.unmarshal(xmler, ComplianceTYPE.class);
+                    export.setCompliance(j3.getValue());
+                } else if (tagName.equals("ContextualMetadataDefinitions")) {
+                    JAXBElement<String> j3 = um.unmarshal(xmler, String.class);
+                    export.setExportId(j3.getValue());
+                } else if (tagName.equals("ExportId")) {
+                    JAXBElement<ContextualmetadataTYPE> j4 = um.unmarshal(xmler, ContextualmetadataTYPE.class);
+                    export.setContextualMetadataDefinitions(j4.getValue());
+                } else if (tagName.equals("ExportCompleted")) {
+                    JAXBElement<XMLGregorianCalendar> j5 = um.unmarshal(xmler, XMLGregorianCalendar.class);
+                    export.setExportCompleted(j5.getValue());
+                    callback.onExportEnd(export, context); // last tag 
+                } else {
+                    JAXBElement<Object> je = (JAXBElement<Object>) um.unmarshal(xmler);;
+                    o = je.getValue();
+                
+                    Class<?> clazz = o.getClass();
+                    if (clazz.equals(AggregationTYPE.class)) {
+                        callback.onExportBegin(export, context);
+                        callback.onAggregation((AggregationTYPE)o, context);
+                    } else if (clazz.equals(RecordTYPE.class)) {
+                        callback.onRecord((RecordTYPE)o, context);
+                    } else if (clazz.equals(ClassTYPE.class)) {
+                        callback.onClass((ClassTYPE)o, context);
+                    } else if (clazz.equals(TemplateTYPE.class)) {
+                        callback.onTemplate((TemplateTYPE)o, context);
+                    } else if (clazz.equals(DisposalholdTYPE.class)) {
+                        callback.onDisposalHold((DisposalholdTYPE)o, context);
+                    } else if (clazz.equals(DisposalscheduleTYPE.class)) {
+                        callback.onDisposalSchedule((DisposalscheduleTYPE)o, context);
+                    } else if (clazz.equals(RoleTYPE.class)) {
+                        callback.onRole((RoleTYPE)o, context);
+                    } else if (clazz.equals(UserTYPE.class)) {
+                        callback.onUser((UserTYPE)o, context);
+                    } else if (clazz.equals(GroupTYPE.class)) {
+                        callback.onGroup((GroupTYPE)o, context);
+                    } else if (clazz.equals(ContextualdefinitionTYPE.class)) {
+                        callback.onContextualDefinition((ContextualdefinitionTYPE)o, context);
+                    } else if (clazz.equals(EventTYPE.class)) {
+                        callback.onEvent((EventTYPE)o, context);
+                    } else if (clazz.equals(EventTYPE.class)) {
+                        callback.onEvent((EventTYPE)o, context);
+                    } else if (clazz.equals(EventTYPE.class)) {
+                        callback.onEvent((EventTYPE)o, context);
+                    } else if (clazz.equals(EventTYPE.class)) {
+                        callback.onEvent((EventTYPE)o, context);
+                    } else if (clazz.equals(EventTYPE.class)) {
+                        callback.onEvent((EventTYPE)o, context);
+                    } else if (clazz.equals(EventTYPE.class)) {
+                        callback.onEvent((EventTYPE)o, context);
+                    } else {
+                        LOG.error("Error: Illegal type in XML even filter " + clazz);
+                    }
+                }
+            } else {
+                xmlfer.nextEvent();
+            }
+        }
+        
+    }
+}

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ParserCallbackFactory.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ParserCallbackFactory.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ParserCallbackFactory.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ParserCallbackFactory.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.moreq2010.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ParserCallbackFactory {
+    static final Log LOG = LogFactory.getLog(ParserCallbackFactory.class);
+
+    public static final MoreqParserCallback createParserCallback(String className ) {
+        try {
+            Class<?> clazz = Class.forName(className);
+            if (null == clazz)
+                return null;
+            Object obj;
+            obj = clazz.newInstance();
+            if (null == obj)
+                return null;
+
+            if (obj instanceof MoreqParserCallback) {
+                return (MoreqParserCallback) obj;            
+            } else {
+                return null;
+            }        
+        } catch (Exception e) {
+            LOG.error("ParserCallbackFactory failed to create parser callback for " + className);
+            LOG.error("Exception " + e);
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/PropertyDescription.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/PropertyDescription.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/PropertyDescription.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/PropertyDescription.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,327 @@
+/*
+ * 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.moreq2010.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.chemistry.moreq2010.util.PropertyDescription.PropertyEnum;
+
+public class PropertyDescription {
+    
+    private final String name;
+    private final UUID id;
+
+    public static enum PropertyEnum {
+        AGGREGATED_TIMESTAMP, APPLIED_TEMPLATE_IDENTIFIER, AUTOMATIC_DELETION_FLAG, CLASS_IDENTIFIER, CLOSED_TIMESTAMP, 
+        CONFIRMATION_PERIOD_DURATION_NUMBER, CONFIRMATION_PERIOD_INTERVAL_CODE, CONTEXTUAL_METADATA_ELEMENT_DEFINITION_IDENTIFIER, 
+        CREATED_TIMESTAMP, DATATYPE, DEFAULT_DISPOSAL_SCHEDULE_IDENTIFIER, DEFAULT_LANGUAGE_IDENTIFIER, DEFAULT_VALUE,
+        DELETED_EVENT_FUNCTION_DEFINITION_IDENTIFIER, DELETED_METADATA_ELEMENT_DEFINITION_IDENTIFIER, DESCRIPTION,
+        DESTROYED_TIMESTAMP, DISPOSAL_ACTION_CODE, DISPOSAL_ACTION_DUE_DATE, DISPOSAL_CONFIRMATION_DUE_DATE,
+        DISPOSAL_OVERDUE_ALERT_TIMESTAMP, DISPOSAL_SCHEDULE_IDENTIFIER, DUPLICATE_IDENTIFIER, ENTITY_REFERENCE_TYPE_IDENTIFIER,
+        EVENT_COMMENT, EVENT_FUNCTION_IDENTIFIER, EVENT_TIMESTAMP, EXPORT_COMMENCING_TIMESTAMP, EXPORT_COMPLETED_TIMESTAMP,
+        EXPORT_IDENTIFIER, EXPORTED_IN_FULL_FLAG, FIRST_USED_TIMESTAMP, FUNCTION_DEFINITION_IDENTIFIER, GENERATE_EVENT_FLAG,
+        GRANTED_ROLE_IDENTIFIER, GROUP_IDENTIFIER, HELD_AGGREGATION_IDENTIFIER, HELD_CLASS_IDENTIFIER, HELD_RECORD_IDENTIFIER,
+        HISTORICAL_DATE_TIME, IMPLEMENTS_MODULE_IDENTIFIER, IMPLEMENTS_SERVICE_IDENTIFIER, INCLUDE_INHERITED_ROLES_FLAG,
+        IS_ADMINISTRATIVE_ROLE_FLAG, IS_ENTITY_REFERENCE_FLAG, IS_MODIFIABLE_FLAG, IS_TEXTUAL_FLAG, LAST_ADDITION_TIMESTAMP,
+        LAST_REVIEW_COMMENT, LAST_REVIEWED_TIMESTAMP, MANDATE, MAX_LEVELS_OF_AGGREGATION, MAX_OCCURS,
+        MCRS_CERTIFICATION_IDENTIFIER, METADATA_ELEMENT_DEFINITION_IDENTIFIER, MIN_OCCURS, NEW_VALUE,
+        OVERDUE_DISPOSAL_ACTION_CODE, OVERDUE_DISPOSAL_ACTION_DUE_DATE, OVERDUE_DISPOSAL_CONFIRMATION_DUE_DATE,
+        ORIGINATED_DATE_TIME, OWNER_INFORMATION, PARENT_AGGREGATION_IDENTIFIER, PARTICIPATING_AGGREGATION_IDENTIFIER,
+        PARTICIPATING_CLASS_IDENTIFIER, PARTICIPATING_COMPONENT_IDENTIFIER, PARTICIPATING_DISPOSAL_HOLD_IDENTIFIER,
+        PARTICIPATING_DISPOSAL_SCHEDULE_IDENTIFIER, PARTICIPATING_DUPLICATE_IDENTIFIER, PARTICIPATING_ENTITY_TYPE_IDENTIFIER,
+        PARTICIPATING_EVENT_IDENTIFIER, PARTICIPATING_FUNCTION_DEFINITION_IDENTIFIER, PARTICIPATING_GROUP_IDENTIFIER, 
+        PARTICIPATING_METADATA_ELEMENT_DEFINITION_IDENTIFIER, PARTICIPATING_NEW_PARENT_IDENTIFIER, 
+        PARTICIPATING_PREVIOUS_PARENT_IDENTIFIER, PARTICIPATING_RECORD_IDENTIFIER, PARTICIPATING_ROLE_IDENTIFIER,
+        PARTICIPATING_SERVICE_IDENTIFIER, PARTICIPATING_TEMPLATE_IDENTIFIER, PARTICIPATING_USER_IDENTIFIER, 
+        PARTICIPATING_USER_OR_GROUP_IDENTIFIER, PERFORMED_BY_USER_IDENTIFIER, PRESENTATION_ORDER, PREVIOUS_VALUE,
+        RECORD_IDENTIFIER, RESCINDED_ROLE_IDENTIFIER, RETAIN_ON_DESTRUCTION_FLAG, RETENTION_PERIOD_DURATION_NUMBER,
+        RETENTION_PERIOD_INTERVAL_CODE, RETENTION_PERIOD_OFFSET_CODE, RETENTION_PERIOD_OFFSET_MONTH_CODE,
+        RETENTION_START_DATE, RETENTION_TRIGGER_CODE, RETENTION_TRIGGER_ELEMENT_IDENTIFIER, ROLE_IDENTIFIER, 
+        SCOPE_NOTES, SEARCH_QUERY, SUPPLIER_INFORMATION, SYSTEM_IDENTIFIER, TEMPLATE_CLASS_IDENTIFIER, 
+        TEMPLATE_ENTITY_TYPE_IDENTIFIER, TEMPLATE_SERVICE_IDENTIFIER, TITLE, TOTAL_ENTITIES, TRANSFERRED_TIMESTAMP,
+        USER_OR_GROUP_IDENTIFIER
+    };
+    
+    private final PropertyEnum key;
+    
+    private static Map<String, PropertyDescription> MAP = new HashMap<String, PropertyDescription>() {{
+            put(Constants.AGGREGATED_TIMESTAMP, new PropertyDescription("Aggregated Timestamp",
+                    Constants.AGGREGATED_TIMESTAMP, PropertyEnum.AGGREGATED_TIMESTAMP));
+            put(Constants.AGGREGATED_TIMESTAMP, new PropertyDescription("Aggregated Timestamp",
+                    Constants.AGGREGATED_TIMESTAMP, PropertyEnum.AGGREGATED_TIMESTAMP));
+            put(Constants.APPLIED_TEMPLATE_IDENTIFIER, new PropertyDescription("Applied Template Identifier",
+                    Constants.APPLIED_TEMPLATE_IDENTIFIER, PropertyEnum.APPLIED_TEMPLATE_IDENTIFIER));
+            put(Constants.AUTOMATIC_DELETION_FLAG, new PropertyDescription("Automatic Deletion Flag",
+                    Constants.AUTOMATIC_DELETION_FLAG, PropertyEnum.AUTOMATIC_DELETION_FLAG));
+            put(Constants.CLASS_IDENTIFIER, new PropertyDescription("Class Identifier", Constants.CLASS_IDENTIFIER,
+                    PropertyEnum.CLASS_IDENTIFIER));
+            put(Constants.CLOSED_TIMESTAMP, new PropertyDescription("Closed Timestamp", Constants.CLOSED_TIMESTAMP,
+                    PropertyEnum.CLOSED_TIMESTAMP));
+            put(Constants.CONFIRMATION_PERIOD_DURATION_NUMBER, new PropertyDescription(
+                    "Confirmation Period Duration Number", Constants.CONFIRMATION_PERIOD_DURATION_NUMBER,
+                    PropertyEnum.CONFIRMATION_PERIOD_DURATION_NUMBER));
+            put(Constants.CONFIRMATION_PERIOD_INTERVAL_CODE, new PropertyDescription(
+                    "Confirmation Period Interval Code", Constants.CONFIRMATION_PERIOD_INTERVAL_CODE,
+                    PropertyEnum.CONFIRMATION_PERIOD_INTERVAL_CODE));
+            put(Constants.CONTEXTUAL_METADATA_ELEMENT_DEFINITION_IDENTIFIER, new PropertyDescription(
+                    "Contextual Metadata Element Definition Identifier",
+                    Constants.CONTEXTUAL_METADATA_ELEMENT_DEFINITION_IDENTIFIER,
+                    PropertyEnum.CONTEXTUAL_METADATA_ELEMENT_DEFINITION_IDENTIFIER));
+            put(Constants.CREATED_TIMESTAMP, new PropertyDescription("Created Timestamp", Constants.CREATED_TIMESTAMP,
+                    PropertyEnum.CREATED_TIMESTAMP));
+            put(Constants.DATATYPE, new PropertyDescription("Datatype", Constants.DATATYPE, PropertyEnum.DATATYPE));
+            put(Constants.DEFAULT_DISPOSAL_SCHEDULE_IDENTIFIER, new PropertyDescription(
+                    "Default Disposal Schedule Identifier", Constants.DEFAULT_DISPOSAL_SCHEDULE_IDENTIFIER,
+                    PropertyEnum.DEFAULT_DISPOSAL_SCHEDULE_IDENTIFIER));
+            put(Constants.DEFAULT_LANGUAGE_IDENTIFIER, new PropertyDescription("Default Language Identifier",
+                    Constants.DEFAULT_LANGUAGE_IDENTIFIER, PropertyEnum.DEFAULT_LANGUAGE_IDENTIFIER));
+            put(Constants.DEFAULT_VALUE, new PropertyDescription("Default Value", Constants.DEFAULT_VALUE,
+                    PropertyEnum.DEFAULT_VALUE));
+            put(Constants.DELETED_EVENT_FUNCTION_DEFINITION_IDENTIFIER, new PropertyDescription(
+                    "Deleted Event Function Definition Identifier",
+                    Constants.DELETED_EVENT_FUNCTION_DEFINITION_IDENTIFIER,
+                    PropertyEnum.DELETED_EVENT_FUNCTION_DEFINITION_IDENTIFIER));
+            put(Constants.DELETED_METADATA_ELEMENT_DEFINITION_IDENTIFIER, new PropertyDescription(
+                    "Deleted Metadata Element Definition Identifier",
+                    Constants.DELETED_METADATA_ELEMENT_DEFINITION_IDENTIFIER,
+                    PropertyEnum.DELETED_METADATA_ELEMENT_DEFINITION_IDENTIFIER));
+            put(Constants.DESCRIPTION, new PropertyDescription("Description", Constants.DESCRIPTION,
+                    PropertyEnum.DESCRIPTION));
+            put(Constants.DESTROYED_TIMESTAMP, new PropertyDescription("Destroyed Timestamp",
+                    Constants.DESTROYED_TIMESTAMP, PropertyEnum.DESTROYED_TIMESTAMP));
+            put(Constants.DISPOSAL_ACTION_CODE, new PropertyDescription("Disposal Action Code",
+                    Constants.DISPOSAL_ACTION_CODE, PropertyEnum.DISPOSAL_ACTION_CODE));
+            put(Constants.DISPOSAL_ACTION_DUE_DATE, new PropertyDescription("Disposal Action Due Date",
+                    Constants.DISPOSAL_ACTION_DUE_DATE, PropertyEnum.DISPOSAL_ACTION_DUE_DATE));
+            put(Constants.DISPOSAL_CONFIRMATION_DUE_DATE, new PropertyDescription("Disposal Confirmation Due Date",
+                    Constants.DISPOSAL_CONFIRMATION_DUE_DATE, PropertyEnum.DISPOSAL_CONFIRMATION_DUE_DATE));
+            put(Constants.DISPOSAL_OVERDUE_ALERT_TIMESTAMP, new PropertyDescription("Disposal Overdue Alert Timestamp",
+                    Constants.DISPOSAL_OVERDUE_ALERT_TIMESTAMP, PropertyEnum.DISPOSAL_OVERDUE_ALERT_TIMESTAMP));
+            put(Constants.DISPOSAL_SCHEDULE_IDENTIFIER, new PropertyDescription("Disposal Schedule Identifier",
+                    Constants.DISPOSAL_SCHEDULE_IDENTIFIER, PropertyEnum.DISPOSAL_SCHEDULE_IDENTIFIER));
+            put(Constants.DUPLICATE_IDENTIFIER, new PropertyDescription("Duplicate Identifier",
+                    Constants.DUPLICATE_IDENTIFIER, PropertyEnum.DUPLICATE_IDENTIFIER));
+            put(Constants.ENTITY_REFERENCE_TYPE_IDENTIFIER, new PropertyDescription("Entity Reference Type Identifier",
+                    Constants.ENTITY_REFERENCE_TYPE_IDENTIFIER, PropertyEnum.ENTITY_REFERENCE_TYPE_IDENTIFIER));
+            put(Constants.EVENT_COMMENT, new PropertyDescription("Event Comment", Constants.EVENT_COMMENT,
+                    PropertyEnum.EVENT_COMMENT));
+            put(Constants.EVENT_FUNCTION_IDENTIFIER, new PropertyDescription("Event Function Identifier",
+                    Constants.EVENT_FUNCTION_IDENTIFIER, PropertyEnum.EVENT_FUNCTION_IDENTIFIER));
+            put(Constants.EVENT_TIMESTAMP, new PropertyDescription("Event Timestamp", Constants.EVENT_TIMESTAMP,
+                    PropertyEnum.EVENT_TIMESTAMP));
+            put(Constants.EXPORT_COMMENCING_TIMESTAMP, new PropertyDescription("Export Commencing Timestamp",
+                    Constants.EXPORT_COMMENCING_TIMESTAMP, PropertyEnum.EXPORT_COMMENCING_TIMESTAMP));
+            put(Constants.EXPORT_COMPLETED_TIMESTAMP, new PropertyDescription("Export Completed Timestamp",
+                    Constants.EXPORT_COMPLETED_TIMESTAMP, PropertyEnum.EXPORT_COMPLETED_TIMESTAMP));
+            put(Constants.EXPORT_IDENTIFIER, new PropertyDescription("Export Identifier", Constants.EXPORT_IDENTIFIER,
+                    PropertyEnum.EXPORT_IDENTIFIER));
+            put(Constants.EXPORTED_IN_FULL_FLAG, new PropertyDescription("Exported In Full Flag",
+                    Constants.EXPORTED_IN_FULL_FLAG, PropertyEnum.EXPORTED_IN_FULL_FLAG));
+            put(Constants.FIRST_USED_TIMESTAMP, new PropertyDescription("First Used Timestamp",
+                    Constants.FIRST_USED_TIMESTAMP, PropertyEnum.FIRST_USED_TIMESTAMP));
+            put(Constants.FUNCTION_DEFINITION_IDENTIFIER, new PropertyDescription("Function Definition Identifier",
+                    Constants.FUNCTION_DEFINITION_IDENTIFIER, PropertyEnum.FUNCTION_DEFINITION_IDENTIFIER));
+            put(Constants.GENERATE_EVENT_FLAG, new PropertyDescription("Generate Event Flag",
+                    Constants.GENERATE_EVENT_FLAG, PropertyEnum.GENERATE_EVENT_FLAG));
+            put(Constants.GRANTED_ROLE_IDENTIFIER, new PropertyDescription("Granted Role Identifier",
+                    Constants.GRANTED_ROLE_IDENTIFIER, PropertyEnum.GRANTED_ROLE_IDENTIFIER));
+            put(Constants.GROUP_IDENTIFIER, new PropertyDescription("Group Identifier", Constants.GROUP_IDENTIFIER,
+                    PropertyEnum.GROUP_IDENTIFIER));
+            put(Constants.HELD_AGGREGATION_IDENTIFIER, new PropertyDescription("Held Aggregation Identifier",
+                    Constants.HELD_AGGREGATION_IDENTIFIER, PropertyEnum.HELD_AGGREGATION_IDENTIFIER));
+            put(Constants.HELD_CLASS_IDENTIFIER, new PropertyDescription("Held Class Identifier",
+                    Constants.HELD_CLASS_IDENTIFIER, PropertyEnum.HELD_CLASS_IDENTIFIER));
+            put(Constants.HELD_RECORD_IDENTIFIER, new PropertyDescription("Held Record Identifier",
+                    Constants.HELD_RECORD_IDENTIFIER, PropertyEnum.HELD_RECORD_IDENTIFIER));
+            put(Constants.HISTORICAL_DATE_TIME, new PropertyDescription("Historical Date Time",
+                    Constants.HISTORICAL_DATE_TIME, PropertyEnum.HISTORICAL_DATE_TIME));
+            put(Constants.IMPLEMENTS_MODULE_IDENTIFIER, new PropertyDescription("Implements Module Identifier",
+                    Constants.IMPLEMENTS_MODULE_IDENTIFIER, PropertyEnum.IMPLEMENTS_MODULE_IDENTIFIER));
+            put(Constants.IMPLEMENTS_SERVICE_IDENTIFIER, new PropertyDescription("Implements Service Identifier",
+                    Constants.IMPLEMENTS_SERVICE_IDENTIFIER, PropertyEnum.IMPLEMENTS_SERVICE_IDENTIFIER));
+            put(Constants.INCLUDE_INHERITED_ROLES_FLAG, new PropertyDescription("Include Inherited Roles Flag",
+                    Constants.INCLUDE_INHERITED_ROLES_FLAG, PropertyEnum.INCLUDE_INHERITED_ROLES_FLAG));
+            put(Constants.IS_ADMINISTRATIVE_ROLE_FLAG, new PropertyDescription("Is Administrative Role Flag",
+                    Constants.IS_ADMINISTRATIVE_ROLE_FLAG, PropertyEnum.IS_ADMINISTRATIVE_ROLE_FLAG));
+            put(Constants.IS_ENTITY_REFERENCE_FLAG, new PropertyDescription("Is Entity Reference Flag",
+                    Constants.IS_ENTITY_REFERENCE_FLAG, PropertyEnum.IS_ENTITY_REFERENCE_FLAG));
+            put(Constants.IS_MODIFIABLE_FLAG, new PropertyDescription("Is Modifiable Flag",
+                    Constants.IS_MODIFIABLE_FLAG, PropertyEnum.IS_MODIFIABLE_FLAG));
+            put(Constants.IS_TEXTUAL_FLAG, new PropertyDescription("Is Textual Flag", Constants.IS_TEXTUAL_FLAG,
+                    PropertyEnum.IS_TEXTUAL_FLAG));
+            put(Constants.LAST_ADDITION_TIMESTAMP, new PropertyDescription("Last Addition Timestamp",
+                    Constants.LAST_ADDITION_TIMESTAMP, PropertyEnum.LAST_ADDITION_TIMESTAMP));
+            put(Constants.LAST_REVIEW_COMMENT, new PropertyDescription("Last Review Comment",
+                    Constants.LAST_REVIEW_COMMENT, PropertyEnum.LAST_REVIEW_COMMENT));
+            put(Constants.LAST_REVIEWED_TIMESTAMP, new PropertyDescription("Last Reviewed Timestamp",
+                    Constants.LAST_REVIEWED_TIMESTAMP, PropertyEnum.LAST_REVIEWED_TIMESTAMP));
+            put(Constants.MANDATE, new PropertyDescription("Mandate", Constants.MANDATE, PropertyEnum.MANDATE));
+            put(Constants.MAX_LEVELS_OF_AGGREGATION, new PropertyDescription("Max Levels Of Aggregation",
+                    Constants.MAX_LEVELS_OF_AGGREGATION, PropertyEnum.MAX_LEVELS_OF_AGGREGATION));
+            put(Constants.MAX_OCCURS, new PropertyDescription("Max Occurs;", Constants.MAX_OCCURS,
+                    PropertyEnum.MAX_OCCURS));
+            put(Constants.MCRS_CERTIFICATION_IDENTIFIER, new PropertyDescription("MCRS Certification Identifier",
+                    Constants.MCRS_CERTIFICATION_IDENTIFIER, PropertyEnum.MCRS_CERTIFICATION_IDENTIFIER));
+            put(Constants.METADATA_ELEMENT_DEFINITION_IDENTIFIER, new PropertyDescription(
+                    "Metadata Element Definition Identifier", Constants.METADATA_ELEMENT_DEFINITION_IDENTIFIER,
+                    PropertyEnum.METADATA_ELEMENT_DEFINITION_IDENTIFIER));
+            put(Constants.MIN_OCCURS, new PropertyDescription("Min Occurs", Constants.MIN_OCCURS,
+                    PropertyEnum.MIN_OCCURS));
+            put(Constants.NEW_VALUE, new PropertyDescription("New Value", Constants.NEW_VALUE, PropertyEnum.NEW_VALUE));
+            put(Constants.OVERDUE_DISPOSAL_ACTION_CODE, new PropertyDescription("Overdue Disposal Action Code",
+                    Constants.OVERDUE_DISPOSAL_ACTION_CODE, PropertyEnum.OVERDUE_DISPOSAL_ACTION_CODE));
+            put(Constants.OVERDUE_DISPOSAL_ACTION_DUE_DATE, new PropertyDescription("Overdue Disposal Action Due Date",
+                    Constants.OVERDUE_DISPOSAL_ACTION_DUE_DATE, PropertyEnum.OVERDUE_DISPOSAL_ACTION_DUE_DATE));
+            put(Constants.OVERDUE_DISPOSAL_CONFIRMATION_DUE_DATE, new PropertyDescription(
+                    "Overdue Disposal Confirmation Due Date", Constants.OVERDUE_DISPOSAL_CONFIRMATION_DUE_DATE,
+                    PropertyEnum.OVERDUE_DISPOSAL_CONFIRMATION_DUE_DATE));
+            put(Constants.ORIGINATED_DATE_TIME, new PropertyDescription("Originated Date Time",
+                    Constants.ORIGINATED_DATE_TIME, PropertyEnum.ORIGINATED_DATE_TIME));
+            put(Constants.OWNER_INFORMATION, new PropertyDescription("Owner Information", Constants.OWNER_INFORMATION,
+                    PropertyEnum.OWNER_INFORMATION));
+            put(Constants.PARENT_AGGREGATION_IDENTIFIER, new PropertyDescription("Parent Aggregation Identifier",
+                    Constants.PARENT_AGGREGATION_IDENTIFIER, PropertyEnum.PARENT_AGGREGATION_IDENTIFIER));
+            put(Constants.PARTICIPATING_AGGREGATION_IDENTIFIER, new PropertyDescription(
+                    "Participating Aggregation Identifier", Constants.PARTICIPATING_AGGREGATION_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_AGGREGATION_IDENTIFIER));
+            put(Constants.PARTICIPATING_CLASS_IDENTIFIER, new PropertyDescription("Participating Class Identifier",
+                    Constants.PARTICIPATING_CLASS_IDENTIFIER, PropertyEnum.PARTICIPATING_CLASS_IDENTIFIER));
+            put(Constants.PARTICIPATING_COMPONENT_IDENTIFIER, new PropertyDescription("",
+                    Constants.PARTICIPATING_COMPONENT_IDENTIFIER, PropertyEnum.PARTICIPATING_COMPONENT_IDENTIFIER));
+            put(Constants.PARTICIPATING_DISPOSAL_HOLD_IDENTIFIER, new PropertyDescription(
+                    "Participating Disposal Hold Identifier", Constants.PARTICIPATING_DISPOSAL_HOLD_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_DISPOSAL_HOLD_IDENTIFIER));
+            put(Constants.PARTICIPATING_DISPOSAL_SCHEDULE_IDENTIFIER, new PropertyDescription(
+                    "Participating Disposal Schedule Identifier", Constants.PARTICIPATING_DISPOSAL_SCHEDULE_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_DISPOSAL_SCHEDULE_IDENTIFIER));
+            put(Constants.PARTICIPATING_DUPLICATE_IDENTIFIER, new PropertyDescription(
+                    "Participating Duplicate Identifier", Constants.PARTICIPATING_DUPLICATE_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_DUPLICATE_IDENTIFIER));
+            put(Constants.PARTICIPATING_ENTITY_TYPE_IDENTIFIER, new PropertyDescription(
+                    "Participating Entity Type Identifier", Constants.PARTICIPATING_ENTITY_TYPE_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_ENTITY_TYPE_IDENTIFIER));
+            put(Constants.PARTICIPATING_EVENT_IDENTIFIER, new PropertyDescription("Participating Event Identifier",
+                    Constants.PARTICIPATING_EVENT_IDENTIFIER, PropertyEnum.PARTICIPATING_EVENT_IDENTIFIER));
+            put(Constants.PARTICIPATING_FUNCTION_DEFINITION_IDENTIFIER, new PropertyDescription(
+                    "Participating Function Definition Identifier",
+                    Constants.PARTICIPATING_FUNCTION_DEFINITION_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_FUNCTION_DEFINITION_IDENTIFIER));
+            put(Constants.PARTICIPATING_GROUP_IDENTIFIER, new PropertyDescription("Participating Group Identifier",
+                    Constants.PARTICIPATING_GROUP_IDENTIFIER, PropertyEnum.PARTICIPATING_GROUP_IDENTIFIER));
+            put(Constants.PARTICIPATING_METADATA_ELEMENT_DEFINITION_IDENTIFIER, new PropertyDescription(
+                    "Participating Metadata Element Definition Identifier",
+                    Constants.PARTICIPATING_METADATA_ELEMENT_DEFINITION_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_METADATA_ELEMENT_DEFINITION_IDENTIFIER));
+            put(Constants.PARTICIPATING_NEW_PARENT_IDENTIFIER, new PropertyDescription(
+                    "Participating New Parent Identifier", Constants.PARTICIPATING_NEW_PARENT_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_NEW_PARENT_IDENTIFIER));
+            put(Constants.PARTICIPATING_PREVIOUS_PARENT_IDENTIFIER, new PropertyDescription(
+                    "Participating Previous Parent Identifier", Constants.PARTICIPATING_PREVIOUS_PARENT_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_PREVIOUS_PARENT_IDENTIFIER));
+            put(Constants.PARTICIPATING_RECORD_IDENTIFIER, new PropertyDescription("Participating Record Identifier",
+                    Constants.PARTICIPATING_RECORD_IDENTIFIER, PropertyEnum.PARTICIPATING_RECORD_IDENTIFIER));
+            put(Constants.PARTICIPATING_ROLE_IDENTIFIER, new PropertyDescription("Participating Role Identifier",
+                    Constants.PARTICIPATING_ROLE_IDENTIFIER, PropertyEnum.PARTICIPATING_ROLE_IDENTIFIER));
+            put(Constants.PARTICIPATING_SERVICE_IDENTIFIER, new PropertyDescription("Participating Service Identifier",
+                    Constants.PARTICIPATING_SERVICE_IDENTIFIER, PropertyEnum.PARTICIPATING_SERVICE_IDENTIFIER));
+            put(Constants.PARTICIPATING_TEMPLATE_IDENTIFIER, new PropertyDescription(
+                    "Participating Template Identifier", Constants.PARTICIPATING_TEMPLATE_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_TEMPLATE_IDENTIFIER));
+            put(Constants.PARTICIPATING_USER_IDENTIFIER, new PropertyDescription("Participating User Identifier",
+                    Constants.PARTICIPATING_USER_IDENTIFIER, PropertyEnum.PARTICIPATING_USER_IDENTIFIER));
+            put(Constants.PARTICIPATING_USER_OR_GROUP_IDENTIFIER, new PropertyDescription(
+                    "Participating User Or Group Identifier", Constants.PARTICIPATING_USER_OR_GROUP_IDENTIFIER,
+                    PropertyEnum.PARTICIPATING_USER_OR_GROUP_IDENTIFIER));
+            put(Constants.PERFORMED_BY_USER_IDENTIFIER, new PropertyDescription("Performed By User Identifier",
+                    Constants.PERFORMED_BY_USER_IDENTIFIER, PropertyEnum.PERFORMED_BY_USER_IDENTIFIER));
+            put(Constants.PRESENTATION_ORDER, new PropertyDescription("Presentation Order",
+                    Constants.PRESENTATION_ORDER, PropertyEnum.PRESENTATION_ORDER));
+            put(Constants.PREVIOUS_VALUE, new PropertyDescription("Previous Value", Constants.PREVIOUS_VALUE,
+                    PropertyEnum.PREVIOUS_VALUE));
+            put(Constants.RECORD_IDENTIFIER, new PropertyDescription("Record Identifier", Constants.RECORD_IDENTIFIER,
+                    PropertyEnum.RECORD_IDENTIFIER));
+            put(Constants.RESCINDED_ROLE_IDENTIFIER, new PropertyDescription("Rescinded Role Identifier",
+                    Constants.RESCINDED_ROLE_IDENTIFIER, PropertyEnum.RESCINDED_ROLE_IDENTIFIER));
+            put(Constants.RETAIN_ON_DESTRUCTION_FLAG, new PropertyDescription("Retain On Destruction Flag",
+                    Constants.RETAIN_ON_DESTRUCTION_FLAG, PropertyEnum.RETAIN_ON_DESTRUCTION_FLAG));
+            put(Constants.RETENTION_PERIOD_DURATION_NUMBER, new PropertyDescription("Retention Period Duration Number",
+                    Constants.RETENTION_PERIOD_DURATION_NUMBER, PropertyEnum.RETENTION_PERIOD_DURATION_NUMBER));
+            put(Constants.RETENTION_PERIOD_INTERVAL_CODE, new PropertyDescription("Retention Period Interval Code",
+                    Constants.RETENTION_PERIOD_INTERVAL_CODE, PropertyEnum.RETENTION_PERIOD_INTERVAL_CODE));
+            put(Constants.RETENTION_PERIOD_OFFSET_CODE, new PropertyDescription("Retention Period Offset Code",
+                    Constants.RETENTION_PERIOD_OFFSET_CODE, PropertyEnum.RETENTION_PERIOD_OFFSET_CODE));
+            put(Constants.RETENTION_PERIOD_OFFSET_MONTH_CODE, new PropertyDescription(
+                    "Retention Period Offset Month Code", Constants.RETENTION_PERIOD_OFFSET_MONTH_CODE,
+                    PropertyEnum.RETENTION_PERIOD_OFFSET_MONTH_CODE));
+            put(Constants.RETENTION_START_DATE, new PropertyDescription("Retention Start Date",
+                    Constants.RETENTION_START_DATE, PropertyEnum.RETENTION_START_DATE));
+            put(Constants.RETENTION_TRIGGER_CODE, new PropertyDescription("Retention Trigger Code",
+                    Constants.RETENTION_TRIGGER_CODE, PropertyEnum.RETENTION_TRIGGER_CODE));
+            put(Constants.RETENTION_TRIGGER_ELEMENT_IDENTIFIER, new PropertyDescription(
+                    "Retention Trigger Element Identifier", Constants.RETENTION_TRIGGER_ELEMENT_IDENTIFIER,
+                    PropertyEnum.RETENTION_TRIGGER_ELEMENT_IDENTIFIER));
+            put(Constants.ROLE_IDENTIFIER, new PropertyDescription("Role Identifier", Constants.ROLE_IDENTIFIER,
+                    PropertyEnum.ROLE_IDENTIFIER));
+            put(Constants.SCOPE_NOTES, new PropertyDescription("Scope Notes", Constants.SCOPE_NOTES,
+                    PropertyEnum.SCOPE_NOTES));
+            put(Constants.SEARCH_QUERY, new PropertyDescription("Search Query", Constants.SEARCH_QUERY,
+                    PropertyEnum.SEARCH_QUERY));
+            put(Constants.SUPPLIER_INFORMATION, new PropertyDescription("Supplier Information",
+                    Constants.SUPPLIER_INFORMATION, PropertyEnum.SUPPLIER_INFORMATION));
+            put(Constants.SYSTEM_IDENTIFIER, new PropertyDescription("System Identifier", Constants.SYSTEM_IDENTIFIER,
+                    PropertyEnum.SYSTEM_IDENTIFIER));
+            put(Constants.TEMPLATE_CLASS_IDENTIFIER, new PropertyDescription("Template Class Identifier",
+                    Constants.TEMPLATE_CLASS_IDENTIFIER, PropertyEnum.TEMPLATE_CLASS_IDENTIFIER));
+            put(Constants.TEMPLATE_ENTITY_TYPE_IDENTIFIER, new PropertyDescription("Template Entity Type Identifier",
+                    Constants.TEMPLATE_ENTITY_TYPE_IDENTIFIER, PropertyEnum.TEMPLATE_ENTITY_TYPE_IDENTIFIER));
+            put(Constants.TEMPLATE_SERVICE_IDENTIFIER, new PropertyDescription("Template Service Identifier",
+                    Constants.TEMPLATE_SERVICE_IDENTIFIER, PropertyEnum.TEMPLATE_SERVICE_IDENTIFIER));
+            put(Constants.TITLE, new PropertyDescription("Title", Constants.TITLE, PropertyEnum.TITLE));
+            put(Constants.TOTAL_ENTITIES, new PropertyDescription("Total Entities", Constants.TOTAL_ENTITIES,
+                    PropertyEnum.TOTAL_ENTITIES));
+            put(Constants.TRANSFERRED_TIMESTAMP, new PropertyDescription("Transferred Timestamp",
+                    Constants.TRANSFERRED_TIMESTAMP, PropertyEnum.TRANSFERRED_TIMESTAMP));
+            put(Constants.USER_OR_GROUP_IDENTIFIER, new PropertyDescription("User Or Group Identifier",
+                    Constants.USER_OR_GROUP_IDENTIFIER, PropertyEnum.USER_OR_GROUP_IDENTIFIER));
+    }};
+    
+    public static final PropertyDescription getPropertyInfo(String id) {
+        return MAP.get(id);
+    }
+    
+    public PropertyDescription (String name, String id, PropertyEnum key) {
+        this.name = name;
+        this.id = UUID.fromString(id);
+        this.key = key;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public String getId() {
+        return id.toString();
+    }
+    
+    PropertyEnum getKey() {
+        return key;
+    }
+}

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ServiceDescription.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ServiceDescription.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ServiceDescription.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/ServiceDescription.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,77 @@
+/*
+ * 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.moreq2010.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class ServiceDescription {
+    
+    private final String name;
+    private final UUID id;
+    public static enum ServiceEnum {
+        USER_GROUP_SVC_ID, MODEL_ROLE_SVC_ID, CLASSIFICATION_SVC_ID, RECORD_SVC_ID, MODEL_METADATA_SVC_ID,
+        DISPOSAL_SCHEDULING_SVC_ID, DISPOSAL_HOLDING_SVC_ID, SEARCH_REPORTING_SVC_ID, EXPORT_SVC_ID
+    } ;
+    private final ServiceEnum key;
+    
+    private static Map<String, ServiceDescription> MAP = new HashMap<String, ServiceDescription>() {{
+            put(Constants.USER_GROUP_SVC_ID, new ServiceDescription("User Group Service", Constants.USER_GROUP_SVC_ID,
+                    ServiceEnum.USER_GROUP_SVC_ID));
+            put(Constants.MODEL_ROLE_SVC_ID, new ServiceDescription("Model Role Service", Constants.MODEL_ROLE_SVC_ID,
+                    ServiceEnum.MODEL_ROLE_SVC_ID));
+            put(Constants.CLASSIFICATION_SVC_ID, new ServiceDescription("Classification Service",
+                    Constants.CLASSIFICATION_SVC_ID, ServiceEnum.CLASSIFICATION_SVC_ID));
+            put(Constants.RECORD_SVC_ID, new ServiceDescription("Record Service", Constants.RECORD_SVC_ID,
+                    ServiceEnum.RECORD_SVC_ID));
+            put(Constants.MODEL_METADATA_SVC_ID, new ServiceDescription("Model Metadata Service",
+                    Constants.MODEL_METADATA_SVC_ID, ServiceEnum.MODEL_METADATA_SVC_ID));
+            put(Constants.DISPOSAL_SCHEDULING_SVC_ID, new ServiceDescription("Disposal Scheduling Service",
+                    Constants.DISPOSAL_SCHEDULING_SVC_ID, ServiceEnum.DISPOSAL_SCHEDULING_SVC_ID));
+            put(Constants.DISPOSAL_HOLDING_SVC_ID, new ServiceDescription("Disposal Holding Service",
+                    Constants.DISPOSAL_HOLDING_SVC_ID, ServiceEnum.DISPOSAL_HOLDING_SVC_ID));
+            put(Constants.SEARCH_REPORTING_SVC_ID, new ServiceDescription("Search Reporting Service",
+                    Constants.SEARCH_REPORTING_SVC_ID, ServiceEnum.SEARCH_REPORTING_SVC_ID));
+            put(Constants.EXPORT_SVC_ID, new ServiceDescription("Export Service", Constants.EXPORT_SVC_ID,
+                    ServiceEnum.EXPORT_SVC_ID));
+    }};
+    
+    public static final ServiceDescription getServiceInfo(String id) {
+        return MAP.get(id);
+    }
+    
+    public ServiceDescription (String name, String id, ServiceEnum key) {
+        this.name = name;
+        this.id = UUID.fromString(id);
+        this.key = key;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public String getId() {
+        return id.toString();
+    }
+    
+    ServiceEnum getKey() {
+        return key;
+    }
+}

Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Validator.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Validator.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Validator.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Validator.java Wed Nov  2 08:49:45 2011
@@ -0,0 +1,68 @@
+/*
+ * 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.moreq2010.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+public class Validator {
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        File file = new File ("src/main/resources/export.xsd");
+
+        factory.setValidating(true);
+        factory.setNamespaceAware(true);
+        factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                "http://www.w3.org/2001/XMLSchema");
+        factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
+                file.toURI().toString());
+
+        System.out.println("Schema file is: " + file.toURI());
+        
+        Document doc = null;
+        try {
+            DocumentBuilder parser = factory.newDocumentBuilder();
+            String fileName = "src/test/resources/example1.xml";
+            doc = parser.parse(fileName);
+            System.out.println("Parsing of file " + fileName + " succeded.");
+            fileName = "src/test/resources/example2.xml";
+            doc = parser.parse(fileName);
+            System.out.println("Parsing of file " + fileName + " succeded.");
+        } catch (ParserConfigurationException e) {
+            System.out.println("Parser not configured: " + e.getMessage());
+        } catch (SAXException e) {
+            System.out.print("Parsing XML failed due to a " + e.getClass().getName() + ":");
+            System.out.println(e.getMessage());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+}