,,,
-
002.53:681.3.016
:
453
: ..,..., .
__________________________________________
...: .., ..., .
__________________________________________
: _____ 06.2001
-
2001
. 3
1. Internet .. 5
1.1 . 6
1.1.1. .. 7
1.1.2. .. 7
1.1.3. SQL. .. 8
1.2. .. 9
1.2.1. WWW - NCSA HTTPD.. 9
1.2.2 WWW - Apache c Java Servlet. 9
1.2.3. SQL - Oracle. 11
1.2.4. Perl. 11
1.2.5. Java.. 12
1.2.6 Java servlets. 12
1.2.7. Web - Oracle - Web. 15
1.2.8. Cold Fusion Allaire Corp. 15
1.3. WWW .. 15
2. .. 17
2.1 .. 18
2.1.1. WWW - . . . 18
2.1.2 . . 20
2.1.3 MIME.. 21
2.1.4 HTTP. 22
2.1.5 CGI. 23
2.2. Web- Apache. 23
2.2.1 WEB- Apache. 25
2.2.2 WEB- Apache. 26
2.4. Perl. 33
2.5 Java.. 34
2.5.1 .. 34
2.5.2. .. 38
2.6. .. 39
2.6.1. . 39
2.6.2. .. 39
.. 49
.. 50
1 RUSMARC.. 51
2 Java.. 90
3 SearchEngein.java.. 103
4 ... 111
() . - , dbf - : Clipper, Dbase, FoxPro, Paradox, Access. , . , , , , .
, , , , . , ( "" ), ( ), (, ). WWW .
World Wide Web, " ", - . " , ", , . WWW : , - "" , . "", , - " ". - HTML (. HyperText Markup Language).
WWW, . , WWW - .
, 5.0 RUSMARC (. . 1), (12,11) .
JavaTM
2- 4 .
Internet , .
RUSMARC :
WEB- Apache;
Java Server WEB- Apache;
:
.
RUSMARC .
Java.
.
.
1. Internet
WWW - .
1. IP - , DNS.
2. - WWW-, IP - WWW (. . 1).
HTML - . ( ), . HTML-, WWW- - CGI- Java-.
, , , , , , (3).
WWW- , - . WWW- , - - , .. , : , , , WWW- ..
WWW - . .
, - HTML- (..2). WWW-. .
. , , WWW. , , .
, . - .
CGI-, WWW- WWW - . , , HTML-, . (. . 3)
. . , , WWW-.
, , , WWW - .
WWW- CGI - Common Gateway Interface. - , . .
, " " (). , WWW-, . .
1 - ;
2 - .
. , , , .
, WWW- .
WWW- WWW- .
( , ), , SQL- .
1.2., WWW WWW-. - Unix- () WWW- (NCSA) . NCSA . NCSA , WWW-. "Apache Group" WWW - NCSA HTTPD. WWW- Apache .
Web- - Apache . Netcraft (15) Web-, , 1998 . 2 . (55% ) . : Microsoft 25%, Netscape -7%. , Unix- (FreeBSD, Linux .), Apache , . , .
, Internet , koi8-r ( koi8) Windows-1251: Unix, Windows. Windows-1251, , , , WWW, koi8, 5%. Unix-, - , IRC (, " "). , , Apache -RUS Web-ࠠ Apache .
, , Apache HTTP- , , . , , , , , . , , Web-, , , . Web- : CGI, ISAPI NSAPI, Wintel-. , Delphi-3 Web-, , Web, Windows-95/NT, Gateway-ODBC. , HTTP . Apache JServ, . Apache Java-, , Java-. , Java Web, , . Java- , Web- Apache. , , UltraSparc-3000 c Java- HotSpot, , , , NT-. Apache, Java, , . , Java-, Apache. , Apache , , Web-, Fastrack, Java Web Server. Apache Java, Jserv, Java-, Apache Configuration, :
Module jserv_module mod_jserv.o - Unix-.
Jserv` .
3 . Oracle . , , , Oracle . , Oracle , - Unix- .
Oracle . 1996 Oracle , Oracle.
Perl . . WWW-. SQL- Perl-. , WWW- . Perl : , , ().
Java , -, , , , , -, , , .
Java - (byte-code). - , . , -. , - , - , Java Virtual Machine , Sun Microsystems. Java Virtual Machine (JVM) , , -. JVM Java.
- - server-side-p, Java , CGI, PHP3, Perl, ASP.
:
.
p , , -p, p p p ( JIT- - pp ) , -p, p p Java-.
, /pp p, , , Perl PHP3 ( , , OS/2 - ), ( , ), () ( Perl, PHP, REXX).
, , . H , , p -pp, , .asp-p Microsoft, mod_perl mod_php apache. ( - PHP3, - , , ).
. "write once run everywhere" . , Sun - -, , , Solaris, FreeBSD OS/2. , - , .
. , , Java , Perl , , PHP3. , C++ Java. ( , , .)
, Java. , VisualAge for Java 2.0 - , WYSIWYG-pp -, HTML- p, pp .
. Java ( java.sql), . , - JDBC-pp ( p , p), p p .
, , c MySQL Oracle, CLASSPATH URL .
, .
, . : , - , ( OS/2, , Java- 15-20 ) Java , : , , , , , ...
, . JServ - apache.
- servlet-wrapper' , . , JServ - . Java , Sun, -. mod_jserv ( apache, ).
, URL ( - /servlets/), apache mod_jserv JServ', , , ( ) - , .
"" - ( ). , , . Java- ( , Java- JIT) . . . , , , , pp ( p, pp p p ). , , - , , perl php , ..
, , . , - JServ, , (, , , ).
WOW - , WWW- Oracle. WOW , Oracle. , WOW' - Oracle Web Server 1, 2, Oracle Web Arcitecture.
SQL - PL/SQL, Oracle . - PL/SQL Oracle. WOW .
WOW WWW- SQL- Oracle Unix. WOW WWW , Oracle ( 3).
Windows , ODBC WWW-. , "evaluation copy" -. DBML - HTML, ODBC. DBML , HTML-. , WWW - $486.
WWW ( 2,3)
1.3. WWWWWW- , , . , . HTML 1-3- . 1-3 .
2, 3, , (.. , WWW-) (-CASE). . : 1-2 1-2 , , .
, , .
2.
WWW - Internet , , , , , WWW - Internet . RUS-MARC, Java .
2.1WWW - , , . WWW - ( . browser), - .
, , WWW-. :
1. , ,
o
o
o
o -
o WWW -
2. WWW
3. , , .
o :
o
o , ,
o () , (link) .
o .
, URL. HTTP, WWW WWW , URL :
1) , (http).
2) - Internet IP - .
3) TCP, .
4) () - .
:
http://www.cnit.nsu.ru:80/welcome.html
http WWW -
o ':' -
o "www.cnit.nsu.ru" - - Internet
o "80" - tcp -
o /welcome.html - -
, WWW :
1) tcp.
2) http.
3) .
4) http.
, WWW - - , .
WWW - . WWW - . , WWW.
, WWW , WWW , - , , , WWW (. 1).
WWW . 1
|
|
IBM PC |
o Unix (UnixWare, Open Server, Solaris, BSD, Linux ..) o Microsoft Windows NT/2000 o IBM OS/2 o Novell NetWare |
Sun SparcStation SparcServer |
o SunOS o Solaris |
Silicon Graphics | o IRIS |
. . WWW - . , , . , .
:
D:\WWW\INDEX.HTM - Windows,
/u/data/www/html/index.html - Unix - ,
USR:WWW/HTML - NetWare ..
, URL, :
/<_>/ ... /<_>/<_>
, WWW - . , , .
, , URL. , D:\WWW\, URL
http://<_>/index.htm
D:\WWW\index.htm
, , , . , URL, .
:
/Harvest /projects/www/harvest
/test/myfile.html C:\MYDIR\FILE.HTM
/Harvest /projects/www/harvest. .
. . , URL .
( Unix) WWW - ( , ..). (.. "") . URL : ~<_>.
:
Indy.cnit.nsu.ru fancy "" /home/fancy. /home/fancy/public_html. URL http://Indy.cnit.nsu.ru/~fancy/start.html, WWW - start.html /home/fancy/public_html.
MIME - , : , , . , on-line , WWW. MIME .
MIME , . MIME. , . :
Content-Type: <_MIME>
MIME (.. ) . MIME:
<> / <> [ ; <> ]
<> - :
Audio -
Application - , - ()
Image -
Message - , MIME -
Multipart - , MIME -
Text -
Video - .
<> - <>
:
text/html - HTML
image/giff - gifF
<> - , .
MIME . :
<>/<> <1> ... <N>
, , MIME.
:
image/giff gif giff
text/html html htm
gif giff image/giff. image/giff (, ), gif giff.
HTTP WWW - WWW - . :
<>
<> < / >
- HTTP ;
- :
GET -
PUT, POST - (, )
:
HTTP/1.1
GET /index.html
index.html .
. WWW CGI (Common Gateway Interface). CGI WWW .
CGI , URL . WWW , , , . CGI - - (Basic, SH, Perl ..).
CGI - , CGI - . cgi-bin , , .
:
, CGI - test-query, URL http://<_>/cgi-bin/test-query
CGI WWW - . CGI - , , .. , , 4 .
2.2. Web- ApacheApache - Web- . Netcraft (15) Web-, , 1998 . 2 . (55% ) . : Microsoft 25%, Netscape - 7%. , Unix- (FreeBCD, Linux .), Apache , . , .
Apache , , . Apache , , , . : , , .
- The Apache Group
- Apache Web Server 1.3.14
- OS/2, Unix, Windows, BeOS
- Alpha, Intel 80486, Pentium, Pentium Pro, PowerPC
- 32
:
CERN -
NCSA -
-
-
-
-
- SHTTP, SSL
API - Basic, CGI, JavaScript API, Java ( JServ )
:
SMP -
-
Web- -
- .
Web- Apache - .
, - , ... , , - Apache. , , Windows 95/98/NT PHP, CGI Perl- , Unix.
, Apache Windows 95/98/NT . - apache_1_3_14_win32_r2.exe (3 176 975 ) (13). - Apache.
: , . - .
-
, Apache. , : f:\usr\local\apache . F: , , :
1) F: - (, Windows 95/98 DriveSpace). , , . Web-, ? DriveSpace .
2) F:. - , F:. , C:\INTERNET. , c:\autoexec.bat :
subst f: C:\INTERNET
. F:.
: , Windows 95/98 , subst- " " . , , f: cd \ cd \ dir
( , dir ) , C:\ ( F:\, ). Perl-. subst. 1.
3) , Apache , . , . F:.
Apache .
. Yes, - Next.
: f:\usr\local\apache OK.
- ustom Source Code (, , Apache). 3 .
Next , Apache.
"".
- Apache ! - .
Apache mime.types
f:\usr\local\apache\conf. mime.types.
:
text/html html htm
text/html html htm shtml shtm sht
, - mime.types, httpd.conf (. )
AddType text/html html htm shtml shtm sht
- httpd.conf
! - . .
f:\usr\local\apache\conf. httpd.conf. - , . , , . . , , . .
ServerAdmin E-mail , . :
ServerAdmin my@email.com
ServerName , :
ServerName www.real.ulan-ude.ru
ServerName, "#" ( )!
DocumentRoot , html-, :
DocumentRoot f:/www
, . , , !
, <Directory /> </Directory> (, ). :
<Directory />
Options Indexes Includes
AllowOverride All
</Directory>
, <Directory>, :
Optinos [options...]
:
ExecCGI - CGI- ;
FollowSymLinks - ( lh);
Include - SSI (Server Side Includes);
Indexes - , index.html ( , DirectoryIndex);
MultiVews - ; , , , ; " " ;
All - MultiViews.
AllowOverride [options...]
:
AuthConfig - ;
FileInfo - , ;
Indexes - , ;
Limit - allow deny, ;
Options - Options.
, (.. - ).
, <Directory "f:/usr/local/apache/htdocs"> </Directory>. , . :
<Directory "f:/www">
Options Indexes Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
- html-. , , , , , DocumentRoot
. UserDir, :
UserDir f:/www/users
, , (. ).
DirectoryIndex :
DirectoryIndex index.htm index.html
- , - , html-. , , , index.phtml, PHP ..
:
ScriptAlias /cgi-bin/ "f:/www/cgi-bin/"
, , . , CGI-. , , :
ScriptAlias /mycgi/ "f:/mycgidir/"
Apache , , http://www.real.ulan-ude.ru/cgi-bin, f:/www/cgi-bin.
, <Directory "f:/www/cgi-bin"> </Directory>. - CGI- ( , ). :
<Directory "f:/www/cgi-bin">
AllowOverride All
Options ExecCGI
</Directory>
:
AddHandler cgi-script .bat .exe
Apache , .exe .bat CGI-.
- :
AddHandler server-parsed .shtml .shtm .sht
, , html SSI, :
AddHandler server-parsed .shtml .shtm .sht .html .htm
Apache , ! ->->Apache Web Server->Start Apache, , MS-DOS, . Apache.
, . Windows , , . , , . Start Apache Ctrl+Alt+A, Shutdown Apache - Ctrl+Alt+S
, :
html: f:/www html- Apache index.html. :
http://www.real.ulan-ude.ru/index.html
http://www.real.ulan-ude.ru/
.
CGI: f:/www/cgi-bin CGI- test.bat :
@echo off
echo Content-type: text/html
echo.
echo.
dir
:
http://www.real.ulan-ude.ru/cgi-bin/test.bat
DOS dir.
SSI: html. , ,
<!--#exec cgi="/cgi-bin/test.bat"-->
, Apache . , , f:/www f:/www/cgi-bin CGI. : , Apache . , , Apache, , serv1 195.161.69.170, - serv2 195.161.69.171. (, "serv1" "serv2" .)
Unix, f:/home , . , serv1 f:/home/serv1, . :
access.log .
errors.log .
www, html-.
cgi CGI-.
(www cgi) .
, Apache httpd.conf (. ), Windows. :
f:\usr\local\apache\conf. httpd.conf. , .
:
#----serv1
<VirtualHost 195.161.69.170>
ServerAdmin webmaster@serv1.ru
ServerName serv1
DocumentRoot "f:/home/serv1/www"
ScriptAlias /cgi/ "f:/home/serv1/www/cgi/"
ErrorLog f:/home/serv1/log/error.log
CustomLog f:/home/serv1/log/access.log common
</VirtualHost>
(, DirectoryIndex ..) , .
hosts, C:\WINDOWS\hosts ( - ). hosts - , :
195.161.69.169 www.real.ulan-ude.ru
localhost 127.0.0.1. ( , localhost . Microsoft!) , :
195.161.69.170 www.real.ulan-ude.ru
195.161.69.171 www.real2.ulan-ude.ru
:
- serv1
http://serv1 ( http://195.161.69.171).
, , f:/home/serv1.
- f:/home/serv1/www, http://serv1.
CGI - f:/home/serv1/www/cgi, http://serv1/cgi/
f:/home/serv1/log
, ! , , , . , IP- ( , 195.161.69.170, 195.161.69.171 .. - ). IP- http://195.161.69.169, - .
, , (, , 1 2) - http://195.161.69.169 http://www.real.ulan-ude.ru. , cgi-bin "" , .
, , , Perl. , Perl. , , Perl , Perl-; , :
#!/usr/local/bin/perl
:
#!/usr/local/bin/perl.exe
:
#!f:\usr\local\bin\perl.exe
Perl- f:/usr/local/bin/ ( f: , , , Apache). , Perl , . , , , Apache-:
f:/usr/local/bin
: Perl . , .
- , . Perl, perl.exe. , #!/usr/local/bin/perl Perl- perl.exe f:/usr/local/bin/, f:/usr/local/bin/perl
, Apache , errors.log : couldn't spawn child process.
, :
f:/usr/local/bin
Perl - perl_setup.exe (436.137 ), . , , .
. Apache conf/httpd.conf
AddHandler cgi-script .bat .exe
AddHandler cgi-script .bat .exe .pl .cgi
, AddHandler . ...
, , . Perl-. (, , cgi-bin ):
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "It works!<br>\n";
system("dir");
Jserv - Apache. ApacheJServ-1.1.2-2.exe (14).
Jserv`. Java, .
Java Microsoft - SDKJava40.exe. JVM, Java Servlet Devolopment Kit 2 (JSDK), httpd.conf -. .
Jserv` -. Jserv - jserv.conf - Apache httpd.conf, .
. LoadModule.
LoadModule [ - jserv_module] [ "./ApacheModuleJServ.dll"]. : LoadModule jserv_module "./ApacheModuleJServ.dll"
- ApJServManual - Jserv on= off=.
ApJServProperties "./conf/jserv.properties" Jservs.
2.4. PerlPerl - , , . Perl . , , , . Perl C, shell, sed awk, , , Perl- . C Perl- C. UNIX Perl , . . Perl , .dbm , . Perl , , C++ Perl-, , Oracle.
CGI-, , , . WWW.(5,6)
Internet World Wide Web - . , , Java
, , , ..
Java , , ,
Java.
Java: , . Java . Java , ++, Java, , ++.
Java , ++, , .
, , . ++ , .
-
Java -. - - : , . Java - .
Java , /, , . .
Java . , - ( ).
: new. Java, ++, : , . . .
, ++. Java , , "" - .
Java , , . , , Java , "" . , Java, , .
Java , . , . - Java - - - , . - Java. Java- .
- . ++ Java " ", . . , - .
Java Java (Java Virtual Mashine - JVM) - , Java . JVM . JVM (POSIX).
. Java -, . , , . , , , , , Java . , , , , .
Java- Java - , . , , , , .
. Java - (). Java .
Java : Thread, , . , Java : , , .
Java , ++. . Java , . , . , , . HotJava , . , , Internet.
, . , Java , .
Java , :
Java , : , Java. (9,10) .
Java "Write Once, Run Anywhere" (" - ") Java-, . (Java Platform API) Java. Java Enterprise API , , .
Java (Java Database Connectivity - JDBC) - Java . JDBC API , SQL. JDBC Java " - " , (7).
(SearchEngein.class) Java Java servlets (17) Apache (16). , Windows NT :
1. Apache, Win32;
2. Apache Java server, Win32;
3. Java (JVM) Win32;
4. Java Servlet Development Kit (JSDK) 2.0
. .
, :
266 .
64 , , .
.
.
, , , - (-) MacOS Unix-. , .
. . , .
, RUSMARC (. 1).
00878nam 22002537 45000010000000330050003300172450005002442600029400153000030900096500031800636500038
10045653004260024653004500019653004690016020004850010091004950008092005030017090005200008852005280022852005500011040005610014041005750008008005830041 BOOK00000876 BOOK00000001 ‑19981027165203.0 ‑00a n. 7b . .-. . " "c- - ; . .. . ‑0 a.c1994 ‑ a22.‑ a x x ‑ a x‑ a ‑ a ‑ a‑ c2.100‑ a32‑ a14.35.09a18‑ c32‑ b/t2h32i437‑ b.t3‑ a-10‑ arus‑950614s1990 rur 00000 rus d‑
:
00878nam 22002537 4500 24
12 1) 3 1.
2) -5
3) 4
1 - 001 00000 0033
2 - 005 00033 0017
3 - 245 00050 0244
4 - 260 00294 0015
5 - 300 00309 0009
6 - 650 00318 0063
7 - 650 00381 0045
8 - 653 00426 0024
9 - 653 00450 0019
10- 653 00469 0016
11- 020 00485 0010
12- 091 00495 0008
13- 092 00503 0017
14- 090 00520 0008
15- 852 00528 0022
16- 852 00550 0011
17- 040 00561 0014
18- 041 00575 0008
19- 008 00583 0041
1 - ‑ BOOK00000876 BOOK00000001
2 - ‑19981027165203.0
3 - ‑00a n. 7b . .-. . " "c- - ; . .. .
4 - ‑0 a.c1994
5 - ‑ a22.
6 - ‑ a x x
7 - ‑ a x
8 - ‑ a
9 - ‑ a
10- ‑ a
11- ‑ c2.100
12- ‑ a32
13- ‑ a14.35.09a18
14- ‑ c32
15- ‑ b/t2h32i437
16- ‑ b.t3
17- ‑ a-10
18- ‑ arus
19- ‑950614s1990 rur 00000 rus d
‑
URL (: http://www.real.ulan-.ude.ru/serv/SearchEngein), - JServ, . Jserv . JServ Java . . , , Java. . HTML . (. . 6) .
. 6
:
out.println("<form method=\"get\" action=\"/serv/SearchEngein\">"+
"<table width=\"461\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr bgcolor=\"#3399FF\"> "+
"<td width=\"266\" class=\"text\"> </td>"+
"<td width=\"135\" class=\"text\"> </td> "+
"<td width=\"207\"> </td>"+
"</tr>"+
"<tr>"+
"<td width=\"266\" valign=\"top\"> "+
"<input type=\"text\" name=\"Query\" maxlength=\"100\" size=\"38\" value=\"\">"+
"</td>"+
"<td width=\"135\" valign=\"top\"> "+
"<select name=\"select\" size=\"1\">"+
"<option value=\"MARCFILE.Book\" selected>"+ConvertISO(getINIVar("KATALOG.Book"))+"</option>"+
"<option value=\"MARCFILE.Stat\">"+ConvertISO(getINIVar("KATALOG.Stat"))+"</option>"+
"<option value=\"MARCFILE.Periud\">"+ConvertISO(getINIVar("KATALOG.Periud"))+"</option>"+
"<option value=\"MARCFILE.Podpis\">"+ConvertISO(getINIVar("KATALOG.Podpis"))+"</option>"+
"<option value=\"MARCFILE.Ucheb\">"+ConvertISO(getINIVar("KATALOG.Ucheb"))+"</option>"+
"</select>"+
"</td>"+
"<td width=\"207\" valign=\"top\"> "+
"<input type=\"submit\" name=\"Start\" value=\"\">"+
"</td>"+
"</tr>"+
"</table>"+
"</form>");
.
<form> metod action.
1) (metod) () ;
2) (action) .
<input>, type, name, value. , .
1) (type) text ;
2) (name) .. , Query;
3) (value) .
<select> - . name. <option> <select>. <option> . <option> value .
<input>, <input> (type) submit - <form>. (name) (value) Start. , </form>.
:
http://localhost/serv/SearchEngein?Query=%E1%A8%E1%E2%A5%AC%A0&select=MARCFILE.Stat&Start=%8F%AE%A8%E1%AA
Query (), select .
- db.ini c:\www\db. . , ( ).
, . .
public void dbFileRead(String dbNamePath, PrintStream out, String query) {
.
.
String mAvtor = null; // 100
String msAvtor = null; // 700
String mName = null; // 245
String mPrinter = null; // 260
String mSize = null; // 300
String mKey = null; // 653
String mSeria = null; // 490
String mRubrika = null; // 650
String mBBK = null; // 91
String mKaIndex = null; // 90
.
long fPosMarker = 0, //
fPosData = 0; //
boolean done = false;
.
int mC =0, //
mE =0; //
byte Jumper[] = new byte[5]; // -
int JIndex = 0, // -
JTemp = 0, // +
MIndex = 0, //
MTemp = 0; //
. query , . .
if (query != null){
try { RandomAccessFile dbfile = new RandomAccessFile(dbNamePath,"r");
//
while (fPosMarker != dbfile.length()) {
try { mC++;
dbfile.seek(fPosMarker);
dbfile.read(Jumper);
String jBuf = new String(Jumper);
JIndex = Integer.parseInt(jBuf,10);
int b = 0;
5 . 12*n, n .
//
while ( b != MD){
dbfile.seek(fPosMarker+24+MIndex);
b = dbfile.read();
MTemp++;
MIndex = MTemp;
}
MTemp= MTemp - 1;
- ; , ; .
//
byte Dic[] = new byte[MTemp];
dbfile.seek(fPosMarker+24);
dbfile.read(Dic);
//
fPosData = fPosMarker+24+MTemp;
String sDic = new String(Dic);
int DI2 = 0,
DI3 = 0,
DI4 = 0,
DI5 = 0,
PNum = 0, //
PLength = 0, //
PStart = 0; //
, , , , .
//
while ( DI2 != MTemp){
DI3=DI2+3;
String DStr = sDic.substring(DI2,DI3);//
DI4=DI3+5;
String DStr2 = sDic.substring(DI3,DI4);//
DI5=DI4+4;
String DStr3 = sDic.substring(DI4,DI5);//
DI2=DI2+12;
PLength = Integer.parseInt(DStr3,10);//
PStart = Integer.parseInt(DStr2,10);//
PNum = Integer.parseInt(DStr,10);//
byte Pole[] = new byte[PLength];
, , . . , , MARC.
//
switch (PNum) {
case 100 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mAvtor = TagRemove(Pol.substring(5));break;}
case 700 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
msAvtor = TagRemove(Pol.substring(5));break;}
case 245 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mName = TagRemove(Pol.substring(5));break;}
case 490 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mSeria = TagRemove(Pol.substring(5));break;}
case 91 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mBBK = TagRemove(Pol.substring(5));break;}
case 90 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mKaIndex = TagRemove(Pol.substring(5));break;}
case 260 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mPrinter = TagRemove(Pol.substring(5));break;}
case 300 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mSize = TagRemove(Pol.substring(5));break;}
case 653 : {
dbfile.seek(fPosData+PStart);
dbfile.read(Pole);
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
mKey = TagRemove(Pol.substring(5));break;}
default : {}
}// switch
}//
, .
if ( mAvtor == null) mAvtor=" ";
if ( msAvtor == null) msAvtor=" ";
if ( mName == null) mName=" ";
if ( mPrinter == null) mPrinter=" ";
if ( mSize == null) mSize=" ";
if ( mKey == null) mKey=" ";
if ( mKaIndex == null) mKaIndex=" ";
if ( mBBK == null) mBBK=" ";
if ( mSeria == null) mSeria=" ";
MarcRecord Rec = new MarcRecord( mAvtor,
msAvtor,
mName,
mPrinter,
mSize,
mKey,
mSeria,
mBBK,
mKaIndex);
. , .
String q = toLow(query);
String p01 = toLow(Rec.rAvtor);
String p02 = toLow(Rec.rsAvtor);
String p03 = toLow(Rec.rName);
String p04 = toLow(Rec.rKey);
, . :
100
700
245
653
if ( p01.indexOf(q) != -1 ||
p02.indexOf(q) != -1 ||
p03.indexOf(q) != -1 ||
p04.indexOf(q) != -1)
{ mE++;
.
out.println("<table width=\"461\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr bgcolor=\"#3399FF\">"+
"<td colspan=\"3\" class=\"text\"> : "+
"<font color=\"#000000\">"+
Rec.rAvtor+" "+
Rec.rsAvtor+
"</font></td></tr><tr>"+
"<td colspan=\"3\" valign=\"top\" class=\"bodytext\">"+mE+". "+mC+
" <b>:</b> "+
Rec.rName+"<br>"+
Rec.rPrinter+" "+
Rec.rSize+"<br>"+
Rec.rBBK+" "+
Rec.rKaIndex+" "+
Rec.rSeria+
"</td></tr></table>");
}
.
fPosMarker = fPosMarker+JIndex;
MTemp = 0;
MIndex = 0;
}
( ) , .
catch (IOException e) {
out.println("!!!"+"<br>");
done=true; }
}
}
.
catch (IOException e) { out.println(" "+dbNamePath); }
}
if (mE == 0) {
out.println(": "+query+" ");
} // end If
}
, HTML. , :
100
700
245
490
91
90
260 -
300 ,
653
HTML :
out.println("<table width=\"461\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr bgcolor=\"#3399FF\">"+
"<td colspan=\"3\" class=\"text\"> : "+
"<font color=\"#000000\">"+
Rec.rAvtor+" "+
Rec.rsAvtor+
"</font></td></tr><tr>"+
"<td colspan=\"3\" valign=\"top\" class=\"bodytext\">"+mE+". "+mC+
" <b>:</b> "+
Rec.rName+"<br>"+
Rec.rPrinter+" "+
Rec.rSize+"<br>"+
Rec.rBBK+" "+
Rec.rKaIndex+" "+
Rec.rSeria+
"</td></tr></table>");
. (. .3), (. . 4)
, , . .
. , , . 8366 , 2 16 . , . , , . , , . : AMD K6-233, 64 Mb, 2 Gb, Windows NT 4.0 SP6a. , .
. , .
1. .., .. : . .: , 2000. -504.
2. . Java: :. . - .: BHV,1997.-320.
3. .. // . - 1999 - 5. . 4-10.
4. , , . Java. :. . . , 1996. 736 .
5. ., . Perl: :. .- .: , 2000. 736.: .
6. . Perl: :. . .: , 2000. 496.: .
7. , . JDBC: Java :. . .,1999.-320.
8. . Java: . .: , 1998. -448.: .
9. http://www.java.sun.com
10. http://www.sun.ru/java/start/intro/history.html
11. http://www.logos.com/marc/
12. http://www.rba.ru:8101/rusmarc/
13. http://httpd.apache.org/dist/httpd/binaries/win32/old/apache_1_3_14_win32_r2.exe
14. http://java.apache.org/jserv/dist/ApacheJServ-1.1.2-2.exe
15. http://www.netcraft.com/Survey
16. http://www.apache.org
17. http://java.apache.org
18. http://www.ruslibnet.ru/
1
RUSMARC
UNIMARC UNIMARC(11). : RUSMARC(12).
LIBNET (18) . 45 27.01.98 .
:
.
.
.
.
, , . ISO 2709 .
.
.
,
, .
. . 24 . 0 23:
. 2.
|
|
- |
|
(1) | 5 | 0-4 | |
(2) | 1 | 5 | |
(3) | 4 | 6-9 | |
(4) | 1 | 10 | |
(5) | 1 | 11 | |
(6) | 5 | 12-16 | |
(7) | 3 | 17-19 | |
(8) | 4 | 20-23 |
(1) ( 0-4)
- , , , , . , ( 546, 00546). , .
(2) ( 5)
, :
n -
, - .
d -
, , ( / , ), , . / : , , 2--, - (), , / . 4-- () (), .
, 001 ( ) . 830 " " .
-
, , , . () , () . - ( 005). .
(3) ( 6-9):
6-9 ISO 2709, - .
() ( 6)
, :
x = /
y =
z =
() ( 7-9). (###).
(4) ( 10)
.
2.
(5) ( 11)
.
2.
(6) ( 12-16)
, ( 546, 00546), - -. , . - , 001, . .
(7) ( 17-19)
, , , - :
() ( 17)
, .
# () =
, , ( ). . -.
3 =
, .. - , , "." ". " .
:
(1) (100/8). , 2-- ( a - ), ( c - ), .. , - . - , -, .
(2) , # ( - ), () - 801 2 ( -).
() ( 18-19). (##).
(8) ( 20-23).
() " " ( 20).
. - 4.
() " " ( 20).
. - 5.
() ( 22-23). (##).
- . ( - ) . ISO 2709 : , , . " " " " ( 20 21 ). , 24. .
.
.
,
, .
(1) ( 0-2)
- , .
(2) ( 3-6)
, , . , , , . , , .
(3) ( 7-11)
, , , (, 12-16). , , .
, / . .
:
001
005
015 / ()
001
, , , , .
.
.
.
, .
005
16 , (4 , 2 - , 2 - , 2 - , 2 - , 2 - , 2 - , ).
.
.
.
100 ( 0-7)
015 / (ISADN)
/ , ( ISADN).
, . / - , - .
2-- . / , 2--, 7--.
, 2--, 4-, 5--, 7--.
2-- $7 $8 .
2-- $4 . $4 / . - . .
:
200 -
210 -
215 -
220 -
230 -
235 -
240 - /
245 - /
250 -
200 -
, . , , , . - , , .. - , , , , . 200 / 600, 700, 701, 702 (. ). , , , C .
200 / (240, 245).
.
.
:
- , (#).
- :
0 -
1 -
3
$a | ||
$b | , | |
$c | ( ) | |
$d | ||
$f | ||
$g | ||
$4 | ||
$x | ||
$y | ||
$z | ||
$j | ||
: |
||
$7 | ||
$8 |
$a
, ( ).
4
2 |
$a |
0 | |
1 |
. , 200.
, , , ( ), $a. , , , ( ), $b.
$b , ()
- . ( ) . 1 ( ). $g.
.
5
2 |
$b |
0 | |
1 |
:
|
$c
( ), (, , , , ..), : , , , , ..)
.
$d
, ( , , , ..). = 0.
.
6
2 |
$d |
0 | |
1 |
$f
( , , ..). (.. , ., ).
.
$g
, $b. 1 ( ).
, , , .
.
7
2 |
$d |
0 | |
1 |
$4
200 / (240, 245). .
.
$x
, , , .
.
$y
, , , .
.
$z
, , , ( , $f).
.
$j
, , .
.
240 - /
245 - /
$4
210 -
, ( ).
- , , ( 210). - ( 215).
210 / 601, 710, 711, 712 (. ).
.
.
:
0
1
:
0
1 , -
2
y z - (|).
8
$a | ||||
$b | ||||
$c | ||||
$d | () / | |||
$e | () | |||
$f | () | |||
$g | ||||
$h | , | |||
$4 | ||||
$ | ||||
$y | ||||
$z | ||||
$j | ||||
: |
||||
$7 | ||||
$8 | ||||
$a
( ), , ( ), , , .
. .
$b
, . , - , - .
.
$c
, , . : , , .
( ).
$d /
.
.
$e
, , .
.
$f
, .
.
$g
, , - , ( , , , ..).
, , . .
.
$h ,
- , .
.
$4
210 / (240, 245).
.
$x
, , , .
.
$y
, , , .
.
$z
, , , ( , $f).
.
$j
, , .
.
150
160
215 -
240 - /
245 - /
215 -
, . - , , ( 210). - ( 215).
215 / 601, 607, 710, 711, 712 (. ).
.
.
, (##).
9
$a | ||
$ | ||
$y | ||
$z | ||
$j | ||
|
||
$7 | ||
$8 |
$a
- .
.
$x
, , , .
.
$y
, , , .
.
$z
, , , .
.
$j
, , .
.
160
210 -
240 - /
245 - /
220 -
, ( , , , ).
220 / 602, 720, 721, 722 (. ).
.
.
, (##).
10
$a | ||
$f | ||
$4 | ||
$x | ||
$y | ||
$z | ||
$j | ||
|
||
$7 | ||
$8 |
$a
, , . .
.
$f
, , .
.
$4
220 / (240, 245). .
.
$x
, , , .
.
$y
, , , .
.
$z
, , , ( , $f).
.
$j
, , .
.
240 - /
245 - /
$4
/ , , 4-- 5--. () () (). , , .
, . , , 8--- .
3-- :
$6
$7
:
300
305 "."
310 "."
320
330
3-- , 320, .
300
/ 2-- . .
.
.
:
0 ( )
1 2--
, (#).
. 11
$a | ||
|
||
$6 | ||
$7 |
- 300 .., .
/ , , . ( ) , . , . , 300 , 5--.
300 305 510, , . 300 , - 305 (. 305 ).
$0
305 ". "
820 2--
830
305 ". "
305 / ( x) 2-- 5--, ". " 5--.
, , 2-- / . , , ". " ( ) 305.
, ". " 5--. , , $b 305, 5--.
/ , 305, 2-- 5--. , , 5-- . / 825 , .
: 305 .
.
.
:
0 ( )
1 2--
, (#).
. 12
$a | ||
$b | , | |
|
||
$6 | ||
$7 |
$0
$5 ( )
300
820 2--
830
310 "."
310 ( y) 2-- , 310, "." 4--.
, , "." ( ) 310 . / , , 4-, , $5.
2-- / 4-- , 310, , . / 825 , .
: 310 .
y.
.
:
0 ( )
1 2--
, (#).
. 13
$a | ||
$b | , | |
|
||
$6 | ||
$7 |
300
820 2--
825 ,
830
835
320
( z) . , . . , , 2-- , - 320.
z.
.
, (##).
. 14
$a | ||
|
||
$6 | ||
$7 |
300
820 2--
825 ,
830
330
/ 2--. , , ..
.
.
:
0 ( )
1 2--
, (#).
. 15
$a | ||
|
||
$6 | ||
$7 |
300
305 ". "
820 2--
825 ,
830
4-- 5-- () "." ". "
() () "." ". " 2--.
2--, 4-- 5-- .
4-- 5--- , 5-- 2-- , 2-- - / (, .. .
4-- () "."
() "." , 4--, 2-- . , , 4--, / .
/ () ( , - ..).
, () (, . ), 5--.
4-- :
$0
$2
$3
$5 ( )
$6
$7
$8
:
400 "." -
410 "." -
415 "." -
420 "." -
430 "." -
440 "." - /
445 "." - /
450 "." -
400 "." -
, "." 200 , $5. , $5 .
.
.
200.
410 . -
, . 210 , $5. , $5 .
- , , ( 410). - ( 415).
.
.
210.
- (. 5, 7, 12, 14).
415 . - -
, . 215 , $5. , $5 .
- ( 415). - , , ( 410).
.
.
215.
420 . -
, . 220 , $5. , $5 .
.
.
220.
430 . -
, , , . 230 , $5. , $5 . , , , , 230.
.
.
230.
440 . - /
/ , . 240 , $5. , $5 . 240. 2--, 440 , 240.
.
.
240.
445 . - /
/ , . 245 , $5. , $5 . 245. 2--, 445 , 245.
.
.
245.
450 . -
- ( ), . 250 , $5. , $5 .
.
.
250.
". " ( ), 5--, 2-- . , , 5--, / .
, 5-- , : . .
5-- :
$0
$2
$3
$5 ( )
$6
$7
$8
:
500 ". " -
510 ". " -
515 ". " -
520 ". " -
530 ". " -
540 ". " - /
545 ". "- /
550 ". " -
500 ". " -
, 2-- , $5. , $5 .
.
.
200.
510 ". " -
- , 2-- , $5. , $5 .
- , , ( 510). - ( 515).
.
.
210.
515 ". " -
- , 2-- , $5. , $5 .
- ( 515). - , , ( 510).
.
.
215.
520 ". " -
, 2-- , $5. , $5 .
.
.
220.
530 ". " -
, , , , 2-- , $5. , $5 .
.
.
230.
540 ". " - /
/ , 2-- , $5. , $5 . 240. 2--, 540 , 240.
.
.
240.
545 "." - /
/ , 2-- , $5. , $5 . 245. 2--, 545 , 245.
.
.
245.
550 ". " -
- , 2-- , $5. , $5 .
.
.
250.
, 2--. . (, ).
:
675 ()
676 ( )
680 ()
686
689 - ()
675 ()
() , () / 2--. .
.
.
, (##).
. 16
$a | , | |
$b | , | |
$c | ||
$v | ||
$z |
676 ( )
() , () 2--. .
.
.
, (##).
. 17
$a | , | |
$b | , | |
$c | ||
$v | ||
$z |
680 ()
() , () / 2--. .
.
.
, (##).
. 18
$a | , | |
$b | , | |
$c |
686
, . () / . $2. . G .
.
.
, (##).
19
$a | , | |
$b | , | |
$c | ||
$2 |
G :" "
689 - () ()
/ - , 2--.
.
( "+").
, (##).
. 20
$a | , | |
$b | , | |
$c | ||
$v |
$a ,
, (.. , ) , , " : " ( " : ").
.
$b ,
, , " :" ( " : ").
.
$c
, $a $b. , , 2--.
.
$v
, , $a $b ( , ..). , .
.
, , "+", . , ,
2--, 3--, , :
$0
$2
$3 /
$5 ( )
$6
$7
$8
2--, 4-- 5--, 7--, . . 3--. $0, $2, $3, $5, $6, $7, $8 , , . .
$0
$0 ( , .), . 2-- , 4-- 5--.
, , $0, 2-- , $5, .
3--.
: 2-- .
$2
, 4-- 5--, , 152 $b.
, ( 2--) ( 4-- 5--) , 152 $b; , , .
. - 7 .
4--, 5--.
$3
, , . 4-- 5--, 7--. $3 4--, $5, ( ) 0 - .
$5 ( )
, 4-- 5--, .. . . , $5, , $5 .
. 21
|
- | ||
1 | 1 | 0 | |
2 | 1 | 1 |
, $5 ( 0), 1
, 1 , 0 -
- 0 1
(1) () ( 0)
4-- 5-- 2--. .
. (. .11 / ).
4-- 5--.
:
a = ( , )
b = ( , )
d = ( )
e =
f =
g =
h =
z = (, , , , , : , , ..)
c = ()
s = ()
: c s z UNIMARC / AUTHORITIES
, . 22
4-- | 5-- | |
a = | . | . |
b = | . | . |
d = | . | . |
e = | . | . |
f = | . | . |
g = | . | . |
h = | . | . |
z = | . | . |
c = | . | |
s = | . |
(2)
, , "." 4-- (.. "y", 310 ".") ". " 5-- (.. 305, ). , .
0 =
$6
, (, ). . , , $6 , . . , . 3-- 4--, 5--.
3-- 4--, 5--.
$6 :
. 22
|
- | ||
1 |
- . |
1 | 0 |
2 |
- . |
2 | 1-2 |
3 | 3 | 3-5 |
(1) ( 0)
.
a =
z =
(2) ( 1-2)
, $6 . . , . , , .
(3) ( 3-5)
, . . , , , .
$7
, , 100 ( 21-22).
2--, 3--, 4-- 5--, 7--. 2-- . 2-- $7. . .
, .
, .
:
ba =
ca =
da = -
db = -
dc = -
ea =
fa =
ga =
ha =
ia =
ja =
ka =
la =
zz =
, .
$8
, () ( , ..), 100 ( 9-11). 2--, 4-- 5-- 7--. , , , $a , , 21-22 100 .
. .
, .
.
2
Java
2.1. , / () - "" . Java . Sun . ( (9) c (10)). Sun C++ Oak - , .. ( ). . JavaTM Sun Microsystems .
//
/*
*/
( /* */ )
/** */ javadoc. - HTML-. . HTML- - . Java! . . (, , Sun .. : , , - 2 - P.Norton " Java".
=
byte (8 bit) : -128 - +127
short = 2 byte : -32768 .. +32767
int = 4 byte : -... +2147483647
long = 8 byte : - ( 10**19 )
? . ** , ** . int . - . .
float : 4 byte : min=+/-1,4*10**-45 max=+/-3,4*10**+38
double : 8 byte : max=+/-2*10**-308 max=+/-1.7*10**+308
char : 2 byte ( unicode - www.unicode.org - 65 000 ). Win DOS- ,
boolean : thrue/false ( 0 1)
" " ? . - . . , string. - . . ... .
int a; // .
// ; , ..
// ( )
, . - , "" , . java . 0,0 ; unicode (.. 0000 ), boolean - false ; ( , )
. .
- , ( ), . ( )
a = 5 ; // 5
:
int a = 5 ;
:
float c = 7.2 ;
boolean d = true ;
char e = 'M' ; //
- C - :
\n enter=newline \t = tab \r = enter \f = newpagetoprint \b backspace
unicode:
\u0037 = , '7' ( )
Unicode
CD .
, :
char c = '\'' ; // "c" " "
: 8 16- , :
a = 0x7B // 16- 7B
a = 0175 // 8- 175
---
?:
int x; // 4 byte
byte y; // 1 byte
x=y; // "y 1 byte "
// "x 4 byte "
, .
:
y=(byte)x; // 4- "x" 1-
.
double z = 7.8; . z
x=(int)z; // , 0.8
x=z; - . , . . z=x;
( % -
,
10 % 3 -> 1 ,
10,2 % 3 -> 堠 1)
-, . :
=+5; +=5;
- % * /
, =+1;
++ = ,
.
++ = ,
, ;
:
int a=5, b;
b=++a; // b
// ( 5 1,
// "6")
""
-- --
( , )
( )
< > =< >= ==
!=
int a = 5;
int b = 6;
boolean c
c = == b // "" - false
||
!
&&
true && true = true
true && false = false
false && true = false
false && false = false
true || true = true
true || false = true
false || true = true
false || false = false
!true = false
!false = true
? " -, - ,
, "". - - java.lang.Throwable Throwable String. - Throwable.
(-"") , - . . " ..", - , , " !" .
try{
}catch(Exception e){
" "
}finally{
catch
}
"Exception" . ., , Try{" "}. , , try-catch , .. , "Exception". Exception .
. . ( throw new "_Exception" <-[ try - catch]). .. - ( "Exception"). ( -) !
2.3 Java
while (condition) {
do-some-actions; // if condition=false,
}
do{
do-some-actions; // at least it'll be done once
} while (condition a verifier);
for (intitialisation; condition; modification){
do-some-actions;
}
:
for (int i = 0; i < 7; i++){
, , - ( , !. , i++ i=i+1
for break ( if() break
continue - .
:
for (int i=-3; i<3; i++){
if (i==0) continue; //
float a = 5/i; // - Java ,
} // _ inf (
//
//
i , - . , .. .
" , , - " ".. .." ( C)
if () {
; // /
... // ,
;
}
-, .
if ( ){
;
...
;
}else{
;
...
; // if
}
switch -
switch (value){
case value1 : do_this;
break; //
case value2 : do_this;
case value3 : ;
default : ;
}
. , Sun, . new .
1) .
int a[];
int[] a;
2) :
a=new int[5] ;
. . ? : "" - length - . -. int (long ).
. . ( ..)
"". , ? ! ( null). "" , ( !) - - . -: , , .
? . , :
int a[] = {7, 21, 85}; // new
:
" float "
float a[][];
:
float a[][] = new float [4][2]; // 4 2
:
float a[][] = new float [4][];
4- "" ( ). new , . :
a[0] = new float[3]; - ""...
. Java , . , , - . .
. ? , . - . . . , - "" .
, . :
data_type FunctionName (_1 _1, _2 _2, ... _N _N){
-, ;
-;
return(); // _ -
// return ; - " "
// ( )
}
. , . - void ;
. ( ) - . . .
- .
int Sum(int x, int y){
return (x+y);
}
" ". , , . ((( - " " .. " " - . : ! ( , , = ... . , .)))
- - "". , , (), . .
"" . , - "". "" - !
int Sum(int x, int y){
int rez; //
rez = x + y;
return (rez);
}
. , . . / , . . . , . - . :
float Sum(float x, float y){
return (x+y);
}
, Sum-, - Sum-.
float a=Sum(5, 6);
a = Sum(5,2, 6);
, ... . , . . ..
java-. .
2.4. - ().? , . Java - - . - . ( ), .
""
Mouse{
x // - ""
y // ""
draw() // = ""
}
:
class Name {
int x, y;
;
int Sum (int a, int b){} //
float z; // ..
//
}
, .
( ) ( ). .
- ? . 4 , 4 , . - . - . . , ! :-)
""
_ ( 1)
( 1)
- = . , .
- "" - , ( - ""). . void . - - - () . ? ..
: "". . . : . - .
( ), - . . , ? . , . , , .
: -
1) "" ( int a;
)
; // ,
// _ - , "" - null
// -
// ""
2) :
=new ();
- , , -.
: . ! - . ( - ). () . : - , . - ? -, .
. ++ Java .
= null;
"" - . , . , , . Java - .
3
SearchEngein.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.*;
//
public class SearchEngein extends HttpServlet {
//
Properties INIProperties = new Properties();
String query = null, //
value = null; //
String dbname, //
dbpath; //
String dbselect; //
byte MD = 30, //
MD2 = 31; //
String RusDos = new String("Cp866"); //
String RusWin = new String("windows-1251"); //
String iso = new String("8859_1"); //
String RusIso = new String("8859-5"); //
//
private String ConvertISO(String Str) {
try {
Str = new String( Str.getBytes(iso),RusWin);}
catch( java.io.UnsupportedEncodingException e ) { return Str;}
return Str;
}
public String getServletInfo() {
return " ";
}
private String RemoveTrash(String str){
return new String(str);
}
//
public String toLow(String str){
char old[] = str.toCharArray();
char news[] = new char[str.length()];
char c;
for (int i =0; i<str.length(); i++){
c = old[i];
switch (c) {
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
case '' : {c = '';break;}
default : {news[i]=c;}
}// switch
news[i] = c;
}
return new String(news);
}
//
private String TagRemove(String s){
boolean inTag = false;
boolean tag = false;
int sn = 0;
char c;
int m = s.length();
char[] cd = new char[m];
char[] old = s.toCharArray();
char cMD = (char) MD2;
for (int i=0; i<m; i++)
{c=old[i];
if (tag) { c=' '; tag = false; }
else if ( c == cMD ) { c=' '; tag = true;}
cd[i] = c;
}
return new String(cd);
}
//
public void dbFileRead(String dbNamePath, PrintStream out, String query) {
String mAvtor = null; // 100
String msAvtor = null; // 700
String mName = null; // 245
String mPrinter = null; // 260
String mSize = null; // 300
String mKey = null; // 653
String mSeria = null; // 490
String mBBK = null; // 91
String mKaIndex = null; // 90
long fPosMarker = 0, //
fPosData = 0; //
boolean done = false,
Avtor = false;
int mC =0,
mE =0; //
byte Jumper[] = new byte[5]; // -
int JIndex = 0, // -
JTemp = 0, // +
MIndex = 0, //
MTemp = 0; //
if (query != null){
try { RandomAccessFile dbfile = new RandomAccessFile(dbNamePath,"r");
//
while (fPosMarker != dbfile.length()) {
try { mC++;
dbfile.seek(fPosMarker);
dbfile.read(Jumper);
String jBuf = new String(Jumper);
JIndex = Integer.parseInt(jBuf,10);
int b = 0;
//
while ( b != MD){
dbfile.seek(fPosMarker+24+MIndex);
b = dbfile.read();
MTemp++;
MIndex = MTemp;
}
MTemp= MTemp - 1;
//
byte Dic[] = new byte[MTemp];
dbfile.seek(fPosMarker+24);
dbfile.read(Dic);
//
fPosData = fPosMarker+24+MTemp;
String sDic = new String(Dic);
byte MarcRec[] = new byte[JIndex-24-MTemp];
dbfile.seek(fPosData);
dbfile.read(MarcRec);
int DI2 = 0,
DI3 = 0,
DI4 = 0,
DI5 = 0,
PNum = 0, //
PLength = 0, //
PStart = 0; //
//
while ( DI2 != MTemp){
DI3=DI2+3;
String DStr = sDic.substring(DI2,DI3);//
DI4=DI3+5;
String DStr2 = sDic.substring(DI3,DI4);//
DI5=DI4+4;
String DStr3 = sDic.substring(DI4,DI5);//
DI2=DI2+12;
PLength = Integer.parseInt(DStr3,10);//
PStart = Integer.parseInt(DStr2,10);//
PNum = Integer.parseInt(DStr,10);//
byte Pole[] = new byte[PLength];
//
for (int PIndex = 0; PIndex < PLength; PIndex++) {
Pole[PIndex] = MarcRec[PStart+PIndex];
}
String Pol = new String(Pole);
if (Pol == null) Pol=" ";
switch (PNum) {
case 100 : { mAvtor = TagRemove(Pol.substring(5));break;}
case 700 : { msAvtor = TagRemove(Pol.substring(5));break;}
case 245 : { mName = TagRemove(Pol.substring(5));break;}
case 490 : { mSeria = TagRemove(Pol.substring(5));break;}
case 91 : { mBBK = TagRemove(Pol.substring(5));break;}
case 90 : { mKaIndex = TagRemove(Pol.substring(5));break;}
case 260 : { mPrinter = TagRemove(Pol.substring(5));break;}
case 300 : { mSize = TagRemove(Pol.substring(5));break;}
case 653 : { mKey = TagRemove(Pol.substring(5));break;}
default : {}
}// switch
}//
if ( mAvtor == null) mAvtor=" ";
if ( msAvtor == null) msAvtor=" ";
if ( mName == null) mName=" ";
if ( mPrinter == null) mPrinter=" ";
if ( mSize == null) mSize=" ";
if ( mKey == null) mKey=" ";
MarcRecord Rec = new MarcRecord( mAvtor,
msAvtor,
mName,
mPrinter,
mSize,
mKey,
mSeria,
mBBK,
mKaIndex);
if ( Rec.rAvtor.indexOf(query) != -1 ||
Rec.rsAvtor.indexOf(query) != -1 ||
Rec.rName.indexOf(query) != -1 ||
Rec.rKey.indexOf(query) != -1)
{ mE++;
out.println("<table width=\"461\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr bgcolor=\"#3399FF\">"+
"<td colspan=\"3\" class=\"text\"> : "+
"<font color=\"#000000\">"+
Rec.rAvtor+" "+
Rec.rsAvtor+
"</font></td></tr><tr>"+
"<td colspan=\"3\" valign=\"top\" class=\"bodytext\">"+mE+". "+mC+
" <b>:</b> "+
Rec.rName+"<br>"+
Rec.rPrinter+" "+
Rec.rSize+"<br>"+
Rec.rBBK+" "+
Rec.rKaIndex+" "+
Rec.rSeria+
"</td></tr></table>");
}
fPosMarker = fPosMarker+JIndex;
MTemp = 0;
MIndex = 0;
}
catch (IOException e) {
out.println("!!!"+"<br>");
done=true; }
}
}
catch (IOException e) { out.println(" "+dbNamePath); }
if (mE == 0) {
out.println(": "+query+" ");
}
} // end If
}
//
public void INIFile(String filename, String directory, PrintStream out) {
DataInputStream inifile = null;
String path = null,
iniRecord = null,
section = null,
vname = null,
vvalue = null;
boolean done = false;
int equalIndex = 0;
//
if (filename.length() == 0) {
out.println("IOError ");
System.exit(0);
}
if (directory.length() == 0) { directory = new String("c:\\www\\db"); }
if (filename.indexOf(".") < 0) { filename = new String(filename+".ini"); }
path = new String(directory+System.getProperty("file.separator")+filename);
//
try { inifile = new DataInputStream(new FileInputStream(path)); }
catch(FileNotFoundException e) {
out.println(filename+"not found");
System.exit(0);
}
//
try { iniRecord = inifile.readLine(); }
catch (IOException e) { done=true; }
while (!done && iniRecord != null)
{ if (iniRecord.startsWith("["))
{ section = iniRecord.substring(1,iniRecord.lastIndexOf("]"));}
else if (!iniRecord.startsWith(";"))
{ equalIndex = iniRecord.indexOf("=");
if (equalIndex > 0)
{ // => .
vname = new String(section+"."+iniRecord.substring(0,equalIndex));
vvalue = new String(iniRecord.substring(equalIndex+1));
INIProperties.put(vname, vvalue);
}
}
try { iniRecord = inifile.readLine(); }
catch (IOException e) { done=true; }
}
}
//
public String getINIVar(String key, String defValue) {
return INIProperties.getProperty(key, defValue);
}
//
public String getINIVar(String key) {
return INIProperties.getProperty(key);
}
public void init(ServletConfig conf) throws ServletException {
super.init(conf);
}
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintStream out;
out = new PrintStream(res.getOutputStream());
res.setContentType("text/html; charset=Cp866");
//
printPageHeader(out);
INIFile("db.ini","c:\\www\\db",out);
//
String requestEnc = req.getCharacterEncoding();
String clientEnc = requestEnc;
if ( requestEnc==null ) requestEnc=iso;
requestEnc=iso;
//
out.println("<body bgcolor=\"#FFFFFF\">");
out.println("<form method=\"get\" action=\"/serv/SearchEngein\">");
out.println(" <table width=\"461\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
out.println(" <tr bgcolor=\"#3399FF\"> ");
out.println(" <td width=\"266\" class=\"text\"> </td>");
out.println(" <td width=\"135\" class=\"text\"> </td> ");
out.println(" <td width=\"207\"> </td>");
out.println(" </tr>");
out.println(" <tr>");
out.println(" <td width=\"266\" valign=\"top\"> ");
out.println(" <input type=\"text\" name=\"Query\" maxlength=\"100\" size=\"38\" value=\"\">");
out.println(" </td>");
out.println(" <td width=\"135\" valign=\"top\"> ");
out.println(" <select name=\"select\" size=\"1\">");
out.println(" <option value=\"MARCFILE.Book\" selected>"+ConvertISO(getINIVar("KATALOG.Book"))+"</option>");
out.println(" <option value=\"MARCFILE.Stat\">"+ConvertISO(getINIVar("KATALOG.Stat"))+"</option>");
out.println(" <option value=\"MARCFILE.Periud\">"+ConvertISO(getINIVar("KATALOG.Periud"))+"</option>");
out.println(" <option value=\"MARCFILE.Podpis\">"+ConvertISO(getINIVar("KATALOG.Podpis"))+"</option>");
out.println(" <option value=\"MARCFILE.Ucheb\">"+ConvertISO(getINIVar("KATALOG.Ucheb"))+"</option>");
out.println(" </select>");
out.println(" </td>");
out.println(" <td width=\"207\" valign=\"top\"> ");
out.println(" <input type=\"submit\" name=\"Start\" value=\"\">");
out.println(" </td>");
out.println(" </tr>");
out.println(" </table>");
out.println(" </form>");
//
//
query = req.getParameter("Query");
if (query == null || query.length()<1)
{
printPageFooter(out);
return;
}
dbselect = req.getParameter("select");
value = new String(ConvertISO(query));
//
dbFileRead(getINIVar(dbselect), out, value);
//
printPageFooter(out);
query = null;
value = null;
}
//
private void printPageHeader(PrintStream out) {
out.println("<html>");
out.println("<head>");
out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Cp866\">");
out.println("<style type=\"text/css\">");
out.println("<!--");
out.println(".text { font: bold 12px Arial, Helvetica, sans-serif; color: #0000FF; text-decoration: none; text-align: left; }");
out.println(".bodytext { font: 12px Arial, Helvetica, sans-serif; color: #000000; text-decoration: none; text-align: left; }");
out.println("-->");
out.println("</style>");
out.println("</head>");
}
private void printPageFooter(PrintStream out) {
out.println("</body>");
out.println("</html>");
out.flush();
}
}
//
class MarcRecord {
protected String rAvtor; //
protected String rsAvtor; //
protected String rName; //
protected String rPrinter; //
protected String rSize; //
protected String rKey; //
protected String rSeria;
protected String rBBK;
protected String rKaIndex;
MarcRecord( String r1,
String r2,
String r3,
String r4,
String r5,
String r6,
String r8,
String r11,
String r12) {
rAvtor = r1;
rsAvtor = r2;
rName = r3;
rPrinter = r4;
rSize = r5;
rKey = r6;
rSeria = r8;
rBBK = r11;
rKaIndex = r12;
}
}
4
4 1000, 5000, 8366, 10000 . , . (. ).
-
Copyright (c) 2025 Stud-Baza.ru , , , .