List of usage examples for java.util Collections EMPTY_MAP
Map EMPTY_MAP
To view the source code for java.util Collections EMPTY_MAP.
Click Source Link
From source file:ddf.catalog.transformer.xml.MetacardMarshallerImpl.java
@Override public String marshal(Metacard metacard) throws XmlPullParserException, IOException, CatalogTransformerException { return marshal(metacard, Collections.EMPTY_MAP); }
From source file:org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline.java
/** * Executes the image converter pipeline. First, the image indicated by the ImageInfo instance * is loaded through an ImageLoader and then optionally converted by a series of * ImageConverters. At the end of the pipeline, the fully loaded and converted image is * returned.// ww w. ja v a2 s .c o m * @param info the image info object indicating the image to load * @param originalImage the original image to start the pipeline off or null if an ImageLoader * is used * @param hints a Map of image conversion hints * @param context the session context * @return the requested image * @throws ImageException if an error occurs while loader or converting the image * @throws IOException if an I/O error occurs */ public Image execute(ImageInfo info, Image originalImage, Map hints, ImageSessionContext context) throws ImageException, IOException { if (hints == null) { hints = Collections.EMPTY_MAP; } long start, duration; start = System.currentTimeMillis(); Image img = null; //Remember the last image in the pipeline that is cacheable and cache that. Image lastCacheableImage = null; int converterCount = converters.size(); int startingPoint = 0; if (cache != null) { for (int i = converterCount - 1; i >= 0; i--) { ImageConverter converter = getConverter(i); ImageFlavor flavor = converter.getTargetFlavor(); img = cache.getImage(info, flavor); if (img != null) { startingPoint = i + 1; break; } } if (img == null && loader != null) { //try target flavor of loader from cache ImageFlavor flavor = loader.getTargetFlavor(); img = cache.getImage(info, flavor); } } if (img == null && originalImage != null) { img = originalImage; } boolean entirelyInCache = true; if (img == null && loader != null) { //Load image img = loader.loadImage(info, hints, context); if (log.isTraceEnabled()) { duration = System.currentTimeMillis() - start; log.trace("Image loading using " + loader + " took " + duration + " ms."); } //Caching entirelyInCache = false; if (img.isCacheable()) { lastCacheableImage = img; } } if (img == null) { throw new ImageException("Pipeline fails. No ImageLoader and no original Image available."); } if (converterCount > 0) { for (int i = startingPoint; i < converterCount; i++) { ImageConverter converter = getConverter(i); start = System.currentTimeMillis(); img = converter.convert(img, hints); if (log.isTraceEnabled()) { duration = System.currentTimeMillis() - start; log.trace("Image conversion using " + converter + " took " + duration + " ms."); } //Caching entirelyInCache = false; if (img.isCacheable()) { lastCacheableImage = img; } } } //Note: Currently we just cache the end result of the pipeline, not all intermediate //results as it is expected that the cache hit ration would be rather small. if (cache != null && !entirelyInCache) { if (lastCacheableImage == null) { //Try to make the Image cacheable lastCacheableImage = forceCaching(img); } if (lastCacheableImage != null) { if (log.isTraceEnabled()) { log.trace("Caching image: " + lastCacheableImage); } cache.putImage(lastCacheableImage); } } return img; }
From source file:org.apache.james.mime4j.field.ContentTypeField.java
/** * Gets all parameters.//from www . ja v a 2 s . c o m * * @return the parameters. */ public Map getParameters() { return parameters != null ? Collections.unmodifiableMap(parameters) : Collections.EMPTY_MAP; }
From source file:org.codehaus.groovy.grails.scaffolding.DefaultScaffoldRequestHandler.java
public Map handleDelete(HttpServletRequest request, HttpServletResponse response, ScaffoldCallback callback) { Serializable id = getRequestId(); if (id == null) { LOG.debug("[ScaffoldRequestHandler] No ID parameter [" + id + "] for request [delete]"); callback.setInvoked(false);//from w w w . ja v a2 s.co m return Collections.EMPTY_MAP; } Map model = new HashMap(); Object domainObject = domain.get(id); model.put(domain.getSingularName(), domainObject); if (domainObject != null) { domain.delete(id); callback.setInvoked(true); } return model; }
From source file:org.eclipselabs.spray.xtext.ui.internal.RegisterPlatformGenmodelListener.java
protected void registerGenmodel(IFile file) { ResourceSet rs = new ResourceSetImpl(); Resource emfResource = rs//from w ww .j ava2 s. c om .createResource(URI.createPlatformResourceURI((file.getFullPath().toPortableString()), true)); try { emfResource.load(Collections.EMPTY_MAP); genModelHelper.registerGenModel(emfResource.getResourceSet(), emfResource.getURI()); emfResource.unload(); } catch (Exception e) { SprayActivatorExt.getInstance().getLog() .log(new Status(IStatus.WARNING, "org.eclipselabs.spray.xtext.ui", "Error loading genmodel " + emfResource.getURI().toString(), e)); } }
From source file:eu.brokeratcloud.fpr.model.DivaRoot.java
public DivaRoot(URI uri) { ResourceSet rs = new ResourceSetImpl(); rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("diva", new XMIResourceFactoryImpl()); Resource res = rs.createResource(uri); try {/*from w w w . j a v a2s . c o m*/ res.load(Collections.EMPTY_MAP); this.root = (VariabilityModel) res.getContents().get(0); } catch (Exception e) { this.root = DivaFactory.eINSTANCE.createVariabilityModel(); SimulationModel simu = DivaFactory.eINSTANCE.createSimulationModel(); Scenario scenario = DivaFactory.eINSTANCE.createScenario(); Context ctx = DivaFactory.eINSTANCE.createContext(); scenario.getContext().add(ctx); simu.getScenario().add(scenario); root.setSimulation(simu); res.getContents().add(this.root); try { res.save(Collections.EMPTY_MAP); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // e.printStackTrace(); } }
From source file:eu.agilejava.snoopee.scan.SnoopEERegistrationClient.java
private void readConfiguration() throws SnoopEEConfigurationException { Map<String, Object> snoopConfig = Collections.EMPTY_MAP; try {/*from www .j a v a 2 s . co m*/ Yaml yaml = new Yaml(); Map<String, Object> props = (Map<String, Object>) yaml .load(Thread.currentThread().getContextClassLoader().getResourceAsStream("/snoopee.yml")); snoopConfig = (Map<String, Object>) props.get("snoopee"); } catch (YAMLException e) { LOGGER.config(() -> "No configuration file. Using env properties."); } applicationConfig.setServiceName(SnoopEEExtensionHelper.getServiceName()); final String host = readProperty("host", snoopConfig); final String port = readProperty("port", snoopConfig); applicationConfig.setServiceHome(host + ":" + port + "/"); applicationConfig.setServiceRoot(readProperty("serviceRoot", snoopConfig)); LOGGER.config(() -> "application config: " + applicationConfig.toJSON()); serviceUrl = "http://" + readProperty("snoopeeService", snoopConfig); }
From source file:org.jhk.pulsing.web.service.prod.PulseService.java
/** * Hmmm should work in DRPC from storm+trident to get notified of new batch and then send * the message to client component for new set? Look into it since familiar only w/ trident * /*from w ww . java 2 s.c o m*/ * @param numMinutes * @return */ @Override public Map<Long, String> getTrendingPulseSubscriptions(int numMinutes) { Instant current = Instant.now(); Instant beforeRange = current.minus(numMinutes, ChronoUnit.MINUTES); Optional<Set<String>> optTps = redisPulseDao.getTrendingPulseSubscriptions(beforeRange.getEpochSecond(), current.getEpochSecond()); @SuppressWarnings("unchecked") Map<Long, String> tpSubscriptions = Collections.EMPTY_MAP; if (optTps.isPresent()) { tpSubscriptions = PulseServiceUtil.processTrendingPulseSubscribe(optTps.get(), _objectMapper); } ; return tpSubscriptions; }
From source file:org.hyperic.hq.appdef.server.session.AgentPluginUpdaterImpl.java
@Transactional(readOnly = false) public void queuePluginTransfer(Map<Integer, Collection<Plugin>> updates, Map<Integer, Collection<String>> removes, boolean restartAgents) { if (isDisabled()) { return;/*from w w w . j a v a 2s . c o m*/ } @SuppressWarnings("unchecked") final Map<Integer, Collection<Plugin>> updateMap = (updates == null) ? Collections.EMPTY_MAP : updates; @SuppressWarnings("unchecked") final Map<Integer, Collection<String>> removeMap = (removes == null) ? Collections.EMPTY_MAP : removes; if (restartAgents) { pluginManager.updateAgentPluginSyncStatus(AgentPluginStatusEnum.SYNC_IN_PROGRESS, updateMap, removeMap); } else { pluginManager.updateAgentPluginSyncStatus(AgentPluginStatusEnum.SYNC_FAILURE, updateMap, removeMap); } // want jobs to get added to the agentSynchronizer after commit to ensure that we don't // have agents restarting and updating status before the status is updated as a result // of the updateAgentPluginSyncStatus() call. If the queuing was not called this way we // could have agents sitting in the "IN-PROGRESS" state indefinitely because they were // updated out of order zeventManager.enqueueEventAfterCommit(new PluginStatusUpdatedZevent(restartAgents, updateMap, removeMap)); }
From source file:de.javakaffee.kryoserializers.KryoTest.java
@BeforeTest protected void beforeTest() { _kryo = new KryoReflectionFactorySupport() { @Override//from w w w . ja va2 s . c om @SuppressWarnings({ "rawtypes", "unchecked" }) public Serializer<?> getDefaultSerializer(final Class type) { if (EnumSet.class.isAssignableFrom(type)) { return new EnumSetSerializer(); } if (EnumMap.class.isAssignableFrom(type)) { return new EnumMapSerializer(); } if (Collection.class.isAssignableFrom(type)) { return new CopyForIterateCollectionSerializer(); } if (Map.class.isAssignableFrom(type)) { return new CopyForIterateMapSerializer(); } if (Date.class.isAssignableFrom(type)) { return new DateSerializer(type); } return super.getDefaultSerializer(type); } }; _kryo.setRegistrationRequired(false); _kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer()); _kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer()); _kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer()); _kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer()); _kryo.register(Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer()); _kryo.register(Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer()); _kryo.register(Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer()); _kryo.register(BigDecimal.class, new BigDecimalSerializer()); _kryo.register(BigInteger.class, new BigIntegerSerializer()); _kryo.register(Pattern.class, new RegexSerializer()); _kryo.register(BitSet.class, new BitSetSerializer()); _kryo.register(URI.class, new URISerializer()); _kryo.register(UUID.class, new UUIDSerializer()); _kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer()); _kryo.register(InvocationHandler.class, new JdkProxySerializer()); UnmodifiableCollectionsSerializer.registerSerializers(_kryo); SynchronizedCollectionsSerializer.registerSerializers(_kryo); }