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


Java Plugin类代码示例

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


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

示例1: main

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
public static void main(String[] argv) throws Exception {
	edu.umd.cs.findbugs.DetectorFactoryCollection detectorFactoryCollection =
		edu.umd.cs.findbugs.DetectorFactoryCollection.instance();

	ExecutionPlan execPlan = new ExecutionPlan();

	for (int i = 0; i < argv.length; ++i) {
		String pluginId = argv[i];
		Plugin plugin = detectorFactoryCollection.getPluginById(pluginId);
		if (plugin != null)
			execPlan.addPlugin(plugin);
	}

	execPlan.build();

	System.out.println(execPlan.passList.size() + " passes in plan");
	execPlan.print();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:ExecutionPlan.java

示例2: getRedirectURL

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
/**
 * @param force
 * @return
 */
public @CheckForNull URI getRedirectURL(final boolean force) {
    String redirect = dfc.getGlobalOption(KEY_REDIRECT_ALL_UPDATE_CHECKS);
    String sysprop = System.getProperty("findbugs.redirectUpdateChecks");
    if (sysprop != null)
        redirect = sysprop;
    Plugin setter = dfc.getGlobalOptionSetter(KEY_REDIRECT_ALL_UPDATE_CHECKS);
    URI redirectUri = null;
    String pluginName = setter == null ? "<unknown plugin>" : setter.getShortDescription();
    if (redirect != null && !redirect.trim().equals("")) {
        try {
            redirectUri = new URI(redirect);
            logError(Level.INFO, "Redirecting all plugin update checks to " + redirectUri + " (" + pluginName + ")");
            
        } catch (URISyntaxException e) {
            String error = "Invalid update check redirect URI in " + pluginName + ": " + redirect;
            logError(Level.SEVERE, error);
            dfc.pluginUpdateCheckComplete(pluginUpdates, force);
            throw new IllegalStateException(error);
        }
    }
    return redirectUri;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:27,代码来源:UpdateChecker.java

示例3: getPluginThatDisabledUpdateChecks

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
public String getPluginThatDisabledUpdateChecks() {
    String disable = dfc.getGlobalOption(KEY_DISABLE_ALL_UPDATE_CHECKS);
    Plugin setter = dfc.getGlobalOptionSetter(KEY_DISABLE_ALL_UPDATE_CHECKS);
    String pluginName = setter == null ? "<unknown plugin>" : setter.getShortDescription();
    String disablingPlugin = null;
    if ("true".equalsIgnoreCase(disable)) {
        logError(Level.INFO, "Skipping update checks due to " + KEY_DISABLE_ALL_UPDATE_CHECKS + "=true set by "
                + pluginName);
        disablingPlugin = pluginName;
    } else if (disable != null && !"false".equalsIgnoreCase(disable)) {
        String error = "Unknown value '" + disable + "' for " + KEY_DISABLE_ALL_UPDATE_CHECKS + " in " + pluginName;
        logError(Level.SEVERE, error);
        throw new IllegalStateException(error);
    }
    return disablingPlugin;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:17,代码来源:UpdateChecker.java

示例4: actuallyCheckforUpdates

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
/** protected for testing */
    protected void actuallyCheckforUpdates(URI url, Collection<Plugin> plugins, String entryPoint) throws IOException {
        LOGGER.fine("Checking for updates at " + url + " for " + getPluginNames(plugins));
        HttpURLConnection conn = (HttpURLConnection) url.toURL().openConnection();
        conn.setDoInput(true);
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        conn.connect();
        OutputStream out = conn.getOutputStream();
        writeXml(out, plugins, entryPoint);
        // for debugging:
//        writeXml(System.out, plugins, entryPoint);
        int responseCode = conn.getResponseCode();
        if (responseCode != 200) {
            logError(SystemProperties.ASSERTIONS_ENABLED ? Level.WARNING : Level.FINE,
                    "Error checking for updates at " + url + ": "
                    + responseCode + " - " + conn.getResponseMessage());
        } else {
            parseUpdateXml(url, plugins, conn.getInputStream());
        }
        conn.disconnect();
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:23,代码来源:UpdateChecker.java

示例5: addPlugin

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
/**
 * Add a Plugin whose Detectors should be added to the execution plan.
 */
public void addPlugin(Plugin plugin) throws OrderingConstraintException {
    if (DEBUG) {
        System.out.println("Adding plugin " + plugin.getPluginId() + " to execution plan");
    }

    pluginList.add(plugin);

    // Add ordering constraints
    copyTo(plugin.interPassConstraintIterator(), interPassConstraintList);
    copyTo(plugin.intraPassConstraintIterator(), intraPassConstraintList);

    // Add detector factories
    for (DetectorFactory factory : plugin.getDetectorFactories()) {
        if (DEBUG) {
            System.out.println("  Detector factory " + factory.getShortName());
        }
        if (factoryMap.put(factory.getFullName(), factory) != null) {
            throw new OrderingConstraintException("Detector " + factory.getFullName() + " is defined by more than one plugin");
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:25,代码来源:ExecutionPlan.java

示例6: main

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
public static void main(String[] argv) throws Exception {
    DetectorFactoryCollection detectorFactoryCollection = DetectorFactoryCollection.instance();

    ExecutionPlan execPlan = new ExecutionPlan();

    for (String pluginId : argv) {
        Plugin plugin = detectorFactoryCollection.getPluginById(pluginId);
        if (plugin != null) {
            execPlan.addPlugin(plugin);
        }
    }

    execPlan.build();

    System.out.println(execPlan.getNumPasses() + " passes in plan");
    execPlan.print();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:18,代码来源:ExecutionPlan.java

示例7: getAdapter

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adapterType == IPropertySheetPage.class) {
        if (adaptableObject instanceof BugExplorerView || adaptableObject instanceof JavaEditor
                || adaptableObject instanceof AbstractFindbugsView) {
            return new BugPropertySheetPage();
        }
    }
    if (adapterType == IPropertySource.class) {
        if (adaptableObject instanceof BugPattern || adaptableObject instanceof BugInstance
                || adaptableObject instanceof DetectorFactory || adaptableObject instanceof Plugin
                || adaptableObject instanceof BugInstance.XmlProps || adaptableObject instanceof BugGroup
                || adaptableObject instanceof BugAnnotation) {
            return new PropertySource(adaptableObject);
        }
        IMarker marker = Util.getAdapter(IMarker.class, adaptableObject);
        if (!MarkerUtil.isFindBugsMarker(marker)) {
            return null;
        }
        return new MarkerPropertySource(marker);
    }
    return null;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:24,代码来源:PropertyPageAdapterFactory.java

示例8: addDetectorInfo

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
private void addDetectorInfo(StringBuilder text) {
    DetectorFactory factory = bug.getDetectorFactory();
    if (factory != null) {
        Plugin plugin = factory.getPlugin();
        if (!plugin.isCorePlugin()) {
            text.append("<p><small><i>Reported by: ").append(factory.getFullName());
            text.append("<br>Contributed by plugin: ").append(plugin.getPluginId());
            text.append("<br>Provider: ").append(plugin.getProvider());
            String website = plugin.getWebsite();
            if (website != null && website.length() > 0) {
                text.append(" (<a href=\"").append(website).append("\">");
                text.append(website).append("</a>)");
            }
            text.append("</i></small>");
        }
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:18,代码来源:BugInfoView.java

示例9: validate

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
/**
 *
 * @param path
 *            non null, full abstract path in the local file system
 * @return {@link Status#OK_STATUS} in case that given path might be a valid
 *         FindBugs detector package (jar file containing bugrank.txt,
 *         findbugs.xml, messages.xml and at least one class file). Returns
 *         error status in case anything goes wrong or file at given path is
 *         not considered as a valid plugin.
 */
@Nonnull
public ValidationStatus validate(String path) {
    File file = new File(path);
    Summary sum = null;
    try {
        sum = PluginLoader.validate(file);
    } catch (IllegalArgumentException e) {
        if(FindbugsPlugin.getDefault().isDebugging()) {
            e.printStackTrace();
        }
        return new ValidationStatus(IStatus.ERROR,
                "Invalid FindBugs plugin archive: " + e.getMessage(), sum, e);
    }
    Plugin loadedPlugin = Plugin.getByPluginId(sum.id);
    URI uri = file.toURI();
    if(loadedPlugin != null && !uri.equals(loadedPlugin.getPluginLoader().getURI())
            && loadedPlugin.isGloballyEnabled()) {
        return new ValidationStatus(IStatus.ERROR, "Duplicated FindBugs plugin: " + sum.id + ", already loaded from: "
                + loadedPlugin.getPluginLoader().getURI(), sum, null);
    }
    return new ValidationStatus(IStatus.OK, Status.OK_STATUS.getMessage(), sum, null);
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:33,代码来源:DetectorValidator.java

示例10: buildFactoryMap

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
private Map<String, DetectorFactory> buildFactoryMap() {
	Map<String, DetectorFactory> factoryMap = new HashMap<String, DetectorFactory>();

	for (Iterator<Plugin> j = pluginList.iterator(); j.hasNext(); ) {
		Plugin plugin = j.next();
		for (Iterator<DetectorFactory> i = plugin.detectorFactoryIterator(); i.hasNext(); ) {
			DetectorFactory factory = i.next();
			factoryMap.put(factory.getFullName(), factory);
		}
	}

	return factoryMap;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:ExecutionPlan.java

示例11: startUpdateCheckThread

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
private void startUpdateCheckThread(final URI url, final Collection<Plugin> plugins, final CountDownLatch latch) {
    if (url == null) {
        logError(Level.INFO, "Not checking for plugin updates w/ blank URL: " + getPluginNames(plugins));
        return;
    }
    final String entryPoint = getEntryPoint();
    if ((entryPoint.contains("edu.umd.cs.findbugs.FindBugsTestCase") 
            || entryPoint.contains("edu.umd.cs.findbugs.cloud.appEngine.AbstractWebCloudTest"))
            && (url.getScheme().equals("http") || url.getScheme().equals("https"))) {
        LOGGER.fine("Skipping update check because we're running in FindBugsTestCase and using "
                + url.getScheme());
        return;
    }
    Util.runInDameonThread(new Runnable() {
        public void run() {
            try {
                actuallyCheckforUpdates(url, plugins, entryPoint);
            } catch (Exception e) {
                if (e instanceof IllegalStateException && e.getMessage().contains("Shutdown in progress"))
                    return;
                logError(e, "Error doing update check at " + url);
            } finally {
                latch.countDown();
            }
        }
    }, "Check for updates");
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:28,代码来源:UpdateChecker.java

示例12: parseUpdateXml

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
    void parseUpdateXml(URI url, Collection<Plugin> plugins, @WillClose
    InputStream inputStream) {
        try {
            Document doc = new SAXReader().read(inputStream);
//            StringWriter stringWriter = new StringWriter();
//            XMLWriter xmlWriter = new XMLWriter(stringWriter);
//            xmlWriter.write(doc);
//            xmlWriter.close();
//            System.out.println("UPDATE RESPONSE: " + stringWriter.toString());
            List<Element> pluginEls =  XMLUtil.selectNodes(doc, "fb-plugin-updates/plugin");
            Map<String, Plugin> map = new HashMap<String, Plugin>();
            for (Plugin p : plugins)
                map.put(p.getPluginId(), p);
            for (Element pluginEl : pluginEls) {
                String id = pluginEl.attributeValue("id");
                Plugin plugin = map.get(id);
                if (plugin != null) {
                    checkPlugin(pluginEl, plugin);
                }

            }
        } catch (Exception e) {
            logError(e, "Could not parse plugin version update for " + url);
        } finally {
            Util.closeSilently(inputStream);
        }
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:29,代码来源:UpdateChecker.java

示例13: checkPluginRelease

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
private void checkPluginRelease(Plugin plugin, Element maxEl) {
    @CheckForNull Date updateDate = parseReleaseDate(maxEl);
    @CheckForNull Date installedDate = plugin.getReleaseDate();
    if (updateDate != null && installedDate != null && updateDate.before(installedDate))
        return;
    String version = maxEl.attributeValue("version");
    if (version.equals(plugin.getVersion()))
        return;

    String url = maxEl.attributeValue("url");
    String message = maxEl.element("message").getTextTrim();

    pluginUpdates.add(new PluginUpdate(plugin, version, updateDate, url, message));
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:15,代码来源:UpdateChecker.java

示例14: getPluginNames

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
private String getPluginNames(Collection<Plugin> plugins) {
    String text = "";
    boolean first = true;
    for (Plugin plugin : plugins) {
        text = (first ? "" : ", ") + plugin.getShortDescription();
        first = false;
    }
    return text;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:10,代码来源:UpdateChecker.java

示例15: PluginUpdate

import edu.umd.cs.findbugs.Plugin; //导入依赖的package包/类
private PluginUpdate(Plugin plugin, String version, @CheckForNull  Date date, @CheckForNull String url, @Nonnull String message) {
    this.plugin = plugin;
    this.version = version;
    this.date = date;
    this.url = url;
    this.message = message;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:8,代码来源:UpdateChecker.java


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