package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.template; import java.util.Collection; import java.util.NoSuchElementException; import java.util.Vector; import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; ***REMOVED*** public class CustomDependencyPackage extends DependencyPackage ***REMOVED*** private Logger logger; public CustomDependencyPackage(Dependency dependency) ***REMOVED*** super(dependency); ***REMOVED*** ***REMOVED*** private String getCustomRepositoryLocation(String ansibleRoot) ***REMOVED*** ***REMOVED*** return ansibleRoot+"/custom"; ***REMOVED*** ***REMOVED*** /* public void serializeTo(String ansibleRoot) ***REMOVED*** for(String mode:new String[]***REMOVED***"add", "remove", "update"***REMOVED***) ***REMOVED*** ***REMOVED*** look for roles in the 'custom' repository try ***REMOVED*** ***REMOVED*** role name String roleName = this.getDependency().getType()+"-"+this.getDependency().getName()+("add".equals(mode) ? "" : "-"+mode); ***REMOVED*** look for the custom role File src = new File(this.getCustomRepositoryLocation(ansibleRoot)+"/"+roleName); System.out.println("** CUSTOM ** " + src); if(src.exists()) ***REMOVED*** ***REMOVED*** do copy System.out.println("copying CUSTOM role"); File dest = new File(ansibleRoot+"/work/"+roleName); FileUtils.copyDirectory(src, dest); ***REMOVED*** ***REMOVED*** catch(IOException e) ***REMOVED*** e.printStackTrace(); ***REMOVED*** ***REMOVED*** ***REMOVED*** */ public Collection getRoles(CustomRoleManager crm) ***REMOVED*** Collection out = new Vector<>(); ***REMOVED*** for(String mode:new String[]***REMOVED***"add", "remove", "update"***REMOVED***) ***REMOVED*** for(String mode:new String[]***REMOVED***"add"***REMOVED***) ***REMOVED*** ***REMOVED*** "remove", "update" ***REMOVED*** role name String roleName = this.getDependency().getType()+"-"+this.getDependency().getName()+("add".equals(mode) ? "" : "-"+mode); try ***REMOVED*** ***REMOVED*** look for custom role Role role = crm.getRole(roleName); if(role!=null) ***REMOVED*** out.add(role); ***REMOVED*** ***REMOVED*** catch (NoSuchElementException e) ***REMOVED*** ***REMOVED*** e.printStackTrace(); this.logger.warn("WARNING: no custom role found for " + roleName); ***REMOVED*** ***REMOVED*** return out; ***REMOVED*** ***REMOVED***