refactoring

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4524 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent bc3d3b4c97
commit 275a226cc5

@ -86,7 +86,7 @@ public class AccessTracker_p {
prop.put("page_num", entCount);
}
if (page == 1) {
String host = post.get("host", "");
String host = (post == null) ? "" : post.get("host", "");
int entCount = 0;
TreeMap<Long, String> access;
Map.Entry<Long, String> entry;

@ -1,4 +1,4 @@
import java.io.IOException;
import de.anomic.http.httpHeader;
import de.anomic.server.serverObjects;
@ -8,7 +8,7 @@ import de.anomic.ymage.ymageOSM;
public class osm {
public static ymageMatrix respond(httpHeader header, serverObjects post, serverSwitch env) throws IOException {
public static ymageMatrix respond(httpHeader header, serverObjects post, serverSwitch env) {
int zoom = 10;
double lat = 47.968056d;

@ -340,7 +340,7 @@ public class blogBoard {
wikiBoard.setAuthor(ip, new String(author));
}
private BlogEntry(String key, HashMap<String, String> record) {
BlogEntry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList<String>()));

@ -76,7 +76,7 @@ public class blogBoardComments {
private static final String dateFormat = "yyyyMMddHHmmss";
private static final int recordSize = 512;
private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);
static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);
static {
SimpleFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
@ -94,7 +94,7 @@ public class blogBoardComments {
public void close() {
database.close();
}
private static String dateString(Date date) {
static String dateString(Date date) {
synchronized (SimpleFormatter) {
return SimpleFormatter.format(date);
}
@ -240,7 +240,7 @@ public class blogBoardComments {
wikiBoard.setAuthor(ip, new String(author));
}
private CommentEntry(String key, HashMap<String, String> record) {
CommentEntry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList<String>()));

@ -951,7 +951,7 @@ public class bookmarksDB {
this((new yacyURL((String)map.map().get(BOOKMARK_URL), null)).hash(), map.map());
}
private Map<String, String> toMap() {
Map<String, String> toMap() {
entry.put(BOOKMARK_TAGS, listManager.collection2string(tags));
entry.put(BOOKMARK_TIMESTAMP, String.valueOf(this.timestamp));
return entry;

@ -55,8 +55,8 @@ import java.util.ArrayList;
public class diff {
private final ArrayList <Part> parts = new ArrayList<Part>();
private final Object[] o;
private final Object[] n;
final Object[] o;
final Object[] n;
/**
* @param o the original <code>String</code>
@ -217,7 +217,7 @@ public class diff {
private final int posOld;
private final int posNew;
private Part(int action, int posOld, int posNew) {
Part(int action, int posOld, int posNew) {
this.action = action;
this.posOld = posOld;
this.posNew = posNew;

@ -60,13 +60,13 @@ public class messageBoard {
private static final String dateFormat = "yyyyMMddHHmmss";
private static final int recordSize = 512;
private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);
static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);
static {
SimpleFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
}
private kelondroMapObjects database = null;
kelondroMapObjects database = null;
private int sn = 0;
public messageBoard(File path) {
@ -85,13 +85,13 @@ public class messageBoard {
database.close();
}
private static String dateString() {
static String dateString() {
synchronized (SimpleFormatter) {
return SimpleFormatter.format(new Date());
}
}
private String snString() {
String snString() {
String s = Integer.toString(sn);
if (s.length() == 1) s = "0" + s;
sn++;
@ -137,7 +137,7 @@ public class messageBoard {
record.put("read", "false");
}
private entry(String key, HashMap<String, String> record) {
entry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
}

@ -70,8 +70,8 @@ public final class userDB {
kelondroMapObjects userTable;
private final File userTableFile;
private HashMap<String, String> ipUsers = new HashMap<String, String>();
private HashMap<String, Object> cookieUsers = new HashMap<String, Object>();
HashMap<String, String> ipUsers = new HashMap<String, String>();
HashMap<String, Object> cookieUsers = new HashMap<String, Object>();
public userDB(File userTableFile) {
this.userTableFile = userTableFile;
@ -325,8 +325,8 @@ public final class userDB {
public static final int PROXY_TIMELIMIT_REACHED = 3;
// this is a simple record structure that hold all properties of a user
private HashMap<String, String> mem;
private String userName;
HashMap<String, String> mem;
String userName;
private Calendar oldDate, newDate;
public Entry(String userName, HashMap<String, String> mem) throws IllegalArgumentException {

@ -259,7 +259,7 @@ public class knwikiParser implements wikiParser {
public boolean isEscaped() { return this.escaped; }
public boolean isNewLineBefore() { return this.nl; }
private static Text[] split2Texts(String text, String escapeBegin, String escapeEnd) {
static Text[] split2Texts(String text, String escapeBegin, String escapeEnd) {
if (text == null) return null;
if (text.length() < 2) return new Text[] { new Text(text, false, true) };
@ -286,7 +286,7 @@ public class knwikiParser implements wikiParser {
from < escapeEnd.length() + 2 || (!escaped && text.charAt(from - escapeEnd.length() - 1) == '\n'));
}
private static String mergeTexts(Text[] texts) {
static String mergeTexts(Text[] texts) {
StringBuffer sb = new StringBuffer();
for (int n=0; n < texts.length; n++)
sb.append(texts[n].getTextPlain());

@ -60,15 +60,15 @@ public class wikiBoard {
private static final String dateFormat = "yyyyMMddHHmmss";
private static final int recordSize = 512;
private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);
static SimpleDateFormat SimpleFormatter = new SimpleDateFormat(dateFormat);
static {
SimpleFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
}
private kelondroMapObjects datbase = null;
private kelondroMapObjects bkpbase = null;
private static HashMap<String, String> authors = new HashMap<String, String>();
kelondroMapObjects datbase = null;
kelondroMapObjects bkpbase = null;
static HashMap<String, String> authors = new HashMap<String, String>();
public wikiBoard(File actpath, File bkppath) {
new File(actpath.getParent()).mkdirs();
@ -94,7 +94,7 @@ public class wikiBoard {
bkpbase.close();
}
private static String dateString() {
static String dateString() {
return dateString(new Date());
}
@ -156,7 +156,7 @@ public class wikiBoard {
//System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString());
}
private entry(String key, HashMap<String, String> record) {
entry(String key, HashMap<String, String> record) {
this.key = key;
this.record = record;
}
@ -204,7 +204,7 @@ public class wikiBoard {
return b;
}
private void setAncestorDate(Date date) {
void setAncestorDate(Date date) {
record.put("bkp", dateString(date));
}
@ -238,7 +238,7 @@ public class wikiBoard {
return read(key + dateString(ancDate), bkpbase);
}
private void setChild(String subject) {
void setChild(String subject) {
record.put("child", kelondroBase64Order.enhancedCoder.encode(subject.getBytes()));
}
@ -290,7 +290,7 @@ public class wikiBoard {
return read(key, datbase);
}
private entry read(String key, kelondroMapObjects base) {
entry read(String key, kelondroMapObjects base) {
try {
key = normalize(key);
if (key.length() > keyLength) key = key.substring(0, keyLength);

@ -108,7 +108,7 @@ public final class httpc {
private static final String vDATE = "20040602";
private static final int terminalMaxLength = 30000;
private static final SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
private static final HashMap<String, String> reverseMappingCache = new HashMap<String, String>();
static final HashMap<String, String> reverseMappingCache = new HashMap<String, String>();
private static final HashSet<httpc> activeConnections = new HashSet<httpc>(); // all connections are stored here and deleted when they are finished
private static final long minimumTime_before_activeConnections_cleanup = 3600000; // 1 Hour
private static final long minimumTime_before_idleConnections_cleanup = 120000; // 2 Minutes
@ -189,7 +189,7 @@ public final class httpc {
private String target_virtual_host = null;
// output and input streams for client control connection
private PushbackInputStream clientInput = null;
PushbackInputStream clientInput = null;
private OutputStream clientOutput = null;
private httpdByteCountInputStream clientInputByteCount = null;
@ -198,7 +198,7 @@ public final class httpc {
private boolean remoteProxyUse = false;
private httpRemoteProxyConfig remoteProxyConfig = null;
private String requestPath = null;
String requestPath = null;
private boolean allowContentEncoding = true;
public boolean ssl;
@ -1443,7 +1443,7 @@ public final class httpc {
} catch (IOException e) {
e.printStackTrace();
}
if (file.length() == 0) file.delete();
if ((file != null) && (file.length() == 0)) file.delete();
}
}

@ -153,7 +153,8 @@ public class indexRWIEntryOrder {
public static class minmaxfinder extends Thread {
private indexRWIVarEntry entryMin, entryMax;
indexRWIVarEntry entryMin;
indexRWIVarEntry entryMax;
private indexContainer container;
private int start, end;
private HashMap<String, Integer> doms;

@ -53,9 +53,9 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
private static long POS_COLUMNS = POS_DESCR + LEN_DESCR; // 2 bytes, short: number of columns in one entry
private static long POS_OHBYTEC = POS_COLUMNS + 2; // 2 bytes, number of extra bytes on each Node
private static long POS_OHHANDLEC = POS_OHBYTEC + 2; // 2 bytes, number of Handles on each Node
private static long POS_USEDC = POS_OHHANDLEC + 2; // 4 bytes, int: used counter
private static long POS_FREEC = POS_USEDC + 4; // 4 bytes, int: free counter
private static long POS_FREEH = POS_FREEC + 4; // 4 bytes, int: free pointer (to free chain start)
static long POS_USEDC = POS_OHHANDLEC + 2; // 4 bytes, int: used counter
static long POS_FREEC = POS_USEDC + 4; // 4 bytes, int: free counter
static long POS_FREEH = POS_FREEC + 4; // 4 bytes, int: free pointer (to free chain start)
private static long POS_MD5PW = POS_FREEH + 4; // 16 bytes, string (encrypted password to this file)
private static long POS_ENCRYPTION = POS_MD5PW + 16; // 16 bytes, string (method description)
private static long POS_OFFSET = POS_ENCRYPTION + 16; // 8 bytes, long (seek position of first record)
@ -75,7 +75,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
protected int headchunksize;// overheadsize + key element column size
protected int tailchunksize;// sum(all: COLWIDTHS) minus the size of the key element colum
protected int recordsize; // (overhead + sum(all: COLWIDTHS)) = the overall size of a record
private byte[] spaceChunk; // a chunk of data that is used to reserve space within the file
byte[] spaceChunk; // a chunk of data that is used to reserve space within the file
// dynamic run-time seek pointers
private long POS_HANDLES = 0; // starts after end of POS_COLWIDHS which is POS_COLWIDTHS + COLWIDTHS.length * 4
@ -137,7 +137,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
}
}
private synchronized void writeused(boolean finalwrite) throws IOException {
synchronized void writeused(boolean finalwrite) throws IOException {
// we write only at close time, not in between. othervise, the read/write head
// needs to run up and own all the way between the beginning and the end of the
// file for each record. We check consistency beteen file size and
@ -176,7 +176,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
return this.USEDC + this.FREEC;
}
private synchronized int used() {
synchronized int used() {
checkConsistency();
return this.USEDC;
}

@ -286,7 +286,6 @@ public class kelondroAttrSeq {
StringTokenizer st = new StringTokenizer(attr, ",");
while (st.hasMoreTokens()) {
a = new kelondroColumn(st.nextToken());
if (a == null) break;
l.add(a);
}
prop_names = new String[l.size()];
@ -307,7 +306,6 @@ public class kelondroAttrSeq {
st = new StringTokenizer(seqs, ",");
while (st.hasMoreTokens()) {
a = new kelondroColumn(st.nextToken());
if (a == null) break;
l.add(a);
}
seq_names = new String[l.size()];

@ -42,7 +42,7 @@ public class kelondroBufferedEcoFS {
* That means, each time, an entry is written to the end of the file, it is not buffered
*/
public kelondroBufferedEcoFS(kelondroEcoFS efs, int maxEntries) throws IOException {
public kelondroBufferedEcoFS(kelondroEcoFS efs, int maxEntries) {
this.efs = efs;
this.maxEntries = maxEntries;
this.buffer = new TreeMap<Long, byte[]>();

@ -165,7 +165,7 @@ public class kelondroCache implements kelondroIndex {
return true;
}
private boolean checkHitSpace() throws IOException {
private boolean checkHitSpace() {
// returns true if it is allowed to write into this cache
int status = cacheGrowStatus();
if (status < 1) {

@ -46,8 +46,18 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements ke
private static long memStartShrink = 6000000; // a limit for the node cache to start with shrinking if less than this memory amount is available
// caching buffer
private kelondroIntBytesMap cacheHeaders; // the cache; holds overhead values and key element
private int readHit, readMiss, writeUnique, writeDouble, cacheDelete, cacheFlush;
kelondroIntBytesMap cacheHeaders; // the cache; holds overhead values and key element
int readHit;
int readMiss;
int writeUnique;
int writeDouble;
int cacheDelete;
int cacheFlush;
public kelondroCachedRecords(
@ -110,7 +120,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements ke
}
}
private int cacheGrowStatus() {
int cacheGrowStatus() {
long available = serverMemory.available();
if ((cacheHeaders != null) && (available < cacheHeaders.memoryNeededForGrow())) return 0;
return cacheGrowStatus(available, memStopGrow, memStartShrink);
@ -300,7 +310,7 @@ public class kelondroCachedRecords extends kelondroAbstractRecords implements ke
//private Handle[] ohHandle= null; // the overhead handles, OHHANDLEC values
//private byte[][] values = null; // an array of byte[] nodes is the value vector
private kelondroHandle handle = null; // index of the entry, by default NUL means undefined
private byte[] headChunk = null; // contains ohBytes, ohHandles and the key value
byte[] headChunk = null; // contains ohBytes, ohHandles and the key value
private byte[] tailChunk = null; // contains all values except the key value
private boolean headChanged = false;
private boolean tailChanged = false;

@ -57,7 +57,7 @@ public class kelondroCollectionIndex {
private static final long minimumRAM4Eco = 20 * 1024 * 1024;
private static final int EcoFSBufferSize = 1000;
private kelondroIndex index;
kelondroIndex index;
private int keylength;
private File path;
private String filenameStub;
@ -354,7 +354,7 @@ public class kelondroCollectionIndex {
// this is computed by the size of the biggest used collection
// this must be multiplied with the payload size
// and doubled for necessary memory transformation during sort operation
return (int) (arrayCapacity(arrays.size() - 1) * this.payloadrow.objectsize * kelondroRowSet.growfactor);
return (int) (arrayCapacity(arrays.size() - 1) * this.payloadrow.objectsize * kelondroRowCollection.growfactor);
}
private void array_remove(

@ -119,7 +119,7 @@ public class kelondroDyn {
file.delete();
} else {
if (file.isDirectory()) {
kelondroFlexTable.delete(file.getParentFile(), file.getName());
kelondroFlexWidthArray.delete(file.getParentFile(), file.getName());
} else {
file.delete();
}

@ -61,10 +61,12 @@ public class kelondroEcoTable implements kelondroIndex {
public static final long maxarraylength = 134217727L; // that may be the maxmimum size of array length in some JVMs
private kelondroRowSet table;
private kelondroBytesIntMap index;
private kelondroBufferedEcoFS file;
private kelondroRow rowdef, taildef;
kelondroRowSet table;
kelondroBytesIntMap index;
kelondroBufferedEcoFS file;
kelondroRow rowdef;
kelondroRow taildef;
private int buffersize;
public kelondroEcoTable(File tablefile, kelondroRow rowdef, int useTailCache, int buffersize, int initialSpace) {
@ -88,7 +90,7 @@ public class kelondroEcoTable implements kelondroIndex {
// should not happen
e.printStackTrace();
}
try { fos.close(); } catch (IOException e) {}
if (fos != null) try { fos.close(); } catch (IOException e) {}
}
try {
@ -220,7 +222,7 @@ public class kelondroEcoTable implements kelondroIndex {
}
public static int staticRAMIndexNeed(File f, kelondroRow rowdef) {
return (int) ((rowdef.primaryKeyLength + 4) * tableSize(f, rowdef.objectsize) * kelondroRowSet.growfactor);
return (int) ((rowdef.primaryKeyLength + 4) * tableSize(f, rowdef.objectsize) * kelondroRowCollection.growfactor);
}
public synchronized void addUnique(Entry row) throws IOException {
@ -492,7 +494,7 @@ public class kelondroEcoTable implements kelondroIndex {
// should not happen
e.printStackTrace();
}
try { fos.close(); } catch (IOException e) {}
if (fos != null) try { fos.close(); } catch (IOException e) {}
// open an existing table file

@ -140,7 +140,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
}
public static int staticRAMIndexNeed(File path, String tablename, kelondroRow rowdef) {
return (int) ((rowdef.column(0).cellwidth + 4) * staticSize(path, tablename) * kelondroRowSet.growfactor);
return (int) ((rowdef.column(0).cellwidth + 4) * staticSize(path, tablename) * kelondroRowCollection.growfactor);
}
public boolean hasRAMIndex() {
@ -385,26 +385,24 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
}
public synchronized kelondroCloneableIterator<kelondroRow.Entry> rows(boolean up, byte[] firstKey) throws IOException {
if (index == null) return new rowIterator(index, up, firstKey);
if (index == null) return new rowIterator(up, firstKey);
assert this.size() == index.size() : "content.size() = " + this.size() + ", index.size() = " + index.size();
return new rowIterator(index, up, firstKey);
return new rowIterator(up, firstKey);
}
public class rowIterator implements kelondroCloneableIterator<kelondroRow.Entry> {
kelondroCloneableIterator<kelondroRow.Entry> indexIterator;
kelondroBytesIntMap index;
boolean up;
public rowIterator(kelondroBytesIntMap index, boolean up, byte[] firstKey) throws IOException {
this.index = index;
public rowIterator(boolean up, byte[] firstKey) throws IOException {
this.up = up;
indexIterator = index.rows(up, firstKey);
}
public rowIterator clone(Object modifier) {
try {
return new rowIterator(index, up, (byte[]) modifier);
return new rowIterator(up, (byte[]) modifier);
} catch (IOException e) {
return null;
}

@ -162,7 +162,7 @@ public class kelondroFlexWidthArray implements kelondroArray {
// open existing files
File file = new File(tabledir, "col.000.list");
return kelondroCachedRecords.staticsize(file);
return kelondroAbstractRecords.staticsize(file);
}
public static void delete(File path, String tablename) {

@ -45,8 +45,10 @@ import java.util.Iterator;
public class kelondroMHashMap {
private int keylen, valuelen, reclen, count;
private byte[] mem;
int keylen;
int valuelen;
int reclen, count;
byte[] mem;
private byte[] emptykey;
public kelondroMHashMap(int valuelen) {

@ -43,7 +43,7 @@ public class kelondroRowCollection {
public static final double growfactor = 1.4;
private static final int isortlimit = 20;
private static final Integer dummy = new Integer(0);
static final Integer dummy = new Integer(0);
public static final qsortthread sortingthread;
static {
@ -538,7 +538,7 @@ public class kelondroRowCollection {
}
}
private final void qsort(int L, int R, int S, byte[] swapspace) {
final void qsort(int L, int R, int S, byte[] swapspace) {
if (R - L < isortlimit) {
isort(L, R, swapspace);
return;

@ -131,7 +131,7 @@ public class kelondroSplitTable implements kelondroIndex {
for (int i = 0; i < l.length; i++) {
if (l[i].startsWith(tablename)) {
File f = new File(path, l[i]);
if (f.isDirectory()) kelondroFlexTable.delete(path, l[i]); else f.delete();
if (f.isDirectory()) kelondroFlexWidthArray.delete(path, l[i]); else f.delete();
}
}
init(true);

@ -217,7 +217,7 @@ public final class kelondroStack extends kelondroFullRecords {
return row().newEntry(n.getValueRow());
}
private void unlinkNode(kelondroNode n) throws IOException {
void unlinkNode(kelondroNode n) throws IOException {
// join chaines over node
kelondroHandle l = n.getOHHandle(left);
kelondroHandle r = n.getOHHandle(right);

@ -1507,7 +1507,7 @@ public class kelondroTree extends kelondroCachedRecords implements kelondroIndex
} catch (Exception e) {
e.printStackTrace();
try {tt.print();} catch (IOException ee) {}
if (tt != null) try {tt.print();} catch (IOException ee) {}
System.out.println("TERMINATED");
}
}

@ -38,7 +38,7 @@ import java.util.Iterator;
import java.util.Map;
import de.anomic.data.robotsParser;
import de.anomic.kelondro.kelondroFlexTable;
import de.anomic.kelondro.kelondroFlexWidthArray;
import de.anomic.plasma.plasmaCrawlEntry;
import de.anomic.plasma.plasmaCrawlNURL;
import de.anomic.plasma.plasmaCrawlProfile;
@ -57,9 +57,9 @@ import de.anomic.yacy.yacyURL;
public class plasmaCrawlQueues {
private plasmaSwitchboard sb;
private serverLog log;
private Map<Integer, crawlWorker> workers; // mapping from url hash to Worker thread object
private plasmaProtocolLoader loader;
serverLog log;
Map<Integer, crawlWorker> workers; // mapping from url hash to Worker thread object
plasmaProtocolLoader loader;
private ArrayList<String> remoteCrawlProviderHashes;
public plasmaCrawlNURL noticeURL;
@ -80,7 +80,7 @@ public class plasmaCrawlQueues {
if (errorDBFile.exists()) {
// delete the error db to get a fresh each time on startup
// this is useful because there is currently no re-use of the data in this table.
if (errorDBFile.isDirectory()) kelondroFlexTable.delete(plasmaPath, "urlError2.db"); else errorDBFile.delete();
if (errorDBFile.isDirectory()) kelondroFlexWidthArray.delete(plasmaPath, "urlError2.db"); else errorDBFile.delete();
}
errorURL = new plasmaCrawlZURL(plasmaPath, "urlError2.db", false);
delegatedURL = new plasmaCrawlZURL(plasmaPath, "urlDelegated2.db", true);

@ -324,7 +324,7 @@ public final class plasmaCondenser {
public int posInText; // unique handle, is initialized with word position (excluding double occurring words)
public int posInPhrase; // position of word in phrase
public int numOfPhrase; // number of phrase. 'normal' phrases begin with number 100
private HashSet<Integer> hash; // a set of handles to all sentences where this word appears
HashSet<Integer> hash; // a set of handles to all sentences where this word appears
public kelondroBitfield flags; // the flag bits for each word
public wordStatProp(int handle, int pip, int nop) {

@ -75,7 +75,7 @@ public class plasmaCrawlBalancer {
// class variables
private ArrayList<String> urlRAMStack; // a list that is flushed first
private kelondroStack urlFileStack; // a file with url hashes
private kelondroIndex urlFileIndex;
kelondroIndex urlFileIndex;
private HashMap<String, LinkedList<String>> domainStacks; // a map from domain name part to Lists with url hashs
private File cacheStacksPath;
private String stackname;

@ -95,7 +95,7 @@ public final class plasmaCrawlLURL {
private final LinkedList<String> gcrawlResultStack; // 6 - local index: triggered external
// the class object
private kelondroIndex urlIndexFile;
kelondroIndex urlIndexFile;
public plasmaCrawlLURL(File indexPath) {
super();

@ -60,9 +60,9 @@ import de.anomic.yacy.yacyURL;
public class plasmaCrawlProfile {
private static HashMap<String, Map<String, DomProfile>> domsCache = new HashMap<String, Map<String, DomProfile>>();
static HashMap<String, Map<String, DomProfile>> domsCache = new HashMap<String, Map<String, DomProfile>>();
private kelondroMapObjects profileTable;
kelondroMapObjects profileTable;
private File profileTableFile;
public plasmaCrawlProfile(File file) {
@ -72,7 +72,7 @@ public class plasmaCrawlProfile {
profileTable = new kelondroMapObjects(dyn, 500);
}
private void resetDatabase() {
void resetDatabase() {
// deletes the profile database and creates a new one
if (profileTable != null) profileTable.close();
if (!(profileTableFile.delete())) throw new RuntimeException("cannot delete crawl profile database");
@ -252,7 +252,7 @@ public class plasmaCrawlProfile {
public static final String XDSTOPW = "xdstopw";
public static final String XPSTOPW = "xpstopw";
private HashMap<String, String> mem;
HashMap<String, String> mem;
private Map<String, DomProfile> doms;
public entry(String name, yacyURL startURL, String generalFilter, String specificFilter,

@ -34,7 +34,7 @@ import java.util.LinkedList;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroEcoTable;
import de.anomic.kelondro.kelondroFlexTable;
import de.anomic.kelondro.kelondroFlexWidthArray;
import de.anomic.kelondro.kelondroIndex;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroRowSet;
@ -57,7 +57,7 @@ public class plasmaCrawlZURL {
0);
// the class object
private kelondroIndex urlIndex = null;
kelondroIndex urlIndex = null;
private LinkedList<String> stack = new LinkedList<String>(); // strings: url
public plasmaCrawlZURL(File cachePath, String tablename, boolean startWithEmptyFile) {
@ -66,7 +66,7 @@ public class plasmaCrawlZURL {
File f = new File(cachePath, tablename);
if (startWithEmptyFile) {
if (f.exists()) {
if (f.isDirectory()) kelondroFlexTable.delete(cachePath, tablename); else f.delete();
if (f.isDirectory()) kelondroFlexWidthArray.delete(cachePath, tablename); else f.delete();
}
}
urlIndex = new kelondroEcoTable(f, rowdef, kelondroEcoTable.tailCacheDenyUsage, EcoFSBufferSize, 0);

@ -99,7 +99,7 @@ public final class plasmaHTCache {
private static final int stackLimit = 150; // if we exceed that limit, we do not check idle
public static final long oneday = 1000 * 60 * 60 * 24; // milliseconds of a day
private static kelondroMapObjects responseHeaderDB = null;
static kelondroMapObjects responseHeaderDB = null;
private static final LinkedList<Entry> cacheStack = new LinkedList<Entry>();
private static final Map<String, File> cacheAge = Collections.synchronizedMap(new TreeMap<String, File>()); // a <date+hash, cache-path> - relation
public static long curCacheSize = 0;
@ -298,7 +298,7 @@ public final class plasmaHTCache {
}
}
private static void resetResponseHeaderDB() {
static void resetResponseHeaderDB() {
if (responseHeaderDB != null) responseHeaderDB.close();
File dbfile = new File(cachePath, DB_NAME);
if (dbfile.exists()) dbfile.delete();

@ -68,9 +68,9 @@ public final class plasmaSearchEvent {
private static final int max_results_preparation = 200;
private long eventTime;
private plasmaSearchQuery query;
plasmaSearchQuery query;
private plasmaWordIndex wordIndex;
private plasmaSearchRankingProcess rankedCache; // ordered search results, grows dynamically as all the query threads enrich this container
plasmaSearchRankingProcess rankedCache; // ordered search results, grows dynamically as all the query threads enrich this container
private Map<String, TreeMap<String, String>> rcAbstracts; // cache for index abstracts; word:TreeMap mapping where the embedded TreeMap is a urlhash:peerlist relation
private yacySearch[] primarySearchThreads, secondarySearchThreads;
private Thread localSearchThread;
@ -80,12 +80,12 @@ public final class plasmaSearchEvent {
public TreeMap<String, Integer> IACount;
public String IAmaxcounthash, IAneardhthash;
private resultWorker[] workerThreads;
private kelondroSortStore<ResultEntry> result;
private kelondroSortStore<plasmaSnippetCache.MediaSnippet> images; // container to sort images by size
private HashMap<String, String> failedURLs; // a mapping from a urlhash to a fail reason string
kelondroSortStore<ResultEntry> result;
kelondroSortStore<plasmaSnippetCache.MediaSnippet> images; // container to sort images by size
HashMap<String, String> failedURLs; // a mapping from a urlhash to a fail reason string
TreeSet<String> snippetFetchWordHashes; // a set of word hashes that are used to match with the snippets
private long urlRetrievalAllTime;
private long snippetComputationAllTime;
long urlRetrievalAllTime;
long snippetComputationAllTime;
@SuppressWarnings("unchecked")
private plasmaSearchEvent(plasmaSearchQuery query,
@ -270,7 +270,7 @@ public final class plasmaSearchEvent {
}
}
private ResultEntry obtainResultEntry(indexURLEntry page, int snippetFetchMode) {
ResultEntry obtainResultEntry(indexURLEntry page, int snippetFetchMode) {
// a search result entry needs some work to produce a result Entry:
// - check if url entry exists in LURL-db
@ -391,7 +391,7 @@ public final class plasmaSearchEvent {
return false;
}
private boolean anyRemoteSearchAlive() {
boolean anyRemoteSearchAlive() {
// check primary search threads
if ((this.primarySearchThreads != null) && (this.primarySearchThreads.length != 0)) {
for (int i = 0; i < this.primarySearchThreads.length; i++) {
@ -650,7 +650,7 @@ public final class plasmaSearchEvent {
boolean secondarySearchStartet = false;
private void prepareSecondarySearch() {
void prepareSecondarySearch() {
if (secondarySearchStartet) return; // don't do this twice
if ((rcAbstracts == null) || (rcAbstracts.size() != query.queryHashes.size())) return; // secondary search not possible (yet)

@ -116,7 +116,7 @@ public class plasmaSnippetCache {
private String line;
private String error;
private int errorCode;
private Set<String> remaingHashes;
Set<String> remaingHashes;
private yacyURL favicon;
public TextSnippet(yacyURL url, String line, int errorCode, Set<String> remaingHashes, String errortext) {

@ -62,9 +62,9 @@ import de.anomic.yacy.yacyURL;
public class plasmaSwitchboardQueue {
private kelondroStack sbQueueStack;
private plasmaCrawlProfile profiles;
private plasmaCrawlLURL lurls;
kelondroStack sbQueueStack;
plasmaCrawlProfile profiles;
plasmaCrawlLURL lurls;
private File sbQueueStackPath;
public plasmaSwitchboardQueue(plasmaCrawlLURL lurls, File sbQueueStackPath, plasmaCrawlProfile profiles) {
@ -191,14 +191,14 @@ public class plasmaSwitchboardQueue {
}
public class Entry {
private yacyURL url; // plasmaURL.urlStringLength
private String referrerHash; // plasmaURL.urlHashLength
private Date ifModifiedSince; // 6
private byte flags; // 1
private String initiator; // yacySeedDB.commonHashLength
private int depth; // plasmaURL.urlCrawlDepthLength
private String profileHandle; // plasmaURL.urlCrawlProfileHandleLength
private String anchorName; // plasmaURL.urlDescrLength
yacyURL url; // plasmaURL.urlStringLength
String referrerHash; // plasmaURL.urlHashLength
Date ifModifiedSince; // 6
byte flags; // 1
String initiator; // yacySeedDB.commonHashLength
int depth; // plasmaURL.urlCrawlDepthLength
String profileHandle; // plasmaURL.urlCrawlProfileHandleLength
String anchorName; // plasmaURL.urlDescrLength
// computed values
private plasmaCrawlProfile.entry profileEntry;

@ -55,7 +55,7 @@ public class plasmaWebStructure {
private serverLog log;
private File rankingPath, structureFile;
private String crlFile, crgFile;
private TreeMap<String, String> structure; // <b64hash(6)>','<host> to <date-yyyymmdd(8)>{<target-b64hash(6)><target-count-hex(4)>}*
TreeMap<String, String> structure; // <b64hash(6)>','<host> to <date-yyyymmdd(8)>{<target-b64hash(6)><target-count-hex(4)>}*
public plasmaWebStructure(serverLog log, File rankingPath, String crlFile, String crgFile, File structureFile) {
this.log = log;
@ -181,7 +181,7 @@ public class plasmaWebStructure {
return (refs.length() - 8) / 10;
}
private static Map<String, Integer> refstr2map(String refs) {
static Map<String, Integer> refstr2map(String refs) {
if ((refs == null) || (refs.length() <= 8)) return new HashMap<String, Integer>();
Map<String, Integer> map = new HashMap<String, Integer>();
String c;

@ -96,7 +96,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
public static final Class<?>[] stringType = {"".getClass()}; // set up some reflection
public static final long startupTime = System.currentTimeMillis();
public static final ThreadGroup sessionThreadGroup = new ThreadGroup("sessionThreadGroup");
private static int sessionCounter = 0; // will be increased with each session and is used to return a hash code
static int sessionCounter = 0; // will be increased with each session and is used to return a hash code
// static variables
public static final Boolean TERMINATE_CONNECTION = Boolean.FALSE;
@ -122,7 +122,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
HashMap<String, String> denyHost;
int commandMaxLength;
private int maxBusySessions;
private HashSet<Session> busySessions;
HashSet<Session> busySessions;
/*
private static ServerSocketFactory getServerSocketFactory(boolean dflt, File keyfile, String passphrase) {

@ -39,7 +39,7 @@ import org.xml.sax.helpers.DefaultHandler;
public class crawlHandler extends DefaultHandler {
// statics for item generation and automatic categorization
private static int guidcount = 0;
static int guidcount = 0;
private static final String[] startpointTags = new String[]{
"author", //
"copyright", //

@ -46,7 +46,7 @@ import de.anomic.server.logging.serverLog;
public class rssReader extends DefaultHandler {
// statics for item generation and automatic categorization
private static int guidcount = 0;
static int guidcount = 0;
private static final String[] tagsDef = new String[]{
"author", //
"copyright", //

@ -283,7 +283,7 @@ public class yacyCore {
}
protected class publishThread extends Thread {
private int added;
int added;
private yacySeed seed;
private final serverSemaphore sync;
private final List<Thread> syncList;

@ -58,7 +58,7 @@ import de.anomic.server.serverDate;
public class yacyNewsQueue {
private File path;
private kelondroStack queueStack;
kelondroStack queueStack;
private yacyNewsDB newsDB;
public static final kelondroRow rowdef = new kelondroRow(new kelondroColumn[]{
@ -144,7 +144,7 @@ public class yacyNewsQueue {
return null;
}
private yacyNewsRecord b2r(kelondroRow.Entry b) throws IOException {
yacyNewsRecord b2r(kelondroRow.Entry b) throws IOException {
if (b == null) return null;
String id = b.getColString(0, null);
//Date touched = yacyCore.parseUniversalDate(new String(b[1]));

@ -42,7 +42,7 @@ public class ymageBMPParser {
public static int INFOHEADER_size = 40;
// compression tags
private static int BI_RGB = 0;
static int BI_RGB = 0;
//private static int BI_RLE8 = 1;
//private static int BI_RLE4 = 2;
//private static int BI_BITFIELDS = 3;

@ -0,0 +1,38 @@
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class screenshot {
/*
try {
Robot robot = new Robot();
Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage bufferedImage = robot.createScreenCapture(area);
} catch (AWTException e) {
}
*/
public static void main(String[] args) throws Exception {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
Rectangle screenRect = new Rectangle(screenSize);
// create screen shot
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(screenRect);
String outFileName = "test.png";
// save captured image to PNG file
ImageIO.write(image, "png", new File(outFileName));
// give feedback
System.out.println("Saved screen shot (" + image.getWidth() + " x " + image.getHeight() + " pixels) to file \"" + outFileName + "\".");
}
}
Loading…
Cancel
Save