FileDocCategorySizeDatePackage
MakeDD.javaAPI DocExample2473Sun Mar 07 08:37:20 GMT 1999com.titan.ship

MakeDD

public class MakeDD extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        try{

        if(args.length <1){
            System.out.println("must specify target directory");
            return;
        }
        EntityDescriptor shipDD = new EntityDescriptor();

        shipDD.setEnterpriseBeanClassName("com.titan.ship.ShipBean");

        shipDD.setHomeInterfaceClassName("com.titan.ship.ShipHome");

        shipDD.setRemoteInterfaceClassName("com.titan.ship.Ship");

        shipDD.setPrimaryKeyClassName("com.titan.ship.ShipPK");


        Class beanClass = ShipBean.class;
        Field [] persistentFields = new Field[4];
        persistentFields[0] = beanClass.getDeclaredField("id");
        persistentFields[1] = beanClass.getDeclaredField("name");
        persistentFields[2] = beanClass.getDeclaredField("capacity");
        persistentFields[3] = beanClass.getDeclaredField("tonnage");
        shipDD.setContainerManagedFields(persistentFields);

        shipDD.setReentrant(false);

        CompoundName jndiName =
        new CompoundName("ShipHome", new Properties());
        shipDD.setBeanHomeName(jndiName);

        ControlDescriptor cd = new ControlDescriptor();
        cd.setIsolationLevel(ControlDescriptor.TRANSACTION_READ_COMMITTED );
        cd.setMethod(null);
        cd.setRunAsMode(ControlDescriptor.CLIENT_IDENTITY);
        cd.setTransactionAttribute(ControlDescriptor.TX_REQUIRED);
        ControlDescriptor [] cdArray = {cd};
        shipDD.setControlDescriptors(cdArray);

        // Set the name to associate with the enterprise Bean
        // in the JNDI name space.

        String fileSeparator = System.getProperties().getProperty(
            "file.separator");

        if(! args[0].endsWith(fileSeparator))
            args[0] += fileSeparator;

        FileOutputStream fis = new FileOutputStream(args[0]+"ShipDD.ser");
        ObjectOutputStream oos = new ObjectOutputStream(fis);
        oos.writeObject(shipDD);
        oos.flush();
        oos.close();
        fis.close();

        }catch(Throwable t){t.printStackTrace();}