Merge branch 'master' of ssh://git@gitorious.org/yacy/rc1.git

pull/1/head
Michael Peter Christen 12 years ago
commit 24f4ca4d85

@ -42,6 +42,7 @@ import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.Domains; import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.kelondro.util.MapTools; import net.yacy.kelondro.util.MapTools;
import net.yacy.peers.NewsDB; import net.yacy.peers.NewsDB;
import net.yacy.peers.NewsPool; import net.yacy.peers.NewsPool;
@ -53,6 +54,7 @@ import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants; import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverObjects; import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch; import net.yacy.server.serverSwitch;
import net.yacy.server.servletProperties;
public class Network { public class Network {
@ -62,7 +64,9 @@ public class Network {
final Switchboard sb = (Switchboard) switchboard; final Switchboard sb = (Switchboard) switchboard;
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
final serverObjects prop = new serverObjects(); // final serverObjects prop = new serverObjects();
final servletProperties prop = new servletProperties();
prop.put("menu", post == null ? 2 : (post.get("menu", "").equals("embed")) ? 0 : (post.get("menu","").equals("simple")) ? 1 : 2); prop.put("menu", post == null ? 2 : (post.get("menu", "").equals("embed")) ? 0 : (post.get("menu","").equals("simple")) ? 1 : 2);
if (sb.peers.mySeed() != null) prop.put("menu_newpeer_peerhash", sb.peers.mySeed().hash); if (sb.peers.mySeed() != null) prop.put("menu_newpeer_peerhash", sb.peers.mySeed().hash);
@ -477,6 +481,14 @@ public class Network {
prop.putNum("table_rt", System.currentTimeMillis() - start); prop.putNum("table_rt", System.currentTimeMillis() - start);
// Adding CORS Access header for Network.xml
final String path = requestHeader.get(HeaderFramework.CONNECTION_PROP_PATH);
if(path != null && path.endsWith(".xml")) {
final ResponseHeader outgoingHeader = new ResponseHeader(200);
outgoingHeader.put(HeaderFramework.CORS_ALLOW_ORIGIN, "*");
prop.setOutgoingHeader(outgoingHeader);
}
// return rewrite properties // return rewrite properties
return prop; return prop;
} }

@ -47,6 +47,7 @@ import net.yacy.cora.util.SpaceExceededException;
import net.yacy.data.WorkTables; import net.yacy.data.WorkTables;
import net.yacy.document.Document; import net.yacy.document.Document;
import net.yacy.document.Parser.Failure; import net.yacy.document.Parser.Failure;
import net.yacy.kelondro.blob.TableColumnIndexException;
import net.yacy.kelondro.blob.Tables; import net.yacy.kelondro.blob.Tables;
import net.yacy.kelondro.blob.Tables.Row; import net.yacy.kelondro.blob.Tables.Row;
import net.yacy.kelondro.blob.TablesColumnIndex; import net.yacy.kelondro.blob.TablesColumnIndex;
@ -149,8 +150,8 @@ public class YMarkTables {
} }
} catch (IOException e) { } catch (IOException e) {
Log.logException(e); Log.logException(e);
} catch (Exception e) { } catch (TableColumnIndexException e) {
Log.logException(e); // currently nothing to do...
} }
} }
} }
@ -166,8 +167,8 @@ public class YMarkTables {
if(this.worktables.hasIndex(bmk_table, YMarkEntry.BOOKMARK.FOLDERS.key())) { if(this.worktables.hasIndex(bmk_table, YMarkEntry.BOOKMARK.FOLDERS.key())) {
try { try {
this.worktables.getIndex(bmk_table).delete(urlHash); this.worktables.getIndex(bmk_table).delete(urlHash);
} catch (Exception e) { } catch (TableColumnIndexException e) {
// nothing to do // currently nothing to do...
} }
} }
} }

@ -0,0 +1,13 @@
package net.yacy.kelondro.blob;
public class TableColumnIndexException extends Exception {
private static final long serialVersionUID = 2397828995935783296L;
public TableColumnIndexException() {
}
public TableColumnIndexException(String msg) {
super(msg);
}
}

@ -96,7 +96,7 @@ public class Tables implements Iterable<String> {
this.cidx = new ConcurrentHashMap<String, TablesColumnIndex>(); this.cidx = new ConcurrentHashMap<String, TablesColumnIndex>();
} }
public TablesColumnIndex getIndex(final String tableName, TablesColumnIndex.INDEXTYPE indexType) throws Exception { public TablesColumnIndex getIndex(final String tableName, TablesColumnIndex.INDEXTYPE indexType) throws TableColumnIndexException, IOException {
final TablesColumnIndex index; final TablesColumnIndex index;
switch(indexType) { switch(indexType) {
case RAM: case RAM:
@ -109,12 +109,12 @@ public class Tables implements Iterable<String> {
index = new TablesColumnBLOBIndex(bheap); index = new TablesColumnBLOBIndex(bheap);
break; break;
default: default:
throw new Exception("Unsupported TableColumnIndex: "+indexType.name()); throw new TableColumnIndexException("Unsupported TableColumnIndex: "+indexType.name());
} }
return index; return index;
} }
public TablesColumnIndex getIndex(final String tableName) throws Exception { public TablesColumnIndex getIndex(final String tableName) throws TableColumnIndexException {
// return an existing index // return an existing index
if(this.cidx.containsKey(tableName)) { if(this.cidx.containsKey(tableName)) {
return this.cidx.get(tableName); return this.cidx.get(tableName);
@ -131,7 +131,7 @@ public class Tables implements Iterable<String> {
final TablesColumnIndex index; final TablesColumnIndex index;
if(size < NOINDEX) { if(size < NOINDEX) {
throw new RuntimeException("TableColumnIndex not available for tables with less than "+NOINDEX+" rows: "+tableName); throw new TableColumnIndexException("TableColumnIndex not available for tables with less than "+NOINDEX+" rows: "+tableName);
} }
if(size < RAMINDEX) { if(size < RAMINDEX) {
index = new TablesColumnRAMIndex(); index = new TablesColumnRAMIndex();

Loading…
Cancel
Save