Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module
In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/module
Modified Files:
BabeldocModule.java BabeldocModuleCommand.java
BabeldocModuleList.java CoreModule.java
Log Message:
reformatted and updated license header
Index: BabeldocModule.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/BabeldocModule.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** BabeldocModule.java 22 May 2003 03:20:26 -0000 1.14
--- BabeldocModule.java 27 Jun 2003 02:19:58 -0000 1.15
***************
*** 1,35 ****
package com.babeldoc.core.module;
import java.io.Serializable;
import java.util.Set;
/**
! * Created by IntelliJ IDEA.
! * User: bruce
! * Date: May 18, 2003
! * Time: 7:27:57 PM
! * To change this template use Options | File Templates.
*/
! abstract public class BabeldocModule
! implements Serializable {
/**
! * Return the name of the module. This must be unique. The name must not contain any
! * periods, punctations symbols. Be safe and use letters and numbers.
*
* @return
*/
! abstract public String getName();
/**
! * Return the set of names of modules that this module depends on. If this module does not depend
! * on return a null set or a null object.
*
* @return
*/
! abstract public Set getDependsOn();
! /**
! * A do-nothing initializer - override with real code to do something when the module
! * is loaded into the system.
*/
public void initialize() {
--- 1,99 ----
+ /* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact ap...@ap....
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * Portions of this software are based upon public domain software
+ * originally written at the National Center for Supercomputing Applications,
+ * University of Illinois, Urbana-Champaign.
+ * ====================================================================
+ *
+ * Babeldoc: The Universal Document Processor
+ *
+ * $Header$
+ * $DateTime$
+ * $Author$
+ *
+ */
package com.babeldoc.core.module;
import java.io.Serializable;
+
import java.util.Set;
+
/**
! * Created by IntelliJ IDEA. User: bruce Date: May 18, 2003 Time: 7:27:57 PM To
! * change this template use Options | File Templates.
*/
! public abstract class BabeldocModule implements Serializable {
/**
! * Return the set of names of modules that this module depends on. If this
! * module does not depend on return a null set or a null object.
*
* @return
*/
! public abstract Set getDependsOn();
/**
! * Return the name of the module. This must be unique. The name must not
! * contain any periods, punctations symbols. Be safe and use letters and
! * numbers.
*
* @return
*/
! public abstract String getName();
! /**
! * A do-nothing initializer - override with real code to do something when
! * the module is loaded into the system.
*/
public void initialize() {
***************
*** 37,42 ****
/**
! * A do-nothing unloader - override with real code to do something when the module
! * is unloaded from the system.
*/
public void unload() {
--- 101,106 ----
/**
! * A do-nothing unloader - override with real code to do something when the
! * module is unloaded from the system.
*/
public void unload() {
Index: BabeldocModuleCommand.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/BabeldocModuleCommand.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** BabeldocModuleCommand.java 22 May 2003 03:20:26 -0000 1.13
--- BabeldocModuleCommand.java 27 Jun 2003 02:19:58 -0000 1.14
***************
*** 1,20 ****
! /*
! * $Header$
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.core.module;
--- 1,66 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
! * Copyright (c) 2000 The Apache Software Foundation. All rights
! * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.module;
***************
*** 22,25 ****
--- 68,72 ----
import com.babeldoc.core.BabeldocCommand;
import com.babeldoc.core.I18n;
+
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
***************
*** 28,116 ****
import java.util.Set;
/**
! * Command class to access and browse the babeldoc modules from the command line
*
* @author bruce
*/
public class BabeldocModuleCommand extends BabeldocCommand {
! /**
! * Main routine
! * @param args
! */
! public static void main(String[] args) {
! new BabeldocModuleCommand(args);
! System.exit(0);
! }
!
! /**
! * Setup the babeldoc command class
! *
! * @param args the command line arguments
! */
! public BabeldocModuleCommand(String[] args) {
! super("module", I18n.get("core.module.command.desc"), args);
! }
! /**
! * Setup the command line arguments
! *
! * @param options the commandline options to look for
! */
! public void setupCommandLine(Options options) {
! super.setupCommandLine(options);
! options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription(I18n.get("core.module.command.option.list")).create('l'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription(I18n.get("core.module.command.option.create")).create('c'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription(I18n.get("core.module.command.option.delete")).create('d'));
! }
! /**
! * process and execute the commandline and
! *
! * @param commandLine the command line
! */
! public void execute(CommandLine commandLine) {
! if (commandLine.hasOption('l')) {
! listModules();
! } else if(commandLine.hasOption("c")) {
// createCache();
! } else if(commandLine.hasOption("d")) {
// deleteCache();
! } else {
! printUsage();
! }
! }
!
! /**
! * Get the set of strings as a csv string.
! *
! * @param depSet
! * @return
! */
! private String getDependantsAsCVS(Set depSet) {
! String[] depsArray = new String[depSet.size()];
! depSet.toArray(depsArray);
! StringBuffer deps = new StringBuffer();
! for(int j = 0; j < depsArray.length; ++j) {
! if(j!=0) {
! deps.append(", ").append(depsArray[j]);
! } else {
! deps.append(depsArray[j]);
! }
! }
! return deps.toString();
! }
! /**
! * List the currently load modules in the system
! */
! public void listModules() {
! BabeldocModule [] modules = BabeldocModuleList.getInstance().getSortedModules();
! for(int i = 0; i < modules.length; ++i) {
BabeldocModule module = modules[i];
String deps = getDependantsAsCVS(module.getDependsOn());
System.out.println(I18n.get("core.module.command.list.output",
! module.getName(), deps));
}
! }
}
--- 75,177 ----
import java.util.Set;
+
/**
! * Command class to access and browse the babeldoc modules from the command
! * line
*
* @author bruce
*/
public class BabeldocModuleCommand extends BabeldocCommand {
! /**
! * Setup the babeldoc command class
! *
! * @param args the command line arguments
! */
! public BabeldocModuleCommand(String[] args) {
! super("module", I18n.get("core.module.command.desc"), args);
! }
! /**
! * Main routine
! *
! * @param args
! */
! public static void main(String[] args) {
! new BabeldocModuleCommand(args);
! System.exit(0);
! }
! /**
! * process and execute the commandline and
! *
! * @param commandLine the command line
! */
! public void execute(CommandLine commandLine) {
! if (commandLine.hasOption('l')) {
! listModules();
! } else if (commandLine.hasOption("c")) {
// createCache();
! } else if (commandLine.hasOption("d")) {
// deleteCache();
! } else {
! printUsage();
! }
! }
! /**
! * List the currently load modules in the system
! */
! public void listModules() {
! BabeldocModule[] modules = BabeldocModuleList.getInstance()
! .getSortedModules();
! for (int i = 0; i < modules.length; ++i) {
BabeldocModule module = modules[i];
String deps = getDependantsAsCVS(module.getDependsOn());
System.out.println(I18n.get("core.module.command.list.output",
! module.getName(), deps));
}
! }
!
! /**
! * Setup the command line arguments
! *
! * @param options the commandline options to look for
! */
! public void setupCommandLine(Options options) {
! super.setupCommandLine(options);
! options.addOption(OptionBuilder.isRequired(false).hasArg(false)
! .withDescription(I18n.get(
! "core.module.command.option.list")).create('l'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false)
! .withDescription(I18n.get(
! "core.module.command.option.create")).create('c'));
! options.addOption(OptionBuilder.isRequired(false).hasArg(false)
! .withDescription(I18n.get(
! "core.module.command.option.delete")).create('d'));
! }
!
! /**
! * Get the set of strings as a csv string.
! *
! * @param depSet
! *
! * @return
! */
! private String getDependantsAsCVS(Set depSet) {
! String[] depsArray = new String[depSet.size()];
! depSet.toArray(depsArray);
!
! StringBuffer deps = new StringBuffer();
!
! for (int j = 0; j < depsArray.length; ++j) {
! if (j != 0) {
! deps.append(", ").append(depsArray[j]);
! } else {
! deps.append(depsArray[j]);
! }
! }
!
! return deps.toString();
! }
}
Index: BabeldocModuleList.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/BabeldocModuleList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BabeldocModuleList.java 21 May 2003 01:49:45 -0000 1.2
--- BabeldocModuleList.java 27 Jun 2003 02:19:58 -0000 1.3
***************
*** 1,20 ****
! /*
! * $Header$
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.core.module;
--- 1,66 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
! * Copyright (c) 2000 The Apache Software Foundation. All rights
! * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.module;
***************
*** 27,44 ****
import java.util.Map;
/**
! * The BabeldocModuleList is the main controller to discover and manipulate the list of
! * modules in babeldoc. Each module must provide an implementation of the IBabeldocModule
! * interface. This is specified as a jar service. There is a tie-in with the build process in
! * that the name of the module must match the name returned by the getName method. This is important.
* <p>
* This is a singleton class. There is an static instance.
*/
public class BabeldocModuleList {
/** Instance variable */
private static BabeldocModuleList instance = null;
!
private Map map = new HashMap();
- BabeldocModule [] modules = null;
/**
--- 73,93 ----
import java.util.Map;
+
/**
! * The BabeldocModuleList is the main controller to discover and manipulate the
! * list of modules in babeldoc. Each module must provide an implementation of
! * the IBabeldocModule interface. This is specified as a jar service. There
! * is a tie-in with the build process in that the name of the module must
! * match the name returned by the getName method. This is important.
! *
* <p>
* This is a singleton class. There is an static instance.
+ * </p>
*/
public class BabeldocModuleList {
/** Instance variable */
private static BabeldocModuleList instance = null;
! BabeldocModule[] modules = null;
private Map map = new HashMap();
/**
***************
*** 49,72 ****
}
/**
! * Load the module list using the jakarta-discovery services methods. Initialize the modules
! * as we go.
*/
! private void loadDynamicModules() {
! for(Enumeration i = Service.providers(BabeldocModule.class);i.hasMoreElements();) {
! BabeldocModule module = (BabeldocModule)i.nextElement();
! // System.out.println("Module found: "+module.getName());
! addModule(module);
}
}
/**
! * Add the module to the list of modules
! * @param module
*/
! public void addModule(BabeldocModule module) {
! module.initialize();
! map.put(module.getName(), module);
! modules = null; // Set the cached list of modules to null.
}
--- 98,136 ----
}
+ /*
+ private String printOutArrayList(IBabeldocModule [] list) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[ ");
+ for(int i = 0; i < list.length; ++i) {
+ buffer.append((list[i].getName()+" "));
+ }
+ buffer.append("]");
+
+ return buffer.toString();
+ }
+ */
+
/**
! * Get the instance variable. Instantiate the object if necessary.
! *
! * @return
*/
! public static BabeldocModuleList getInstance() {
! if (instance == null) {
! instance = new BabeldocModuleList();
}
+
+ return instance;
}
/**
! * Get the module with the name, depName
! *
! * @param depName
! *
! * @return
*/
! public BabeldocModule getModule(String depName) {
! return (BabeldocModule) this.map.get(depName);
}
***************
*** 76,93 ****
* @return array of babeldoc modules
*/
! public BabeldocModule [] getSortedModules() {
! if(modules==null) {
modules = new BabeldocModule[map.size()];
map.values().toArray(modules);
! for(int i = 0; i<modules.length; ++i ) {
! for(int j = 0; j<modules.length; ++j) {
! if(i==j) {
continue;
}
BabeldocModule mod1 = modules[i];
BabeldocModule mod2 = modules[j];
! if(dependsOn(mod1, mod2)) {
BabeldocModule tmp = modules[i];
modules[i] = modules[j];
--- 140,158 ----
* @return array of babeldoc modules
*/
! public BabeldocModule[] getSortedModules() {
! if (modules == null) {
modules = new BabeldocModule[map.size()];
map.values().toArray(modules);
! for (int i = 0; i < modules.length; ++i) {
! for (int j = 0; j < modules.length; ++j) {
! if (i == j) {
continue;
}
+
BabeldocModule mod1 = modules[i];
BabeldocModule mod2 = modules[j];
! if (dependsOn(mod1, mod2)) {
BabeldocModule tmp = modules[i];
modules[i] = modules[j];
***************
*** 97,158 ****
}
}
return modules;
}
/**
! * Returns true if mod1 depends on mod2. This is a fairly expensive operation.
*
* @param mod1
* @param mod2
* @return
*/
private boolean dependsOn(BabeldocModule mod1, BabeldocModule mod2) {
! if(mod1.getDependsOn()!=null) {
! for(Iterator iter = mod1.getDependsOn().iterator(); iter.hasNext();) {
! String depName = (String)iter.next();
! if(depName.equals(mod2.getName())) {
return true;
} else {
BabeldocModule depMod = getModule(depName);
return dependsOn(depMod, mod2);
}
}
}
return false;
}
/**
! * Get the module with the name, depName
! *
! * @param depName
! * @return
*/
! public BabeldocModule getModule(String depName) {
! return (BabeldocModule)this.map.get(depName);
! }
!
! /*
! private String printOutArrayList(IBabeldocModule [] list) {
! StringBuffer buffer = new StringBuffer();
! buffer.append("[ ");
! for(int i = 0; i < list.length; ++i) {
! buffer.append((list[i].getName()+" "));
! }
! buffer.append("]");
!
! return buffer.toString();
! }
! */
! /**
! * Get the instance variable. Instantiate the object if necessary.
! *
! * @return
! */
! public static BabeldocModuleList getInstance() {
! if(instance==null) {
! instance = new BabeldocModuleList();
}
- return instance;
}
--- 162,219 ----
}
}
+
return modules;
}
/**
! * Add the module to the list of modules
! *
! * @param module
! */
! public void addModule(BabeldocModule module) {
! module.initialize();
! map.put(module.getName(), module);
! modules = null; // Set the cached list of modules to null.
! }
!
! /**
! * Returns true if mod1 depends on mod2. This is a fairly expensive
! * operation.
*
* @param mod1
* @param mod2
+ *
* @return
*/
private boolean dependsOn(BabeldocModule mod1, BabeldocModule mod2) {
! if (mod1.getDependsOn() != null) {
! for (Iterator iter = mod1.getDependsOn().iterator(); iter.hasNext();) {
! String depName = (String) iter.next();
!
! if (depName.equals(mod2.getName())) {
return true;
} else {
BabeldocModule depMod = getModule(depName);
+
return dependsOn(depMod, mod2);
}
}
}
+
return false;
}
/**
! * Load the module list using the jakarta-discovery services methods.
! * Initialize the modules as we go.
*/
! private void loadDynamicModules() {
! for (Enumeration i = Service.providers(BabeldocModule.class);
! i.hasMoreElements();) {
! BabeldocModule module = (BabeldocModule) i.nextElement();
! // System.out.println("Module found: "+module.getName());
! addModule(module);
}
}
Index: CoreModule.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/module/CoreModule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CoreModule.java 21 May 2003 01:31:54 -0000 1.1
--- CoreModule.java 27 Jun 2003 02:19:58 -0000 1.2
***************
*** 1,20 ****
! /*
! * $Header$
*
! * babeldoc: universal document processor
*
! * This program is free software; you can redistribute it and/or
! * modify it under the terms of the GNU General Public License
! * as published by the Free Software Foundation; either version 2
! * of the License, or (at your option) any later version.
*
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.babeldoc.core.module;
--- 1,66 ----
! /* ====================================================================
! * The Apache Software License, Version 1.1
*
! * Copyright (c) 2000 The Apache Software Foundation. All rights
! * reserved.
*
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
*
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Apache" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact ap...@ap....
! *
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
! *
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
! *
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
! *
! * Portions of this software are based upon public domain software
! * originally written at the National Center for Supercomputing Applications,
! * University of Illinois, Urbana-Champaign.
! * ====================================================================
! *
! * Babeldoc: The Universal Document Processor
! *
! * $Header$
! * $DateTime$
! * $Author$
*
*/
package com.babeldoc.core.module;
***************
*** 22,39 ****
import java.util.Set;
/**
! * Created by IntelliJ IDEA.
! * User: bruce
! * Date: May 18, 2003
! * Time: 5:55:27 PM
! * To change this template use Options | File Templates.
*/
! public class CoreModule extends BabeldocModule{
! public String getName() {
! return "core";
! }
!
public Set getDependsOn() {
return null;
}
}
--- 68,93 ----
import java.util.Set;
+
/**
! * Created by IntelliJ IDEA. User: bruce Date: May 18, 2003 Time: 5:55:27 PM To
! * change this template use Options | File Templates.
*/
! public class CoreModule extends BabeldocModule {
! /**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
! */
public Set getDependsOn() {
return null;
+ }
+
+ /**
+ * TODO: DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getName() {
+ return "core";
}
}
|