summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Guzzo <andrea.guzzo@booking.com>2013-09-25 15:22:57 (GMT)
committer Andrea Guzzo <andrea.guzzo@booking.com>2013-09-25 15:22:57 (GMT)
commite5dc3865530aa8d8fa0f4ef231e183afbb7ca4f2 (patch)
tree972e1b2caf7bb8a33dd6e673031767531f808b5e
parentefa3d59e8d8846e0b37ffa33749fd011068900ac (diff)
some more work ....still not workingcmdline
-rw-r--r--core/JMXContext.m1
-rw-r--r--core/NSXMLNode+V8.mm13
-rw-r--r--jmx/main.m7
3 files changed, 18 insertions, 3 deletions
diff --git a/core/JMXContext.m b/core/JMXContext.m
index d05d50b..108b585 100644
--- a/core/JMXContext.m
+++ b/core/JMXContext.m
@@ -104,6 +104,7 @@ static BOOL initialized = NO;
[ns setStringValue:@"http://jmxapp.org"];
[ns setName:@"jmx"];
[root addNamespace:ns];
+ [root setURI:@"http://jmxapp.org"];
#if USE_NSOPERATIONS
[self initQueue];
#endif
diff --git a/core/NSXMLNode+V8.mm b/core/NSXMLNode+V8.mm
index 8f854a1..acae0e2 100644
--- a/core/NSXMLNode+V8.mm
+++ b/core/NSXMLNode+V8.mm
@@ -157,7 +157,9 @@ static v8::Handle<Value>GetNameSpaceURI(Local<String> name, const AccessorInfo&
v8::Locker lock;
HandleScope handleScope;
NSXMLNode *node = (NSXMLNode *)info.Holder()->GetPointerFromInternalField(0);
- return handleScope.Close(String::New([[node URI] UTF8String]));
+ if (node && [node URI])
+ return handleScope.Close(String::New([[node URI] UTF8String]));
+ return handleScope.Close(Undefined());
}
static v8::Handle<Value>GetLocalName(Local<String> name, const AccessorInfo& info)
@@ -181,7 +183,9 @@ static v8::Handle<Value>GetPrefix(Local<String> name, const AccessorInfo& info)
v8::Locker lock;
HandleScope handleScope;
NSXMLNode *node = (NSXMLNode *)info.Holder()->GetPointerFromInternalField(0);
- return handleScope.Close(String::New([[node prefix] UTF8String]));
+ if (node && [node prefix])
+ return handleScope.Close(String::New([[node prefix] UTF8String]));
+ return handleScope.Close(Undefined());
}
static v8::Handle<Value>GetBaseURI(Local<String> name, const AccessorInfo& info)
@@ -189,7 +193,10 @@ static v8::Handle<Value>GetBaseURI(Local<String> name, const AccessorInfo& info)
v8::Locker lock;
HandleScope handleScope;
NSXMLNode *node = (NSXMLNode *)info.Holder()->GetPointerFromInternalField(0);
- return handleScope.Close(String::New([[[node rootDocument] URI] UTF8String]));
+ if (node && [node URI])
+ return handleScope.Close(String::New([[node URI] UTF8String]));
+
+ return handleScope.Close(Undefined());
}
static v8::Handle<Value>GetTextContent(Local<String> name, const AccessorInfo& info)
diff --git a/jmx/main.m b/jmx/main.m
index 6f0583f..8b0c4f6 100644
--- a/jmx/main.m
+++ b/jmx/main.m
@@ -10,6 +10,8 @@
#import <JMXGlobals.h>
#import <JMXApplication.h>
#import <JMXScriptEntity.h>
+#import <JMXContext.h>
+#import <JMXGraph.h>
static JMXScriptEntity *scriptController = nil;
@@ -18,10 +20,15 @@ int main(int argc, const char * argv[])
@autoreleasepool {
JMXApplication *app =[[JMXApplication alloc] init];
+ [NSApplication sharedApplication].delegate = app;
openlog("JMX", LOG_PERROR, LOG_USER);
[app applicationWillFinishLaunching:[NSNotification notificationWithName:@"applicationWillFinishLaunching" object:nil]];
[app applicationDidFinishLaunching:[NSNotification notificationWithName:@"applicationDidFinishLaunching" object:nil]];
scriptController = [[JMXScriptEntity alloc] initWithName:@"scriptController"];
+ NSXMLElement *rootElement = [[[JMXContext sharedContext] dom] rootElement];
+ @synchronized(rootElement) {
+ [rootElement addChild:scriptController];
+ }
scriptController.active = YES;
[scriptController exec:@"echo('CIAO');"];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];