This method will store away the map of classes and injection metadata for later use. It will be stored in the
module metadata slot, and it will be used when creating instances of WAR based endpoints.
483193
@Override
    public void injectionMetaDataCreated(InjectionMetaData injectionMetaData) throws InjectionException {

        // PI22432 Adding the judgement for null
        if (injectionMetaData == null)
            return;

        ModuleMetaData mmd = injectionMetaData.getModuleMetaData();

        if (mmd == null)
            return;

        JaxWsModuleMetaData jaxWsmoduleMetaData = JaxWsMetaDataManager.getJaxWsModuleMetaData(mmd);

        if (jaxWsmoduleMetaData == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unsupported Module, no JaxWsModuleMetaData is created for " + mmd.getName() + ", Injection Processing for web service is ignored");
            }
            return;
        }

        if (!jaxWsmoduleMetaData.getJ2EEName().equals(mmd.getJ2EEName())) {
            //Only process the injection event for the main module, e.g. EJB WS Router module and EJB module share the same JaxWsModuleMetaData
            //While, we only process the injection event if it is from EJB Module itself
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Not main module for the JaxWsModuleMetaData {0} or the jaxWsModuleMetaData has been initialized, Injection Processing for web service is ignored",
                         mmd.getName());
            }
            return;
        }

        List<Class<?>> injectionClasses = injectionMetaData.getComponentNameSpaceConfiguration().getInjectionClasses();
        if (injectionClasses != null) {
            for (Class<?> clazz : injectionClasses) {
                jaxWsmoduleMetaData.setReferenceContext(clazz, injectionMetaData.getReferenceContext());
            }
        }

//        try {
//            if (JaxWsUtils.isEJBModule(jaxWsmoduleMetaData.getModuleContainer())) {
//                //only one ReferenceContextInjectionInstanceInterceptor is needed in InstanceManager
//                InstanceInterceptor interceptor = jaxWsmoduleMetaData.getJaxWsInstanceManager().getInterceptor(ReferenceContextInjectionInstanceInterceptor.class.getName());
//                if (interceptor == null) {
//                    jaxWsmoduleMetaData.getJaxWsInstanceManager().addInterceptor(new ReferenceContextInjectionInstanceInterceptor(jaxWsmoduleMetaData.getReferenceContextMap()));
//                }
//            }
//        } catch (UnableToAdaptException e) {
//            throw new InjectionException(e);
//        }

    }
955995
@Override
    public void destroyApplicationScopeResources(JaxRsModuleMetaData jaxRsModuleMetaData) {

        for (ModuleMetaData mmd : jaxRsModuleMetaData.getEnclosingModuleMetaDatas()) {
            managedObjectFactoryCache.remove(mmd);
            Iterator<ComponentMetaData> iter = beanManagers.keySet().iterator();
            while (iter.hasNext()) {
                ComponentMetaData cmd = iter.next();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "destroyApplicationScopeResources - is " + cmd + " a child of " + mmd + "?");
                }

                if (mmd.equals(cmd.getModuleMetaData())) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "destroyApplicationScopeResources - yes");
                    }
                    iter.remove();
                }
            }
        }
        Bus bus = jaxRsModuleMetaData.getServerMetaData().getServerBus();

        @SuppressWarnings("unchecked")
        Map<String, BeanCustomizerContext> beanCustomizerContexts = (Map<String, BeanCustomizerContext>) bus.getProperty(JaxRsConstants.ENDPOINT_BEANCUSTOMIZER_CONTEXTOBJ);
        if (beanCustomizerContexts == null) {
            return;
        }
        @SuppressWarnings("unchecked")
        Map<Class<?>, ManagedObject<?>> newContext = (Map<Class<?>, ManagedObject<?>>) beanCustomizerContexts.get(createCustomizerKey(this));
        if (newContext == null) {
            return;
        }
        Collection<ManagedObject<?>> objects = newContext.values();
        for (ManagedObject<?> mo : objects) {

            if (mo != null) {
                mo.release();
            }
        }

//destroy application
        ManagedObject<?> appObject = (ManagedObject<?>) jaxRsModuleMetaData.getManagedAppRef();
        if (appObject != null) {
            appObject.release();
        }
    }
908351
@Override
    public void endMetaData(MetaData metadata)
    {
        this.builder.addBlock(new MetaDataBlock(this.builder.endBlockList(), metadata));
    }
456872
protected function _setupMetadata()
    {
        if ($this->metadataCacheInClass() && (count($this->_metadata) > 0)) {
            return true;
        }

        // Assume that metadata will be loaded from cache
        $isMetadataFromCache = true;

        // If $this has no metadata cache but the class has a default metadata cache
        if (null === $this->_metadataCache && null !== self::$_defaultMetadataCache) {
            // Make $this use the default metadata cache of the class
            $this->_setMetadataCache(self::$_defaultMetadataCache);
        }

        // If $this has a metadata cache
        if (null !== $this->_metadataCache) {
            // Define the cache identifier where the metadata are saved

            //get db configuration
            $dbConfig = $this->_db->getConfig();

            $port = isset($dbConfig['options']['port'])
                  ? ':'.$dbConfig['options']['port']
                  : (isset($dbConfig['port'])
                  ? ':'.$dbConfig['port']
                  : null);

            $host = isset($dbConfig['options']['host'])
                  ? ':'.$dbConfig['options']['host']
                  : (isset($dbConfig['host'])
                  ? ':'.$dbConfig['host']
                  : null);

            // Define the cache identifier where the metadata are saved
            $cacheId = md5( // port:host/dbname:schema.table (based on availabilty)
                    $port . $host . '/'. $dbConfig['dbname'] . ':'
                  . $this->_schema. '.' . $this->_name
            );
        }

        // If $this has no metadata cache or metadata cache misses
        if (null === $this->_metadataCache || !($metadata = $this->_metadataCache->load($cacheId))) {
            // Metadata are not loaded from cache
            $isMetadataFromCache = false;
            // Fetch metadata from the adapter's describeTable() method
            $metadata = $this->_db->describeTable($this->_name, $this->_schema);
            // If $this has a metadata cache, then cache the metadata
            if (null !== $this->_metadataCache && !$this->_metadataCache->save($metadata, $cacheId)) {
                trigger_error('Failed saving metadata to metadataCache', E_USER_NOTICE);
            }
        }

        // Assign the metadata to $this
        $this->_metadata = $metadata;

        // Return whether the metadata were loaded from cache
        return $isMetadataFromCache;
    }
620035
def generate_endpoint_classes(db, generate_pks=False):
    """"""
    seen_classes = set()
    for cls in current_app.class_references.values():
        seen_classes.add(cls.__tablename__)
    with app.app_context():
        db.metadata.reflect(bind=db.engine)
        for name, table in db.metadata.tables.items():
            if not name in seen_classes:
                seen_classes.add(name)
                if not table.primary_key and generate_pks:
                    cls = add_pk_if_required(db, table, name)
                else:
                    cls = type(
                        str(name),
                        (sandman_model, db.Model),
                        {'__tablename__': name})
                register(cls)
391409
static void registerAdditionalModules(
            final ObjectMapper objectMapper,
            final Function<String, String> propertyAccessor) {
        final String moduleClassNames = propertyAccessor.apply("commons.object-mapper-additional-module-class-names");
        if (moduleClassNames != null) {
            for (final String moduleClassName : moduleClassNames.split(",")) {
                registerModule(objectMapper, moduleClassName);
            }
        }
    }
549173
private static ClassMetadata getClassMetadata(final Class cls, final Map /* <Class,ClassMetadata> */metadataMap,
                                                  final ClassAccessPrivilegedAction caAction,
                                                  final FieldAccessPrivilegedAction faAction) {
        if (null == cls) {
            return null;
        }

        ClassMetadata result;
        synchronized (metadataMap) {
            result = (ClassMetadata) metadataMap.get(cls);
        }
        if (result != null) {
            return result;
        }

        int primitiveFieldCount = 0;
        int shellSize = OBJECT_SHELL_SIZE; // java.lang.Object shell
        final List /* Field */refFields = new LinkedList();

        final Field[] declaredFields;
        try {
            caAction.setContext(cls);
            declaredFields = (Field[]) AccessController.doPrivileged(caAction);
        } catch (PrivilegedActionException pae) {
            throw new RuntimeException("could not access declared fields of class " + cls.getName() + ": "
                                       + pae.getException());
        }

        for (int f = 0; f < declaredFields.length; ++f) {
            final Field field = declaredFields[f];
            if (Modifier.isStatic(field.getModifiers())) {
                continue;
            }
            /*
             * Can't do that: HashMap data is transient, for example... if (Modifier.isTransient(field.getModifiers()))
             * { shellSize += OBJREF_SIZE; continue; }
             */

            final Class fieldType = field.getType();
            if (fieldType.isPrimitive()) {
                // memory alignment ignored:
                shellSize += sizeofPrimitiveType(fieldType);
                ++primitiveFieldCount;
            } else {
                // prepare for graph traversal later:
                if (!field.isAccessible()) {
                    try {
                        faAction.setContext(field);
                        AccessController.doPrivileged(faAction);
                    } catch (PrivilegedActionException pae) {
                        throw new RuntimeException("could not make field " + field + " accessible: "
                                                   + pae.getException());
                    }
                }

                // memory alignment ignored:
                shellSize += OBJREF_SIZE;
                refFields.add(field);
            }
        }

        // recurse into superclass:
        final ClassMetadata superMetadata = getClassMetadata(cls.getSuperclass(), metadataMap, caAction, faAction);
        if (superMetadata != null) {
            primitiveFieldCount += superMetadata.m_primitiveFieldCount;
            shellSize += superMetadata.m_shellSize - OBJECT_SHELL_SIZE;
            refFields.addAll(Arrays.asList(superMetadata.m_refFields));
        }

        final Field[] _refFields = new Field[refFields.size()];
        refFields.toArray(_refFields);

        result = new ClassMetadata(primitiveFieldCount, shellSize, _refFields);
        synchronized (metadataMap) {
            metadataMap.put(cls, result);
        }

        return result;
    }
336726
private void destroyEndpointMBeans() {
        for (Map.Entry<String, ServiceRegistration<DynamicMBean>> mbean : endpointMBeans.entrySet()) {
            String mbeanName = mbean.getKey();
            endpointMBeans.remove(mbeanName);
            mbean.getValue().unregister();
        }
    }
327082
public static void populateMetadata(AbstractComputeInstanceMetadata instanceMetadata, Map<?, ?> metadata) {
        if (metadata != null) {
            Map<String, String> finalMetadata = new HashMap<>(metadata.size());
            for (Map.Entry<?, ?> entry : metadata.entrySet()) {
                Object key = entry.getKey();
                Object value = entry.getValue();
                if (value instanceof String) {
                    finalMetadata.put(key.toString(), value.toString());
                }
            }
            instanceMetadata.setMetadata(finalMetadata);
        }
    }
1051296
@JsonProperty
    private Map<String, Object> getMetadata() {
        if (metadata == null) {
            metadata = new HashMap<>();
        }
        
        return metadata;
    }
845480
public static Map<String, String> encodeROMap(List<ROStoreVersionDirMap> metadataMap) {
        Map<String, String> storeToValue = Maps.newHashMap();
        for(ROStoreVersionDirMap currentStore: metadataMap) {
            storeToValue.put(currentStore.getStoreName(), currentStore.getStoreDir());
        }
        return storeToValue;
    }
322653
private static void manageLifecycleAnnotation(final Component<?> component, final MultiMap<String, Method> lifecycleMethod, final Class<? extends Annotation> annotationClass) {
        for (final Method method : ClassUtility.getAnnotatedMethods(component.getClass(), annotationClass)) {

            // Add a method to the multimap entry
            // TODO sort
            lifecycleMethod.add(annotationClass.getName(), method);
        }
    }
562158
public void dump()
    {
        Object allData[] = new Object[] {
                                         this,
                                         "EJBName                     = " + ivEjbName,
                                         "method name                 = " + ivMethodName,
                                         "method parameters           = " + ivMethodParms,
                                         "binding style               = " + ivBindingStyle,
                                         "exclude default inteceptors = " + ivExcludeDefaultLevelInterceptors,
                                         "exclude class inteceptors   = " + ivExcludeClassLevelInterceptors,
        }; // d457352

        int totalLength = allData.length;

        String[] interceptorOrder = null;
        if (ivInterceptorOrder != null)
        {
            interceptorOrder = new String[ivInterceptorOrder.size()];
            interceptorOrder = ivInterceptorOrder.toArray(interceptorOrder);
            totalLength += interceptorOrder.length + 2;
        }

        String[] interceptorNames = null;
        if (ivInterceptorClassNames != null)
        {
            interceptorNames = new String[ivInterceptorClassNames.size()];
            interceptorNames = ivInterceptorClassNames.toArray(interceptorNames);
            totalLength += interceptorNames.length + 2;
        }

        int index = 0;
        Object dumpData[] = new Object[totalLength];
        System.arraycopy(allData, 0, dumpData, index, allData.length);
        index += allData.length;

        if (interceptorOrder != null)
        {
            dumpData[index++] = "Interceptor Order: ";
            dumpData[index++] = " ";
            System.arraycopy(interceptorOrder, 0, dumpData, index, interceptorOrder.length);
            index += interceptorOrder.length;
        }

        if (interceptorNames != null)
        {
            dumpData[index++] = "Interceptor Class Names: ";
            dumpData[index++] = " ";
            System.arraycopy(interceptorNames, 0, dumpData, index, interceptorNames.length);
            index += interceptorNames.length;
        }

        Tr.dump(tc, "-- EJBInterceptorBinding Dump --", dumpData);
        Tr.dump(tc, "-- EJBInterceptorBinding Dump End --");
    }
977376
public synchronized void removeMetadataForModelsIn(Bundle bundle) {
        if (bundle == null) {
            throw new IllegalArgumentException("method parameter bundle must not be null");
        }

        Map<Class<?>, ResourceModelMetadataHolder> newCache = copyCache();
        Iterator<Map.Entry<Class<?>, ResourceModelMetadataHolder>> it = newCache.entrySet().iterator();
        while (it.hasNext()) {
            OsgiModelSource<?> source = it.next().getValue().source;
            if (source.getBundleId() == bundle.getBundleId()) {
                it.remove();
            }
        }
        this.cache = newCache;
    }
254960
@Override
    public void storeClass(JavaClass javaClass) {
        if (DEBUG) {
            System.out.println("Storing class " + javaClass.getClassName() + " in repository");
        }
        JavaClass previous = nameToClassMap.put(javaClass.getClassName(), javaClass);
        if (DEBUG && previous != null) {
            System.out.println("\t==> A previous class was evicted!");
            dumpStack();
        }
        Repository tmp = org.apache.bcel.Repository.getRepository();
        if (tmp != null && tmp != this) {
            throw new IllegalStateException("Wrong/multiple BCEL repository");
        }
        if (tmp == null) {
            org.apache.bcel.Repository.setRepository(this);
        }
    }
724295
private void initialize(Map<String, Object> metadata) {
        if (metadata == null) {
            metadata = new HashMap<String, Object>();
        }
        metadata.put(REQUEST_ID, generateRequestID());
        this.metadata = metadata;
    }
1061455
private void populateMap(Object bean) {
        Class<?> klass = bean.getClass();

        // If klass is a System class then set includeSuperClass to false.

        boolean includeSuperClass = klass.getClassLoader() != null;

        Method[] methods = includeSuperClass ? klass.getMethods() : klass.getDeclaredMethods();
        for (final Method method : methods) {
            final int modifiers = method.getModifiers();
            if (Modifier.isPublic(modifiers)
                    && !Modifier.isStatic(modifiers)
                    && method.getParameterTypes().length == 0
                    && !method.isBridge()
                    && method.getReturnType() != Void.TYPE
                    && isValidMethodName(method.getName())) {
                final String key = getKeyNameFromMethod(method);
                if (key != null && !key.isEmpty()) {
                    try {
                        final Object result = method.invoke(bean);
                        if (result != null) {
                            this.map.put(key, wrap(result));
                            // we don't use the result anywhere outside of wrap
                            // if it's a resource we should be sure to close it
                            // after calling toString
                            if (result instanceof Closeable) {
                                try {
                                    ((Closeable) result).close();
                                } catch (IOException ignore) {
                                }
                            }
                        }
                    } catch (IllegalAccessException ignore) {
                    } catch (IllegalArgumentException ignore) {
                    } catch (InvocationTargetException ignore) {
                    }
                }
            }
        }
    }