当前位置: 首页>>代码示例>>Java>>正文


Java GeneratorStatistics类代码示例

本文整理汇总了Java中org.easyrec.plugin.stats.GeneratorStatistics的典型用法代码示例。如果您正苦于以下问题:Java GeneratorStatistics类的具体用法?Java GeneratorStatistics怎么用?Java GeneratorStatistics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GeneratorStatistics类属于org.easyrec.plugin.stats包,在下文中一共展示了GeneratorStatistics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateSimilarity

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public void calculateSimilarity(final Integer tenantId, final Integer actionTypeId, final Integer itemTypeId,
                                final Integer assocTypeId, final Integer viewTypeId, final Integer sourceTypeId,
                                final Date changeDate, final GeneratorStatistics stats,
                                final ExecutablePluginSupport.ExecutionControl control) {
    validateStrategies();

    if (logger.isInfoEnabled()) logger.info("Starting similarity computation.");

    Date start = new Date();

    int assocsCreated = similarityCalculationStrategy
            .calculateSimilarity(tenantId, actionTypeId, itemTypeId, assocTypeId, sourceTypeId, viewTypeId,
                    changeDate, control);
    stats.setNumberOfRulesCreated(assocsCreated);

    Date end = new Date();
    double time = (end.getTime() - start.getTime()) / 1000L;

    if (logger.isInfoEnabled())
        logger.info(String.format("Calculating USER-ITEM predictions for %d took %.2f seconds", tenantId, time));
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:ItemItemServiceImpl.java

示例2: installGenerator

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
private void installGenerator(final URI pluginId, final Version version, final PluginVO plugin,
                              final ClassPathXmlApplicationContext cax,
                              final Generator<GeneratorConfiguration, GeneratorStatistics> generator) {
    cax.getAutowireCapableBeanFactory()
            .autowireBeanProperties(generator, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);

    if (generator.getConfiguration() == null) {
        GeneratorConfiguration generatorConfiguration = generator.newConfiguration();
        generator.setConfiguration(generatorConfiguration);
    }

    if (LifecyclePhase.NOT_INSTALLED.toString().equals(plugin.getState()))
        generator.install(true);
    else
        generator.install(false);

    pluginDAO.updatePluginState(pluginId, version, LifecyclePhase.INSTALLED.toString());

    generator.initialize();
    generators.put(generator.getId(), generator);
    contexts.put(generator.getId(), cax);
    logger.info("registered plugin " + generator.getSourceType());
    pluginDAO.updatePluginState(pluginId, version, LifecyclePhase.INITIALIZED.toString());
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:25,代码来源:PluginRegistry.java

示例3: unmarshalStatistics

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
private static GeneratorStatistics unmarshalStatistics(String pluginIdAndVersion, String statisticsString,
                                                       PluginRegistry pluginRegistry) {
    try {
        Generator<?, ?> generator = Preconditions.checkNotNull(
                pluginRegistry.getGenerators().get(PluginId.parsePluginId(pluginIdAndVersion)));

        StringReader xmlRepresentation = new StringReader(statisticsString);
        StreamSource streamSource = new StreamSource(xmlRepresentation);
        JAXBContext jaxbContext =
                JAXBContext.newInstance(generator.getStatisticsClass(),
                        StatisticsConstants.STATS_MARSHAL_FAILED.getClass(),
                        StatisticsConstants.STATS_FORCED_END.getClass(),
                        StatisticsConstants.STATS_UNMARSHAL_FAILED.getClass(),
                        StatisticsConstants.STATS_EXECUTION_FAILED.getClass());
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

        JAXBElement<? extends GeneratorStatistics> jaxbElement =
                unmarshaller.unmarshal(streamSource, generator.getStatisticsClass());

        return jaxbElement.getValue();
    } catch (Exception e) {
        logger.warn("Unable to unmarshal configuration");
        return StatisticsConstants.STATS_UNMARSHAL_FAILED;
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:26,代码来源:LogEntryDAOMysqlImpl.java

示例4: makeARMConfiguration

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
private void makeARMConfiguration(Generator<GeneratorConfiguration, GeneratorStatistics> generator, int tenantId,
                                  String assocType, int assocTypeId, String actionType) {
    GeneratorConfiguration generatorConfiguration = generator.newConfiguration();
    generatorConfiguration.setAssociationType(assocType);

    try {
        Field actionTypeField = generatorConfiguration.getClass().getDeclaredField("actionType");
        actionTypeField.setAccessible(true);
        actionTypeField.set(generatorConfiguration, actionType);
    } catch (Exception e) {
        logger.warn("Failed to set action type on ARM config", e);
    }

    NamedConfiguration namedConfiguration = new NamedConfiguration(tenantId, assocTypeId,
            new PluginId("http://www.easyrec.org/plugins/ARM", easyrecSettings.getVersion()),
            "Default Configuration", generatorConfiguration, true);

    namedConfigurationDAO.createConfiguration(namedConfiguration);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:20,代码来源:NamedConfigurationServiceImpl.java

示例5: runGeneratorsForTenant

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public List<LogEntry> runGeneratorsForTenant(int tenantId, Predicate<GeneratorStatistics> writeLog,
                                             boolean writeLogLast) {
    Map<String, Integer> assocTypes = assocTypeDAO.getMapping(tenantId);
    List<LogEntry> result = Lists.newArrayList();

    for (Integer assocTypeId : assocTypes.values()) {
        NamedConfiguration namedConfiguration = namedConfigurationDAO.readActiveConfiguration(tenantId,
                assocTypeId);

        if (namedConfiguration == null) continue;

        result.add(runGenerator(namedConfiguration, writeLog, writeLogLast));
    }

    return result;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:17,代码来源:GeneratorContainer.java

示例6: unmarshalStatistics

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
private static GeneratorStatistics unmarshalStatistics(String pluginIdAndVersion, String statisticsString,
                                                       PluginRegistry pluginRegistry) {
    try {
        Generator<?, ?> generator = Preconditions.checkNotNull(
                pluginRegistry.getGenerators().get(PluginId.parsePluginId(pluginIdAndVersion)));

        StringReader xmlRepresentation = new StringReader(statisticsString);
        StreamSource streamSource = new StreamSource(xmlRepresentation);
        JAXBContext jaxbContext =
                JAXBContext.newInstance(generator.getStatisticsClass(),
                        StatisticsConstants.STATS_MARSHAL_FAILED.getClass(),
                        StatisticsConstants.STATS_FORCED_END.getClass(),
                        StatisticsConstants.STATS_UNMARSHAL_FAILED.getClass(),
                        StatisticsConstants.STATS_EXECUTION_FAILED.getClass());
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

        JAXBElement<? extends GeneratorStatistics> jaxbElement =
                unmarshaller.unmarshal(streamSource, generator.getStatisticsClass());

        return jaxbElement.getValue();
    } catch (Exception e) {
        logger.warn("Unable to unmarshal configuration", e);
        return StatisticsConstants.STATS_UNMARSHAL_FAILED;
    }
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:26,代码来源:LogEntryDAOMysqlImpl.java

示例7: runGeneratorsForTenant

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public List<LogEntry> runGeneratorsForTenant(int tenantId, Predicate<GeneratorStatistics> writeLog,
                                             boolean writeLogLast, boolean forceRun) {

    List<NamedConfiguration> configurations = namedConfigurationDAO.readActiveConfigurations(tenantId);
    List<LogEntry> result = Lists.newArrayList();

    for (NamedConfiguration namedConfiguration : configurations) {
        if (namedConfiguration == null) continue;

        LogEntry le = runGenerator(namedConfiguration, writeLog, writeLogLast, forceRun);
        if (le != null) result.add(le);
    }

    return result;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:GeneratorContainer.java

示例8: PluginRegistry

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public PluginRegistry(Resource pluginFolder, PluginDAO pluginDAO, ItemAssocDAO itemAssocDAO,
                      TenantService tenantService, TypeMappingService typeMappingService,
                      Map<PluginId, Generator<GeneratorConfiguration, GeneratorStatistics>> generators) {
    this.pluginFolder = pluginFolder;
    this.pluginDAO = pluginDAO;
    this.itemAssocDAO = itemAssocDAO;
    this.tenantService = tenantService;
    this.typeMappingService = typeMappingService;
    this.generators = generators;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:11,代码来源:PluginRegistry.java

示例9: getPluginDescription

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public String getPluginDescription(URI pluginId, Version version) {
    PluginId key = new PluginId(pluginId, version);
    Generator<GeneratorConfiguration, GeneratorStatistics> generator = generators.get(key);

    if (generator != null)
        return generator.getPluginDescription();

    return "";
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:10,代码来源:PluginRegistry.java

示例10: deletePlugin

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
@SuppressWarnings({"UnusedDeclaration"})
public void deletePlugin(URI pluginId, Version version) {
    PluginId key = new PluginId(pluginId, version);
    Generator<GeneratorConfiguration, GeneratorStatistics> generator = generators.get(key);

    if ((generator != null) && (LifecyclePhase.INITIALIZED.equals(generator.getLifecyclePhase())))
        deactivatePlugin(pluginId, version);

    pluginDAO.deletePlugin(pluginId, version);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:11,代码来源:PluginRegistry.java

示例11: isAllExecutablesStopped

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public boolean isAllExecutablesStopped() {
    for (Generator<GeneratorConfiguration, GeneratorStatistics> executable : this.generators.values()) {
        ExecutionState state = executable.getExecutionState();

        if (state.isRunning() || state.isAbortRequested()) return false;
    }

    return true;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:10,代码来源:PluginRegistry.java

示例12: LogEntry

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public LogEntry(int id, int tenantId, PluginId pluginId, Date startDate, Date endDate,
                int assocTypeId, GeneratorConfiguration configuration, GeneratorStatistics statistics) {
    this.id = id;
    this.tenantId = tenantId;
    this.pluginId = pluginId;
    this.startDate = startDate;
    this.endDate = endDate;
    this.assocTypeId = assocTypeId;
    this.configuration = configuration;
    this.statistics = statistics;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:12,代码来源:LogEntry.java

示例13: setUp

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() {
    waitingGenerator = new WaitingGenerator();

    pluginRegistry.getGenerators().put(waitingGenerator.getId(),
            // fu generics ...
            (Generator<GeneratorConfiguration, GeneratorStatistics>)
                    (Generator<? extends GeneratorConfiguration, ? extends GeneratorStatistics>) waitingGenerator);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:11,代码来源:NamedConfigurationDAOMysqlImplTest.java

示例14: pluginstop

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
public ModelAndView pluginstop(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
    String key = ServletUtils.getSafeParameter(request, "key", "");
    String value = ServletUtils.getSafeParameter(request, "value", "");
    String enabled = ServletUtils.getSafeParameter(request, "enabled", "");
    String executiontime = ServletUtils.getSafeParameter(request, "executiontime", "");
    String archiving = ServletUtils.getSafeParameter(request, "archiving", "");
    String archivingtime = ServletUtils.getSafeParameter(request, "archivingtime", "");
    String backtracking = ServletUtils.getSafeParameter(request, "backtracking", "");
    String maxactions = ServletUtils.getSafeParameter(request, "maxactions", "");
    String pluginsactive = ServletUtils.getSafeParameter(request, "pluginsactive", "");

    int siteNumber = ServletUtils.getSafeParameter(request, "siteNumber", 0);

    ModelAndView mav = new ModelAndView("page");

    mav.addObject("title", "easyrec :: administration");

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenantId", tenantId);

    if (Security.isDeveloper(request)) {
        mav.setViewName("dev/page");
        mav.addObject("page", "plugins");
        String pluginId = ServletUtils.getSafeParameter(request, "pluginId", "");
        String versionStr = ServletUtils.getSafeParameter(request, "version", "");
        PluginId pluginIdToStop = new PluginId(pluginId, versionStr);

        Map<PluginId, Generator<GeneratorConfiguration, GeneratorStatistics>> generators = this.pluginRegistry
                .getGenerators();
        Generator<GeneratorConfiguration, GeneratorStatistics> generator = generators.get(pluginIdToStop);
        generator.abort();

        return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, "pluginstop", MSG.SUCCESS, "");
    } else {
        return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, PLUGIN_STOP, MSG.ERROR);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:40,代码来源:PluginsController.java

示例15: setupDefaultConfiguration

import org.easyrec.plugin.stats.GeneratorStatistics; //导入依赖的package包/类
@Override
    public void setupDefaultConfiguration(int tenantId) {
        PluginId armPluginId = new PluginId("http://www.easyrec.org/plugins/ARM", easyrecSettings.getVersion());
        Generator<GeneratorConfiguration, GeneratorStatistics> generator =
                pluginRegistry.getGenerators().get(armPluginId);

        sourceTypeDAO.insertOrUpdate(tenantId, armPluginId.toString());

        makeARMConfiguration(generator, tenantId, "VIEWED_TOGETHER", 1, "VIEW");
        makeARMConfiguration(generator, tenantId, "GOOD_RATED_TOGETHER", 2, "RATE");
        makeARMConfiguration(generator, tenantId, "BOUGHT_TOGETHER", 3, "BUY");

        PluginId slopeOnePluginId =
                new PluginId("http://www.easyrec.org/plugins/slopeone", easyrecSettings.getVersion());
        sourceTypeDAO.insertOrUpdate(tenantId, slopeOnePluginId.toString());
        int isRelatedAssocTypeId = typeMappingService.getIdOfAssocType(tenantId, "IS_RELATED");
        createDefaultConfiguration(slopeOnePluginId, tenantId, isRelatedAssocTypeId);

//        PluginId profileDukePluginId =
//                new PluginId("http://www.easyrec.org/plugins/profileSimilarity", easyrecSettings.getVersion());
//        sourceTypeDAO.insertOrUpdate(tenantId, profileDukePluginId.toString());
//        int profileSimilarityAssocTypeId = typeMappingService.getIdOfAssocType(tenantId, "PROFILE_SIMILARITY");
//        createDefaultConfiguration(profileDukePluginId, tenantId, profileSimilarityAssocTypeId);
//
//        // deactivate the profileSimilarity plugin by default
//        namedConfigurationDAO.deactivateByPlugin(profileDukePluginId);

        generatorContainer.runGeneratorsForTenant(tenantId, true);

        remoteTenantService.updateTenantStatistics(tenantId);
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:32,代码来源:NamedConfigurationServiceImpl.java


注:本文中的org.easyrec.plugin.stats.GeneratorStatistics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。