Gets the context data associated with the current EJB method or EJB
lifecycle callback.

@see BeanO#getContextData
@throws IllegalStateException if neither an EJB method nor an EJB
lifecycle method is active on the thread
506153
public Map<String, Object> getContextData() // d644886
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        Map<String, Object> contextData;
        if (isLifecycleMethodActive()) // d704496
        {
            if (ivLifecycleContextData == null)
            {
                ivLifecycleContextData = new HashMap<String, Object>();

                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "getContextData: created empty");
            }
            else
            {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "getContextData: lifecycle");
            }

            contextData = ivLifecycleContextData;
        }
        else
        {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "getContextData: method");

            EJSDeployedSupport s = getMethodContext();
            if (s == null)
            {
                IllegalStateException ex = new IllegalStateException(
                                "Context data not available outside the scope of an EJB or lifecycle callback method");
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "getContextData: " + ex);
                throw ex;
            }

            contextData = s.getContextData();
        }

        return contextData;
    }
704285
public static Context getContext()
    {
        if (ctx == null)
        {
            try
            {
                setContext(null);
            }
            catch (Exception e)
            {
                log.error("Cannot instantiate the InitialContext", e);
                throw new OJBRuntimeException(e);
            }
        }
        return ctx;
    }
25100
@Pure
	public static Object getContext() throws AndroidException {
		final Object ctx;
		synchronized (Android.class) {
			if (context == null) {
				throw new AndroidException();
			}
			ctx = context.get();
		}
		if (ctx == null) {
			throw new AndroidException();
		}
		return ctx;
	}
315293
public com.google.api.Context getContext() {
    return context_ == null ? com.google.api.Context.getDefaultInstance() : context_;
  }
962710
public final ServletContext getServletContext() {
        switch (type) {
            case ServletConfig:
                return servletConfig.getServletContext();
            case FilterConfig:
                return filterConfig.getServletContext();
            case ServletContext:
                return servletContext;
            default:
                throw new IllegalStateException();
        }
    }
582629
@Override
	public List<RecordContext> getAllData () throws DatabaseException {
    	SqlPreparedStatementWrapper psGetAllData = null;
    	try {
        	psGetAllData = DbSQL.getSingleton().getPreparedStatement("context.ps.alldata");
			List<RecordContext> result = new ArrayList<>();
			try (ResultSet rs = psGetAllData.getPs().executeQuery()) {
				while (rs.next()) {
					result.add(new RecordContext(rs.getLong(DATAID), rs.getInt(CONTEXTID), rs.getInt(TYPE), rs.getString(DATA)));
				}
			}
			
			return result;
		} catch (SQLException e) {
			throw new DatabaseException(e);
		} finally {
			DbSQL.getSingleton().releasePreparedStatement(psGetAllData);
		}
    }
559814
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)
        context['topic'] = self.object
        context['forum'] = self.object.forum
        return context
1093975
private Context currentContext()
   {
      LinkedList<Context> stack = threadContexts.get();

      if (stack != null && !stack.isEmpty())
      {
         return stack.getLast();
      }

      return null;
   }
78650
public static Map<String, String> getCopyOfContextMap() {
        if (mdcAdapter == null) {
            throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
        }
        return mdcAdapter.getCopyOfContextMap();
    }
927867
private Context getContext(ExecutionContext executionContext) {
        // Get context id.
        HttpServletRequest request = executionContext.getActionBeanContext().getRequest();
        String parameter = request.getParameter(ID_PARAMETER);
        
        // Return context.
        if (parameter != null) {
            int id = Integer.parseInt(parameter, 16);
            return contexts.get(id);
        }
        
        return null;
    }
1358987
@Override
	public String getContextDescription() {
		String msg = String.format("In method '%s.%s'", getParent().getElement().getSimpleName().toString(), getElement().getSimpleName().toString());

		return msg;
	}
282343
public static RequestContext get() {
        if (CURRENT_CONTEXT.get() == null) {
            synchronized (RequestContext.class) {
                if (CURRENT_CONTEXT.get() == null) {
                    createContext();
                }
            }
        }

        // ensure that RequestContextV1 is also initialized for this request
        RequestContextV1.get();

        return CURRENT_CONTEXT.get();
    }
897627
@Override
    public Class<?> getInvokedBusinessInterface()
                    throws IllegalStateException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        // d367572.1 start
        synchronized (this)
        {
            if ((state == PRE_CREATE) ||
                (state == CREATING) ||
                (state == DESTROYED))
            {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "Incorrect state: " + getStateName(state));
                throw new IllegalStateException(getStateName(state));
            }
        }
        // d367572.1 end

        Class<?> bInterface = null;
        EJSWrapperBase wrapper = null;

        // -----------------------------------------------------------------------
        // Obtain the Method Context for the current thread (EJSDeployedSupport),
        // which contains the 'wrapper' used to invoke the current method.
        //
        // The invoked 'business interface' is the first and only interface
        // for the wrapper class.
        //
        // Note that this method is NOT allowed for the EJB 2.1 component
        // interfaces... and results in an exception.
        // -----------------------------------------------------------------------

        EJSDeployedSupport methodContext = EJSContainer.getMethodContext();

        // d367572.7 start of eliminate potential NPE if methodContext is null.
        if (methodContext != null)
        {
            wrapper = methodContext.ivWrapper;

            if (wrapper != null)
            {
                // For an aggregate wrapper, all interfaces must be evaluated for
                // exposing the method. If a single interface is found, return it,
                // otherwise it is ambiguous.                             F743-34304
                if (wrapper.ivBusinessInterfaceIndex == EJSWrapperBase.AGGREGATE_LOCAL_INDEX)
                {
                    Method method = methodContext.methodInfo.ivMethod;
                    String methodName = method.getName();
                    Class<?>[] methodParams = method.getParameterTypes();
                    for (Class<?> curInterface : wrapper.bmd.ivBusinessLocalInterfaceClasses)
                    {
                        try
                        {
                            curInterface.getMethod(methodName, methodParams);
                            if (isTraceOn && tc.isDebugEnabled())
                                Tr.debug(tc, "Method " + methodName + " found on interface " + curInterface);
                            if (bInterface != null)
                            {
                                throw new IllegalStateException("Ambiguous invoked business interface.");
                            }
                            bInterface = curInterface;
                        } catch (SecurityException ex) // d679175
                        {
                            // this normal and means the interface doesn't expose this method.
                            if (isTraceOn && tc.isDebugEnabled())
                                Tr.debug(tc, "Method " + methodName + " not found on interface " + curInterface);
                        } catch (NoSuchMethodException ex) // d679175
                        {
                            // this normal and means the interface doesn't expose this method.
                            if (isTraceOn && tc.isDebugEnabled())
                                Tr.debug(tc, "Method " + methodName + " not found on interface " + curInterface);
                        }
                    }
                }

                // For performance (and in case No-Interface view) obtain the
                // 'interface' using the index provided on the wrapper, rather
                // than using reflections as done in prior releases.       F743-1756
                else if (wrapper.ivInterface == WrapperInterface.BUSINESS_LOCAL)
                {
                    bInterface = wrapper.bmd.ivBusinessLocalInterfaceClasses[wrapper.ivBusinessInterfaceIndex];
                }
                else if (wrapper.ivInterface == WrapperInterface.BUSINESS_REMOTE ||
                         wrapper.ivInterface == WrapperInterface.BUSINESS_RMI_REMOTE)
                {
                    bInterface = wrapper.bmd.ivBusinessRemoteInterfaceClasses[wrapper.ivBusinessInterfaceIndex];
                }
            }
        } // d367572.7 end

        if (bInterface == null)
        {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "getInvokedBusinessInterface : IllegalStateException : " +
                             "Not invoked through business interface");

            throw new IllegalStateException("Not invoked through business interface");
        }

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "getInvokedBusinessInterface : " + bInterface);

        return bInterface;
    }
924258
@Override
    public String getContextPath() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getContextPath();
        } finally {
            collaborator.postInvoke();
        }
    }
714666
@Override
    public <T> T getInjectionTargetContextData(Class<T> data)
    {
        if (data.isAssignableFrom(getClass()))
            return data.cast(this);

        // Return null if requested context data is not available
        return null;
    }
551293
public static void bind(ApplicationContext context) {
        Object old = contextMap.putIfAbsent(getContextClassLoader(), context);
        if (old != null) {
            throw new IllegalStateException(
                "There is already a ApplicationContext associated with the context ClassLoader of the current thread!");
        }
    }
1209262
public EJBMetaData getEJBMetaData()
                    throws RemoteException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "getEJBMetaData");

        homeEnabled();

        // We construct the meta data lazily here to avoid initialization-
        // ordering issues if we attempt to do it in initialize().

        if (ejbMetaData == null)
        {
            // p116618 - start of change
            EJSWrapper wrapper = getWrapper().getRemoteWrapper();

            if (cvUsePortableClass == false) // p125891
            {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "getEJBMetaData():Creating non-portable EJBMetaDataImpl");

                ejbMetaData =
                                new com.ibm.ejs.container.EJBMetaDataImpl
                                (beanMetaData,
                                                getWrapper().getRemoteWrapper(),
                                                j2eeName); // p125891

            }
            else
            {
                if (isTraceOn && tc.isDebugEnabled()) // p125891
                    Tr.debug(tc, "getEJBMetaData():Creating portable EJBMetaDataImpl"); //p125891

                Object wrapperRef = container.getEJBRuntime().getRemoteReference(wrapper);
                EJBHome homeStub = (EJBHome) PortableRemoteObject.narrow(wrapperRef, EJBHome.class);
                Class<?> pKeyClass = null;
                if (beanMetaData.pKeyClass != null) {
                    pKeyClass = beanMetaData.pKeyClass;
                }

                int beanType = EJBMetaDataImpl.NON_SESSION_BEAN;
                if (beanMetaData.type == InternalConstants.TYPE_STATEFUL_SESSION) {
                    beanType = EJBMetaDataImpl.STATEFUL_SESSION;
                }
                else if (beanMetaData.type == InternalConstants.TYPE_STATELESS_SESSION) {
                    beanType = EJBMetaDataImpl.STATELESS_SESSION;
                }

                ejbMetaData =
                                new EJBMetaDataImpl(beanType,
                                                homeStub,
                                                beanMetaData.enterpriseBeanAbstractClass, //150685
                                                beanMetaData.homeInterfaceClass,
                                                beanMetaData.remoteInterfaceClass,
                                                pKeyClass);
            }
            // p116618 - end of change
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "getEJBMetaData", ejbMetaData);
        return ejbMetaData;
    }