1 23 24 package com.sun.enterprise.config.serverbeans.validation.tests; 25 26 import java.util.Locale ; 27 import java.util.logging.Level ; 28 import java.io.File ; 29 import java.util.Vector ; 30 31 import com.sun.enterprise.config.serverbeans.validation.GenericValidator; 32 import com.sun.enterprise.config.serverbeans.validation.ValidationDescriptor; 33 import com.sun.enterprise.config.serverbeans.validation.Result; 34 import com.sun.enterprise.config.serverbeans.ServerTags; 35 import com.sun.enterprise.config.serverbeans.Profiler; 36 import com.sun.enterprise.config.serverbeans.validation.AttrClassName; 37 import com.sun.enterprise.config.serverbeans.validation.tests.StaticTest; 38 39 import com.sun.enterprise.config.ConfigBean; 40 import com.sun.enterprise.config.ConfigContextEvent; 41 import com.sun.enterprise.config.ConfigException; 42 43 49 50 public class ProfilerTest extends GenericValidator { 51 52 public ProfilerTest(ValidationDescriptor desc) { 53 super(desc); 54 } 55 56 public Result validate(ConfigContextEvent cce) { 57 Result result = super.validate(cce); 59 if(cce.getChoice().equals(StaticTest.VALIDATE)) { 60 Profiler profiler = (Profiler) cce.getObject(); 61 validateAttribute(ServerTags.CLASSPATH, profiler.getClasspath(), result); 62 JvmOptionsTest.validateJvmOptions(profiler.getJvmOptions(), result); 63 } 64 65 if(cce.getChoice().equals(StaticTest.UPDATE)) { 66 validateAttribute(cce.getName(), (String ) cce.getObject(), result); 67 } 68 else if(cce.getChoice().equals(StaticTest.SET)) { 69 final String name = cce.getName(); 70 75 if (name.equals("JvmOptions")) { 76 JvmOptionsTest.validateJvmOptions((String [])cce.getObject(), result); 77 } 78 } 79 return result; 80 } 81 82 public void validateAttribute(String name, String value, Result result) { 83 84 if(value == null || value.equals("")) 85 return; 86 if(name.equals(ServerTags.CLASSPATH)) { 87 if(!StaticTest.isClassPathValid(value)) { 88 result.failed(smh.getLocalString(getClass().getName() + ".invalidProfilerClasspath", 89 "Attribute:(classpath={0}), Invalid path in classpath", new Object []{value})); 90 } 91 } 92 } 93 } 94 | Popular Tags |