(message ";;; work --> Start")
(message ";;; work --> Load Work Modules")
(add-to-list 'load-path "~/.elisp/kyle")
(message ";;; work --> marketdata-gateway")
(require-if-available 'marketdata-gateway)
(when (>= emacs-major-version 22)
(defalias 'mdgq 'marketdata-gateway-query "Run `marketdata-gateway-query'.")
(defalias 'mdgql `(lambda () (marketdata-gateway-query "localhost"))
"Run `marketdata-gateway-query' on localhost."))
(message ";;; work --> General Functions")
(message ";;; work --> log4-toggle-debug-error")
(defun log4-toggle-debug-error ()
"Toggle \"DEBUG\" to \"ERROR\" and vice versa on current line."
(interactive)
(let ((debug-regexp "\"DEBUG\"")
(error-regexp "\"ERROR\""))
(save-excursion
(save-match-data
(goto-char (point-at-bol))
(if (re-search-forward debug-regexp (point-at-eol) t)
(progn
(goto-char (point-at-bol))
(while (re-search-forward debug-regexp (point-at-eol) t)
(replace-match "\"ERROR\"" nil nil)))
(progn
(goto-char (point-at-bol))
(while (re-search-forward error-regexp (point-at-eol) t)
(replace-match "\"DEBUG\"" nil nil))))
))))
(global-set-key "\M-t" 'log4-toggle-debug-error)
(message ";;; work --> find-file-log")
(defun find-file-log (file)
"Runs `find-file' with FILE, then moves the point to the end of buffer."
(find-file file)
(goto-char (point-max)))
(message ";;; work --> Cylon Project")
(message ";;; work --> marketdata-cylon-setenv")
(defun marketdata-cylon-setenv (&optional file no-dot-classpath)
"Run FILE script and copy the resulting Cylon environment
settings into the emacs environment.
If FILE is nil, a local setenv is used if found, otherwise
setenv-cylon and .classpath are searched for going up the
directory tree.
If NO-DOT-CLASSPATH is non-nil, .classpath is not used."
(interactive)
(let (dot-classpath) (unless file
(if (file-exists-p "./setenv")
(setq file "./setenv")
(let ((dir (directory-file-name (expand-file-name ".")))
(old-dir "")
test-file)
(while (and (not file)
(not (equal dir old-dir)))
(setq test-file (concat dir "share/scripts/setenv-cylon"))
(when (file-exists-p test-file)
(setq file test-file))
(setq test-file (concat dir ".classpath"))
(when (file-exists-p test-file)
(setq dot-classpath test-file))
(setq dir (file-name-directory (directory-file-name dir)))))))
(let ((vars '("JAVA_HOME" "JRE_LIBS" "JRE_SERVER_LIBS"
"ANT_HOME" "GS_HOME" "JSHOMEDIR" "MD_HOME"
"PATH" "CLASSPATH" "LD_LIBRARY_PATH")))
(if (file-executable-p file)
(with-temp-buffer
(shell-command file t)
(dolist (var vars)
(goto-char (point-min))
(while (re-search-forward (concat "^" var ": ") nil t)
(message (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
(setenv var (buffer-substring-no-properties (point) (point-at-eol))))))
(if (file-exists-p file)
(error "Could not execute file: %s" file)
(error "Could not find file: %s" file))))
(when (and dot-classpath (not no-dot-classpath))
(let ((base-dir (file-name-directory (directory-file-name dot-classpath)))
classpath)
(with-temp-buffer
(insert-file-contents dot-classpath)
(goto-char (point-min))
(while (re-search-forward "kind=\"lib\" path=\"\\(.*\\)\"" nil t)
(setq classpath (concat classpath ":" base-dir (match-string 1)))))
(when (> (length classpath) 0)
(setenv "CLASSPATH" (substring classpath 1)))))
(setq jde-global-classpath (getenv "CLASSPATH"))
))
(message ";;; work --> Menu")
(let ((users '(("dj615869" . "")
("mdapps" . "/opt/mdapps")
("root" . "/")))
(servers-dev '("sbkdevmdp09" "sbkdevmdp90"))
(servers-prod '("sbkmdwebp01" "sbkmdwebp02" "sbkmdwebp03" "sbkmdwebp04"
"secmdwebp01" "secmdwebp02" "secmdwebp03" "secmdwebp04")))
(auto-menu
"Work"
`(("Dired..."
,(auto-menu-dired '(("dj" . "~/svn/MarketData/dj")
("cylon" . "~/svn/MarketData/dj/cylon/trunk")
("cylon-core" . "~/svn/MarketData/dj/cylon/trunk/core")
("pubsub" . "~/svn/MarketData/dj/PubSub/trunk")
("gateway-monitor-posts" . "~/svn/MarketData/dj/cylon/trunk/admin-tools/gateway-monitor/posts")
("webservices" . "~/svn/MarketData/dj/webservices/trunk"))))
("Remote..."
(("DEV..."
,(auto-menu-dired-remote users servers-dev))
("PROD..."
,(auto-menu-dired-remote users servers-prod))
("Coding..."
(("sbkdevmdp09"
,(auto-menu-dired '(("dj" . "/dj615869@sbkdevmdp09:/home/dj615869/svn/MarketData/dj")
("cylon" . "/dj615869@sbkdevmdp09:/home/dj615869/svn/MarketData/dj/cylon/trunk")
("cylon-core" . "/dj615869@sbkdevmdp09:/home/dj615869/svn/MarketData/dj/cylon/trunk/core")
("pubsub" . "/dj615869@sbkdevmdp09:/home/dj615869/svn/MarketData/dj/PubSub/trunk")
("webservices" . "/dj615869@sbkdevmdp09:/home/dj615869/svn/MarketData/dj/webservices/trunk"))))))))
("Load..."
(("Log Files..."
(("sbkmdlogp01:webservices" "(find-file-log \"/mdapps@sbkmdlogp01:/opt/mdapps/logs/webservices.log\")"
"Load `/mdapps@sbkmdlogp01:/opt/mdapps/logs/webservices.log' file.")
("secmdlogp01:webservices" "(find-file-log \"/mdapps@secmdlogp01:/opt/mdapps/logs/webservices.log\")"
"Load `/mdapps@secmdlogp01:/opt/mdapps/logs/webservices.log' file.")))))
("Gateway Monitor Post Files..."
,(auto-menu-file-dir "~/svn/MarketData/dj/cylon/trunk/admin-tools/gateway-monitor/posts" "-post$" "find-file" t))
("Query Gateway" "(marketdata-gateway-query)" "Query a MarketData Gateway.")
("Set Cylon Environment" "(marketdata-cylon-setenv)" "Set MarketData Cylon Environment.")
("Toggle Log4 DEBUG/ERROR" "(log4-toggle-debug-error)" "Toggle between \"DEBUG\" and \"ERROR\" on current line.")
)))
(message ";;; work --> End")