/** * Gets all custom implicit wrappers. * * @return a set containing all available implicit wrappers */ public static Set<CustomImplicitContextData> getCustomImplicitDataProviders() { return getImplicitWrappers(CustomImplicitContextData.class, TraceeContextLoggerConstants.IMPLICIT_CONTEXT_PROVIDER_CLASS_CUSTOM_RESOURCE_URL); }
public static List<TypeToWrapper> getTypeToWrapper() { if (typeToWrapperList == null) { typeToWrapperList = getAvailableWrappers(); } return typeToWrapperList; }
public static Set<Class> getAllWrappedClasses() { final List<TypeToWrapper> localTypeToWrapperList = getTypeToWrapper(); Set<Class> resultList = new HashSet<Class>(); if (localTypeToWrapperList != null) { for (TypeToWrapper typeToWrapper : localTypeToWrapperList) { resultList.add(typeToWrapper.getWrappedInstanceType()); } } return resultList; }
/** * Does the initialization stuff like Creating the lookup map and bind the wrapper classes. */ public ContextLoggerConfiguration() { List<TypeToWrapper> tmpWrapperList = TypeToWrapper.getTypeToWrapper(); Map<ImplicitContext, Class> tmpImplicitContextClassMap = new ConcurrentHashMap<ImplicitContext, Class>(); Map<Class, Class> tmpClassToWrapperMap = new ConcurrentHashMap<Class, Class>(); // now iterate over types and fill map for (TypeToWrapper wrapper : tmpWrapperList) { tmpClassToWrapperMap.put(wrapper.getWrappedInstanceType(), wrapper.getWrapperType()); } Set<Class> tmpWrapperClasses = TypeToWrapper.findWrapperClasses(); Set<ImplicitContextData> implicitContextWrapperClasses = TypeToWrapper.getImplicitContextDataProviders(); for (ImplicitContextData instance : implicitContextWrapperClasses) { tmpImplicitContextClassMap.put(instance.getImplicitContext(), instance.getClass()); tmpWrapperClasses.add(instance.getClass()); } // must register custom data provider classes Set<CustomImplicitContextData> customImplicitContextDataProviderClasses = TypeToWrapper.getCustomImplicitDataProviders(); for (CustomImplicitContextData instance : customImplicitContextDataProviderClasses) { tmpWrapperClasses.add(instance.getClass()); } // Make collections immutable wrapperList = Collections.unmodifiableList(tmpWrapperList); implicitContextClassMap = Collections.unmodifiableMap(tmpImplicitContextClassMap); classToWrapperMap = Collections.unmodifiableMap(tmpClassToWrapperMap); wrapperClasses = Collections.unmodifiableSet(tmpWrapperClasses); profile = Profile.getCurrentProfile(); }
logWarn("TracEE-Context-Logger : Can't read type to wrapper mapping resource with url '" + resourceUrl + "' "); return result; result.add(new TypeToWrapper(instance.getWrappedType(), clazz)); logError("Context logger - An error occurred while loading explicit type wrappers.", e);
/** * Gets a list with all wrapper classes. * * @return a list with all wrapper classes */ public static Set<Class> findWrapperClasses() { final List<TypeToWrapper> localTypeToWrapperList = getTypeToWrapper(); Set<Class> resultList = new HashSet<Class>(); if (localTypeToWrapperList != null) { for (TypeToWrapper typeToWrapper : localTypeToWrapperList) { resultList.add(typeToWrapper.getWrapperType()); } } return resultList; }
if (wrapper.getWrappedInstanceType().isAssignableFrom(instance.getClass())) { try { WrappedContextData wrapperInstance = (WrappedContextData) createInstance(wrapper.getWrapperType()); wrapperInstance.setContextData(instance);
/** * Gets all internal implicit data providers. * * @return a set containing all available implicit wrappers */ public static Set<ImplicitContextData> getImplicitContextDataProviders() { return getImplicitWrappers(ImplicitContextData.class, TraceeContextLoggerConstants.IMPLICIT_CONTEXT_PROVIDER_CLASS_INTERNAL_RESOURCE_URL); }
public static List<TypeToWrapper> getAvailableWrappers() { final List<TypeToWrapper> wrappers = new ArrayList<TypeToWrapper>(); for (final String resourceUrl : RESOURCE_URLS) { wrappers.addAll(getAvailableWrappers(resourceUrl)); } return wrappers; }