List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:com.eviware.soapui.plugins.PluginManager.java
private Collection<JarClassLoader> findDependentClassLoaders(File pluginFile) throws IOException { if (resolver == null) { return Collections.emptySet(); }//from w ww.j a va 2 s .c o m Collection<PluginInfo> allDependencies = resolver.findAllDependencies(pluginFile); Set<JarClassLoader> classLoaders = new HashSet<JarClassLoader>(); for (PluginInfo dependency : allDependencies) { for (InstalledPluginRecord installedPluginRecord : installedPlugins.values()) { if (installedPluginRecord.plugin.getInfo().isCompatibleWith(dependency)) { classLoaders.add(installedPluginRecord.pluginClassLoader); break; } } } return classLoaders; }
From source file:io.gravitee.management.idp.core.plugin.impl.IdentityProviderManagerImpl.java
private <T> T create(Plugin plugin, Class<T> identityClass, Map<String, Object> properties) { if (identityClass == null) { return null; }/*from w w w . j a v a2s. c o m*/ try { T identityObj = createInstance(identityClass); final Import annImport = identityClass.getAnnotation(Import.class); Set<Class<?>> configurations = (annImport != null) ? new HashSet<>(Arrays.asList(annImport.value())) : Collections.emptySet(); ApplicationContext idpApplicationContext = pluginContextFactory .create(new AnnotationBasedPluginContextConfigurer(plugin) { @Override public Set<Class<?>> configurations() { return configurations; } @Override public ConfigurableEnvironment environment() { return new StandardEnvironment() { @Override protected void customizePropertySources(MutablePropertySources propertySources) { propertySources.addFirst(new MapPropertySource(plugin.id(), properties)); super.customizePropertySources(propertySources); } }; } }); idpApplicationContext.getAutowireCapableBeanFactory().autowireBean(identityObj); return identityObj; } catch (Exception ex) { LOGGER.error("An unexpected error occurs while loading identity provider", ex); return null; } }
From source file:org.grails.plugin.freemarker.AbstractTagLibAwareConfigurer.java
protected void reconfigure(Configuration configuration) { // TODO: Reconfiguration of reloaded tags if (configuration != null) { synchronized (configuration) { Boolean isConfigured = (Boolean) configuration .getCustomAttribute(AbstractTagLibAwareConfigurer.CONFIGURED_ATTRIBUTE_NAME); if (isConfigured == null || isConfigured == false) { try { ApplicationContext springContext = grailsApplication.getMainContext(); Map<String, Map<String, TemplateModel>> sharedVars = new LinkedHashMap<String, Map<String, TemplateModel>>(); GrailsClass[] tagLibClasses = grailsApplication.getArtefacts(TagLibArtefactHandler.TYPE); for (GrailsClass grailsClass : tagLibClasses) { GrailsTagLibClass tagLibClass = (GrailsTagLibClass) grailsClass; String namespace = tagLibClass.getNamespace(); if (log.isDebugEnabled()) { log.debug("reconfigure(): Exposing tag '" + namespace + "' (" + tagLibClass.getFullName() + ")"); }/*from ww w .j a va 2 s . c o m*/ GroovyObject tagLibInstance = getTagLibInstance(springContext, tagLibClass.getFullName()); Map<String, TemplateModel> sharedVar = sharedVars.get(namespace); if (sharedVar == null) { sharedVar = new LinkedHashMap<String, TemplateModel>(); sharedVars.put(namespace, sharedVar); } Set<String> tagNamesWithReturn = tagLibClass.getTagNamesThatReturnObject(); if (tagNamesWithReturn == null) { tagNamesWithReturn = Collections.emptySet(); } for (String tagName : tagLibClass.getTagNames()) { if (log.isDebugEnabled()) { log.debug("reconfigure(): tag " + tagName); } Object tagInstanceObject = null; try { tagInstanceObject = tagLibInstance.getProperty(tagName); } catch (IllegalStateException e) { /* * Workaround for properties exposed as tags * and dependent of RequestAttributes */ log.debug("reconfigure()", e); } if (tagInstanceObject != null && tagInstanceObject instanceof Closure) { Closure tagInstance = (Closure) tagInstanceObject; sharedVar.put(tagName, new TagLibToDirectiveAndFunction(namespace, tagLibInstance, tagName, tagInstance, tagNamesWithReturn.contains(tagName))); } } } for (Map.Entry<String, Map<String, TemplateModel>> entry : sharedVars.entrySet()) { if (log.isDebugEnabled()) { log.debug("reconfigure(): @" + entry.getKey() + ". = " + entry.getValue()); } configuration.setSharedVariable(entry.getKey(), entry.getValue()); } configuration.setCustomAttribute(AbstractTagLibAwareConfigurer.CONFIGURED_ATTRIBUTE_NAME, Boolean.TRUE); } catch (TemplateModelException e) { throw new RuntimeException(e); } } } } }
From source file:jenkins.plugins.git.GitSCMSourceContext.java
@NonNull public Collection<RefNameMapping> getRefNameMappings() { if (refNameMappings == null) { return Collections.emptySet(); } else {/*from ww w . j a v a 2s . com*/ return Collections.unmodifiableSet(refNameMappings); } }
From source file:com.tesora.dve.mysqlapi.repl.MyReplicationSlaveConfig.java
public Set<String> getIncludeDBList() { if (configFile == null) return Collections.emptySet(); if (includeDBList != null) return includeDBList; includeDBList = new HashSet<String>(Arrays.asList(configProps.getStringArray(REPL_INCLUDE_DB_KEY))); return includeDBList; }
From source file:org.osiam.auth.oauth_client.ClientEntity.java
@Override @JsonIgnore public Collection<GrantedAuthority> getAuthorities() { return Collections.emptySet(); }
From source file:io.cloudslang.lang.systemtests.BindingScopeTest.java
@Test public void testInputNotRequiredNull() throws Exception { URL resource = getClass().getResource("/yaml/check_weather_required_input_with_default.sl"); CompilationArtifact compilationArtifact = slang.compile(SlangSource.fromFile(resource.toURI()), new HashSet<SlangSource>()); Map<String, Value> userInputs = new HashMap<>(); userInputs.put("city", ValueFactory.create(null)); userInputs.put("input_with_default_value", ValueFactory.create("")); Set<SystemProperty> systemProperties = Collections.emptySet(); Map<String, StepData> steps = triggerWithData(compilationArtifact, userInputs, systemProperties).getSteps(); assertEquals("default_value", steps.get(EXEC_START_PATH).getInputs().get("input_with_default_value")); assertEquals(null, steps.get(EXEC_START_PATH).getInputs().get("city")); }
From source file:de.blizzy.documentr.web.access.RoleController.java
@ModelAttribute public RoleForm createRoleForm(@RequestParam(required = false) String name, @RequestParam(required = false) String originalName, @RequestParam(required = false) Set<String> permissions) { if (permissions == null) { permissions = Collections.emptySet(); }// w w w .j a va2s .c o m return (name != null) ? new RoleForm(name, originalName, permissions) : null; }
From source file:grails.plugin.springsecurity.web.access.GrailsWebInvocationPrivilegeEvaluator.java
static HttpServletRequest createInstance(final String contextPath, final String httpMethod, final String requestURI) { final Map<String, Object> attributes = new HashMap<String, Object>(); return (HttpServletRequest) Proxy.newProxyInstance(HttpServletRequest.class.getClassLoader(), new Class[] { HttpServletRequest.class }, new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) { String methodName = method.getName(); if ("getContextPath".equals(methodName)) return contextPath; if ("getMethod".equals(methodName)) return httpMethod; if ("getRequestURI".equals(methodName)) return requestURI; if ("setAttribute".equals(methodName)) { attributes.put((String) args[0], args[1]); return null; }//from w ww . j a va 2 s. c o m if ("getAttribute".equals(methodName)) { return attributes.get(args[0]); } if ("getProtocol".equals(methodName) || "getScheme".equals(methodName)) return "http"; if ("getServerName".equals(methodName)) return "localhost"; if ("getServerPort".equals(methodName)) return 8080; if (methodName.startsWith("is")) return false; if ("getParameterMap".equals(methodName)) return Collections.emptyMap(); if ("getAttributeNames".equals(methodName) || "getHeaderNames".equals(methodName) || "getHeaders".equals(methodName) || "getLocales".equals(methodName) || "getParameterNames".equals(methodName)) { return Collections.enumeration(Collections.emptySet()); } return null; } }); }
From source file:net.rim.ejde.internal.ui.launchers.LaunchUtils.java
/** * Get the projects defined in the given launch configuration. * * @param configuration//w ww. j av a2s . c om * The launch configuration * @return The collection of projects */ @SuppressWarnings("unchecked") public static Set<IProject> getProjectsFromConfiguration(ILaunchConfiguration configuration) { List<String> checkedProjectNames; try { checkedProjectNames = configuration.getAttribute(IFledgeLaunchConstants.ATTR_DEPLOYED_PROJECTS, Collections.EMPTY_LIST); } catch (CoreException e) { _logger.error(e); return Collections.emptySet(); } Set<IProject> checkedProjects = new HashSet<IProject>(); for (String name : checkedProjectNames) { IResource ires = ResourcesPlugin.getWorkspace().getRoot().findMember(name); if (ires != null && ires instanceof IProject) { IProject project = (IProject) ires; // this also filters out closed projects if (project.isOpen()) { checkedProjects.add(project); } } } return checkedProjects; }