1 | ;;+----------------------------------------------------------------------------- |
---|
2 | ;;+ Isidorus |
---|
3 | ;;+ (c) 2008-2010 Marc Kuester, Christoph Ludwig, Lukas Georgieff |
---|
4 | ;;+ |
---|
5 | ;;+ Isidorus is freely distributable under the LLGPL license. |
---|
6 | ;;+ You can find a detailed description in trunk/docs/LLGPL-LICENSE.txt and |
---|
7 | ;;+ trunk/docs/LGPL-LICENSE.txt. |
---|
8 | ;;+----------------------------------------------------------------------------- |
---|
9 | |
---|
10 | (in-package :atom) |
---|
11 | |
---|
12 | (defmacro get-conflist (sym conflines) |
---|
13 | `(rest (assoc ,sym ,conflines))) |
---|
14 | |
---|
15 | (defmacro get-confvalue (sym conflines) |
---|
16 | `(first (rest (assoc ,sym ,conflines)))) |
---|
17 | |
---|
18 | (defmacro build-updatefeed (collection-feed feed feedtype source-locator-prefix) |
---|
19 | "Helper macro to build an update feed (feedtype: snapshotsfeed or fragmentfeed)" |
---|
20 | `(let* |
---|
21 | ((entry |
---|
22 | (get-conflist ,feedtype (rest ,feed))) |
---|
23 | (entry-obj |
---|
24 | (make-instance |
---|
25 | 'collection-entry |
---|
26 | :id (get-confvalue 'id entry) |
---|
27 | :link-type ,feedtype |
---|
28 | :tm-id (id ,collection-feed) |
---|
29 | :path (format nil "~a/~a" (path ,collection-feed) (get-confvalue 'relative-path entry)) |
---|
30 | :title (get-confvalue 'title entry)))) |
---|
31 | ;(format t "feed: ~a" ,feed) |
---|
32 | ;(format t "entry: ~a" entry) |
---|
33 | (register-entry ,collection-feed entry-obj) |
---|
34 | (register-subfeed |
---|
35 | ,collection-feed |
---|
36 | (make-instance |
---|
37 | ,feedtype |
---|
38 | :id (get-confvalue 'id entry) |
---|
39 | :author (author ,collection-feed) |
---|
40 | :path (format nil "~a/~a" (path ,collection-feed) (get-confvalue 'relative-path entry)) |
---|
41 | :tm-id (id ,collection-feed) |
---|
42 | :source-locator-prefix ,source-locator-prefix |
---|
43 | :title (get-confvalue 'title entry))))) |
---|
44 | |
---|
45 | (defmacro defsite (sitename &body conflines) |
---|
46 | "Macro to encapsulate the definition of feeds for the TMs the engine hosts" |
---|
47 | |
---|
48 | (setf *tm-feed* |
---|
49 | (make-instance |
---|
50 | 'feed |
---|
51 | :id (string-downcase sitename) |
---|
52 | :title (get-confvalue 'title conflines) |
---|
53 | :path (get-confvalue 'relative-path conflines) |
---|
54 | :author (get-confvalue 'author conflines))) |
---|
55 | |
---|
56 | (dolist (feed |
---|
57 | (remove-if-not (lambda (elem) (eq elem 'collection-feed)) conflines :key #'first)) |
---|
58 | |
---|
59 | (let* |
---|
60 | ((collection-url |
---|
61 | (format nil "~a/~a" (get-confvalue 'relative-path conflines) (get-confvalue 'relative-path (rest feed)))) |
---|
62 | (source-locator-prefix (get-confvalue 'source-locator-prefix (rest feed))) |
---|
63 | (overview-entry |
---|
64 | (make-instance |
---|
65 | 'overview-entry |
---|
66 | :id (get-confvalue 'id (rest feed)) |
---|
67 | :title (get-confvalue 'title (rest feed)) |
---|
68 | :author (get-confvalue 'author (rest feed)) |
---|
69 | :path collection-url)) |
---|
70 | (cf |
---|
71 | (make-instance |
---|
72 | 'collection-feed |
---|
73 | :id (get-confvalue 'id (rest feed)) |
---|
74 | :title (get-confvalue 'title (rest feed)) |
---|
75 | :source-locator-prefix source-locator-prefix |
---|
76 | :dependency (get-conflist 'dependency (rest feed)) |
---|
77 | :author (get-confvalue 'author (rest feed)) |
---|
78 | :path collection-url))) |
---|
79 | |
---|
80 | (register-entry *tm-feed* overview-entry) |
---|
81 | (register-subfeed *tm-feed* cf) |
---|
82 | |
---|
83 | (build-updatefeed cf feed 'fragments-feed source-locator-prefix) |
---|
84 | (build-updatefeed cf feed 'snapshots-feed source-locator-prefix)))) |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|