Examples of Switchboard


Examples of de.anomic.search.Switchboard

    public static serverObjects respond(
            final RequestHeader header,
            final serverObjects post,
            final serverSwitch env) {
        final servletProperties prop = new servletProperties();
        final Switchboard sb = (Switchboard)env;
       
        // read post for handle
        final String handle = (post == null) ? "" : post.get("handle", "");
        if (post != null) {
            if (post.containsKey("terminate")) try {
View Full Code Here

Examples of de.anomic.search.Switchboard

        searchengines.put("OAIster@OCLC", "http://oaister.worldcat.org/search?q=");
        searchengines.put("oai.yacy.net", "http://oai.yacy.net/yacysearch.html?verify=true&resource=local&nav=all&display=2&meanCount=5&query=");
    }
   
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        final Switchboard sb = (Switchboard) env;
        final boolean authenticated = sb.adminAuthenticated(header) >= 2;
        final int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0);
        final servletProperties prop = new servletProperties();
       
        prop.put("display", display);
       
        String default_left = sb.getConfig("compare_yacy.left", defaultsearch);
        String default_right = sb.getConfig("compare_yacy.right", defaultsearch);
       
        if (post != null) {
            if (searchengines.get(post.get("left", default_left)) != null) {
                default_left = post.get("left", default_left);
                sb.setConfig("compare_yacy.left", default_left);
            }
            if (searchengines.get(post.get("right", default_right)) != null) {
                default_right = post.get("right", default_right);
                sb.setConfig("compare_yacy.right", default_right);
            }
        }
       
        prop.put("searchengines", order.length);
        String name;
View Full Code Here

Examples of de.anomic.search.Switchboard

public class suggest {
   
    private static final int meanMax = 30;
   
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        final Switchboard sb = (Switchboard) env;
        final servletProperties prop = new servletProperties();

        final String ext = header.get("EXT", "");
        final boolean json = ext.equals("json");
        final boolean xml = ext.equals("xml");
View Full Code Here

Examples of de.anomic.search.Switchboard

        } catch (final ConcurrentModificationException e) {}
        return accessClone;
    }
   
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        final Switchboard sb = (Switchboard) env;
    
        // return variable that accumulates replacements
        final serverObjects prop = new serverObjects();
        prop.setLocalized(!(header.get(HeaderFramework.CONNECTION_PROP_PATH)).endsWith(".xml"));
        int page = 0;
        if (post != null) {
            page = post.getInt("page", 0);
        }
        prop.put("page", page);
    
        final int maxCount = 1000;
        boolean dark = true;
        if (page == 0) {
            final Iterator<String> i = sb.accessHosts();
            String host;
            int entCount = 0;
            try {
                while ((entCount < maxCount) && (i.hasNext())) {
                    host = i.next();
                    prop.putHTML("page_list_" + entCount + "_host", host);
                    prop.putNum("page_list_" + entCount + "_countSecond", sb.latestAccessCount(host, 1000));
                    prop.putNum("page_list_" + entCount + "_countMinute", sb.latestAccessCount(host, 1000 * 60));
                    prop.putNum("page_list_" + entCount + "_count10Minutes", sb.latestAccessCount(host, 1000 * 60 * 10));
                    prop.putNum("page_list_" + entCount + "_countHour", sb.latestAccessCount(host, 1000 * 60 * 60));
                    entCount++;
                }
            } catch (final ConcurrentModificationException e) {} // we don't want to synchronize this
            prop.put("page_list", entCount);
            prop.put("page_num", entCount);
           
            entCount = 0;
            try {
                for (final Map.Entry<String, Integer> bfe: serverCore.bfHost.entrySet()) {
                    prop.putHTML("page_bflist_" + entCount + "_host", bfe.getKey());
                    prop.putNum("page_bflist_" + entCount + "_countSecond", bfe.getValue());
                    entCount++;
                }
            } catch (final ConcurrentModificationException e) {} // we dont want to synchronize this
            prop.put("page_bflist", entCount);
        } else if (page == 1) {
            String host = (post == null) ? "" : post.get("host", "");
            int entCount = 0;
            Collection<Track> access;
            Track entry;
            if (host.length() > 0) {
                access = sb.accessTrack(host);
                if (access != null) {
                    try {
                        final Iterator<Track> ii = listclone(access).iterator();
                        while (ii.hasNext()) {
                            entry = ii.next();
                            prop.putHTML("page_list_" + entCount + "_host", host);
                            prop.put("page_list_" + entCount + "_date", SimpleFormatter.format(new Date(entry.getTime())));
                            prop.putHTML("page_list_" + entCount + "_path", entry.getPath());
                            entCount++;
                        }
                    } catch (final ConcurrentModificationException e) {} // we don't want to synchronize this
                }
            } else {
                try {
                    final Iterator<String> i = sb.accessHosts();
                    while ((entCount < maxCount) && (i.hasNext())) {
                        host = i.next();
                        access = sb.accessTrack(host);
                        final Iterator<Track> ii = listclone(access).iterator();
                        while (ii.hasNext()) {
                                entry = ii.next();
                                prop.putHTML("page_list_" + entCount + "_host", host);
                                prop.put("page_list_" + entCount + "_date", SimpleFormatter.format(new Date(entry.getTime())));
View Full Code Here

Examples of de.anomic.search.Switchboard


public class addTag_p {
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {

        final Switchboard switchboard = (Switchboard) env;
        final serverObjects prop = new serverObjects();
        boolean isAdmin = false;
        isAdmin = switchboard.verifyAuthentication(header, true);
       
        prop.put("result", "0");//error
        //rename tags
        if(post != null && isAdmin) {
          if (post.containsKey("selectTag") && post.containsKey("addTag")) {
View Full Code Here

Examples of de.anomic.search.Switchboard

import de.anomic.server.serverSwitch;

public class editTag_p {
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
       
        final Switchboard switchboard = (Switchboard) env;           
        final serverObjects prop = new serverObjects();
        boolean isAdmin = false;
        isAdmin = switchboard.verifyAuthentication(header, true);
       
        prop.put("result", "0");//error
        //rename tags
        if(post != null && isAdmin && post.containsKey("old") && post.containsKey("new")){
            if(switchboard.bookmarksDB.renameTag(post.get("old"), post.get("new")))
View Full Code Here

Examples of de.anomic.search.Switchboard

  final static int SORT_SIZE = 2;
  final static int SHOW_ALL = -1;
 
  public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        // return variable that accumulates replacements
        final Switchboard switchboard = (Switchboard) env;
        final boolean isAdmin = switchboard.verifyAuthentication(header, true);
        final serverObjects prop = new serverObjects();
        Iterator<BookmarksDB.Tag> it = null;
        String tagName = "";
        int top = SHOW_ALL;
        int comp = SORT_ALPHA;
View Full Code Here

Examples of de.anomic.search.Switchboard

public final class Connections_p {   
   
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
        // return variable that accumulates replacements
        final Switchboard sb = (Switchboard) env;
        final serverObjects prop = new serverObjects();

        // server sessions
        // get the serverCore thread
        final WorkflowThread httpd = sb.getThread("10_httpd");
       
        // determines if name lookup should be done or not
        final boolean doNameLookup;
        if (post != null) { 
            doNameLookup = (post.containsKey("nameLookup") && post.getBoolean("nameLookup", true));
            if (post.containsKey("closeServerSession")) {
                final String sessionName = post.get("closeServerSession", null);
                sb.closeSessions("10_httpd", sessionName);
                prop.put("LOCATION","");
                return prop;               
            }
        } else {
            doNameLookup = false;
View Full Code Here

Examples of de.anomic.search.Switchboard

   
    public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch ss) {
        if (post == null || ss == null) { return null; }

        // return variable that accumulates replacements
        final Switchboard sb = (Switchboard) ss;
        final serverObjects prop = new serverObjects();

        prop.put("magic", yacyCore.magic);
       
        if ((post == null) || (ss == null) || !yacyNetwork.authentifyRequest(post, ss)) {
            prop.put("response", "-1"); // request rejected
            return prop;
        }
       
        if ((sb.isRobinsonMode()) &&
            (!sb.isPublicRobinson()) &&
            (!sb.isInMyCluster(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)))) {
          // if we are a robinson cluster, answer only if we are public robinson peers,
          // or we are a private cluster and the requester is in our cluster.
            // if we don't answer, the remote peer will recognize us as junior peer,
            // what would mean that our peer ping does not work
          prop.put("response", "-1"); // request rejected
View Full Code Here

Examples of de.anomic.search.Switchboard

        prop.put("rowdef","");
        prop.put("name","");
        if (post == null || env == null) return prop;

        // return variable that accumulates replacements
        final Switchboard sb = (Switchboard) env;
       
        if (sb.adminAuthenticated(header) < 2 && !yacyNetwork.authentifyRequest(post, env)) {
            return prop;
        }
       
        if (post.get("object", "").equals("host")) {
            prop.put("name","host");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.