List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY
String[] EMPTY_STRING_ARRAY
To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.
Click Source Link
String
array. From source file:com.cyclopsgroup.waterview.core.DefaultLookAndFeelService.java
/** * Overwrite or implement method getLayoutNames() * * @see com.cyclopsgroup.waterview.spi.LookAndFeelService#getLayoutNames() *//*ww w . j ava 2 s . com*/ public String[] getLayoutNames() { return (String[]) layouts.keySet().toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
From source file:jef.tools.security.EncrypterUtil.java
/** * ?????(???)/*from w ww. j av a 2 s . com*/ * * @param type * @return * @throws Exception */ @SuppressWarnings("unchecked") public static String[] getSupportedAlgorithmName(AlgorithmType type) throws Exception { Service[] algoms = getSupportedAlgorithm(type); MethodEx m = BeanUtils.getCompatibleMethod(Service.class, "getAliases"); List<String> names = new ArrayList<String>(); for (Service s : algoms) { names.add(s.getAlgorithm()); List<String> alias = ((List<String>) m.invoke(s)); names.addAll(alias); } return names.toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
From source file:loci.formats.in.MetamorphTiffReader.java
@Override public String[] getUsedFiles(boolean noPixels) { FormatTools.assertId(currentId, true, 1); return noPixels ? ArrayUtils.EMPTY_STRING_ARRAY : files; }
From source file:com.cyclopsgroup.waterview.core.DefaultModuleService.java
/** * Overwrite or implement method getPackageAliases() * * @see com.cyclopsgroup.waterview.spi.ModuleService#getPackageAliases() *///from ww w . ja v a2s . c o m public String[] getPackageAliases() { return (String[]) packageNames.keySet().toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
From source file:io.fabric8.elasticsearch.plugin.auth.OpenShiftTokenAuthenticationTest.java
@Test public void testAuthenticate() throws Exception { when(apiService.localSubjectAccessReview(anyString(), anyString(), anyString(), anyString(), anyString(), eq(ArrayUtils.EMPTY_STRING_ARRAY))).thenReturn(true); when(contextFactory.create(any(RestRequest.class))).thenReturn(context); threadContext.putTransient(ConfigurationSettings.OPENSHIFT_REQUEST_CONTEXT, new OpenshiftRequestContext(username, "atoken", false, Collections.emptySet(), null, null)); User expUser = new User(username); expUser.addRole(BaseRolesSyncStrategy.formatUserRoleName(username)); expUser.addRole(BaseRolesSyncStrategy.formatUserKibanaRoleName(username)); expUser.addRole(SearchGuardRolesMapping.ADMIN_ROLE); expUser.addRole("prometheus"); User user = backend.authenticate(new AuthCredentials(username)); assertEquals(expUser, user);//from w w w . jav a 2s .c o m }
From source file:com.norconex.collector.http.filter.impl.ExtensionURLFilter.java
public final void setExtensions(String extensions) { this.extensions = extensions; if (extensions != null) { this.extensionParts = extensions.split(","); } else {/*from w w w . j av a2 s .co m*/ this.extensionParts = ArrayUtils.EMPTY_STRING_ARRAY; } }
From source file:com.cyclopsgroup.tornado.security.impl.DefaultSecurityService.java
/** * @param userName Name of user// w w w .ja v a 2 s .com * @return Runtime user instance * @throws Exception Throw it out */ protected RuntimeUserAPI doLoadUser(String userName) throws Exception { User userModel = sem.findUserByName(userName); if (userModel == null) { throw new NoSuchUserException(userName); } DefaultRuntimeUser user = new DefaultRuntimeUser(userModel); List userRoles = sem.findRolesByUser(userModel.getId()); for (Iterator i = userRoles.iterator(); i.hasNext();) { user.addRole((Role) i.next()); } user.addRole(sem.findRoleByName(ROLE_GUEST)); if (!userName.equals(USER_GUEST)) { user.addRole(sem.findRoleByName(ROLE_USER)); } for (Iterator i = userModel.getGroups().iterator(); i.hasNext();) { Group group = (Group) i.next(); List groupRoles = sem.findRolesByGroup(group.getId()); for (Iterator j = groupRoles.iterator(); j.hasNext();) { user.addRole((Role) j.next()); } if (group.getName().equals(GROUP_ADMINS)) { user.addRole(sem.findRoleByName(ROLE_ADMIN)); } } String[] roleIdArray = (String[]) user.getRoleIds().toArray(ArrayUtils.EMPTY_STRING_ARRAY); List rps = sem.findRolePermissionsByRoles(roleIdArray); for (Iterator i = rps.iterator(); i.hasNext();) { RolePermission rp = (RolePermission) i.next(); try { PermissionType pt = (PermissionType) Class.forName(rp.getPermissionType()).newInstance(); Permission p = pt.createPermission(rp.getPermission()); user.addPermission(pt, p); } catch (Exception e) { getLogger().warn("Permission is not valid " + rp.getPermissionType() + "|" + rp.getPermission()); } } return user; }
From source file:gov.nih.nci.caarray.util.CaArrayHibernateHelperImpl.java
private String[] getGroupNames() { User user = CaArrayUsernameHolder.getCsmUser(); try {/* w w w . j a va 2s .c om*/ Set<Group> groups = SecurityUtils.getAuthorizationManager().getGroups(user.getUserId().toString()); String[] groupNames = new String[groups.size()]; int i = 0; for (Group g : groups) { groupNames[i++] = String.valueOf(g.getGroupId()); } return groupNames; } catch (CSObjectNotFoundException e) { LOG.error("Could not retrieve group names", e); return ArrayUtils.EMPTY_STRING_ARRAY; } }
From source file:gov.nih.nci.caarray.security.SecurityPolicy.java
/** * Returns whether the given property on the given entity object is allowed by this policy. * @param entity the object in question/*from w w w .j a v a2 s . c o m*/ * @param propertyName the name of the property on the object * @return whether this policy allows the specified property on the specified object to be seen */ private boolean allowProperty(PropertyAccessor propAccessor) { // NOPMD for some reason PMD thinks it's not used AttributePolicy attributePolicy = getAttributePolicy(propAccessor); String[] policyNames = ArrayUtils.EMPTY_STRING_ARRAY; if (attributePolicy != null) { policyNames = (mode == SecurityPolicyMode.WHITELIST) ? attributePolicy.allow() : attributePolicy.deny(); } boolean containsPolicy = ArrayUtils.contains(policyNames, name); return (mode == SecurityPolicyMode.WHITELIST) ? containsPolicy : !containsPolicy; }
From source file:io.fabric8.elasticsearch.plugin.OpenshiftAPIServiceTest.java
@Test public void testLocalSubjectAccessReviewWhenNotNonResourceURL() throws IOException { OkHttpClient okClient = mock(OkHttpClient.class); DefaultOpenShiftClient client = mock(DefaultOpenShiftClient.class); OpenShiftClientFactory factory = mock(OpenShiftClientFactory.class); Call call = mock(Call.class); when(factory.buildClient(anyString())).thenReturn(client); when(client.getHttpClient()).thenReturn(okClient); when(client.getMasterUrl()).thenReturn(new URL("https://localhost:8443/")); Response response = new Response.Builder() .request(new Request.Builder().url("https://localhost:8443").build()).code(201) .protocol(Protocol.HTTP_1_1).message("") .body(ResponseBody.create(MediaType.parse("application/json;utf-8"), "{\"allowed\":true}")).build(); RequestAnswer answer = new RequestAnswer(call); when(okClient.newCall(any(Request.class))).thenAnswer(answer); when(call.execute()).thenReturn(response); service = new OpenshiftAPIService(factory); assertTrue(service.localSubjectAccessReview("sometoken", "openshift-logging", "get", "pod/metrics", null, ArrayUtils.EMPTY_STRING_ARRAY)); Buffer buffer = new Buffer(); assertEquals("https://localhost:8443/apis/authorization.openshift.io/v1/subjectaccessreviews", answer.getRequest().url().toString()); answer.getRequest().body().writeTo(buffer); String exp = "{\"kind\":\"SubjectAccessReview\"," + "\"apiVersion\":\"authorization.openshift.io/v1\",\"verb\":\"get\",\"scopes\":[],\"resourceAPIGroup\":null," + "\"resource\":\"pod/metrics\",\"namespace\":\"openshift-logging\"}"; assertEquals(exp, new String(buffer.readByteArray())); }