1 package org.apache.maven.profiles.activation; 2 3 import org.apache.maven.model.Activation; 4 import org.apache.maven.model.ActivationFile; 5 import org.apache.maven.model.Profile; 6 import org.codehaus.plexus.util.FileUtils; 7 8 23 24 public class FileProfileActivator 25 extends DetectedProfileActivator 26 { 27 protected boolean canDetectActivation( Profile profile ) 28 { 29 return profile.getActivation() != null && profile.getActivation().getFile() != null; 30 } 31 32 public boolean isActive( Profile profile ) 33 { 34 Activation activation = profile.getActivation(); 35 36 ActivationFile actFile = activation.getFile(); 37 38 if ( actFile != null ) 39 { 40 String fileString = actFile.getExists(); 42 43 if ( fileString != null && !"".equals( fileString ) ) 44 { 45 return FileUtils.fileExists( fileString ); 46 } 47 48 fileString = actFile.getMissing(); 50 51 if ( fileString != null && !"".equals( fileString ) ) 52 { 53 return !FileUtils.fileExists( fileString ); 54 } 55 } 56 57 return false; 58 } 59 } 60 | Popular Tags |