- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {OutputStreamWriter o =
OutputStream out;new OutputStreamWriter(out)
OutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
HttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
- Smart code suggestions by Codota
}
@Override public void configure(Properties p){ super.configure(p); servant = PropertiesConstants.getString(p,"servant",servant); }
public CatalogNode getChildByPath(CatalogNode parent, Path _path) { if (parent == null){ parent = getRoot(); if (parent == null) return null; } if (_path.isRoot()){ return parent; } String __path = rootPath + parent.getPath() + _path; File rootFile = new File(__path); if (!rootFile.isDirectory() || !rootFile.exists()){ return null; } Path childPath = parent.getPath().append(_path); return createCatalogNode(childPath); }
public static void main(String [] args){ Settings settings = Settings.get(); settings.SetValue("home", "D:\\ecloud\\logicbus\\servants"); settings.addSettings(new CommandLine(args)); ServantCatalog catalog = new FileSystemServantCatalog(); catalog.configure(settings); ServantCatalogNode root = (ServantCatalogNode) catalog.getRoot(); scanCatalog(catalog,root); ServiceDescription sd = catalog.findService(new Path("/core/AclQuery")); if (sd != null){ logger.info(sd.getPath()); } sd = catalog.findService(new Path("/core/AclQuery2")); if (sd != null){ logger.info(sd.getPath()); } }
public CatalogNode getRoot() { return createCatalogNode(new Path("")); }
private static void scanCatalog(ServantCatalog sc,CatalogNode root) { CatalogNode[] children = sc.getChildren(root); logger.info("Package found:" + root.getPath()); ServantCatalogNode servantCatalogNode = (ServantCatalogNode) root; ServiceDescription[] services = servantCatalogNode.getServices(); logger.info("Service Cnt:" + services.length); for (ServiceDescription sd:services){ logger.info(sd.getPath()); } for (CatalogNode child : children) { scanCatalog(sc, child); } } }
ServiceDescription sd = toServiceDescription(_path,doc); if (sd == null){ continue;
/** * 在当前目录下查找服务定义信息 * @param id 服务的Id */ public ServiceDescription findService(Path id) { String pkg = id.getPackage(); String serviceId = id.getId(); ServantCatalogNodeImpl node = (ServantCatalogNodeImpl) getChildByPath(null,new Path(pkg)); if (node == null){ return null; } return node.findService(serviceId); }
public CatalogNode[] getChildren(CatalogNode parent) { String __path = rootPath + parent.getPath(); File rootFile = new File(__path); if (!rootFile.isDirectory() || !rootFile.exists()){ return null; } Vector<CatalogNode> nodes = new Vector<CatalogNode>(); File [] children = rootFile.listFiles(); if (children != null){ for (int i = 0 ; i < children.length ; i ++){ File child = children[i]; if (!child.isDirectory()){ continue; } Path childPath = parent.getPath().append(child.getName()); CatalogNode node = createCatalogNode(childPath); if (node != null){ nodes.add(node); } } } return nodes.toArray(new CatalogNode[0]); }
@Override public void configure(Properties p){ super.configure(p); servant = PropertiesConstants.getString(p,"servant",servant); visible = PropertiesConstants.getString(p,"visible",visible); log = PropertiesConstants.getString(p,"log",log); }