⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webapp.java

📁 用来为垂直搜索引擎抓取数据的采集系统
💻 JAVA
字号:
/*
 * *****************************************************
 * Copyright (c) 2005 IIM Lab. All  Rights Reserved.
 * Created by xuehao at 2005-10-12
 * Contact: zxuehao@mail.ustc.edu.cn
 * *****************************************************
 */
package org.indigo.application;

import java.io.File;
import java.util.List;

import org.indigo.commands.Command;
import org.indigo.commands.CompositeCommand;
import org.indigo.commands.RawCommand;
import org.indigo.log.FileLoggerParam;
import org.indigo.spider.Spider;
import org.indigo.spider.ThreadPool;
import org.indigo.util.TaskProperties;
import org.indigo.util.TaskListReader;
/**
 * 控制台应用程序。
 * @author wbz
 *
 */
public class WebApp
{
    public WebApp()
    {
        String taskName=null;
        List tasks = TaskListReader.getTaskList();

        for( int i=0; i<tasks.size(); i++ )
        {
            String str=null;
            taskName = (String) tasks.get( i );
            
            File file = new File( taskName );
            if( !file.exists() )
            {
                str = "TaskFile: " + taskName + " doesnot exists!";
                FileLoggerParam.getInstance().warning( str );
                continue ;
            }else
            {
            }
            
	        Command cmd = null;
	        TaskProperties props = new TaskProperties();
	        props.open( taskName );
	        str = props.getProperty( "Nested" );
	        boolean bComp=false;
	        if( str==null )
	            bComp = false;
	        else
	        if(  str.equalsIgnoreCase("true") || str.equals("") )
	            bComp = true;
	        else
	            bComp = false;
	        
	        if( !bComp )
	        {
//	            System.out.println( "will create raw command "+taskName );
	            file = new File( taskName );
	            if( !file.exists() )
	            {
	                str = "TaskFile: " + taskName + " doesnot exists!";
	                FileLoggerParam.getInstance().warning( str );
	                continue ;
	            }else
	            {
		            cmd = new RawCommand( taskName, false, true );
	            }
	        }else
	        {
//	            System.out.println( "will create composite command "+taskName );
	            file = new File( taskName );
	            if( !file.exists() )
	            {
	                str = "TaskFile: " + taskName + " doesnot exists!";
	                FileLoggerParam.getInstance().warning( str );
	                continue ;
	            }else
	            {
	                cmd = new CompositeCommand( taskName, false, true );
	            }
	        }
	        
//	        str = "Add Command " + cmd.getTaskName();
//	        FileLogger.getInstance().info( str );

//	        (new Spider(cmd)).start();
	        ThreadPool.getInstance().execute( new Spider(cmd) );
        }
        

    }
    public static void main(String[] args)
    {
       
        WebApp app = new WebApp();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -