Output class

@param def definition
@param out Writer
@throws IOException ioException
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);
   }
431092
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {

      out.write("public class " + getClassName(def) + " implements ConnectionFactory");
      writeLeftCurlyBracket(out, 0);
      int indent = 1;

      writeWithIndent(out, indent, "private Reference reference;\n\n");

      writeDefaultConstructor(def, out, indent);

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

      writeWithIndent(out, indent, "public " + getClassName(def) + "(ConnectionManager cxManager)");
      writeLeftCurlyBracket(out, indent);
      writeRightCurlyBracket(out, indent);
      writeEol(out);

      writeConnection(def, out, indent);
      writeMetaData(def, out, indent);
      writeRecordFactory(def, out, indent);
      writeReference(def, out, indent);
      writeRightCurlyBracket(out, 0);
   }
248448
private void writeConnection(Definition def, Writer out, int indent) throws IOException
   {
      writeWithIndent(out, indent, "/** \n");
      writeWithIndent(out, indent, " * Get connection from factory\n");
      writeWithIndent(out, indent, " *\n");
      writeWithIndent(out, indent,
            " * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n");
      writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() +
            " getConnection() throws ResourceException;\n");
   }
125393
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      out.write("public class " + getClassName(def));
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      int indent = 1;

      writeWithIndent(out, indent, "/** The resource adapter */\n");
      writeWithIndent(out, indent, "private " + def.getRaClass() + " ra;\n\n");

      writeWithIndent(out, indent, "/** Activation spec */\n");
      writeWithIndent(out, indent, "private " + def.getAsClass() + " spec;\n\n");

      writeWithIndent(out, indent, "/** The message endpoint factory */\n");
      writeWithIndent(out, indent, "private MessageEndpointFactory endpointFactory;\n\n");

      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Default constructor\n");
      writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n");
      writeWithIndent(out, indent, " */\n");
      writeWithIndent(out, indent, "public " + getClassName(def) + "() throws ResourceException");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this(null, null, null);");
      writeRightCurlyBracket(out, indent);
      writeEol(out);

      //constructor
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Constructor\n");
      writeWithIndent(out, indent, " * @param ra " + def.getRaClass());
      writeEol(out);
      writeWithIndent(out, indent, " * @param endpointFactory MessageEndpointFactory\n");
      writeWithIndent(out, indent, " * @param spec " + def.getAsClass());
      writeEol(out);
      writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public " + getClassName(def) + "(" + def.getRaClass() + " ra, \n");
      writeWithIndent(out, indent + 1, "MessageEndpointFactory endpointFactory,\n");
      writeWithIndent(out, indent + 1, def.getAsClass() + " spec) throws ResourceException\n");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this.ra = ra;\n");
      writeWithIndent(out, indent + 1, "this.endpointFactory = endpointFactory;\n");
      writeWithIndent(out, indent + 1, "this.spec = spec;");
      writeRightCurlyBracket(out, indent);
      writeEol(out);

      writeGetAs(def, out, indent);
      writeMef(def, out, indent);
      writeStartStop(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
1179741
private void writeVars(Definition def, Writer out, int indent) throws IOException
   {
      writeWithIndent(out, indent, "/** JNDI name */\n");
      writeWithIndent(out, indent,
            "private static final String JNDI_NAME = \"java:/eis/" + def.getDefaultValue() + "\";\n\n");

      writeWithIndent(out, indent, "/** MBeanServer instance */\n");
      writeWithIndent(out, indent, "private MBeanServer mbeanServer;\n\n");

      writeWithIndent(out, indent, "/** Object Name */\n");
      writeWithIndent(out, indent, "private String objectName;\n\n");

      writeWithIndent(out, indent, "/** The actual ObjectName instance */\n");
      writeWithIndent(out, indent, "private ObjectName on;\n\n");

      writeWithIndent(out, indent, "/** Registered */\n");
      writeWithIndent(out, indent, "private boolean registered;\n\n");
   }
138426
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(COLOR_RED);
        result.write(intToByteArray(red));
        result.write(COLOR_GREEN);
        result.write(intToByteArray(green));
        result.write(COLOR_BLUE);
        result.write(intToByteArray(blue));
        result.write(COLON);    	
    }
1227995
public void writeDefinition(final OutputStream result) throws IOException 
    {
        result.write(DocWriter.getISOBytes("{"));
        result.write(DocWriter.getISOBytes("\\style"));
        result.write(DocWriter.getISOBytes("\\s"));
        result.write(intToByteArray(this.styleNumber));
        result.write(RtfBasicElement.DELIMITER);
        writeParagraphSettings(result);
        super.writeBegin(result);
        result.write(RtfBasicElement.DELIMITER);
        result.write(DocWriter.getISOBytes(this.styleName));
        result.write(DocWriter.getISOBytes(";"));
        result.write(DocWriter.getISOBytes("}"));
        this.document.outputDebugLinebreak(result);   	
    }
673535
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        if (!classDefinesElementType()) {
            out.writeUTF(_elementType.getName());
        }
        out.write(_contents);
    }
27649
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      int indent = 1;
      out.write("public interface " + getClassName(def));
      writeLeftCurlyBracket(out, 0);
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Receive message\n");
      writeWithIndent(out, indent, " * @param msg String.\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public void onMessage(String msg);");

      writeRightCurlyBracket(out, 0);
   }
516374
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      if (def.isUseAnnotation())
      {
         out.write("@AdministeredObject(adminObjectInterfaces = { ");
         out.write(def.getAdminObjects().get(numOfAo).getAdminObjectInterface());
         out.write(".class })\n");
      }
      out.write("public class " + getClassName(def) + " implements " +
            def.getAdminObjects().get(numOfAo).getAdminObjectInterface());
      if (def.isAdminObjectImplRaAssociation())
      {
         out.write(",\n");
         writeIndent(out, 1);
         out.write("ResourceAdapterAssociation, Referenceable, Serializable");
      }
      writeLeftCurlyBracket(out, 0);
      int indent = 1;

      writeIndent(out, indent);
      out.write("/** Serial version uid */\n");
      writeIndent(out, indent);
      out.write("private static final long serialVersionUID = 1L;\n\n");

      if (def.isAdminObjectImplRaAssociation())
      {
         writeWithIndent(out, indent, "/** The resource adapter */\n");
         writeIndent(out, indent);
         if (def.isRaSerial())
         {
            out.write("private ResourceAdapter ra;\n\n");
         }
         else
         {
            out.write("private transient ResourceAdapter ra;\n\n");
         }

         writeWithIndent(out, indent, "/** Reference */\n");
         writeWithIndent(out, indent, "private Reference reference;\n\n");
      }
      writeConfigPropsDeclare(def, out, indent);

      writeDefaultConstructor(def, out, indent);

      writeConfigProps(def, out, indent);

      if (def.isAdminObjectImplRaAssociation())
      {
         writeResourceAdapter(def, out, indent);
         writeReference(def, out, indent);
      }
      writeHashCode(def, out, indent);
      writeEquals(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
184066
@SuppressWarnings("unchecked")
  public Class<? extends OutputFormat<?,?>> getOutputFormatClass() 
     throws ClassNotFoundException {
    return (Class<? extends OutputFormat<?,?>>) 
      conf.getClass(OUTPUT_FORMAT_CLASS_ATTR, TextOutputFormat.class);
  }
502291
public void setOutputFormatClass(Class<? extends OutputFormat> cls
                                   ) throws IllegalStateException {
    ensureState(JobState.DEFINE);
    conf.setClass(OUTPUT_FORMAT_CLASS_ATTR, cls, OutputFormat.class);
  }
1327337
public void writeDefinition(final OutputStream result) throws IOException 
    {
        result.write(DEFAULT_FONT);
        result.write(intToByteArray(0));
        result.write(OPEN_GROUP);
        result.write(FONT_TABLE);
        for(int i = 0; i < fontList.size(); i++) {
            result.write(OPEN_GROUP);
            result.write(FONT_NUMBER);
            result.write(intToByteArray(i));
            RtfFont rf = (RtfFont) fontList.get(i);
            rf.writeDefinition(result);
            result.write(COMMA_DELIMITER);
            result.write(CLOSE_GROUP);
        }
        result.write(CLOSE_GROUP);
        this.document.outputDebugLinebreak(result);    	
    }
904974
@Override
   public void writeImport(Definition def, Writer out) throws IOException
   {
      out.write("package " + def.getRaPackage() + ";\n\n");
      if (def.isAdminObjectImplRaAssociation())
      {
         out.write("import java.io.Serializable;\n\n");
         out.write("import javax.naming.NamingException;\n");
         out.write("import javax.naming.Reference;\n\n");
         out.write("import javax.resource.Referenceable;\n");
      }
      if (def.isUseAnnotation())
      {
         out.write("import javax.resource.spi.AdministeredObject;\n");
         out.write("import javax.resource.spi.ConfigProperty;\n");
      }
      if (def.isAdminObjectImplRaAssociation())
      {
         out.write("import javax.resource.spi.ResourceAdapter;\n");
         out.write("import javax.resource.spi.ResourceAdapterAssociation;\n");
      }
      writeEol(out);
   }
1087685
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(ANSI);
        result.write(ANSI_CODEPAGE);
        result.write(intToByteArray(1252));
        this.document.outputDebugLinebreak(result);    	
    }
150289
private void writeOutbound(Definition def, Writer out, int indent) throws IOException
   {
      writeIndent(out, indent);
      out.write("<outbound-resourceadapter>");
      writeEol(out);

      for (int num = 0; num < def.getMcfDefs().size(); num++)
      {

         writeIndent(out, indent + 1);
         out.write("<connection-definition>");
         writeEol(out);
         writeIndent(out, indent + 2);
         out.write("<managedconnectionfactory-class>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(num).getMcfClass() + "</managedconnectionfactory-class>");
         writeEol(out);
         writeConfigPropsXml(def.getMcfDefs().get(num).getMcfConfigProps(), out, indent + 2);

         if (!def.getMcfDefs().get(num).isUseCciConnection())
         {
            writeIndent(out, indent + 2);
            out.write("<connectionfactory-interface>" + def.getRaPackage() + "." +
                  def.getMcfDefs().get(num).getCfInterfaceClass() + "</connectionfactory-interface>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<connectionfactory-impl-class>" + def.getRaPackage() + "." +
                  def.getMcfDefs().get(num).getCfClass() + "</connectionfactory-impl-class>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<connection-interface>" + def.getRaPackage() + "." +
                  def.getMcfDefs().get(num).getConnInterfaceClass() + "</connection-interface>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<connection-impl-class>" + def.getRaPackage() + "." +
                  def.getMcfDefs().get(num).getConnImplClass() + "</connection-impl-class>");
            writeEol(out);
         }
         else
         {
            writeIndent(out, indent + 2);
            out.write("<connectionfactory-interface>javax.resource.cci.ConnectionFactory"
                  + "</connectionfactory-interface>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<connectionfactory-impl-class>" + def.getRaPackage() + "." +
                  def.getMcfDefs().get(num).getCciConnFactoryClass() + "</connectionfactory-impl-class>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<connection-interface>javax.resource.cci.Connection</connection-interface>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<connection-impl-class>" + def.getRaPackage() + "." +
                  def.getMcfDefs().get(num).getCciConnClass() + "</connection-impl-class>");
            writeEol(out);
         }
         writeIndent(out, indent + 1);
         out.write("</connection-definition>");
         writeEol(out);
      }
      writeIndent(out, indent + 1);
      out.write("<transaction-support>" + def.getSupportTransaction() + "</transaction-support>");
      writeEol(out);

      if (def.getAuthenMechanisms() != null && def.getAuthenMechanisms().size() > 0)
      {
         for (int i = 0; i < def.getAuthenMechanisms().size(); i++)
         {
            writeIndent(out, indent + 1);
            out.write("<authentication-mechanism>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<authentication-mechanism-type>" + def.getAuthenMechanisms().get(i).getAuthMechanism() +
                  "</authentication-mechanism-type>");
            writeEol(out);
            writeIndent(out, indent + 2);
            out.write("<credential-interface>");
            if (def.getAuthenMechanisms().get(i).getCredentialInterface().equals("GSSCredential"))
               out.write("org.ietf.jgss.GSSCredential");
            else
               out.write("javax.resource.spi.security." + def.getAuthenMechanisms().get(i).getCredentialInterface());
            out.write("</credential-interface>");
            writeEol(out);
            writeIndent(out, indent + 1);
            out.write("</authentication-mechanism>");
            writeEol(out);
         }
      }

      writeIndent(out, indent + 1);
      out.write("<reauthentication-support>" + def.isSupportReauthen() + "</reauthentication-support>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("</outbound-resourceadapter>");
      writeEol(out);
   }
463818
@Override
   public void writeImport(Definition def, Writer out) throws IOException
   {
      out.write("package " + def.getRaPackage() + ";\n\n");
      out.write("import javax.naming.NamingException;\n");
      out.write("import javax.naming.Reference;\n\n");
      out.write("import javax.resource.ResourceException;\n");
      out.write("import javax.resource.cci.Connection;\n");
      out.write("import javax.resource.cci.ConnectionFactory;\n");
      out.write("import javax.resource.cci.ConnectionSpec;\n");
      out.write("import javax.resource.cci.RecordFactory;\n");
      out.write("import javax.resource.cci.ResourceAdapterMetaData;\n");
      out.write("import javax.resource.spi.ConnectionManager;\n\n");
      if (def.getMcfDefs().size() != 1)
         out.write("import " + def.getRaPackage() + ".*;\n\n");
   }