Write toc-mc.html for managed connections
@param events The events
@param fw The file writer
@exception Exception If an error occurs
439926
private static void generateToCManagedConnection(Map<String, TraceEvent> events, FileWriter fw)
      throws Exception
   {
      writeString(fw, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"");
      writeEOL(fw);
      writeString(fw, "                      \"http://www.w3.org/TR/html4/loose.dtd\">");
      writeEOL(fw);

      writeString(fw, "<html>");
      writeEOL(fw);

      writeString(fw, "<head>");
      writeEOL(fw);

      writeString(fw, "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">");
      writeEOL(fw);

      writeString(fw, "<title>Reference: ManagedConnection</title>");
      writeEOL(fw);

      writeString(fw, "</head>");
      writeEOL(fw);

      writeString(fw, "<body style=\"background: #D7D7D7;\">");
      writeEOL(fw);

      writeString(fw, "<h1>Reference: ManagedConnection</h1>");
      writeEOL(fw);

      writeString(fw, "<table>");
      writeEOL(fw);
      
      writeString(fw, "<tr>");
      writeEOL(fw);

      writeString(fw, "<td><b>ManagedConnection</b></td>");
      writeEOL(fw);

      writeString(fw, "<td><b>ConnectionListener</b></td>");
      writeEOL(fw);

      writeString(fw, "<td><b>ManagedConnectionPool</b></td>");
      writeEOL(fw);

      writeString(fw, "<td><b>Pool</b></td>");
      writeEOL(fw);

      writeString(fw, "</tr>");
      writeEOL(fw);

      for (Map.Entry<String, TraceEvent> entry : events.entrySet())
      {
         TraceEvent te = entry.getValue();

         writeString(fw, "<tr>");
         writeEOL(fw);

         writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" +
                     te.getPayload1() + "</a></td>");
         writeEOL(fw);
         
         writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" +
                     te.getConnectionListener() + "</a></td>");
         writeEOL(fw);
         
         writeString(fw, "<td>" + te.getManagedConnectionPool() + "</td>");
         writeEOL(fw);
      
         writeString(fw, "<td><a href=\"" + te.getPool() + "/index.html\">" + te.getPool() + "</a></td>");
         writeEOL(fw);
      
         writeString(fw, "</tr>");
         writeEOL(fw);
      }

      writeString(fw, "</table>");
      writeEOL(fw);

      writeString(fw, "<p>");
      writeEOL(fw);

      writeString(fw, "<a href=\"index.html\">Back</a>");
      writeEOL(fw);

      writeString(fw, "</body>");
      writeEOL(fw);

      writeString(fw, "</html>");
      writeEOL(fw);
   }
740468
private void writeConnectionFactory(Definition def, Writer out, int indent) throws IOException
   {
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Creates a Connection Factory instance. \n");
      writeWithIndent(out, indent, " *\n");
      writeWithIndent(out, indent, " * @param cxManager ConnectionManager to be "
            + "associated with created EIS connection factory instance\n");
      writeWithIndent(out, indent, " * @return EIS-specific Connection Factory instance or "
            + "javax.resource.cci.ConnectionFactory instance\n");
      writeWithIndent(out, indent, " * @throws ResourceException Generic exception\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent,
            "public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException");
      writeLeftCurlyBracket(out, indent);
      writeLogging(def, out, indent + 1, "trace", "createConnectionFactory", "cxManager");
      writeIndent(out, indent + 1);
      if (def.getMcfDefs().get(getNumOfMcf()).isUseCciConnection())
         out.write("return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnFactoryClass() + "(cxManager);");
      else
         out.write("return new " + def.getMcfDefs().get(getNumOfMcf()).getCfClass() + "(this, cxManager);");

      writeRightCurlyBracket(out, indent);
      writeEol(out);

      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Creates a Connection Factory instance. \n");
      writeWithIndent(out, indent, " *\n");
      writeWithIndent(out, indent, " * @return EIS-specific Connection Factory instance or "
            + "javax.resource.cci.ConnectionFactory instance\n");
      writeWithIndent(out, indent, " * @throws ResourceException Generic exception\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public Object createConnectionFactory() throws ResourceException");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1,
            "throw new ResourceException(\"This resource adapter doesn't support non-managed environments\");");

      writeRightCurlyBracket(out, indent);
      writeEol(out);
   }
607618
private void writeJsonForJobs(PrintWriter wrt, List<RecentJobEvent> jobs) {
		
		try {
		
			wrt.write("[");
			
			// Loop Jobs
			for (int i = 0; i < jobs.size(); i++) {
				RecentJobEvent jobEvent = jobs.get(i);
	
				writeJsonForJob(wrt, jobEvent);
	
				//Write seperator between json objects
				if(i != jobs.size() - 1) {
					wrt.write(",");
				}
			}
			wrt.write("]");
		
		} catch (EofException eof) { // Connection closed by client
			LOG.info("Info server for jobmanager: Connection closed by client, EofException");
		} catch (IOException ioe) { // Connection closed by client	
			LOG.info("Info server for jobmanager: Connection closed by client, IOException");
		} 
		
	}
872788
public static void writeToFile(final File fileNode, final byte[] data) throws FrameworkException, IOException {

		setFileProperties(fileNode);

		FileUtils.writeByteArrayToFile(fileNode.getFileOnDisk(), data);

	}
704202
@Override
    public void writeFragmentTo(MwsWriter w) {
        w.write("SellerId", sellerId);
        w.writeList("AmazonOrderId", "Id", amazonOrderId);
    }
106831
@Override
    public void writeFragmentTo(MwsWriter w) {
        w.write("ListOrderItemsResult", listOrderItemsResult);
        w.write("ResponseMetadata", responseMetadata);
    }
31828
@Override
    public void writeFragmentTo(MwsWriter w) {
        w.write("Status", status);
        w.write("Timestamp", timestamp);
        w.write("MessageId", messageId);
        w.writeList("Messages", "Message", messages);
    }
355428
public static void writeTo(String path) throws IOException, NoSuchMethodException, IllegalAccessException,
            InvocationTargetException {
        createXwpfDocumentIfNull();
        MsUtils.writeTo(xwpfDocument, path);
    }
937357
private void write(IRTMPEvent event, Number streamId) {
        log.trace("write to stream id: {} channel: {}", streamId, id);
        final Header header = new Header();
        final Packet packet = new Packet(header, event);
        // set the channel id
        header.setChannelId(id);
        int ts = event.getTimestamp();
        if (ts != 0) {
            header.setTimer(event.getTimestamp());
        }
        header.setStreamId(streamId);
        header.setDataType(event.getDataType());
        // should use RTMPConnection specific method.. 
        //log.trace("Connection type for write: {}", connection.getClass().getName());
        connection.write(packet);
    }
973527
async def write(self, event, ignoreException = True):
        '''
        
        '''
        connmark = self.connmark
        if self.connected:
            def _until():
                if not self.connected or self.connmark != connmark:
                    return True
            r = await self.wait_for_send(event, until=_until)
            if r:
                if ignoreException:
                    return
                else:
                    raise
        else:
            if not ignoreException:
                raise ConnectionResetException
1027400
@Override
    public void writeEnc(Writer w) throws IOException
    {
        w.write("<!ENTITY ");
        w.write(mName);
        w.write(" \"");
        TextEscaper.outputDTDText(w, mRepl, 0, mRepl.length);
        w.write("\">");
    }
463017
public static void writeTo(Node node, Resource file) throws PageException {
	OutputStream os = null;
	try {
	    os = IOUtil.toBufferedOutputStream(file.getOutputStream());
	    writeTo(node, new StreamResult(os), false, false, null, null, null);
	}
	catch (IOException ioe) {
	    throw Caster.toPageException(ioe);
	}
	finally {
	    IOUtil.closeEL(os);
	}
    }
336734
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      int indent = 1;
      out.write("public class " + getClassName(def) + " implements ManagedConnection");
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      writeWithIndent(out, indent, "/** The logger */\n");
      writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");

      writeWithIndent(out, indent, "/** The logwriter */\n");
      writeWithIndent(out, indent, "private PrintWriter logwriter;\n\n");

      writeWithIndent(out, indent, "/** ManagedConnectionFactory */\n");
      writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf;\n\n");

      writeWithIndent(out, indent, "/** Listeners */\n");
      writeWithIndent(out, indent, "private List<ConnectionEventListener> listeners;\n\n");

      writeWithIndent(out, indent, "/** Connections */\n");
      if (def.getMcfDefs().get(getNumOfMcf()).isUseCciConnection())
         writeWithIndent(out, indent,
               "private Set<" + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "> connections;\n\n");
      else
         writeWithIndent(out, indent,
               "private Set<" + def.getMcfDefs().get(getNumOfMcf()).getConnImplClass() + "> connections;\n\n");

      if (def.isSupportEis())
      {
         writeWithIndent(out, indent, "/** Socket */\n");
         writeWithIndent(out, indent, "private Socket socket;\n\n");
      }

      //constructor
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Default constructor\n");
      writeWithIndent(out, indent, " * @param mcf mcf\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent,
            "public " + getClassName(def) + "(" + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf)");
      if (def.isSupportEis())
      {
         out.write(" throws ResourceException");
      }
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this.mcf = mcf;\n");
      writeWithIndent(out, indent + 1, "this.logwriter = null;\n");
      writeWithIndent(out, indent + 1,
            "this.listeners = Collections.synchronizedList(new ArrayList<ConnectionEventListener>(1));\n");
      if (def.getMcfDefs().get(getNumOfMcf()).isUseCciConnection())
         writeWithIndent(out, indent + 1,
               "this.connections = new HashSet<" + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + ">();");
      else
         writeWithIndent(out, indent + 1,
               "this.connections = new HashSet<" + def.getMcfDefs().get(getNumOfMcf()).getConnImplClass() + ">();");

      if (def.isSupportEis())
      {
         writeEol(out);
         writeWithIndent(out, indent + 1, "this.socket = null; // TODO: Initialize me");
      }

      writeRightCurlyBracket(out, indent);
      writeEol(out);

      writeConnection(def, out, indent);
      writeLifecycle(def, out, indent);
      writeConnectionEventListener(def, out, indent);
      writeLogWriter(def, out, indent);
      writeTransaction(def, out, indent);
      writeMetaData(def, out, indent);
      writeMethod(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
569899
protected static void appendTOC(Descriptor descriptor, Collection<Component> components)
    {
        File tocFile = new File(descriptor.filenameFor(Component.TOC));
        PrintWriter w = null;
        try
        {
            w = new PrintWriter(new FileWriter(tocFile, true));
            for (Component component : components)
                w.println(component.name);
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, tocFile);
        }
        finally
        {
            FileUtils.closeQuietly(w);
        }
    }
1370823
public static Map<String, List<TraceEvent>> tocConnections(List<TraceEvent> data) throws Exception
   {
      Map<String, List<TraceEvent>> result = new TreeMap<String, List<TraceEvent>>();

      for (TraceEvent te : data)
      {
         if (te.getType() == TraceEvent.GET_CONNECTION)
         {
            List<TraceEvent> l = result.get(te.getPayload1());

            if (l == null)
               l = new ArrayList<TraceEvent>();

            l.add(te);

            result.put(te.getPayload1(), l);
         }
      }

      return result;
   }
970581
@Override
    public void writeFragmentTo(MwsWriter w) {
        w.write("AmazonOrderId", amazonOrderId);
        w.write("SellerOrderId", sellerOrderId);
        w.write("PurchaseDate", purchaseDate);
        w.write("LastUpdateDate", lastUpdateDate);
        w.write("OrderStatus", orderStatus);
        w.write("FulfillmentChannel", fulfillmentChannel);
        w.write("SalesChannel", salesChannel);
        w.write("OrderChannel", orderChannel);
        w.write("ShipServiceLevel", shipServiceLevel);
        w.write("ShippingAddress", shippingAddress);
        w.write("OrderTotal", orderTotal);
        w.write("NumberOfItemsShipped", numberOfItemsShipped);
        w.write("NumberOfItemsUnshipped", numberOfItemsUnshipped);
        w.writeList("PaymentExecutionDetail", "PaymentExecutionDetailItem", paymentExecutionDetail);
        w.write("PaymentMethod", paymentMethod);
        w.write("MarketplaceId", marketplaceId);
        w.write("BuyerEmail", buyerEmail);
        w.write("BuyerName", buyerName);
        w.write("ShipmentServiceLevelCategory", shipmentServiceLevelCategory);
        w.write("ShippedByAmazonTFM", shippedByAmazonTFM);
        w.write("TFMShipmentStatus", tfmShipmentStatus);
        w.write("CbaDisplayableShippingLabel", cbaDisplayableShippingLabel);
        w.write("OrderType", orderType);
        w.write("EarliestShipDate", earliestShipDate);
        w.write("LatestShipDate", latestShipDate);
        w.write("EarliestDeliveryDate", earliestDeliveryDate);
        w.write("LatestDeliveryDate", latestDeliveryDate);
    }
825205
public void writeData(Writer w) throws IOException {
    PrintWriter out = new PrintWriter(w);

    for (IntTaggedWord itw : seenCounter.keySet()) {
      out.println(itw.toLexicalEntry(wordIndex, tagIndex) + " SEEN " + seenCounter.getCount(itw));
    }
    for (IntTaggedWord itw : getUnknownWordModel().unSeenCounter().keySet()) {
      out.println(itw.toLexicalEntry(wordIndex, tagIndex) + " UNSEEN " + getUnknownWordModel().unSeenCounter().getCount(itw));
    }
    for (int i = 0; i < smooth.length; i++) {
      out.println("smooth[" + i + "] = " + smooth[i]);
    }
    out.flush();
  }