Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding lein

  • Loading branch information...
commit 41d7a3de2a998942352a28d371a3a97942b3cdf5 1 parent 64fb357
@mchapala authored
Showing with 30 additions and 762 deletions.
  1. +0 −3  ats-clojure --username ch.murali@gmail.com/build.gradle
  2. +0 −72 ats-clojure --username ch.murali@gmail.com/buildfile
  3. +0 −2  ats-clojure --username ch.murali@gmail.com/clojure.sh
  4. +0 −34 ats-clojure --username ch.murali@gmail.com/ibwebapp/build.gradle
  5. BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/buildscript/clojuresque-1.4.1.jar
  6. BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/clojure-1.3.0.jar
  7. BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/hazelcast-1.9.3.1.jar
  8. BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/runtime/runtime-1.4.1.jar
  9. BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/swank-clojure-1.3.2.jar
  10. +0 −166 ats-clojure --username ch.murali@gmail.com/ibwebapp/pom.xml
  11. +18 −0 ats-clojure --username ch.murali@gmail.com/ibwebapp/project.clj
  12. +0 −1  ats-clojure --username ch.murali@gmail.com/ibwebapp/sdb.db
  13. +4 −1 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/constants/constants.clj
  14. +0 −11 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/models.clj
  15. +0 −126 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/models/post.clj
  16. +0 −63 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/models/user.clj
  17. +0 −14 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/server.clj
  18. +0 −152 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/views/admin.clj
  19. +0 −44 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/views/blog.clj
  20. +0 −55 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/views/common.clj
  21. +7 −2 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ms/ms.clj
  22. +1 −1  ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/orders/orders.clj
  23. +0 −14 ats-clojure --username ch.murali@gmail.com/pom.xml
  24. +0 −1  ats-clojure --username ch.murali@gmail.com/settings.gradle
View
3  ats-clojure --username ch.murali@gmail.com/build.gradle
@@ -1,3 +0,0 @@
-allprojects {
-// task hello << { task -> println "I'm $task.project.name" }
-}
View
72 ats-clojure --username ch.murali@gmail.com/buildfile
@@ -1,72 +0,0 @@
-# Generated by Buildr 1.4.6, change to your liking
-
-
-# Version number for this release
-VERSION_NUMBER = "1.0.0"
-# Group identifier for your projects
-GROUP = "ATS"
-COPYRIGHT = ""
-
-# Specify Maven 2.0 remote repositories here, like this:
-repositories.remote << "http://www.ibiblio.org/maven2/"
-repositories.remote << 'http://repo1.maven.org/maven2'
-repositories.remote << 'http://build.clojure.org/releases'
-repositories.remote << 'http://repo.incanter.org'
-repositories.remote << 'http://build.clojure.org/snapshots'
-repositories.remote << 'http://clojars.org/repo/'
-
-
-desc "The Ats project"
-define "ATS" do
- project.version = VERSION_NUMBER
- project.group = GROUP
- manifest["Implementation-Vendor"] = COPYRIGHT
-
- define "ibbase" do
- compile.with 'com.ib:jtsclient:jar:9.6'
- test.compile.with 'com.ib:jtsclient:jar:9.6'
- package(:jar)
- end
-
-
- define 'ibconnection' do
- project.group = 'ATS'
- project.version = '0.0.1-SNAPSHOT'
- CLOJURE='org.clojure:clojure:jar:1.3.0'
- HAZELCAST='com.hazelcast:hazelcast:jar:1.9.3.1'
- compile.with project('ibbase'), HAZELCAST,CLOJURE, 'swank-clojure:swank-clojure:jar:1.3.2','com.ib:jtsclient:jar:9.6'
-
- task :build do
- cp project.compile.dependencies.collect { |t| t.to_s }, project.path_to('lib')
-
- sourcefiles = Array.new
- sources = FileList[_("src/main/clojure/**/*.clj")].collect {|x| x = x.split(".clj") }
- sources.each {
- |source|
- patha=Pathname.new(project.path_to('src/main/clojure'))
- #puts "patha"+patha.to_s
- #puts "source" + source.to_s
- pathb=Pathname.new(source.to_s)
- temp= pathb.relative_path_from(patha).to_s
- #puts "relative path"+temp
- sourcefiles.push(temp)
- #puts "all source files"+sourcefiles.to_s
- }
-
- puts "all source files"+sourcefiles.to_s
- sourcedir = FileList[_("src/main/clojure/**/*")] #.collect {|x| x.split(".clj") }
- puts "all source dir file"+sourcedir.to_s
- source_paths = sourcedir.select { |source| File.directory?(source) }
- puts "source_paths"+source_paths.to_s
- cp_str = path_to(:target,:classes)
- puts "cp_str"+cp_str
- Java::Commands.java(
- :classpath => [ compile.dependencies,cp_str,sourcedir ],
- :java_args => ["clojure.lang.Compile",sourcefiles],
- :properties => {"clojure.compile.path" => cp_str },
- :verbose=>[true]
- )
- end
- package :jar, :id => 'ibconnection'
-end # ibconnection.do
-end
View
2  ats-clojure --username ch.murali@gmail.com/clojure.sh
@@ -1,2 +0,0 @@
-#test
-java -verbose -cp /home/mchapala/development/workspace/ATS/ibconnection/target/classes:/home/mchapala/development/workspace/ATS/ibconnection/src/main/clojure:/home/mchapala/development/workspace/ATS/ibconnection/target/classes:/home/mchapala/development/workspace/ATS/ibconnection/target/classes:/home/mchapala/.m2/repository/swank-clojure/swank-clojure/1.3.2/swank-clojure-1.3.2.jar:/home/mchapala/.m2/repository/org/clojure/clojure/1.3.0/clojure-1.3.0.jar:/home/mchapala/.m2/repository/ATS/ATS-ibbase/1.0.0/ATS-ibbase-1.0.0.jar:/home/mchapala/.m2/repository/com/hazelcast/hazelcast/1.9.3.1/hazelcast-1.9.3.1.jar:/home/mchapala/.m2/repository/com/ib/jtsclient/9.6/jtsclient-9.6.jar -Dclojure.compile.path=/home/mchapala/development/workspace/ATS/ibconnection/target/classes -Xmx1G clojure.lang.Compile
View
34 ats-clojure --username ch.murali@gmail.com/ibwebapp/build.gradle
@@ -1,34 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'maven'
-apply plugin: 'clojure'
-
-version = '1.0.0'
-warnOnReflection = false
-aotCompile = true
-
-repositories {
- mavenCentral()
- clojarsRepo()
- flatDir dirs: project.file("lib/runtime")
- flatDir dirs: project.file("lib")
-}
-
-buildscript {
- repositories { flatDir dirs: project.file("lib/buildscript") }
- dependencies { classpath "clojuresque:clojuresque:1.4.1" }
-}
-
-dependencies {
- compile 'org.clojure:clojure:1.3.0'
- compile 'com.ib:jtsclient:9.6'
- compile 'com.hazelcast:hazelcast:1.9.3.1'
- compile 'clj-time:clj-time:0.3.0'
- compile 'org.markdownj:markdownj:0.3.0-1.0.2b4'
- compile 'noir:noir:1.1.1-SNAPSHOT'
- compile 'simpledb:simpledb:0.1.4'
- compile 'com.ib:jtsclient:9.6'
- compile 'ch.qos.logback:logback-core:1.0.0'
- compile 'org.clojure:tools.logging:0.2.3'
- compile 'javax.mail:mail:1.4.1'
-
- }
View
BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/buildscript/clojuresque-1.4.1.jar
Binary file not shown
View
BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/clojure-1.3.0.jar
Binary file not shown
View
BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/hazelcast-1.9.3.1.jar
Binary file not shown
View
BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/runtime/runtime-1.4.1.jar
Binary file not shown
View
BIN  ats-clojure --username ch.murali@gmail.com/ibwebapp/lib/swank-clojure-1.3.2.jar
Binary file not shown
View
166 ats-clojure --username ch.murali@gmail.com/ibwebapp/pom.xml
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <properties>
- <clojure.version>1.3.0</clojure.version>
- </properties>
- <modelVersion>4.0.0</modelVersion>
- <groupId>ats</groupId>
- <artifactId>ibwebapp</artifactId>
- <version>0.0.1</version>
- <name>ibwebapp</name>
- <description>ats</description>
- <build>
- <sourceDirectory>src/main/clojure</sourceDirectory>
- <testSourceDirectory>src/test/clojure</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/clojure</directory>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
-
- <testResources>
- <testResource>
- <directory>src/test/clojure</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>com.theoryinpractise</groupId>
- <artifactId>clojure-maven-plugin</artifactId>
- <version>1.3.8</version>
- <extensions>true</extensions>
- <configuration>
- <!-- <replScript>script/startup.clj</replScript> -->
- <sourceDirectories>
- <sourceDirectory>src/main/clojure</sourceDirectory>
- </sourceDirectories>
- <clojureOptions>-Xmx1G</clojureOptions>
- <!-- <temporaryOutputDirectory>true</temporaryOutputDirectory> -->
- <copyAllCompiledNamespaces>true</copyAllCompiledNamespaces>
- <namespaces>
- <namespace>!ibweb.*</namespace>
- <namespace>!orders.*</namespace>
- </namespaces>
- <!-- <script>src/test/clojure/run.clj</script>
- <testScript>src/test/clojure/test.clj</testScript> -->
- </configuration>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>test</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- </plugin>
- </plugins>
- </build>
- <repositories>
- <repository>
- <id>central</id>
- <url>http://repo1.maven.org/maven2</url>
- </repository>
- <repository>
- <id>clojure-releases</id>
- <url>http://build.clojure.org/releases</url>
- </repository>
-
- <repository>
- <id>clojure-snapshots</id>
- <url>http://build.clojure.org/snapshots</url>
- </repository>
- <repository>
- <id>clojars</id>
- <url>http://clojars.org/repo/</url>
- </repository>
- </repositories>
- <dependencies>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>0.9.94</version>
- </dependency>
- <dependency>
- <groupId>org.clojure</groupId>
- <artifactId>clojure</artifactId>
- <version>${clojure.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>com.hazelcast</groupId>
- <artifactId>hazelcast</artifactId>
- <version>1.9.4.3</version>
- </dependency>
-
- <dependency>
- <groupId>com.ib</groupId>
- <artifactId>jtsclient</artifactId>
- <version>9.6</version>
- </dependency>
- <dependency>
- <groupId>clj-time</groupId>
- <artifactId>clj-time</artifactId>
- <version>0.3.0</version>
- <exclusions>
- <exclusion>
- <artifactId>clojure-contrib</artifactId>
- <groupId>org.clojure</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.markdownj</groupId>
- <artifactId>markdownj</artifactId>
- <version>0.3.0-1.0.2b4</version>
- </dependency>
- <dependency>
- <groupId>noir</groupId>
- <artifactId>noir</artifactId>
- <version>1.2.1</version>
- </dependency>
- <dependency>
- <groupId>simpledb</groupId>
- <artifactId>simpledb</artifactId>
- <version>0.1.4</version>
- </dependency>
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>1.4.1</version>
- </dependency>
- <dependency>
- <groupId>org.clojure</groupId>
- <artifactId>tools.namespace</artifactId>
- <version>0.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.clojure</groupId>
- <artifactId>tools.logging</artifactId>
- <version>0.2.3</version>
- </dependency>
- <dependency>
- <groupId>xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.2.2</version>
- </dependency>
- </dependencies>
-</project>
View
18 ats-clojure --username ch.murali@gmail.com/ibwebapp/project.clj
@@ -0,0 +1,18 @@
+(defproject ibwebapp "0.0.1-SNAPSHOT"
+ :description "IB WEBAPP"
+ :dependencies [
+ [org.clojure/clojure "1.6.0-alpha3"]
+ [com.hazelcast/hazelcast "3.1.5"]
+ [clj-time/clj-time "0.6.0"]
+ [javax.mail/mail "1.4.7"]
+ [org.clojure/tools.logging "0.2.6"]
+ [com.thoughtworks.xstream/xstream "1.4.6"]
+ [org.clojure/tools.nrepl "0.2.3"]
+ ]
+ :resource-paths ["lib/jtsclient-9.6.jar"]
+ :java-source-paths ["src/main/java"]
+ :source-paths ["src/main/clojure"]
+ :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
+ :aot :all
+ :main script.startup.startup
+ )
View
1  ats-clojure --username ch.murali@gmail.com/ibwebapp/sdb.db
@@ -1 +0,0 @@
-{:post-monikers {}, :post-ids (), :posts {}, :next-post-id -1, :users {"admin" {:username "admin", :password "$2a$10$yq6f67vdgGqgJ/fPwjslmO32s7.s96slesNr8RBMMts.Z5FXrTa9q"}}}
View
5 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/constants/constants.clj
@@ -1,4 +1,3 @@
-
(ns constants.constants
;(:require )
;(:use )
@@ -6,6 +5,10 @@
(:import (com.thoughtworks.xstream XStream))
)
(def xstreamInstance (XStream.))
+(def PI 3.14)
+
+(def TWSQUEUENAME "TWSQUEUENAME")
+
View
11 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/models.clj
@@ -1,11 +0,0 @@
-(ns ibweb.models
- (:require [simpledb.core :as db]
- [ibweb.models.user :as users]
- [ibweb.models.post :as posts]))
-
-(defn initialize []
- (db/init)
- (when-not (db/get :users)
- ;;db values need to be initialized.. this should only happen once.
- (users/init!)
- (posts/init!)))
View
126 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/models/post.clj
@@ -1,126 +0,0 @@
-(ns ibweb.models.post
- (:require [simpledb.core :as db]
- [clj-time.core :as ctime]
- [clj-time.format :as tform]
- [clj-time.coerce :as coerce]
- [clojure.string :as string]
- [ibweb.models.user :as users]
- [noir.validation :as vali]
- [noir.session :as session])
- (:import com.petebevin.markdown.MarkdownProcessor))
-
-(def posts-per-page 10)
-(def date-format (tform/formatter "MM/dd/yy" (ctime/default-time-zone)))
-(def time-format (tform/formatter "h:mma" (ctime/default-time-zone)))
-(def mdp (MarkdownProcessor.))
-
-;; Gets
-
-(defn total []
- (count (db/get :post-ids)))
-
-(defn id->post [id]
- (db/get-in :posts [id]))
-
-(defn ids->posts [ids]
- (map id->post ids))
-
-(defn moniker->post [moniker]
- (id->post (db/get-in :post-monikers [moniker])))
-
-(defn get-page [page]
- (let [page-num (dec (Integer. page)) ;; make it 1-based indexing
- prev (* page-num posts-per-page)]
- (ids->posts (take posts-per-page (drop prev (db/get :post-ids))))))
-
-(defn get-latest []
- (get-page 1))
-
-;; Mutations and checks
-
-(defn next-id []
- (str (db/update! :next-post-id inc)))
-
-(defn gen-moniker [title]
- (-> title
- (string/lower-case)
- (string/replace #"[^a-zA-Z0-9\s]" "")
- (string/replace #" " "-")))
-
-(defn new-moniker? [moniker]
- (not (contains? (db/get :post-monikers) moniker)))
-
-(defn perma-link [moniker]
- (str "/blog/view/" moniker))
-
-(defn edit-url [{:keys [id]}]
- (str "/blog/admin/post/edit/" id))
-
-(defn md->html [text]
- (. mdp (markdown text)))
-
-(defn wrap-moniker [{:keys [title] :as post}]
- (let [moniker (gen-moniker title)]
- (-> post
- (assoc :moniker moniker)
- (assoc :perma-link (perma-link moniker)))))
-
-(defn wrap-markdown [{:keys [body] :as post}]
- (assoc post :md-body (md->html body)))
-
-(defn wrap-time [post]
- (let [ts (ctime/now)]
- (-> post
- (assoc :ts (coerce/to-long ts))
- (assoc :date (tform/unparse date-format ts))
- (assoc :tme (tform/unparse time-format ts)))))
-
-(defn prepare-new [{:keys [title body] :as post}]
- (let [id (next-id)
- ts (ctime/now)]
- (-> post
- (assoc :id id)
- (assoc :username (users/me))
- (wrap-time)
- (wrap-moniker)
- (wrap-markdown))))
-
-(defn valid? [{:keys [title body]}]
- (vali/rule (vali/has-value? title)
- [:title "There must be a title"])
- (vali/rule (new-moniker? (gen-moniker title))
- [:title "That title is already taken."])
- (vali/rule (vali/has-value? body)
- [:body "There's no post content."])
- (not (vali/errors? :title :body)))
-
-;; Operations
-
-(defn add! [post]
- (when (valid? post)
- (let [{:keys [id moniker] :as final} (prepare-new post)]
- (db/update! :posts assoc id final)
- (db/update! :post-ids conj id)
- (db/update! :post-monikers assoc moniker id))))
-
-(defn edit! [{:keys [id title] :as post}]
- (let [{orig-moniker :moniker :as original} (id->post id)
- {:keys [moniker] :as final} (-> post
- (wrap-moniker)
- (wrap-markdown))]
- (db/update! :posts assoc id (merge original final))
- (db/update! :post-monikers dissoc orig-moniker) ;; remove the old moniker entry in case it changed
- (db/update! :post-monikers assoc moniker id)))
-
-(defn remove! [id]
- (let [{:keys [moniker]} (id->post id)
- neue-ids (remove #{id} (db/get :post-ids))]
- (db/put! :post-ids neue-ids)
- (db/update! :posts dissoc id)
- (db/update! :post-monikers dissoc moniker)))
-
-(defn init! []
- (db/put! :next-post-id -1)
- (db/put! :posts {})
- (db/put! :post-ids (list))
- (db/put! :post-monikers {}))
View
63 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/models/user.clj
@@ -1,63 +0,0 @@
-(ns ibweb.models.user
- (:require [simpledb.core :as db]
- [noir.util.crypt :as crypt]
- [noir.validation :as vali]
- [noir.session :as session]))
-
-;; Gets
-
-(defn all []
- (vals (db/get :users)))
-
-(defn get-username [username]
- (db/get-in :users [username]))
-
-(defn admin? []
- (session/get :admin))
-
-(defn me []
- (session/get :username))
-
-;; Mutations and Checks
-
-(defn prepare [{password :password :as user}]
- (assoc user :password (crypt/encrypt password)))
-
-(defn valid? [{:keys [username password]}]
- (vali/rule (not (db/get-in :users [username]))
- [:username "That username is already taken"])
- (vali/rule (vali/min-length? username 3)
- [:username "Username must be at least 3 characters."])
- (vali/rule (vali/min-length? password 5)
- [:password "Password must be at least 5 characters."])
- (not (vali/errors? :username :password)))
-
-;; Operations
-
-(defn- store! [{username :username :as user}]
- (db/update! :users assoc username user))
-
-(defn login! [{:keys [username password] :as user}]
- (let [{stored-pass :password} (get-username username)]
- (if (and stored-pass
- (crypt/compare password stored-pass))
- (do
- (session/put! :admin true)
- (session/put! :username username))
- (vali/set-error :username "Invalid username or password"))))
-
-(defn add! [{:keys [username password]}]
- (let [user (-> {:username username :password password}
- (prepare))]
- (when (valid? user)
- (store! user))))
-
-(defn edit! [user]
- (add! user))
-
-(defn remove! [username]
- (db/update! :users dissoc username))
-
-(defn init! []
- (db/put! :users {})
- (store! (prepare {:username "admin" :password "admin"})))
View
14 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/server.clj
@@ -1,14 +0,0 @@
-(ns ibweb.server
- (:require [noir.server :as server]
- [ibweb.models :as models]))
-
-(server/load-views "ibweb/views/")
-
-(defn -main [& m]
- (let [mode (or (first m) :dev)
- port (Integer. (get (System/getenv) "PORT" "8080"))]
- (models/initialize)
- (server/start port {:mode (keyword mode)
- :ns 'ibweb})))
-
-
View
152 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/views/admin.clj
@@ -1,152 +0,0 @@
-(ns ibweb.views.admin
- (:use noir.core
- hiccup.core
- hiccup.page-helpers
- hiccup.form-helpers)
- (:require [noir.session :as session]
- [noir.validation :as vali]
- [noir.response :as resp]
- [clojure.string :as string]
- [ibweb.models.post :as posts]
- [ibweb.models.user :as users]
- [ibweb.views.common :as common]))
-
-;; Links
-
-(def post-actions [{:url "/blog/admin/post/add" :text "Add a post"}])
-(def user-actions [{:url "/blog/admin/user/add" :text "Add a user"}])
-
-;; Partials
-
-(defpartial error-text [errors]
- [:p (string/join "<br/>" errors)])
-
-(defpartial post-fields [{:keys [title body]}]
- (vali/on-error :title error-text)
- (text-field {:placeholder "Title"} :title title)
- (vali/on-error :body error-text)
- (text-area {:placeholder "Body"} :body body))
-
-(defpartial user-fields [{:keys [username] :as usr}]
- (vali/on-error :username error-text)
- (text-field {:placeholder "Username"} :username username)
- (password-field {:placeholder "Password"} :password))
-
-(defpartial post-item [{:keys [title] :as post}]
- [:li
- (link-to (posts/edit-url post) title)])
-
-(defpartial action-item [{:keys [url text]}]
- [:li
- (link-to url text)])
-
-(defpartial user-item [{:keys [username]}]
- [:li
- (link-to (str "/blog/admin/user/edit/" username) username)])
-
-;; Admin pages
-
-;;force you to be an admin to get to the admin section
-(pre-route "/blog/admin*" {}
- (when-not (users/admin?)
- (resp/redirect "/blog/login")))
-
-(defpage "/blog/login" {:as user}
- (if (users/admin?)
- (resp/redirect "/blog/admin")
- (common/main-layout
- (form-to [:post "/blog/login"]
- [:ul.actions
- [:li (link-to {:class "submit"} "/" "Login")]]
- (user-fields user)
- (submit-button {:class "submit"} "submit")))))
-
-(defpage [:post "/blog/login"] {:as user}
- (if (users/login! user)
- (resp/redirect "/blog/admin")
- (render "/blog/login" user)))
-
-(defpage "/blog/logout" {}
- (session/clear!)
- (resp/redirect "/blog/"))
-
-;; Post pages
-
-(defpage "/blog/admin" {}
- (common/admin-layout
- [:ul.actions
- (map action-item post-actions)]
- [:ul.items
- (map post-item (posts/get-latest))]))
-
-(defpage "/blog/admin/post/add" {:as post}
- (common/admin-layout
- (form-to [:post "/blog/admin/post/add"]
- [:ul.actions
- [:li (link-to {:class "submit"} "/" "Add")]]
- (post-fields post)
- (submit-button {:class "submit"} "add post"))))
-
-(defpage [:post "/blog/admin/post/add"] {:as post}
- (if (posts/add! post)
- (resp/redirect "/blog/admin")
- (render "/blog/admin/post/add" post)))
-
-(defpage "/blog/admin/post/edit/:id" {:keys [id]}
- (if-let [post (posts/id->post id)]
- (common/admin-layout
- (form-to [:post (str "/blog/admin/post/edit/" id)]
- [:ul.actions
- [:li (link-to {:class "submit"} "/" "Submit")]
- [:li (link-to {:class "delete"} (str "/blog/admin/post/remove/" id) "Remove")]]
- (post-fields post)
- (submit-button {:class "submit"} "submit")))))
-
-(defpage [:post "/blog/admin/post/edit/:id"] {:keys [id] :as post}
- (if (posts/edit! post)
- (resp/redirect "/blog/admin")
- (render (str "/blog/admin/post/edit/" id) post)))
-
-(defpage "/blog/admin/post/remove/:id" {:keys [id]}
- (posts/remove! id)
- (resp/redirect "/blog/admin"))
-
-;; User pages
-
-(defpage "/blog/admin/users" {}
- (common/admin-layout
- [:ul.actions
- (map action-item user-actions)]
- [:ul.items
- (map user-item (users/all))]))
-
-(defpage "/blog/admin/user/add" {}
- (common/admin-layout
- (form-to [:post "/blog/admin/user/add"]
- [:ul.actions
- [:li (link-to {:class "submit"} "/" "Add")]]
- (user-fields {})
- (submit-button {:class "submit"} "add user"))))
-
-(defpage [:post "/blog/admin/user/add"] {:keys [username password] :as neue-user}
- (if (users/add! neue-user)
- (resp/redirect "/blog/admin/users")
- (render "/blog/admin/user/add" neue-user)))
-
-(defpage "/blog/admin/user/edit/:old-name" {:keys [old-name]}
- (let [user (users/get-username old-name)]
- (common/admin-layout
- (form-to [:post (str "/blog/admin/user/edit/" old-name)]
- [:ul.actions
- [:li (link-to {:class "submit"} "/" "Submit")]
- [:li (link-to {:class "delete"} (str "/blog/admin/user/remove/" old-name) "Remove")]]
- (user-fields user)))))
-
-(defpage [:post "/blog/admin/user/edit/:old-name"] {:keys [old-name] :as user}
- (if (users/edit! old-name user)
- (resp/redirect "/blog/admin/users")
- (render "/blog/admin/user/edit/:old-name" user)))
-
-(defpage "/blog/admin/user/remove/:id" {:keys [id]}
- (users/remove! id)
- (resp/redirect "/blog/admin/users"))
View
44 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/views/blog.clj
@@ -1,44 +0,0 @@
-(ns ibweb.views.blog
- (:use noir.core
- hiccup.core
- hiccup.page-helpers)
- (:require [ibweb.models.post :as posts]
- [ibweb.views.common :as common]
- [ibweb.models.user :as user]
- [noir.response :as resp]))
-
-;; Page structure
-
-(defpartial post-item [{:keys [perma-link title md-body date tme] :as post}]
- (when post
- [:li.post
- [:h2 (link-to perma-link title)]
- [:ul.datetime
- [:li date]
- [:li tme]
- (when (user/admin?)
- [:li (link-to (posts/edit-url post) "edit")])]
- [:div.content md-body]]))
-
-(defpartial blog-page [items]
- (common/main-layout
- [:ul.posts
- (map post-item items)]))
-
-;; Blog pages
-
-(defpage "/" []
- (resp/redirect "/blog/"))
-
-(defpage "/blog/" []
- (blog-page (posts/get-latest)))
-
-(defpage "/blog/page/:page" {:keys [page]}
- (blog-page (posts/get-page page)))
-
-(defpage "/blog/page/" []
- (render "/blog/page/:page" {:page 1}))
-
-(defpage "/blog/view/:perma" {:keys [perma]}
- (if-let [cur (posts/moniker->post perma)]
- (blog-page [cur])))
View
55 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ibweb/views/common.clj
@@ -1,55 +0,0 @@
-(ns ibweb.views.common
- (use noir.core
- hiccup.core
- hiccup.page-helpers))
-
-;; Links and includes
-(def main-links [{:url "/blog/admin" :text "Admin"}])
-
-(def admin-links [{:url "/blog/" :text "Blog"}
- {:url "/blog/admin" :text "Posts"}
- {:url "/blog/admin/users" :text "Users"}
- {:url "/blog/logout" :text "Logout"}])
-
-(def includes {:jquery (include-js "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js")
- :default (include-css "/css/default.css")
- :reset (include-css "/css/reset.css")
- :blog.js (include-js "/js/blog.js")})
-
-;; Helper partials
-
-(defpartial build-head [incls]
- [:head
- [:title "The Noir Blog"]
- (map #(get includes %) incls)])
-
-(defpartial link-item [{:keys [url cls text]}]
- [:li
- (link-to {:class cls} url text)])
-
-;; Layouts
-
-(defpartial main-layout [& content]
- (html5
- (build-head [:reset :default :jquery :blog.js])
- [:body
- [:div#wrapper
- [:div.content
- [:div#header
- [:h1 (link-to "/blog/" "The Noir blog")]
- [:ul.nav
- (map link-item main-links)]]
- content]]]))
-
-(defpartial admin-layout [& content]
- (html5
- (build-head [:reset :default :jquery :blog.js])
- [:body
- [:div#wrapper
- [:div.content
- [:div#header
- [:h1 (link-to "/blog/admin" "Admin")]
- [:ul.nav
- (map link-item admin-links)]]
- content]]]))
-
View
9 ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/ms/ms.clj
@@ -1,5 +1,6 @@
(ns ms.ms
(:import (com.hazelcast.core ITopic Hazelcast MessageListener))
+ (:import (com.hazelcast.config Config))
(:require [ml.ml])
(:import [ml.ml Mylistener Mylistener2])
(:use [clojure.tools.logging :only (info error debug)])
@@ -7,7 +8,11 @@
(info "sender")
(info "creating topic")
-(def topic (. Hazelcast (getTopic "default") ))
+
+(def config (Config.))
+(def hInstance (. Hazelcast (newHazelcastInstance config)))
+
+(def topic (. hInstance (getTopic "default" )))
(info "creating listener")
@@ -17,7 +22,7 @@
(info "creating topic1")
-(def topic1 (. Hazelcast (getTopic "default") ))
+(def topic1 (. hInstance (getTopic "default") ))
(def mL2 (Mylistener2. ))
View
2  ats-clojure --username ch.murali@gmail.com/ibwebapp/src/main/clojure/orders/orders.clj
@@ -1,4 +1,4 @@
-(ns order.orders
+(ns orders.orders
(:import [com.ib.client Order]))
View
14 ats-clojure --username ch.murali@gmail.com/pom.xml
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>ats</groupId>
- <artifactId>ats</artifactId>
- <version>0.0.1</version>
- <packaging>pom</packaging>
- <name>ats</name>
- <description>ats</description>
- <modules>
- <module>ibwebapp</module>
- </modules>
- </project>
View
1  ats-clojure --username ch.murali@gmail.com/settings.gradle
@@ -1 +0,0 @@
-include 'ibconnection','ibwebapp'
Please sign in to comment.
Something went wrong with that request. Please try again.