Nope, haven't gotten there yet. We're porting our App to Jonas2 as a
background task.
Do you have something available? Are there other tools available for
this? At one time I thought I heard mention of Sun providing a
conversion tool.
Thanks,
Tom
Olivier Richaud wrote:
>
> I was in the process of writing my own convertor but I found yours very
> interresting. I must congratulate you for this work and for offering your
> work to the community.
>
> Neverthless, did you also worked on the jonas specific properties files that
> were neccessary to link data members to SQL? Did you work on reengineering
> class that produce a Jona specific XML descriptor as now required in Jonas
> since it replaces the deprecated properties files that were necessary?
>
> Thanks in advance.
>
> Olivier Richaud
> CSTB
> office: +33 4 93 95 67 24
> mobile: +33 6 87 52 53 17
> www: http://cic.cstb.fr
> ----- Message d'origine -----
> De : Tom Casaletto <[EMAIL PROTECTED]>
> � : <[EMAIL PROTECTED]>
> Envoy� : jeudi 27 avril 2000 05:27
> Objet : Converting .ser -> xml
>
> > In case anyone is interested, we have hacked a quick program to convert
> > serialized deployment descriptors into XML. It is tuned here and there
> > for our particulars but is a good starting point if you have a lot of
> > beans.
> >
> > -Tom Casaletto
> > [EMAIL PROTECTED]
> > --------------
> >
> > // DDConverter.java
> >
> > import javax.ejb.deployment.DeploymentDescriptor;
> > import javax.ejb.deployment.SessionDescriptor;
> > import javax.ejb.deployment.EntityDescriptor;
> > import javax.ejb.deployment.AccessControlEntry;
> > import javax.ejb.deployment.ControlDescriptor;
> > import javax.naming.Name;
> > import java.security.Identity;
> > import java.util.Properties;
> > import java.util.StringTokenizer;
> >
> > import java.io.FileInputStream;
> > import java.io.ObjectInput;
> > import java.io.ObjectInputStream;
> >
> > import java.lang.reflect.Method;
> > import java.lang.reflect.Field;
> >
> > import java.io.File;
> > import java.io.FileWriter;
> > import java.io.BufferedWriter;
> >
> > import java.util.Iterator;
> > import java.util.List;
> > import java.util.LinkedList;
> >
> > // This program converts serialized deployment descriptors into
> > // XML files. You pass in the names of the serialized deployment
> > // descriptor files and it creates xml files with the same info.
> > // e.g bash>java DDConverter myEntityBean.ser mySessionBean1.ser
> > mySessionBean2.ser
> > //
> > // would create myEntityBean.ser.xml mySessionBean1.ser.xml
> > mySessionBean2.ser.xml
> >
> > class DDConverter {
> >
> > static File outputFile = null;
> > static BufferedWriter writer = null;
> > static String tab = " ";
> > static List beans = new LinkedList();
> >
> > public static void main(String argv[]) {
> >
> > if (argv.length <= 0) {
> > System.out.println("usage: java DDConverter <bean1.ser>
> > [bean2.ser | bean3.ser | ...]");
> > System.exit(1);
> > } else {
> > for (int i=0; i<argv.length; i++) {
> > beans.add(argv[i]);
> > }
> > }
> >
> > System.out.println("starting conversion...");
> >
> > Iterator it = beans.iterator();
> > while (it.hasNext()) {
> > String serFile = (String)it.next();
> > System.out.println(" attempting to convert: "+serFile);
> >
> > StringTokenizer t = new StringTokenizer(serFile,".");
> > String beanName = t.nextToken();
> > boolean isSession = false;
> > DeploymentDescriptor desc = null;
> >
> > try {
> > outputFile = new File(serFile+".xml");
> > writer = new BufferedWriter(new FileWriter(outputFile));
> > } catch (Exception e) {
> > System.out.println("Cannot open output file");
> > System.exit(1);
> > }
> >
> > try {
> > ObjectInput in = new ObjectInputStream (new
> > FileInputStream(serFile));
> > desc = (SessionDescriptor)in.readObject();
> > isSession = true;
> > System.out.println(" Session Deployment descriptor
> > found");
> > } catch (ClassCastException e) {
> > System.out.println(" Session Deployment descriptor not
> > found, must be an entity bean");
> >
> > try {
> > ObjectInput in2 = new ObjectInputStream (new
> > FileInputStream(serFile));
> > desc = (EntityDescriptor)in2.readObject();
> > System.out.println(" Entity Deployment descriptor
> > found");
> > } catch (Exception ex) {
> > System.out.println("Cannot read entity dd:" +
> > serFile );
> > System.exit(1);
> > }
> >
> > } catch (Exception exc) {
> > System.out.println("Cannot read session dd:" + exc);
> > exc.printStackTrace();
> > System.out.println("Cannot read session dd:" + serFile);
> > System.exit(1);
> > }
> >
> > try {
> > writer.write("<!DOCTYPE ejb-jar SYSTEM
> > \"../../../xml/ejb-jar_1_1.dtd\">");
> > writer.newLine();
> > writer.write("<ejb-jar>");
> > writer.newLine();
> > writer.write(tab+"<description>Deployment descriptor for
> > the "+serFile+"</description>");
> > writer.newLine();
> > writer.write(tab+"<enterprise-beans>");
> > writer.newLine();
> > if (isSession) {
> > writer.write(tab+tab+"<session>");
> > } else {
> > writer.write(tab+tab+"<entity>");
> > }
> > writer.newLine();
> >
> >
> > writer.write(tab+tab+tab+"<ejb-name>"+beanName+"</ejb-name>");
> > writer.newLine();
> >
> >
> writer.write(tab+tab+tab+"<home>"+desc.getHomeInterfaceClassName()+"</home>"
> );
> > writer.newLine();
> >
> >
> writer.write(tab+tab+tab+"<remote>"+desc.getRemoteInterfaceClassName()+"</re
> mote>");
> > writer.newLine();
> >
> >
> writer.write(tab+tab+tab+"<ejb-class>"+desc.getEnterpriseBeanClassName()+"</
> ejb-class>");
> > writer.newLine();
> > if (isSession) {
> > int smt =
> > ((SessionDescriptor)desc).getStateManagementType();
> > if (smt == SessionDescriptor.STATELESS_SESSION) {
> >
> > writer.write(tab+tab+tab+"<session-type>Stateless</session-type>");
> > } else {
> >
> > writer.write(tab+tab+tab+"<session-type>Stateful</session-type>");
> > }
> > writer.newLine();
> > } else {
> > String pkName =
> > ((EntityDescriptor)desc).getPrimaryKeyClassName();
> >
> >
> writer.write(tab+tab+tab+"<persistence-type>Container</persistence-type>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+"<prim-key-class>"+pkName+"</prim-key-class>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+"<reentrant>False</reentrant>");
> > writer.newLine();
> > }
> >
> >
> writer.write(tab+tab+tab+"<transaction-type>Container</transaction-type>");
> > writer.newLine();
> >
> > if (!isSession) {
> > Field [] fs =
> > ((EntityDescriptor)desc).getContainerManagedFields();
> > if (fs != null && fs.length>0) {
> > for (int j=0; j<fs.length; j++) {
> >
> >
> writer.write(tab+tab+tab+"<cmp-field><field-name>"+fs[j].getName()+"</cmp-fi
> eld></field-name>");
> > writer.newLine();
> > }
> > }
> > }
> >
> > if (isSession) {
> > writer.write(tab+tab+"</session>");
> > } else {
> > writer.write(tab+tab+"</entity>");
> > }
> > writer.newLine();
> > writer.write(tab+"</enterprise-beans>");
> > writer.newLine();
> >
> >
> > writer.write(tab+"<assembly-descriptor>");
> > writer.newLine();
> >
> > ControlDescriptor[] cds = desc.getControlDescriptors();
> > if (cds != null && cds.length>0) {
> > for (int j=0; j<cds.length; j++) {
> > ControlDescriptor cd = cds[j];
> > Method m = cd.getMethod();
> > int isoLevel = cd.getIsolationLevel();
> > int runAs = cd.getRunAsMode();
> > int txAttr = cd.getTransactionAttribute();
> >
> > String methodName = new String();
> > if (m!=null) {
> > methodName = m.getName();
> > } else {
> > methodName = "*";
> > }
> >
> > // public static final int TX_NOT_SUPPORTED =
> > 0;
> > // public static final int TX_BEAN_MANAGED =
> > 1;
> > // public static final int TX_REQUIRED =
> > 2;
> > // public static final int TX_SUPPORTS =
> > 3;
> > // public static final int TX_REQUIRES_NEW =
> > 4;
> > // public static final int TX_MANDATORY =
> > 5;
> > // public static final int TX_NEVER =
> > 6;
> >
> > writer.write(tab+tab+"<container-transaction>");
> > writer.newLine();
> > writer.write(tab+tab+tab+"<method>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+tab+"<ejb-name>"+beanName+"</ejb-name>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+tab+"<method-name>"+methodName+"</method-name>");
> > writer.newLine();
> > writer.write(tab+tab+tab+"</method>");
> > writer.newLine();
> > if (txAttr == 0) {
> >
> >
> writer.write(tab+tab+tab+"<trans-attribute>NotSupported</trans-attribute>");
> > } else if (txAttr == 1) {
> >
> >
> writer.write(tab+tab+tab+"<trans-attribute>BeanManaged</trans-attribute>");
> > } else if (txAttr == 2) {
> >
> > writer.write(tab+tab+tab+"<trans-attribute>Required</trans-attribute>");
> > } else if (txAttr == 3) {
> >
> > writer.write(tab+tab+tab+"<trans-attribute>Supports</trans-attribute>");
> > } else if (txAttr == 4) {
> >
> >
> writer.write(tab+tab+tab+"<trans-attribute>RequiresNew</trans-attribute>");
> > } else if (txAttr == 5) {
> >
> > writer.write(tab+tab+tab+"<trans-attribute>Mandatory</trans-attribute>");
> > } else if (txAttr == 6) {
> >
> > writer.write(tab+tab+tab+"<trans-attribute>Never</trans-attribute>");
> > }
> > writer.newLine();
> >
> > writer.write(tab+tab+"</container-transaction>");
> > writer.newLine();
> >
> > }
> > } else {
> > writer.write(tab+tab+"<container-transaction>");
> > writer.newLine();
> > writer.write(tab+tab+tab+"<method>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+tab+"<ejb-name>"+beanName+"</ejb-name>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+tab+"<method-name>*</method-name>");
> > writer.newLine();
> > writer.write(tab+tab+tab+"</method>");
> > writer.newLine();
> >
> > writer.write(tab+tab+tab+"<trans-attribute>Supports</trans-attribute>");
> > writer.newLine();
> > writer.write(tab+tab+"</container-transaction>");
> > writer.newLine();
> > }
> >
> > writer.write(tab+"</assembly-descriptor>");
> > writer.newLine();
> >
> > writer.write("</ejb-jar>");
> > writer.close();
> >
> > System.out.println(" successfully converted:
> > "+serFile);
> > System.out.println("");
> >
> > } catch (Exception e) {
> > System.out.println("problems in main");
> > System.exit(1);
> > }
> > }
> > System.out.println("normal completion...");
> >
> > }
> > }
> > ----
> > To unsubscribe, send email to [EMAIL PROTECTED] and
> > include in the body of the message "unsubscribe jonas-users".
> > For general help, send email to [EMAIL PROTECTED] and
> > include in the body of the message "help".
> >
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".