/** * 设置日志类型 * @param type * * @since 1.2.4.4 */ public void setLogType(String type){logType = parseLogType(type);}
@Override public void addWatcher(ServiceDescriptionWatcher watcher){ for (ServantCatalog catalog:catalogs){ if (catalog != null){ catalog.addWatcher(watcher); } } }
@Override public void removeWatcher(ServiceDescriptionWatcher watcher) { for (ServantCatalog catalog:catalogs){ if (catalog != null){ catalog.removeWatcher(watcher); } } } }
@Override protected void onCreate(ServiceDescription sd){ Properties props = sd.getProperties(); dftAvg = PropertiesConstants.getInt(props, "avg", dftAvg); }
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() + "/" + sd.getServiceID()); } for (CatalogNode child : children) { scanCatalog(sc, child); } } }
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); } } }
@Override public void configure(Properties p) { id = PropertiesConstants.getString(p,"id","",true); name = PropertiesConstants.getString(p, "name", getName(),true); note = PropertiesConstants.getString(p,"note",getNote(),true); visible = PropertiesConstants.getString(p, "visible", getVisible(),true); acGroupId = PropertiesConstants.getString(p, "acGroupId", getAcGroup(),true); privilege = PropertiesConstants.getString(p,"privilege", getPrivilege(),true); backendApp = PropertiesConstants.getString(p, "backendApp", getBackendApp(),true); backendPath = PropertiesConstants.getString(p, "backendPath",getBackendPath(),true); logType = parseLogType(PropertiesConstants.getString(p, "logType", getLogType().toString(),true)); }
private void report(ServantCatalogNode root,Element xml){ root.report(xml); Document doc = xml.getOwnerDocument(); CatalogNode [] children = getChildren(root); if (children == null || children.length <= 0) return ; for (int i = 0 ; i < children.length ; i ++){ Element catalog = doc.createElement("catalog"); report((ServantCatalogNode) children[i],catalog); xml.appendChild(catalog); } }
private void report(ServantCatalogNode root,Map<String,Object> json){ root.toJson(json); CatalogNode [] children = getChildren(root); if (children == null || children.length <= 0) return ; List<Object> catalogs = new ArrayList<Object>(); for (int i = 0 ; i < children.length ; i ++){ Map<String,Object> catalog = new HashMap<String,Object>(); report((ServantCatalogNode)children[i],catalog); catalogs.add(catalog); } json.put("catalog", catalogs); }
/** * 输出目录 * @param catalog 目录 * @param root 节点 * @param e 输出的Element */ protected void outputCatalog(ServantCatalog catalog,ServantCatalogNode root,Element e){ root.toXML(e); Document doc = e.getOwnerDocument(); CatalogNode [] children = catalog.getChildren(root); if (children == null || children.length <= 0) return ; for (int i = 0 ; i < children.length ; i ++){ Element _e = doc.createElement("catalog"); outputCatalog(catalog,(ServantCatalogNode)children[i],_e); e.appendChild(_e); } }
protected String getGroupId(Path serviceId, ServiceDescription servant,Context ctx){ return servant.getAcGroup(); }
public void report(Map<String, Object> json) { toJson(json); }
public void report(Element xml) { toXML(xml); }
/** * 查询指定服务的服务规格 * @param id 服务ID * @return 服务规格 */ public ServiceDescription get(Path id){ for (int i = 0 ; i < catalogs.size() ; i ++){ ServantCatalog __catalog = catalogs.elementAt(i); if (__catalog == null){ continue; } ServiceDescription sd = __catalog.findService(id); if (sd != null){ return sd; } } return null; }
@Override public void configure(Element e, Properties p) { Properties props = new XmlElementProperties(e,p); configure(props); }
/** * 初始化服务者 * * <br> * 根据服务描述初始化服务者. * * @param sd service description */ public void create(ServiceDescription sd){ desc = sd; timeOut = PropertiesConstants.getLong(sd.getProperties(), "time_out", 3000); }
@Override public void toXML(Element root) { if (root != null){ XmlTools.setString(root,"id",getServiceID()); XmlTools.setString(root,"name",getName()); XmlTools.setString(root,"note",getNote()); XmlTools.setString(root,"visible",getVisible()); XmlTools.setString(root,"log", logType.toString()); XmlTools.setString(root,"acGroupId",getAcGroup()); XmlTools.setString(root,"privilege",getPrivilege()); XmlTools.setString(root,"backendApp", getBackendApp()); XmlTools.setString(root,"backendPath",getBackendPath()); } }
public void create(ServiceDescription sd) throws ServantException{ super.create(sd); m_welcome = sd.getProperties().GetValue("welcome", "Welcome to Logic Bus Server!"); }
@Override public void toJson(Map<String, Object> json) { if (json != null){ JsonTools.setString(json,"id",getServiceID()); JsonTools.setString(json,"name",getName()); JsonTools.setString(json,"note",getNote()); JsonTools.setString(json,"visible",getVisible()); JsonTools.setString(json,"log", logType.toString()); JsonTools.setString(json,"acGroupId",getAcGroup()); JsonTools.setString(json,"privilege",getPrivilege()); JsonTools.setString(json,"backendApp", getBackendApp()); JsonTools.setString(json,"backendPath",getBackendPath()); } }
@Override protected void onCreate(ServiceDescription sd) { Properties p = sd.getProperties(); dftApp = PropertiesConstants.getString(p, "dftApp", dftApp); arguToken = PropertiesConstants.getString(p, "auth.para.token", arguToken); arguFromIp = PropertiesConstants.getString(p, "auth.para.fromIp", arguFromIp); arguCallback = PropertiesConstants.getString(p, "auth.para.callback", arguCallback); arguApp = PropertiesConstants.getString(p, "auth.para.app", arguApp); ipBinded = PropertiesConstants.getBoolean(p, "auth.ip.binded", ipBinded); }