List of usage examples for java.util Comparator comparing
public static <T, U extends Comparable<? super U>> Comparator<T> comparing( Function<? super T, ? extends U> keyExtractor)
From source file:project.combiner.P2ProfileGenerator.java
static byte[] profileGz(Snapshot currentSnapshot, String timestamp, String profileID, String productID) throws IOException { snapshot = currentSnapshot;//from ww w .j ava 2 s. c o m String ECLIPSE_PROFILE_ID = profileID; String ECLIPSE_PRODUCT_ID = productID; String INSTALL_FOLDER = "/jobs/genie.technology.packaging/mars.epp-tycho-build/workspace/org.eclipse.epp.packages/packages/" + ECLIPSE_PRODUCT_ID + "/target/products/" + ECLIPSE_PROFILE_ID + "/win32/win32/x86_64/eclipse"; INSTALL_FOLDER = "D:\\evening"; String cache = "/jobs/genie.technology.packaging/mars.epp-tycho-build/workspace/org.eclipse.epp.packages/packages/" + ECLIPSE_PRODUCT_ID + "/target/products/" + ECLIPSE_PROFILE_ID + "/win32/win32/x86_64/eclipse"; cache = "D:\\evening"; String cacheRoot = cache.replace('\\', '/'); String cacheExtensions = "file:/" + cacheRoot + "/.eclipseextension|file:/" + cacheRoot + "/configuration/org.eclipse.osgi/118/data/listener_1925729951/"; ArrayList<String> lines = ArrayList.of("<?xml version='1.0' encoding='UTF-8'?>", "<?profile version='1.0.0'?>", "<profile id='" + ECLIPSE_PROFILE_ID + "' timestamp='" + timestamp + "'>", " <properties size='7'>", " <property name='org.eclipse.equinox.p2.installFolder' value='" + INSTALL_FOLDER + "'/>", " <property name='org.eclipse.equinox.p2.cache' value='" + cache + "'/>", " <property name='org.eclipse.update.install.features' value='true'/>", " <property name='org.eclipse.equinox.p2.roaming' value='true'/>", " <property name='org.eclipse.equinox.p2.environments' value='osgi.nl=en_US,osgi.ws=win32,osgi.arch=x86_64,osgi.os=win32'/>", " <property name='eclipse.touchpoint.launcherName' value='eclipse'/>", " <property name='org.eclipse.equinox.p2.cache.extensions' value='" + cacheExtensions + "'/>", " </properties>"); HashMap<Path, HashMap<String, String>> pluginToManifest = MainBuildIDE.getPluginToManifest(); HashMap<Path, Map<String, String>> pluginToProperties = getPluginToProperties(); HashMap<Path, Map<String, String>> pluginToP2Inf = getPluginToP2Inf(); Path configJrePluginPath = fromZipPath("plugins/config.a.jre.javase"); Path jrePluginPath = fromZipPath("plugins/a.jre.javase"); Path platform_rootPluginPath = fromZipPath("plugins/org.eclipse.platform_root"); Path platformIDEPath = fromZipPath("features/org.eclipse.platform.ide"); Path platformIDEExecutablePath = fromZipPath( "features/org.eclipse.platform.ide.executable.win32.win32.x86_64"); Path platformIDEExecutableEclipsePath = fromZipPath( "features/org.eclipse.platform.ide.executable.win32.win32.x86_64.eclipse"); Path rcpConfiguration_rootPluginPath = fromZipPath( "plugins/org.eclipse.rcp.configuration_root.win32.win32.x86_64"); Path rcp_rootPluginPath = fromZipPath("plugins/org.eclipse.rcp_root"); Path platformPath = fromZipPath("features/org.eclipse.platform.feature.group"); HashMap<Path, Feature> originalFeatures = getFeatures(); HashMap<Path, Plugin> plugins = getPlugins(); ArrayList<Path> pluginPaths = pluginToManifest.keySet().toArrayList(); HashMap<String, String> versionsStore = new HashMap<>(); for (Path pluginPath : pluginPaths) { versionsStore.put(pluginPath.getFileName().toString().replace(".jar", ""), extractVersion(pluginPath, pluginToManifest)); } pluginPaths.addAll(configJrePluginPath, jrePluginPath, platform_rootPluginPath, platformIDEPath, platformIDEExecutablePath, platformIDEExecutableEclipsePath, rcp_rootPluginPath, rcpConfiguration_rootPluginPath); pluginPaths.addAll(tooling.keySet()); for (Tooling tool : Tooling.values()) { Path path = fromZipPath("features/" + tool.name); pluginPaths.add(path); Path versionSource = fromZipPath("plugins/" + tool.versionSource); String version = extractVersion(versionSource, pluginToManifest); versionsStore.put(tool.name, version); } HashMap<Path, Feature> features = new HashMap<>(originalFeatures.size() * 2); for (HashMap.Entry<Path, Feature> entry : originalFeatures) { Feature feature = entry.rhs; Path group = entry.lhs.resolveSibling(feature.id + ".feature.group"); pluginPaths.add(group); features.put(group, feature); Path jar = entry.lhs.resolveSibling(feature.id + ".feature.jar"); pluginPaths.add(jar); features.put(jar, feature); features.put(entry.lhs, feature); } pluginPaths.sort(Comparator.comparing((Path p) -> extractName(p, pluginToManifest)) .thenComparing(p -> extractVersion(p, pluginToManifest))); Feature p2UserUIFeature = features.get(fromZipPath("features/org.eclipse.equinox.p2.user.ui")); Feature rcpConfigurationFeature = features.get(fromZipPath("features/org.eclipse.rcp.configuration")); Feature platformFeature = features.get(platformPath); Plugin platformPlugin = plugins.get(fromZipPath("plugins/org.eclipse.platform")); Plugin rcpPlugin = plugins.get(fromZipPath("plugins/org.eclipse.rcp.jar")); Plugin equinoxLauncherPlugin = plugins.get(fromZipPath("plugins/org.eclipse.equinox.launcher.jar")); Plugin equinoxCommonPlugin = plugins.get(fromZipPath("plugins/org.eclipse.equinox.common.jar")); Plugin equinoxDSPlugin = plugins.get(fromZipPath("plugins/org.eclipse.equinox.ds.jar")); Plugin equinoxEventPlugin = plugins.get(fromZipPath("plugins/org.eclipse.equinox.event.jar")); Plugin equinoxSimpleconfiguratorPlugin = plugins .get(fromZipPath("plugins/org.eclipse.equinox.simpleconfigurator.jar")); Plugin updateConfiguratorPlugin = plugins.get(fromZipPath("plugins/org.eclipse.update.configurator.jar")); Plugin equinoxP2ReconcilerDropinsPlugin = plugins .get(fromZipPath("plugins/org.eclipse.equinox.p2.reconciler.dropins.jar")); unitsOpen(lines, pluginPaths.size()); for (Path pluginPath : pluginPaths) { if (pluginPath == configJrePluginPath) { addConfigJreUnit(lines); } else if (pluginPath == jrePluginPath) { addJreUnit(lines); } else if (pluginPath == platformIDEPath) { addPlatformIDE(lines, platformFeature, p2UserUIFeature, rcpConfigurationFeature); } else if (pluginPath == platformIDEExecutablePath) { addPlatformIDEExecutable(lines, platformFeature); } else if (pluginPath == platformIDEExecutableEclipsePath) { addPlatformIDEExecutableEclipse(lines, platformFeature); } else if (pluginPath == rcpConfiguration_rootPluginPath) { addRcpConfigurationUnit(lines, rcpConfigurationFeature); } else if (pluginPath == platform_rootPluginPath) { addBinary_RootUnit(lines, platformPlugin); } else if (pluginPath == rcp_rootPluginPath) { addBinary_RootUnit(lines, rcpPlugin); } else if (Tooling.has(pluginPath)) { performTooling(lines, Tooling.get(pluginPath), features, versionsStore, equinoxLauncherPlugin); } else if (tooling.containsKey(pluginPath)) { lines.addAll(replaceVersions(pluginPath, equinoxLauncherPlugin, equinoxCommonPlugin, equinoxDSPlugin, equinoxEventPlugin, equinoxP2ReconcilerDropinsPlugin, equinoxSimpleconfiguratorPlugin, updateConfiguratorPlugin)); } else if (features.containsKey(pluginPath)) { addFeatureUnit(lines, features.get(pluginPath), pluginPath.getFileName().toString()); } else { HashMap<String, String> manifest = pluginToManifest.get(pluginPath); Map<String, String> props = pluginToProperties.get(pluginPath); Map<String, String> p2Inf = pluginToP2Inf.get(pluginPath); addPluginUnit(pluginPath, lines, props, p2Inf, manifest); } } unitsClose(lines); iusPropertiesOpen(lines, pluginPaths.size()); for (Path plugin : pluginPaths) { String s1 = plugin.getFileName().toString(); String s2 = s1.replace(".feature.group", ""); String s3 = s2.replace(".feature.jar", ""); String replaceAll = s3.replaceFirst("(_[0-9&&[^6]][^_4][^_]+\\.?j?a?r?$)|(\\.jar$)", ""); switch (replaceAll) { case "com.ibm.icu": case "com.jcraft.jsch": case "com.sun.el": case "javax.annotation": case "javax.el": case "javax.inject": case "javax.servlet.jsp": case "javax.servlet": case "javax.xml": case "org.apache.ant": case "org.apache.batik.css": case "org.apache.batik.util.gui": case "org.apache.batik.util": case "org.apache.commons.codec": case "org.apache.commons.logging": case "org.apache.felix.gogo.command": case "org.apache.felix.gogo.runtime": case "org.apache.felix.gogo.shell": case "org.apache.httpcomponents.httpclient": case "org.apache.httpcomponents.httpcore": case "org.apache.jasper.glassfish": // case "org.apache.log4j": case "org.apache.lucene.analysis": case "org.apache.lucene.core": // case "org.apache.ws.commons.util": // case "org.apache.xerces": // case "org.apache.xml.resolver": // case "org.apache.xml.serializer": // case "org.apache.xmlrpc": case "org.eclipse.ant.core": // case "org.eclipse.ant.launching": // case "org.eclipse.ant.ui": case "org.eclipse.compare.core": case "org.eclipse.compare.win32": case "org.eclipse.compare": case "org.eclipse.core.commands": case "org.eclipse.core.contenttype": case "org.eclipse.core.databinding.beans": case "org.eclipse.core.databinding.observable": case "org.eclipse.core.databinding.property": case "org.eclipse.core.databinding": case "org.eclipse.core.expressions": case "org.eclipse.core.externaltools": case "org.eclipse.core.filebuffers": case "org.eclipse.core.filesystem.java7": case "org.eclipse.core.filesystem.win32.x86_64": case "org.eclipse.core.filesystem": case "org.eclipse.core.jobs": case "org.eclipse.core.net.win32.x86_64": case "org.eclipse.core.net": case "org.eclipse.core.resources.win32.x86_64": case "org.eclipse.core.resources": case "org.eclipse.core.runtime.compatibility.registry": case "org.eclipse.core.runtime.compatibility": case "org.eclipse.core.runtime": case "org.eclipse.core.variables": // case "org.eclipse.cvs": case "org.eclipse.debug.core": case "org.eclipse.debug.ui": case "org.eclipse.e4.core.commands": case "org.eclipse.e4.core.contexts": case "org.eclipse.e4.core.di.extensions": case "org.eclipse.e4.core.di": case "org.eclipse.e4.core.services": case "org.eclipse.e4.rcp": // case "org.eclipse.e4.tools.css.spy": // case "org.eclipse.e4.tools.spy": case "org.eclipse.e4.ui.bindings": case "org.eclipse.e4.ui.css.core": case "org.eclipse.e4.ui.css.swt.theme": case "org.eclipse.e4.ui.css.swt": case "org.eclipse.e4.ui.di": case "org.eclipse.e4.ui.model.workbench": case "org.eclipse.e4.ui.services": case "org.eclipse.e4.ui.widgets": case "org.eclipse.e4.ui.workbench.addons.swt": case "org.eclipse.e4.ui.workbench.renderers.swt": case "org.eclipse.e4.ui.workbench.swt": case "org.eclipse.e4.ui.workbench3": case "org.eclipse.e4.ui.workbench": case "org.eclipse.ecf": case "org.eclipse.ecf.core.feature": case "org.eclipse.ecf.core.ssl.feature": case "org.eclipse.ecf.filetransfer": case "org.eclipse.ecf.filetransfer.feature": case "org.eclipse.ecf.filetransfer.httpclient4.feature": case "org.eclipse.ecf.filetransfer.httpclient4.ssl.feature": case "org.eclipse.ecf.filetransfer.ssl.feature": case "org.eclipse.ecf.identity": case "org.eclipse.ecf.provider.filetransfer": case "org.eclipse.ecf.provider.filetransfer.httpclient4": case "org.eclipse.ecf.provider.filetransfer.httpclient4.ssl": case "org.eclipse.ecf.provider.filetransfer.ssl": case "org.eclipse.ecf.ssl": // case "org.eclipse.egit": // case "org.eclipse.egit.core": // case "org.eclipse.egit.doc": // case "org.eclipse.egit.ui": case "org.eclipse.emf.common": case "org.eclipse.emf.ecore.change": // case "org.eclipse.emf.ecore.edit": case "org.eclipse.emf.ecore.xmi": case "org.eclipse.emf.ecore": // case "org.eclipse.emf.edit": // case "org.eclipse.epp.mpc.core": // case "org.eclipse.epp.mpc.help.ui": // case "org.eclipse.epp.mpc.ui": case "org.eclipse.equinox.app": case "org.eclipse.equinox.bidi": case "org.eclipse.equinox.common": case "org.eclipse.equinox.concurrent": case "org.eclipse.equinox.console": case "org.eclipse.equinox.ds": case "org.eclipse.equinox.event": case "org.eclipse.equinox.frameworkadmin.equinox": case "org.eclipse.equinox.frameworkadmin": case "org.eclipse.equinox.http.jetty": case "org.eclipse.equinox.http.registry": case "org.eclipse.equinox.http.servlet": case "org.eclipse.equinox.jsp.jasper.registry": case "org.eclipse.equinox.jsp.jasper": case "org.eclipse.equinox.launcher.win32.win32.x86_64": case "org.eclipse.equinox.launcher": case "org.eclipse.equinox.p2.artifact.repository": case "org.eclipse.equinox.p2.console": case "org.eclipse.equinox.p2.core": case "org.eclipse.equinox.p2.core.feature": case "org.eclipse.equinox.p2.director.app": case "org.eclipse.equinox.p2.directorywatcher": case "org.eclipse.equinox.p2.director": // case "org.eclipse.equinox.p2.discovery": // case "org.eclipse.equinox.p2.discovery.compatibility": case "org.eclipse.equinox.p2.engine": case "org.eclipse.equinox.p2.extensionlocation": case "org.eclipse.equinox.p2.extras.feature": case "org.eclipse.equinox.p2.garbagecollector": case "org.eclipse.equinox.p2.jarprocessor": case "org.eclipse.equinox.p2.metadata.repository": case "org.eclipse.equinox.p2.metadata": case "org.eclipse.equinox.p2.operations": case "org.eclipse.equinox.p2.publisher.eclipse": case "org.eclipse.equinox.p2.publisher": case "org.eclipse.equinox.p2.ql": case "org.eclipse.equinox.p2.reconciler.dropins": case "org.eclipse.equinox.p2.repository.tools": case "org.eclipse.equinox.p2.repository": case "org.eclipse.equinox.p2.rcp.feature": case "org.eclipse.equinox.p2.touchpoint.eclipse": case "org.eclipse.equinox.p2.touchpoint.natives": case "org.eclipse.equinox.p2.transport.ecf": case "org.eclipse.equinox.p2.ui": // case "org.eclipse.equinox.p2.ui.discovery": case "org.eclipse.equinox.p2.ui.importexport": case "org.eclipse.equinox.p2.ui.sdk": case "org.eclipse.equinox.p2.ui.sdk.scheduler": case "org.eclipse.equinox.p2.updatechecker": case "org.eclipse.equinox.p2.updatesite": case "org.eclipse.equinox.p2.user.ui": case "org.eclipse.equinox.preferences": case "org.eclipse.equinox.registry": case "org.eclipse.equinox.security.ui": case "org.eclipse.equinox.security.win32.x86_64": case "org.eclipse.equinox.security": case "org.eclipse.equinox.simpleconfigurator.manipulator": case "org.eclipse.equinox.simpleconfigurator": case "org.eclipse.equinox.util": case "org.eclipse.help.base": case "org.eclipse.help.ui": case "org.eclipse.help.webapp": case "org.eclipse.help": // case "org.eclipse.jdt": // case "org.eclipse.jdt.annotation": // case "org.eclipse.jdt.apt.core": // case "org.eclipse.jdt.apt.pluggable.core": // case "org.eclipse.jdt.apt.ui": // case "org.eclipse.jdt.compiler.apt": // case "org.eclipse.jdt.compiler.tool": // case "org.eclipse.jdt.core.manipulation": // case "org.eclipse.jdt.core": // case "org.eclipse.jdt.debug.ui": // case "org.eclipse.jdt.debug": // case "org.eclipse.jdt.doc.isv": // case "org.eclipse.jdt.doc.user": // case "org.eclipse.jdt.junit.core": // case "org.eclipse.jdt.junit.runtime": // case "org.eclipse.jdt.junit4.runtime": // case "org.eclipse.jdt.junit": // case "org.eclipse.jdt.launching": // case "org.eclipse.jdt.ui": // case "org.eclipse.jem.util": case "org.eclipse.jetty.continuation": case "org.eclipse.jetty.http": case "org.eclipse.jetty.io": case "org.eclipse.jetty.security": case "org.eclipse.jetty.server": case "org.eclipse.jetty.servlet": case "org.eclipse.jetty.util": case "org.eclipse.jface.databinding": case "org.eclipse.jface.text": case "org.eclipse.jface": // case "org.eclipse.jgit.archive": // case "org.eclipse.jgit": case "org.eclipse.jsch.core": case "org.eclipse.jsch.ui": case "org.eclipse.ltk.core.refactoring": case "org.eclipse.ltk.ui.refactoring": // case "org.eclipse.m2e.archetype.common": // case "org.eclipse.m2e.core.ui": // case "org.eclipse.m2e.core": // case "org.eclipse.m2e.discovery": // case "org.eclipse.m2e.editor.xml": // case "org.eclipse.m2e.editor": // case "org.eclipse.m2e.jdt.ui": // case "org.eclipse.m2e.jdt": // case "org.eclipse.m2e.launching": // case "org.eclipse.m2e.lifecyclemapping.defaults": // case "org.eclipse.m2e.logback.appender": // case "org.eclipse.m2e.logback.configuration": // case "org.eclipse.m2e.maven.indexer": // case "org.eclipse.m2e.maven.runtime.slf4j.simple": // case "org.eclipse.m2e.maven.runtime": // case "org.eclipse.m2e.model.edit": // case "org.eclipse.m2e.profiles.core": // case "org.eclipse.m2e.profiles.ui": // case "org.eclipse.m2e.refactoring": // case "org.eclipse.m2e.scm": // case "org.eclipse.mylyn.bugzilla.core": // case "org.eclipse.mylyn.bugzilla.ide": // case "org.eclipse.mylyn.bugzilla.ui": // case "org.eclipse.mylyn.commons.core": // case "org.eclipse.mylyn.commons.identity.core": // case "org.eclipse.mylyn.commons.net": // case "org.eclipse.mylyn.commons.notifications.core": // case "org.eclipse.mylyn.commons.notifications.feed": // case "org.eclipse.mylyn.commons.notifications.ui": // case "org.eclipse.mylyn.commons.repositories.core": // case "org.eclipse.mylyn.commons.repositories.ui": // case "org.eclipse.mylyn.commons.screenshots": // case "org.eclipse.mylyn.commons.ui": // case "org.eclipse.mylyn.commons.workbench": // case "org.eclipse.mylyn.commons.xmlrpc": // case "org.eclipse.mylyn.context.core": // case "org.eclipse.mylyn.context.tasks.ui": // case "org.eclipse.mylyn.context.ui": // case "org.eclipse.mylyn.discovery.core": // case "org.eclipse.mylyn.discovery.ui": // case "org.eclipse.mylyn.help.ui": // case "org.eclipse.mylyn.ide.ui": // case "org.eclipse.mylyn.monitor.core": // case "org.eclipse.mylyn.monitor.ui": // case "org.eclipse.mylyn.resources.ui": // case "org.eclipse.mylyn.tasks.bugs": // case "org.eclipse.mylyn.tasks.core": // case "org.eclipse.mylyn.tasks.index.core": // case "org.eclipse.mylyn.tasks.index.ui": // case "org.eclipse.mylyn.tasks.search": // case "org.eclipse.mylyn.tasks.ui": // case "org.eclipse.mylyn.team.cvs": // case "org.eclipse.mylyn.team.ui": case "org.eclipse.osgi.compatibility.state": case "org.eclipse.osgi.services": case "org.eclipse.osgi.util": case "org.eclipse.osgi": // case "org.eclipse.pde": // case "org.eclipse.pde.api.tools.annotations": // case "org.eclipse.pde.api.tools.ui": // case "org.eclipse.pde.api.tools": // case "org.eclipse.pde.build": // case "org.eclipse.pde.core": // case "org.eclipse.pde.doc.user": // case "org.eclipse.pde.ds.core": // case "org.eclipse.pde.ds.ui": // case "org.eclipse.pde.junit.runtime": // case "org.eclipse.pde.launching": // case "org.eclipse.pde.runtime": // case "org.eclipse.pde.ua.core": // case "org.eclipse.pde.ua.ui": // case "org.eclipse.pde.ui": // case "org.eclipse.pde.ui.templates": // case "org.eclipse.platform.doc.isv": case "org.eclipse.platform.doc.user": case "org.eclipse.platform": case "org.eclipse.rcp": case "org.eclipse.rcp.configuration": case "org.eclipse.search": case "org.eclipse.swt.win32.win32.x86_64": case "org.eclipse.swt": case "org.eclipse.team.core": // case "org.eclipse.team.cvs.core": // case "org.eclipse.team.cvs.ssh2": // case "org.eclipse.team.cvs.ui": case "org.eclipse.team.ui": case "org.eclipse.text": case "org.eclipse.ui.browser": case "org.eclipse.ui.cheatsheets": case "org.eclipse.ui.console": case "org.eclipse.ui.editors": case "org.eclipse.ui.externaltools": case "org.eclipse.ui.forms": case "org.eclipse.ui.ide.application": case "org.eclipse.ui.ide": case "org.eclipse.ui.intro.universal": case "org.eclipse.ui.intro": case "org.eclipse.ui.navigator.resources": case "org.eclipse.ui.navigator": case "org.eclipse.ui.net": case "org.eclipse.ui.themes": // case "org.eclipse.ui.trace": // case "org.eclipse.ui.views.log": case "org.eclipse.ui.views.properties.tabbed": case "org.eclipse.ui.views": case "org.eclipse.ui.win32": case "org.eclipse.ui.workbench.texteditor": case "org.eclipse.ui.workbench": case "org.eclipse.ui": case "org.eclipse.update.configurator": // case "org.eclipse.wst.common.core": // case "org.eclipse.wst.common.emf": // case "org.eclipse.wst.common.environment": // case "org.eclipse.wst.common.frameworks.ui": // case "org.eclipse.wst.common.frameworks": // case "org.eclipse.wst.common.project.facet.core": // case "org.eclipse.wst.common.ui": // case "org.eclipse.wst.common.uriresolver": // case "org.eclipse.wst.sse.core": // case "org.eclipse.wst.sse.ui": // case "org.eclipse.wst.validation.ui": // case "org.eclipse.wst.validation": // case "org.eclipse.wst.xml.core": // case "org.eclipse.wst.xml.ui": // case "org.eclipse.wst.xsd.core": // case "org.eclipse.xsd": // case "org.hamcrest.core": // case "org.junit": // case "org.nodeclipse.pluginslist.core": // case "org.objectweb.asm.tree": // case "org.objectweb.asm": case "org.sat4j.core": case "org.sat4j.pb": // case "org.slf4j.api": // case "org.springsource.ide.eclipse.commons.core": // case "org.springsource.ide.eclipse.commons.frameworks.core": // case "org.springsource.ide.eclipse.commons.livexp": // case "org.springsource.ide.eclipse.commons.quicksearch": case "org.w3c.css.sac": case "org.w3c.dom.events": case "org.w3c.dom.smil": case "org.w3c.dom.svg": // case "winterwell.markdown": continue; default: } if (plugin == configJrePluginPath) { //addConfigJreUnit(lines); } else if (plugin == jrePluginPath) { //addJreUnit(lines); } else if (plugin == platformIDEPath) { iuPropertiesOpen(lines, replaceAll, platformFeature.version); propertiesOpen(lines, 2); property(lines, "org.eclipse.equinox.p2.internal.inclusion.rules", "STRICT"); property(lines, "org.eclipse.equinox.p2.type.root", "true"); propertiesClose(lines); iuPropertiesClose(lines); } else if (plugin == platformIDEExecutablePath) { Feature feature2 = platformFeature; iuPropertiesOpen(lines, replaceAll, feature2.version); propertiesOpen(lines, 1); String key = "unzipped|" + "@artifact|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse"; String value = "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/eclipse.exe|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/eclipsec.exe|"; property(lines, key, value); propertiesClose(lines); iuPropertiesClose(lines); } else if (plugin == platformIDEExecutableEclipsePath) { // Feature feature = features.get(plugin.resolveSibling("org.eclipse.platform.feature.group")); // addPlatformIDEExecutableEclipse(lines, feature); } else if (plugin == rcpConfiguration_rootPluginPath) { iuPropertiesOpen(lines, replaceAll, platformFeature.version); propertiesOpen(lines, 1); String key = "unzipped|" + "@artifact|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse"; String value = "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/eclipse.exe|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/eclipsec.exe|"; property(lines, key, value); propertiesClose(lines); iuPropertiesClose(lines); } else if (plugin == platform_rootPluginPath) { iuPropertiesOpen(lines, replaceAll, platformFeature.version); propertiesOpen(lines, 1); String key = "unzipped|" + "@artifact|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse"; String value = "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/notice.html|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/.eclipseproduct|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/epl-v10.html|"; property(lines, key, value); propertiesClose(lines); iuPropertiesClose(lines); } else if (plugin == rcp_rootPluginPath) { iuPropertiesOpen(lines, replaceAll, platformFeature.version); propertiesOpen(lines, 1); String key = "unzipped|" + "@artifact|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse"; String value = "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/readme|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/readme/readme_eclipse.html|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/epl-v10.html|" + "/opt/public/eclipse/builds/4I/gitCache/eclipse.platform.releng.aggregator/" + "eclipse.platform.releng.tychoeclipsebuilder/platform/target/products/" + "org.eclipse.platform.ide/win32/win32/x86_64/eclipse" + "/notice.html|"; property(lines, key, value); propertiesClose(lines); iuPropertiesClose(lines); } else if (Tooling.has(plugin)) { //performTooling(lines, Tooling.get(plugin), features, versionsStore); } else if (tooling.containsKey(plugin)) { //lines.addAll(tooling.get(plugin)); } else if (features.containsKey(plugin)) { Feature someFeature = features.get(plugin); iuPropertiesOpen(lines, someFeature.id, someFeature.version); propertiesOpen(lines, 2); property(lines, "org.eclipse.equinox.p2.internal.inclusion.rules", "STRICT"); property(lines, "org.eclipse.equinox.p2.type.root", "true"); propertiesClose(lines); iuPropertiesClose(lines); } else { HashMap<String, String> manifest = pluginToManifest.get(plugin); String bsn = manifest.get("Bundle-SymbolicName"); String id = bsn.split(";")[0].trim(); String version = manifest.get("Bundle-Version"); iuPropertiesOpen(lines, id, version); propertiesOpen(lines, 2); property(lines, "org.eclipse.equinox.p2.internal.inclusion.rules", "STRICT"); property(lines, "org.eclipse.equinox.p2.type.root", "true"); propertiesClose(lines); iuPropertiesClose(lines); } } iusPropertiesClose(lines); lines.addAll("</profile>", ""); String profileGz = String.join("\n", lines); return profileGz.getBytes(UTF8); }
From source file:View.Visualize.java
public void getScatterChartData(Integer nameColumn, Integer valueColumn, Table table, ScatterChart scatterChart, Boolean newSeries, Boolean rowCounter) { data.clear();//from w ww . j a v a2 s . c o m ObservableList<XYChart.Data> scatterChartData = FXCollections.observableArrayList(); XYChart.Series series1 = new XYChart.Series(); if (!newSeries) { series1.getData().clear(); scatterChart.getData().clear(); } scatterChart.setAnimated(false);//bug fix addDataFromTable(table, nameColumn, valueColumn, rowCounter); data.entrySet().stream().map(entry -> new XYChart.Data(entry.getKey(), entry.getValue())) .forEach(scatterChartData::add); series1.getData().addAll(scatterChartData); scatterChart.getData().addAll(series1); series1.getData().sort(Comparator.comparing(BarChart.Data<String, Double>::getYValue).reversed()); setupHover(series1); addColorChangeOnIndividual(scatterChartData); }
From source file:com.netflix.metacat.connector.jdbc.services.JdbcConnectorTableService.java
/** * {@inheritDoc}// w w w. j av a2s . co m */ @Override public List<QualifiedName> listNames(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name, @Nullable final QualifiedName prefix, @Nullable final Sort sort, @Nullable final Pageable pageable) { log.debug("Beginning to list tables names for qualified name {} for request {}", name, context); final String catalog = name.getCatalogName(); final String database = name.getDatabaseName(); try (Connection connection = this.getConnection(database)) { final List<QualifiedName> names = Lists.newArrayList(); try (ResultSet tables = this.getTables(connection, name, prefix)) { while (tables.next()) { names.add(QualifiedName.ofTable(catalog, database, tables.getString("TABLE_NAME"))); } } // Does user want sorting? if (sort != null) { final Comparator<QualifiedName> comparator = Comparator.comparing(QualifiedName::getTableName); JdbcConnectorUtils.sort(names, sort, comparator); } // Does user want pagination? final List<QualifiedName> results = JdbcConnectorUtils.paginate(names, pageable); log.debug("Finished listing tables names for qualified name {} for request {}", name, context); return results; } catch (final SQLException se) { throw this.exceptionMapper.toConnectorException(se, name); } }
From source file:eu.itesla_project.online.tools.PrintOnlineWorkflowSummaryTable.java
private void printViolations(String workflowId, String basecaseId, String contingencyId, Integer stateId, OnlineStep step, List<LimitViolation> violations, TableFormatter formatter) { if (violations != null && !violations.isEmpty()) { violations.stream().sorted(Comparator.comparing(LimitViolation::getLimitType)).forEach(violation -> { if (violation != null) { try { formatter.writeCell(workflowId); formatter.writeCell(basecaseId); formatter.writeCell(contingencyId); formatter.writeCell(stateId); formatter.writeEmptyCell(); formatter.writeEmptyCell(); formatter.writeCell(ViolationType.STEADY_STATE.name()); formatter.writeCell(violation.getLimitType().name()); formatter.writeCell(step.name()); formatter.writeCell(violation.getSubject().getId()); formatter.writeCell(violation.getValue()); formatter.writeCell(violation.getLimit()); } catch (IOException e) { throw new RuntimeException(e); }/*w w w . ja v a 2s.c o m*/ } }); } }
From source file:software.reinvent.dependency.parser.service.CsvWriter.java
/** * Transforms {@link ArtifactDependency} information's to a ","-separated string. * * @param artifact the artifact to write * @param dependenciesToFilter the dependencies to filter - like internal or external dependencies * @param dependencyStringFunction the string transform function to apply * * @return the ","-separated string/*from ww w.j a v a 2 s . c o m*/ */ private String getDependencyColumn(final Artifact artifact, final Set<ArtifactDependency> dependenciesToFilter, final Function<ArtifactDependency, String> dependencyStringFunction) { return Joiner.on(",") .join(artifact.getDependencies().stream() .filter(Optional.ofNullable(dependenciesToFilter).orElse(Sets.newHashSet())::contains) .sorted(Comparator.comparing(ArtifactDependency::getGroupId) .thenComparing(ArtifactDependency::getArtifactId)) .map(dependencyStringFunction).collect(Collectors.toList())); }
From source file:org.languagetool.rules.spelling.morfologik.suggestions_ordering.SuggestionsOrdererGSoC.java
@Override public List<SuggestedReplacement> orderSuggestions(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos) { if (!isMlAvailable()) { return suggestions.stream().map(SuggestedReplacement::new).collect(Collectors.toList()); }/*w ww. jav a2 s .c o m*/ List<Pair<String, Float>> suggestionsScores = new LinkedList<>(); for (String suggestion : suggestions) { String text = sentence.getText(); String correctedSentence = text.substring(0, startPos) + suggestion + sentence.getText().substring(startPos + word.length()); float score = processRow(text, correctedSentence, word, suggestion, DEFAULT_CONTEXT_LENGTH); suggestionsScores.add(Pair.of(suggestion, score)); } Comparator<Pair<String, Float>> comparing = Comparator.comparing(Pair::getValue); suggestionsScores.sort(comparing.reversed()); return suggestionsScores.stream().map(p -> { SuggestedReplacement s = new SuggestedReplacement(p.getKey()); s.setConfidence(p.getRight()); return s; }).collect(Collectors.toList()); }
From source file:org.hawkular.metrics.clients.ptrans.fullstack.CollectdITest.java
private List<Point> getExpectedData() throws Exception { return Files.lines(collectdOut.toPath()).filter(l -> l.startsWith("PUTVAL")).map(this::collectdLogToPoint) .sorted(Comparator.comparing(Point::getType).thenComparing(Point::getTimestamp)).collect(toList()); }
From source file:org.dcache.util.collector.pools.PoolInfoCollectorUtils.java
/** * <p>Accesses current state of selection unit.</p> *//*w w w. java2s . c o m*/ public static String[] listPools(PoolSelectionUnit poolSelectionUnit) { if (poolSelectionUnit == null) { return new String[0]; } return poolSelectionUnit.getPools().values().stream().sorted(Comparator.comparing(SelectionPool::getName)) .map(SelectionPool::getName).toArray(String[]::new); }
From source file:org.apache.distributedlog.fs.DLFileSystem.java
@Override public FileStatus[] listStatus(Path path) throws FileNotFoundException, IOException { String logName = getStreamName(path); try {/*from ww w.j a v a 2 s.c o m*/ Iterator<String> logs = namespace.getLogs(logName); List<FileStatus> statusList = Lists.newArrayList(); while (logs.hasNext()) { String child = logs.next(); Path childPath = new Path(path, child); statusList.add(getFileStatus(childPath)); } Collections.sort(statusList, Comparator.comparing(fileStatus -> fileStatus.getPath().getName())); return statusList.toArray(new FileStatus[statusList.size()]); } catch (LogNotFoundException e) { throw new FileNotFoundException(path.toString()); } }
From source file:org.wildfly.swarm.proc.Monitor.java
private Optional<ArchivedResult> getPreviousResults(Path currentOutput, File dir) throws IOException { try (Stream<Path> stream = Files.walk(dir.toPath(), 1)) { return stream.filter(path -> Files.isRegularFile(path)) .filter(path -> path.getFileName().toString().endsWith(".csv")) .filter(path -> !isSameFile(currentOutput, path)).map(path -> { String fileName = path.getFileName().toString(); Version version = Version.valueOf(fileName.substring(0, fileName.lastIndexOf("."))); return new ArchivedResult(version, path.toFile()); }).sorted(Comparator.comparing(ArchivedResult::getVersion).reversed()).findFirst(); }// w w w .j a v a2 s . com }