|
From: <tr...@us...> - 2003-06-27 02:20:01
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/compiler
In directory sc8-pr-cvs1:/tmp/cvs-serv700/src/com/babeldoc/core/pipeline/compiler
Modified Files:
PipelineClassLoader.java PipelineStageCompiler.java
Log Message:
reformatted and updated license header
Index: PipelineClassLoader.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/compiler/PipelineClassLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PipelineClassLoader.java 24 Feb 2003 22:46:54 -0000 1.1.1.1
--- PipelineClassLoader.java 27 Jun 2003 02:19:59 -0000 1.2
***************
*** 1,43 ****
! /*
! * $Header$
! * $DateTime$
*
*
! * babeldoc: universal document processor
! * Copyright (C) 2002 Bruce McDonald, Elogex Inc.
*
! * 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.pipeline.compiler;
-
/**
* <strong>PipelineClassLoader</strong>
*
- * <p>This is pipeline classloader for getting the created classes. Now if the
- * class does not exist, then this will delegate (to where?) to create the classes
- * using bcel</p>
- *
- * <p>Title: Babel</p>
- * <p>Description: Universal Document Processor</p>
- * <p>Copyright: Copyright (c) 2002</p>
- * <p>Company: </p>
* @author Bmcdonald
* @version 1.0
*/
! public class PipelineClassLoader
! extends ClassLoader {
/** instance: the name of the pipeline "package" */
private String namespace;
--- 1,98 ----
! /* ====================================================================
! * 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.pipeline.compiler;
/**
* <strong>PipelineClassLoader</strong>
+ *
+ * <p>
+ * This is pipeline classloader for getting the created classes. Now if the
+ * class does not exist, then this will delegate (to where?) to create the
+ * classes using bcel
+ * </p>
+ *
+ * <p>
+ * Title: Babel
+ * </p>
+ *
+ * <p>
+ * Description: Universal Document Processor
+ * </p>
+ *
+ * <p>
+ * Copyright: Copyright (c) 2002
+ * </p>
+ *
+ * <p>
+ * Company:
+ * </p>
*
* @author Bmcdonald
* @version 1.0
*/
! public class PipelineClassLoader extends ClassLoader {
/** instance: the name of the pipeline "package" */
private String namespace;
***************
*** 58,94 ****
/**
! * Load the pipeline stage factory using the configured namespace. If the class
! * is not defined, then compile and define it and create an instance of it.
*
* @param name
* @return
*/
! public com.babeldoc.core.pipeline.IPipelineStageFactory getCompiledPipelineStageFactory(com.babeldoc.core.pipeline.PipelineFactory pFactory,
! String name) {
name += getNamespace();
! com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] Getting \"" + name + "\"");
Class classObject = this.loadClass(name);
if (classObject == null) {
com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] got null, creating");
byte[] data = compileFactory(pFactory, name);
classObject = defineClass(name, data, 0, data.length);
}
try {
return (com.babeldoc.core.pipeline.IPipelineStageFactory) (classObject.newInstance());
} catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Exception creating compiled stage factory", e);
}
return null;
}
/**
* Load the class
*
* @param name the name of the pipeline to load.
* @return the class
*/
public synchronized Class loadClass(String name) {
Class c = findLoadedClass(name);
if (c != null) {
return c;
--- 113,170 ----
/**
! * Load the pipeline stage factory using the configured namespace. If the
! * class is not defined, then compile and define it and create an instance
! * of it.
*
+ * @param pFactory DOCUMENT ME!
* @param name
+ *
* @return
*/
! public com.babeldoc.core.pipeline.IPipelineStageFactory getCompiledPipelineStageFactory(
! com.babeldoc.core.pipeline.PipelineFactory pFactory, String name) {
name += getNamespace();
! com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] Getting \"" +
! name + "\"");
!
Class classObject = this.loadClass(name);
+
if (classObject == null) {
com.babeldoc.core.LogService.getInstance().logDebug("[PipelineClassLoader.getCompiledPipelineStageFactory] got null, creating");
+
byte[] data = compileFactory(pFactory, name);
classObject = defineClass(name, data, 0, data.length);
}
+
try {
return (com.babeldoc.core.pipeline.IPipelineStageFactory) (classObject.newInstance());
} catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Exception creating compiled stage factory",
! e);
}
+
return null;
}
/**
+ * Get the namespace
+ *
+ * @return
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
* Load the class
*
* @param name the name of the pipeline to load.
+ *
* @return the class
*/
public synchronized Class loadClass(String name) {
Class c = findLoadedClass(name);
+
if (c != null) {
return c;
***************
*** 99,107 ****
/**
! * Make the class using bcel
*
! * for the name, factory
*/
! protected byte[] compileFactory(com.babeldoc.core.pipeline.PipelineFactory pFactory, String name) {
/*
LogService.getInstance().logDebug("[PipelineClassLoader.compileFactory] Creating synthetic class");
--- 175,187 ----
/**
! * Make the class using bcel for the name, factory
*
! * @param pFactory DOCUMENT ME!
! * @param name DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
! protected byte[] compileFactory(
! com.babeldoc.core.pipeline.PipelineFactory pFactory, String name) {
/*
LogService.getInstance().logDebug("[PipelineClassLoader.compileFactory] Creating synthetic class");
***************
*** 126,138 ****
*/
return null;
- }
-
- /**
- * Get the namespace
- *
- * @return
- */
- public String getNamespace() {
- return namespace;
}
}
--- 206,209 ----
Index: PipelineStageCompiler.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/compiler/PipelineStageCompiler.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PipelineStageCompiler.java 24 Feb 2003 22:46:54 -0000 1.1.1.1
--- PipelineStageCompiler.java 27 Jun 2003 02:19:59 -0000 1.2
***************
*** 1,23 ****
! /*
! * $Header$
! * $DateTime$
*
*
! * babeldoc: universal document processor
! * Copyright (C) 2002 Bruce McDonald, Elogex Inc.
*
! * 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.pipeline.compiler;
--- 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.pipeline.compiler;
***************
*** 30,42 ****
import java.util.HashMap;
/**
! * <strong>PipelineStageCompiler</strong>
! * This class used to do pipeline stage compilation.
! * .
*
- * <p>Title: Babel</p>
- * <p>Description: Universal Document Processor</p>
- * <p>Copyright: Copyright (c) 2002</p>
- * <p>Company: </p>
* @author Bmcdonald
* @version 1.0
--- 73,97 ----
import java.util.HashMap;
+
/**
! * <strong>PipelineStageCompiler</strong> This class used to do pipeline stage
! * compilation. .
! *
! * <p>
! * Title: Babel
! * </p>
! *
! * <p>
! * Description: Universal Document Processor
! * </p>
! *
! * <p>
! * Copyright: Copyright (c) 2002
! * </p>
! *
! * <p>
! * Company:
! * </p>
*
* @author Bmcdonald
* @version 1.0
***************
*** 45,63 ****
/** constant: the name of the configuration */
public static final String CONFIG_NAME = "pipeline/compiler";
/** constant: the name of the namespace property key */
public static final String NAMESPACE = "namespace";
/** constant: the name of the namespace property key */
public static final String COMPILER = "compile";
/** instance: hashmap of the class loaders out there */
HashMap loaders = null;
/** instance: temporary measure - single class loader for all pipelines */
PipelineClassLoader loader = null;
-
- /** static: the singleton reference */
- private static PipelineStageCompiler pipelineStageCompiler = null;
-
/**
* Private constructor. If the compiler is set to active, initialize.
--- 100,119 ----
/** constant: the name of the configuration */
public static final String CONFIG_NAME = "pipeline/compiler";
+
/** constant: the name of the namespace property key */
public static final String NAMESPACE = "namespace";
+
/** constant: the name of the namespace property key */
public static final String COMPILER = "compile";
+ /** static: the singleton reference */
+ private static PipelineStageCompiler pipelineStageCompiler = null;
/** instance: hashmap of the class loaders out there */
HashMap loaders = null;
+
/** instance: temporary measure - single class loader for all pipelines */
PipelineClassLoader loader = null;
/**
* Private constructor. If the compiler is set to active, initialize.
***************
*** 66,76 ****
private PipelineStageCompiler() {
String compile = ConfigService.getString(CONFIG_NAME, COMPILER);
! if (compile != null && compile.equalsIgnoreCase("yes")) {
//loaders = new HashMap();
String namespace = ConfigService.getString(CONFIG_NAME, NAMESPACE);
if (namespace == null) {
namespace = "pipeline";
}
! LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] creating class loader \"" + namespace + "\"");
loader = new PipelineClassLoader(namespace);
}
--- 122,136 ----
private PipelineStageCompiler() {
String compile = ConfigService.getString(CONFIG_NAME, COMPILER);
!
! if ((compile != null) && compile.equalsIgnoreCase("yes")) {
//loaders = new HashMap();
String namespace = ConfigService.getString(CONFIG_NAME, NAMESPACE);
+
if (namespace == null) {
namespace = "pipeline";
}
!
! LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] creating class loader \"" +
! namespace + "\"");
loader = new PipelineClassLoader(namespace);
}
***************
*** 80,83 ****
--- 140,144 ----
* Get the pipeline stage factory
*
+ * @return DOCUMENT ME!
*/
public static PipelineStageCompiler getInstance() {
***************
*** 85,88 ****
--- 146,150 ----
pipelineStageCompiler = new PipelineStageCompiler();
}
+
return pipelineStageCompiler;
}
***************
*** 93,104 ****
* @param pFactory the factory of the pipeline
* @param name the name of pipelinestage factory
* @return
*/
! public IPipelineStageFactory getPipelineStageFactory(PipelineFactory pFactory,
! String name) {
if (loader != null) {
return loader.getCompiledPipelineStageFactory(pFactory, name);
} else {
LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] No loader - aborting");
return null;
}
--- 155,168 ----
* @param pFactory the factory of the pipeline
* @param name the name of pipelinestage factory
+ *
* @return
*/
! public IPipelineStageFactory getPipelineStageFactory(
! PipelineFactory pFactory, String name) {
if (loader != null) {
return loader.getCompiledPipelineStageFactory(pFactory, name);
} else {
LogService.getInstance().logDebug("[PipelineStageCompiler.PipelineStageCompiler] No loader - aborting");
+
return null;
}
|