/usr/share/doc/libdynapath-clojure/html/README.html is in libdynapath-clojure 0.2.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>dynapath [![Build Status](https://secure.travis-ci.org/tobias/dynapath.png?branch=master)](https://travis-ci.org/tobias/dynapath)</title>
</head>
<body>
<h1>dynapath <a href="https://travis-ci.org/tobias/dynapath"><img src="https://secure.travis-ci.org/tobias/dynapath.png?branch=master" alt="Build Status" /></a></h1>
<p>dynapath provides a protocol and util functions for class loaders that
make their effective classpaths readable and/or modifiable.</p>
<h2>Rationale</h2>
<p>Clojure uses a <code>clojure.lang.DynamicClassLoader</code> by default (an
extension of <code>java.net.URLClassLoader</code>), which provides <code>.getURLs</code> for
reading the effective classpath and <code>.addURL</code> for modifying it. It's
common for projects that need to read or modify the effective
classpath to assume that a <code>URLClassLoader</code> is always available. But
in some environments, the available class loader may not be a
<code>URLClassLoader</code>, and may not be readable or modifiable.</p>
<p>Some projects (notably <code>pomegranate</code>) handle this by providing a
protocol that can be implemented for other class loaders that may
provide similar functionality.</p>
<p>dynapath provides a protocol that is based on an extraction of
pomegranate's protocol, and is intended to be a standard way for
accessing or modifying the effective classpath. Using dynapath in your
library instead of assuming a class loader or implementing your own
protocol provides the following benefits:</p>
<ul>
<li>Your library can work with any modifiable/readable class loader
without any changes</li>
<li>Any project that has already implemented <code>DynamicClasspath</code> for
whatever esoteric class loader they are using will not need any
other changes to use your library as well</li>
</ul>
<h2>Usage</h2>
<p>Add it as a dependency:</p>
<p>For a Leiningen project:</p>
<pre><code>[org.tcrawley/dynapath "0.2.1"]
</code></pre>
<p>For a maven project:</p>
<pre><code><dependency>
<groupId>org.tcrawley</groupId>
<artifactId>dynapath</artifactId>
<version>0.2.1</version>
</dependency>
</code></pre>
<p>If you need to access or modify the effective classpath:</p>
<pre><code>(require '[dynapath.util :as dp])
;; returns a seq of the urls for the classloader. Takes any classloader
;; (whether it implements DynamicClasspath or not) and does the right thing
(dp/classpath-urls a-classloader)
;; returns a seq of all the urls available from the classloader and its
;; parentage chain
(dp/all-classpath-urls a-classloader)
;; adds a url to the given classloader if it is addable
(dp/add-classpath-url a-classloader a-url)
</code></pre>
<p>Loading the <code>dynapath.defaults</code> namespace will automatically implement
<code>classpath-urls</code> and <code>add-classpath-url</code> for <code>URLClassLoader</code> and
<code>DynamicClassLoader</code>.</p>
<p>If you need to implement <code>DynamicClasspath</code>:</p>
<pre><code>(require '[dynapath.dynamic-classpath :as dc])
(extend-type AReadableButNotModfiableClassLoader
dc/DynamicClasspath
(can-read? [_] true)
(can-add? [_] false)
(classpath-urls [cl] (seq ...)))
(extend AReadableAndModifiableClassLoader
dc/DynamicClasspath
(assoc dc/base-readable-addable-classpath ;; implements can-read? and can-add?
:classpath-urls (fn [cl] ...)
:add-classpath-url (fn [cl url] ...)))
</code></pre>
<h2>Who's using it?</h2>
<ul>
<li><a href="https://github.com/Raynes/bultitude">bultitude</a></li>
<li><a href="https://github.com/immutant/immutant">immutant</a></li>
<li><a href="https://github.com/pallet/ritz">ritz</a></li>
<li><a href="https://github.com/xumingming/tair-repl">tair-repl</a></li>
</ul>
<p>There are currently pending pull requests for:</p>
<ul>
<li><a href="https://github.com/cemerick/pomegranate">pomegranate</a></li>
</ul>
<p>Are you using it? If so, add yourself to this list and send me a PR.</p>
<h2>License</h2>
<p>Copyright © 2012 Tobias Crawley</p>
<p>Distributed under the Eclipse Public License.</p>
</body>
</html>
|