[DEBUG] update new xml API
This commit is contained in:
parent
38dd3dda35
commit
ba0ef7a106
@ -10,7 +10,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.atriasoft.aknot.exception.AknotException;
|
import org.atriasoft.aknot.exception.AknotException;
|
||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.XmlMapper;
|
||||||
import org.atriasoft.exml.exception.ExmlBuilderException;
|
import org.atriasoft.exml.exception.ExmlBuilderException;
|
||||||
import org.atriasoft.exml.exception.ExmlException;
|
import org.atriasoft.exml.exception.ExmlException;
|
||||||
import org.atriasoft.exml.exception.ExmlParserErrorMulti;
|
import org.atriasoft.exml.exception.ExmlParserErrorMulti;
|
||||||
@ -284,11 +284,9 @@ public class Manifest {
|
|||||||
Log.debug("PArse main XML config " + rootDirectory);
|
Log.debug("PArse main XML config " + rootDirectory);
|
||||||
ManifestFile parsedElements = null;
|
ManifestFile parsedElements = null;
|
||||||
try {
|
try {
|
||||||
parsedElements = Exml.parseOne(this.manifestXml, ManifestFile.class, "manifest");
|
final XmlMapper mapper = new XmlMapper();
|
||||||
} catch (final ExmlException e1) {
|
parsedElements = mapper.read(ManifestFile.class, this.manifestXml);
|
||||||
// TODO Auto-generated catch block
|
} catch (final ExmlException | AknotException e1) {
|
||||||
e1.printStackTrace();
|
|
||||||
} catch (final AknotException e1) {
|
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -299,11 +297,9 @@ public class Manifest {
|
|||||||
Log.debug("PArse <<SUB>> XML config " + maniPath);
|
Log.debug("PArse <<SUB>> XML config " + maniPath);
|
||||||
ManifestFile tmpManifest = null;
|
ManifestFile tmpManifest = null;
|
||||||
try {
|
try {
|
||||||
tmpManifest = Exml.parseOne(maniPath, ManifestFile.class, "manifest");
|
final XmlMapper mapper = new XmlMapper();
|
||||||
} catch (final ExmlException e) {
|
tmpManifest = mapper.read(ManifestFile.class, maniPath);
|
||||||
// TODO Auto-generated catch block
|
} catch (final ExmlException | AknotException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (final AknotException e) {
|
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import org.atriasoft.ejson.Ejson;
|
|||||||
import org.atriasoft.ejson.model.JsonArray;
|
import org.atriasoft.ejson.model.JsonArray;
|
||||||
import org.atriasoft.ejson.model.JsonObject;
|
import org.atriasoft.ejson.model.JsonObject;
|
||||||
import org.atriasoft.ejson.model.JsonString;
|
import org.atriasoft.ejson.model.JsonString;
|
||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.XmlMapper;
|
||||||
import org.atriasoft.exml.exception.ExmlException;
|
import org.atriasoft.exml.exception.ExmlException;
|
||||||
import org.atriasoft.island.Config;
|
import org.atriasoft.island.Config;
|
||||||
import org.atriasoft.island.Env;
|
import org.atriasoft.island.Env;
|
||||||
@ -158,7 +158,8 @@ public class DependencySync {
|
|||||||
Log.verbose("dataAsString: " + dataAsString);
|
Log.verbose("dataAsString: " + dataAsString);
|
||||||
MavenMetadata metaData = null;
|
MavenMetadata metaData = null;
|
||||||
try {
|
try {
|
||||||
metaData = Exml.parseOne(dataAsString, MavenMetadata.class, "metadata");
|
final XmlMapper mapper = new XmlMapper();
|
||||||
|
metaData = mapper.parse(dataAsString, MavenMetadata.class);
|
||||||
} catch (ExmlException e) {
|
} catch (ExmlException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -178,7 +179,8 @@ public class DependencySync {
|
|||||||
readRemoteFileAndStore(remotePakageFileName + "/" + base, localPackageFileName.resolve(base), base);
|
readRemoteFileAndStore(remotePakageFileName + "/" + base, localPackageFileName.resolve(base), base);
|
||||||
PomMaven mavenPom = null;
|
PomMaven mavenPom = null;
|
||||||
try {
|
try {
|
||||||
mavenPom = Exml.parseOne(localPackageFileName.resolve(base), PomMaven.class, "project");
|
final XmlMapper mapper = new XmlMapper();
|
||||||
|
mavenPom = mapper.read(PomMaven.class, localPackageFileName.resolve(base));
|
||||||
} catch (ExmlException e) {
|
} catch (ExmlException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -9,13 +9,14 @@ import java.util.ListIterator;
|
|||||||
import org.atriasoft.aknot.annotation.AknotList;
|
import org.atriasoft.aknot.annotation.AknotList;
|
||||||
import org.atriasoft.aknot.annotation.AknotName;
|
import org.atriasoft.aknot.annotation.AknotName;
|
||||||
import org.atriasoft.aknot.exception.AknotException;
|
import org.atriasoft.aknot.exception.AknotException;
|
||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.XmlMapper;
|
||||||
import org.atriasoft.exml.exception.ExmlBuilderException;
|
import org.atriasoft.exml.exception.ExmlBuilderException;
|
||||||
import org.atriasoft.exml.exception.ExmlException;
|
import org.atriasoft.exml.exception.ExmlException;
|
||||||
import org.atriasoft.island.Env;
|
import org.atriasoft.island.Env;
|
||||||
import org.atriasoft.island.internal.Log;
|
import org.atriasoft.island.internal.Log;
|
||||||
import org.atriasoft.island.model.Volatile;
|
import org.atriasoft.island.model.Volatile;
|
||||||
|
|
||||||
|
@AknotName("config-island")
|
||||||
public class ConfigManifest {
|
public class ConfigManifest {
|
||||||
|
|
||||||
public static ConfigManifest load() {
|
public static ConfigManifest load() {
|
||||||
@ -23,20 +24,24 @@ public class ConfigManifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigManifest load(final Path path) {
|
public static ConfigManifest load(final Path path) {
|
||||||
ConfigManifest[] root = null;
|
ConfigManifest root = null;
|
||||||
try {
|
try {
|
||||||
root = Exml.parse(path, ConfigManifest.class, "config-island");
|
XmlMapper mapper = new XmlMapper();
|
||||||
|
root = mapper.read(ConfigManifest.class, path);
|
||||||
} catch (final ExmlException e) {
|
} catch (final ExmlException e) {
|
||||||
Log.error("Can not parse the file.1. " + path);
|
Log.error("Can not parse the file.1. " + path);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (final AknotException e) {
|
} catch (final AknotException e) {
|
||||||
Log.error("Can not parse the file.2. " + path);
|
Log.error("Can not parse the file.2. " + path);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} catch (IOException e) {
|
||||||
if (root.length != 1) {
|
|
||||||
Log.error("Can not parse the file.3. " + path);
|
Log.error("Can not parse the file.3. " + path);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return root[0];
|
if (root == null) {
|
||||||
|
Log.error("Can not parse the file.4. " + path);
|
||||||
|
}
|
||||||
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String repo = "";
|
private String repo = "";
|
||||||
@ -182,8 +187,9 @@ public class ConfigManifest {
|
|||||||
|
|
||||||
public void store(final Path path) throws ExmlBuilderException {
|
public void store(final Path path) throws ExmlBuilderException {
|
||||||
try {
|
try {
|
||||||
Exml.store(path, this, "config-island");
|
XmlMapper mapper = new XmlMapper();
|
||||||
} catch (final ExmlException | IOException ex) {
|
mapper.store(this, path);
|
||||||
|
} catch (final ExmlException | IOException | AknotException ex) {
|
||||||
Log.warning("detect throw: " + ex.getMessage());
|
Log.warning("detect throw: " + ex.getMessage());
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import org.atriasoft.aknot.annotation.AknotManaged;
|
|||||||
import org.atriasoft.aknot.annotation.AknotName;
|
import org.atriasoft.aknot.annotation.AknotName;
|
||||||
|
|
||||||
@AknotIgnoreUnknown
|
@AknotIgnoreUnknown
|
||||||
|
@AknotName("manifest")
|
||||||
public class ManifestFile {
|
public class ManifestFile {
|
||||||
private Path fileRealPath = null;
|
private Path fileRealPath = null;
|
||||||
private List<ProjectConfig> projects = new ArrayList<>();
|
private List<ProjectConfig> projects = new ArrayList<>();
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package org.atriasoft.island.model.maven;
|
package org.atriasoft.island.model.maven;
|
||||||
|
|
||||||
|
import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
|
||||||
import org.atriasoft.aknot.annotation.AknotIgnoreUnknown;
|
import org.atriasoft.aknot.annotation.AknotIgnoreUnknown;
|
||||||
import org.atriasoft.aknot.annotation.AknotName;
|
import org.atriasoft.aknot.annotation.AknotName;
|
||||||
import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
|
|
||||||
|
|
||||||
@AknotDefaultAttribute(false)
|
@AknotDefaultAttribute(false)
|
||||||
@AknotIgnoreUnknown
|
@AknotIgnoreUnknown
|
||||||
|
@AknotName("metadata")
|
||||||
public record MavenMetadata(
|
public record MavenMetadata(
|
||||||
@AknotName("groupId") String groupId,
|
@AknotName("groupId") String groupId,
|
||||||
@AknotName("artifactId") String artifactId,
|
@AknotName("artifactId") String artifactId,
|
||||||
|
@ -10,6 +10,7 @@ import org.atriasoft.aknot.annotation.AknotOptional;
|
|||||||
|
|
||||||
@AknotDefaultNullValue
|
@AknotDefaultNullValue
|
||||||
@AknotIgnoreUnknown
|
@AknotIgnoreUnknown
|
||||||
|
@AknotName("project")
|
||||||
public record PomMaven(
|
public record PomMaven(
|
||||||
@AknotName("modelVersion") String modelVersion,
|
@AknotName("modelVersion") String modelVersion,
|
||||||
@AknotName("groupId") String groupId,
|
@AknotName("groupId") String groupId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user