Class ConfigModularityUtils
- java.lang.Object
-
- com.sun.enterprise.config.modularity.ConfigModularityUtils
-
@Service public final class ConfigModularityUtils extends Object
Contains utility methods for zero-config- Author:
- Masoud Kalali
-
-
Constructor Summary
Constructors Constructor Description ConfigModularityUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSystemPropertyForToken(List<ConfigCustomizationToken> tokens, SystemPropertyBag bag)<T extends org.jvnet.hk2.config.ConfigBeanProxy>
voidapplyCustomTokens(ConfigBeanDefaultValue configBeanDefaultValue, T finalConfigBean, org.jvnet.hk2.config.ConfigBeanProxy parent)booleancheckInterfaces(Class[] ifs, Type actualGenericParameter)StringconvertConfigElementNameToClassName(String name)convert a configuration element name to representing class namebooleandeleteConfigurationForConfigBean(org.jvnet.hk2.config.ConfigBeanProxy configBean, Collection col, ConfigBeanDefaultValue defaultValue)MethodfindDeeperSuitableCollectionGetter(Class owner, Class typeToSet)MethodfindSuitableCollectionGetter(Class owner, Class typeToSet)Find a getter method that returns a collection of the type we want to put set.List<Class>getAnnotatedConfigBeans(Class annotationType)ClassgetClassFor(String serviceName)ClassgetClassForFullName(String configBeanClassName)ClassgetClassFromDescriptor(org.glassfish.hk2.api.ActiveDescriptor<?> descriptor)ClassgetClassFromInjector(org.jvnet.hk2.config.ConfigInjector injector)<T extends org.jvnet.hk2.config.ConfigBeanProxy>
TgetConfigBeanFromCollection(Collection<T> col, T configBeanObject, Class typeOfObjects)org.jvnet.hk2.config.ConfigBeanProxygetConfigBeanInstanceFor(Class configBeanType)<U extends org.jvnet.hk2.config.ConfigBeanProxy>
URLgetConfigurationFileUrl(Class<U> configBeanClass, String baseFileName, String runtimeType)<T extends org.jvnet.hk2.config.ConfigBeanProxy>
TgetCurrentConfigBeanForDefaultValue(ConfigBeanDefaultValue defaultValue)List<ConfigBeanDefaultValue>getDefaultConfigurations(Class configBeanClass, String runtimeType)If exists, locate and return a URL to the configuration snippet for the given config bean class.ClassgetDuckClass(Class configBeanType)<U extends org.jvnet.hk2.config.ConfigBeanProxy>
List<U>getExtensions(org.jvnet.hk2.config.ConfigBeanProxy parent)MethodgetGetDefaultValuesMethod(Class configBeanType)List<Class>getInstalledExtensions(Class extensionType)MethodgetMatchingGetterMethod(Class classToQuery, Class methodReturnType)Find a suitable getter method in the given class.MethodgetMatchingSetterMethod(Class classToQuery, Class typeToSet)Finds and return the setter method matching the class identified by typeToSet<T extends org.jvnet.hk2.config.ConfigBeanProxy>
TgetNamedConfigBeanFromCollection(Collection<T> col, String nameToLookFor, Class typeOfObjects)StringgetNameForConfigBean(Object configBean, Class configBeanType)org.jvnet.hk2.config.ConfigBeanProxygetOwner(org.jvnet.hk2.config.ConfigBeanProxy parent, String parentElement, String childElement)ClassgetOwningClassForLocation(String location)org.jvnet.hk2.config.ConfigBeanProxygetOwningObject(String location)StringgetPropertyValue(ConfigCustomizationToken token, org.jvnet.hk2.config.ConfigBeanProxy finalConfigBean)StringgetRuntimeTypePrefix(com.sun.enterprise.module.bootstrap.StartupContext startupContext)StringgetServiceTypeNameIfNamedComponent(String serviceName)booleanhasCustomConfig(Class configBeanClass)booleanisCommandInvocation()booleanisIgnorePersisting()StringreplacePropertiesWithCurrentValue(String xmlConfiguration, ConfigBeanDefaultValue value)StringresolveExpression(String expression)StringserializeConfigBean(org.jvnet.hk2.config.ConfigBeanProxy configBean)StringserializeConfigBeanByType(Class configBeanType)voidsetCommandInvocation(boolean commandInvocation)<T extends org.jvnet.hk2.config.ConfigBeanProxy>
TsetConfigBean(T finalConfigBean, ConfigBeanDefaultValue configBeanDefaultValue, org.jvnet.hk2.config.ConfigBeanProxy parent)voidsetIgnorePersisting(boolean ignorePersisting)<T extends org.jvnet.hk2.config.ConfigBeanProxy>
booleanstackPositionHigher(T finalConfigBean, org.jvnet.hk2.config.ConfigBeanProxy itemToRemove)
-
-
-
Method Detail
-
getConfigurationFileUrl
public <U extends org.jvnet.hk2.config.ConfigBeanProxy> URL getConfigurationFileUrl(Class<U> configBeanClass, String baseFileName, String runtimeType)
-
getDefaultConfigurations
public List<ConfigBeanDefaultValue> getDefaultConfigurations(Class configBeanClass, String runtimeType)
If exists, locate and return a URL to the configuration snippet for the given config bean class.- Parameters:
configBeanClass- the config bean type we want to check for its configuration snippet- Returns:
- A url to the file or null of not exists
-
hasCustomConfig
public boolean hasCustomConfig(Class configBeanClass)
-
findSuitableCollectionGetter
public Method findSuitableCollectionGetter(Class owner, Class typeToSet)
Find a getter method that returns a collection of the type we want to put set.- Parameters:
owner- The class we want to search to find a method that returns a Collection typed with toSetTypetypeToSet- The type we want to find a matching collection fo- Returns:
- The Method that
-
findDeeperSuitableCollectionGetter
public Method findDeeperSuitableCollectionGetter(Class owner, Class typeToSet)
-
getOwningObject
public org.jvnet.hk2.config.ConfigBeanProxy getOwningObject(String location)
-
getOwner
public org.jvnet.hk2.config.ConfigBeanProxy getOwner(org.jvnet.hk2.config.ConfigBeanProxy parent, String parentElement, String childElement) throws InvocationTargetException, IllegalAccessException
-
getExtensions
public <U extends org.jvnet.hk2.config.ConfigBeanProxy> List<U> getExtensions(org.jvnet.hk2.config.ConfigBeanProxy parent)
-
setConfigBean
public <T extends org.jvnet.hk2.config.ConfigBeanProxy> T setConfigBean(T finalConfigBean, ConfigBeanDefaultValue configBeanDefaultValue, org.jvnet.hk2.config.ConfigBeanProxy parent)
-
stackPositionHigher
public <T extends org.jvnet.hk2.config.ConfigBeanProxy> boolean stackPositionHigher(T finalConfigBean, org.jvnet.hk2.config.ConfigBeanProxy itemToRemove)
-
applyCustomTokens
public <T extends org.jvnet.hk2.config.ConfigBeanProxy> void applyCustomTokens(ConfigBeanDefaultValue configBeanDefaultValue, T finalConfigBean, org.jvnet.hk2.config.ConfigBeanProxy parent) throws org.jvnet.hk2.config.TransactionFailure, PropertyVetoException
- Throws:
org.jvnet.hk2.config.TransactionFailurePropertyVetoException
-
addSystemPropertyForToken
public void addSystemPropertyForToken(List<ConfigCustomizationToken> tokens, SystemPropertyBag bag) throws org.jvnet.hk2.config.TransactionFailure, PropertyVetoException
- Throws:
org.jvnet.hk2.config.TransactionFailurePropertyVetoException
-
getCurrentConfigBeanForDefaultValue
public <T extends org.jvnet.hk2.config.ConfigBeanProxy> T getCurrentConfigBeanForDefaultValue(ConfigBeanDefaultValue defaultValue) throws InvocationTargetException, IllegalAccessException
-
getConfigBeanFromCollection
public <T extends org.jvnet.hk2.config.ConfigBeanProxy> T getConfigBeanFromCollection(Collection<T> col, T configBeanObject, Class typeOfObjects) throws InvocationTargetException, IllegalAccessException
-
getNamedConfigBeanFromCollection
public <T extends org.jvnet.hk2.config.ConfigBeanProxy> T getNamedConfigBeanFromCollection(Collection<T> col, String nameToLookFor, Class typeOfObjects) throws InvocationTargetException, IllegalAccessException
-
getNameForConfigBean
public String getNameForConfigBean(Object configBean, Class configBeanType) throws InvocationTargetException, IllegalAccessException
-
convertConfigElementNameToClassName
public String convertConfigElementNameToClassName(String name)
convert a configuration element name to representing class name- Parameters:
name- the configuration element name we want to convert to class name- Returns:
- the class name which the configuration element represent.
-
getClassFromInjector
public Class getClassFromInjector(org.jvnet.hk2.config.ConfigInjector injector)
-
getServiceTypeNameIfNamedComponent
public String getServiceTypeNameIfNamedComponent(String serviceName)
-
getConfigBeanInstanceFor
public org.jvnet.hk2.config.ConfigBeanProxy getConfigBeanInstanceFor(Class configBeanType)
-
serializeConfigBean
public String serializeConfigBean(org.jvnet.hk2.config.ConfigBeanProxy configBean)
-
getMatchingGetterMethod
public Method getMatchingGetterMethod(Class classToQuery, Class methodReturnType)
Find a suitable getter method in the given class. the returned method represent a method that will return back a type of methodReturnType.- Parameters:
classToQuery- The class we want to find the getter inmethodReturnType- the type we want to find the getter for- Returns:
- A Method object for a getter method in the classToQuery which returns the methodReturnType
-
getMatchingSetterMethod
public Method getMatchingSetterMethod(Class classToQuery, Class typeToSet)
Finds and return the setter method matching the class identified by typeToSet- Parameters:
classToQuery- The ConfigLoader we want to inspect for presence of a setter method accepting class of type fqcn.typeToSet- the type we want to find a setter for- Returns:
- the matching Method object or null if not present.
-
deleteConfigurationForConfigBean
public boolean deleteConfigurationForConfigBean(org.jvnet.hk2.config.ConfigBeanProxy configBean, Collection col, ConfigBeanDefaultValue defaultValue)
-
getClassFromDescriptor
public Class getClassFromDescriptor(org.glassfish.hk2.api.ActiveDescriptor<?> descriptor)
-
replacePropertiesWithCurrentValue
public String replacePropertiesWithCurrentValue(String xmlConfiguration, ConfigBeanDefaultValue value) throws InvocationTargetException, IllegalAccessException
-
getPropertyValue
public String getPropertyValue(ConfigCustomizationToken token, org.jvnet.hk2.config.ConfigBeanProxy finalConfigBean)
-
getRuntimeTypePrefix
public String getRuntimeTypePrefix(com.sun.enterprise.module.bootstrap.StartupContext startupContext)
-
isIgnorePersisting
public boolean isIgnorePersisting()
-
setIgnorePersisting
public void setIgnorePersisting(boolean ignorePersisting)
-
isCommandInvocation
public boolean isCommandInvocation()
-
setCommandInvocation
public void setCommandInvocation(boolean commandInvocation)
-
-