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


Java Store类代码示例

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


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

示例1: execute

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
/**
 * Execute an operation with the store.
 *
 * This method enforces thread safety based on the store factory.
 *
 * @param storeOperation The store.
 * @param rootModule     The root module to use for store initialization.
 * @throws MojoExecutionException On execution errors.
 * @throws MojoFailureException   On execution failures.
 */
protected void execute(StoreOperation storeOperation, MavenProject rootModule, Set<MavenProject> executedModules) throws MojoExecutionException, MojoFailureException {
    if (skip) {
        getLog().info("Skipping execution.");
    } else {
        synchronized (storeFactory) {
            Store store = getStore(rootModule);
            if (isResetStoreBeforeExecution() && executedModules.isEmpty()) {
                store.reset();
            }
            try {
                storeOperation.run(rootModule, store);
            } finally {
                releaseStore(rootModule, store);
            }
        }
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:28,代码来源:AbstractMojo.java

示例2: aggregate

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
protected void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
    File file = ProjectResolver.getOutputFile(rootModule, exportFile, EXPORT_FILE);
    getLog().info("Exporting database to '" + file.getAbsolutePath() + "'");
    EmbeddedGraphStore graphStore = (EmbeddedGraphStore) store;
    store.beginTransaction();
    try {
        GraphDatabaseService databaseService = graphStore.getGraphDatabaseService();
        SubGraph graph = DatabaseSubGraph.from(databaseService);
        new SubGraphExporter(graph).export(new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")));
    } catch (IOException e) {
        throw new MojoExecutionException("Cannot export database.", e);
    } finally {
        store.commitTransaction();
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:17,代码来源:ExportDatabaseMojo.java

示例3: execute

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public void execute(MavenProject mavenProject, Store store) throws MojoExecutionException, MojoFailureException {
    ScannerConfiguration configuration = new ScannerConfiguration();
    configuration.setContinueOnError(continueOnError);
    ScannerContext scannerContext = new ScannerContextImpl(store);
    ScannerPluginRepository scannerPluginRepository = pluginRepositoryProvider.getScannerPluginRepository();
    Map<String, ScannerPlugin<?, ?>> scannerPlugins;
    try {
        scannerPlugins = scannerPluginRepository.getScannerPlugins(scannerContext, getPluginProperties());
    } catch (PluginRepositoryException e) {
        throw new MojoExecutionException("Cannot determine scanner plugins.", e);
    }
    ScopePluginRepository scopePluginRepository = pluginRepositoryProvider.getScopePluginRepository();
    Scanner scanner = new ScannerImpl(configuration, scannerContext, scannerPlugins, scopePluginRepository.getScopes());
    store.beginTransaction();
    try {
        scanner.scan(mavenProject, mavenProject.getFile().getAbsolutePath(), MavenScope.PROJECT);
    } finally {
        store.commitTransaction();
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:22,代码来源:ScanMojo.java

示例4: run

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public void run() throws CliExecutionException {
    List<Class<?>> descriptorTypes;
    final Store store = getStore();
    try {
        descriptorTypes = pluginRepository.getModelPluginRepository().getDescriptorTypes();
    } catch (PluginRepositoryException e) {
        throw new CliExecutionException("Cannot get model.", e);
    }
    ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(pluginRepository.getClassLoader());
    try {
        store.start(descriptorTypes);
        executeTask(store);
    } finally {
        store.stop();
        Thread.currentThread().setContextClassLoader(oldClassLoader);
    }
}
 
开发者ID:buschmais,项目名称:jqa-commandline-tool,代码行数:20,代码来源:AbstractTask.java

示例5: scan

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public ManifestFileDescriptor scan(FileResource item, String path, Scope scope, Scanner scanner) throws IOException {
    try (InputStream stream = item.createStream()) {
        Manifest manifest = new Manifest(stream);
        ScannerContext context = scanner.getContext();
        Store store = context.getStore();
        FileDescriptor fileDescriptor = context.getCurrentDescriptor();
        ManifestFileDescriptor manifestFileDescriptor = store.addDescriptorType(fileDescriptor, ManifestFileDescriptor.class);
        ManifestSectionDescriptor mainSectionDescriptor = store.create(ManifestSectionDescriptor.class);
        mainSectionDescriptor.setName(SECTION_MAIN);
        manifestFileDescriptor.setMainSection(mainSectionDescriptor);
        readSection(manifest.getMainAttributes(), mainSectionDescriptor, store);
        for (Map.Entry<String, Attributes> sectionEntry : manifest.getEntries().entrySet()) {
            ManifestSectionDescriptor sectionDescriptor = store.create(ManifestSectionDescriptor.class);
            sectionDescriptor.setName(sectionEntry.getKey());
            readSection(sectionEntry.getValue(), sectionDescriptor, store);
            manifestFileDescriptor.getManifestSections().add(sectionDescriptor);
        }
        return manifestFileDescriptor;
    }
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:22,代码来源:ManifestFileScannerPlugin.java

示例6: scan

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public PropertyFileDescriptor scan(FileResource item, String path, Scope scope, Scanner scanner) throws IOException {
    ScannerContext context = scanner.getContext();
    Store store = context.getStore();
    FileDescriptor fileDescriptor = context.getCurrentDescriptor();
    PropertyFileDescriptor propertyFileDescriptor = store.addDescriptorType(fileDescriptor, PropertyFileDescriptor.class);
    Properties properties = new Properties();
    try (InputStream stream = item.createStream()) {
        properties.load(stream);
    } catch (IllegalArgumentException e) {
        LOGGER.warn("Cannot load properties from '" + path + "': " + e.getMessage());
    }
    for (String name : properties.stringPropertyNames()) {
        String value = properties.getProperty(name);
        PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
        propertyDescriptor.setName(name);
        propertyDescriptor.setValue(value);
        propertyFileDescriptor.getProperties().add(propertyDescriptor);
    }
    return propertyFileDescriptor;
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:22,代码来源:PropertyFileScannerPlugin.java

示例7: scan

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public PropertyFileDescriptor scan(FileResource item, String path, Scope scope, Scanner scanner) throws IOException {
    ScannerContext context = scanner.getContext();
    Store store = context.getStore();
    FileDescriptor fileDescriptor = context.getCurrentDescriptor();
    Class<XmlPropertyFileDescriptor> descriptorType = XmlPropertyFileDescriptor.class;
    PropertyFileDescriptor propertyFileDescriptor = store.addDescriptorType(fileDescriptor, descriptorType);
    Properties properties = new Properties();
    try (InputStream stream = item.createStream()) {
        properties.loadFromXML(stream);
    } catch (IllegalArgumentException e) {
        LOGGER.warn("Cannot load properties from '" + path + "': " + e.getMessage());
    }

    for (String name : properties.stringPropertyNames()) {
        String value = properties.getProperty(name);
        PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
        propertyDescriptor.setName(name);
        propertyDescriptor.setValue(value);
        propertyFileDescriptor.getProperties().add(propertyDescriptor);
    }
    return propertyFileDescriptor;
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:24,代码来源:XmlPropertyFileScannerPlugin.java

示例8: scan

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public PlaintextFileDescriptor scan(final FileResource item, final String path, final Scope scope, final Scanner scanner) throws IOException {
    final Store store = scanner.getContext().getStore();
    final PlaintextFileDescriptor plaintextFileDescriptor = store.create(PlaintextFileDescriptor.class);
    plaintextFileDescriptor.setFileName(path);

    try (BufferedReader reader = new BufferedReader(new InputStreamReader(item.createStream()))) {
        final PlaintextLineParser pumlLineParser = new PlaintextLineParser(store, plaintextFileDescriptor);
        String line;
        while ((line = reader.readLine()) != null) {
            pumlLineParser.parseLine(line);
        }
    }

    return plaintextFileDescriptor;
}
 
开发者ID:kontext-e,项目名称:jqassistant-plugins,代码行数:17,代码来源:PlaintextFileScannerPlugin.java

示例9: scan

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public PlantUmlFileDescriptor scan(final FileResource item, final String path, final Scope scope, final Scanner scanner) throws IOException {
    final Store store = scanner.getContext().getStore();
    final PlantUmlFileDescriptor plantUmlFileDescriptor = store.create(PlantUmlFileDescriptor.class);
    plantUmlFileDescriptor.setFileName(path);

    try (BufferedReader reader = new BufferedReader(new InputStreamReader(item.createStream()))) {
        final PumlLineParser pumlLineParser = new PumlLineParser(store, plantUmlFileDescriptor, path.endsWith(".puml") ? ParsingState.ACCEPTING : ParsingState.IGNORING);
        String line;
        while ((line = reader.readLine()) != null) {
            pumlLineParser.parseLine(line);
        }
    }

    return plantUmlFileDescriptor;
}
 
开发者ID:kontext-e,项目名称:jqassistant-plugins,代码行数:17,代码来源:PlantUmlFileScannerPlugin.java

示例10: readViolations

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
private void readViolations(final Store store, final FileType fileType, final PmdFileDescriptor pmdFileDescriptor) {
     for (ViolationType vioType : fileType.getViolation()) {
         final PmdViolationDescriptor vioDescriptor = store.create(PmdViolationDescriptor.class);
vioDescriptor.setBeginLine(vioType.getBeginline());
vioDescriptor.setEndLine(vioType.getEndline());
vioDescriptor.setBeginColumn(vioType.getBegincolumn());
vioDescriptor.setEndColumn(vioType.getEndcolumn());
         vioDescriptor.setRule(vioType.getRule());
         vioDescriptor.setRuleSet(vioType.getRuleset());
         vioDescriptor.setPackage(vioType.get_package());
         vioDescriptor.setClassName(vioType.getClazz());
vioDescriptor.setMethod(vioType.getMethod());
vioDescriptor.setVariable(vioType.getVariable());
vioDescriptor.setExternalInfoUrl(vioType.getExternalInfoUrl());
vioDescriptor.setPriority(vioType.getPriority());
vioDescriptor.setMessage(vioType.getValue());
         pmdFileDescriptor.getViolations().add(vioDescriptor);
     }
 }
 
开发者ID:kontext-e,项目名称:jqassistant-plugins,代码行数:20,代码来源:PmdReportScannerPlugin.java

示例11: releaseStore

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
/**
 * Release a store instance.
 *
 * @param rootModule The root module
 * @param store      The store instance.
 */
private void releaseStore(MavenProject rootModule, Store store) {
    switch (storeLifecycle) {
        case MODULE:
            storeFactory.closeStore(store);
            break;
        case REACTOR:
            rootModule.setContextValue(Store.class.getName(), store);
            break;
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:17,代码来源:AbstractMojo.java

示例12: aggregate

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
    getLog().info("Available rules for '" + rootModule.getName() + "'.");
    RuleSet ruleSet = readRules(rootModule);
    RuleHelper ruleHelper = new RuleHelper(LOGGER);
    try {
        ruleHelper.printRuleSet(ruleSet);
    } catch (RuleException e) {
        throw new MojoExecutionException("Cannot print available rules.", e);
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:12,代码来源:AvailableRulesMojo.java

示例13: aggregate

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
protected void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
    Server server = new EmbeddedNeoServer((EmbeddedGraphStore) store, serverAddress,
            serverPort != null ? serverPort : Server.DEFAULT_PORT);
    server.start();
    getLog().info("Running server for module " + rootModule.getGroupId() + ":" + rootModule.getArtifactId() + ":" + rootModule.getVersion());
    getLog().info("Press <Enter> to finish.");
    try {
        System.in.read();
    } catch (IOException e) {
        throw new MojoExecutionException("Cannot read from System.in.", e);
    } finally {
        server.stop();
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:16,代码来源:ServerMojo.java

示例14: aggregate

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
    getLog().info("Available scopes for '" + rootModule.getName() + "'.");
    ScopeHelper scopeHelper = new ScopeHelper(logger);
    ScopePluginRepository scopePluginRepository = pluginRepositoryProvider.getScopePluginRepository();
    scopeHelper.printScopes(scopePluginRepository.getScopes());
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:8,代码来源:AvailableScopesMojo.java

示例15: aggregate

import com.buschmais.jqassistant.core.store.api.Store; //导入依赖的package包/类
@Override
public void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
    getLog().info("Effective rules for '" + rootModule.getName() + "'.");
    RuleSet ruleSet = readRules(rootModule);
    RuleSelection ruleSelection = RuleSelection.Builder.select(ruleSet, groups, constraints, concepts);
    RuleHelper ruleHelper = new RuleHelper(LOGGER);
    try {
        ruleHelper.printRuleSet(ruleSet, ruleSelection);
    } catch (RuleException e) {
        throw new MojoExecutionException("Cannot print effective rules.", e);
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:13,代码来源:EffectiveRulesMojo.java


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