* Make helmadoc work with multiple application repositories.
This commit is contained in:
parent
3a55bd1b5e
commit
05bce5953e
2 changed files with 46 additions and 39 deletions
|
@ -17,8 +17,8 @@
|
|||
package helma.doc;
|
||||
|
||||
import helma.framework.IPathElement;
|
||||
import helma.framework.repository.FileResource;
|
||||
import helma.framework.repository.FileResource;
|
||||
import helma.framework.core.Application;
|
||||
import helma.framework.repository.FileRepository;
|
||||
import helma.main.Server;
|
||||
import helma.util.ResourceProperties;
|
||||
import java.io.*;
|
||||
|
@ -27,19 +27,21 @@ import java.util.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class DocApplication extends DocDirElement {
|
||||
public class DocApplication extends DocElement {
|
||||
|
||||
Application app;
|
||||
HashSet excluded;
|
||||
|
||||
/**
|
||||
* Creates a new DocApplication object.
|
||||
*
|
||||
* @param name ...
|
||||
* @param location ...
|
||||
* @param app
|
||||
*
|
||||
* @throws DocException ...
|
||||
*/
|
||||
public DocApplication(String name, File location) throws DocException {
|
||||
super(name, location, APPLICATION);
|
||||
public DocApplication(Application app) throws DocException {
|
||||
super(app.getName(), app.getAppDir(), APPLICATION);
|
||||
this.app = app;
|
||||
readProps();
|
||||
}
|
||||
|
||||
|
@ -61,7 +63,7 @@ public class DocApplication extends DocDirElement {
|
|||
*
|
||||
* @param args ...
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
/* public static void main(String[] args) {
|
||||
System.out.println("this is helma.doc");
|
||||
DocApplication app;
|
||||
app = new DocApplication (args[0], args[1]);
|
||||
|
@ -90,20 +92,13 @@ public class DocApplication extends DocDirElement {
|
|||
|
||||
// System.out.println (func.getContent ());
|
||||
// System.out.println ("\n\n\ncomment = " + func.getComment ());
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* reads the app.properties file and parses for helma.excludeDocs
|
||||
*/
|
||||
private void readProps() {
|
||||
File propsFile = new File(location, "app.properties");
|
||||
ResourceProperties serverProps = null;
|
||||
if (Server.getServer()!=null) {
|
||||
serverProps = Server.getServer().getProperties();
|
||||
}
|
||||
ResourceProperties appProps = new ResourceProperties();
|
||||
appProps.setDefaultProperties(serverProps);
|
||||
appProps.addResource(new FileResource(propsFile));
|
||||
ResourceProperties appProps = app.getProperties();
|
||||
|
||||
excluded = new HashSet();
|
||||
addExclude("cvs");
|
||||
|
@ -147,23 +142,34 @@ public class DocApplication extends DocDirElement {
|
|||
*/
|
||||
public void readApplication() {
|
||||
readProps();
|
||||
|
||||
String[] arr = location.list();
|
||||
|
||||
children.clear();
|
||||
|
||||
Iterator it = app.getRepositories().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Object next = it.next();
|
||||
|
||||
if (!(next instanceof FileRepository)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File dir = ((FileRepository) next).getDirectory();
|
||||
|
||||
String[] arr = dir.list();
|
||||
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (isExcluded(arr[i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File f = new File(location.getAbsolutePath(), arr[i]);
|
||||
File f = new File(dir.getAbsolutePath(), arr[i]);
|
||||
|
||||
if (!f.isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
System.err.println("*** NEW PROTOTYPE DOC: " + f);
|
||||
DocPrototype pt = DocPrototype.newInstance(f, this);
|
||||
|
||||
addChild(pt);
|
||||
|
@ -179,6 +185,7 @@ public class DocApplication extends DocDirElement {
|
|||
((DocPrototype) i.next()).checkInheritance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -449,7 +449,7 @@ public class RhinoEngine implements ScriptingEngine {
|
|||
*/
|
||||
public IPathElement getIntrospector() {
|
||||
if (doc == null) {
|
||||
doc = new DocApplication(app.getName(), new File(Server.getServer().getAppsHome(), app.getName()));
|
||||
doc = new DocApplication(app);
|
||||
doc.readApplication();
|
||||
}
|
||||
return doc;
|
||||
|
|
Loading…
Add table
Reference in a new issue