/*
(non-Javadoc)
@see javax.slee.resource.ResourceAdaptor#unsetResourceAdaptorContext()
491878
public void unsetResourceAdaptorContext() {
		this.raContext = null;
		this.tracer = null;
		this.sleeEndpoint = null;
		this.eventLookupFacility = null;
		this.sbbInterface = null;		
	}
1125116
@Override
    public void remove(Statement st, Resource... contexts) throws RepositoryException {
        getClient().sendRemove(null, st.getSubject(), st.getPredicate(), st.getObject(), mergeResource(st.getContext(), contexts));
    }
725529
@Deactivate
    protected void deactivate(ComponentContext context) {
        lock.writeLock().lock();
        try {
            componentContext = null;
            properties = null;
            threadContextConfigurations = null;
        } finally {
            lock.writeLock().unlock();
        }
    }
159548
private function clearContext()
    {
        $this->url = NULL;
        $this->params = array();
        $this->headers = array();
        Logger::log('Context service for ' . static::class . ' cleared!');
        $this->closeConnection();
    }
1306939
public PurgeJmsQueuesBuilder withApplicationContext(ApplicationContext applicationContext) {
        if (applicationContext.containsBean("connectionFactory")) {
            connectionFactory(applicationContext.getBean("connectionFactory", ConnectionFactory.class));
        }

        return this;
    }
512768
public void popContextData(){
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "popContextData");
        }
        
        // If we pushed thread context onto the thread, be sure to reset it before
        // taking it off.
        if (this.originalCD != null) {
          //Each producer service of the Transfer service is accessed in order to get the thread context data
          Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
          if (TransferIterator != null) {
            while(TransferIterator.hasNext()){
              ITransferContextService tcs = TransferIterator.next();
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Calling resetState on: " + tcs);
              }
              tcs.resetState();
            }
          }
        }
        
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Restoring the current thread's class loader");
        }
        if(currentCL != null){
            //Revert back to the thread's current class loader
            AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
                public ClassLoader run() {
                    Thread.currentThread().setContextClassLoader(currentCL);
                    return currentCL;
                }
            });
        }
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Restoring the current thread's context data");
        }
        //When popping we are going to reset the thread context to clear everything off, then we are going to set it back to the state when we first pushed
        //our stuff onto the thread
        if(currentCD != null){
            Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
            if (TransferIterator != null) { 
                while(TransferIterator.hasNext()){
                    ITransferContextService tcs = TransferIterator.next();
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "calling restoreState on: " + tcs);
                    }
                    tcs.restoreState(currentCD);
                }  
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Ending the current ComponentMetaData context");
        }
        //Reset data for other components that we already have hooks into
        ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
        cmdai.endContext();
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "popContextData");
        }
    }
314239
@com.fasterxml.jackson.annotation.JsonProperty("Context")
    public void setContext(String context) {
        this.context = context;
    }
974155
protected synchronized void deactivate(ComponentContext context) {
        cfwBundleRef.deactivate(context);
        scheduledExecSvcRef.deactivate(context);
        injectionServiceSRRef.deactivate(context);
        injectionService12SRRef.deactivate(context);
        executorServiceRef.deactivate(context);
        injectionEngineSRRef.deactivate(context);
    }
206527
private void removeResource(FacesContext context, UIComponent resource, UIViewRoot view) {
        view.removeComponentResource(context, resource, HEAD);
        view.removeComponentResource(context, resource, TARGET);
    }
190366
private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException {
		for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
			BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
			if (foundMethodBinding == null) {
				continue; // not a bound method
			}
			if (foundMethodBinding instanceof ConformanceMethodBinding) {
				myServerConformanceMethod = null;
				continue;
			}
			String resourceName = foundMethodBinding.getResourceName();
			if (!resourceNames.contains(resourceName)) {
				resourceNames.add(resourceName);
			}
		}
	}
993210
public void unsetSbbContext() {
		this.sbbContext = null;
		this.tracer = null;
		this.timerFacility = null;
		this.nullACIFactory = null;
		this.nullActivityFactory = null;
		this.sipProvider = null;
	}
465982
@Override
	public void unbind(Object context) {
		if (m_validationSession != null && context instanceof ValidationObject) {
	        m_validationSession.unbind((ValidationObject) context);
		}
	}
995261
public synchronized void removeContextAttribute(String name)
    {
        Object old= super.getContextAttribute(name);
        super.removeContextAttribute(name);

        if (old != null && _contextAttributeListeners != null)
        {
            ServletContextAttributeEvent event= new ServletContextAttributeEvent(getServletContext(), name, old);
            for (int i= 0; i < LazyList.size(_contextAttributeListeners); i++)
            {
                ServletContextAttributeListener l=
                    (ServletContextAttributeListener)LazyList.get(_contextAttributeListeners, i);
                l.attributeRemoved(event);
            }
        }
    }
583330
public void setResourceDetails(java.util.Collection<ResourceDetail> resourceDetails) {
        if (resourceDetails == null) {
            this.resourceDetails = null;
            return;
        }

        this.resourceDetails = new java.util.ArrayList<ResourceDetail>(resourceDetails);
    }
70938
public synchronized void setContexts(HttpContext[] contexts)
    {
        List old = Arrays.asList(getContexts());
        
        for (int i=0;i<contexts.length;i++)
        {
            boolean existing=old.remove(contexts[i]);
            if (!existing)
                addContext(contexts[i]);
        }

        for (int i=0;i<old.size();i++)
            removeContext((HttpContext)old.get(i));
    }

    
     */
    public synchronized HttpContext[] getContexts()
    {
        if (_virtualHostMap==null)
            return new HttpContext[0];
        
        ArrayList contexts = new ArrayList(33);
        Iterator maps=_virtualHostMap.values().iterator();
        while (maps.hasNext())
        {
            PathMap pm=(PathMap)maps.next();
            Iterator lists=pm.values().iterator();
            while(lists.hasNext())
            {
                List list=(List)lists.next();
                for (int i=0;i<list.size();i++)
                {
                    HttpContext context=(HttpContext)list.get(i);
                    if (!contexts.contains(context))
                        contexts.add(context);
                }
            }
        }
        return (HttpContext[])contexts.toArray(new HttpContext[contexts.size()]);
    }

     */
    /** Add a context.
     * @param context 
     */
    public HttpContext addContext(HttpContext context)
    {
        if (context.getContextPath()==null ||
            context.getContextPath().length()==0)
            throw new IllegalArgumentException("No Context Path Set");
        boolean existing=removeMappings(context);
        if (!existing)
        {
            context.setHttpServer(this);
            addComponent(context);
        }
        addMappings(context);
        return context;
    }

     */
    /** Remove a context or Web application.
     * @exception IllegalStateException if context not stopped
     */
    public boolean removeContext(HttpContext context)
        throws IllegalStateException
    {
        if (removeMappings(context))
        {
            removeComponent(context);
            if (context.isStarted())
                try{context.stop();} catch (InterruptedException e){log.warn(LogSupport.EXCEPTION,e);}
            context.setHttpServer(null);
            return true;
        }
        return false;
    }
    

     */
    /** Add a context.
     * As contexts cannot be publicly created, this may be used to
     * alias an existing context.
     * @param virtualHost The virtual host or null for all hosts.
     * @param context 
     */
    public HttpContext addContext(String virtualHost,
                                  HttpContext context)
    {
        if (virtualHost!=null)
            context.addVirtualHost(virtualHost);
        addContext(context);
        return context;
    }


     */
    /** Create and add a new context.
     * Note that multiple contexts can be created for the same
     * virtualHost and contextPath. Requests are offered to multiple
     * contexts in the order they where added to the HttpServer.
     * @param contextPath
     * @return A HttpContext instance created by a call to newHttpContext.
     */
    public HttpContext addContext(String contextPath)
    {
        HttpContext hc = newHttpContext();
        hc.setContextPath(contextPath);
        addContext(hc);
        return hc;
    }
    
     */
    /** Create and add a new context.
     * Note that multiple contexts can be created for the same
     * virtualHost and contextPath. Requests are offered to multiple
     * contexts in the order they where added to the HttpServer.
     * @param virtualHost Virtual hostname or null for all hosts.
     * @param contextPathSpec Path specification relative to the context path.
     * @return A HttpContext instance created by a call to newHttpContext.
     */
    public HttpContext addContext(String virtualHost, String contextPathSpec)
    {
        if (virtualHost!=null && virtualHost.length()==0)
            virtualHost=null;
        HttpContext hc = newHttpContext();
        hc.setContextPath(contextPathSpec);
        if (virtualHost!=null)
            hc.addVirtualHost(virtualHost);
        addContext(hc);
        return hc;
    }
    
    
     */
    /** Get specific context. 
     * @param virtualHost The virtual host or null for all hosts.
     * @param contextPathSpec Path specification relative to the context path.
     * @param i Index among contexts of same virtualHost and pathSpec.
     * @return The HttpContext or null.
     */
    public HttpContext getContext(String virtualHost, String contextPathSpec, int i)
    {
        HttpContext hc=null;
        contextPathSpec=HttpContext.canonicalContextPathSpec(contextPathSpec);

        PathMap contextMap=(PathMap)_virtualHostMap.get(virtualHost);
        if (contextMap!=null)
        {
            List contextList = (List)contextMap.get(contextPathSpec);
            if (contextList!=null)
            {
                if (i>=contextList.size())
                    return null;
                hc=(HttpContext)contextList.get(i);
            }
        }

        return hc;
    }

    
     */
    /** Get or create context. 
     * @param virtualHost The virtual host or null for all hosts.
     * @param contextPathSpec
     * @return HttpContext. If multiple contexts exist for the same
     * virtualHost and pathSpec, the most recently added context is returned.
     * If no context exists, a new context is created by a call to newHttpContext.
     */
    public HttpContext getContext(String virtualHost, String contextPathSpec)
    { 
        HttpContext hc=null;
        contextPathSpec=HttpContext.canonicalContextPathSpec(contextPathSpec);
        PathMap contextMap=(PathMap)_virtualHostMap.get(virtualHost);
        
        if (contextMap!=null)
        {
            List contextList = (List)contextMap.get(contextPathSpec);
            if (contextList!=null && contextList.size()>0)
                hc=(HttpContext)contextList.get(contextList.size()-1);
        }
        if (hc==null)
            hc=addContext(virtualHost,contextPathSpec);

        return hc;
    }
    
     */
    /** Get or create context. 
     * @param contextPathSpec Path specification relative to the context path.
     * @return The HttpContext  If multiple contexts exist for the same
     * pathSpec, the most recently added context is returned.
     * If no context exists, a new context is created by a call to newHttpContext.
     */
    public HttpContext getContext(String contextPathSpec)
    {
        return getContext(null,contextPathSpec);
    }    
 
     */
    /** Create a new HttpContext.
     * Specialized HttpServer classes may override this method to
     * return subclasses of HttpContext.
     * @return A new instance of HttpContext or a subclass of HttpContext
     */
    protected HttpContext newHttpContext()
    {
        return new HttpContext();
    }

     */    
    synchronized void addMapping(String virtualHost, HttpContext context)
    {
        // Get the map of contexts
        PathMap contextMap=(PathMap)_virtualHostMap.get(virtualHost);
        if (contextMap==null)
        {
            contextMap=new PathMap(7);
            _virtualHostMap.put(virtualHost,contextMap);
        }
        
        // Generalize contextPath
        String contextPathSpec=
            HttpContext.canonicalContextPathSpec(context.getContextPath());
        
        // Get the list of contexts at this path
        List contextList = (List)contextMap.get(contextPathSpec);
        if (contextList==null)
        {
            contextList=new ArrayList(1);
            contextMap.put(contextPathSpec,contextList);
        }
        
        // Add the context to the list
        contextList.add(context);
            
        if(log.isDebugEnabled())log.debug("Added "+context+" for host "+(virtualHost==null?"*":virtualHost));
    }
915034
private void configureDefaultContextPath(DefaultContextPath dcp) {
        String methodName = "configureDefaultContextPath";
        String defaultContextPath = dcp.getValue();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, methodName + ": defaultContextPath --> " + defaultContextPath);
        }

        if (defaultContextPath != null && !defaultContextPath.isEmpty()) {
            webAppConfiguration.setDefaultContextPath(defaultContextPath);
        }
    }
165489
protected void unsetThreadContextProvider(ServiceReference<ThreadContextProvider> ref) {
        String threadContextProviderName = (String) ref.getProperty(COMPONENT_NAME);
        if (threadContextProviders.removeReference(threadContextProviderName, ref)
            && Boolean.TRUE.equals(ref.getProperty(ThreadContextProvider.ALWAYS_CAPTURE_THREAD_CONTEXT)))
            alwaysEnabled.remove(threadContextProviderName);
    }