Search in sources :

Example 1 with EcReptileEngineBeanClassDTO

use of com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO in project dq-easy-cloud by dq-open-cloud.

the class EcReptileDynamicBeanServiceImpl method reptileData.

@Override
public EcBaseServiceResult reptileData(EcReptileDataDTO reptileDataDTO) {
    EcReptileEngineBeanClassDTO reptileEngineBeanClassDTOFromCache = EcReptileConfig.getReptileEngineBeanClassDTO();
    EcAssert.verifyObjNull(reptileEngineBeanClassDTOFromCache, "缓存reptileEngineBeanClassDTOFromCache");
    EcReptileDynamicBeanDTO dynamicBeanDTO = reptileEngineBeanClassDTOFromCache.getReptileDynamicBeanDTO();
    // 获取爬虫引擎
    GeccoEngine geccoEngine = reptileEngineBeanClassDTOFromCache.getGeccoEngine();
    EcAssert.verifyDataNotExistent(geccoEngine, "缓存中geccoEngine");
    EcReptileUtils.intoScheduler(geccoEngine, dynamicBeanDTO, reptileDataDTO);
    return EcBaseServiceResult.newInstanceOfSuccess();
}
Also used : GeccoEngine(com.geccocrawler.gecco.GeccoEngine) EcReptileEngineBeanClassDTO(com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO) EcReptileDynamicBeanDTO(com.easy.cloud.core.reptile.dynamicbean.pojo.dto.EcReptileDynamicBeanDTO)

Example 2 with EcReptileEngineBeanClassDTO

use of com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO in project dq-easy-cloud by dq-open-cloud.

the class EcReptileConfig method loadReptileEngineBeanClassDTO.

/**
 * <p>
 * 将EcReptileEngineBeanClassDTO对象add到缓存
 * </p>
 *
 * @param reptileDynamicBeanDTO
 * @param geccoEngine
 * @author daiqi
 * @创建时间 2018年6月11日 上午10:24:09
 */
public static synchronized void loadReptileEngineBeanClassDTO(EcReptileDynamicBeanDTO reptileDynamicBeanDTO, GeccoEngine geccoEngine) {
    EcAssert.verifyObjNull(reptileDynamicBeanDTO, "reptileDynamicBeanDTO");
    EcAssert.verifyObjNull(geccoEngine, "geccoEngine");
    EcReptileEngineBeanClassDTO reptileEngineBeanClassDTO = EcReptileEngineBeanClassDTO.getInstance();
    reptileEngineBeanClassDTO.setReptileDynamicBeanDTO(reptileDynamicBeanDTO);
    reptileEngineBeanClassDTO.setGeccoEngine(geccoEngine);
}
Also used : EcReptileEngineBeanClassDTO(com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO)

Example 3 with EcReptileEngineBeanClassDTO

use of com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO in project dq-easy-cloud by dq-open-cloud.

the class EcReptileUtils method unLoadReptileRuleClass.

/**
 * <p>
 * 从引擎中下线相关规则
 * </p>
 *
 * @return void
 * @author daiqi
 * @date 2018/6/12 17:04
 */
public static synchronized void unLoadReptileRuleClass() {
    EcReptileEngineBeanClassDTO reptileEngineBeanClassDTO = EcReptileConfig.getReptileEngineBeanClassDTO();
    for (JavassistDynamicBean javassistDynamicBean : reptileEngineBeanClassDTO.getJavassistDynamicBeans()) {
        javassistDynamicBean.unloadClass();
    }
    reptileEngineBeanClassDTO.clearJavassistDynamicBeans();
    reptileEngineBeanClassDTO.clearRuleBeanClazzs();
}
Also used : JavassistDynamicBean(com.geccocrawler.gecco.dynamic.JavassistDynamicBean) EcReptileEngineBeanClassDTO(com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO)

Aggregations

EcReptileEngineBeanClassDTO (com.easy.cloud.core.reptile.engine.pojo.dto.EcReptileEngineBeanClassDTO)3 EcReptileDynamicBeanDTO (com.easy.cloud.core.reptile.dynamicbean.pojo.dto.EcReptileDynamicBeanDTO)1 GeccoEngine (com.geccocrawler.gecco.GeccoEngine)1 JavassistDynamicBean (com.geccocrawler.gecco.dynamic.JavassistDynamicBean)1