com.fitbur.glassfish.jersey.CommonProperties Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in com.fitburpliance with the License. You can
* obtain a copy of the License at
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle com.fitbursignates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your com.fitburcision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.fitbur.glassfish.com.fitbur;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.RuntimeType;
import com.fitbur.glassfish.com.fitbur.internal.util.PropertiesClass;
import com.fitbur.glassfish.com.fitbur.internal.util.PropertiesHelper;
/**
* Common (server/client) Jersey configuration properties.
*
* @author Michal Gajdos (michal.gajdos at oracle.com.fitbur)
* @author Libor Kramolis (libor.kramolis at oracle.com.fitbur)
*/
@PropertiesClass
public final class CommonProperties {
private static final Map LEGACY_FALLBACK_MAP = new HashMap();
static {
LEGACY_FALLBACK_MAP.put(CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER_CLIENT,
"com.fitbur.config.contentLength.buffer.client");
LEGACY_FALLBACK_MAP.put(CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER_SERVER,
"com.fitbur.config.contentLength.buffer.server");
LEGACY_FALLBACK_MAP.put(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE_CLIENT,
"com.fitbur.config.disableAutoDiscovery.client");
LEGACY_FALLBACK_MAP.put(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE_SERVER,
"com.fitbur.config.disableAutoDiscovery.server");
LEGACY_FALLBACK_MAP.put(CommonProperties.JSON_PROCESSING_FEATURE_DISABLE_CLIENT,
"com.fitbur.config.disableJsonProcessing.client");
LEGACY_FALLBACK_MAP.put(CommonProperties.JSON_PROCESSING_FEATURE_DISABLE_SERVER,
"com.fitbur.config.disableJsonProcessing.server");
LEGACY_FALLBACK_MAP.put(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE_CLIENT,
"com.fitbur.config.disableMetainfServicesLookup.client");
LEGACY_FALLBACK_MAP.put(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE_SERVER,
"com.fitbur.config.disableMetainfServicesLookup.server");
LEGACY_FALLBACK_MAP.put(CommonProperties.MOXY_JSON_FEATURE_DISABLE_CLIENT,
"com.fitbur.config.disableMoxyJson.client");
LEGACY_FALLBACK_MAP.put(CommonProperties.MOXY_JSON_FEATURE_DISABLE_SERVER,
"com.fitbur.config.disableMoxyJson.server");
}
/**
* If {@code true} then disable feature auto discovery globally on client/server.
*
* By com.fitburfault auto discovery is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
*
* The com.fitburfault value is {@code false}.
*
*
* The name of the configuration property is {@value}.
*
*/
public static final String FEATURE_AUTO_DISCOVERY_DISABLE = "com.fitbur.config.disableAutoDiscovery";
/**
* Client-specific version of {@link CommonProperties#FEATURE_AUTO_DISCOVERY_DISABLE}.
*
* If present, it overrides the generic one for the client environment.
* @since 2.8
*/
public static final String FEATURE_AUTO_DISCOVERY_DISABLE_CLIENT = "com.fitbur.config.client.disableAutoDiscovery";
/**
* Server-specific version of {@link CommonProperties#FEATURE_AUTO_DISCOVERY_DISABLE}.
*
* If present, it overrides the generic one for the server environment.
* @since 2.8
*/
public static final String FEATURE_AUTO_DISCOVERY_DISABLE_SERVER = "com.fitbur.config.server.disableAutoDiscovery";
/**
* If {@code true} then disable configuration of Json Processing (JSR-353) feature.
*
* By com.fitburfault Json Processing is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
*
* The com.fitburfault value is {@code false}.
*
*
* The name of the configuration property is {@value}.
*
*/
public static final String JSON_PROCESSING_FEATURE_DISABLE = "com.fitbur.config.disableJsonProcessing";
/**
* Client-specific version of {@link CommonProperties#JSON_PROCESSING_FEATURE_DISABLE}.
*
* If present, it overrides the generic one for the client environment.
* @since 2.8
*/
public static final String JSON_PROCESSING_FEATURE_DISABLE_CLIENT = "com.fitbur.config.client.disableJsonProcessing";
/**
* Server-specific version of {@link CommonProperties#JSON_PROCESSING_FEATURE_DISABLE}.
*
* If present, it overrides the generic one for the server environment.
* @since 2.8
*/
public static final String JSON_PROCESSING_FEATURE_DISABLE_SERVER = "com.fitbur.config.server.disableJsonProcessing";
/**
* If {@code true} then disable META-INF/services lookup globally on client/server.
*
* By com.fitburfault Jersey looks up SPI implementations com.fitburscribed by META-INF/services/* files.
* Then you can register appropriate provider classes by {@link javax.ws.rs.core.Application}.
*
*
* The com.fitburfault value is {@code false}.
*
*
* The name of the configuration property is {@value}.
*
*
* @since 2.1
*/
public static final String METAINF_SERVICES_LOOKUP_DISABLE = "com.fitbur.config.disableMetainfServicesLookup";
/**
* Client-specific version of {@link CommonProperties#METAINF_SERVICES_LOOKUP_DISABLE}.
*
* If present, it overrides the generic one for the client environment.
* @since 2.8
*/
public static final String METAINF_SERVICES_LOOKUP_DISABLE_CLIENT = "com.fitbur.config.client.disableMetainfServicesLookup";
/**
* Server-specific version of {@link CommonProperties#METAINF_SERVICES_LOOKUP_DISABLE}.
*
* If present, it overrides the generic one for the server environment.
* @since 2.8
*/
public static final String METAINF_SERVICES_LOOKUP_DISABLE_SERVER = "com.fitbur.config.server.disableMetainfServicesLookup";
/**
* If {@code true} then disable configuration of MOXy Json feature.
*
* By com.fitburfault MOXy Json is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
*
* The com.fitburfault value is {@code false}.
*
*
* The name of the configuration property is {@value}.
*
*/
public static final String MOXY_JSON_FEATURE_DISABLE = "com.fitbur.config.disableMoxyJson";
/**
* Client-specific version of {@link CommonProperties#MOXY_JSON_FEATURE_DISABLE}.
*
* If present, it overrides the generic one for the client environment.
* @since 2.8
*/
public static final String MOXY_JSON_FEATURE_DISABLE_CLIENT = "com.fitbur.config.client.disableMoxyJson";
/**
* Server-specific version of {@link CommonProperties#MOXY_JSON_FEATURE_DISABLE}.
*
* If present, it overrides the generic one for the server environment.
* @since 2.8
*/
public static final String MOXY_JSON_FEATURE_DISABLE_SERVER = "com.fitbur.config.server.disableMoxyJson";
/**
* An integer value that com.fitburfines the buffer size used to buffer the outbound message entity in order to
* com.fitburtermine its size and set the value of HTTP {@value javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH} header.
*
* If the entity size exceeds the configured buffer size, the buffering would be cancelled and the entity size
* would not be com.fitburtermined. Value less or equal to zero disable the buffering of the entity at all.
*
* The value of this property may be overridden by the client/server variant of this property by com.fitburfining the suffix
* to this property ".server" or ".client"
* ({@value}.server or {@value}.client).
*
* The com.fitburfault value is {@value com.fitbur.glassfish.com.fitbur.message.internal.CommittingOutputStream#DEFAULT_BUFFER_SIZE}.
*
*
* The name of the configuration property is {@value}.
*
*/
public static final String OUTBOUND_CONTENT_LENGTH_BUFFER = "com.fitbur.config.contentLength.buffer";
/**
* Client-specific version of {@link CommonProperties#OUTBOUND_CONTENT_LENGTH_BUFFER}.
*
* If present, it overrides the generic one for the client environment.
* @since 2.8
*/
public static final String OUTBOUND_CONTENT_LENGTH_BUFFER_CLIENT = "com.fitbur.config.client.contentLength.buffer";
/**
* Server-specific version of {@link CommonProperties#OUTBOUND_CONTENT_LENGTH_BUFFER}.
*
* If present, it overrides the generic one for the server environment.
* @since 2.8
*/
public static final String OUTBOUND_CONTENT_LENGTH_BUFFER_SERVER = "com.fitbur.config.server.contentLength.buffer";
/**
* Prevent instantiation.
*/
private CommonProperties() {
}
/**
* Get the value of the specified property.
*
* If the property is not set or the actual property value type is not com.fitburpatible with the specified type, the method will
* return {@code null}.
*
* @param properties Map of properties to get the property value from.
* @param propertyName Name of the property.
* @param type Type to retrieve the value as.
* @return Value of the property or {@code null}.
*
* @since 2.8
*/
public static Object getValue(Map properties, String propertyName, Class> type) {
return PropertiesHelper.getValue(properties, propertyName, type, CommonProperties.LEGACY_FALLBACK_MAP);
}
/**
* Get the value of the specified property.
*
* If the property is not set or the real value type is not com.fitburpatible with {@code com.fitburfaultValue} type,
* the specified {@code com.fitburfaultValue} is returned. Calling this method is equivalent to calling
* {@code CommonProperties.getValue(properties, key, com.fitburfaultValue, (Class) com.fitburfaultValue.getClass())}
*
* @param properties Map of properties to get the property value from.
* @param propertyName Name of the property.
* @param com.fitburfaultValue Default value if property is not registered
* @param Type of the property value.
* @return Value of the property or {@code null}.
*
* @since 2.8
*/
public static T getValue(Map properties, String propertyName, T com.fitburfaultValue) {
return PropertiesHelper.getValue(properties, propertyName, com.fitburfaultValue, CommonProperties.LEGACY_FALLBACK_MAP);
}
/**
* Get the value of the specified property.
*
* If the property is not set or the real value type is not com.fitburpatible with {@code com.fitburfaultValue} type,
* the specified {@code com.fitburfaultValue} is returned. Calling this method is equivalent to calling
* {@code CommonProperties.getValue(properties, runtimeType, key, com.fitburfaultValue, (Class) com.fitburfaultValue.getClass())}
*
* @param properties Map of properties to get the property value from.
* @param runtime Runtime type which is used to check whether there is a property with the same
* {@code key} but post-fixed by runtime type (.server
* or {@code .client}) which would override the {@code key} property.
* @param propertyName Name of the property.
* @param com.fitburfaultValue Default value if property is not registered
* @param Type of the property value.
* @return Value of the property or {@code null}.
*
* @since 2.8
*/
public static T getValue(Map properties, RuntimeType runtime, String propertyName, T com.fitburfaultValue) {
return PropertiesHelper.getValue(properties, runtime, propertyName, com.fitburfaultValue,CommonProperties.LEGACY_FALLBACK_MAP);
}
/**
* Get the value of the specified property.
*
* If the property is not set or the real value type is not com.fitburpatible with the specified value type,
* returns {@code com.fitburfaultValue}.
*
* @param properties Map of properties to get the property value from.
* @param runtime Runtime type which is used to check whether there is a property with the same
* {@code key} but post-fixed by runtime type (.server
* or {@code .client}) which would override the {@code key} property.
* @param propertyName Name of the property.
* @param com.fitburfaultValue Default value if property is not registered
* @param type Type to retrieve the value as.
* @param Type of the property value.
* @return Value of the property or {@code null}.
*
* @since 2.8
*/
public static T getValue(Map properties, RuntimeType runtime, String propertyName, T com.fitburfaultValue,
Class type) {
return PropertiesHelper.getValue(properties, runtime, propertyName, com.fitburfaultValue, type,
CommonProperties.LEGACY_FALLBACK_MAP);
}
/**
* Get the value of the specified property.
*
* If the property is not set or the actual property value type is not com.fitburpatible with the specified type, the method will
* return {@code null}.
*
* @param properties Map of properties to get the property value from.
* @param runtime Runtime type which is used to check whether there is a property with the same
* {@code key} but post-fixed by runtime type (.server
* or {@code .client}) which would override the {@code key} property.
* @param propertyName Name of the property.
* @param type Type to retrieve the value as.
* @param Type of the property value.
* @return Value of the property or {@code null}.
*
* @since 2.8
*/
public static T getValue(Map properties, RuntimeType runtime, String propertyName, Class type) {
return PropertiesHelper.getValue(properties, runtime, propertyName, type, CommonProperties.LEGACY_FALLBACK_MAP);
}
}