- (id)initWithHostName:(NSString *)_hostname port:(int)_port
databaseName:(NSString *)_dbname;
+/* accessors */
+
+- (NSString *)hostName;
+- (int)port;
+- (NSString *)databaseName;
+
/* support */
- (EOAdaptor *)adaptorInContext:(WOContext *)_ctx;
return self->databaseName;
}
+// TODO: add baseURL generation
+
/* support */
- (EOAdaptor *)adaptorInContext:(WOContext *)_ctx {
return self->host;
}
+- (id)container {
+ return [self host];
+}
+- (NSString *)nameInContainer {
+ return @"Databases";
+}
+
/* name lookup */
- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
- (id)initWithName:(NSString *)_name inContainer:(id)_container;
+/* accessors */
+
+- (DSoDatabase *)database;
+- (NSString *)tableName;
+
+- (NSString *)hostName;
+- (int)port;
+- (NSString *)databaseName;
+
+/* support */
+
+- (EOAdaptor *)adaptorInContext:(WOContext *)_ctx;
+
@end
#endif /* __dbd_DSoTable_H__ */
[super dealloc];
}
+/* accessors */
+
+- (DSoDatabase *)database {
+ return self->database;
+}
+- (NSString *)tableName {
+ return self->tableName;
+}
+
+- (NSString *)hostName {
+ return [[self database] hostName];
+}
+- (int)port {
+ return [[self database] port];
+}
+- (NSString *)databaseName {
+ return [[self database] databaseName];
+}
+
+- (id)container {
+ return [self database];
+}
+- (NSString *)nameInContainer {
+ return [self tableName];
+}
+
/* support */
- (EOAdaptor *)adaptorInContext:(WOContext *)_ctx {
--- /dev/null
+// $Id$
+
+#include <NGObjWeb/SoComponent.h>
+
+@class EOAdaptorChannel;
+
+@interface DTable : SoComponent
+{
+ EOAdaptorChannel *channel;
+ NSArray *columnNames;
+ id item;
+}
+
+@end
+
+#include "DSoTable.h"
+#include "common.h"
+
+@implementation DTable
+
+- (void)dealloc {
+ if ([self->channel isOpen])
+ [self->channel closeChannel];
+ [self->channel release];
+
+ [self->columnNames release];
+ [self->item release];
+ [super dealloc];
+}
+
+/* notifications */
+
+- (void)sleep {
+ if ([self->channel isOpen])
+ [self->channel closeChannel];
+
+ [super sleep];
+}
+
+/* DB things */
+
+- (EOAdaptor *)adaptor {
+ return [(DSoTable *)[self clientObject] adaptorInContext:[self context]];
+}
+
+- (EOAdaptorChannel *)channel {
+ EOAdaptorContext *ctx;
+
+ if (self->channel)
+ return self->channel;
+
+ ctx = [[self adaptor] createAdaptorContext];
+ self->channel = [[ctx createAdaptorChannel] retain];
+ if (![self->channel openChannel]) {
+ [self->channel release];
+ self->channel = nil;
+ }
+
+ return self->channel;
+}
+
+- (EOModel *)_describeModel {
+ NSArray *tableNames;
+
+ tableNames = [NSArray arrayWithObject:[[self clientObject] tableName]];
+ return [[self channel] describeModelWithTableNames:tableNames];
+}
+
+/* accessors */
+
+- (void)setItem:(id)_item {
+ ASSIGN(self->item, _item);
+}
+- (id)item {
+ return self->item;
+}
+
+- (NSArray *)columnNames {
+ return self->columnNames;
+}
+
+- (NSString *)itemSlashLink {
+ // this suxx, a) we need to write code, b) we need to attach the / manually
+ return [[self item] stringByAppendingString:@"/"];
+}
+
+@end /* DTable */
--- /dev/null
+<?xml version='1.0' standalone='yes'?>
+<var:component className="Frame"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+>
+
+Host: <a href="../.."><var:string value="clientObject.hostName"/></a><br />
+Port: <var:string value="clientObject.port"/><br />
+DB: <a href=".."><var:string value="clientObject.databaseName"/></a><br />
+Table: <var:string value="clientObject.tableName"/><br />
+
+<h4>Columns</h4>
+<var:foreach list="columnNames" item="item">
+ <li><a var:href="itemSlashLink"><var:string value="item" /></a></li>
+</var:foreach>
+
+</var:component>
DHostView.m \
DDatabaseManager.m \
DDatabase.m \
+ DTable.m \
dbd_RESOURCE_FILES += \
Version \
DHostView.wox \
DDatabaseManager.wox \
DDatabase.wox \
+ DTable.wox \
dbd_WEBSERVER_RESOURCE_FILES +=
"WebDAV Access" = "Authenticated";
};
methods = {
- "index" = {
+ index = {
protectedBy = "View";
pageName = "MainPage";
};
- "GET" = { // more or less a hack, see README
+ GET = { // more or less a hack, see README
protectedBy = "View";
pageName = "MainPage";
};
- "connect" = {
+ connect = {
protectedBy = "View";
pageName = "MainPage";
actionName = "connect";
DSoHost = {
superclass = "DSoObject";
methods = {
- "index" = {
+ index = {
protectedBy = "View";
pageName = "DHostView";
};
DSoTable = {
superclass = "DSoObject";
methods = {
+ index = {
+ protectedBy = "View";
+ pageName = "DTable";
+ };
};
};
DSoDatabase = {
superclass = "DSoObject";
methods = {
- "index" = {
+ index = {
protectedBy = "View";
pageName = "DDatabase";
};
DSoDatabaseManager = {
superclass = "DSoObject";
methods = {
- "index" = {
+ index = {
protectedBy = "View";
pageName = "DDatabaseManager";
};