Create a new clazz

For a class named “Foo” in assembly “Bar”:

  1. Create a sql file that adds suitable records to it, behavior, clazz, and metaclazz, and any superclazzes. If Foo is to have persistent instances, this file should also create a new table named “foo”. By convention, the sql file is named “create_foo.sql”, and is kept in the “sql” subdirectory of the “Bar” directory. NOTE: Each new object requires a new version_id/object_id, and these must be kept in synch with the ZeeStore.
  2. Run, from either the command line or MySqlQueryBrowser, the sql created in the previous step. Validate that the new records exist in the ZeeStore and are well-formed.
  3. Create a python file containing class definitions for the new clazz and its metaclazz. The new file should be named “Foo.py”, and should be located in the “Bar” subdirectory of the zeetix root. Inside “Foo.py”, there should be an import statement that imports the superclazz, and class definitions for “Foo” and “FooClazz”.
  4. Create another python file containing class definitions for the record clazzes of the new clazz. The new file should be named “FooRecord.py”, and should be located in the “Bar” subdirectory of the zeetix root (alongside “Foo.py”). Inside “FooRecord.py”, there should be an import statement that imports the superclazz (another descendant of ItRecord), and class definitions for “FooRecord” and “FooRecordClazz”.
  5. Add implementations of hook methods required by the various framework interfaces, such as “doTransientAttributeNames”, “doTableName”, and so on.
  6. Add an import line and installation code to “BarAssembly.py” that imports and installs Foo and FooRecord.

With proper tweaking of the existing Zeetix naming conventions, it should be possible to generate the required column names (in the DB), record attribute names (in the record clazz), and instance attributes (in the new clazz) from the specification provided in the original subclazz creation method. I do some of this now (I use ZeeString), and could do MUCH MUCH more.

Advertisements

One Response to “Create a new clazz”

  1. Mike Burns Says:

    I think your last paragraph speaks to this, but steps 1-4 and 6 are absolutely scriptable with small amounts of user input. I’d make a simple command-line app that reads in field/type pairs and generates the SQL, classes, etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: