List of usage examples for java.lang String CASE_INSENSITIVE_ORDER
Comparator CASE_INSENSITIVE_ORDER
To view the source code for java.lang String CASE_INSENSITIVE_ORDER.
Click Source Link
From source file:org.jvnet.hudson.update_center.LocalDirectoryRepository.java
/** * Return all plugins contained in the directory. * // w ww . j a v a2 s. c om * @return a collection of histories of plugins contained in the directory. * @see org.jvnet.hudson.update_center.MavenRepository#listHudsonPlugins() */ @Override public Collection<PluginHistory> listHudsonPlugins() throws PlexusContainerException, ComponentLookupException, IOException, UnsupportedExistingLuceneIndexException, AbstractArtifactResolutionException { // Search all plugins contained in the directory. DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(dir); ds.setIncludes(new String[] { "**/*.hpi", "**/*.jpi" }); ds.scan(); // build plugin history. Map<String, PluginHistory> plugins = new TreeMap<String, PluginHistory>(String.CASE_INSENSITIVE_ORDER); for (String filename : ds.getIncludedFiles()) { File hpiFile = new File(dir, filename); JarFile jar = new JarFile(hpiFile); Manifest manifest = jar.getManifest(); long lastModified = jar.getEntry("META-INF/MANIFEST.MF").getTime(); jar.close(); String groupId = manifest.getMainAttributes().getValue("Group-Id"); if (groupId == null) { // Old plugins inheriting from org.jvnet.hudson.plugins do not have // Group-Id field set in manifest. Absence of group id causes NPE in ArtifactInfo. groupId = "org.jvnet.hudson.plugins"; } final String extension = FilenameUtils.getExtension(filename); // Extension-Name and Implementation-Title is not set for plugin using gradle (ex: ivy:1.26) // Short-Name seems always present and have the same value as the other two. String artifactId = manifest.getMainAttributes().getValue("Short-Name"); ArtifactInfo a = new ArtifactInfo(null, // fname extension, groupId, artifactId, manifest.getMainAttributes().getValue("Plugin-Version"), // version // maybe Implementation-Version is more proper. null, // classifier "hpi", // packaging manifest.getMainAttributes().getValue("Long-Name"), // name manifest.getMainAttributes().getValue("Specification-Title"), // description lastModified, // lastModified hpiFile.length(), // size null, // md5 null, // sha1 ArtifactAvailablility.NOT_PRESENT, // sourcesExists ArtifactAvailablility.NOT_PRESENT, //javadocExists, ArtifactAvailablility.NOT_PRESENT, //signatureExists, null // repository ); if (!includeSnapshots && a.version.contains("SNAPSHOT")) continue; // ignore snapshots PluginHistory p = plugins.get(a.artifactId); if (p == null) plugins.put(a.artifactId, p = new PluginHistory(a.artifactId)); URL url; if (downloadDir == null) { // No downloadDir specified. // Just link to packages where they are located. String path = filename; if (File.separatorChar != '/') { // fix path separate character to / path = filename.replace(File.separatorChar, '/'); } url = new URL(baseUrl, path); } else { // downloadDir is specified. // Packages are deployed into downloadDir, based on its plugin name and version. final String path = new LocalHPI(this, p, a, hpiFile, null).getRelativePath(); url = new URL(new URL(baseUrl, "download/"), path); } p.addArtifact(new LocalHPI(this, p, a, hpiFile, url)); p.groupId.add(a.groupId); } return plugins.values(); }
From source file:edu.cornell.mannlib.vitro.webapp.servlet.setup.ThemeInfoSetup.java
/** Get a list of the names of available themes, sorted alphabetically. */ private List<String> getThemeNames(File themesBaseDir) { ArrayList<String> themeNames = new ArrayList<String>(); for (File child : themesBaseDir.listFiles()) { if (child.isDirectory()) { themeNames.add(child.getName()); }/* www. jav a 2 s . c o m*/ } Collections.sort(themeNames, String.CASE_INSENSITIVE_ORDER); return themeNames; }
From source file:org.nuxeo.ecm.directory.ui.DirectoryUIManagerImpl.java
public List<String> getDirectoryNames() { List<String> dirNames = new ArrayList<String>(registry.keySet()); Collections.sort(dirNames, String.CASE_INSENSITIVE_ORDER); return dirNames; }
From source file:com.microsoft.tfs.client.common.ui.protocolhandler.ProtocolHandler.java
private Map<String, AtomicReference<String>> prepareTfsLinkItemMap() { final Map<String, AtomicReference<String>> t = new TreeMap<String, AtomicReference<String>>( String.CASE_INSENSITIVE_ORDER); t.put(PROTOCOL_HANDLER_SERVER_URL_ITEM, serverUrl); t.put(PROTOCOL_HANDLER_CLONE_URL_ITEM, cloneUrl); t.put(PROTOCOL_HANDLER_COLLECTION_ID_ITEM, collectionId); t.put(PROTOCOL_HANDLER_COLLECTION_URL_ITEM, collectionUrl); t.put(PROTOCOL_HANDLER_PROJECT_ITEM, project); t.put(PROTOCOL_HANDLER_REPOSITORY_ITEM, repository); t.put(PROTOCOL_HANDLER_BRANCH_ITEM, branchName); // The branch parameter is not sent if the repository is empty. // We cannot infer the master branch however, because an empty // repository does not have any branches at all. branchName.set(StringUtil.EMPTY);// w ww .j a v a 2 s. c o m return t; }
From source file:org.apache.kylin.cube.upgrade.V1_5_1.CubeDescUpgrade_v_1_5_1.java
private Set<String> newIgnoreCaseSet(Set<String> input) { Set<String> ret = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (input != null) ret.addAll(input);/*from ww w . j av a2 s. co m*/ return ret; }
From source file:com.github.gfx.android.orma.migration.SchemaDiffMigration.java
public static Map<String, SQLiteMaster> loadMetadata(Database db, List<? extends MigrationSchema> schemas) { Map<String, SQLiteMaster> metadata = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); Set<String> tableNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for (MigrationSchema schema : schemas) { tableNames.add(schema.getTableName()); }//from w ww .j a va 2s. c o m for (Map.Entry<String, SQLiteMaster> entry : SQLiteMaster.loadTables(db).entrySet()) { if (tableNames.contains(entry.getKey())) { metadata.put(entry.getKey(), entry.getValue()); } } return metadata; }
From source file:uk.ac.ebi.arrayexpress.utils.search.EFOExpansionLookupIndex.java
private void addCustomSynonyms(IndexWriter w) throws InterruptedException { // here we add all custom synonyms so those that weren't added during // EFO processing // get a chance to be included, too. don't worry about duplication, // dupes will be removed during retrieval if (null != this.customSynonyms) { Set<String> addedTerms = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); for (String term : this.customSynonyms.keySet()) { if (!addedTerms.contains(term)) { Document d = new Document(); Set<String> syns = this.customSynonyms.get(term); for (String syn : syns) { addIndexField(d, "term", syn, true, true); }/*from ww w. ja va 2 s. c o m*/ addIndexDocument(w, d); addedTerms.addAll(syns); } } } }
From source file:org.ambraproject.wombat.controller.WombatController.java
private static ImmutableSortedSet<String> caseInsensitiveImmutableSet(String... strings) { return ImmutableSortedSet.copyOf(String.CASE_INSENSITIVE_ORDER, Arrays.asList(strings)); }
From source file:uk.org.rbc1b.roms.db.common.MergeUtilTest.java
@Test public void testMergeDisjointSingleStrings() { final List<Pair<String, String>> outputs = new ArrayList<Pair<String, String>>(); MergeUtil.merge(Arrays.asList("foo"), Arrays.asList("bar"), String.CASE_INSENSITIVE_ORDER, new MergeUtil.Callback<String, String>() { @Override//from ww w .ja v a 2 s . c om public void output(String leftValue, String rightValue) { outputs.add(new ImmutablePair<String, String>(leftValue, rightValue)); } }); assertEquals(Arrays.asList(new ImmutablePair<String, String>(null, "bar"), new ImmutablePair<String, String>("foo", null)), outputs); }
From source file:com.mirth.connect.plugins.globalmapviewer.GlobalMapClient.java
@Override public void prepareData(List<DashboardStatus> statuses) throws ClientException { final Set<String> channelIds = new HashSet<String>(); // Use this map to look up channel names from channel Ids final Map<String, String> channelNameMap = new HashMap<String, String>(); // Determine which global channel maps to retrieve try {/* w ww .j a va 2 s . com*/ SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { Set<DashboardStatus> channelStatuses = PlatformUI.MIRTH_FRAME.dashboardPanel .getSelectedChannelStatuses(); if (channelStatuses != null) { for (DashboardStatus channelStatus : channelStatuses) { channelIds.add(channelStatus.getChannelId()); channelNameMap.put(channelStatus.getChannelId(), channelStatus.getName()); } } } }); } catch (Exception e) { } try { data = new Vector<Object>(); Serializer serializer = ObjectXMLSerializer.getInstance(); Map<String, String> globalMaps = null; selectedRow = 0; String currentlySelectedMap = globalMapPanel.getSelectedMap(); String currentlySelectedVar = globalMapPanel.getSelectedVar(); try { globalMaps = (Map<String, String>) PlatformUI.MIRTH_FRAME.mirthClient .getServlet(GlobalMapServletInterface.class).getAllMaps(channelIds, true); } catch (ClientException e) { if (e instanceof ForbiddenException) { // Don't error. Let an empty map be processed parent.alertThrowable(parent, e, false); } else { throw e; } } if (globalMaps != null) { Map<String, String> sortedGlobalMaps = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); String serializedGlobalMap = null; // Sort the maps in order of channel name for better readability for (Entry<String, String> channelEntry : globalMaps.entrySet()) { if (channelEntry.getKey() == null) { /* * Since the global map's name is null, it cannot be used as a key in the * Tree Map. We also want to display it last, so we'll just store a * reference to it and use it later */ serializedGlobalMap = channelEntry.getValue(); } else { sortedGlobalMaps.put(channelNameMap.get(channelEntry.getKey()), channelEntry.getValue()); } } // For each global channel map, display each of its keys alphabetically for (Entry<String, String> channelEntry : sortedGlobalMaps.entrySet()) { String channelName = channelEntry.getKey(); String serializedMap = channelEntry.getValue(); Map<String, Object> sortedMap = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER); sortedMap.putAll(MapUtil.deserializeMap(serializer, serializedMap)); for (Entry<String, Object> entry : sortedMap.entrySet()) { Vector<Object> row = new Vector<Object>(); String entryKey = StringUtil.valueOf(entry.getKey()); row.add(channelName); row.add(StringUtil.valueOf(entryKey)); row.add(StringUtil.valueOf(entry.getValue())); data.add(row); if (StringUtils.equals(entryKey, currentlySelectedVar) && StringUtils.equals(channelName, currentlySelectedMap)) { selectedRow = data.size(); } } } // Now we add the global map if necessary if (serializedGlobalMap != null) { Map<String, Object> sortedMap = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER); sortedMap.putAll(MapUtil.deserializeMap(serializer, serializedGlobalMap)); for (Entry<String, Object> entry : sortedMap.entrySet()) { Vector<Object> row = new Vector<Object>(); String entryKey = StringUtil.valueOf(entry.getKey()); row.add("<Global Map>"); row.add(entryKey); row.add(StringUtil.valueOf(entry.getValue())); data.add(row); if (StringUtils.equals(entryKey, currentlySelectedVar) && StringUtils.equals("<Global Map>", currentlySelectedMap)) { selectedRow = data.size(); } } } } } catch (ClientException e) { throw e; } }