public VResult[] check(VObject object) { XModelObject o = ((VObjectImpl) object).getModelObject(); String paramName = o.getAttributeValue("param-name"); if (paramName == null) return null; XModelObject parent = o.getParent(); if (parent == null || !"WebAppServlet".equals(parent.getModelEntity().getName())) { return null; } if (!paramName.equals("config") && !paramName.startsWith("config/")) return null; String value = o.getAttributeValue("param-value"); if (value == null || value.length() == 0) return null; XModel model = getXModel(object); XModelObject webRoot = model == null ? null : model.getByPath("FileSystems/WEB-ROOT"); if (webRoot == null) return null; StringTokenizer st = new StringTokenizer(value, ","); while (st.hasMoreTokens()) { String path = st.nextToken().trim(); if (path.length() == 0) continue; XModelObject fc = XModelImpl.getByRelativePath(model, path); if (fc == null) { return fire(object, "config.exists", "param-value", path); } String path2 = path.startsWith("/") ? path.substring(1) : path; XModelObject fc2 = webRoot.getChildByPath(path2); if (fc2 == null) { return fire(object, "config.exists", "param-value", path); } if (!fc2.getModelEntity().getName().startsWith("StrutsConfig")) { return fire(object, "config.valid", "param-value", path); } } return null; }
public String setAttributeValue(String name, String value) { if ("read only".equals(name) && isActive()) { String ov = getAttributeValue("read only"); boolean changed = (value != null && !value.equals(ov)); String result = super.setAttributeValue(name, value); if (changed) { XModelObject p = getParent(); if (p != null) { XModelImpl m = (XModelImpl) getModel(); m.fireStructureChanged(p, XModelTreeEvent.STRUCTURE_CHANGED, p); } } return result; } else { return super.setAttributeValue(name, value); } }