/**
* Title: Generic backend Z3950 association
* @version: $Id: ZServerAssociation.java,v 1.67 2004/04/14 13:21:43 ianibbo Exp $
* Copyright: Copyright (C) 2001 Knowledge Integration Ltd.
* @author: Ian Ibbotson (ibbo@k-int.com)
* Company: KI
* Description:
*/
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2.1 of
// the license, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite
// 330, Boston, MA 02111-1307, USA.
//
/*
* $Log: ZServerAssociation.java,v $
* Revision 1.67 2004/04/14 13:21:43 ianibbo
* Updated.. new a2j
*
* Revision 1.66 2004/03/17 09:51:46 ianibbo
* UPdated
*
* Revision 1.65 2004/03/09 06:36:16 ianibbo
* Updated
*
* Revision 1.64 2003/09/28 10:17:46 ianibbo
* Syncing up after a week away...
*
* Revision 1.63 2003/07/23 12:47:54 rob_tice
* Added default element set name property and checking - rob
*
* Revision 1.62 2003/06/17 18:26:05 rob_tice
* Null pointer exception in SearchException if no diagnostic fixed - rob
* Default esn and format pulled from properties if not specified in search - rob
* Scan exception caught ans different response submitted - rob
* search task==null chaeck moved to stop null pointer exception - rob
*
* Revision 1.61 2003/05/09 12:54:48 rob_tice
* Updated diagnostics and started removal of unused imports
*
* Revision 1.60 2003/02/14 16:42:06 ianibbo
* Better chance of not thowing a class cast exception if we just call toString
* on searchexception reason.
*
* Revision 1.59 2003/02/03 12:36:52 ianibbo
* Updated constants and added normarc as a recsyn in server
*
* Revision 1.58 2002/12/11 10:25:32 ianibbo
* Removed TASK_EXECUTING_ASYNC and TASK_EXECUTING_SYNC with TASK_EXECUTING.
* Made HSSSearchTask behave a little better WRT timeouts.
*
* Revision 1.57 2002/12/09 15:37:14 ianibbo
* Fixed license text cut and paste error... All files should now be correctly
* GPL.
*
* Revision 1.56 2002/11/19 13:36:09 ianibbo
* Making iso2709 generator work with internally defined iso2709 record structure
*
* Revision 1.55 2002/11/19 10:16:04 ianibbo
* Small fix for z-server mappings dir
*
* Revision 1.54 2002/11/16 08:03:07 ianibbo
* Set default buffer size in Z Endpoint
*
* Revision 1.53 2002/07/28 13:47:45 ianibbo
* Simplified InformationFragmentSource *considerably*
*
* Revision 1.52 2002/07/18 13:55:58 ianibbo
* Recompiled all codecs to support serialization. Added socket timeout to ZEndpoint
*
* Revision 1.51 2002/07/03 17:17:55 ianibbo
* First attempt at merging ralphs assoc changes with setprefrecsyn on search task.
*
* Revision 1.50 2002/07/01 14:28:14 ianibbo
* Updated a2jruntime that understands new marc variants and added appropriate
* lines into Z client.
*
* Revision 1.49 2002/06/19 12:44:24 ianibbo
* Included ralphs changes to the ZServerAssociation that provide diagnostics
* when record conversion fails.
*
*/
package com.k_int.z3950.server;
import java.net.*;
import java.util.Hashtable;
import java.util.Vector;
import java.util.Properties;
import java.util.Enumeration;
import com.k_int.util.ISO2709Builder;
import com.k_int.z3950.util.*;
import com.k_int.gen.AsnUseful.*;
import com.k_int.gen.Z39_50_APDU_1995.*;
import com.k_int.gen.NegotiationRecordDefinition_charSetandLanguageNegotiation_3.*;
import java.math.BigInteger;
// Used to represent arbritray query structures
import com.k_int.util.RPNQueryRep.*;
// for OID Register
import com.k_int.codec.util.*;
import com.k_int.IR.*;
import com.k_int.IR.Syntaxes.Conversion.*;
// For XML components
import org.w3c.dom.Document;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
// For log4j logging
import com.k_int.util.LoggingFacade.*;
public class ZServerAssociation implements TargetAPDUListener
{
private Searchable search_service = null;
private ZTargetEndpoint assoc = null;
private Hashtable active_searches = new Hashtable();
private OIDRegister reg = OIDRegister.getRegister();
private static LoggingContext cat = LogContextFactory.getContext("com.k_int.z3950.server.ZServerAssociation");
private XSLConverter record_schema_convertor;
private int dbg_counter = 0;
private GenericEventToTargetListenerAdapter event_adapter = null;
private String default_element_set_name = null;
private String default_record_format = null;
private boolean allow_concurrent_operations = true;
private int backend_search_timeout = 60000;
public ZServerAssociation(Socket s, Class search_service_class, Properties p)
{
dbg_counter++;
try
{
this.search_service = (Searchable)(search_service_class.newInstance());
}
catch ( Exception e )
{
e.printStackTrace();
}
search_service.init(p);
record_schema_convertor=XSLConverter.getConvertor(p);
String allow_concurrent_operations_str = p.getProperty("AllowConcurrentOperations");
if ( ( allow_concurrent_operations_str != null ) && ( allow_concurrent_operations_str.equalsIgnoreCase("false") ) )
allow_concurrent_operations = false;
String backend_search_timeout_str = p.getProperty("BackendSearchTimeout");
if ( backend_search_timeout_str != null )
backend_search_timeout = Integer.parseInt(backend_search_timeout_str);
// record_schema_convertor.setTemplateSource(p.getProperty("MappingsDir"));
default_element_set_name= p.getProperty("DefaultElementSetName");
if (default_element_set_name == null)
{
cat.debug("No default element set name supplied, setting to b");
default_element_set_name="b";
}
else if ( default_element_set_name.equals("b") || default_element_set_name.equals("f"))
{;}
else
{
cat.warn("Default Element Set Name not defined as b or f - overriding and setting to b");
default_element_set_name="b";
}
default_record_format = p.getProperty("DefaultRecordFormat");
assoc = new ZTargetEndpoint(s);
event_adapter = new GenericEventToTargetListenerAdapter(this);
assoc.getPDUAnnouncer().addObserver( event_adapter );
assoc.start();
}
protected void finalize() throws Throwable
{
dbg_counter--;
cat.debug("ZServerAssociation::finalize() - "+dbg_counter+" remaining");
}
public void incomingInitRequest(APDUEvent e)
{
cat.debug("Incoming initRequest....");
InitializeRequest_type init_request = (InitializeRequest_type) (e.getPDU().o);
for ( int i=0; i<Z3950Constants.z3950_option_names.length; i++ )
{
if ( init_request.options.isSet(i) )
cat.info("Origin requested service: "+Z3950Constants.z3950_option_names[i]);
}
// Did the origin request scan?
if ( init_request.options.isSet(7) )
{
// Does our backend support scan?
if ( ! ( this.search_service instanceof Scanable ) )
{
init_request.options.clearBit(7);
cat.info("Origin requested scan, not supported by this backend realisation.");
}
else
{
Scanable s = (Scanable)this.search_service;
if ( ! s.isScanSupported() )
{
init_request.options.clearBit(7);
cat.info("Origin requested scan, not supported by this instance of the search backend");
}
}
}
if ( ( init_request.options.isSet(13) ) && ( !allow_concurrent_operations ) )
{
in
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Z39.50源码 JZKIt 源码 (2927个子文件)
z3950v3.asn 121KB
z3950v3.asn 121KB
charset.asn 10KB
charset.asn 10KB
useful.asn1 1KB
useful.asn1 1KB
Changelog 13KB
Z3950Origin.class 28KB
ZEndpoint.class 25KB
SynchronousOriginBean.class 19KB
ZClient.class 19KB
DiagnosticHandler.class 17KB
AggregateFragmentSource.class 16KB
Z3950SearchTask.class 15KB
ZTargetEndpoint.class 13KB
XSLConverter.class 11KB
DiagnosticObserver.class 11KB
HeterogeneousSetOfSearchable.class 8KB
DatabaseInfo_codec.class 8KB
SearchTask.class 7KB
PDU_codec.class 7KB
HSSTest.class 7KB
ReadAheadEnumeration.class 7KB
TargetInfo_codec.class 7KB
RPNHelper.class 6KB
SingleTargetFailureTest.class 6KB
HSSSearchTask.class 6KB
XMLDataSource.class 6KB
Bib1Diagnostics.class 6KB
Explain_Record_codec.class 6KB
CCLToRPNParser.class 6KB
AccessInfo_codec.class 5KB
BadServerSearchTask.class 5KB
HSSSDT.class 5KB
SortStringToSortSequence.class 5KB
PerElementDetails_codec.class 5KB
DiagFormat_codec.class 5KB
DemoSearchTask.class 5KB
AttrPlusTermNode.class 5KB
ZServerAssociation.class 5KB
SearchRequest_codec.class 5KB
AssocDestructionTest.class 5KB
XMLConfig.class 5KB
ExtendedServicesRequest_codec.class 5KB
TaskPackage_codec.class 5KB
BasePrefixQueryParser.class 5KB
AttrPlusTermNode.class 5KB
InitializeRequest_codec.class 5KB
ChallengeItem158_codec.class 4KB
ChallengeItem148_codec.class 4KB
RPN2Internal.class 4KB
ElementMetaData_codec.class 4KB
iso2709.class 4KB
InitializeResponse_codec.class 4KB
HTDVTest.class 4KB
PrefixQueryVisitor.class 4KB
SessionDestructionTest.class 4KB
TermListDetails_codec.class 4KB
targetResponse_inline8_codec.class 4KB
TestClient.class 4KB
PresentRequest_codec.class 4KB
ElementData_codec.class 4KB
ExtendedServicesInfo_codec.class 4KB
RecordFormatSpecification.class 4KB
RootNode.class 4KB
originProposal_inline5_codec.class 4KB
SearchInfoReportItem188_codec.class 4KB
SearchInfoReportItem198_codec.class 4KB
SearchInfoReportItem208_codec.class 4KB
XMLRecord.class 4KB
ZServer.class 4KB
ProcessingInformation_codec.class 4KB
SessionDestructionTest$ClientThread.class 4KB
HSSSDT$ClientThread.class 4KB
IRStatusReport.class 4KB
TestSetup.class 4KB
PrefixToRPNParser.class 4KB
TermInfo_codec.class 4KB
OriginOnlySDT$ClientThread.class 4KB
CollectionDirectory.class 4KB
elements_inline80Item81_codec.class 4KB
elements_inline70Item71_codec.class 4KB
OriginOnlySDT.class 4KB
SearchResponse_codec.class 4KB
ScanRequest_codec.class 4KB
RecordSyntaxInfo_codec.class 4KB
OriginPartToKeep_codec.class 4KB
HoldingsAndCircData_codec.class 4KB
DatabaseInfo_type.class 4KB
ElementSetDetails_codec.class 4KB
BadServerSearchable.class 4KB
TaggedElement_codec.class 4KB
ISO2709Builder.class 4KB
BaseSortParser.class 4KB
DeleteResultSetResponse_codec.class 4KB
DemoSearchable.class 4KB
SortKeyDetails_codec.class 4KB
SchemaInfo_codec.class 4KB
Close_codec.class 4KB
RPN2Internal.class 4KB
共 2927 条
- 1
- 2
- 3
- 4
- 5
- 6
- 30
liaochangfa
- 粉丝: 33
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于python实现的基于PyQt5和爬虫的小说阅读系统.zip
- 机械设计整经机上纱自动化sw20非常好的设计图纸100%好用.zip
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页