DefaultServiceDescription sd = new DefaultServiceDescription(id);
String id = name.substring(start + 1, end); Path childPath = _path.append(id); DefaultServiceDescription sd = new DefaultServiceDescription(childPath.getId()); sd.setModule(servant); sd.setName(id);
/** * 从XML节点中提取服务描述信息 * @param _path 父节点路径 * @param root XML节点 * @return 服务描述信息 */ protected ServiceDescription toServiceDescription(Path _path,Element root){ String id = root.getAttribute("id"); if (id == null){ return null; } Path childPath = _path.append(id); DefaultServiceDescription sd = new DefaultServiceDescription(childPath.getId()); sd.fromXML(root); sd.setPath(childPath.getPath()); return sd; }
private void serviceFound(Element element,ServantCatalogNodeImpl node, String src,Class<?> bootstrap) { //从xml文件名中获取服务id int end = src.lastIndexOf('.'); int start = src.lastIndexOf('/'); String id = src.substring(start + 1, end); Path childPath = node.getPath().append(id); DefaultServiceDescription sd = new DefaultServiceDescription(childPath.getId()); sd.setModule(servant); sd.setName(id); sd.setNote(id); sd.setPath(childPath.getPath()); String visible = element.getAttribute("visible"); sd.setVisible(StringUtils.isNotEmpty(visible)?visible:"public"); String log = element.getAttribute("log"); sd.setLogType(StringUtils.isNotEmpty(log)?log:"brief"); sd.getProperties().SetValue("script", src); sd.getProperties().SetValue("bootstrap", bootstrap.getName()); node.addService(sd.getServiceID(), sd); } }
protected ServiceDescription toServiceDescription(Path _path,Element root){ String id = root.getAttribute("id"); if (id == null){ return null; } Path childPath = _path.append(id); DefaultServiceDescription sd = new DefaultServiceDescription(childPath.getId()); sd.fromXML(root); //保存module String module = sd.getModule(); Properties p = sd.getProperties(); p.SetValue("servant.impl", module); sd.setModule(servant); sd.setPath(childPath.getPath()); return sd; }