diff --git a/ccm-core/web/WEB-INF/jboss-web.xml b/ccm-core/doc/jboss-web.xml similarity index 100% rename from ccm-core/web/WEB-INF/jboss-web.xml rename to ccm-core/doc/jboss-web.xml diff --git a/ccm-core/web/WEB-INF/sun-web.xml b/ccm-core/doc/sun-web.xml similarity index 100% rename from ccm-core/web/WEB-INF/sun-web.xml rename to ccm-core/doc/sun-web.xml diff --git a/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java b/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java index 83c985380..89a485b3c 100755 --- a/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java +++ b/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * Copyright (C) 2009 Peter Boy (pb@zes.uni-bremen.de) All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -60,7 +61,7 @@ import org.apache.log4j.Logger; */ public final class CCMResourceManager { public final static String versionId = - "$Id: CCM.java 1393 2006-11-28 09:12:32Z sskracic $" + + "$Id: CCMResourceManager.java 1393 2006-11-28 09:12:32Z sskracic $" + "$Author: pboy $" + "$DateTime: 2009/01/10 18:10:38 $"; @@ -160,12 +161,12 @@ public final class CCMResourceManager { * Note! API changed! * * Originally it is used to determine all file object locations of a - * CCMResourceManager installation, during the installation step as well as + * CCM installation, during the installation step as well as * while running the application inside a servlet container. The CCM installation * of a servlet container used to use a non-standard layout. It is based upon a * system wide environment variable CCM_HOME to determine the home directory. * - * The dependence from a system wide environment variable prevents a servlet + * The dependency from a system wide environment variable prevents a servlet * container to run multiple instances of CCM. In addition to it CCM will * be migrated to be installable in a standard way to a standard container. * Therefore all file locations will be given to the applications @@ -175,24 +176,43 @@ public final class CCMResourceManager { * Method getHomeDirectory() is preserved during the transition phase. * It may be removed in the future! Or it may be moved to * c.ad.packaging for assistence of the installation step only. + * + * MODIFIED: + * CCM_HOME is now interpreted as the path to the applications base + * directory (web application context). * * @return Directory location in the servers file system as File object. */ static final File getHomeDirectory() { - final String home = System.getProperty("ccm.home"); + + String home = System.getProperty("ccm.home"); if (home == null) { throw new IllegalStateException ("The ccm.home system property is null or not defined"); } - final File file = new File(home); - - if (!file.exists()) { - throw new IllegalStateException - ("The file given in the ccm.home system property " + - "does not exist"); + // make a guess, weather ist is old style (i.e. referring to the containers + // base directory and therefor does not contain the webapps part) or + // new style referring to the apps base directory (and therefor containing + // the webapps part) + if (home.indexOf("webapps") > 0 ){ + // should be new style } + else { + // presumably old style, add path to standard context name + home += "/webapps/ROOT)"; + } + + File file = new File(home); + +// No need to require that home exists (indeed, during install it will not). +// Should be created by invoking method if not. +// if (!file.exists()) { +// throw new IllegalStateException +// ("The file given in the ccm.home system property " + +// "does not exist"); +// } if (!file.isDirectory()) { throw new IllegalStateException @@ -296,7 +316,9 @@ public final class CCMResourceManager { // temporary: enforce that BaseDir is ROOT! - m_baseDir.renameTo(new File(m_baseDir.getParent(),"ROOT")); + // removed, all modules are now installed into one context and + // its name is specified in project.xml + // m_baseDir.renameTo(new File(m_baseDir.getParent(),"ROOT")); // eventually: check if dir exists, create it if not. if (!m_baseDir.exists()) { @@ -327,8 +349,9 @@ public final class CCMResourceManager { // environment variable. // During transition phase only! Must be removed when the new // standard compliant installation method is fully in place - m_baseDir = new File(new File(CCMResourceManager.getHomeDirectory(), - "webapps"), "ROOT"); + // MODIFIED + // HomeDirectory now specifies the applications context dir. + m_baseDir = CCMResourceManager.getHomeDirectory(); // eventually: check if dir exists, create it if not. if (!m_baseDir.exists()) { diff --git a/ccm-core/src/com/arsdigita/util/parameter/AbstractParameter.java b/ccm-core/src/com/arsdigita/util/parameter/AbstractParameter.java index 7c935f693..cb5bdcc82 100755 --- a/ccm-core/src/com/arsdigita/util/parameter/AbstractParameter.java +++ b/ccm-core/src/com/arsdigita/util/parameter/AbstractParameter.java @@ -154,6 +154,32 @@ public abstract class AbstractParameter implements Parameter { * Calls {@link #doRead(ParameterReader,ErrorList)}. * * @see Parameter#read(ParameterReader,ErrorList) + * + * From Parameter#read(ParameterReader,ErrorList): + * Gets the parameter value as a Java object. The value will have + * a specific runtime type and so may be appropriately cast. + * + * Reading typically follows the following procedure: + * + *
readererrors. Callers of this method will
+ * typically construct an ErrorList in which to
+ * collect errors.
+ *
+ * @param reader The ParameterReader from which to
+ * recover a string literal value; it cannot be null
+ * @param errors The ErrorList in which to collect
+ * any errors encountered; it cannot be null
+ * @return The Java object value of the parameter
+ *
*/
public final Object read(final ParameterReader reader,
final ErrorList errors) {
diff --git a/ccm-core/src/com/arsdigita/util/parameter/AbstractParameterContext.java b/ccm-core/src/com/arsdigita/util/parameter/AbstractParameterContext.java
index d2ddc3610..cc9344d6b 100755
--- a/ccm-core/src/com/arsdigita/util/parameter/AbstractParameterContext.java
+++ b/ccm-core/src/com/arsdigita/util/parameter/AbstractParameterContext.java
@@ -98,14 +98,29 @@ public abstract class AbstractParameterContext implements ParameterContext {
}
/**
- * @see ParameterContext#get(Parameter)
+ * From ParameterContext#get(Parameter):
+ * Gets the unmarshaled value of param. If the
+ * loaded value is null, param.getDefaultValue() is
+ * returned.
+ *
+ * @param param The named Parameter whose value to
+ * retrieve; it cannot be null
+ * @return The unmarshaled Java object value of param
*/
public Object get(final Parameter param) {
return get(param, param.getDefaultValue());
}
/**
- * @see ParameterContext#get(Parameter,Object)
+ * From ParameterContext#get(Parameter,Object)
+ * Gets the unmarshaled value of param, returning
+ * dephalt if param's value is null.
+ *
+ * @param param The Parameter whose value to
+ * retrieve; it cannot be null
+ * @param dephalt The fallback default value; it may be null
+ * @return The unmarshaled Java object value of param
+ * or dephalt if the former is null
*/
public Object get(final Parameter param, final Object dephault) {
if (Assert.isEnabled()) {
@@ -139,6 +154,8 @@ public abstract class AbstractParameterContext implements ParameterContext {
}
/**
+ *
+ *
* Reads and unmarshals all values associated with the registered
* parameters from reader. Any errors are returned.
*
@@ -156,7 +173,15 @@ public abstract class AbstractParameterContext implements ParameterContext {
}
/**
- * @see ParameterContext#load(ParameterReader,ErrorList)
+ * From ParameterContext#load(ParameterReader,ErrorList):
+ * Reads and unmarshals all values associated with the registered
+ * parameters from reader. If any errors are
+ * encountered, they are added to errors.
+ *
+ * @param reader The ParameterReader from which to
+ * fetch the values; it cannot be null
+ * @param errors The ErrorList that captures any
+ * errors while loading; it cannot be null
*/
public final void load(final ParameterReader reader,
final ErrorList errors) {
diff --git a/ccm-core/src/com/arsdigita/util/parameter/ResourceParameter.java b/ccm-core/src/com/arsdigita/util/parameter/ResourceParameter.java
index b376538ed..15cae35f2 100755
--- a/ccm-core/src/com/arsdigita/util/parameter/ResourceParameter.java
+++ b/ccm-core/src/com/arsdigita/util/parameter/ResourceParameter.java
@@ -31,7 +31,9 @@ import org.apache.log4j.Logger;
* InputStream for the given Resource. If it does not, and if it is
* required, it logs an error. Otherwise, it returns null.
*
- * @deprecated Use {@link URLParameter} instead.
+ * Had been deprecated for a while in favour of an URLParameter and a
+ * application specific resource: protocol extension (c.ad.util.protocol.resource).
+ * As of version 6.5 reverted to ResourceParameter to avoid non-standard extensions.
*
* @author Justin Ross <jross@redhat.com>
* @version $Id: ResourceParameter.java 287 2005-02-22 00:29:02Z sskracic $
diff --git a/ccm-core/web/WEB-INF/web.xml-ccm-core b/ccm-core/web/WEB-INF/web.xml-core
similarity index 100%
rename from ccm-core/web/WEB-INF/web.xml-ccm-core
rename to ccm-core/web/WEB-INF/web.xml-core