Example usage for java.util Collections EMPTY_MAP

List of usage examples for java.util Collections EMPTY_MAP

Introduction

In this page you can find the example usage for java.util Collections EMPTY_MAP.

Prototype

Map EMPTY_MAP

To view the source code for java.util Collections EMPTY_MAP.

Click Source Link

Document

The empty map (immutable).

Usage

From source file:org.apache.hadoop.hbase.rsgroup.RSGroupInfoManagerImpl.java

public RSGroupInfoManagerImpl(MasterServices master) throws IOException {
    this.rsGroupMap = Collections.EMPTY_MAP;
    this.tableMap = Collections.EMPTY_MAP;
    rsGroupSerDe = new RSGroupSerDe();
    this.master = master;
    this.watcher = master.getZooKeeper();
    this.conn = master.getClusterConnection();
    rsGroupStartupWorker = new RSGroupStartupWorker(this, master, conn);
    prevRSGroups = new HashSet<String>();
    refresh();//from  w  ww  .j a v a2 s .  co m
    rsGroupStartupWorker.start();
    defaultServerUpdater = new DefaultServerUpdater(this);
    master.getServerManager().registerListener(this);
    defaultServerUpdater.start();
}

From source file:org.apache.excalibur.source.factories.HTTPClientSource.java

/**
 * Constructor, creates a new {@link HTTPClientSource} instance.
 *
 * @param uri URI//from  www.  j  av  a 2  s .c om
 * @param parameters contextual parameters passed to this instance
 * @exception Exception if an error occurs
 */
public HTTPClientSource(final String uri, final Map parameters, final HttpState httpState) throws Exception {
    this.m_uri = uri;
    this.m_parameters = parameters == null ? Collections.EMPTY_MAP : parameters;
    this.m_httpState = httpState;
}

From source file:fr.inria.atlanmod.neoemf.map.datastore.MapPersistenceBackendFactoryTest.java

@Test
public void testCreatePersistentEStoreNoOption() throws InvalidDataStoreException, NoSuchFieldException,
        SecurityException, IllegalArgumentException, IllegalAccessException {
    PersistenceBackend persistentBackend = persistenceBackendFactory.createPersistentBackend(testFile,
            Collections.EMPTY_MAP);
    SearcheableResourceEStore eStore = persistenceBackendFactory.createPersistentEStore(null, persistentBackend,
            Collections.EMPTY_MAP);
    assert eStore instanceof DirectWriteMapResourceEStoreImpl : "Invalid EStore created";
    PersistenceBackend innerBackend = getInnerBackend((DirectWriteMapResourceEStoreImpl) eStore);
    assert innerBackend == persistentBackend : "The backend in the EStore is not the created one";
}

From source file:org.apache.tapestry5.upload.internal.services.MultipartDecoderImplTest.java

@Test
public void file_items_cleaned_up() throws Exception {
    HttpServletRequest request = mockHttpServletRequest();
    expect(request.getParameterMap()).andReturn(Collections.EMPTY_MAP);
    MultipartDecoderImpl decoder = new MultipartDecoderImpl(fileItemFactory, -1, -1, CHARSET);
    StubFileItem firstItem = new StubFileItem("one");
    firstItem.setFormField(false);//from   w  w w . j  av  a  2s.  c  o  m
    StubFileItem secondItem = new StubFileItem("two");
    secondItem.setFormField(false);

    List<FileItem> fileItems = new ArrayList<FileItem>();
    fileItems.add(firstItem);
    fileItems.add(secondItem);

    replay();

    decoder.processFileItems(request, fileItems);

    assertFalse(firstItem.isDeleted());
    assertFalse(secondItem.isDeleted());
    decoder.threadDidCleanup();
    assertTrue(firstItem.isDeleted());
    assertTrue(secondItem.isDeleted());

    verify();
}

From source file:org.eclipselabs.spray.xtext.ui.internal.RegisterPlatformGenmodelListener.java

private void unregisterEPackage(IFile file) {
    ResourceSet rs = new ResourceSetImpl();
    Resource emfResource = rs/*from  ww  w  . ja  v  a 2 s .c o  m*/
            .createResource(URI.createPlatformResourceURI((file.getFullPath().toPortableString()), true));
    try {
        emfResource.load(Collections.EMPTY_MAP);
        EPackage.Registry registry = EPackage.Registry.INSTANCE;
        for (EPackage pck : EcoreUtil2.eAllOfType(emfResource.getContents().get(0), EPackage.class)) {
            if (registry.remove(pck.getNsURI()) != null) {
                LOG.info("Deregistered EPackage " + pck.getNsURI());
            }
        }
        emfResource.unload();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.apache.nifi.integration.util.NiFiTestServer.java

public void startServer() throws Exception {
    jetty.start();//from w  w  w  .  j a v a 2  s  .c o m

    // ensure the ui extensions are set
    webappContext.getServletContext().setAttribute("nifi-ui-extensions",
            new UiExtensionMapping(Collections.EMPTY_MAP));
}

From source file:org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy.java

@SuppressWarnings("unchecked")
public ProportionalCapacityPreemptionPolicy() {
    clock = new SystemClock();
    allPartitions = Collections.EMPTY_SET;
    leafQueueNames = Collections.EMPTY_SET;
    preemptableQueues = Collections.EMPTY_MAP;
}

From source file:com.ctrip.infosec.rule.resource.DataProxy.java

/**
 * ?DataProxyResponseresultMap/* w w  w .  ja v a 2  s.  c  o m*/
 */
private static Map parseProfileResult(Map result) {
    if (result != null) {
        if (result.get("tagName") != null) {
            return parseResult(result);
        } else if (result.get("tagNames") != null) {
            Object tagValues = result.get("tagNames");
            List oldResults = JSON.parseObject(JSON.toJSONString(tagValues), List.class);
            Map newResults = new HashMap();
            Iterator iterator = oldResults.iterator();
            while (iterator.hasNext()) {
                Map oneResult = (Map) iterator.next();
                newResults.putAll(parseResult(oneResult));
            }
            return newResults;
        } else {
            return result;
        }
    }
    return Collections.EMPTY_MAP;
}

From source file:org.hyperic.hq.plugin.appha.VSphereUtil.java

/**
 * Find a managed entity by UUID from the live vCenter inventory.
 * This should only be used when a real-time inventory check is required.
 * Otherwise, use findByUuidFromCache() since it is more efficient.
 */// w w w.  j  a v a  2s  . co m
Map<String, ManagedEntity> findByUuidFromInventory(String type, Set<String> uuids) throws PluginException {

    if (uuids == null || uuids.isEmpty()) {
        return Collections.EMPTY_MAP;
    }

    StopWatch watch = new StopWatch();
    Map<String, ManagedEntity> inventory = new HashMap<String, ManagedEntity>(uuids.size());

    try {
        ManagedEntity[] entities = find(type);
        for (int i = 0; entities != null && i < entities.length; i++) {
            ManagedEntity entity = entities[i];
            String entUuid = getUuid(entity);
            if (entUuid == null) {
                continue;
            }
            if (uuids.contains(entUuid)) {
                inventory.put(entUuid, entity);
                if (inventory.size() == uuids.size()) {
                    break;
                }
            }
        }
    } catch (Exception ex) {
        throw new PluginException(type + "/" + uuids + ": " + ex, ex);
    } finally {
        if (_log.isDebugEnabled()) {
            _log.debug("findByUuidFromInventory: type=" + type + ", uuids=" + uuids + ", managedEntities="
                    + inventory + ", time=" + watch);
        }
    }

    return inventory;
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.datastore.BlueprintsPersistenceBackendFactoryTest.java

@Test
public void testCreatePersistentEStoreDirectWriteOption() throws InvalidDataStoreException,
        NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    storeOptions.add(BlueprintsResourceOptions.EStoreGraphOption.DIRECT_WRITE);
    PersistenceBackend persistentBackend = persistenceBackendFactory.createPersistentBackend(testFile,
            Collections.EMPTY_MAP);
    SearcheableResourceEStore eStore = persistenceBackendFactory.createPersistentEStore(null, persistentBackend,
            options);//w  w  w .j a v  a2s  .  com
    assert eStore instanceof DirectWriteBlueprintsResourceEStoreImpl : "Invalid EStore created";
    PersistenceBackend innerBackend = getInnerBackend(eStore);
    assert innerBackend == persistentBackend : "The backend in the EStore is not the created one";
}