/* (non-Javadoc)
@see com.ibm.ws.webcontainer.webapp.IWebAppDispatcherContext#dumpDispatchContextHierarchy()
544500
public void dumpDispatchContextHierarchy(){
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){
            logger.logp(Level.FINE, CLASS_NAME,"dumpDispatchContextHierarchy", "current context -->" + this);
            WebAppDispatcherContext tmpParentContext = parentContext;
            while (tmpParentContext != null){
                logger.logp(Level.FINE, CLASS_NAME,"dumpDispatchContextHierarchy", "parent context -->" + tmpParentContext);
                tmpParentContext = tmpParentContext.parentContext;
            }
        }
    }
187622
@Override
    public String buildRESTParentHierarchy(String pid)
            throws MelcoeXacmlException {
        Set<String> parents = getParents(pid);
        if (parents == null || parents.size() == 0) {
            return "/" + pid;
        }

        String[] parentArray = parents.toArray(new String[parents.size()]);

        return buildRESTParentHierarchy(parentArray[0]) + "/" + pid;
    }
268551
public static JsonObject serialize(OutputPortContext context) {
    return serialize(context.uri(), context.output().instance().component().network());
  }
355401
public void dumpContext(PrintWriter writer) {
        try {
            NamingEnumeration<NameClassPair> list = context.list("/");
            writer.print("\n{\n  name: \"");
            /*writer.print(this.namespace);
            writer.print(" ");*/
            writer.print(this.root);
            writer.println("\",\n  children: [");
            enumerate(list, "/", writer);
            writer.println("]}");
            writer.flush();
        } catch (NamingException e) {
            e.printStackTrace(writer);
        }
    }
508237
public HashMap<String,Object> saveContextData(){
        HashMap<String,Object> contextData = new HashMap<String, Object>();      
        //Save off the data from the other components we have hooks into
        ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
        ComponentMetaData cmd = cmdai.getComponentMetaData();
        if (cmd != null) {
          contextData.put(ComponentMetaData, cmd);
        }  
        
        //Each producer service of the Transfer service is accessed in order to get the thread context data
        //The context data is then stored off
        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 storeState on: " + tcs);
                }
                tcs.storeState(contextData);
            }
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "No implmenting services found");
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Saving the context data : " + contextData);
        }
        return contextData;
    }
110192
public void dumpTo(AreaTree tree, PrintWriter out)
    {
        if (produceHeader)
            out.println("<?xml version=\"1.0\"?>");
        out.println("<areaTree base=\"" + HTMLEntities(tree.getRoot().getPage().getSourceURL().toString()) + "\">");
        recursiveDump(tree.getRoot(), 1, out);
        out.println("</areaTree>");
    }
1189025
private static ContextRuntime getRootContext(final Injector injector,
                                               final Configuration rootContextConfiguration,
                                               final Optional<Configuration> rootServiceConfiguration)
      throws ContextClientCodeException {
    final ContextRuntime result;
    if (rootServiceConfiguration.isPresent()) {
      final Injector rootServiceInjector;
      try {
        rootServiceInjector = injector.forkInjector(rootServiceConfiguration.get());
      } catch (final BindException e) {
        throw new ContextClientCodeException(ContextClientCodeException.getIdentifier(rootContextConfiguration),
            Optional.<String>empty(), "Unable to instatiate the root context", e);
      }
      result = new ContextRuntime(rootServiceInjector, rootContextConfiguration);
    } else {
      result = new ContextRuntime(injector.forkInjector(), rootContextConfiguration);
    }
    return result;
  }
846369
private static void listHierarchy(Task task, String indent)
   {
      for (Task child : task.getChildTasks())
      {
         System.out.println(indent + "Task: " + child.getName() + "\t" + child.getStart() + "\t" + child.getFinish());
         listHierarchy(child, indent + " ");
      }
   }
103643
@Benchmark
  @BenchmarkMode(Mode.SampleTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public StatsTraceContext newServerContext_empty() {
    return StatsTraceContext.newServerContext(
        serverStreamTracerFactories, methodName, emptyMetadata);
  }
569767
public static <T> void injectEEFields(Iterable<Set<ResourceInjection<?>>> resourceInjectionsHierarchy,
            T beanInstance, CreationalContext<T> ctx) {
        for (Set<ResourceInjection<?>> resourceInjections : resourceInjectionsHierarchy) {
            for (ResourceInjection<?> resourceInjection : resourceInjections) {
                resourceInjection.injectResourceReference(beanInstance, ctx);
            }
        }
    }
33437
public static DumpData toDumpData(Node node, PageContext pageContext, int maxlevel, DumpProperties props) {
	if (maxlevel <= 0) {
	    return DumpUtil.MAX_LEVEL_REACHED;
	}
	maxlevel--;
	// Document
	if (node instanceof Document) {
	    DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
	    table.setTitle("XML Document");
	    table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString()));
	    table.appendRow(1, new SimpleDumpData("XmlRoot"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLROOT, null), pageContext, maxlevel, props));
	    return table;

	}
	// Element
	if (node instanceof Element) {
	    DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
	    table.setTitle("XML Element");
	    table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString()));
	    table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString()));
	    table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString()));
	    table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props));
	    table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString()));
	    table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props));
	    table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props));
	    return table;

	}
	// Text
	if (node instanceof Text) {
	    DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
	    table.setTitle("XML Text");
	    Text txt = (Text) node;

	    table.appendRow(1, new SimpleDumpData("XmlText"), new SimpleDumpData(txt.getData()));
	    return table;

	}
	// Attr
	if (node instanceof Attr) {
	    DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
	    table.setTitle("XML Attr");
	    table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString()));
	    table.appendRow(1, new SimpleDumpData("XmlValue"), DumpUtil.toDumpData(((Attr) node).getValue(), pageContext, maxlevel, props));
	    table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true)));

	    return table;

	}
	// Node
	DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000");
	table.setTitle("XML Node (" + ListUtil.last(node.getClass().getName(), ".", true) + ")");
	table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString()));
	table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString()));
	table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString()));
	table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props));
	table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString()));
	table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props));
	table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props));

	table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true)));

	return table;
    }
239251
public IWebAppDispatcherContext getWebAppDispatcherContext() {
        //321485
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"getWebAppDispatcherContext", " "+this);
        }
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        IWebAppDispatcherContext dc=null;
        dc = SRTServletRequestThreadData.getInstance().getDispatchContext();
        if (dc==null){
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"getWebAppDispatcherContext", " return _dispatchContext "+ _dispatchContext );
            }

            dc = _dispatchContext;
        }

        return dc;
    }
168771
public void marshal(Object obj, HierarchicalStreamWriter writer,
			MarshallingContext context) {
		XTrace trace = (XTrace) obj;
		writer.startNode("XAttributeMap");
		context.convertAnother(trace.getAttributes(),
				XesXStreamPersistency.attributeMapConverter);
		writer.endNode();
		for (XEvent event : trace) {
			writer.startNode("XEvent");
			context.convertAnother(event, XesXStreamPersistency.eventConverter);
			writer.endNode();
		}
	}
1318452
public void dumpTree(PrintStream printStream, DumpConfiguration dumpConfiguration) {
		dumpTree(printStream,tree.getRoot(),0, dumpConfiguration);
	}
566684
@Override
    protected void updateStackingContexts()
    {
        super.updateStackingContexts();
        if (stackingParent != null)
        {
            if (formsStackingContext()) //all the positioned boxes are considered as separate stacking contexts
            {
                stackingParent.getStackingContext().registerChildContext(this);
                if (scontext != null) //clear this context if it exists (remove old children)
                    scontext.clear();
            }
        }
    }
826732
@Override
    protected void releaseConnectionContext(com.ibm.ws.webcontainer.srt.SRTConnectionContext context) {
        connContextPool.put((SRTConnectionContext) context);
    }
1306256
public void exportArtifacts(SessionProvider sp, FolderDescriptor parentFolder, OutputStream out)
            throws RepositoryException, FileNotFoundException
   {

      Session session = currentSession(sp);
      Node parentNode;
      if (rootNodePath.length() > 1)
      {
         parentNode = (Node) session.getItem(rootNodePath + "/" + parentFolder.getAsPath());
      }
      else
      {
         parentNode = (Node) session.getItem("/" + parentFolder.getAsPath());
      }

      LOG.info("Write repository to zipped stream");

      ZipOutputStream zout = new ZipOutputStream(new BufferedOutputStream(out, BUFFER));
      try
      {
         mapRepositoryToZipStream(parentNode, zout);
         zout.flush();
         zout.close();
      }
      catch (IOException e)
      {
         LOG.error("Cannot write to zip stream", e);
      }

   }