--- /dev/null
+/*
+ * Copyright
+ * 2012 axYus - www.axyus.com
+ * 2012 JP.Tessier - jean-philippe.tessier@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.controls.core;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import nu.xom.Builder;
+import nu.xom.Document;
+
+import org.apache.log4j.Logger;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+import fr.gouv.finances.dgfip.xemelios.controls.core.models.ControlModel;
+
+/**
+ * @author jp.tessier
+ *
+ */
+public class ControlProvider extends AbstractUnitControl {
+
+ private static final Logger logger = Logger.getLogger(ControlProvider.class);
+ private Hashtable<String,Document> hashTablesReferences = null;
+
+ @Override
+ public void startDocument() throws SAXException {
+ hashTablesReferences=new Hashtable<String, Document>();
+ ArrayList<ControlModel> controls = getDocumentModel().getControls();
+
+ Document doc = null;
+ for(ControlModel cm:controls){
+ if(cm.getTableReferenceResource()!=null && cm.getTableReferenceResource().length() > 0 && !hashTablesReferences.containsKey(cm.getTableReferenceResource())){
+ Builder builder = new Builder();
+ try {
+ doc = builder.build(ControlProvider.class.getClassLoader().getResourceAsStream(cm.getTableReferenceResource()));
+ hashTablesReferences.put(cm.getTableReferenceResource(),doc);
+ } catch (Exception e) {
+ logger.debug("Probleme de recuperation de ressource !");
+ }
+ }
+ }
+ }
+
+ public Document getTableReference(String resource) {
+ return hashTablesReferences.get(resource);
+ }
+
+ @Override
+ public void setDocumentLocator(Locator locator) {}
+
+ @Override
+ public void endDocument() throws SAXException {
+ //hashTablesReferences.clear();
+ }
+
+ @Override
+ public void startPrefixMapping(String prefix, String uri, String xpath) throws SAXException {}
+
+ @Override
+ public void endPrefixMapping(String prefix, String xpath) throws SAXException {}
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes atts, String xpath) throws SAXException {}
+
+ @Override
+ public ArrayList<ControlReturn> endElement(String uri, String localName, String qName, String xpath) throws SAXException { return null;}
+
+ @Override
+ public void characters(char[] ch, int start, int length, String xpath) throws SAXException {}
+
+ @Override
+ public void ignorableWhitespace(char[] ch, int start, int length, String xpath) throws SAXException {}
+
+ @Override
+ public void processingInstruction(String target, String data, String xpath) throws SAXException {}
+
+ @Override
+ public void skippedEntity(String name, String xpath) throws SAXException {}
+
+ @Override
+ public void setParameters(Hashtable<String, Object> params) {}
+}
--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - www.axyus.com
+ * 2011 JP.Tessier - jean-philippe.tessier@axyus.com
+ *
+ * This file is part of XEMELIOS.
+ *
+ * XEMELIOS is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with XEMELIOS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package fr.gouv.finances.dgfip.xemelios.controls.core;
+
+/**
+ * @author jp.tessier
+ *
+ */
+public class Snippet {
+ /**
+ *
+ */
+ public static void main(String[] args) {
+
+ }
+}
+