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

📄 clienttransportmodule.java

📁 数字图书馆的互操作接口
💻 JAVA
字号:
package dli2fe.helpers;

/**
 * Title:        Digial Library Interoperable Interface Fudan Edition
 * Description:  This project contains all the classes required for DLI2FE interface. Developers use these classes to implement the wrapper and client side codes. The basic functions of DLI2FE is as follows:
 * Search: Search a digital library source site.
 * Metadata: Fetch metadata for a site.
 * ResultAccess: Get results for a given query.
 * DLI2FE uses Dublin Core as the basic attribute model, DAV/DASL as the general XML-based query language and CORBA as distributed object transportation mechanism.
 * Copyright:    Copyright (c) 2001
 * Company:      Fudan University
 * @author Carl Tao
 * @version 1.0
 */
import dli2fe.*;
import java.util.Hashtable;

public abstract class ClientTransportModule implements Metadata, Searcher, ResultAccess{
  static Hashtable tms = new Hashtable();
  static boolean isInited = false;

  abstract public void setLspURI(String uri) throws DLI2FEException;

  static void init() {
    isInited = true;
    /* register handlers for http and dli2fens */
    tms.put("http", "dli2fe.helpers.ClientCORBATransport");
    tms.put(DLI2FE.NameServerURISchema, "dli2fe.helpers.ClientCORBATransport");
  }

  public static final ClientTransportModule create(String uri) throws DLI2FEException {
    if (!isInited)
      init();
    Class cls = null;
    int i = uri.indexOf(":");
    if (i > 0) {
      String prefix = uri.substring(0, i).toLowerCase();
      String className = (String)tms.get(prefix);
      if (className != null) {
        try {
          cls = Class.forName(className);
        } catch (Exception any) {};
      }
    }

    if (cls == null) {
      throw new RuntimeException("[Client Transport] Do not know how to create transprot for " + uri);
    }

    try {
      ClientTransportModule tm = (ClientTransportModule)cls.newInstance();
      tm.setLspURI(uri);
      return tm;
    } catch (Exception any) {
      if (any instanceof DLI2FEException)
        throw (DLI2FEException)any;
      else
        throw new RuntimeException("[Client Transport] Can not create transport module: " + any);
    }
  }

}

⌨️ 快捷键说明

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