Fisherman and tolerance

Posted & filed under The Rantorium.

First they fished the seas empty. Then they said the seals were eating what was left and tried to have them all killed. Now they say that the fish are for them alone. There’s not enough to go round any more.

Homo Fishiens is laying claim to every scaly swimmer in rivers and lakes, as of course, they have been entitled to fish ever since they could stand upright. Upright not for long though, with the enticing thought of that enormous umbrella which shelters them and their tinnies and fags from the rain while the rod dangles lazily in the water hoping for a passing catch.

It now appears the mega brolly now conceals a small gun emplacement, with sights aimed on passing cormorants. You know, those voracious pirates who fished the seas dry. Or was that fishermen? Anyway, they now want to blow the cormorants away:

Cormorants must die!

Whatever next?

Beware next time you’re in Tesco, reaching for that last salmon on the shelf. There may be a fisherman in the next aisle with his shooter aimed right at you.

Bodington database schema upgrade scripts

Posted & filed under CLAN.

Postgres

Download the Bodington 2.1.1_stable1 to Bodington 2.4.0 database upgrade script
Download the Bodington 2.4.0 to Bodington 2.6.0 database upgrade script

2.1.1_stable1 -> 2.4.0

log_book_entries
– add column linked_url varchar(255)
————————————————————————————————————————
alter table log_book_entries add column linked_url varchar(255);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(53, 8, ‘linked_url’, ‘setLinkedUrl’, ‘getLinkedUrl’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
————————————————————————————————————————

log_book_pages
– add column section_first_big_string_id int4(10)
– add column section_last_big_string_id int4(10)
– add column section_user_first_big_string_id int4(10)
– add column section_user_last_big_string_id int4(10)
– add column question_first_big_string_id int4(10)
– add column question_last_big_string_id int4(10)
– add column question_user_first_big_string_id int4(10)
– add column question_user_last_big_string_id int4(10)
————————————————————————————————————————
alter table log_book_pages add column section_first_big_string_id int;
alter table log_book_pages add column section_last_big_string_id int;
alter table log_book_pages add column section_user_first_big_string_id int;
alter table log_book_pages add column section_user_last_big_string_id int;
alter table log_book_pages add column question_first_big_string_id int;
alter table log_book_pages add column question_last_big_string_id int;
alter table log_book_pages add column question_user_first_big_string_id int;
alter table log_book_pages add column question_user_last_big_string_id int;

CONSTRAINT FK_pages_s_f_to_bgstrs FOREIGN KEY(section_first_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_s_l_to_bgstrs FOREIGN KEY(section_last_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_s_u_f_to_bgstrs FOREIGN KEY(section_user_first_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_s_u_l_to_bgstrs FOREIGN KEY(section_user_last_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_q_f_to_bgstrs FOREIGN KEY(question_first_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_q_l_to_bgstrs FOREIGN KEY(question_last_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_q_u_f_to_bgstrs FOREIGN KEY(question_user_first_big_string_id) REFERENCES big_strings (big_string_id);
CONSTRAINT FK_pages_q_u_l_to_bgstrs FOREIGN KEY(question_user_last_big_string_id) REFERENCES big_strings (big_string_id);

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 9, ‘section_first_big_string_id’, ‘setSectionFirstBigStringId’, ‘getSectionFirstBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 10, ‘section_last_big_string_id’, ‘setSectionLastBigStringId’, ‘getSectionLastBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 11, ‘section_user_first_big_string_id’, ‘setSectionUserFirstBigStringId’, ‘getSectionUserFirstBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 12, ‘section_user_last_big_string_id’, ‘setSectionUserLastBigStringId’, ‘getSectionUserLastBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 13, ‘question_first_big_string_id’, ‘setQuestionFirstBigStringId’, ‘getQuestionFirstBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 14, ‘question_last_big_string_id’, ‘setQuestionLastBigStringId’, ‘getQuestionLastBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 15, ‘question_user_first_big_string_id’, ‘setQuestionUserFirstBigStringId’, ‘getQuestionUserFirstBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(52, 16, ‘question_user_last_big_string_id’, ‘setQuestionUserLastBigStringId’, ‘getQuestionUserLastBigStringId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
————————————————————————————————————————

add table user_x509s
– user_x509_id int4(10)
– user_id int4(10)
– serialized_certificate text(-5)
– serial_number int4(10)
– distinguished_name varchar(255)
————————————————————————————————————————
CREATE TABLE user_x509s (
user_x509_id int NOT NULL,
user_id int NOT NULL ,
serialized_certificate LONG VARCHAR NULL ,
serial_number int NULL,
distinguished_name VARCHAR(255),

CONSTRAINT PK_user_x509s PRIMARY KEY
(
user_x509_id
),
CONSTRAINT FK_user_x509s_to_objects FOREIGN KEY
(
user_x509_id
) REFERENCES objects (
id
),
CONSTRAINT FK_user_x509s_to_users FOREIGN KEY
(
user_id
) REFERENCES users (
user_id
)
);
INSERT INTO classes (type, db_name, table_name, java_class)
VALUES( 58, null, ‘user_x509s’, ‘org.bodington.server.realm.UserX509′);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(58, 1, ‘user_x509_id’, ‘setUserX509Id’, ‘getUserX509Id’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(58, 2, ‘user_id’, ‘setUserId’, ‘getUserId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(58, 3, ‘serialized_certificate’, ‘setSerializedCertificate’, ‘getSerializedCertificate’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(58, 4, ‘serial_number’, ‘setSerialNumber’, ‘getSerialNumber’, ‘int’, ‘int’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(58, 5, ‘distinguished_name’, ‘setDistinguishedName’, ‘getDistinguishedName’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
————————————————————————————————————————

xml_tokens
– add column tertiary_id int4(10)
– add column secondary_id int4(10)
– add column primary_id int4(10)
————————————————————————————————————————
alter table xml_tokens add column tertiary_id int;
alter table xml_tokens add column secondary_id int;
alter table xml_tokens add column primary_id int;
————————————————————————————————————————

xml_words
– add column pos int4(10)
– add column flags int4(10)
————————————————————————————————————————
alter table xml_words add column pos int;
alter table xml_words add column flags int;
————————————————————————————————————————

2.4.0 -> 2.6.0

add table announcements
– announcement_id int4(10)
– announcement_flags int4(10)
————————————————————————————————————————
CREATE TABLE announcements (
announcement_id int NOT NULL ,
announcement_flags int NOT NULL,
CONSTRAINT PK_announcements PRIMARY KEY
(
announcement_id
),
CONSTRAINT FK_announcement_to_resources FOREIGN KEY
(
announcement_id
) REFERENCES resources (
resource_id
)
);

INSERT INTO classes (type, super_type, db_name, table_name, java_class)
VALUES(202, 10, null, ‘announcements’, ‘org.bodington.announcement.server.Announcement’);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(202, 1, ‘announcement_id’, ‘setAnnouncementId’, ‘getAnnouncementId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(202, 2, ‘announcement_flags’, ‘setAnnouncementFlags’, ‘getAnnouncementFlags’, ‘int’, ‘int’, 0, null, null, null );
————————————————————————————————————————

add table imageblocks
– imageblock_id int4(10)
– imageblock_flags int4(10)
– source_url varchar(255)
– alt_tag_text varchar(50)
– link_href varchar(255)
– image_height varchar(5)
– image_width varchar(5)
————————————————————————————————————————
CREATE TABLE imageblocks (
imageblock_id int NOT NULL,
imageblock_flags int NOT NULL,
source_url varchar (255) NULL,
alt_tag_text varchar (50) NULL,
link_href varchar (255) NULL,
image_height varchar (5) NULL,
image_width varchar (5) NULL,

CONSTRAINT PK_imageblocks PRIMARY KEY
(
imageblock_id
),
CONSTRAINT FK_imageblocks_to_resources FOREIGN KEY
(
imageblock_id
) REFERENCES resources (
resource_id
)
);

INSERT INTO classes (type, super_type, db_name, table_name, java_class)
VALUES(104, 10, null, ‘imageblocks’, ‘org.bodington.server.resources.ImageBlockResource’);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 1, ‘imageblock_id’, ‘setImageBlockId’, ‘getImageBlockId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 2, ‘imageblock_flags’, ‘setImageBlockFlags’, ‘getImageBlockFlags’, ‘int’, ‘int’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 3, ‘source_url’, ‘setSourceURL’, ‘getSourceURL’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 4, ‘alt_tag_text’, ‘setAltTagText’, ‘getAltTagText’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 5, ‘link_href’, ‘setLinkHREF’, ‘getLinkHREF’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 6, ‘image_height’, ‘setImageHeight’, ‘getImageHeight’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(104, 7, ‘image_width’, ‘setImageWidth’, ‘getImageWidth’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
————————————————————————————————————————

resources
– add column open_timestamp timestamp(8)
– add column close_timestamp timestamp(8)
————————————————————————————————————————
alter table resources add column open_timestamp TIMESTAMP;
alter table resources add column close_timestamp TIMESTAMP;

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(10, 13, ‘open_timestamp’, ‘setOpenTimestamp’, ‘getOpenTimestamp’, ‘java.sql.Timestamp’, ‘java.sql.Timestamp’, 0, null, null, null);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(10, 14, ‘close_timestamp’, ‘setCloseTimestamp’, ‘getCloseTimestamp’, ‘java.sql.Timestamp’, ‘java.sql.Timestamp’, 0, null, null, null);
————————————————————————————————————————

add table textblocks
– textblock_id int4(10)
– textblock_flags int4(10)
————————————————————————————————————————
CREATE TABLE textblocks (
textblock_id int NOT NULL,
textblock_flags int NOT NULL,

CONSTRAINT PK_textblocks PRIMARY KEY
(
textblock_id
),
CONSTRAINT FK_textblocks_to_resources FOREIGN KEY
(
textblock_id
) REFERENCES resources (
resource_id
)
);

INSERT INTO classes (type, super_type, db_name, table_name, java_class)
VALUES(103, 10, null, ‘textblocks’, ‘org.bodington.server.resources.TextBlockResource’);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(103, 1, ‘textblock_id’, ‘setTextBlockId’, ‘getTextBlockId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(103, 2, ‘textblock_flags’, ‘setTextBlockFlags’, ‘getTextBlockFlags’, ‘int’, ‘int’, 0, null, null, null );
————————————————————————————————————————

users
– add column language varchar(5)
————————————————————————————————————————
alter table users add column language varchar(255);

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(1, 10, ‘language’, ‘setLanguage’, ‘getLanguage’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
————————————————————————————————————————

add table xml_namespaces
– xml_namespace_id int4(10)
– xml_object_id int4(10)
– prefix varchar(50)
– namespace varchar(255)
————————————————————————————————————————
CREATE TABLE xml_namespaces (
xml_namespace_id int NOT NULL,
xml_object_id int NOT NULL,
prefix varchar (50) NOT NULL,
namespace varchar (255) NOT NULL,
CONSTRAINT PK_xml_namespaces PRIMARY KEY (xml_namespace_id)
);
CREATE INDEX IX_xml_namespaces ON xml_namespaces (xml_object_id);
————————————————————————————————————————

xml_attributes
– add column xml_namespace_id int4(10)
————————————————————————————————————————
alter table xml_attributes add column xml_namespace_id int;

alter table xml_attributes add CONSTRAINT FK_xml_atts_xml_namespaces FOREIGN KEY(xml_namespace_id) REFERENCES xml_namespaces (xml_namespace_id);
alter table xml_attributes add CONSTRAINT FK_xml_atts_xml_namespaces FOREIGN KEY(xml_namespace_id) REFERENCES xml_namespaces (xml_namespace_id);
————————————————————————————————————————

xml_elements
– add column xml_namespace_id int4(10)
————————————————————————————————————————
alter table xml_elements add column xml_namespace_id int;

alter table xml_elements add CONSTRAINT FK_xml_elements_xml_namespaces FOREIGN KEY(xml_namespace_id) REFERENCES xml_namespaces (xml_namespace_id);
alter table xml_elements add CONSTRAINT FK_xml_elements_xml_namespaces FOREIGN KEY(xml_namespace_id) REFERENCES xml_namespaces (xml_namespace_id);
————————————————————————————————————————

add table bookmarks
————————————————————————————————————————
CREATE TABLE bookmarks (
bookmark_id int NOT NULL ,
bookmark_flags int2 NOT NULL,
CONSTRAINT PK_bookmarks PRIMARY KEY
(
bookmark_id
),
CONSTRAINT FK_bookmarks_to_resources FOREIGN KEY
(
bookmark_id
) REFERENCES resources (
resource_id
)
);

INSERT INTO classes (type, super_type, db_name, table_name, java_class)
VALUES(201, 10, null, ‘bookmarks’, ‘org.bodington.bookmark.server.BookMark’);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(201, 1, ‘bookmark_id’, ‘setBookMarkId’, ‘getBookMarkId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(201, 2, ‘bookmark_flags’, ‘setBookMarkFlags’, ‘getBookMarkFlags’, ‘byte’, ‘byte’, 0, null, null, null );
————————————————————————————————————————

add table bookmark_items
————————————————————————————————————————
CREATE TABLE bookmark_items (
bookmark_item_id int NOT NULL ,
bookmark_id int NOT NULL ,
url varchar (255) NOT NULL ,
description varchar (255) NOT NULL ,
target varchar (255) ,
ordinal int NOT NULL,
flags int NOT NULL,
CONSTRAINT PK_bookmark_items PRIMARY KEY
(
bookmark_item_id
),
CONSTRAINT FK_bookmark_items_to_objects FOREIGN KEY
(
bookmark_item_id
) REFERENCES objects (
id
),
CONSTRAINT FK_bookmark_items_to_bookmarks FOREIGN KEY
(
bookmark_id
) REFERENCES bookmarks (
bookmark_id
)
);

INSERT INTO classes (type, super_type, db_name, table_name, java_class)
VALUES(2010, null, null, ‘bookmark_items’, ‘org.bodington.bookmark.server.BookMarkItem’);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 1, ‘bookmark_item_id’, ‘setBookMarkItemId’, ‘getBookMarkItemId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 2, ‘bookmark_id’, ‘setBookMarkId’, ‘getBookMarkId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 3, ‘url’, ‘setUrl’, ‘getUrl’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 4, ‘description’, ‘setDescription’, ‘getDescription’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 5, ‘target’, ‘setTarget’, ‘getTarget’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 6, ‘ordinal’, ‘setOrdinal’, ‘getOrdinal’, ‘int’, ‘int’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(2010, 7, ‘flags’, ‘setFlags’, ‘getFlags’, ‘int’, ‘int’, 0, null, null, null );
————————————————————————————————————————

add table forums
————————————————————————————————————————
CREATE TABLE forums (
forum_id int NOT NULL ,
external_id int NOT NULL ,
forum_flags int NOT NULL,
CONSTRAINT PK_forums PRIMARY KEY
(
forum_id
),
CONSTRAINT FK_forum_to_resources FOREIGN KEY
(
forum_id
) REFERENCES resources (
resource_id
)
);

INSERT INTO classes (type, super_type, db_name, table_name, java_class)
VALUES(203, 10, null, ‘forums’, ‘org.bodington.forum.server.Forum’);
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(203, 1, ‘forum_id’, ‘setForumId’, ‘getForumId’, ‘org.bodington.database.PrimaryKey’, ‘org.bodington.database.PrimaryKey’, 1, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(203, 2, ‘external_id’, ‘setExternalId’, ‘getExternalId’, ‘int’, ‘int’, 0, null, null, null );
INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
VALUES(203, 3, ‘forum_flags’, ‘setForumFlags’, ‘getForumFlags’, ‘int’, ‘int’, 0, null, null, null );
————————————————————————————————————————

log_book_pages
– section_user_first_big_string_id -> section_user_first_big_str_id
– section_user_last_big_string_id -> section_user_last_big_str_id
– question_user_first_big_string_id -> question_user_first_big_str_id
– question_user_last_big_string_id -> question_user_last_big_str_id
————————————————————————————————————————
alter table log_book_pages rename column section_user_first_big_string_id to section_user_first_big_str_id;
alter table log_book_pages rename column section_user_last_big_string_id to section_user_last_big_str_id;
alter table log_book_pages rename column question_user_first_big_string_id to question_user_first_big_str_id;
alter table log_book_pages rename column question_user_last_big_string_id to question_user_last_big_str_id;
update fields set field=’section_user_first_big_str_id’ where field=’section_user_first_big_string_id’;
update fields set field=’section_user_last_big_str_id’ where field=’section_user_last_big_string_id’;
update fields set field=’question_user_first_big_str_id’ where field=’question_user_first_big_string_id’;
update fields set field=’question_user_last_big_str_id’ where field=’question_user_last_big_string_id’;
————————————————————————————————————————

SAMUEL gets SAML2 Metadata

Posted & filed under Guanxi.

Well, I’m completely out of cakes now. That took a wee while, well, two days reading and two days coding but enough to empty the cake trolley. What SAMUEL now has is a set of object bindings for SAML2 Metadata. I’m going to use these in the Guanxi Service Provider to authenticate and manage Guards from the Engine. There wasn’t a suitable type in the SAML2 metadata so I created a new extension schema for a GuanxiGuardDescriptor which will allow the Engine to identity, authenticate and communicate with it’s Guards.

The core elements I’m implemented at the moment are:

EntityDescriptor, RoleDescriptor, KeyDescriptor, ContactPerson, and Organization.

The objects being created along the way via SAX parsing a SAML2 metadata file. Planning for each guard to have it’s own metadata file, rather than have a huge one with everything under one EntitiesDescriptor. So there’ll be a parse fest when the Engine starts up. Best to have all the heavyweight SAML work done on startup rather than on the fly parsing when a Guard initiates a session.

It’s all in cvs under samuel:/src/org/guanxi/samuel/saml/metadata

Must order some more cakes…

XML info

Posted & filed under howTo.

What’s the difference between xsd:include and xsd:import?

You use xsd:include when you want to bring definitions from another schema but in the same namespace into your own schema. The main point to remember is the included schema must have the same targetNamespace as the including schema. If you try to include a schema from another namespace, you get the error:

The targetNamespace of the referenced schema … must be identical to that of the including schema …

You use xsd:import when you want to bring element definitions in from another namespace. The main point here is that you can only import from a different namespace. You use this to extend your schema using definitions from another namespace. It’s also essential that you specify the schema location URI for the namespace you’re importing:

<import namespace=”urn:oasis:names:tc:SAML:2.0:metadata” schemaLocation=”saml/saml-schema-metadata-2.0.xsd”/>

I used the above xsd:import when developing the Guanxi Service Provider extensions to the SAML2 Metadata specification.

Where have all my linebreaks gone?

Have a look at this X509 certificate in an XML fragment. It has linebreaks in it, as it’s base 64 encoded. It doesn’t have the BEGIN/END header/footer but that’s not the issue. The issue is, when you parse this, all the linebreaks get converted to spaces, due to normalisation. It wouldn’t be so bad but the parser first destroys the data you’re interested in, i.e. the certificate data and then, after removing the linebreaks, it then proceeds to wrap your data in utter crap. It wraps it in tabs and linebreaks, which you have to remove before the data is halfway useable.


<ds:X509Certificate>MIICfzCCAjygAwIBAgIRAOAEuxPf9DpHHOUYb1Zl26QwCwYHKoZIzjgEAwUAMBwx
GjAYBgNVBAMTEUdVQU5YSS0tNzE0NzIzOTI2MB4XDTA1MDcyNjEyMzI0OVoXDTA1
MDgxNTEyNDI0OVowHDEaMBgGA1UEAxMRR1VBTlhJLS03MTQ3MjM5MjYwggG3MIIB
LAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YRt1I870QAwx4/gLZR
JmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZUKWkn5/oBHsQIsJP
u6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOuK2HXKu/yIgMZndFI
AccCFQCXYFCPFSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps93su8q1w2uFe5eZSv
u/o66oL5V0wLPQeCZ1FZV4661FlP5nEHEIGAtEkWcSPoTCgWE7fPCTKMyKbhPBZ6
i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7YnoBJDvMpPG+qFGQiaiD3+Fa5Z8Gkotm
XoB7VSVkAUw7/s9JKgOBhAACgYBUDBhP5YQi1fZ/FxilpPOVhxxO0iOiyXuj2Q52
bROgPxLoKEzjRxCfP3V1D6xhzWJjXj4ce5EiNY8393VNiu2ahKuxTc9T5Md4tLeG
Sfqt3hL/yRRPYYvXAODXngcKAoGpW/dCJl4ivQz0erjRi3LsrxyRTQakI+c6y6fA
gjv8WDALBgcqhkjOOAQDBQADMAAwLQIVAJK514VTRvVaUHeynGpdZDQ9N4EjAhRa
shgQVsHjXq6wdrDL1rR92I1ZQA==
</ds:X509Certificate>

One of ‘{“” is expected

This is a strange one. Here’s the schema head:
<schema
    targetNamespace=”urn:guanxi:idp”
    xmlns:gx=”urn:guanxi:idp”
    xmlns=”http://www.w3.org/2001/XMLSchema”
    elementFormDefault=”unqualified”
    attributeFormDefault=”unqualified”
    blockDefault=”substitution”
    version=”2.0″>

With the above schema, I get the validation error:

Invalid content was found starting with element ‘service-provider’. One of ‘{“”:service-provider}’ is expected.

To get rid of the validation error, change elementFormDefault to be:

elementFormDefault=”qualified”