public static String resourceNameFromConfigBeanType( final Dom parent, String collectionName, final Class<? extends ConfigBeanProxy> childType) { final StringBuilder sb = new StringBuilder(resourceNameFromDom(parent)).append('/'); final String tagName = parent.document.buildModel(childType).getTagName(); if (collectionName != null) { if (collectionName.isEmpty()) { collectionName = pluralize(tagName); } sb.append(collectionName).append('/'); } sb.append(tagName); return sb.toString(); }
public static String resourceNameFromConfigBeanType( final Dom parent, String collectionName, final Class<? extends ConfigBeanProxy> childType) { final StringBuilder sb = new StringBuilder(resourceNameFromDom(parent)).append('/'); final String tagName = parent.document.buildModel(childType).getTagName(); if (collectionName != null) { if (collectionName.isEmpty()) { collectionName = pluralize(tagName); } sb.append(collectionName).append('/'); } sb.append(tagName); return sb.toString(); }
public static String resourceNameFromDom(Dom d) { Dom lastDom = null; final StringBuilder path = new StringBuilder(); while (d != null) { if (path.length() > 0) { path.insert(0, '/'); } final ConfigModel m = d.model; lastDom = d; final String key = d.getKey(); final String pathSegment = m.getTagName() + (key == null ? "" : "/" + key); path.insert(0, pathSegment); d = d.parent(); } if (lastDom != null) { if (lastDom.getKey() != null) { path.insert(0, pluralize(lastDom.model.getTagName()) + '/'); } } return path.toString(); }
public static String resourceNameFromDom(Dom d) { Dom lastDom = null; final StringBuilder path = new StringBuilder(); while (d != null) { if (path.length() > 0) { path.insert(0, '/'); } final ConfigModel m = d.model; lastDom = d; final String key = d.getKey(); final String pathSegment = m.getTagName() + (key == null ? "" : "/" + key); path.insert(0, pathSegment); d = d.parent(); } if (lastDom != null) { if (lastDom.getKey() != null) { path.insert(0, pluralize(lastDom.model.getTagName()) + '/'); } } return path.toString(); }
indentingXMLStreamWriter = new IndentingXMLStreamWriter(writer); Dom configBeanDom = Dom.unwrap(configBean); configBeanDom.writeTo(configBeanDom.model.getTagName(), indentingXMLStreamWriter); indentingXMLStreamWriter.flush(); s = bos.toString();
String childTypeName = childCM.targetTypeName; if (childTypeName.equals(child.getName())) { return childCM.getTagName(); for (ConfigModel subChildModel : subChildrenModels) { if (subChildModel.targetTypeName.equals(child.getName())) { return subChildModel.getTagName();
private static void listRefs(Dom dom, String value, List<String> refs) { //this method is rather ugly, but it works. See 9340 which presents a compatibility issue //frankly, it makes no sense to do an extensive search of all references of <system-property> being deleted, //but that's what resolution of this issue demands. --- Kedar 10/5/2009 for (String aname : dom.getAttributeNames()) { String raw = dom.rawAttribute(aname); if (raw != null && raw.equals(value)) { refs.add(dom.model.getTagName() + ":" + aname); } } for (String ename : dom.getElementNames()) { List<Dom> nodes = null; try { nodes = dom.nodeElements(ename); } catch(Exception e) { //ignore, in some situations, HK2 might throw ClassCastException here } if (nodes != null) { for (Dom node : nodes) listRefs(node, value, refs); //beware: recursive call ... } } } }