use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.
the class V3AgentInAdapter method adapt.
@Override
public Agent adapt(V3Agent from) {
Agent to = new Agent();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetAddress()) {
to.setAddress(from.getAddress());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetConcurrent()) {
to.setConcurrent(from.isConcurrent());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetEncryptOptions()) {
to.setEncryptOptions(from.isEncryptOptions());
}
if (from.isSetHost()) {
to.setHost(adaptIn(from.getHost()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOptions()) {
to.setOptions(new Options());
to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
}
if (from.isSetOrder()) {
to.setOrder(from.getOrder());
}
if (from.isSetPassword()) {
to.setPassword(from.getPassword());
}
if (from.isSetPort()) {
to.setPort(from.getPort());
}
if (from.isSetType()) {
to.setType(from.getType());
}
if (from.isSetUsername()) {
to.setUsername(from.getUsername());
}
return to;
}
use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.
the class FenceOptionsParser method parse.
/* Format of @str is <agent>;<agent>;...
* Format of @typeStr is <name>=<type>,<name=type>,...
*/
public static List<Agent> parse(String str, String typeStr, boolean ignoreValues) {
List<Agent> ret = new ArrayList<>();
Map<String, String> types = parseTypes(typeStr);
for (String agent : str.split(";", -1)) {
if (!agent.isEmpty()) {
Agent parsedAgent = parseAgent(agent, types, ignoreValues);
if (parsedAgent != null) {
ret.add(parsedAgent);
}
}
}
return ret;
}
use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.
the class FenceOptionsParser method parseAgent.
/* Format is <agent>:<name=value>,<name=value>,...
*
* e.g. alom:secure=secure,port=ipport
*/
private static Agent parseAgent(String str, Map<String, String> types, boolean ignoreValues) {
String[] parts = str.split(":", -1);
if (parts.length != 2) {
log.error("Invalid fencing agent description \"{}\".", str);
return null;
}
Agent ret = new Agent();
ret.setType(parts[0]);
ret.setOptions(parseOptions(parts[1], types, ignoreValues));
return ret;
}
use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.
the class BackendFenceAgentsResource method mapCollection.
private Agents mapCollection(List<FenceAgent> fenceAgents) {
Agents agents = new Agents();
for (FenceAgent fenceAgent : fenceAgents) {
Agent agent = map(fenceAgent, null);
agents.getAgents().add(addLinks(populate(agent, fenceAgent)));
}
return agents;
}
Aggregations