onsdagen den 13 november 2002 kl 23.56 skrev Dain Sundstrom:
public interface MetaDataRepository {
   MetaDataRepository getParent();
   void setParent(MetaDataRepository parent);
   Object get(Object attributeKey);
   void set(Object attributeKey, Object value);
}
maybe add
void setJDBCBackend(url, u, p);
void serConf(path);

Basically this is a plain old map with a possible parent. Exactly how this is implemented, I really don't care; it is a detail. I'm going to write one backed by a HashMap, and we can throw it away later. For attribute keys, I'm thinking of things like MethodTxAttribute that has a method object inside of it. Alternatively, we could lookup by method and get another map back. I don't like that one because it would be too hard to manage with any user interface. There are a million ways to skin this cat. Does anyone have any ideas on how to organize the keys?
<snip>

The final problem is how do we keep this repository in sync with the physical store. For this I would guess we need some sort of listener or notification system. This isn't one of my current problems so I haven't thought about it too much.
hmmm ... me thinks hsqldb is way underused as a admin tool in jboss today ... hehe ... i am biased ... yes ...

hsqldb has a pluggable listener called Trigger.class with one method public void fire(String trigName, String tabName, Object row[]);

so when an jboss instance starts ... it would ofcource need some core configuration either as a xml-file or class.ser ? then one could start a "jdbc:hsqldb:hsql:." instance and go get configuration - also when db changes it will notify other db's throughout *hsqldbr and there is our "distributed metadata repository" ... all sql, all libs in there already ... cool ...

/peter_f

*hsqldbr(eplicated)
http://www.javagroups.com/javagroupsnew/docs/hsqldbr/design.htm

***
/**
* <P>Sample code for use of triggers in hsqldb.
*
* SQL to invoke is:<p>
* CREATE TRIGGER triggerSample BEFORE|AFTER INSERT|UPDATE|DELETE
* ON myTable [FOR EACH ROW] [QUEUE n] [NOWAIT] CALL "myPackage.trigClass"<br>
*
* This will create a thread that will wait for its firing event to occur;
* when this happens, the trigger's thread runs the 'trigClass.fire'
* Note that this is still in the same Java Virtual Machine as the
* database, so make sure the fired method does not hang.<p>
*
* There is a queue of events waiting to be run by each trigger thread.
* This is particularly useful for 'FOR EACH ROW' triggers, when a large
* number of trigger events occur in rapid succession, without the trigger
* thread getting a chance to run. If the queue becomes full, subsequent
* additions to it cause the database engine to suspend awaiting space
* in the queue. Take great care to avoid this situation if the trigger
* action involves accessing the database, as deadlock will occur.
* This can be avoided either by ensuring the QUEUE parameter makes a large
* enough queue, or by using the NOWAIT parameter, which causes a new
* trigger event to overwrite the most recent event in the queue.
* The default queue size is 1024.<p>
*
* Ensure that "myPackage.trigClass" is present in the classpath which
* you use to start hsql.<p>
*
* If the method wants to access the database, it must establish
* a JDBC connection.<p>
*
* When the 'fire' method is called, it is passed the following arguments:<br>
* fire (String trigName, String tabName, Object row[])<br>
*
* where 'row' represents the row acted on, with each column being
* a member of the array. The mapping of row classes to database
* types is specified in /doc/hsqlSyntax.html#Datatypes
*
*
* For implementation at a later date:<br>
* 1. jdbc:default:connection: URL for JDBC trigger method connections to
* the database.<br>
* 2. arguments to the trigger method.<br>
* 3. Because they run in different threads, it is possible for an
* 'after' trigger to run before its corresponding 'before' trigger;
* the acceptability of this needs to be investigated.
*
* @author Peter Hudson
* @version 1.7.0
*/
public class TriggerSample implements org.hsqldb.Trigger {

/**
* fire method declaration
* <P> This is a sample implementation that simply prints information
* about the trigger firing.
*
* @param trigName
* @param tabName
* @param row
*/
public void fire(String trigName, String tabName, Object row[]) {

System.out.println(trigName + " trigger fired on " + tabName);
System.out.print("col 0 value <");
System.out.print(row[0]);
System.out.println(">");

// you can cast row[i] given your knowledge of what the table
// format is.
}
}

/**
*
*
* test SQL
* CREATE CACHED TABLE trig_test (int_field integer)
* CREATE TRIGGER ins_before BEFORE INSERT ON trig_test CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER ins_after AFTER INSERT ON trig_test CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER upd_before BEFORE UPDATE ON trig_test CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER upd_after AFTER UPDATE ON trig_test CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER upd_before_row BEFORE UPDATE ON trig_test FOR EACH ROW CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER upd_after_row AFTER UPDATE ON trig_test FOR EACH ROW CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER del_before BEFORE DELETE ON trig_test CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER del_after AFTER DELETE ON trig_test CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER del_before_row BEFORE DELETE ON trig_test FOR EACH ROW CALL "org.hsqldb.sample.TriggerSample"
* CREATE TRIGGER del_after_row AFTER DELETE ON trig_test FOR EACH ROW CALL "org.hsqldb.sample.TriggerSample"
* INSERT INTO trig_test VALUES (1)
* INSERT INTO trig_test VALUES (2)
* INSERT INTO trig_test VALUES (3)
* UPDATE trig_test SET int_field = int_field + 3
* DELETE FROM trig_test
*/

***



-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to