1 18 19 package org.objectweb.jac.ide; 20 21 import java.lang.Class ; 22 import java.util.Collection ; 23 import java.util.List ; 24 import java.util.Set ; 25 import java.util.Vector ; 26 import org.objectweb.jac.core.ACManager; 27 import org.objectweb.jac.core.AspectComponent; 28 import org.objectweb.jac.core.Jac; 29 import org.objectweb.jac.util.File; 30 31 public class AspectConfiguration extends ModelElement { 32 33 public AspectConfiguration() { 34 } 35 36 public AspectConfiguration(String aspectName) { 37 this.name = aspectName; 38 } 39 40 public String toString() { 41 String _name=null; 42 if (name != null) { 43 _name=name; 44 } else if(aspect!=null) { 45 _name=aspect.getName(); 46 } 47 if (_name!=null) { 48 if(woven) 49 return _name+" *"; 50 else 51 return _name; 52 } else { 53 return super.toString(); 54 } 55 } 56 57 Application application; 58 59 63 public Application getApplication() { 64 return application; 65 } 66 67 71 public void setApplication(Application v) { 72 this.application = v; 73 } 74 75 String name; 76 77 81 public String getName() { 82 return name; 83 } 84 85 89 public void setName(String v) { 90 this.name = v; 91 } 92 93 public static Set getDeclaredAspects(Object substance) { 94 return ACManager.getACM().getDeclaredACs(); 95 } 96 97 Aspect aspect; 98 99 103 public Aspect getAspect() { 104 return aspect; 105 } 106 107 111 public void setAspect(Aspect v) { 112 this.aspect = v; 113 } 114 115 boolean woven = true; 116 117 121 public boolean isWoven() { 122 return woven; 123 } 124 125 129 public void setWoven(boolean v) { 130 this.woven = v; 131 } 132 133 public boolean canReload() { 134 return application!=null && application.isStarted() && application.isDistributionEnabled(); 135 } 136 137 140 public void reload() throws Throwable { 141 if (!application.isStarted()) { 142 org.objectweb.jac.aspects.gui.Actions.showStatus( 143 "Application is not started: cannot reload configuration"); 144 return; 145 } 146 147 org.objectweb.jac.aspects.gui.Actions.showStatus("Reloading aspect configuration '"+ 148 name+"'..."); 149 150 Jac.remoteReloadAspect(getApplication().getName(), 151 getApplication().getServerName(),name); 152 } 153 154 String configurationCode = ""; 155 156 160 public String getConfigurationCode() { 161 return configurationCode; 162 } 163 164 168 public void setConfigurationCode(String v) { 169 this.configurationCode = v; 170 } 171 172 String defaultConfigurationCode = ""; 173 174 178 public String getDefaultConfigurationCode() { 179 return defaultConfigurationCode; 180 } 181 182 186 public void setDefaultConfigurationCode(String v) { 187 this.defaultConfigurationCode = v; 188 } 189 190 191 private List configItems=new Vector (); 192 193 197 public void addConfigItem(ConfigItem config){ 198 configItems.add(config); 199 } 200 201 205 public void removeConfigItem(ConfigItem config){ 206 configItems.remove(config); 207 } 208 209 213 public Collection getConfigurationMethods() 214 { 215 String acClassName = ACManager.getACM().getACPathFromName(name); 216 try { 217 Class acClass = Class.forName(acClassName); 218 AspectComponent acInstance = (AspectComponent)acClass.newInstance(); 219 return acInstance.getConfigurationMethods(); 220 } catch (Exception e) { 221 } 222 return new Vector (); 223 } 224 } 225 | Popular Tags |