Craig,
Thanks for commiting the file. I agree that this might be the best way to generate discussion. I've answered some of your points below.
I've committed your proposed CatalogFactory.java interface to [chain],Sorry about the nonconforming javadoc. I did my best to conform to the style.
with minor tweaks to the Javadoc comments to conform to the usual
style in [chain].
The getInstance() method seems out of place here ... in most factoryI agree. I had started wondering about this myself. I definitely plan on having it in my implementation as you point out. I've attached a patch that removes this. The patch also fixes a problem with excessive line spacing. I'm not sure if it was on my end or your end but the source file had an "extra" space for every line. The patch addresses that as well.
pattern implementations I've seen, this would actually be a public
static method on an implementation of CatalogFactory. What kind of
use cases do you see for it here?
Also, your original motivation was to disconnect catalog lookups fromHmmm you seem to be pointing out something that I was not aware of. If I understand you corectly, you are saying that classes contained in a jar in the server's classpath (ex. server/lib) vs. the application classpath, then that class will be the one used by every application on the server. Is that right? If so, then a static class loaded by the server container is what will be referenced by all applications using that class.
something like the ServletContext attribute that ChainListener
(containing a Catalog) sets up. How are you proposing to do this
disconnect -- I presume it's something in the actual implementation of
CatalogFactory? If so, will your proposed solution work when
commons-chain.jar is included either in the WEB-INF/lib directory, and
when it's installed in the servet container (thus making static
variables global across webapps)?
I had not thought of that. I'm not sure that this is a a deal breaker though. People wishing to deploy the chain.jar at the server level will just need to be aware that they should probably not use the "default" catalog. If each application adds their catalog with a unique name, there should not be a problem right?
sean
Index: chain/src/java/org/apache/commons/chain/CatalogFactory.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/chain/src/java/org/apache/commons/chain/CatalogFactory.java,v retrieving revision 1.1 diff -u -r1.1 CatalogFactory.java --- chain/src/java/org/apache/commons/chain/CatalogFactory.java 2 Oct 2004 19:20:55 -0000 1.1 +++ chain/src/java/org/apache/commons/chain/CatalogFactory.java 5 Oct 2004 02:36:02 -0000 @@ -1,76 +1,67 @@ -/* - * Copyright 1999-2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.chain; - -/** - * <p>A [EMAIL PROTECTED] CatalogFactory} is a class used to store and retrieve - * [EMAIL PROTECTED] Catalog}s. The factory allows for a default [EMAIL PROTECTED] Catalog} - * as well as [EMAIL PROTECTED] Catalog}s stored with a name key. Follows the - * Factory pattern (see GoF).</p> - * - * @author Sean Schofield - * @version $Revision: 1.1 $ $Date: 2004/10/02 19:20:55 $ - */ - -public interface CatalogFactory { - - - /** - * <p>Returns a instance of CatalogFactory.</p> - * - * @return an instance of CatalogFactory - */ - public CatalogFactory getInstance(); - - - /** - * <p>Gets the default instance of Catalog associated with the factory.</p> - * - * @return the default Catalog instance - */ - public Catalog getCatalog(); - - - /** - * <p>Sets the default instance of Catalog associated with the factory.</p> - * - * @param catalog the default Catalog instance - */ - public void setCatalog(Catalog catalog); - - - /** - * <p>Retrieves a Catalog instance by name.</p> - * - * @param name the name of the Catalog to retrieve - * @return the specified Catalog - */ - public Catalog getCatalog(String name); - - - /** - * <p>Adds a named instance of Catalog to the factory (for subsequent - * retrieval later).</p> - * - * @param name the name of the Catalog to add - * @param catalog the Catalog to add - */ - public void addCatalog(String name, Catalog catalog); - - -} - - +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.chain; + + +/** + * <p>A [EMAIL PROTECTED] CatalogFactory} is a class used to store and retrieve + * [EMAIL PROTECTED] Catalog}s. The factory allows for a default [EMAIL PROTECTED] Catalog} + * as well as [EMAIL PROTECTED] Catalog}s stored with a name key. Follows the + * Factory pattern (see GoF).</p> + * + * @author Sean Schofield + * @version $Revision: 1.1 $ $Date: 2004/10/02 19:20:55 $ + */ + + +public interface CatalogFactory { + + + /** + * <p>Gets the default instance of Catalog associated with the factory.</p> + * + * @return the default Catalog instance + */ + public Catalog getCatalog(); + + + /** + * <p>Sets the default instance of Catalog associated with the factory.</p> + * + * @param catalog the default Catalog instance + */ + public void setCatalog(Catalog catalog); + + /** + * <p>Retrieves a Catalog instance by name.</p> + * + * @param name the name of the Catalog to retrieve + * @return the specified Catalog + */ + + public Catalog getCatalog(String name); + + /** + * <p>Adds a named instance of Catalog to the factory (for subsequent + * retrieval later).</p> + * + * @param name the name of the Catalog to add + * @param catalog the Catalog to add + */ + public void addCatalog(String name, Catalog catalog); + +}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]