⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showserverinfo.java

📁 关于Ultraseek的一些用法,刚初学,所以都是比较简单
💻 JAVA
字号:
/* -*- mode:java; indent-tabs-mode:nil; c-basic-offset:2 -*- * *  $RCSFile$ $Revision: 1.6 $ $Date: 2006/01/28 01:00:40 $ * *  Copyright (c) 2004 Autonomy Corp.  All Rights Reserved. *  Permission to use, copy, modify, and distribute this file is hereby *  granted without fee, provided that the above copyright notice appear *  in all copies. */import java.io.*;import java.net.*;import java.util.*;import com.ultraseek.xpa.server.*;/** * Show diagnostic information for an Ultraseek server. * @since XPA2.2 */public class ShowServerInfo {  public ShowServerInfo() { }  public static void lineup(StringBuffer sb, int col, String str ) {    if (sb.length() >= col) {      sb.setLength(col-1);      sb.append(" ");    } else {      while (sb.length() < col) {        sb.append(" ");      }    }    sb.append( str );  }  public static void showUltraseekServerInfo(UltraseekServer server) {    try {      System.out.println( server.getProtocol() + "://" + server.getHost() + ":" + server.getPort() );      if (server.getIsUltraSpider())        System.out.print( "Ultra Spider:   " );      else        System.out.print( "Ultraseek:      " );      System.out.println( "Version: " + server.getVersionString() );      System.out.println( "Timestamp:      " + server.getConfigurationTimestamp() );      System.out.println( "Default Locale: " + server.getLocale() );      System.out.print  ( "Locales:        " );      boolean first = true;      Iterator i = server.getLocales().iterator();      while (i.hasNext()) {        Locale l = (Locale) i.next();        if (!first) {          System.out.print(",");        } else {          first = false;        }        System.out.print( "" + l );      }      System.out.println();      System.out.println( "Default Style:  " + server.getDefaultStyle() );      System.out.print  ( "Styles:         " );      i = server.getStyles().iterator();      first = true;      while (i.hasNext()) {        String l = (String) i.next();        if (!first) {          System.out.print(",");        } else {          first = false;        }        System.out.print( "" + l );      }      System.out.println();      System.out.println( "Collections: " );      i = server.getSearchCollections().iterator();      StringBuffer sb = new StringBuffer(120);      sb.setLength(0);      lineup(sb,  1, "ID" );      lineup(sb, 10, "Name" );      lineup(sb, 23, "Type" );      lineup(sb, 30, "Show?" );      lineup(sb, 37, "Search?" );      lineup(sb, 46, "Locale" );      lineup(sb, 53, "Threads");      lineup(sb, 56, "Docs");      lineup(sb, 63, "Status");      System.out.println(sb);      sb.setLength(0);      for (int j = 0; j < 70; j++) sb.append("-");      System.out.println(sb);      while (i.hasNext()) {        UltraseekCollection col = (UltraseekCollection) i.next();        String type = col.getClass().getName();        type = type.substring(type.lastIndexOf(".")+1);        sb.setLength(0);        lineup(sb,  1, col.getID() );        lineup(sb, 10, col.getName() );        lineup(sb, 23, type );        lineup(sb, 30, (col.getDefaultShow() ? " show " : "noshow" ));        lineup(sb, 37, (col.getDefaultSearch() ? " search " : "nosearch" ));        lineup(sb, 46, (""+col.getLocale()));        UltraseekCollectionStatus stat = col.getStatus();        lineup(sb, 53, ("" + stat.getNumActiveThreads() ));        lineup(sb, 56, ("" + stat.getNumIndexedDocuments() ));        lineup(sb, 63, stat.getStatus() );        //lineup(sb, 80, "" + stat );        System.out.println(sb);      }    } catch (IOException e) {      System.out.println("Exception: " + e );    }  }  public static void main(String[] args) throws Exception {    InputStreamReader inputStreamReader = new InputStreamReader(System.in);    BufferedReader bufferedReader = new BufferedReader(inputStreamReader);    System.out.println();    System.out.println("This demo shows information about");    System.out.println("a running Ultraseek instance.");    System.out.println();    URL url = null;    while (url == null) {      System.out.println("Enter the URL (including TCP port) of your");      System.out.println("running Ultraseek instance.");      System.out.print("URL: ");      String url_string = bufferedReader.readLine();      if (!url_string.toLowerCase().startsWith("http"))        url_string = "http://" + url_string;      try {        url = new URL(url_string);      } catch (MalformedURLException e) {        System.out.println("" + e);      }    }    UltraseekServer server = new UltraseekServer(url);    System.out.println();    showUltraseekServerInfo(server);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -