當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。