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:io.fabric8.kubernetes.api.KubernetesHelper.java

/**
 * Returns all the current containers from the given currentState
 *///from   w ww .  ja va  2s  .  co m
public static Map<String, ContainerStatus> getCurrentContainers(Pod pod) {
    if (pod != null) {
        PodState currentState = pod.getCurrentState();
        return getCurrentContainers(currentState);

    }
    return Collections.EMPTY_MAP;
}

From source file:io.fabric8.kubernetes.api.KubernetesHelper.java

/**
 * Returns all the current containers from the given currentState
 *//*w w  w .  j a va2  s  .c o  m*/
public static Map<String, ContainerStatus> getCurrentContainers(PodState currentState) {
    if (currentState != null) {
        Map<String, ContainerStatus> info = currentState.getInfo();
        if (info != null) {
            return info;
        }
    }
    return Collections.EMPTY_MAP;
}

From source file:com.redhat.rhn.manager.errata.ErrataManager.java

/**
 * Returns the systems affected by a given errata
 *
 * @param user Logged-in user./*  w ww . j  ava2 s  . c o m*/
 * @param eid Errata ID.
 * @param pc PageControl
 * @return systems Affected by current errata, that are in the set of SSM.
 */
public static DataResult<SystemOverview> systemsAffectedInSet(User user, Long eid, PageControl pc) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("eid", eid);
    params.put("user_id", user.getId());
    return makeDataResult(params, Collections.EMPTY_MAP, pc,
            ModeFactory.getMode("Errata_queries", "in_set_and_affected_by_errata"));
}

From source file:com.senseidb.svc.impl.HttpRestSenseiServiceImpl.java

private static Map<String, String> convertJsonToStringMap(JSONObject jsonObject) throws JSONException {
    if (jsonObject == null)
        return Collections.EMPTY_MAP;

    @SuppressWarnings("unchecked")
    Iterator<String> nameItr = jsonObject.keys();

    Map<String, String> outMap = new HashMap<String, String>();
    while (nameItr.hasNext()) {
        String name = nameItr.next();
        outMap.put(name, jsonObject.getString(name));
    }//  ww w.  j  av  a 2  s  .  co  m

    return outMap;
}

From source file:org.cloudfoundry.identity.uaa.oauth.UaaTokenServices.java

@Override
public OAuth2AccessToken createAccessToken(OAuth2Authentication authentication) throws AuthenticationException {

    String userId = null;// ww w.j a v  a 2  s .  c om
    Date userAuthenticationTime = null;
    UaaUser user = null;
    boolean wasIdTokenRequestedThroughAuthCodeScopeParameter = false;
    Collection<GrantedAuthority> clientScopes = null;
    Set<String> authenticationMethods = null;
    Set<String> authNContextClassRef = null;
    // Clients should really by different kinds of users
    if (authentication.isClientOnly()) {
        ClientDetails client = clientDetailsService.loadClientByClientId(authentication.getName());
        clientScopes = client.getAuthorities();
    } else {
        userId = getUserId(authentication);
        user = userDatabase.retrieveUserById(userId);
        if (authentication.getUserAuthentication() instanceof UaaAuthentication) {
            userAuthenticationTime = new Date(
                    ((UaaAuthentication) authentication.getUserAuthentication()).getAuthenticatedTime());
            authenticationMethods = ((UaaAuthentication) authentication.getUserAuthentication())
                    .getAuthenticationMethods();
            authNContextClassRef = ((UaaAuthentication) authentication.getUserAuthentication())
                    .getAuthContextClassRef();
        }
    }

    ClientDetails client = clientDetailsService
            .loadClientByClientId(authentication.getOAuth2Request().getClientId());
    String clientSecretForHash = client.getClientSecret();
    if (clientSecretForHash != null && clientSecretForHash.split(" ").length > 1) {
        clientSecretForHash = clientSecretForHash.split(" ")[1];
    }
    String revocableHashSignature = UaaTokenUtils.getRevocableTokenSignature(client, clientSecretForHash, user);

    String tokenId = generateUniqueTokenId();
    String refreshTokenId = generateUniqueTokenId() + REFRESH_TOKEN_SUFFIX;

    boolean opaque = opaqueTokenRequired(authentication);
    boolean accessTokenRevocable = opaque
            || IdentityZoneHolder.get().getConfig().getTokenPolicy().isJwtRevocable();
    boolean refreshTokenRevocable = accessTokenRevocable || TokenConstants.TokenFormat.OPAQUE.getStringValue()
            .equals(IdentityZoneHolder.get().getConfig().getTokenPolicy().getRefreshTokenFormat());

    OAuth2RefreshToken refreshToken = createRefreshToken(refreshTokenId, authentication, revocableHashSignature,
            refreshTokenRevocable);

    String clientId = authentication.getOAuth2Request().getClientId();
    Set<String> userScopes = authentication.getOAuth2Request().getScope();
    String grantType = authentication.getOAuth2Request().getRequestParameters().get("grant_type");

    Set<String> modifiableUserScopes = new LinkedHashSet<>(userScopes);

    Set<String> externalGroupsForIdToken = Collections.EMPTY_SET;
    Map<String, List<String>> userAttributesForIdToken = Collections.EMPTY_MAP;
    if (authentication.getUserAuthentication() instanceof UaaAuthentication) {
        externalGroupsForIdToken = ((UaaAuthentication) authentication.getUserAuthentication())
                .getExternalGroups();
        userAttributesForIdToken = ((UaaAuthentication) authentication.getUserAuthentication())
                .getUserAttributes();
    }

    String nonce = authentication.getOAuth2Request().getRequestParameters().get(NONCE);

    Map<String, String> additionalAuthorizationAttributes = getAdditionalAuthorizationAttributes(
            authentication.getOAuth2Request().getRequestParameters().get("authorities"));

    if ("authorization_code"
            .equals(authentication.getOAuth2Request().getRequestParameters().get(OAuth2Utils.GRANT_TYPE))
            && "code".equals(
                    authentication.getOAuth2Request().getRequestParameters().get(OAuth2Utils.RESPONSE_TYPE))
            && authentication.getOAuth2Request().getRequestParameters().get(OAuth2Utils.SCOPE) != null
            && authentication.getOAuth2Request().getRequestParameters().get(OAuth2Utils.SCOPE)
                    .contains("openid")) {
        wasIdTokenRequestedThroughAuthCodeScopeParameter = true;
    }

    int zoneAccessTokenValidity = getZoneAccessTokenValidity();

    Integer validity = client.getAccessTokenValiditySeconds();
    Set<String> responseTypes = extractResponseTypes(authentication);

    Map<String, String> externalAttributes = null;
    if (uaaTokenEnhancer != null) {
        externalAttributes = uaaTokenEnhancer.getExternalAttributes(authentication);
    }

    CompositeAccessToken accessToken = createAccessToken(tokenId, userId, user, userAuthenticationTime,
            validity != null ? validity.intValue() : zoneAccessTokenValidity, clientScopes,
            modifiableUserScopes, clientId, authentication.getOAuth2Request().getResourceIds(), grantType,
            refreshToken != null ? refreshToken.getValue() : null, nonce, additionalAuthorizationAttributes,
            externalAttributes, responseTypes, revocableHashSignature,
            wasIdTokenRequestedThroughAuthCodeScopeParameter, externalGroupsForIdToken,
            userAttributesForIdToken, accessTokenRevocable, authenticationMethods, authNContextClassRef);

    return persistRevocableToken(tokenId, refreshTokenId, accessToken, refreshToken, clientId, userId, opaque,
            accessTokenRevocable);
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> setUIStateAction(String uid, Map<String, Number> tuts) {
    UIData tut = UIData.getEntity(uid);//from www .j a  va  2  s.  c  o m
    tut.setStates(tuts);

    return Collections.EMPTY_MAP;
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> saveSettingsAction(String uid, Map<String, Object> settings) {
    UserSettings userSettings = UserSettings.getEntity(uid);
    userSettings.setStates((Map) settings);

    return Collections.EMPTY_MAP;
}

From source file:org.alfresco.web.bean.users.CreateUserWizard.java

public Map getPersonPropertiesImmutability() {
    return Collections.EMPTY_MAP;
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> clearAllMailsAction(String uid) {
    MailBox mailBox = MailBox.getMailBoxOf(uid);
    MailServices.inst().clearAll(mailBox);

    return Collections.EMPTY_MAP;
}

From source file:org.apache.cocoon.Cocoon.java

/**
 * Get the sitemap component configurations
 * @since 2.1
 */
public Map getComponentConfigurations() {
    return Collections.EMPTY_MAP;
}