Updane new aknot

This commit is contained in:
Edouard DUPIN 2022-05-03 15:05:23 +02:00
parent 42dd73995e
commit 381980372e
14 changed files with 387 additions and 339 deletions

View File

@ -1,27 +1,31 @@
package org.atriasoft.island.model; package org.atriasoft.island.model;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public class Volatile { public class Volatile {
private String address; private String address;
private String path; private String path;
@XmlName({"address", "path"}) @AknotName({ "address", "path" })
public Volatile(final String gitAddress, final String path) { public Volatile(final String gitAddress, final String path) {
this.address = gitAddress; this.address = gitAddress;
this.path = path; this.path = path;
} }
public String getAddress() { public String getAddress() {
return this.address; return this.address;
} }
public void setAddress(final String gitAddress) {
this.address = gitAddress;
}
public String getPath() { public String getPath() {
return this.path; return this.path;
} }
public void setAddress(final String gitAddress) {
this.address = gitAddress;
}
public void setPath(final String path) { public void setPath(final String path) {
this.path = path; this.path = path;
} }

View File

@ -1,50 +1,31 @@
package org.atriasoft.island.model.manifest; package org.atriasoft.island.model.manifest;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public class Artifactory { public class Artifactory {
private String name; // Local name of the remote. private String name; // Local name of the remote.
private String fetch; // Address to fetch. private String fetch; // Address to fetch.
private String type; // type of artifactory (default maven to update later ...) private String type; // type of artifactory (default maven to update later ...)
@XmlName({"name", "fetch", "type"})
public Artifactory(final String name, final String fetch, final String type) {
this.name = name;
this.fetch = fetch;
this.type = type;
}
@XmlName({"name", "fetch"})
public Artifactory(final String name, final String fetch) {
this.name = name;
this.fetch = fetch;
this.type = "maven";
}
public Artifactory() { public Artifactory() {
this.name = ""; this.name = "";
this.fetch = ""; this.fetch = "";
this.type = "maven"; this.type = "maven";
} }
public String getName() { @AknotName({ "name", "fetch" })
return this.name; public Artifactory(final String name, final String fetch) {
}
public void setName(final String name) {
this.name = name; this.name = name;
this.fetch = fetch;
this.type = "maven";
} }
public String getFetch() { @AknotName({ "name", "fetch", "type" })
return this.fetch; public Artifactory(final String name, final String fetch, final String type) {
} this.name = name;
public void setFetch(final String fetch) {
this.fetch = fetch; this.fetch = fetch;
}
public String getType() {
return this.type;
}
public void setType(final String type) {
this.type = type; this.type = type;
} }
@ -54,5 +35,28 @@ public class Artifactory {
return new Artifactory(this.name, this.fetch, this.type); return new Artifactory(this.name, this.fetch, this.type);
} }
public String getFetch() {
return this.fetch;
}
public String getName() {
return this.name;
}
public String getType() {
return this.type;
}
public void setFetch(final String fetch) {
this.fetch = fetch;
}
public void setName(final String name) {
this.name = name;
}
public void setType(final String type) {
this.type = type;
}
} }

View File

@ -6,106 +6,26 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import org.atriasoft.aknot.annotation.AknotList;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.Exml; import org.atriasoft.exml.Exml;
import org.atriasoft.exml.annotation.XmlList;
import org.atriasoft.exml.annotation.XmlName;
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;
public class ConfigManifest { public class ConfigManifest {
private String repo = "";
private String branch = "master";
private String manifestName = "default.xml";
private List<Volatile> volatiles = new ArrayList<>();
private List<Link> links = new ArrayList<>();
public ConfigManifest() {
}
public String getRepo() {
return this.repo;
}
public void setRepo(final String repo) {
this.repo = repo;
}
public String getBranch() {
return this.branch;
}
public void setBranch(final String branch) {
this.branch = branch;
}
@XmlName(value="manifest-name")
public String getManifestName() {
return this.manifestName;
}
public void setManifestName(final String manifestName) {
this.manifestName = manifestName;
}
@XmlList(value="volatile")
public List<Volatile> getVolatiles() {
return this.volatiles;
}
public void setVolatiles(final List<Volatile> volatiles) {
this.volatiles = volatiles;
}
public void addVolatile(final String gitAddress, final String path) {
rmVolatile(path);
this.volatiles.add(new Volatile(gitAddress, path));
}
public void rmVolatile(final String path) {
ListIterator<Volatile> it = this.volatiles.listIterator();
while (it.hasNext()) {
Volatile elem = it.next();
if (elem.getPath().equals(path)) {
it.remove();
}
}
}
public boolean existVolatile(final String path) {
ListIterator<Volatile> it = this.volatiles.listIterator();
while (it.hasNext()) {
Volatile elem = it.next();
if (elem.getPath().equals(path)) {
return true;
}
}
return false;
}
@XmlList(value="link")
public List<Link> getLinks() {
return this.links;
}
public void setLinks(final List<Link> curentLink) {
this.links = curentLink;
}
public void addLink(final String source, final String destination) {
rmLink(destination);
this.links.add(new Link(source, destination));
}
private void rmLink(final String destination) {
ListIterator<Link> it = this.links.listIterator();
while (it.hasNext()) {
Link elem = it.next();
if (elem.getDestination().equals(destination)) {
it.remove();
}
}
}
public static ConfigManifest load() { public static ConfigManifest load() {
return ConfigManifest.load(Env.getIslandPathConfig()); return ConfigManifest.load(Env.getIslandPathConfig());
} }
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"); root = Exml.parse(path, ConfigManifest.class, "config-island");
} catch (ExmlBuilderException e) { } catch (final ExmlException e) {
Log.error("Can not parse the file.1. " + path);
e.printStackTrace();
} catch (ExmlException e) {
Log.error("Can not parse the file.1. " + path); Log.error("Can not parse the file.1. " + path);
e.printStackTrace(); e.printStackTrace();
} }
@ -114,34 +34,32 @@ public class ConfigManifest {
} }
return root[0]; return root[0];
} }
public void store() {
try { private String repo = "";
store(Env.getIslandPathConfig()); private String branch = "master";
} catch (ExmlBuilderException e) { private String manifestName = "default.xml";
Log.error("Can not store the configuration ... ");
e.printStackTrace(); private List<Volatile> volatiles = new ArrayList<>();
}
private List<Link> links = new ArrayList<>();
public ConfigManifest() {}
public void addLink(final String source, final String destination) {
rmLink(destination);
this.links.add(new Link(source, destination));
} }
public void store(final Path path) throws ExmlBuilderException {
try { public void addVolatile(final String gitAddress, final String path) {
Exml.store(path, this, "config-island"); rmVolatile(path);
} catch (ExmlException ex) { this.volatiles.add(new Volatile(gitAddress, path));
Log.warning("detect throw: " + ex.getMessage());
ex.printStackTrace();
} catch (IOException ex) {
Log.warning("detect throw: " + ex.getMessage());
ex.printStackTrace();
}
} }
public String createAdressGitRepo(final String fetch, final String name) { public String createAdressGitRepo(final String fetch, final String name) {
// check if it is a directAdress: // check if it is a directAdress:
if (fetch.startsWith("git@") if (fetch.startsWith("git@") || fetch.startsWith("http://") || fetch.startsWith("https://")) {
|| fetch.startsWith("http://") if (fetch.startsWith("git@") && fetch.substring(4).split(":").length <= 1) {
|| fetch.startsWith("https://")) {
if (fetch.startsWith("git@")
&& fetch.substring(4).split(":").length <= 1) {
return fetch + ":" + name; return fetch + ":" + name;
} }
return fetch + "/" + name; return fetch + "/" + name;
@ -152,7 +70,7 @@ public class ConfigManifest {
while (offsetFetch.startsWith("..")) { while (offsetFetch.startsWith("..")) {
if (offsetFetch.startsWith("../")) { if (offsetFetch.startsWith("../")) {
offsetFetch = offsetFetch.substring(3); offsetFetch = offsetFetch.substring(3);
} else if (offsetFetch.equals("..")){ } else if (offsetFetch.equals("..")) {
offsetFetch = offsetFetch.substring(2); offsetFetch = offsetFetch.substring(2);
} else { } else {
break; break;
@ -170,8 +88,100 @@ public class ConfigManifest {
return addressManifest + offsetFetch + name; return addressManifest + offsetFetch + name;
} }
public boolean existVolatile(final String path) {
final ListIterator<Volatile> it = this.volatiles.listIterator();
while (it.hasNext()) {
final Volatile elem = it.next();
if (elem.getPath().equals(path)) {
return true;
}
}
return false;
}
public String getBranch() {
return this.branch;
}
@AknotList(value = "link")
public List<Link> getLinks() {
return this.links;
}
public ProjectConfig getManifestConfig() { public ProjectConfig getManifestConfig() {
return new ProjectConfig("manifest", Env.getIslandPathManifest().resolve(getManifestName()).toString()); return new ProjectConfig("manifest", Env.getIslandPathManifest().resolve(getManifestName()).toString());
} }
@AknotName(value = "manifest-name")
public String getManifestName() {
return this.manifestName;
}
public String getRepo() {
return this.repo;
}
@AknotList(value = "volatile")
public List<Volatile> getVolatiles() {
return this.volatiles;
}
private void rmLink(final String destination) {
final ListIterator<Link> it = this.links.listIterator();
while (it.hasNext()) {
final Link elem = it.next();
if (elem.getDestination().equals(destination)) {
it.remove();
}
}
}
public void rmVolatile(final String path) {
final ListIterator<Volatile> it = this.volatiles.listIterator();
while (it.hasNext()) {
final Volatile elem = it.next();
if (elem.getPath().equals(path)) {
it.remove();
}
}
}
public void setBranch(final String branch) {
this.branch = branch;
}
public void setLinks(final List<Link> curentLink) {
this.links = curentLink;
}
public void setManifestName(final String manifestName) {
this.manifestName = manifestName;
}
public void setRepo(final String repo) {
this.repo = repo;
}
public void setVolatiles(final List<Volatile> volatiles) {
this.volatiles = volatiles;
}
public void store() {
try {
store(Env.getIslandPathConfig());
} catch (final ExmlBuilderException e) {
Log.error("Can not store the configuration ... ");
e.printStackTrace();
}
}
public void store(final Path path) throws ExmlBuilderException {
try {
Exml.store(path, this, "config-island");
} catch (final ExmlException | IOException ex) {
Log.warning("detect throw: " + ex.getMessage());
ex.printStackTrace();
}
}
} }

View File

@ -1,29 +1,30 @@
package org.atriasoft.island.model.manifest; package org.atriasoft.island.model.manifest;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotOptional;
import org.atriasoft.exml.annotation.XmlOptional; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public record Dependency ( public record Dependency(
String org, String org,
String name, String name,
@XmlOptional String revision, @AknotOptional String revision,
@XmlOptional String remote) { // TODO this is a big mistake for xml , can not parse multiple type... use @XmlOptionnal(nullDefaultValue=true) @AknotOptional String remote) { // TODO this is a big mistake for xml , can not parse multiple type... use @XmlOptionnal(nullDefaultValue=true)
@XmlName({"org", "name", "rev", "remote"}) @AknotName({ "org", "name", "rev", "remote" })
public Dependency(final String org, final String name, final String revision, final String remote) { public Dependency(final String org, final String name, final String revision, final String remote) {
this.org = org; this.org = org;
this.name = name; this.name = name;
this.revision = revision; this.revision = revision;
this.remote = remote==null?"default":remote; this.remote = remote == null ? "default" : remote;
} }
@XmlName({"org", "name", "rev"})
@AknotName({ "org", "name", "rev" })
public Dependency(final String org, final String name, final String revision) { public Dependency(final String org, final String name, final String revision) {
this(org, name, revision, null); this(org, name, revision, null);
} }
@XmlName({"org", "name"}) @AknotName({ "org", "name" })
public Dependency(final String org, final String name) { public Dependency(final String org, final String name) {
this(org, name, null, null); this(org, name, null, null);
} }

View File

@ -1,8 +1,8 @@
package org.atriasoft.island.model.manifest; package org.atriasoft.island.model.manifest;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public class Link { public class Link {
private String source; private String source;
private String destination; private String destination;

View File

@ -4,12 +4,12 @@ import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.atriasoft.exml.annotation.XmlIgnoreUnknow; import org.atriasoft.aknot.annotation.AknotIgnoreUnknown;
import org.atriasoft.exml.annotation.XmlList; import org.atriasoft.aknot.annotation.AknotList;
import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotName;
@XmlIgnoreUnknow @AknotIgnoreUnknown
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<>();
@ -20,28 +20,28 @@ public class ManifestFile {
private OptionRepository options = null; private OptionRepository options = null;
private List<Link> links = new ArrayList<>(); private List<Link> links = new ArrayList<>();
@XmlName("artefactory") @AknotName("artefactory")
public List<Artifactory> getArtefactories() { public List<Artifactory> getArtefactories() {
return this.artefactories; return this.artefactories;
} }
@XmlName(value = "dependencies") @AknotName(value = "dependencies")
@XmlList(value = "dependency") @AknotList(value = "dependency")
public List<Dependency> getDependencies() { public List<Dependency> getDependencies() {
return this.dependencies; return this.dependencies;
} }
@XmlManaged(false) @AknotManaged(false)
public Path getFileRealPath() { public Path getFileRealPath() {
return this.fileRealPath; return this.fileRealPath;
} }
@XmlName(value = "include") @AknotName(value = "include")
public List<String> getIncludes() { public List<String> getIncludes() {
return this.includes; return this.includes;
} }
@XmlName(value = "link") @AknotName(value = "link")
public List<Link> getLinks() { public List<Link> getLinks() {
return this.links; return this.links;
} }
@ -50,12 +50,12 @@ public class ManifestFile {
return this.options; return this.options;
} }
@XmlName(value = "project") @AknotName(value = "project")
public List<ProjectConfig> getProjects() { public List<ProjectConfig> getProjects() {
return this.projects; return this.projects;
} }
@XmlName(value = "remote") @AknotName(value = "remote")
public List<RemoteConfig> getRemotes() { public List<RemoteConfig> getRemotes() {
return this.remotes; return this.remotes;
} }

View File

@ -1,30 +1,33 @@
package org.atriasoft.island.model.manifest; package org.atriasoft.island.model.manifest;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public class MirrorConfig { public class MirrorConfig {
private String name; private String name;
private String fetch; private String fetch;
@XmlName({"name", "fetch"}) @AknotName({ "name", "fetch" })
public MirrorConfig(final String name, final String fetch) { public MirrorConfig(final String name, final String fetch) {
this.name = name; this.name = name;
this.fetch = fetch; this.fetch = fetch;
} }
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getFetch() { public String getFetch() {
return this.fetch; return this.fetch;
} }
public String getName() {
return this.name;
}
public void setFetch(final String fetch) { public void setFetch(final String fetch) {
this.fetch = fetch; this.fetch = fetch;
} }
public void setName(final String name) {
this.name = name;
}
} }

View File

@ -1,6 +1,6 @@
package org.atriasoft.island.model.manifest; package org.atriasoft.island.model.manifest;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotName;
public class OptionRepository { public class OptionRepository {
private String branchRelease; private String branchRelease;
@ -10,7 +10,6 @@ public class OptionRepository {
private String defaultRemote; private String defaultRemote;
private boolean synchronizeSubmodule; private boolean synchronizeSubmodule;
public OptionRepository() { public OptionRepository() {
this.branchRelease = "master"; this.branchRelease = "master";
this.branchDevelop = "dev"; this.branchDevelop = "dev";
@ -19,7 +18,9 @@ public class OptionRepository {
this.defaultRemote = "origin"; this.defaultRemote = "origin";
this.synchronizeSubmodule = false; this.synchronizeSubmodule = false;
} }
public OptionRepository(final String branchRelease, final String branchDevelop, final DeliverMode deliverMode, final String defaultBranch, final String defaultRemote, final boolean synchronizeSubmodule) {
public OptionRepository(final String branchRelease, final String branchDevelop, final DeliverMode deliverMode, final String defaultBranch, final String defaultRemote,
final boolean synchronizeSubmodule) {
this.branchRelease = branchRelease; this.branchRelease = branchRelease;
this.branchDevelop = branchDevelop; this.branchDevelop = branchDevelop;
this.deliverMode = deliverMode; this.deliverMode = deliverMode;
@ -27,65 +28,71 @@ public class OptionRepository {
this.defaultRemote = defaultRemote; this.defaultRemote = defaultRemote;
this.synchronizeSubmodule = synchronizeSubmodule; this.synchronizeSubmodule = synchronizeSubmodule;
} }
@XmlName(value="branch-release")
public String getBranchRelease() { @Override
return this.branchRelease; public OptionRepository clone() {
} // TODO Auto-generated method stub
public void setBranchRelease(final String branchRelease) { return new OptionRepository(this.branchRelease, this.branchDevelop, this.deliverMode, this.defaultBranch, this.defaultRemote, this.synchronizeSubmodule);
this.branchRelease = branchRelease;
} }
@XmlName(value="branch-develop") @AknotName(value = "branch-develop")
public String getBranchDevelop() { public String getBranchDevelop() {
return this.branchDevelop; return this.branchDevelop;
} }
@AknotName(value = "branch-release")
public String getBranchRelease() {
return this.branchRelease;
}
@AknotName(value = "default-branch")
public String getDefaultBranch() {
return this.defaultBranch;
}
@AknotName(value = "default-remote")
public String getDefaultRemote() {
return this.defaultRemote;
}
@AknotName(value = "deliver-mode")
public DeliverMode getDeliverMode() {
return this.deliverMode;
}
@AknotName(value = "synchronize-submodule")
public boolean isSynchronizeSubmodule() {
return this.synchronizeSubmodule;
}
public void setBranchDevelop(final String branchDevelop) { public void setBranchDevelop(final String branchDevelop) {
this.branchDevelop = branchDevelop; this.branchDevelop = branchDevelop;
} }
@XmlName(value="deliver-mode") public void setBranchRelease(final String branchRelease) {
public DeliverMode getDeliverMode() { this.branchRelease = branchRelease;
return this.deliverMode;
}
public void setDeliverMode(final DeliverMode deliverMode) {
this.deliverMode = deliverMode;
} }
@XmlName(value="default-branch")
public String getDefaultBranch() {
return this.defaultBranch;
}
public void setDefaultBranch(final String defaultBranch) { public void setDefaultBranch(final String defaultBranch) {
this.defaultBranch = defaultBranch; this.defaultBranch = defaultBranch;
} }
@XmlName(value="default-remote")
public String getDefaultRemote() {
return this.defaultRemote;
}
public void setDefaultRemote(final String defaultRemote) { public void setDefaultRemote(final String defaultRemote) {
this.defaultRemote = defaultRemote; this.defaultRemote = defaultRemote;
} }
@XmlName(value="synchronize-submodule") public void setDeliverMode(final DeliverMode deliverMode) {
public boolean isSynchronizeSubmodule() { this.deliverMode = deliverMode;
return this.synchronizeSubmodule;
} }
public void setSynchronizeSubmodule(final boolean downloadSubmodule) { public void setSynchronizeSubmodule(final boolean downloadSubmodule) {
this.synchronizeSubmodule = downloadSubmodule; this.synchronizeSubmodule = downloadSubmodule;
} }
@Override
public OptionRepository clone() {
// TODO Auto-generated method stub
return new OptionRepository( this.branchRelease, this.branchDevelop, this.deliverMode, this.defaultBranch, this.defaultRemote, this.synchronizeSubmodule);
}
@Override @Override
public String toString() { public String toString() {
return "OptionRepository [branchRelease=" + this.branchRelease + ", branchDevelop=" + this.branchDevelop + ", deliverMode=" + this.deliverMode + ", defaultBranch=" + this.defaultBranch + ", defaultRemote=" return "OptionRepository [branchRelease=" + this.branchRelease + ", branchDevelop=" + this.branchDevelop + ", deliverMode=" + this.deliverMode + ", defaultBranch=" + this.defaultBranch
+ this.defaultRemote + ", synchronizeSubmodule=" + this.synchronizeSubmodule + "]"; + ", defaultRemote=" + this.defaultRemote + ", synchronizeSubmodule=" + this.synchronizeSubmodule + "]";
} }
} }

View File

@ -3,12 +3,12 @@ package org.atriasoft.island.model.manifest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotOptional;
import org.atriasoft.exml.annotation.XmlOptional; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public class ProjectConfig { public class ProjectConfig {
private String name; private String name;
private String path; private String path;
@ -17,7 +17,7 @@ public class ProjectConfig {
private boolean volatileElement = false; private boolean volatileElement = false;
private List<RemoteConfig> remotes = new ArrayList<>(); private List<RemoteConfig> remotes = new ArrayList<>();
RemoteConfig selectRemotes = null; RemoteConfig selectRemotes = null;
// TODO remove this when Xml parser is ready ... // TODO remove this when Xml parser is ready ...
public ProjectConfig() { public ProjectConfig() {
this.name = null; this.name = null;
@ -25,72 +25,87 @@ public class ProjectConfig {
this.tag = null; this.tag = null;
this.branch = null; this.branch = null;
} }
@XmlName({"name", "path"})
@AknotName({ "name", "path" })
public ProjectConfig(final String name, final String path) { public ProjectConfig(final String name, final String path) {
this.name = name; this.name = name;
this.path = path; this.path = path;
this.tag = null; this.tag = null;
this.branch = null; this.branch = null;
} }
@XmlName({"name", "path", "branch"})
@AknotName({ "name", "path", "branch" })
public ProjectConfig(final String name, final String path, final String branch) { public ProjectConfig(final String name, final String path, final String branch) {
this.name = name; this.name = name;
this.path = path; this.path = path;
this.tag = null; this.tag = null;
this.tag = branch; this.tag = branch;
} }
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getPath() {
return this.path;
}
public void setPath(final String path) {
this.path = path;
}
@XmlOptional
public String getTag() {
return this.tag;
}
public void setTag(final String tag) {
this.tag = tag;
}
@XmlOptional
public void setBranch(final String branch) {
this.branch = branch;
}
public String getBranch() { public String getBranch() {
return this.branch; return this.branch;
} }
@XmlManaged(false) public String getName() {
return this.name;
}
public String getPath() {
return this.path;
}
@AknotManaged(false)
public List<RemoteConfig> getRemotes() { public List<RemoteConfig> getRemotes() {
return this.remotes; return this.remotes;
} }
public void setRemotes(final List<RemoteConfig> remotes) {
this.remotes = remotes; @AknotManaged(false)
}
@XmlManaged(false)
public RemoteConfig getSelectRemotes() { public RemoteConfig getSelectRemotes() {
return this.selectRemotes; return this.selectRemotes;
} }
public void setSelectRemotes(final RemoteConfig selectRemotes) {
this.selectRemotes = selectRemotes; @AknotOptional
public String getTag() {
return this.tag;
} }
@XmlManaged(false)
@AknotManaged(false)
public boolean isVolatile() { public boolean isVolatile() {
return this.volatileElement; return this.volatileElement;
} }
@AknotOptional
public void setBranch(final String branch) {
this.branch = branch;
}
public void setName(final String name) {
this.name = name;
}
public void setPath(final String path) {
this.path = path;
}
public void setRemotes(final List<RemoteConfig> remotes) {
this.remotes = remotes;
}
public void setSelectRemotes(final RemoteConfig selectRemotes) {
this.selectRemotes = selectRemotes;
}
public void setTag(final String tag) {
this.tag = tag;
}
public void setVolatile(final boolean volatileElement) { public void setVolatile(final boolean volatileElement) {
this.volatileElement = volatileElement; this.volatileElement = volatileElement;
} }
@Override @Override
public String toString() { public String toString() {
return "ProjectConfig [name=" + this.name + ", path=" + this.path + ", tag=" + this.tag +", branch=" + this.branch + ", volatileElement=" + this.volatileElement + ", remotes=" + this.remotes + ", selectRemotes=" + this.selectRemotes + "]"; return "ProjectConfig [name=" + this.name + ", path=" + this.path + ", tag=" + this.tag + ", branch=" + this.branch + ", volatileElement=" + this.volatileElement + ", remotes=" + this.remotes
+ ", selectRemotes=" + this.selectRemotes + "]";
} }
} }

View File

@ -3,62 +3,67 @@ package org.atriasoft.island.model.manifest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotOptional;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.exml.annotation.XmlOptional; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute @AknotDefaultAttribute
public class RemoteConfig { public class RemoteConfig {
private String name; // Local name of the remote. private String name; // Local name of the remote.
private String fetch; // Address to fetch. private String fetch; // Address to fetch.
private boolean sync = true; // Need to sync the submodule. private boolean sync = true; // Need to sync the submodule.
List<MirrorConfig> mirror; // List of all mirror available. List<MirrorConfig> mirror; // List of all mirror available.
@XmlName({"name", "fetch", "mirror"})
public RemoteConfig(final String name, final String fetch, final List<MirrorConfig> mirror) {
this.name = name;
this.fetch = fetch;
this.mirror = mirror;
}
public RemoteConfig() { public RemoteConfig() {
this.name = ""; this.name = "";
this.fetch = ""; this.fetch = "";
this.mirror = new ArrayList<>(); this.mirror = new ArrayList<>();
} }
public String getName() { @AknotName({ "name", "fetch", "mirror" })
return this.name; public RemoteConfig(final String name, final String fetch, final List<MirrorConfig> mirror) {
}
public void setName(final String name) {
this.name = name; this.name = name;
}
public String getFetch() {
return this.fetch;
}
public void setFetch(final String fetch) {
this.fetch = fetch; this.fetch = fetch;
}
@XmlAttribute(false)
public List<MirrorConfig> getMirror() {
return this.mirror;
}
public void setMirror(final List<MirrorConfig> mirror) {
this.mirror = mirror; this.mirror = mirror;
} }
@Override @Override
public RemoteConfig clone() { public RemoteConfig clone() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return new RemoteConfig(this.name, this.fetch, new ArrayList<>(this.mirror)); return new RemoteConfig(this.name, this.fetch, new ArrayList<>(this.mirror));
} }
@XmlOptional public String getFetch() {
return this.fetch;
}
@AknotAttribute(false)
public List<MirrorConfig> getMirror() {
return this.mirror;
}
public String getName() {
return this.name;
}
@AknotOptional
public boolean isSync() { public boolean isSync() {
return this.sync; return this.sync;
} }
public void setFetch(final String fetch) {
this.fetch = fetch;
}
public void setMirror(final List<MirrorConfig> mirror) {
this.mirror = mirror;
}
public void setName(final String name) {
this.name = name;
}
public void setSync(final boolean sync) { public void setSync(final boolean sync) {
this.sync = sync; this.sync = sync;
} }

View File

@ -1,14 +1,14 @@
package org.atriasoft.island.model.maven; package org.atriasoft.island.model.maven;
import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.aknot.annotation.AknotIgnoreUnknown;
import org.atriasoft.exml.annotation.XmlIgnoreUnknow; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotDefaultAttribute;
@XmlDefaultAttibute(false) @AknotDefaultAttribute(false)
@XmlIgnoreUnknow @AknotIgnoreUnknown
public record MavenMetadata( public record MavenMetadata(
@XmlName("groupId") String groupId, @AknotName("groupId") String groupId,
@XmlName("artifactId") String artifactId, @AknotName("artifactId") String artifactId,
@XmlName("versioning") Versioning versioning) { @AknotName("versioning") Versioning versioning) {
} }

View File

@ -1,16 +1,16 @@
package org.atriasoft.island.model.maven; package org.atriasoft.island.model.maven;
import org.atriasoft.exml.annotation.XmlDefaultNullValue; import org.atriasoft.aknot.annotation.AknotDefaultNullValue;
import org.atriasoft.exml.annotation.XmlIgnoreUnknow; import org.atriasoft.aknot.annotation.AknotIgnoreUnknown;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlOptional; import org.atriasoft.aknot.annotation.AknotOptional;
@XmlDefaultNullValue @AknotDefaultNullValue
@XmlIgnoreUnknow @AknotIgnoreUnknown
public record PomDependency( public record PomDependency(
@XmlName("groupId") String groupId, @AknotName("groupId") String groupId,
@XmlName("artifactId") String artifactId, @AknotName("artifactId") String artifactId,
@XmlOptional @XmlName("version") String version, @AknotOptional @AknotName("version") String version,
@XmlOptional @XmlName("scope") String scope) { @AknotOptional @AknotName("scope") String scope) {
} }

View File

@ -2,21 +2,20 @@ package org.atriasoft.island.model.maven;
import java.util.List; import java.util.List;
import org.atriasoft.exml.annotation.XmlDefaultNullValue; import org.atriasoft.aknot.annotation.AknotDefaultNullValue;
import org.atriasoft.exml.annotation.XmlIgnoreUnknow; import org.atriasoft.aknot.annotation.AknotIgnoreUnknown;
import org.atriasoft.exml.annotation.XmlList; import org.atriasoft.aknot.annotation.AknotList;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.exml.annotation.XmlOptional; import org.atriasoft.aknot.annotation.AknotOptional;
@XmlDefaultNullValue @AknotDefaultNullValue
@XmlIgnoreUnknow @AknotIgnoreUnknown
public record PomMaven ( public record PomMaven(
@XmlName("modelVersion") String modelVersion, @AknotName("modelVersion") String modelVersion,
@XmlName("groupId") String groupId, @AknotName("groupId") String groupId,
@XmlName("artifactId") String artifactId, @AknotName("artifactId") String artifactId,
@XmlName("version") String version, @AknotName("version") String version,
@XmlOptional @XmlName("name") String name, @AknotOptional @AknotName("name") String name,
@XmlOptional @XmlName("description") String description, @AknotOptional @AknotName("description") String description,
@XmlOptional @XmlName("url") String url, @AknotOptional @AknotName("url") String url,
@XmlOptional @XmlName("dependencies") @XmlList(value="dependency") List<PomDependency> dependencies) { @AknotOptional @AknotName("dependencies") @AknotList(value = "dependency") List<PomDependency> dependencies) {}
}

View File

@ -2,13 +2,13 @@ package org.atriasoft.island.model.maven;
import java.util.List; import java.util.List;
import org.atriasoft.exml.annotation.XmlList; import org.atriasoft.aknot.annotation.AknotList;
import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.aknot.annotation.AknotName;
public record Versioning( public record Versioning(
@XmlName("latest") String latest, @AknotName("latest") String latest,
@XmlName("release") String release, @AknotName("release") String release,
@XmlName("lastUpdated") String lastUpdated, @AknotName("lastUpdated") String lastUpdated,
@XmlName("versions") @XmlList(value="version") List<String> versions) { @AknotName("versions") @AknotList(value = "version") List<String> versions) {
} }