List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:be.fedict.hsm.admin.webapp.KeyStoreController.java
public List<CertificateView> getCertificates() { if (null == this.selectedKeyStoreAlias) { return Collections.EMPTY_LIST; }/* ww w. j a v a 2 s . c o m*/ List<X509Certificate> certificateChain = this.keyStoreManagerBean .getCertificateChain(this.selectedKeyStore.getId(), this.selectedKeyStoreAlias); LOG.debug("getCertificates: " + certificateChain.size()); List<CertificateView> certificateChainView = new LinkedList<CertificateView>(); for (X509Certificate certificate : certificateChain) { CertificateView certificateView = new CertificateView(certificate); certificateChainView.add(certificateView); } return certificateChainView; }
From source file:com.dianping.cache.remote.jms.CacheMessageProducerAMQ.java
@SuppressWarnings("unchecked") private List<String> getMailReceivers() { String receivers = null;// www .j a v a 2 s .c om try { receivers = ConfigCache.getInstance().getProperty(CONFIG_KEY_ACTIVEMQ_ERRMAIL_RECEIVERS); } catch (Throwable e) { logger.warn("Get config[" + CONFIG_KEY_ACTIVEMQ_ERRMAIL_RECEIVERS + "] from lion failed.", e); } return StringUtils.isNotBlank(receivers) ? Arrays.asList(StringUtils.split(receivers, ",")) : Collections.EMPTY_LIST; }
From source file:com.heliosapm.opentsdb.client.jvmjmx.custom.aggregation.AggregateFunction.java
/** * Computes and returns the aggregate for the named aggregator and object of nput items. * The object is introspected to determine if it is:<ul> * <li>Null</li>//from www . j a v a2 s . com * <li>{@link java.util.Map}</li> * <li>{@link java.util.Collection}</li> * <li>An array</li> * </ul>. * If it is none of the above, a runtime exception is thrown. * If it is a map or an array, it is converted to a list for aggregate computation. * @param name The name of the aggregator function * @param item The object of items to aggregate * @return the aggregate value * TODO: Do we need to support multi dimmensional arrays ? */ @SuppressWarnings("unchecked") public static Object aggregate(CharSequence name, Object item) { final List<Object> items; final AggregateFunction function = AggregateFunction.forName(name); if (item == null) { items = Collections.EMPTY_LIST; } else if (item instanceof Map) { Map<Object, Object> map = (Map<Object, Object>) item; items = new ArrayList<Object>(map.keySet()); } else if (item instanceof Collection) { items = new ArrayList<Object>((Collection<Object>) item); } else if (item.getClass().isArray()) { int length = Array.getLength(item); items = new ArrayList<Object>(length); for (int i = 0; i < length; i++) { items.add(i, Array.get(item, i)); } } else { throw new IllegalArgumentException("Aggregate object of type [" + item.getClass().getName() + "] was not a Map, Collection or Array", new Throwable()); } return function.aggregate(items); }
From source file:com.creactiviti.piper.core.Coordinator.java
private void validate(MapObject aCreateJobParams, Pipeline aPipeline) { // validate inputs Map<String, Object> inputs = aCreateJobParams.getMap(DSL.INPUTS, Collections.EMPTY_MAP); List<Accessor> input = aPipeline.getInputs(); for (Accessor in : input) { if (in.getBoolean(DSL.REQUIRED, false)) { Assert.isTrue(inputs.containsKey(in.get(DSL.NAME)), "Missing required param: " + in.get("name")); }/*from w w w . j a v a 2 s.c om*/ } // validate webhooks List<Accessor> webhooks = aCreateJobParams.getList(WEBHOOKS, MapObject.class, Collections.EMPTY_LIST); for (Accessor webhook : webhooks) { Assert.notNull(webhook.getString(DSL.TYPE), "must define 'type' on webhook"); Assert.notNull(webhook.getString(DSL.URL), "must define 'url' on webhook"); } }
From source file:com.haulmont.cuba.gui.data.impl.EmbeddedDatasourceImpl.java
@Override public Collection<T> getItemsToUpdate() { return Collections.EMPTY_LIST; }
From source file:com.sun.faces.context.FacesContextImpl.java
public Iterator getMessages(String clientId) { assertNotReleased();// w w w . j a va 2s . com // If no messages have been enqueued at all, // return an empty List Iterator if (null == componentMessageLists) { return (Collections.EMPTY_LIST.iterator()); } List list = (List) componentMessageLists.get(clientId); if (list == null) { return (Collections.EMPTY_LIST.iterator()); } return (list.iterator()); }
From source file:azkaban.project.FlowLoaderUtils.java
/** * Adds email properties to a flow./*from w w w.ja va2 s .co m*/ * * @param flow the flow * @param prop the prop */ public static void addEmailPropsToFlow(final Flow flow, final Props prop) { final List<String> successEmailList = prop.getStringList(CommonJobProperties.SUCCESS_EMAILS, Collections.EMPTY_LIST); final Set<String> successEmail = new HashSet<>(); for (final String email : successEmailList) { successEmail.add(email.toLowerCase()); } final List<String> failureEmailList = prop.getStringList(CommonJobProperties.FAILURE_EMAILS, Collections.EMPTY_LIST); final Set<String> failureEmail = new HashSet<>(); for (final String email : failureEmailList) { failureEmail.add(email.toLowerCase()); } final List<String> notifyEmailList = prop.getStringList(CommonJobProperties.NOTIFY_EMAILS, Collections.EMPTY_LIST); for (String email : notifyEmailList) { email = email.toLowerCase(); successEmail.add(email); failureEmail.add(email); } flow.addFailureEmails(failureEmail); flow.addSuccessEmails(successEmail); }
From source file:org.miloss.fgsms.bueller.Bueller.java
/** * provides a wrapper for getting alternate urls without passing a db * connection/*from w w w.ja v a2s. c om*/ * * @param url * @param pooled * @return */ protected static List<String> GetAlternateUrls(String url, boolean pooled) { java.sql.Connection perf = null; if (pooled) { perf = Utility.getPerformanceDBConnection(); } else { perf = Utility.getPerformanceDB_NONPOOLED_Connection(); } List<String> ret = Collections.EMPTY_LIST; try { ret = GetAlternateUrls(url, perf); } catch (Exception ex) { log.log(Level.ERROR, null, ex); } finally { DBUtils.safeClose(perf); } return ret; }
From source file:com.haulmont.cuba.gui.data.impl.EmbeddedDatasourceImpl.java
@Override public Collection<T> getItemsToDelete() { return Collections.EMPTY_LIST; }
From source file:com.xpn.xwiki.XWikiTest.java
@Override protected void setUp() throws Exception { super.setUp(); this.document = new XWikiDocument(new DocumentReference("Wiki", "MilkyWay", "Fidis")); getContext().setRequest(new XWikiServletRequestStub()); getContext().setURL(new URL("http://localhost:8080/xwiki/bin/view/MilkyWay/Fidis")); this.xwiki = new XWiki(new XWikiConfig(), getContext()) { protected void registerWikiMacros() { }/*from www . j ava 2s . c o m*/ // Avoid all the error at XWiki initialization @Override public String getXWikiPreference(String prefname, String defaultValue, XWikiContext context) { if (prefname.equals("plugins") || prefname.startsWith("macros_")) { return defaultValue; } else { return super.getXWikiPreference(prefname, defaultValue, context); } } }; getContext().setWiki(this.xwiki); // Ensure that no Velocity Templates are going to be used when executing Velocity since otherwise // the Velocity init would fail (since by default the macros.vm templates wouldn't be found as we're // not providing it in our unit test resources). this.xwiki.getConfig().setProperty("xwiki.render.velocity.macrolist", ""); this.mockXWikiStore = mock(XWikiHibernateStore.class, new Class[] { XWiki.class, XWikiContext.class }, new Object[] { this.xwiki, getContext() }); this.mockXWikiStore.stubs().method("loadXWikiDoc") .will(new CustomStub("Implements XWikiStoreInterface.loadXWikiDoc") { public Object invoke(Invocation invocation) throws Throwable { XWikiDocument shallowDoc = (XWikiDocument) invocation.parameterValues.get(0); if (XWikiTest.this.docs.containsKey(shallowDoc.getName())) { return XWikiTest.this.docs.get(shallowDoc.getName()); } else { return shallowDoc; } } }); this.mockXWikiStore.stubs().method("saveXWikiDoc") .will(new CustomStub("Implements XWikiStoreInterface.saveXWikiDoc") { public Object invoke(Invocation invocation) throws Throwable { XWikiDocument document = (XWikiDocument) invocation.parameterValues.get(0); document.setNew(false); document.setStore((XWikiStoreInterface) XWikiTest.this.mockXWikiStore.proxy()); XWikiTest.this.docs.put(document.getName(), document); return null; } }); this.mockXWikiStore.stubs().method("deleteXWikiDoc") .will(new CustomStub("Implements XWikiStoreInterface.deleteXWikiDoc") { public Object invoke(Invocation invocation) throws Throwable { XWikiDocument document = (XWikiDocument) invocation.parameterValues.get(0); XWikiTest.this.docs.remove(document.getName()); return null; } }); this.mockXWikiStore.stubs().method("getTranslationList").will(returnValue(Collections.EMPTY_LIST)); this.mockXWikiStore.stubs().method("exists").will(returnValue(true)); this.mockXWikiVersioningStore = mock(XWikiHibernateVersioningStore.class, new Class[] { XWiki.class, XWikiContext.class }, new Object[] { this.xwiki, getContext() }); this.mockXWikiVersioningStore.stubs().method("getXWikiDocumentArchive").will(returnValue(null)); this.mockXWikiVersioningStore.stubs().method("resetRCSArchive").will(returnValue(null)); this.xwiki.setStore((XWikiStoreInterface) this.mockXWikiStore.proxy()); this.xwiki.setVersioningStore((XWikiVersioningStoreInterface) this.mockXWikiVersioningStore.proxy()); this.xwiki.saveDocument(this.document, getContext()); this.document.setCreator("Condor"); this.document.setAuthor("Albatross"); this.xwiki.saveDocument(this.document, getContext()); }