All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hazelcast.internal.serialization.impl.FactoryIdHelper Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hazelcast.internal.serialization.impl;

import com.hazelcast.logging.Logger;

public final class FactoryIdHelper {

    public static final String SPI_DS_FACTORY = "hazelcast.serialization.ds.spi";
    public static final int SPI_DS_FACTORY_ID = -1;

    public static final String PARTITION_DS_FACTORY = "hazelcast.serialization.ds.partition";
    public static final int PARTITION_DS_FACTORY_ID = -2;


    public static final String MAP_DS_FACTORY = "hazelcast.serialization.ds.map";
    public static final int MAP_DS_FACTORY_ID = -4;

    public static final String LOCK_DS_FACTORY = "hazelcast.serialization.ds.lock";
    public static final int LOCK_DS_FACTORY_ID = -8;

    public static final String TOPIC_DS_FACTORY = "hazelcast.serialization.ds.topic";
    public static final int TOPIC_DS_FACTORY_ID = -9;

    public static final String REPLICATED_MAP_DS_FACTORY = "hazelcast.serialization.ds.replicated_map";
    public static final int REPLICATED_MAP_DS_FACTORY_ID = -12;

    public static final String CACHE_DS_FACTORY = "hazelcast.serialization.ds.cache";
    public static final int CACHE_DS_FACTORY_ID = -13;

    public static final String RINGBUFFER_DS_FACTORY = "hazelcast.serialization.ds.ringbuffer";
    public static final int RINGBUFFER_DS_FACTORY_ID = -17;

    public static final String PREDICATE_DS_FACTORY = "hazelcast.serialization.ds.predicate";
    public static final int PREDICATE_DS_FACTORY_ID = -20;


    public static final String SCHEDULED_EXECUTOR_DS_FACTORY = "hazelcast.serialization.ds.scheduled.executor";
    public static final int SCHEDULED_EXECUTOR_DS_FACTORY_ID = -27;

    public static final String AGGREGATOR_DS_FACTORY = "hazelcast.serialization.ds.aggregator";
    public static final int AGGREGATOR_DS_FACTORY_ID = -29;

    public static final String PROJECTION_DS_FACTORY = "hazelcast.serialization.ds.projection";
    public static final int PROJECTION_DS_FACTORY_ID = -30;

    public static final String CONFIG_DS_FACTORY = "hazelcast.serialization.ds.config";
    public static final int CONFIG_DS_FACTORY_ID = -31;

    public static final String EVENT_JOURNAL_DS_FACTORY = "hazelcast.serialization.ds.event_journal";
    public static final int EVENT_JOURNAL_DS_FACTORY_ID = -33;

    public static final String UTIL_COLLECTION_DS_FACTORY = "hazelcast.serialization.util.collection";
    public static final int UTIL_COLLECTION_DS_FACTORY_ID = -40;

    public static final String SCHEMA_DS_FACTORY = "hazelcast.serialization.schema";
    public static final int SCHEMA_DS_FACTORY_ID = -42;

    public static final String BASIC_FUNCTIONS_DS_FACTORY = "hazelcast.serialization.lambda";
    public static final int BASIC_FUNCTIONS_DS_FACTORY_ID = -44;

    // factory ID 0 is reserved for Cluster objects (Data, Address, Member etc)...

    private FactoryIdHelper() {
    }

    public static int getFactoryId(String prop, int defaultId) {
        final String value = System.getProperty(prop);
        if (value != null) {
            try {
                return Integer.parseInt(value);
            } catch (NumberFormatException e) {
                Logger.getLogger(FactoryIdHelper.class).finest("Parameter for property prop could not be parsed", e);
            }
        }
        return defaultId;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy