IMPROVEKIT

BROKERstep

It is a Framework for OS / X compatible with GNUstep of persistent layer objects (Objective-C) / relational (MySQL, Postgres, Sybase) - With similar features it is based on tools of the time, such as "TopLink" and "Visual Works Lens". It was my first experience in coding in Objective-C (10.6 KLOC!), to learn the language (with a dynamic look from Smalltalk), about frameworks in OS / X with the idea of ​​releasing it as a library for future developments.

The idea was to migrate Wichi made in Smalltalk to be able to build dynamically adaptive systems on OS / X. Although I did not get to do this (I started with my Dalí project, and later with the Master CTS), this framework was tested, with the addition of certain extensions that seemed necessary to me based on my previous experience in using the VW "Lens"

Some features of the framework:

• ODBC Wrapper, compatible with Unix ODBC (tested on Mysql, Postgres, and Sybase)
• Pool of sessions to the database
• Mapping to table or stored procedure
• Dynamic datamodel (mappings can be added in runtime)
• Persistent Object identity
• Dynamic persistent objects (variable structure)
• Objects proxies, Proxy Killing (performance)
• Cascade writes
• 1 to N relationships
• Protocol mapping
• Datamodel specification file
• Transaction management, locks
• Handling Exceptions
• SQL commands (implementation similar to a Block Smalltalk with DB session parameter)
• SQL templates, Stored procedures parameterizable
• Commands to manage the Database schema
• Objective-C class Extensions
• Objective-C message protocols

Objective-C is a beautiful language, as Smalltalker I feel very comfortable. I made some attempts to migrate Smalltalk code (Swiki, Carcaranha, Wichi using the code generator) but did not finish them, since I abandoned the idea of ​​developing in Objective-C and concentrated on Squeak (and Ruby as a helper). Apple has selected Swift, a much more complex language than Objective-C. From the comments I read, I'm not sure which was the best choice.

Go this package in honor of Objective-C creator Brad Cox (May 2, 1944 - January 2, 2021)

 

 

MODEL DATA SPECIFICATION LANGUAGE FOR BROKERstep

(
(class <object-class-name>)
[(table | store-procedure <db-name>)]
[(sequence <dbsequence-name>)]
[(mapping-class <mapping-class-name>)]
[(oid-prefix <oid-type-prefix>)]
(fields (<field-name>
[(type <type-name>)]
[(selector <selector>)]
...))
)

 

Definition

<object-class-name>
class name of the mapped object

<db-name>
string that indicates the name of the table or sp for the persistence of the object. is optional, if not specified <object-class-name> is assumed

<db-sequence-name>
optional. for the generation of the oid a particular name for the sequence can be indicated. if not indicated, it will assume

<db-name> + "_poi_seq"

<mapping-class-name>
optional. class name mapping. if not indicated, it assumes

<object-class-name>

Mapping

<oid-type-prefix>
optional. three-letter string for the oid prefix. is used to determine type. if not specified, a unique value constructed with letters from the <object-class-name> is assigned

<field-name>
field name / argument in database table / sp

<type-name>
field type. possible values ​​are:
"string" ("StringTypeMapping")
"datetime" ("DatetimeTypeMapping")
"integer" ("IntegerTypeMapping")
"double" ("DoubleTypeMapping")
"date" ("DateTypeMapping")
"object" ("ObjectReferenceTypeMapping")
"collection" ("ObjectCollectionTypeMapping")
is optional, if not indicated, it assumes "string"

<selector>
optional. getter / setter method name of the object attribute. if not specified, it assumes <field-name> for the getter

<field-name>:
for the setter

EXAMPLES

Lisp like file

((class 'Person')
(table 'PERSON')
(sequence 'PERSONA_SEQ')
(mapping-class 'PersonMapp')
(oid-prefix 'PER')
(fields ('name' (selector 'name'))
('address' (selector 'address'))
('age' 'integer' (selector 'age'))
('birth' 'date' (selector 'birthday'))
('country' 'object' (selector 'country'))
('rights' 'collection' (selector 'rights')))))

Example (Objective-C code)

#define TEST_FIELDMAPPINGTYPE1 "StringTypeMapping"
#define TEST_FIELDMAPPINGTYPE2 "DatetimeTypeMapping"
#define TEST_FIELDMAPPINGTYPE3 "IntegerTypeMapping"
#define TEST_FIELDMAPPINGTYPE16 "DoubleTypeMapping"
#define TEST_FIELDMAPPINGTYPE17 "DateTypeMapping"
#define TEST_FIELDMAPPINGTYPE18 "ObjectReferenceTypeMapping"
#define TEST_FIELDMAPPINGTYPE25 "ObjectCollectionTypeMapping"

[self setTableName: [self tableName]];
[self setSequenceName: [[self tableName] stringByAppendingString: @ "_ poi_seq"]];
[self setMappedClassName: [[self mappedClass] className]];
[self setOIDPrefix: [self oidPrefix]];
[MappedField
mappedFieldNamed: @ TEST_FIELDNAME24
mapping: [NSClassFromString (@ TEST_FIELDMAPPINGTYPE24) withColumn: @ TEST_FIELDNAME24]
fieldType: NSClassFromString (@ TEST_FIELDTYPE24)
mappedClass: [self mappedClass]
getterName: @ TEST_FIELDNAME24
setterName: [NSString stringWithFormat: @ "% @:", @ TEST_FIELDNAME24]];

Example (PLIST)

<? xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE plist PUBLIC "- // Apple Computer // DTD PLIST 1.0 // EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd%22 >
<plist version = "1.0">
<dict><key> Entities </key>
<dict><key> Person </key>

<dict><key> fields </key><dict>

<key> name </key>
<dict> <key> len </key><string> 30 </string>
<key> selector </key><string> name </string>
<key> type </key><string> string </string>
</dict></dict>
<key> mapping-class </key>
<string> PersonMapp </string>
<key> oid-prefix </key><string> PER </string>

<key> sequence </key><string> PERSONA_SEQ </string>
<key> table </key><string> PERSON </string>
</dict></dict></dict>
</plist>

Contact improvekit@gmail.com