38 lines
902 B
Java
38 lines
902 B
Java
|
package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.template;
|
||
|
|
||
|
import java.io.File;
|
||
|
import java.io.IOException;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Vector;
|
||
|
|
||
|
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
|
||
|
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleSerializeHelper;
|
||
|
|
||
|
public class StaticRoleManager {
|
||
|
|
||
|
private String root;
|
||
|
|
||
|
public StaticRoleManager(String root) {
|
||
|
this.root = root;
|
||
|
}
|
||
|
|
||
|
public String getRoot() {
|
||
|
return this.root;
|
||
|
}
|
||
|
|
||
|
public Collection<Role> getStaticRoles() {
|
||
|
Collection<Role> out = new Vector<>();
|
||
|
for(File f: new File(this.getRoot()).listFiles()) {
|
||
|
try {
|
||
|
out.add(AnsibleSerializeHelper.deserializeRoleFromFilesystem(f));
|
||
|
} catch(IOException e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
}
|
||
|
return out;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|