Commit 9ebb9d56 authored by Vincent Calame's avatar Vincent Calame

Renommage de fichiers

parent e68883a8
...@@ -36,7 +36,7 @@ import net.scrutari.datauri.ThesaurusURI; ...@@ -36,7 +36,7 @@ import net.scrutari.datauri.ThesaurusURI;
import net.scrutari.xml.xmlpull.AttrHandler; import net.scrutari.xml.xmlpull.AttrHandler;
import net.scrutari.xml.xmlpull.CorpusHandler; import net.scrutari.xml.xmlpull.CorpusHandler;
import net.scrutari.xml.xmlpull.ThesaurusHandler; import net.scrutari.xml.xmlpull.ThesaurusHandler;
import net.scrutari.xml.xmlpull.XmlPullUtils; import net.scrutari.xml.xmlpull.SctXmlUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParserFactory;
...@@ -169,12 +169,12 @@ public class BaseXmlEngine { ...@@ -169,12 +169,12 @@ public class BaseXmlEngine {
case "corpus": case "corpus":
String corpusName = getAttributeString(attributeMap, "corpus-name"); String corpusName = getAttributeString(attributeMap, "corpus-name");
if (corpusName == null) { if (corpusName == null) {
XmlPullUtils.xml(messageHandler, "_ error.empty.xml.attribute", "/base/corpus", "corpus-name"); SctXmlUtils.xml(messageHandler, "_ error.empty.xml.attribute", "/base/corpus", "corpus-name");
return null; return null;
} }
CorpusURI corpusURI = CorpusURI.check(parameters.getBaseURI(), corpusName); CorpusURI corpusURI = CorpusURI.check(parameters.getBaseURI(), corpusName);
if (corpusURI == null) { if (corpusURI == null) {
XmlPullUtils.format(messageHandler, "_ error.wrong.xml.attributevalue", "/base/corpus", "corpus-name", corpusName); SctXmlUtils.format(messageHandler, "_ error.wrong.xml.attributevalue", "/base/corpus", "corpus-name", corpusName);
return null; return null;
} }
try { try {
...@@ -185,12 +185,12 @@ public class BaseXmlEngine { ...@@ -185,12 +185,12 @@ public class BaseXmlEngine {
case "thesaurus": case "thesaurus":
String thesaurusName = getAttributeString(attributeMap, "thesaurus-name"); String thesaurusName = getAttributeString(attributeMap, "thesaurus-name");
if (thesaurusName == null) { if (thesaurusName == null) {
XmlPullUtils.xml(messageHandler, "_ error.empty.xml.attribute", "/base/thesaurus", "thesaurus-name"); SctXmlUtils.xml(messageHandler, "_ error.empty.xml.attribute", "/base/thesaurus", "thesaurus-name");
return null; return null;
} }
ThesaurusURI thesaurusURI = ThesaurusURI.check(parameters.getBaseURI(), thesaurusName); ThesaurusURI thesaurusURI = ThesaurusURI.check(parameters.getBaseURI(), thesaurusName);
if (thesaurusURI == null) { if (thesaurusURI == null) {
XmlPullUtils.format(messageHandler, "_ error.wrong.xml.attributevalue", "/base/thesaurus", "thesaurus-name", thesaurusName); SctXmlUtils.format(messageHandler, "_ error.wrong.xml.attributevalue", "/base/thesaurus", "thesaurus-name", thesaurusName);
return null; return null;
} }
try { try {
...@@ -249,9 +249,9 @@ public class BaseXmlEngine { ...@@ -249,9 +249,9 @@ public class BaseXmlEngine {
case "langs-ui": case "langs-ui":
return new AvailableLangHandler(baseDataBuilder, messageHandler, tagXpath); return new AvailableLangHandler(baseDataBuilder, messageHandler, tagXpath);
case "attr": case "attr":
AttributeKey attributeKey = XmlPullUtils.parseAttributeKey(attributeMap, messageHandler, tagXpath); AttributeKey attributeKey = SctXmlUtils.parseAttributeKey(attributeMap, messageHandler, tagXpath);
if (attributeKey != null) { if (attributeKey != null) {
return new AttrHandler(attributeKey, messageHandler, XmlPullUtils.toXpath(tagXpath, attributeKey), dataValidator.getFormatChecker(attributeKey)); return new AttrHandler(attributeKey, messageHandler, SctXmlUtils.toXpath(tagXpath, attributeKey), dataValidator.getFormatChecker(attributeKey));
} else { } else {
return null; return null;
} }
...@@ -266,11 +266,11 @@ public class BaseXmlEngine { ...@@ -266,11 +266,11 @@ public class BaseXmlEngine {
case BASE_ICON: case BASE_ICON:
boolean done = false; boolean done = false;
try { try {
done = baseDataBuilder.setBaseIcon(XmlPullUtils.testURI(text)); done = baseDataBuilder.setBaseIcon(SctXmlUtils.testURI(text));
} catch (MalformedURLException | URISyntaxException e) { } catch (MalformedURLException | URISyntaxException e) {
} }
if (!done) { if (!done) {
XmlPullUtils.format(messageHandler, "_ error.wrong.xml.tagvalue", xpath + "/base-icon", text); SctXmlUtils.format(messageHandler, "_ error.wrong.xml.tagvalue", xpath + "/base-icon", text);
} }
break; break;
} }
...@@ -307,7 +307,7 @@ public class BaseXmlEngine { ...@@ -307,7 +307,7 @@ public class BaseXmlEngine {
try { try {
return new LabelElementHandler(attributeMap, xpath + "/" + tagname); return new LabelElementHandler(attributeMap, xpath + "/" + tagname);
} catch (ErrorMessageException eme) { } catch (ErrorMessageException eme) {
XmlPullUtils.lang(messageHandler, eme.getErrorMessage()); SctXmlUtils.lang(messageHandler, eme.getErrorMessage());
return null; return null;
} }
} }
...@@ -316,7 +316,7 @@ public class BaseXmlEngine { ...@@ -316,7 +316,7 @@ public class BaseXmlEngine {
@Override @Override
public void endSubElement(XmlPullElementHandler elementHandler) { public void endSubElement(XmlPullElementHandler elementHandler) {
baseDataBuilder.addLabel(name, XmlPullUtils.testLabel(elementHandler)); baseDataBuilder.addLabel(name, SctXmlUtils.testLabel(elementHandler));
} }
} }
...@@ -348,7 +348,7 @@ public class BaseXmlEngine { ...@@ -348,7 +348,7 @@ public class BaseXmlEngine {
Lang lang = Lang.parse(text); Lang lang = Lang.parse(text);
baseDataBuilder.addAvailableLang(lang); baseDataBuilder.addAvailableLang(lang);
} catch (ParseException ile) { } catch (ParseException ile) {
XmlPullUtils.lang(messageHandler, "_ error.wrong.xml.tagvalue", xpath + "/lang", text); SctXmlUtils.lang(messageHandler, "_ error.wrong.xml.tagvalue", xpath + "/lang", text);
} }
} }
......
...@@ -28,7 +28,7 @@ import net.scrutari.datauri.URIParseException; ...@@ -28,7 +28,7 @@ import net.scrutari.datauri.URIParseException;
import net.scrutari.datauri.URIParser; import net.scrutari.datauri.URIParser;
import net.scrutari.db.api.DataCoder; import net.scrutari.db.api.DataCoder;
import net.scrutari.db.api.caches.DataCacheWriter; import net.scrutari.db.api.caches.DataCacheWriter;
import net.scrutari.xml.xmlpull.XmlPullUtils; import net.scrutari.xml.xmlpull.SctXmlUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParserFactory;
...@@ -237,11 +237,11 @@ public class IndexationXmlEngine { ...@@ -237,11 +237,11 @@ public class IndexationXmlEngine {
} }
private void reference(String key, Object... values) { private void reference(String key, Object... values) {
XmlPullUtils.reference(messageHandler, key, values); SctXmlUtils.reference(messageHandler, key, values);
} }
private void format(String key, Object... values) { private void format(String key, Object... values) {
XmlPullUtils.format(messageHandler, key, values); SctXmlUtils.format(messageHandler, key, values);
} }
private void xml(String key, Object... values) { private void xml(String key, Object... values) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
*/ */
package net.scrutari.xml.xmlpull; package net.scrutari.xml;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -80,7 +80,7 @@ public class AttrHandler extends DefaultElementHandler { ...@@ -80,7 +80,7 @@ public class AttrHandler extends DefaultElementHandler {
String orignalText = cs.toString(); String orignalText = cs.toString();
String checkedText = stringChecker.check(orignalText); String checkedText = stringChecker.check(orignalText);
if (checkedText == null) { if (checkedText == null) {
XmlPullUtils.format(messageHandler, "_ error.wrong.xml.tagvalue", xpath + "/val", orignalText); SctXmlUtils.format(messageHandler, "_ error.wrong.xml.tagvalue", xpath + "/val", orignalText);
return null; return null;
} else if (!checkedText.equals(orignalText)) { } else if (!checkedText.equals(orignalText)) {
return CleanedString.newInstance(checkedText); return CleanedString.newInstance(checkedText);
......
...@@ -30,9 +30,9 @@ import net.scrutari.data.SctSpace; ...@@ -30,9 +30,9 @@ import net.scrutari.data.SctSpace;
* *
* @author Vincent Calame * @author Vincent Calame
*/ */
public final class XmlPullUtils { public final class SctXmlUtils {
private XmlPullUtils() { private SctXmlUtils() {
} }
public static Label testLabel(XmlPullElementHandler elementHandler) { public static Label testLabel(XmlPullElementHandler elementHandler) {
......
...@@ -54,7 +54,7 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -54,7 +54,7 @@ public class ThesaurusHandler extends DefaultElementHandler {
this.dataCacheWriter = parameters.getDataCacheWriter(); this.dataCacheWriter = parameters.getDataCacheWriter();
this.dataCoder = parameters.getDataCoder(); this.dataCoder = parameters.getDataCoder();
if (dataCoder.checkCode(thesaurusURI) != -1) { if (dataCoder.checkCode(thesaurusURI) != -1) {
XmlPullUtils.reference(messageHandler, "_ error.existing.xml.attributevalue", thesaurusxpath, "thesaurus-name", thesaurusName); SctXmlUtils.reference(messageHandler, "_ error.existing.xml.attributevalue", thesaurusxpath, "thesaurus-name", thesaurusName);
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.codethesaurus = dataCoder.getCode(thesaurusURI); this.codethesaurus = dataCoder.getCode(thesaurusURI);
...@@ -78,23 +78,23 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -78,23 +78,23 @@ public class ThesaurusHandler extends DefaultElementHandler {
metadataDone = true; metadataDone = true;
return new MetadataHandler(); return new MetadataHandler();
} else { } else {
XmlPullUtils.xml(messageHandler, "_ error.unsupported.xml.missingtag", thesaurusxpath, "thesaurus-metadata"); SctXmlUtils.xml(messageHandler, "_ error.unsupported.xml.missingtag", thesaurusxpath, "thesaurus-metadata");
return null; return null;
} }
} else { } else {
if (tagname.equals("motcle")) { if (tagname.equals("motcle")) {
String motcleId = getAttributeString(attributeMap, "motcle-id"); String motcleId = getAttributeString(attributeMap, "motcle-id");
if (motcleId == null) { if (motcleId == null) {
XmlPullUtils.xml(messageHandler, "_ error.empty.xml.attribute", thesaurusxpath + "/motcle", "motcle-id"); SctXmlUtils.xml(messageHandler, "_ error.empty.xml.attribute", thesaurusxpath + "/motcle", "motcle-id");
return null; return null;
} }
MotcleURI motcleURI = MotcleURI.check(thesaurusURI, motcleId); MotcleURI motcleURI = MotcleURI.check(thesaurusURI, motcleId);
if (motcleURI == null) { if (motcleURI == null) {
XmlPullUtils.format(messageHandler, "_ error.wrong.xml.attributevalue", thesaurusxpath + "/motcle", "motcle-id", motcleId); SctXmlUtils.format(messageHandler, "_ error.wrong.xml.attributevalue", thesaurusxpath + "/motcle", "motcle-id", motcleId);
return null; return null;
} }
if (dataCoder.checkCode(motcleURI) != -1) { if (dataCoder.checkCode(motcleURI) != -1) {
XmlPullUtils.reference(messageHandler, "_ error.existing.xml.attributevalue", thesaurusxpath + "/motcle[motcle-id='" + motcleId + "']", "motcle-id", motcleId); SctXmlUtils.reference(messageHandler, "_ error.existing.xml.attributevalue", thesaurusxpath + "/motcle[motcle-id='" + motcleId + "']", "motcle-id", motcleId);
return null; return null;
} }
int codemotcle = dataCoder.getCode(motcleURI); int codemotcle = dataCoder.getCode(motcleURI);
...@@ -132,9 +132,9 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -132,9 +132,9 @@ public class ThesaurusHandler extends DefaultElementHandler {
case "intitule-thesaurus": case "intitule-thesaurus":
return new PhraseHandler(DataConstants.THESAURUS_TITLE, xpath); return new PhraseHandler(DataConstants.THESAURUS_TITLE, xpath);
case "attr": case "attr":
AttributeKey attributeKey = XmlPullUtils.parseAttributeKey(attributeMap, messageHandler, xpath); AttributeKey attributeKey = SctXmlUtils.parseAttributeKey(attributeMap, messageHandler, xpath);
if (attributeKey != null) { if (attributeKey != null) {
return new AttrHandler(attributeKey, messageHandler, XmlPullUtils.toXpath(xpath, attributeKey), dataValidator.getFormatChecker(attributeKey)); return new AttrHandler(attributeKey, messageHandler, SctXmlUtils.toXpath(xpath, attributeKey), dataValidator.getFormatChecker(attributeKey));
} else { } else {
return null; return null;
} }
...@@ -170,7 +170,7 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -170,7 +170,7 @@ public class ThesaurusHandler extends DefaultElementHandler {
try { try {
return new LabelElementHandler(attributeMap, xpath + "/lib"); return new LabelElementHandler(attributeMap, xpath + "/lib");
} catch (ErrorMessageException eme) { } catch (ErrorMessageException eme) {
XmlPullUtils.lang(messageHandler, eme.getErrorMessage()); SctXmlUtils.lang(messageHandler, eme.getErrorMessage());
return null; return null;
} }
} }
...@@ -179,7 +179,7 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -179,7 +179,7 @@ public class ThesaurusHandler extends DefaultElementHandler {
@Override @Override
public void endSubElement(XmlPullElementHandler elementHandler) { public void endSubElement(XmlPullElementHandler elementHandler) {
thesaurusDataBuilder.addLabel(name, XmlPullUtils.testLabel(elementHandler)); thesaurusDataBuilder.addLabel(name, SctXmlUtils.testLabel(elementHandler));
} }
} }
...@@ -216,13 +216,13 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -216,13 +216,13 @@ public class ThesaurusHandler extends DefaultElementHandler {
try { try {
return new LabelElementHandler(attributeMap, thesaurusxpath + "/motcle[motcle-id='" + motcleURI.getMotcleId() + "']/lib"); return new LabelElementHandler(attributeMap, thesaurusxpath + "/motcle[motcle-id='" + motcleURI.getMotcleId() + "']/lib");
} catch (ErrorMessageException eme) { } catch (ErrorMessageException eme) {
XmlPullUtils.lang(messageHandler, eme.getErrorMessage()); SctXmlUtils.lang(messageHandler, eme.getErrorMessage());
return null; return null;
} }
case "attr": case "attr":
AttributeKey attributeKey = XmlPullUtils.parseAttributeKey(attributeMap, messageHandler, xpath); AttributeKey attributeKey = SctXmlUtils.parseAttributeKey(attributeMap, messageHandler, xpath);
if (attributeKey != null) { if (attributeKey != null) {
return new AttrHandler(attributeKey, messageHandler, XmlPullUtils.toXpath(xpath, attributeKey), dataValidator.getFormatChecker(attributeKey)); return new AttrHandler(attributeKey, messageHandler, SctXmlUtils.toXpath(xpath, attributeKey), dataValidator.getFormatChecker(attributeKey));
} else { } else {
return null; return null;
} }
...@@ -233,7 +233,7 @@ public class ThesaurusHandler extends DefaultElementHandler { ...@@ -233,7 +233,7 @@ public class ThesaurusHandler extends DefaultElementHandler {
@Override @Override
public void endSubElement(XmlPullElementHandler elementHandler) { public void endSubElement(XmlPullElementHandler elementHandler) {
if (elementHandler instanceof LabelElementHandler) { if (elementHandler instanceof LabelElementHandler) {
motcleDataBuilder.addLabel(XmlPullUtils.testLabel(elementHandler)); motcleDataBuilder.addLabel(SctXmlUtils.testLabel(elementHandler));
} else if (elementHandler instanceof AttrHandler) { } else if (elementHandler instanceof AttrHandler) {
AttrHandler attrHandler = (AttrHandler) elementHandler; AttrHandler attrHandler = (AttrHandler) elementHandler;
motcleDataBuilder.addAttribute(attrHandler.getAttributeKey(), attrHandler.getValueList()); motcleDataBuilder.addAttribute(attrHandler.getAttributeKey(), attrHandler.getValueList());
......
...@@ -58,8 +58,8 @@ import net.scrutari.xml.BaseURIXmlEngine; ...@@ -58,8 +58,8 @@ import net.scrutari.xml.BaseURIXmlEngine;
import net.scrutari.xml.BaseXmlEngine; import net.scrutari.xml.BaseXmlEngine;
import net.scrutari.xml.IndexationXmlEngine; import net.scrutari.xml.IndexationXmlEngine;
import net.scrutari.xml.Parameters; import net.scrutari.xml.Parameters;
import net.scrutari.xml.xmlpull.XmlChecker; import net.scrutari.xml.XmlChecker;
import net.scrutari.xml.xmlpull.XmlPullUtils; import net.scrutari.xml.xmlpull.SctXmlUtils;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
...@@ -292,7 +292,7 @@ public final class SctEngineImpl implements SctEngine { ...@@ -292,7 +292,7 @@ public final class SctEngineImpl implements SctEngine {
if (baseURI != null) { if (baseURI != null) {
String existingSourceName = aliasManagerBuilder.getSourceName(baseURI); String existingSourceName = aliasManagerBuilder.getSourceName(baseURI);
if ((existingSourceName != null) && (!existingSourceName.equals(scrutariSourceName))) { if ((existingSourceName != null) && (!existingSourceName.equals(scrutariSourceName))) {
XmlPullUtils.reference(updateLogHandler, "_ error.existing.baseuri", baseURI); SctXmlUtils.reference(updateLogHandler, "_ error.existing.baseuri", baseURI);
} else { } else {
BaseURI currentMain = aliasManagerBuilder.getMainBaseURI(scrutariSourceName); BaseURI currentMain = aliasManagerBuilder.getMainBaseURI(scrutariSourceName);
if (currentMain == null) { if (currentMain == null) {
...@@ -443,14 +443,14 @@ public final class SctEngineImpl implements SctEngine { ...@@ -443,14 +443,14 @@ public final class SctEngineImpl implements SctEngine {
BaseURI mainBaseURI = scrutariSourceDef.getMainBaseURI(); BaseURI mainBaseURI = scrutariSourceDef.getMainBaseURI();
if (mainBaseURI != null) { if (mainBaseURI != null) {
if (aliasManagerBuilder.containsBaseURI(mainBaseURI)) { if (aliasManagerBuilder.containsBaseURI(mainBaseURI)) {
XmlPullUtils.reference(messageHandler, "_ error.existing.baseuri", mainBaseURI); SctXmlUtils.reference(messageHandler, "_ error.existing.baseuri", mainBaseURI);
} else { } else {
aliasManagerBuilder.putMainBaseURI(scrutariSourceName, mainBaseURI); aliasManagerBuilder.putMainBaseURI(scrutariSourceName, mainBaseURI);
} }
} }
for (BaseURI baseURI : scrutariSourceDef.getAliasList()) { for (BaseURI baseURI : scrutariSourceDef.getAliasList()) {
if (aliasManagerBuilder.containsBaseURI(baseURI)) { if (aliasManagerBuilder.containsBaseURI(baseURI)) {
XmlPullUtils.reference(messageHandler, "_ error.existing.baseuri", mainBaseURI); SctXmlUtils.reference(messageHandler, "_ error.existing.baseuri", mainBaseURI);
} else { } else {
aliasManagerBuilder.putAliasBaseURI(scrutariSourceName, baseURI); aliasManagerBuilder.putAliasBaseURI(scrutariSourceName, baseURI);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment