Search in sources :

Example 1 with Boolean.parseBoolean

use of java.lang.Boolean.parseBoolean in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleNearCacheConfig.

private NearCacheConfig handleNearCacheConfig(Node node, NearCacheConfig existingNearCacheConfig) {
    String name = getAttribute(node, "name");
    name = name == null ? NearCacheConfig.DEFAULT_NAME : name;
    NearCacheConfig nearCacheConfig = existingNearCacheConfig != null ? existingNearCacheConfig : new NearCacheConfig(name);
    Boolean serializeKeys = null;
    for (Node child : childElements(node)) {
        String nodeName = cleanNodeName(child);
        if (matches("time-to-live-seconds", nodeName)) {
            nearCacheConfig.setTimeToLiveSeconds(Integer.parseInt(getTextContent(child)));
        } else if (matches("max-idle-seconds", nodeName)) {
            nearCacheConfig.setMaxIdleSeconds(Integer.parseInt(getTextContent(child)));
        } else if (matches("in-memory-format", nodeName)) {
            nearCacheConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(getTextContent(child))));
        } else if (matches("serialize-keys", nodeName)) {
            serializeKeys = Boolean.parseBoolean(getTextContent(child));
            nearCacheConfig.setSerializeKeys(serializeKeys);
        } else if (matches("invalidate-on-change", nodeName)) {
            nearCacheConfig.setInvalidateOnChange(Boolean.parseBoolean(getTextContent(child)));
        } else if (matches("cache-local-entries", nodeName)) {
            nearCacheConfig.setCacheLocalEntries(Boolean.parseBoolean(getTextContent(child)));
        } else if (matches("local-update-policy", nodeName)) {
            NearCacheConfig.LocalUpdatePolicy policy = NearCacheConfig.LocalUpdatePolicy.valueOf(getTextContent(child));
            nearCacheConfig.setLocalUpdatePolicy(policy);
        } else if (matches("eviction", nodeName)) {
            nearCacheConfig.setEvictionConfig(getEvictionConfig(child, true, false));
        }
    }
    if (serializeKeys != null && !serializeKeys && nearCacheConfig.getInMemoryFormat() == InMemoryFormat.NATIVE) {
        LOGGER.warning("The Near Cache doesn't support keys by-reference with NATIVE in-memory-format." + " This setting will have no effect!");
    }
    return nearCacheConfig;
}
Also used : Node(org.w3c.dom.Node) NearCacheConfig(com.hazelcast.config.NearCacheConfig) Boolean.parseBoolean(java.lang.Boolean.parseBoolean)

Example 2 with Boolean.parseBoolean

use of java.lang.Boolean.parseBoolean in project coprhd-controller by CoprHD.

the class BlockService method pauseMirrors.

/**
 * Pause the specified mirror(s) for the source volume
 *
 * @param id
 *            the URN of a ViPR Source volume
 * @param sync
 *            flag for pause operation; true=split, false=fracture
 * @param copyID
 *            copyID Copy volume ID, none specified pauses all copies
 *
 * @return TaskList
 */
private TaskList pauseMirrors(URI id, String sync, URI copyID) {
    Volume sourceVolume = queryVolumeResource(id);
    ArgValidator.checkEntity(sourceVolume, id, true);
    StringSet mirrors = sourceVolume.getMirrors();
    if (mirrors == null || mirrors.isEmpty()) {
        throw APIException.badRequests.invalidParameterVolumeHasNoContinuousCopies(sourceVolume.getId());
    }
    ArrayList<BlockMirror> mirrorList = null;
    if (copyID != null) {
        BlockMirror mirror = queryMirror(copyID);
        ArgValidator.checkEntity(mirror, copyID, true);
        if (!mirror.getSource().getURI().equals(id)) {
            throw APIException.badRequests.invalidParameterBlockCopyDoesNotBelongToVolume(copyID, id);
        } else {
            mirrorList = new ArrayList();
            mirrorList.add(mirror);
        }
    }
    if (sync != null) {
        ArgValidator.checkFieldValueFromArrayIgnoreCase(sync, ProtectionOp.SYNC.getRestOp(), TRUE_STR, FALSE_STR);
    }
    Boolean syncParam = Boolean.parseBoolean(sync);
    String task = UUID.randomUUID().toString();
    StorageSystem device = _dbClient.queryObject(StorageSystem.class, sourceVolume.getStorageController());
    BlockServiceApi blockServiceApi = getBlockServiceImpl("mirror");
    auditOp(OperationTypeEnum.FRACTURE_VOLUME_MIRROR, true, AuditLogManager.AUDITOP_BEGIN, mirrorList == null ? mirrors : mirrorList, sync);
    return blockServiceApi.pauseNativeContinuousCopies(device, sourceVolume, mirrorList, syncParam, task);
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) MapVolume(com.emc.storageos.api.mapper.functions.MapVolume) Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) ArrayList(java.util.ArrayList) Boolean.parseBoolean(java.lang.Boolean.parseBoolean) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

Boolean.parseBoolean (java.lang.Boolean.parseBoolean)2 MapVolume (com.emc.storageos.api.mapper.functions.MapVolume)1 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 Volume (com.emc.storageos.db.client.model.Volume)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 ArrayList (java.util.ArrayList)1 Node (org.w3c.dom.Node)1