Package net.yacy.peers

Examples of net.yacy.peers.Seed


            // open an editor page for the message
            // first ask if the other peer is online, and also what kind of document it accepts
            final Map<String, String> result = Protocol.permissionMessage(sb.peers, hash);
            //System.out.println("DEBUG: permission request result = " + result.toString());
            String peerName;
            Seed targetPeer = null;
            if (hash.equals(sb.peers.mySeed().hash)) {
                peerName = sb.peers.mySeed().get(Seed.NAME,"nameless");
            } else {
                targetPeer = sb.peers.getConnected(hash);
                if (targetPeer == null)
                    peerName = "nameless";
                else
                    peerName = targetPeer.get(Seed.NAME,"nameless");
            }

            prop.putXML("mode_permission_peerName", peerName);
            final String response = (result == null) ? null : result.get("response");
            if (response == null || result == null) {
View Full Code Here


        final String col = post.get("col", "");
        final File listsPath = env.getDataPath(SwitchboardConstants.LISTS_PATH, SwitchboardConstants.LISTS_PATH_DEFAULT);

        String otherPeerName = null;
        if (post.containsKey("iam")) {
            final Seed bla = sb.peers.get(post.get("iam", ""));
            if (bla != null) otherPeerName = bla.getName();
        }
        if (otherPeerName == null) otherPeerName = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP);

        if ((sb.isRobinsonMode()) && (!sb.isInMyCluster(otherPeerName))) {
            // if we are a robinson cluster, answer only if this client is known by our network definition
View Full Code Here

                prop.put("page_list_" + m + "_qph", qph);
               
                prop.put("page_list_" + m + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
                prop.putHTML("page_list_" + m + "_host", host);
                if (page == 5) {
                    final Seed remotepeer = sb.peers.lookupByIP(Domains.dnsResolve(host), true, true, true);
                    prop.putHTML("page_list_" + m + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());
                }
                prop.putNum("page_list_" + m + "_count", handles.size());

                // next
                m++;
View Full Code Here

            prop.put("loader-set", "0");
        } else {
            prop.put("loader-set", "1");
            boolean dark = true;
            final Request[] w = sb.crawlQueues.activeWorkerEntries();
            Seed initiator;
            int count = 0;
            for (int i = 0; i < w.length; i++)  {
                if (w[i] == null) continue;
               
                initiator = sb.peers.getConnected((w[i].initiator() == null) ? "" : ASCII.String(w[i].initiator()));
                prop.put("loader-set_list_"+count+"_dark", dark ? "1" : "0");
                prop.putHTML("loader-set_list_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
                prop.put("loader-set_list_"+count+"_depth", w[i].depth());
                prop.put("loader-set_list_"+count+"_status", w[i].getStatus());
                prop.putHTML("loader-set_list_"+count+"_url", w[i].url().toNormalform(true, false));
                dark = !dark;
                count++;
View Full Code Here

           
            if (sb.peers != null) {
                final int maxCount = Math.min(1000, sb.peers.newsPool.size(tableID));
                final Iterator<NewsDB.Record> recordIterator = sb.peers.newsPool.recordIterator(tableID, false);
                NewsDB.Record record;
                Seed seed;
                int i = 0;
                while ((recordIterator.hasNext()) && (i < maxCount)) {
                    record = recordIterator.next();
                    if (record == null) continue;
                   
                    seed = sb.peers.getConnected(record.originator());
                    if (seed == null) seed = sb.peers.getDisconnected(record.originator());
                    final String category = record.category();
                    prop.put("table_list_" + i + "_id", record.id());
                    prop.putHTML("table_list_" + i + "_ori", (seed == null) ? record.originator() : seed.getName());
                    prop.put("table_list_" + i + "_cre", GenericFormatter.SHORT_SECOND_FORMATTER.format(record.created()));
                    prop.put("table_list_" + i + "_crerfcdate", HeaderFramework.formatRFC1123(record.created()));
                    prop.putHTML("table_list_" + i + "_cat", category);
                    prop.put("table_list_" + i + "_rec", (record.received() == null) ? "-" : GenericFormatter.SHORT_SECOND_FORMATTER.format(record.received()));
                    prop.put("table_list_" + i + "_dis", record.distributed());
                   
                    final Map<String, String> attributeMap = record.attributes();
                    prop.putHTML("table_list_" + i + "_att", attributeMap.toString());
                    int j = 0;
                    if (!attributeMap.isEmpty()) {
                        for (final Entry<String, String> attribute: attributeMap.entrySet()) {
                            prop.put("table_list_" + i + "_attributes_" + j + "_name", attribute.getKey());
                            prop.putHTML("table_list_" + i + "_attributes_" + j + "_value", attribute.getValue());
                            j++;
                        }
                    }
                    prop.put("table_list_" + i + "_attributes", j);
                                       
                    // generating link / title / description (taken over from Surftips.java)
                    String link, title, description;
                    if (category.equals(NewsPool.CATEGORY_CRAWL_START)) {
                      link = record.attribute("startURL", "");
                      title = (record.attribute("intention", "").isEmpty()) ? link : record.attribute("intention", "");
                      description = "Crawl Start Point";
                    } else if (category.equals(NewsPool.CATEGORY_PROFILE_UPDATE)) {
                      link = record.attribute("homepage", "");
                      title = "Home Page of " + record.attribute("nickname", "");
                      description = "Profile Update";
                    } else if (category.equals(NewsPool.CATEGORY_BOOKMARK_ADD)) {
                      link = record.attribute("url", "");
                      title = record.attribute("title", "");
                      description = "Bookmark: " + record.attribute("description", "");
                    } else if (category.equals(NewsPool.CATEGORY_SURFTIPP_ADD)) {
                      link = record.attribute("url", "");
                      title = record.attribute("title", "");
                      description = "Surf Tipp: " + record.attribute("description", "");
                    } else if (category.equals(NewsPool.CATEGORY_SURFTIPP_VOTE_ADD)) {
                      link = record.attribute("url", "");
                      title = record.attribute("title", "");
                      description = record.attribute("url", "");
                    } else if (category.equals(NewsPool.CATEGORY_WIKI_UPDATE)) {
                      link = (seed == null)? "" : "http://" + seed.getPublicAddress() + "/Wiki.html?page=" + record.attribute("page", "");
                      title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");
                      description = "Wiki Update: " + record.attribute("description", "");
                    } else if (category.equals(NewsPool.CATEGORY_BLOG_ADD)) {
                      link = (seed == null)? "" : "http://" + seed.getPublicAddress() + "/Blog.html?page=" + record.attribute("page", "");
                      title = record.attribute("author", "Anonymous") + ": " + record.attribute("page", "");
                      description = "Blog Entry: " + record.attribute("subject", "");
                    } else {
                      link = "";            
                      title = "";
View Full Code Here

            prop.put("table_showIP",      (showIP) ? "1" : "0");
            prop.put("table_showURL",     (showURL) ? "1" : "0");

            boolean dark = true;
            String urlstr, urltxt;
            Seed initiatorSeed, executorSeed;
            URIMetadataRow urle;
            URIMetadataRow.Components metadata;

            int cnt = 0;
            final Iterator<Map.Entry<String, InitExecEntry>> i = ResultURLs.results(tabletype);
            Map.Entry<String, InitExecEntry> entry;
            while (i.hasNext()) {
                entry = i.next();
                try {
                    urle = sb.indexSegments.urlMetadata(Segments.Process.LOCALCRAWLING).load(UTF8.getBytes(entry.getKey()));
                    if (urle == null) {
                        Log.logWarning("PLASMA", "CrawlResults: URL not in index with url hash " + entry.getKey());
                        urlstr = null;
                        urltxt = null;
                        metadata = null;
                        continue;
                    }
                    metadata = urle.metadata();
                    urlstr = metadata.url().toNormalform(false, true);
                    urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL

                    initiatorSeed = entry.getValue() == null || entry.getValue().initiatorHash == null ? null : sb.peers.getConnected(ASCII.String(entry.getValue().initiatorHash));
                    executorSeed = entry.getValue() == null || entry.getValue().executorHash == null ? null : sb.peers.getConnected(ASCII.String(entry.getValue().executorHash));

                    prop.put("table_indexed_" + cnt + "_dark", (dark) ? "1" : "0");
                    prop.put("table_indexed_" + cnt + "_feedbackpage", "CrawlResults.html");
                    prop.put("table_indexed_" + cnt + "_tabletype", tabletype.getCode());
                    prop.put("table_indexed_" + cnt + "_urlhash", entry.getKey());

                    if (showInit) {
                        prop.put("table_indexed_" + cnt + "_showInit", "1");
                        prop.put("table_indexed_" + cnt + "_showInit_initiatorSeed", (initiatorSeed == null) ? "unknown" : initiatorSeed.getName());
                    } else
                        prop.put("table_indexed_" + cnt + "_showInit", "0");

                    if (showExec) {
                        prop.put("table_indexed_" + cnt + "_showExec", "1");
View Full Code Here

            prop.put("crawler-queue", "1");
            final List<Request> crawlerList = sb.crawlQueues.noticeURL.top(NoticedURL.StackType.LIMIT, showLimit);
           
            Request urle;
            boolean dark = true;
            Seed initiator;
            String profileHandle;
            CrawlProfile profileEntry;
            int i, showNum = 0;
            for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {
                urle = crawlerList.get(i);
                if (urle != null && urle.url() != null) {
                    initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : ASCII.String(urle.initiator()));
                    profileHandle = urle.profileHandle();
                    profileEntry = profileHandle == null ? null : sb.crawler.getActive(profileHandle.getBytes());
                    prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");
                    prop.putHTML("crawler-queue_list_"+showNum+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()) );
                    prop.put("crawler-queue_list_"+showNum+"_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));
                    prop.put("crawler-queue_list_"+showNum+"_depth", urle.depth());
                    prop.put("crawler-queue_list_"+showNum+"_modified", daydate(urle.appdate()) );
                    prop.putHTML("crawler-queue_list_"+showNum+"_anchor", urle.name());
                    prop.putHTML("crawler-queue_list_"+showNum+"_url", urle.url().toNormalform(false, true));
View Full Code Here

            prop.put("crawler-queue", "1");
            final List<Request> crawlerList = sb.crawlQueues.noticeURL.top(NoticedURL.StackType.CORE, (int) (showLimit * 1.20));

            Request urle;
            boolean dark = true;
            Seed initiator;
            String profileHandle;
            CrawlProfile profileEntry;
            int i;
            for (i = 0; (i < crawlerList.size()) && (showNum < showLimit); i++) {
                urle = crawlerList.get(i);
                if ((urle != null)&&(urle.url()!=null)) {
                    initiator = sb.peers.getConnected(urle.initiator() == null ? "" : ASCII.String(urle.initiator()));
                    profileHandle = urle.profileHandle();
                    profileEntry = profileHandle == null ? null : sb.crawler.getActive(profileHandle.getBytes());
                    prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");
                    prop.putHTML("crawler-queue_list_"+showNum+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()) );
                    prop.put("crawler-queue_list_"+showNum+"_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));
                    prop.put("crawler-queue_list_"+showNum+"_depth", urle.depth());
                    prop.put("crawler-queue_list_"+showNum+"_modified", daydate(urle.appdate()) );
                    prop.putHTML("crawler-queue_list_"+showNum+"_anchor", urle.name());
                    prop.putHTML("crawler-queue_list_"+showNum+"_url", urle.url().toNormalform(false, true));
View Full Code Here

        }
        if (segment == null) segment = sb.indexSegments.segment(Segments.Process.PUBLIC);
        prop.put("rejected", "0");
        //int showRejectedCount = 10;

        Seed initiator;

        // index size
        prop.putNum("urlpublictextSize", segment.urlMetadata().size());
        prop.putNum("rwipublictextSize", segment.termIndex().sizesMax());

        // loader queue
        prop.putNum("loaderSize", sb.crawlQueues.workerSize());
        prop.putNum("loaderMax", sb.getConfigLong(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10));
        if (sb.crawlQueues.workerSize() == 0) {
            prop.put("list-loader", "0");
        } else {
            final Request[] w = sb.crawlQueues.activeWorkerEntries();
            int count = 0;
            for (final Request r : w)  {
                if (r == null) continue;
                prop.put("list-loader_"+count+"_profile", r.profileHandle());
                initiator = sb.peers.getConnected((r.initiator() == null) ? "" : ASCII.String(r.initiator()));
                prop.putHTML("list-loader_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
                prop.put("list-loader_"+count+"_depth", r.depth());
                prop.putXML("list-loader_"+count+"_url", r.url().toString());
                count++;
            }
            prop.put("list-loader", count);
View Full Code Here


    public static final void addNTable(final Switchboard sb, final serverObjects prop, final String tableName, final List<Request> crawlerList) {

        int showNum = 0;
        Seed initiator;
        for (final Request urle : crawlerList) {
            if ((urle != null) && (urle.url() != null)) {
                initiator = sb.peers.getConnected((urle.initiator() == null) ? "" : UTF8.String(urle.initiator()));
                prop.put(tableName + "_" + showNum + "_profile", urle.profileHandle());
                prop.put(tableName + "_" + showNum + "_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
                prop.put(tableName + "_" + showNum + "_depth", urle.depth());
                prop.put(tableName + "_" + showNum + "_modified", daydate(urle.appdate()));
                prop.putXML(tableName + "_" + showNum + "_anchor", urle.name());
                prop.putXML(tableName + "_" + showNum + "_url", urle.url().toNormalform(false, true));
                prop.put(tableName + "_" + showNum + "_hash", urle.url().hash());
View Full Code Here

TOP

Related Classes of net.yacy.peers.Seed

Copyright © 2018 www.massapicom. 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.