Integrate vendor release

r1795: First part of the conversion of CCM to be deployed in a standard way
  r1796: Multilanguage categorization (already local, but upgrade script
         added, comments and translation added)


First part of the conversion of CCM / APLAWS to be deployed in a standard way 
by a *.war file.

Backwards compatible to the procedures so far. The ccm scripts can be used
as used to. Only difference is the location of some files (see below).

As an alternative the webapps directory created by the ccm scripts can be
moved into a standard tomcat container or can be added as a virtual host.
APLAWS no longer depends on all the environment variables. For detailed 
instructions see documentation on the WIKI. This is a temporary solution,
further enhancements are on the way!

No update script required for this part.

Modifications:

-   Creation of a c.ad.runtime.CCMResourceManager class, which currently
handles just the file locations. It replaces the dependency from the
CCM_HOME environment variable. It is initialized during startup of the
servlet container or by the entry point of the installation tools (i.e.
c.ad.packaging.mastertool). It replaces the c.ad.packaging.CCM class
as well. Currently contains backwards compatibility code to check the 
runtime environment just in case the initialization is missing (will be 
removed later).

-   Creation of c.ad.web.CCMApplicationContextListener class which is
notified by the servlet container at the beginning of the startup procedure.
Initialises CCMResourceManager. Must be configured by web.xml (if a contributed
package overwrites the trunk values)!

-   File location changes:
    -   Configuration registry moved to [appbase]/WEB-INF/conf/registry
    -   ps2fs files moved to [appbase]/ps2fs
        (can be modified by configuration parameter)
    -   lucene index files moved to [appbase]/WEB-INF/work/lucene
        (can be modified by configuration parameter)
Developers watch out! ant clean now removes these files, too (esp. registry)!

-   XML factory classes are now determined by configuration parameters
    - waf.xml.xsl_transformer=[saxon (default)|jd.xslt|resin|xalan|xsltc]
    - waf.xml.dom_builder=[xerces (default) | resin]
    - waf.xml.sax_parser=[xerces (default) | resin] 

-   Package c.ad.packaging reorganized so it contains just installation
related code. Runtime configuration related code moved to c.ad.runtime.
Code is not part of the API.

-   log4j configuration file is still at the old location, but is not used
anymore! It will be moved to [appbase]/WEB-INF/conf/ in the future.
Developers, modify the file ~/webapps/WEB-INF//classes/log4j.properties 
in the meantime.

-   While working on the code some deprecated classes and method invocations 
replaced by supported API. If a class is no longer used by any module in
trunk, the class has been removed by appending "nolongerInUse" to the file 
name. If any of the contributed modules is still depending on deprecated code
it is easy to find and to follow the recommended replacement instructions. Do
not re-incorporate deprecated code! We have to clean up the code base!


Second part: Multilanguage categories
Added update script
Translation of some comments, added comments
version number bumped to reflect the major changes




git-svn-id: https://svn.libreccm.org/ccm/trunk@73 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2009-02-07 22:44:11 +00:00
parent 743ff9b5d4
commit 4ab614055a
164 changed files with 2624 additions and 1058 deletions

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-cms"
prettyName="Red Hat CCM Content Management System"
version="6.5.4"
version="6.5.5"
release="1"
webapp="ROOT">
<ccm:dependencies>

View File

@ -35,7 +35,8 @@ public abstract class AbstractItemResolver implements ItemResolver {
protected static final String TEMPLATE_CONTEXT_PREFIX = "tem_";
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#getItem(com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String)
* @see com.arsdigita.cms.dispatcher.ItemResolver#getItem(
* com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String)
*/
public abstract ContentItem getItem(
ContentSection section,
@ -43,12 +44,16 @@ public abstract class AbstractItemResolver implements ItemResolver {
String context);
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#getCurrentContext(com.arsdigita.bebop.PageState)
* @see com.arsdigita.cms.dispatcher.ItemResolver#getCurrentContext(
* com.arsdigita.bebop.PageState)
*/
public abstract String getCurrentContext(PageState state);
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, java.math.BigDecimal, java.lang.String, com.arsdigita.cms.ContentSection, java.lang.String)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(
* com.arsdigita.bebop.PageState, java.math.BigDecimal,
* java.lang.String, com.arsdigita.cms.ContentSection,
* java.lang.String)
*/
public abstract String generateItemURL(
PageState state,
@ -58,7 +63,12 @@ public abstract class AbstractItemResolver implements ItemResolver {
String context);
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, java.math.BigDecimal, java.lang.String, com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(
* com.arsdigita.bebop.PageState,
* java.math.BigDecimal,
* java.lang.String,
* com.arsdigita.cms.ContentSection,
* java.lang.String, java.lang.String)
*/
public abstract String generateItemURL(
PageState state,
@ -69,7 +79,11 @@ public abstract class AbstractItemResolver implements ItemResolver {
String templateContext);
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, com.arsdigita.cms.ContentItem, com.arsdigita.cms.ContentSection, java.lang.String)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(
* com.arsdigita.bebop.PageState,
* com.arsdigita.cms.ContentItem,
* com.arsdigita.cms.ContentSection,
* java.lang.String)
*/
public abstract String generateItemURL(
PageState state,
@ -78,7 +92,11 @@ public abstract class AbstractItemResolver implements ItemResolver {
String context);
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, com.arsdigita.cms.ContentItem, com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String)
* @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(
* com.arsdigita.bebop.PageState,
* com.arsdigita.cms.ContentItem,
* com.arsdigita.cms.ContentSection,
* java.lang.String, java.lang.String)
*/
public abstract String generateItemURL(
PageState state,
@ -88,9 +106,12 @@ public abstract class AbstractItemResolver implements ItemResolver {
String templateContext);
/* (non-Javadoc)
* @see com.arsdigita.cms.dispatcher.ItemResolver#getMasterPage(com.arsdigita.cms.ContentItem, javax.servlet.http.HttpServletRequest)
* @see com.arsdigita.cms.dispatcher.ItemResolver#getMasterPage(
* com.arsdigita.cms.ContentItem,
* javax.servlet.http.HttpServletRequest)
*/
public abstract CMSPage getMasterPage(ContentItem item, HttpServletRequest request) throws ServletException;
public abstract CMSPage getMasterPage(ContentItem item, HttpServletRequest request)
throws ServletException;
/**
* Finds the template context from the URL and returns it, if it is there.
@ -115,7 +136,8 @@ public abstract class AbstractItemResolver implements ItemResolver {
templateContext = tokenizer.nextToken();
}
if (templateContext != null && templateContext.startsWith(TEMPLATE_CONTEXT_PREFIX)) {
if (templateContext != null && templateContext.startsWith(
TEMPLATE_CONTEXT_PREFIX)) {
return templateContext.substring(TEMPLATE_CONTEXT_PREFIX.length());
} else {
return null;

View File

@ -105,7 +105,10 @@ import org.apache.log4j.Logger;
*/
public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
public static final String versionId = "$Id: CMSDispatcher.java 754 2005-09-02 13:26:17Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $";
public static final String versionId =
"$Id: CMSDispatcher.java 1795 2009-02-07 10:47:32Z pboy $" +
" by $Author: pboy $, " +
"$DateTime: 2004/08/17 23:15:09 $";
private static Logger s_log =
Logger.getLogger(CMSDispatcher.class);

View File

@ -44,13 +44,13 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
/**
* Resolves items to URLs and URLs to items with category-based URLs for multiple language
* variants.
* Resolves items to URLs and URLs to items with category-based URLs for
* multiple language variants.
*
* Created Mon Jan 20 14:30:03 2003.
*
* @author <a href="mailto:sseago@redhat.com">Scott Seago</a>
* @version $Id: CategoryItemResolverImpl.java 287 2005-02-22 00:29:02Z sskracic $
* @version $Id: CategoryItemResolverImpl.java 1795 2009-02-07 10:47:32Z pboy $
*/
public class CategoryItemResolverImpl extends MultilingualItemResolver
implements CategoryItemResolver, TemplateResolver {
@ -138,6 +138,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
* #getCurrentContext}.
* @return The content item, or null if no such item exists
*/
@Override
public ContentItem getItem(final ContentSection section,
String url,
final String context) {
@ -146,9 +147,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
" at URL '" + url + "' for context " + context);
}
Assert.assertNotNull(section, "ContentSection section");
Assert.assertNotNull(url, "String url");
Assert.assertNotNull(context, "String context");
Assert.exists(section, "ContentSection section");
Assert.exists(url, "String url");
Assert.exists(context, "String context");
url = stripTemplateFromURL(url);
if ( ContentItem.DRAFT.equals(context) ||
@ -158,7 +159,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
}
String categoryURL = url.substring(("/"+CATEGORIES_PREFIX).length());
Category root = section.getRootCategory();
Assert.assertNotNull (root);
Assert.exists(root);
String file = null;
@ -191,7 +192,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
cats = root.getChildrenByURL (path + "/" + file);
if (cats == null) {
// final element wasn't category. assume an item.
if (path == "") {
// Really object identity? Don't think so.
// if (path == "") {
if (path.equals("")) {
cats = new Category[1];
cats[0] = root;
} else {
@ -204,7 +207,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
return null;
}
Assert.assertTrue (cats.length >= 1);
Assert.isTrue (cats.length >= 1);
Category cat = cats[cats.length-1];
s_log.debug ("Category is " + cat.getDisplayName());
String lang = null;
@ -312,9 +315,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
"' in category '" + category + "'");
}
Assert.assertNotNull(itemId, "BigDecimal itemId");
Assert.assertNotNull(context, "Sring context");
Assert.assertNotNull(section, "ContentSection section");
Assert.exists(itemId, "BigDecimal itemId");
Assert.exists(context, "Sring context");
Assert.exists(section, "ContentSection section");
if (ContentItem.DRAFT.equals(context)) {
// No template context here.
@ -332,9 +335,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
.newInstance(new OID(ContentItem.BASE_DATA_OBJECT_TYPE,
itemId));
if (Assert.isAssertEnabled()) {
Assert.assertNotNull(item, "item");
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
if (Assert.isEnabled()) {
Assert.exists(item, "item");
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
"Generating " + ContentItem.LIVE + " " +
"URL; this item must be the live version");
}
@ -392,16 +395,16 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
context + " in category " + category);
}
Assert.assertNotNull(item, "ContentItem item");
Assert.assertNotNull(context, "String context");
Assert.exists(item, "ContentItem item");
Assert.exists(context, "String context");
if (section == null) {
section = item.getContentSection();
}
if (ContentItem.DRAFT.equals(context)) {
if (Assert.isAssertEnabled()) {
Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()),
if (Assert.isEnabled()) {
Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()),
"Generating " + ContentItem.DRAFT +
" url: item must be draft version");
}
@ -411,8 +414,8 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
} else if (CMSDispatcher.PREVIEW.equals(context)) {
return generatePreviewURL(section, item, templateContext, category);
} else if (ContentItem.LIVE.equals(context)) {
if (Assert.isAssertEnabled()) {
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
if (Assert.isEnabled()) {
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
"Generating " + ContentItem.LIVE +
" url: item must be live version");
}
@ -436,6 +439,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
* @return The URL of the item
* @see #getCurrentContext
*/
@Override
public String generateItemURL(final PageState state,
final BigDecimal itemId,
final String name,
@ -459,6 +463,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
* @return The URL of the item
* @see #getCurrentContext
*/
@Override
public String generateItemURL(final PageState state,
final BigDecimal itemId,
final String name,
@ -481,6 +486,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
* @return The URL of the item
* @see #getCurrentContext
*/
@Override
public String generateItemURL(final PageState state,
final ContentItem item,
final ContentSection section,
@ -502,6 +508,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
* @return The URL of the item
* @see #getCurrentContext
*/
@Override
public String generateItemURL(final PageState state,
final ContentItem item,
ContentSection section,
@ -638,8 +645,8 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
ContentItem item,
String templateContext,
Category category) {
Assert.assertNotNull(section, "ContentSection section");
Assert.assertNotNull(item, "ContentItem item");
Assert.exists(section, "ContentSection section");
Assert.exists(item, "ContentItem item");
Category urlCategory = getURLCategory(item,category);
// Use passed-in category, if item is in it, else use default
@ -771,6 +778,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
/**
* Returns the template associated with the item (if any)
*/
@Override
protected String getItemTemplate(ContentSection section,
ContentItem item,
HttpServletRequest request) {
@ -838,6 +846,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
return encodeAsString().equals(obj.encodeAsString());
}
@Override
public int hashCode() {
return encodeAsString().hashCode();
}

View File

@ -32,9 +32,12 @@ import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
/**
* ------- May be outdated. TemplateResolver has been reworked. ----------
* Resolves the JSP template to use for dispatching an
* item. This replaces TemplateResolver since the latter
* has a useless API.
* ------------------------------------------------------------------------
*
* <p>In general, the process for resolving a template involves two
* steps:</p>
*
@ -93,7 +96,7 @@ public class DefaultTemplateResolver extends AbstractTemplateResolver
template = getDefaultTemplate(section, item, request);
Assert.assertNotNull(template, "default template");
Assert.exists(template, "default template");
}
if (s_log.isInfoEnabled()) {
@ -174,7 +177,8 @@ public class DefaultTemplateResolver extends AbstractTemplateResolver
template = manager.getDefaultTemplate(section, type, context, mimeType);
} else {
if (s_log.isDebugEnabled()) {
s_log.debug("Item has no content type, not looking for a content type specific template");
s_log.debug("Item has no content type, not looking for a " +
"content type specific template");
}
}

View File

@ -48,12 +48,12 @@ import java.util.StringTokenizer;
* Created Mon Jan 20 14:30:03 2003.
*
* @author <a href="mailto:mhanisch@redhat.com">Michael Hanisch</a>
* @version $Id: MultilingualItemResolver.java 1160 2006-06-13 16:42:30Z apevec $
* @version $Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $
*/
public class MultilingualItemResolver extends AbstractItemResolver implements ItemResolver {
public static final String versionId =
"$Id: MultilingualItemResolver.java 1160 2006-06-13 16:42:30Z apevec $" +
"$Author: apevec $" +
"$Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $" +
"$Author: pboy $" +
"$DateTime: 2004/08/17 23:15:09 $";
private static final Logger s_log = Logger.getLogger
@ -98,9 +98,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
" at URL '" + url + "' for context " + context);
}
Assert.assertNotNull(section, "ContentSection section");
Assert.assertNotNull(url, "String url");
Assert.assertNotNull(context, "String context");
Assert.exists(section, "ContentSection section");
Assert.exists(url, "String url");
Assert.exists(context, "String context");
Folder rootFolder = section.getRootFolder();
url = stripTemplateFromURL(url);
@ -164,8 +164,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
// and return FIXME: Please hack this if there is
// more graceful solution. [aavetyan]
if (Assert.isAssertEnabled()) {
Assert.assertTrue
if (Assert.isEnabled()) {
Assert.isTrue
(url.indexOf(ITEM_ID) >= 0,
"url must contain parameter " + ITEM_ID);
}
@ -300,9 +300,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
context + "' with name '" + name + "'");
}
Assert.assertNotNull(itemId, "BigDecimal itemId");
Assert.assertNotNull(context, "Sring context");
Assert.assertNotNull(section, "ContentSection section");
Assert.exists(itemId, "BigDecimal itemId");
Assert.exists(context, "String context");
Assert.exists(section, "ContentSection section");
if (ContentItem.DRAFT.equals(context)) {
// No template context here.
@ -314,9 +314,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
} else if (ContentItem.LIVE.equals(context)) {
ContentItem item = new ContentItem(itemId);
if (Assert.isAssertEnabled()) {
Assert.assertNotNull(item, "item");
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
if (Assert.isEnabled()) {
Assert.exists(item, "item");
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
"Generating " + ContentItem.LIVE + " " +
"URL; this item must be the live version");
}
@ -370,16 +370,16 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
context);
}
Assert.assertNotNull(item, "ContentItem item");
Assert.assertNotNull(context, "String context");
Assert.exists(item, "ContentItem item");
Assert.exists(context, "String context");
if (section == null) {
section = item.getContentSection();
}
if (ContentItem.DRAFT.equals(context)) {
if (Assert.isAssertEnabled()) {
Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()),
if (Assert.isEnabled()) {
Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()),
"Generating " + ContentItem.DRAFT +
" url: item must be draft version");
}
@ -388,8 +388,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
} else if (CMSDispatcher.PREVIEW.equals(context)) {
return generatePreviewURL(section, item, templateContext);
} else if (ContentItem.LIVE.equals(context)) {
if (Assert.isAssertEnabled()) {
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
if (Assert.isEnabled()) {
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
"Generating " + ContentItem.LIVE +
" url: item must be live version");
}
@ -442,8 +442,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
" and section " + section);
}
if (Assert.isAssertEnabled()) {
Assert.assertTrue(section != null && itemId != null,
if (Assert.isEnabled()) {
Assert.isTrue(section != null && itemId != null,
"get draft url: neither secion nor item " +
"can be null");
}
@ -569,8 +569,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
protected String generatePreviewURL(ContentSection section,
ContentItem item,
String templateContext) {
Assert.assertNotNull(section, "ContentSection section");
Assert.assertNotNull(item, "ContentItem item");
Assert.exists(section, "ContentSection section");
Assert.exists(item, "ContentItem item");
final StringBuffer url = new StringBuffer(100);
url.append(section.getPath());
@ -644,8 +644,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
// XXX this is wrong: here we abort on not finding the
// parameter; below we return null.
if (Assert.isAssertEnabled()) {
Assert.assertTrue(pos >= 0,
if (Assert.isEnabled()) {
Assert.isTrue(pos >= 0,
"Draft URL must contain parameter " + ITEM_ID);
}
@ -720,7 +720,12 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
// will have deal with 'foo' folder.
String name = index > 0 ? url.substring(0, index) : "";
parentFolder = name != "" ? (Folder) parentFolder.getItem(URLEncoder.encode(name), true) : parentFolder;
parentFolder =
// really object identity? Don't think so
// name != "" ? (Folder) parentFolder.getItem(URLEncoder.encode(name), true)
// : parentFolder;
name.isEmpty() ? parentFolder
: (Folder) parentFolder.getItem(URLEncoder.encode(name), true);
url = index + 1 < len ? url.substring(index + 1) : "";
return getItemFromLiveURL(url, parentFolder);
@ -833,9 +838,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
lang = null; // no extension, so we cannot guess the language
}
if (Assert.isAssertEnabled()) {
Assert.assertNotNull(name, "String name");
Assert.assertTrue(lang == null || lang.length() == 2);
if (Assert.isEnabled()) {
Assert.exists(name, "String name");
Assert.exists(lang == null || lang.length() == 2);
}
if (s_log.isDebugEnabled()) {

View File

@ -22,17 +22,25 @@ init com.arsdigita.cms.publishToFile.Initializer {
// "url stub" }'.
// "Content type" is the object type of the content type.
// "Root directory" must be a path to a writable directory, relative
// to the file-system root. "Shared storage" must be _true_ if the root
// to the file-system root.
// (pboy): "Root directory here is relative to application base!
// "Shared storage" must be _true_ if the root
// directory is shared NFS storage, _false_ otherwise. "URL stub"
// must be the path component of the URL from which the live server
// will serve from this directory.
destination = {
{ "com.arsdigita.cms.ContentItem",
"data/p2fs",
"p2fs",
false,
"/p2fs" },
// (pboy): starting with webapps refers to the CCM_HOME env variable which
// points to the installation root of the servlet container. This is not
// used anymore, all specifications are relative to webapplication base.
// So the following may have to be changed to "packages/content-section/templates"
// if someone tries to use p2fs
{ "com.arsdigita.cms.Template",
"webapps/ROOT/packages/content-section/templates",
// "webapps/ROOT/packages/content-section/templates",
"packages/content-section/templates",
false,
"/templates" }
};

View File

@ -33,12 +33,13 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.persistence.metadata.MetadataRoot;
import com.arsdigita.persistence.metadata.ObjectType;
import com.arsdigita.runtime.CCM;
import com.arsdigita.runtime.CCMResourceManager;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.*;
// import java.io.File;
import java.util.List;
import java.util.Iterator;
@ -47,6 +48,9 @@ import java.util.Iterator;
* Initializes the publish-to-file service. The configuration is described in
* the {@link com.arsdigita.cms.publishToFile} page.
*
* (pboy) ToDo: Adjusting the initialisation to the new configuration method
* without enterprise.init file.
*
* @author Jeff Teeters (teeters@arsdigita.com)
* @version $Revision: #24 $ $Date: 2004/08/17 $
*/
@ -242,6 +246,7 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
}
String contentType = (String)entry.get(0);
// destRoot is here relative to webapp root!
String destRoot = (String) entry.get(1);
Boolean sharedRoot = (Boolean) entry.get(2);
String destURL = (String) entry.get(3);
@ -267,8 +272,11 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
"' must not end with a '/'");
}
destRoot = new File(System.getProperty("ccm.home"),
// Does destRoot really now turns into an absolute fully pathname?!
destRoot = new File(CCMResourceManager.getBaseDirectory().getPath(),
destRoot).getPath();
s_log.info("Destination Root is set to : " + destRoot);
if (sharedRoot == null) {
@ -299,10 +307,24 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
File file = dest.getFile();
if (!file.exists()) {
file.mkdirs();
s_log.info(file.getPath() + " created");
}
boolean writable = false;
FileWriter fl;
File fname = new File(file.getPath(),"placeholder.txt");
s_log.info("Try to create : " + destRoot);
try {
writable = file.canWrite() && file.isDirectory();
try {
fl = new FileWriter(fname.getPath());
fl.write("Location for the p2fs module to store static content. \n");
fl.close();
} catch ( IOException e ) {
// Will be reported as an initalization error
s_log.warn("Fehler beim Erstellen der Datei " + fname.getPath());
}
} catch ( SecurityException ex ) {
// Will be reported as an initalization error
}
@ -310,7 +332,7 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
// HACK: Let's see if we can write to the config directory. If we can,
// then we're running as ccmadmin inside of ccm load, and there is no
// need to thrown an exception.
File conf = CCM.getConfigDirectory();
File conf = CCMResourceManager.getConfigDirectory();
if (conf.isDirectory() && conf.canWrite()) {
// we're ok
} else {
@ -319,7 +341,8 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
}
}
if (Template.BASE_DATA_OBJECT_TYPE.equals(contentType) || !ContentSection.getConfig().getDisableItemPfs()) {
if (Template.BASE_DATA_OBJECT_TYPE.equals(contentType) ||
!ContentSection.getConfig().getDisableItemPfs()) {
PublishToFile.addDestination(contentType,
dest);
}

View File

@ -72,6 +72,9 @@ public class PublishToFile implements PublishToFileListener {
private final PublishedHTMLProvider m_provider;
/**
* Default Constructor
*/
public PublishToFile() {
m_provider = new HttpHTMLProvider(s_timeout);
}
@ -357,8 +360,10 @@ public class PublishToFile implements PublishToFileListener {
}
/**
* Returns an extension given a content type.if the content-type is null assume "html".
* @param contentType Content-Type returned from the request, e.g. text/html;charset=ISO-8859-1
* Returns an extension given a content type. If the content-type is null
* assume "html".
* @param contentType Content-Type returned from the request,
* e.g. text/html;charset=ISO-8859-1
**/
private static String getFileExtension(String contentType) {
if ( contentType == null || contentType == "" )
@ -371,11 +376,13 @@ public class PublishToFile implements PublishToFileListener {
MimeType type = MimeType.loadMimeType(contentType);
if (type == null) {
s_log.error("Unknown content type in published item: " + contentType + " assuming extension 'html'");
s_log.error("Unknown content type in published item: " +
contentType + " assuming extension 'html'");
return ".html";
} else {
if (s_log.isDebugEnabled()) {
s_log.debug("File extension for " + contentType + " is " + type.getFileExtension());
s_log.debug("File extension for " + contentType + " is " +
type.getFileExtension());
}
return "." + type.getFileExtension();
}
@ -383,7 +390,8 @@ public class PublishToFile implements PublishToFileListener {
/***
* Publish the page that is at url source to the file system and also any streamed assets that it references.
* Publish the page that is at url source to the file system and also any
* streamed assets that it references.
* @param item ContentItem being published.
* @param where Location Folder, where item will be published
***/
@ -394,7 +402,8 @@ public class PublishToFile implements PublishToFileListener {
// Read 'public' Template in HTML format and write to FS
// It can be either 'deault' or specified template
String publicUrl = url + '?' + ContentSectionServlet.MEDIA_TYPE + '=' + TemplateManager.PUBLIC_CONTEXT;
String publicUrl = url + '?' + ContentSectionServlet.MEDIA_TYPE + '=' +
TemplateManager.PUBLIC_CONTEXT;
if ( !publishPageAtDocRoot(readHTML(publicUrl), where, item, null, host) )
return false;
@ -470,7 +479,8 @@ public class PublishToFile implements PublishToFileListener {
final String fileExt = getFileExtension(rf.contentType);
final String html = rf.body;
if (s_log.isDebugEnabled()) {
s_log.debug("content item before getting bundle is " + item.getName() + " with id " + item.getID());
s_log.debug("content item before getting bundle is " + item.getName() +
" with id " + item.getID());
}
@ -526,7 +536,8 @@ public class PublishToFile implements PublishToFileListener {
scanner.transform(out);
out.close();
} catch ( IOException ex ) {
throw new PublishToFileException("Unable to write item " + item + " to filesystem.", ex);
throw new PublishToFileException("Unable to write item " + item +
" to filesystem.", ex);
}
if (s_log.isDebugEnabled()) {

View File

@ -49,7 +49,7 @@ import java.io.IOException;
*/
public abstract class SortableList extends List {
public static final String versionId = "$Id: SortableList.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $";
public static final String versionId = "$Id: SortableList.java 1618 2007-09-13 12:14:51Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/17 23:15:09 $";
private static final org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.getLogger(SortableList.class);

View File

@ -63,12 +63,12 @@ import org.apache.log4j.Logger;
* A split pane for the Category Administration UI.
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: CategoryAdminPane.java 287 2005-02-22 00:29:02Z sskracic $
* @version $Id: CategoryAdminPane.java 1795 2009-02-07 10:47:32Z pboy $
*/
public final class CategoryAdminPane extends BaseAdminPane {
public static final String versionId =
"$Id: CategoryAdminPane.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$Id: CategoryAdminPane.java 1795 2009-02-07 10:47:32Z pboy $" +
"$Author: pboy $" +
"$DateTime: 2004/08/17 23:15:09 $";
public static final String CONTEXT_SELECTED="sel_context";
@ -91,6 +91,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
m_contextModel = new UseContextSelectionModel(new StringParameter(CONTEXT_SELECTED));
/* Left column */
/* Use context section */
List list = new List(new CategoryUseContextModelBuilder());
@ -102,6 +103,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
m_categoryTree.addChangeListener(new SelectionListener());
m_model = m_categoryTree.getSelectionModel();
setSelectionModel(m_model);
setSelector(m_categoryTree);
@ -111,8 +113,6 @@ public final class CategoryAdminPane extends BaseAdminPane {
ActionGroup contextGroup = new ActionGroup();
contextSection.setBody(contextGroup);
contextGroup.setSubject(list);
/* Add use context form to pane */
ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context")));
Form addContextForm = new AddUseContextForm(m_contextModel);
getBody().add(addContextForm);
@ -135,10 +135,6 @@ public final class CategoryAdminPane extends BaseAdminPane {
m_parent = new ParentRequestLocal();
m_category = new SelectionRequestLocal();
/* Right column */
/* Context section aka category details */
/* Action links */
setAdd(gz("cms.ui.category.add"),
new CategoryAddForm(m_category, m_model));

View File

@ -74,13 +74,12 @@ public final class CategoryCollectionListModel implements ListModel {
}
/**
* Liest den Namen der Kategorie aus. Angepaßt, damit hier immer
* der Wert aus Category gelesen wird und nicht die lokalisierte
* Version. Ist hier sinnvoll, da es Teil der Adminoberfläche für
* Kategorien ist. Eine lokalisierte Anzeige würde hier nur zu
* Verwirrung führen.
* Reads the name of the category.
*
* Quasimodo
* Quasimodo:
* Modified to ensure that the value is read from Category (and not the
* localized version). This is necessary because we are in the admin GUI,
* a localized version would be confusing.
*/
public Object getElement() {
return getCategory().getName("");

View File

@ -28,6 +28,8 @@ import com.arsdigita.dispatcher.AccessDeniedException;
import org.apache.log4j.Logger;
/**
* XXX
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: CategoryEditForm.java 287 2005-02-22 00:29:02Z sskracic $
*/
@ -61,6 +63,10 @@ final class CategoryEditForm extends BaseCategoryForm {
final PageState state = e.getPageState();
final Category category = m_category.getCategory(state);
// Quasimodo:
// Modified to ensure that the value is read from Category (and not the
// localized version). This is necessary because we are in the admin GUI,
// a localized version would be confusing.
m_name.setValue(state, category.getName(""));
m_description.setValue(state, category.getDescription(""));
m_url.setValue(state, category.getURL(""));

View File

@ -71,6 +71,7 @@ import org.apache.log4j.Logger;
* Edits a single category.
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
* @version $Id: CategoryItemPane.java 1329 2006-09-27 11:47:05Z sskracic $
*/
class CategoryItemPane extends BaseItemPane {
@ -101,7 +102,8 @@ class CategoryItemPane extends BaseItemPane {
add(m_detailPane);
setDefault(m_detailPane);
final ActionLink orderItemsLink = new ActionLink(new Label(gz("cms.ui.category.categorized_objects"))) {
final ActionLink orderItemsLink = new ActionLink(new Label(
gz("cms.ui.category.categorized_objects"))) {
public boolean isVisible(PageState state) {
// update for live items only
if (!super.isVisible(state)) {
@ -123,23 +125,32 @@ class CategoryItemPane extends BaseItemPane {
add(orderItemsForm2);
// Change index item
final ActionLink indexLink = new ActionLink(new Label(gz("cms.ui.category.change_index_item")));
final ActionLink indexLink = new ActionLink(new Label(gz(
"cms.ui.category.change_index_item")));
final Form indexForm = new IndexItemSelectionForm(m_category);
add(indexForm);
ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz("cms.ui.category.view_index_item")),"");
EditItemLink editIndexLink = new EditItemLink(new Label(gz("cms.ui.category.edit_index_item")),"");
ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz(
"cms.ui.category.view_index_item")),"");
EditItemLink editIndexLink = new EditItemLink(new Label(gz(
"cms.ui.category.edit_index_item")),"");
// Summary
m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink, viewIndexLink, editIndexLink, orderItemsLink));
m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink,
viewIndexLink, editIndexLink, orderItemsLink));
// Quasimodo: BEGIN
// Localizations
ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz("cms.ui.category.localization.add"))) {
ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz(
"cms.ui.category.localization.add"))) {
public boolean isVisible(PageState state) {
// Only show addLanguage button, if there are langauges to add
int countSupportedLanguages = (new CategorizationConfig()).getSupportedLanguages().countTokens();
long countLanguages = m_category.getCategory(state).getCategoryLocalizationCollection().size();
int countSupportedLanguages = (
new CategorizationConfig()).getSupportedLanguages()
.countTokens();
long countLanguages =
m_category.getCategory(state)
.getCategoryLocalizationCollection().size();
if(countLanguages < countSupportedLanguages) {
return true;
@ -149,7 +160,8 @@ class CategoryItemPane extends BaseItemPane {
}
};
CategoryLocalizationAddForm addCategoryLocalizationForm = new CategoryLocalizationAddForm(m_category);
CategoryLocalizationAddForm addCategoryLocalizationForm =
new CategoryLocalizationAddForm(m_category);
m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink));
add(addCategoryLocalizationForm);
connect(addCategoryLocalizationLink, addCategoryLocalizationForm);
@ -225,8 +237,8 @@ class CategoryItemPane extends BaseItemPane {
}
/*
* This alternative constructor sets two additional links, allowing the user to view and
* edit the content index item.
* This alternative constructor sets two additional links, allowing
* the user to view and edit the content index item.
*/
SummarySection(final ActionLink editLink,
final ActionLink deleteLink,
@ -373,14 +385,16 @@ class CategoryItemPane extends BaseItemPane {
}
};
final ActionLink restoreDefault = new ActionLink(new Label(gz("cms.ui.restore_default_permissions"))) {
final ActionLink restoreDefault = new ActionLink(new Label(gz(
"cms.ui.restore_default_permissions"))) {
public boolean isVisible(PageState ps) {
Category cat = m_category.getCategory(ps);
return PermissionService.getContext(cat) == null;
}
};
final ActionLink useCustom = new ActionLink(new Label(gz("cms.ui.use_custom_permissions"))) {
final ActionLink useCustom = new ActionLink(new Label(gz(
"cms.ui.use_custom_permissions"))) {
public boolean isVisible(PageState ps) {
Category cat = m_category.getCategory(ps);
return PermissionService.getContext(cat) != null;
@ -466,11 +480,13 @@ class CategoryItemPane extends BaseItemPane {
super(c,s);
}
// Build the preview link. This uses a standard redirect link to find the content.
// The prepareURL method is called by the printwriter
// Build the preview link. This uses a standard redirect link to find
// the content. The prepareURL method is called by the printwriter
protected String prepareURL(final PageState state, String location) {
ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state).getDirectIndexObject())).getPrimaryInstance();
ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state)
.getDirectIndexObject()))
.getPrimaryInstance();
if(indexItem==null) {
return "";
} else {
@ -497,11 +513,17 @@ class CategoryItemPane extends BaseItemPane {
super(c,s);
}
// Build the preview link. This is based on code in the ContentSoonExpiredPane class.
// The prepareURL method of the parent is overwritten. This method is called by the printwriter
/**
* Build the preview link. This is based on code in the
* ContentSoonExpiredPane class. The prepareURL method of the parent
* is overwritten. This method is called by the printwriter
*/
@Override
protected String prepareURL(final PageState state, String location) {
boolean canEdit = false;
ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state).getDirectIndexObject())).getPrimaryInstance();
ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state)
.getDirectIndexObject()))
.getPrimaryInstance();
if(indexItem==null) {
return "";
}
@ -509,12 +531,18 @@ class CategoryItemPane extends BaseItemPane {
return "";
} else {
BigDecimal draftID = indexItem.getDraftVersion().getID();
return "item.jsp?item_id=" + draftID + "&set_tab=" + ContentItemPage.AUTHORING_TAB;
return "item.jsp?item_id=" + draftID + "&set_tab=" +
ContentItemPage.AUTHORING_TAB;
}
}
// We only show this link when an index item exists for this category and
// the user is allowed to edit this item.
/**
* We only show this link when an index item exists for this category
* and the user is allowed to edit this item.
* @param state
* @return
*/
@Override
public boolean isVisible(PageState state) {
if (!super.isVisible(state)) {
return false;
@ -527,15 +555,25 @@ class CategoryItemPane extends BaseItemPane {
}
}
// This method checks whether a usern is allowed to edit a particular item
/**
* This method checks whether a usern is allowed to edit a
* particular item.
*
* @param item
* @param state
* @return
*/
private boolean isItemEditable(ContentItem item, PageState state) {
BigDecimal id = item.getID();
User user = Web.getContext().getUser();
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(), Integer.parseInt(id.toString())));
Iterator permissions = PermissionService.getImpliedPrivileges(ci.getOID(), user.getOID());
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(),
Integer.parseInt(id.toString())));
Iterator permissions = PermissionService.getImpliedPrivileges(
ci.getOID(), user.getOID());
while (permissions.hasNext()) {
PrivilegeDescriptor permission = (PrivilegeDescriptor)permissions.next();
if (permission.equals(PrivilegeDescriptor.ADMIN) || permission.equals(PrivilegeDescriptor.EDIT)) {
if (permission.equals(PrivilegeDescriptor.ADMIN) ||
permission.equals(PrivilegeDescriptor.EDIT)) {
return true;
}
}

View File

@ -1,12 +1,21 @@
/*
* CategoryLocalizationAddForm.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 18. April 2008, 12:03
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.arsdigita.cms.ui.category;
@ -27,11 +36,12 @@ import java.util.StringTokenizer;
import org.apache.log4j.Logger;
/**
* Erzeugt ein Formular zum Anlegen einer neuen Lokalisierungen zu der aktuellen Kategorie.
* Diese Klasse ist Teil der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare
* um die Formulare für die Bearbeitung der neuen, mehrsprachigen Kategorien.
* Generates a form for creating new localisations for the given category.
*
* @author quasi
* This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories.
*
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
*/
public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
@ -46,7 +56,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
/** Creates a new instance of CategoryLocalizationAddForm */
public CategoryLocalizationAddForm(final CategoryRequestLocal category) {
super("AddCategoryLocalization", gz("cms.ui.category.localization.add"), category);
super("AddCategoryLocalization",
gz("cms.ui.category.localization.add"), category);
addInitListener(new InitListener());
addProcessListener(new ProcessListener());
@ -66,9 +77,11 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
final Category category = m_category.getCategory(state);
// Select one entry
m_locale.addOption(new Option("", new Label((String) GlobalizationUtil.globalize("cms.ui.select_one").localize())), state);
m_locale.addOption(new Option("",
new Label((String) GlobalizationUtil.globalize(
"cms.ui.select_one").localize())), state);
// Für alle Sprachen, die unterstützt werden (registry-Eintrag)
// all supported languages (by registry entry)
CategorizationConfig catConfig = new CategorizationConfig();
StringTokenizer strTok = catConfig.getSupportedLanguages();
@ -76,9 +89,11 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
String code = strTok.nextToken();
// Wenn die Sprache bereits existiert, dann entferne sie aus der Auswahlliste
if(!category.getCategoryLocalizationCollection().localizationExists(code)) {
m_locale.addOption(new Option(code, new Locale(code).getDisplayLanguage()), state);
// If lanuage exists, remove it from the selection list
if(!category.getCategoryLocalizationCollection().
localizationExists(code)) {
m_locale.addOption(new Option(code,
new Locale(code).getDisplayLanguage()), state);
}
}
}
@ -103,7 +118,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
//Assert.assertNotNull(parent, "Category parent");
if (s_log.isDebugEnabled()) {
s_log.debug("Adding localization for locale " + locale + " to category " + category);
s_log.debug("Adding localization for locale " + locale +
" to category " + category);
}
if (category.canEdit()) {

View File

@ -1,12 +1,21 @@
/*
* CategoryLocalizationEditForm.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 18. April 2008, 12:03
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.FormProcessException;
@ -22,11 +31,12 @@ import java.util.Locale;
import org.apache.log4j.Logger;
/**
* Erzeugt ein Formular zum Bearbeiten einer vorhandenen Lokalisierungen zu der aktuellen Kategorie.
* Diese Klasse ist Teil der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare
* um die Formulare für die Bearbeitung der neuen, mehrsprachigen Kategorien.
* Generates a form for editing an existing localisation for the given category.
*
* @author quasi
* This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories.
*
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
*/
public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
@ -46,7 +56,8 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
public CategoryLocalizationEditForm(final CategoryRequestLocal category,
final String locale) {
super("EditCategoryLocalization", gz("cms.ui.category.localization.edit"), category);
super("EditCategoryLocalization", gz(
"cms.ui.category.localization.edit"), category);
// Speichere Locale ab
m_categoryLocalizationLocale = locale;
@ -56,6 +67,9 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
}
/**
* please add: purpose of this class
*/
private class InitListener implements FormInitListener {
public final void init(final FormSectionEvent e)
throws FormProcessException {
@ -63,15 +77,18 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
final PageState state = e.getPageState();
final Category category = m_category.getCategory(state);
// Verstecke Locale-Widget und sperre es (read-only)
m_locale.addOption(new Option(m_categoryLocalizationLocale, new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state);
// Hide Locale-Widget and lock it (read-only)
m_locale.addOption(new Option(m_categoryLocalizationLocale,
new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state);
// m_locale.setValue(state, m_categoryLocalizationLocale);
// m_locale.setVisible(state, false);
m_locale.lock();
m_name.setValue(state, category.getName((String) m_locale.getValue(state)));
m_description.setValue(state, category.getDescription((String) m_locale.getValue(state)));
m_description.setValue(state, category.getDescription(
(String) m_locale.getValue(state)));
m_url.setValue(state, category.getURL((String) m_locale.getValue(state)));
if (category.isEnabled((String) m_locale.getValue(state))) {
m_isEnabled.setValue(state, "yes");
} else {
@ -80,6 +97,9 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
}
}
/**
* ##todo: document purpose of this
*/
private class ProcessListener implements FormProcessListener {
public final void process(final FormSectionEvent e)
throws FormProcessException {
@ -88,14 +108,20 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
final Category category = m_category.getCategory(state);
if (s_log.isDebugEnabled()) {
s_log.debug("Editing localization for locale " + m_locale + " for category " + category);
s_log.debug("Editing localization for locale " + m_locale +
" for category " + category);
}
if (category.canEdit()) {
category.setName((String) m_name.getValue(state), (String) m_locale.getValue(state));
category.setDescription((String) m_description.getValue(state), (String) m_locale.getValue(state));
category.setURL((String) m_url.getValue(state), (String) m_locale.getValue(state));
category.setEnabled("yes".equals((String) m_isEnabled.getValue(state)), (String) m_locale.getValue(state));
category.setName((String) m_name.getValue(state),
(String) m_locale.getValue(state));
category.setDescription((String) m_description.getValue(state),
(String) m_locale.getValue(state));
category.setURL((String) m_url.getValue(state),
(String) m_locale.getValue(state));
category.setEnabled("yes".equals(
(String) m_isEnabled.getValue(state)),
(String) m_locale.getValue(state));
category.save();
} else {
throw new AccessDeniedException();

View File

@ -1,12 +1,21 @@
/*
* CategoryLocalizationForm.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 18. April 2008, 12:04
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.FormProcessException;
@ -34,11 +43,12 @@ import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.xml.Element;
/**
* Basisklasse für CategoryLocalizationAddForm und CategoryLocalizationEditForm.
* Diese Klasse ist Teil der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare
* um die Formulare für die Bearbeitung der neuen, mehrsprachigen Kategorien.
* Base class for CategoryLocalizationAddForm and CategoryLocalizationEditForm.
*
* @author quasi
* This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories.
*
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
*/
public class CategoryLocalizationForm extends BaseForm {
@ -48,7 +58,9 @@ public class CategoryLocalizationForm extends BaseForm {
final TextArea m_description;
final TextField m_url;
final RadioGroup m_isEnabled;
private Label m_script = new Label("<script language=\"javascript\" src=\"/javascript/manipulate-input.js\"></script>", false);
private Label m_script = new Label(
"<script language=\"javascript\" src=\"/javascript/manipulate-input.js\">"+
"</script>", false);
private final static String LOCALE = "locale";
private final static String NAME = "name";
@ -56,7 +68,10 @@ public class CategoryLocalizationForm extends BaseForm {
private final static String URL = "url";
private final static String IS_ENABLED = "isEnabled";
/** Creates a new instance of CategoryLocalizationForm */
/**
* Creates a new instance of CategoryLocalizationForm.
*
*/
public CategoryLocalizationForm(final String key,
final GlobalizedMessage heading,
final CategoryRequestLocal category) {
@ -65,7 +80,7 @@ public class CategoryLocalizationForm extends BaseForm {
m_category = category;
// Parameter-Model für den SingleSelect
// Parameter-Model for SingleSelect
ParameterModel localeParam = new StringParameter(LOCALE);
localeParam.addParameterListener(new StringInRangeValidationListener(0, 2));
@ -145,8 +160,12 @@ public class CategoryLocalizationForm extends BaseForm {
super.generateXML(ps, parent);
}
// Muß erweitert werden um folgende Funktion: Die Namen müssen eindeutig sein in der
// gewählten Sprache
/**
* Purpose:
*
* XXXToDo: Should be extended with the function:
* Names have to be unambiguous in the selected language
*/
class NameUniqueListener implements ParameterListener {
private final CategoryRequestLocal m_category;
private final Widget m_widget;
@ -165,7 +184,14 @@ public class CategoryLocalizationForm extends BaseForm {
}
// XXX Muß noch angepaßt werden
/**
* Purpose:
*
* XXX provisional, has to be adapted
*
* @param e
* @throws com.arsdigita.bebop.FormProcessException
*/
public final void validate(final ParameterEvent e)
throws FormProcessException {
final PageState state = e.getPageState();

View File

@ -1,12 +1,21 @@
/*
* CategortyLocalizationTable.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 18. April 2008, 12:03
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.Component;
@ -33,11 +42,12 @@ import java.math.BigDecimal;
import java.util.Locale;
/**
* Listet alle vorhandenen Lokalisierungen zu der aktuellen Kategorie auf. Diese Klasse ist Teil
* der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare um die Formulare für die
* Bearbeitung der neuen, mehrsprachigen Kategorien.
* Lists all existing localizations for a selected category.
*
* @author quasi
* This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories.
*
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
*/
public class CategoryLocalizationTable extends Table implements TableActionListener {
@ -58,17 +68,23 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
m_category = category;
m_model = model;
// Falls die Tabelle leer ist
setEmptyView(new Label(GlobalizationUtil.globalize("cms.ui.category.localization.none")));
// if table is empty:
setEmptyView(new Label(GlobalizationUtil.globalize(
"cms.ui.category.localization.none")));
TableColumnModel tab_model = getColumnModel();
// Spalten definieren
// XXX Globalisieren
tab_model.add(new TableColumn(0, GlobalizationUtil.globalize("cms.ui.category.localization.locale").localize(), TABLE_COL_LANG));
tab_model.add(new TableColumn(1, GlobalizationUtil.globalize("cms.ui.category.localization.name").localize()));
tab_model.add(new TableColumn(2, GlobalizationUtil.globalize("cms.ui.category.localization.description").localize()));
tab_model.add(new TableColumn(3, GlobalizationUtil.globalize("cms.ui.category.localization.url").localize()));
tab_model.add(new TableColumn(4, GlobalizationUtil.globalize("cms.ui.category.localization.action").localize(), TABLE_COL_DEL));
// define columns
// XXX globalize
tab_model.add(new TableColumn(0, GlobalizationUtil.globalize(
"cms.ui.category.localization.locale").localize(), TABLE_COL_LANG));
tab_model.add(new TableColumn(1, GlobalizationUtil.globalize(
"cms.ui.category.localization.name").localize()));
tab_model.add(new TableColumn(2, GlobalizationUtil.globalize(
"cms.ui.category.localization.description").localize()));
tab_model.add(new TableColumn(3, GlobalizationUtil.globalize(
"cms.ui.category.localization.url").localize()));
tab_model.add(new TableColumn(4, GlobalizationUtil.globalize(
"cms.ui.category.localization.action").localize(), TABLE_COL_DEL));
setModelBuilder(new CategoryLocalizationTableModelBuilder());
@ -79,7 +95,12 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
}
private class CategoryLocalizationTableModelBuilder extends LockableImpl implements TableModelBuilder {
/**
* XXXX
*
*/
private class CategoryLocalizationTableModelBuilder extends LockableImpl
implements TableModelBuilder {
public TableModel makeModel(Table table, PageState state) {
final Category category = m_category.getCategory(state);
@ -92,6 +113,10 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
}
}
/**
* XXX
*
*/
private class CategoryLocalizationTableModel implements TableModel {
final private int MAX_DESC_LENGTH = 25;
@ -110,8 +135,10 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
}
/**
* check collection for the existence of another row.If it has fetch the
* value of current CategoryLocalization object into m_categoryLocalization class variable.
* Check collection for the existence of another row.
*
* If exists, fetch the value of current CategoryLocalization object
* into m_categoryLocalization class variable.
*/
public boolean nextRow() {
@ -139,7 +166,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
return m_categoryLocalization.getName();
case 2:
String desc = m_categoryLocalization.getDescription();
if(desc != null && desc.length() > MAX_DESC_LENGTH) desc = desc.substring(MAX_DESC_LENGTH - 3).concat("...");
if(desc != null && desc.length() > MAX_DESC_LENGTH)
desc = desc.substring(MAX_DESC_LENGTH - 3).concat("...");
return desc;
case 3:
return m_categoryLocalization.getURL();
@ -172,7 +200,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
int row, int column) {
SecurityManager sm = Utilities.getSecurityManager(state);
// CategoryLocalization cl = (CategoryLocalization) m_clSel.getSelectedObject(state);
// CategoryLocalization cl =
// (CategoryLocalization) m_clSel.getSelectedObject(state);
// boolean canEdit = sm.canAccess(state.getRequest(),
// SecurityManager.DELETE_ITEM,
@ -198,7 +227,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
int row, int column) {
// SecurityManager sm = Utilities.getSecurityManager(state);
// CategoryLocalization categoryLocalization = new CategoryLocalization(new BigDecimal(evt.getRowKey().toString()));
// CategoryLocalization categoryLocalization =
// new CategoryLocalization(new BigDecimal(evt.getRowKey().toString()));
// boolean canDelete = sm.canAccess(state.getRequest(),
// SecurityManager.DELETE_ITEM,
@ -206,7 +236,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
// if (canDelete) {
if (true) {
ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) GlobalizationUtil.globalize("cms.ui.category.localization.confirm_delete").localize());
link.setConfirmation((String) GlobalizationUtil.globalize(
"cms.ui.category.localization.confirm_delete").localize());
// link.setConfirmation("Delete this localization?");
return link;
} else {
@ -225,7 +256,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
PageState state = evt.getPageState();
// Get selected CategoryLocalization
CategoryLocalization categoryLocalization = new CategoryLocalization(new BigDecimal(evt.getRowKey().toString()));
CategoryLocalization categoryLocalization =
new CategoryLocalization(new BigDecimal(evt.getRowKey().toString()));
// Get Category
Category category = m_category.getCategory(state);

View File

@ -85,12 +85,12 @@ import com.arsdigita.workflow.simple.WorkflowTemplate;
* @author Michael Pih
* @author Xixi D'moon &lt;xdmoon@redhat.com&gt;
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: ItemLifecycleSelectForm.java 1563 2007-04-18 15:58:17Z apevec $
* @version $Id: ItemLifecycleSelectForm.java 1643 2007-09-17 14:19:06Z chrisg23 $
*/
class ItemLifecycleSelectForm extends BaseForm {
public static final String versionId =
"$Id: ItemLifecycleSelectForm.java 1563 2007-04-18 15:58:17Z apevec $" +
"$Author: apevec $" +
"$Id: ItemLifecycleSelectForm.java 1643 2007-09-17 14:19:06Z chrisg23 $" +
"$Author: chrisg23 $" +
"$DateTime: $";
private static final Logger s_log = Logger.getLogger

View File

@ -73,7 +73,7 @@ import java.util.Set;
**/
public class CMSTask extends UserTask {
public static final String versionId = "$Id: CMSTask.java 1583 2007-05-25 15:32:13Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/17 23:15:09 $";
public static final String versionId = "$Id: CMSTask.java 1637 2007-09-17 10:14:27Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/17 23:15:09 $";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.workflow.CMSTask";

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-core"
prettyName="Core"
version="6.5.5"
version="6.5.6"
release="1"
webapp="ROOT"
buildHooks="build-hooks.xml">

View File

@ -23,7 +23,7 @@ import com.arsdigita.kernel.*;
object type Category extends ACSObject {
// Hier werden die Default-Werte gespeichert ???
// Default values are stored here ???
String[0..1] description = cat_categories.description VARCHAR(4000);
String[1..1] name = cat_categories.name VARCHAR(200);
String[0..1] url = cat_categories.url VARCHAR(200);

View File

@ -15,7 +15,7 @@
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id: oracle-se-create.sql 725 2005-08-23 16:56:33Z sskracic $
-- $Id: oracle-se-create.sql 1704 2008-06-08 14:45:43Z pboy $
-- $DateTime: 2004/08/16 18:10:38 $
@@ oracle-se/function-currentDate.sql

View File

@ -15,7 +15,7 @@
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id: table-messages.sql 287 2005-02-22 00:29:02Z sskracic $
-- $Id: table-messages.sql 1704 2008-06-08 14:45:43Z pboy $
-- $DateTime: 2004/08/16 18:10:38 $
create table messages (

View File

@ -15,7 +15,7 @@
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id: postgres-create.sql 725 2005-08-23 16:56:33Z sskracic $
-- $Id: postgres-create.sql 1704 2008-06-08 14:45:43Z pboy $
-- $DateTime: 2004/08/16 18:10:38 $
begin;

View File

@ -1,5 +1,5 @@
--
-- Copyright (C) 2008 pb@zes.uni-bremen.de All Rights Reserved.
-- Copyright (C) 2008 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

View File

@ -1,4 +1,9 @@
<!-- Specification file for additional checks during the
installation process by the packaging tools
(see com/arsdigita/packaging/Check.java for details) -->
<checklist>
<!-- type "schema" will be run before the schema for
a package is loaded. -->
<checks type="schema">
<check class="com.arsdigita.core.LibCheck"/>
</checks>

View File

@ -3,9 +3,9 @@
<script sql="ccm-core/upgrade/::database::-6.0.0-6.0.1.sql"/>
</version>
<version from="6.0.1" to="6.1.0">
<script class="com.arsdigita.core.TroikaRickshawUpgrade"/>
<script class="com.arsdigita.core.upgrade.TroikaRickshawUpgrade"/>
<script sql="ccm-core/upgrade/::database::-6.0.1-6.1.0.sql"/>
<script class="com.arsdigita.core.TroikaRickshawUpgrade2"/>
<script class="com.arsdigita.core.upgrade.TroikaRickshawUpgrade2"/>
</version>
<version from="6.1.0" to="6.1.1">
<script sql="ccm-core/upgrade/::database::-6.1.0-6.1.1.sql"/>

View File

@ -40,7 +40,10 @@ public final class Bebop {
public static final BebopConfig getConfig() {
if (s_config == null) {
s_config = new BebopConfig();
s_config.load("ccm-core/bebop.properties");
// deprecated, use load() instead, load the default config db,
// which is ccm-core /bebop.properties for BebogConfig by definition
// s_config.load("ccm-core/bebop.properties");
s_config.load();
}
return s_config;
}

View File

@ -142,7 +142,7 @@ import java.util.Map;
*/
public class PropertyEditor extends SimpleContainer {
public static final String versionId = "$Id: PropertyEditor.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId = "$Id: PropertyEditor.java 1638 2007-09-17 11:48:34Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/16 18:10:38 $";
private SequentialMap m_forms;
private SequentialMap m_labels;

View File

@ -85,12 +85,12 @@ import javax.servlet.ServletException;
* is identified by an integer.
*
* @author David Lutterkort
* @version $Id: Table.java 287 2005-02-22 00:29:02Z sskracic $
* @version $Id: Table.java 1638 2007-09-17 11:48:34Z chrisg23 $
* @see TableModel
* @see TableColumnModel */
public class Table extends BlockStylable implements BebopConstants {
public static final String versionId = "$Id: Table.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId = "$Id: Table.java 1638 2007-09-17 11:48:34Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/16 18:10:38 $";
// Names for HTML Attributes
private static final String WIDTH = "width";

View File

@ -18,7 +18,7 @@
*/
package com.arsdigita.bebop.demo;
import com.arsdigita.bebop.BebopMapDispatcher;
import com.arsdigita.bebop.page.BebopMapDispatcher;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Page;
import com.arsdigita.util.UncheckedWrapperException;
@ -36,7 +36,10 @@ import org.apache.log4j.Logger;
* */
public class AutoDispatcher extends BebopMapDispatcher {
public static final String versionId = "$Id: AutoDispatcher.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId =
"$Id: AutoDispatcher.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log =
Logger.getLogger(AutoDispatcher.class);

View File

@ -18,7 +18,7 @@
*/
package com.arsdigita.bebop.demo;
import com.arsdigita.bebop.BebopMapDispatcher;
import com.arsdigita.bebop.page.BebopMapDispatcher;
import com.arsdigita.bebop.Page;
import java.util.HashMap;
@ -28,7 +28,10 @@ import java.util.HashMap;
*/
public class MinimalDispatcher extends BebopMapDispatcher {
public static final String versionId = "$Id: MinimalDispatcher.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId =
"$Id: MinimalDispatcher.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
/** Constructor. Instantiates the subsite url/page mapping. */
public MinimalDispatcher() {

View File

@ -18,7 +18,7 @@
*/
package com.arsdigita.bebop.demo;
import com.arsdigita.bebop.BebopMapDispatcher;
import com.arsdigita.bebop.page.BebopMapDispatcher;
import com.arsdigita.db.ConnectionManager;
import com.arsdigita.dispatcher.Dispatcher;
import com.arsdigita.dispatcher.RequestContext;
@ -41,7 +41,10 @@ import javax.servlet.http.HttpServletResponse;
*/
public class OtherDispatcher extends BebopMapDispatcher {
public static final String versionId = "$Id: OtherDispatcher.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId =
"$Id: OtherDispatcher.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public OtherDispatcher() {
super();

View File

@ -75,12 +75,12 @@ import org.apache.log4j.Logger;
* associated with the <em>package</em> mounted on each site node.
*
* @author Bill Schneider
* @version $Id: PageTransformer.java 1314 2006-09-06 15:47:44Z apevec $
* @version $Id: PageTransformer.java 1655 2007-09-18 11:16:54Z chrisg23 $
*/
public class PageTransformer implements PresentationManager {
public static final String versionId =
"$Id: PageTransformer.java 1314 2006-09-06 15:47:44Z apevec $" +
"$Author: apevec $" +
"$Id: PageTransformer.java 1655 2007-09-18 11:16:54Z chrisg23 $" +
"$Author: chrisg23 $" +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger

View File

@ -18,20 +18,21 @@
*/
package com.arsdigita.bebop.parameters;
import java.awt.Image;
// pboy: unused imports, to be deleted
// import java.awt.Image;
import java.io.File;
import javax.servlet.http.HttpServletRequest;
import javax.swing.ImageIcon;
// import javax.swing.ImageIcon;
import org.apache.bcel.generic.INSTANCEOF;
// import org.apache.bcel.generic.INSTANCEOF;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.event.ParameterListener;
// import com.arsdigita.bebop.FormProcessException;
// import com.arsdigita.bebop.event.ParameterListener;
import com.arsdigita.bebop.event.ParameterEvent;
import com.arsdigita.dispatcher.MultipartHttpServletRequest;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.util.Assert;
// import com.arsdigita.util.Assert;
/**
* Verifies that the File is smaller than the specified size in bytes

View File

@ -24,10 +24,9 @@ import com.arsdigita.bebop.event.ParameterEvent;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* Verifies that the
* parameter's value is non-empty. A value is considererd non-empty
* if it exists in the page state, and it contains some data besides
* whitespace.
* Verifies that the parameter's value is non-empty.
* A value is considererd non-empty if it exists in the page state,
* and it contains some data besides whitespace.
*
* @author Karl Goldstein
* @author Uday Mathur
@ -37,7 +36,10 @@ import com.arsdigita.globalization.GlobalizedMessage;
*/
public class NotEmptyValidationListener extends GlobalizedParameterListener {
public static final String versionId = "$Id: NotEmptyValidationListener.java 1502 2007-03-20 11:38:53Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId =
"$Id: NotEmptyValidationListener.java 1502 2007-03-20 11:38:53Z chrisgilbert23 $" +
"by $Author: chrisgilbert23 $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public NotEmptyValidationListener(String label) {
setError(new GlobalizedMessage(label, getBundleBaseName()));

View File

@ -40,11 +40,11 @@ import com.arsdigita.xml.Element;
* of the column headers is clicked.
*
* @author David Lutterkort
* @version $Id: TableHeader.java 287 2005-02-22 00:29:02Z sskracic $
* @version $Id: TableHeader.java 1638 2007-09-17 11:48:34Z chrisg23 $
*/
public class TableHeader extends SimpleComponent {
public static final String versionId = "$Id: TableHeader.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId = "$Id: TableHeader.java 1638 2007-09-17 11:48:34Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/16 18:10:38 $";
/**
* The control event when the user clicks on a column header.

View File

@ -1,39 +1,46 @@
/*
* CategorizationConfig.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 17. Januar 2008, 15:29
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.arsdigita.categorization;
/**
*
* @author quasi
*/
import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.util.Assert;
// unused imports
// import com.arsdigita.runtime.RuntimeConfig;
// import com.arsdigita.util.Assert;
import com.arsdigita.util.parameter.BooleanParameter;
import com.arsdigita.util.parameter.StringParameter;
import com.arsdigita.util.parameter.ErrorList;
import com.arsdigita.util.parameter.IntegerParameter;
// import com.arsdigita.util.parameter.ErrorList;
// import com.arsdigita.util.parameter.IntegerParameter;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.ParameterError;
// import com.arsdigita.util.parameter.ParameterError;
import java.util.StringTokenizer;
import org.apache.log4j.Logger;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
// import java.util.Map;
// import java.util.HashMap;
// import java.util.Set;
// import java.util.HashSet;
/**
* Stores the configuration record for the Categorization functionality
* Stores the configuration record for the Categorization functionality.
*
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
*/
public final class CategorizationConfig extends AbstractConfig {
public static final String versionId =
@ -46,13 +53,28 @@ public final class CategorizationConfig extends AbstractConfig {
private final Parameter m_showInternalName;
private final Parameter m_supportedLanguages;
/**
* Public Constructor
*/
public CategorizationConfig() {
/**
* If set to false for a given category id its label (name) is taken
* from the language bundle for the language preference declared by
* the browser (of the default, if the requested language is not supported).
* If no language bundle exist for that id, the category will be
* excluded from the category tree (or navigation tree is used in
* navigation).
*/
m_showInternalName = new BooleanParameter
("waf.categorization.show_internal_name",
Parameter.REQUIRED,
new Boolean(false));
new Boolean(true));
/**
* String containing the supported languages. The first one is considered
* as default.
*/
m_supportedLanguages = new StringParameter
("waf.categorization.supported_languages",
Parameter.REQUIRED,

View File

@ -1,6 +1,6 @@
waf.categorization.show_internal_name.title=Activate output of internal keys for categorization
waf.categorization.show_internal_name.purpose=Activate this setting to output internal keys for categories without the requested locale. This is usually for debugging.
waf.categorization.show_internal_name.example=false
waf.categorization.show_internal_name.title=Activate output of internal keys (labels) for categorization.
waf.categorization.show_internal_name.purpose=Activate it to output internal keys for categories without the requested locale. This is usually for debugging. It is set to true here to preserve backwards compatibility to version 1.0.4 and prior.
waf.categorization.show_internal_name.example=true
waf.categorization.show_internal_name.format=[boolean]
waf.categorization.supported_languages.title=Set the supported languages for categorization
waf.categorization.supported_languages.purpose=Set the supported languages for categorization. First entry is the default language

View File

@ -418,7 +418,6 @@ public class Category extends ACSObject {
return getName(this.getNegotiatedLocale());
}
/**
* Returns the display name of the category. This overrides the parent
* implementation.
@ -729,7 +728,6 @@ public class Category extends ACSObject {
return isEnabled(this.getNegotiatedLocale());
}
/**
* Sets whether the category is enabled.
*

View File

@ -1,14 +1,24 @@
/*
* CategoryLocalization.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 17. Januar 2008, 14:36
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.arsdigita.categorization;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
@ -17,7 +27,7 @@ import java.math.BigDecimal;
/**
*
* @author quasi
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
*/
public class CategoryLocalization extends ACSObject {

View File

@ -1,18 +1,30 @@
/*
* CategoryLocalizationCollection.java
* Copyright (C) 2008 Sören Bernstein All Rights Reserved.
*
* Created on 19. Januar 2008, 13:24
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Quasimodo
*/
package com.arsdigita.categorization;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.ACSObjectCollection;
import com.arsdigita.persistence.DataAssociation;
// unused imports
// import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
// import com.arsdigita.persistence.DataObject;
/**
* Represents a collection of categoryLocalizations.
@ -21,6 +33,7 @@ import com.arsdigita.persistence.DataObject;
* Category} and other classes. See, for example, {@link Category#getChildren()}
* or {@link Category#getDescendants()}.</p>
*
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
* @author Randy Graebner (randyg@alum.mit.edu)
* @version $Revision: #15 $ $DateTime: 2004/08/16 18:10:38 $
**/
@ -107,7 +120,8 @@ public class CategoryLocalizationCollection extends ACSObjectCollection {
*/
public boolean localizationExists(String locale) {
//
// Really string comparison using != ??
// && !locale.isEmpty() ?
if(!m_dataCollection.isEmpty() && locale != "") {
// First check, if we are already at the right position. This will speed up repeated access for the same locale

View File

@ -1,173 +0,0 @@
/*
* Copyright (C) 2003-2004 Red Hat Inc. 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
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.core;
import com.arsdigita.auditing.BasicAuditTrail;
import com.arsdigita.db.DbHelper;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.loader.CoreLoader;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.runtime.CompoundInitializer;
import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.LegacyInitEvent;
import com.arsdigita.runtime.LegacyInitializer;
import com.arsdigita.runtime.OptionalLegacyInitializer;
import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.ui.admin.Admin;
import com.arsdigita.ui.sitemap.SiteMap;
import com.arsdigita.util.xml.XML;
import com.arsdigita.web.Host;
import com.arsdigita.web.WebApp;
import com.arsdigita.web.ApplicationType;
import com.arsdigita.workflow.simple.TaskComment;
import com.arsdigita.search.converter.Converter;
import com.arsdigita.search.converter.ConverterRegistry;
import com.arsdigita.search.converter.PDFConverter;
import com.arsdigita.search.converter.ExcelConverter;
import com.arsdigita.search.converter.OOConverter;
import com.arsdigita.search.converter.WordConverter;
import com.arsdigita.search.converter.TextConverter;
/**
* CoreInitializer
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #15 $ $Date: 2004/08/16 $
**/
public class Initializer extends CompoundInitializer {
public final static String versionId = "$Id: Initializer.java 1547 2007-03-29 14:24:57Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $";
public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(url);
add(new com.arsdigita.persistence.Initializer());
add(new PDLInitializer
(new ManifestSource
("ccm-core.pdl.mf",
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
add(new LegacyInitializer("com/arsdigita/core/enterprise.init"));
add(new OptionalLegacyInitializer("enterprise.init"));
}
public final void init(final DomainInitEvent e) {
super.init(e);
e.getFactory().registerInstantiator
(Host.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dobj) {
return new Host(dobj);
}
});
e.getFactory().registerInstantiator
(ApplicationType.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dobj) {
return new ApplicationType(dobj);
}
});
e.getFactory().registerInstantiator
(WebApp.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(final DataObject data) {
return new WebApp(data);
}
});
e.getFactory().registerInstantiator
(TaskComment.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(final DataObject data) {
return new TaskComment(data);
}
});
e.getFactory().registerInstantiator
(Admin.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(final DataObject data) {
return new Admin(data);
}
});
e.getFactory().registerInstantiator
(SiteMap.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(final DataObject data) {
return new SiteMap(data);
}
});
e.getFactory().registerInstantiator
(BasicAuditTrail.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(final DataObject data) {
return new BasicAuditTrail(data);
}
});
// register the document converters
Converter converter = new PDFConverter();
ConverterRegistry.registerConverter(converter,
converter.getMimeTypes());
converter = new ExcelConverter();
ConverterRegistry.registerConverter(converter,
converter.getMimeTypes());
converter = new WordConverter();
ConverterRegistry.registerConverter(converter,
converter.getMimeTypes());
converter = new OOConverter();
ConverterRegistry.registerConverter(converter,
converter.getMimeTypes());
converter = new TextConverter();
ConverterRegistry.registerConverter(converter,
converter.getMimeTypes());
}
public final void init(final LegacyInitEvent e) {
super.init(e);
Session session = SessionManager.getSession();
TransactionContext txn = session.getTransactionContext();
txn.beginTxn();
CoreLoader.loadHost();
txn.commitTxn();
XML.setupFactories();
}
}

View File

@ -18,18 +18,38 @@
*/
package com.arsdigita.core;
import com.arsdigita.packaging.BaseCheck;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.util.Assert;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* LibCheck
* LibCheck uses the checklist mechanism to perform additional checks for
* libraries specifically required by ccm-core.
* (@see com.arsdigita.packaging.Check.java)
* The check is activated during initial setup by the file /ccm-core.checklist!
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #5 $ $Date: 2004/08/16 $
**/
*/
public class LibCheck extends BaseCheck {
public final static String versionId = "$Id: LibCheck.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: LibCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
// Integrating the packaging.MessageMap service class providing a
// package specific message file by overriding the variable in BaseCheck.
static {
final InputStream in = LibCheck.class.getResourceAsStream
("libcheck.messages_linux");
Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in));
}
private boolean checkJAAS() {
final String classname = "javax.security.auth.Policy";

View File

@ -1,25 +0,0 @@
/*
* Copyright (C) 2003-2004 Red Hat Inc. 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
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.core;
import com.arsdigita.loader.CoreLoader;
public final class Loader extends CoreLoader {
// Empty
}

View File

@ -1,4 +1,4 @@
init com.arsdigita.versioning.Initializer { }
// init com.arsdigita.versioning.Initializer { }
init com.arsdigita.globalization.Initializer {
// See http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc
@ -40,8 +40,9 @@ init com.arsdigita.kernel.security.Initializer {
}
init com.arsdigita.search.Initializer {}
// init com.arsdigita.search.Initializer {}
// As of version 6.5.x still in use!
init com.arsdigita.search.intermedia.Initializer {
timerDelay = 60; // Parameters for search timer/indexing
syncDelay = 60; // All units are time in seconds
@ -50,8 +51,9 @@ init com.arsdigita.search.intermedia.Initializer {
indexingRetryDelay = 60;
}
init com.arsdigita.search.lucene.Initializer {}
// init com.arsdigita.search.lucene.Initializer {}
// As of version 6.5.x still in use!
init com.arsdigita.notification.Initializer {
RequestManagerDelay = 900; // in seconds
RequestManagerPeriod = 900; // in seconds

View File

@ -0,0 +1,43 @@
[security_jars]
Users of Java 1.3.x must place the following jars from the CCM tools
RPM in the system classpath:
$CCM_TOOLS_HOME/lib/security/local_policy.jar
$CCM_TOOLS_HOME/lib/security/jce.jar
$CCM_TOOLS_HOME/lib/security/US_export_policy.jar
$CCM_TOOLS_HOME/lib/security/jaas.jar
$CCM_TOOLS_HOME/lib/security/sunjce_provider.jar
Add symbolic links to these files to the /usr/local/share/java
directory or add them directly to the CLASSPATH environment variable.
[jaas_found]
CHECK: JAAS is available
[jaas_not_found]
WARNING: JAAS not found
JAAS is the Java Authentication and Authorization Service and is
required for CCM authentication. Check your classpath.
[jce_found]
CHECK: JCE is available
[jce_not_found]
WARNING: JCE not found
JCE is the Java Cryptography Extension and is required for CCM
authentication. Check your classpath.
[classpath]
The classpath of the CCM runtime includes
* jar files in JAVA_HOME/jre/lib/ext
* jars, zips, or class files under one of the paths listed in
CCM_HOME/ccm.classpath if it exists or /etc/ccm/ccm.classpath
otherwise
* the CLASSPATH environment variable.

View File

@ -41,7 +41,10 @@ import java.util.Set;
public class Script {
public final static String versionId = "$Id: Script.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Script.java 738 2005-09-01 12:36:52Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log =
Logger.getLogger(Script.class);

View File

@ -70,8 +70,12 @@ public class Kernel {
s_securityConfig = new SecurityConfig();
s_initialContext.setLocale(Locale.getDefault());
s_config.load("ccm-core/kernel.properties");
s_securityConfig.load("ccm-core/security.properties");
// deprecated, use load() instead which loads ccm-core/kernel.properties
// by default for KernelConfig / SecurityConfig
// s_config.load("ccm-core/kernel.properties");
s_config.load();
// s_securityConfig.load("ccm-core/security.properties");
s_securityConfig.load();
s_context = new ThreadLocal() {
public Object initialValue() {
return s_initialContext;

View File

@ -87,6 +87,9 @@ public class SecurityConfig extends AbstractConfig {
private final Parameter m_userBanOn = new BooleanParameter
("waf.user_ban_on", Parameter.REQUIRED, Boolean.FALSE);
/**
* Constructs an empty SecurityConfig object
*/
public SecurityConfig() {
register(m_rootPage);
register(m_loginPage);

View File

@ -23,15 +23,15 @@ import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.dispatcher.RedirectException;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelHelper;
// import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.UserAuthentication;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.kernel.security.HTTPRequestCallback;
import com.arsdigita.kernel.security.HTTPResponseCallback;
import com.arsdigita.kernel.security.LifetimeCallback;
// import com.arsdigita.kernel.security.HTTPRequestCallback;
// import com.arsdigita.kernel.security.HTTPResponseCallback;
// import com.arsdigita.kernel.security.LifetimeCallback;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.LoginSignal;
import com.arsdigita.web.Web;

View File

@ -18,20 +18,29 @@
*/
package com.arsdigita.loader;
import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.ParameterRecord;
// deprecated: import com.arsdigita.util.parameter.ParameterRecord;
// replaced by c.ad.rt.AbstractConfig, should be deleted after testing
import com.arsdigita.util.parameter.StringParameter;
import org.apache.log4j.Logger;
/**
* MimeTypeRow
* A configuration record for MimeTypes
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #5 $ $Date: 2004/08/16 $
**/
class MimeTypeRow extends ParameterRecord {
class MimeTypeRow extends AbstractConfig {
public final static String versionId = "$Id: MimeTypeRow.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: MimeTypeRow.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger(MimeTypeRow.class);
private StringParameter m_type = new StringParameter
("waf.mime.type", Parameter.REQUIRED, null);
@ -49,7 +58,7 @@ class MimeTypeRow extends ParameterRecord {
("waf.mime.sizer_or_inso", Parameter.OPTIONAL, null);
public MimeTypeRow() {
super("mime-type-row");
// super();
register(m_type);
register(m_label);
register(m_extensions);

View File

@ -22,11 +22,21 @@ import com.arsdigita.installer.SQLLoader;
import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.Session;
import com.arsdigita.runtime.AbstractScript;
import com.arsdigita.runtime.InteractiveParameterLoader;
// pboy (Jan.09):
// deprecated without recommended replacement
// created Interactive ParameterReader as a replacement
// import com.arsdigita.runtime.InteractiveParameterLoader;
import com.arsdigita.runtime.InteractiveParameterReader;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.config.JavaPropertyLoader;
import com.arsdigita.util.parameter.CompoundParameterLoader;
import com.arsdigita.util.parameter.ParameterLoader;
// deprecated, use c.ad.util.JavaPropertyReader instead
// import com.arsdigita.util.config.JavaPropertyLoader;
import com.arsdigita.util.JavaPropertyReader;
// deprecated, use c.ad.util.parameter.CompoundParameterReader instead
// import com.arsdigita.util.parameter.CompoundParameterLoader;
import com.arsdigita.util.parameter.CompoundParameterReader;
// deprecated, use c.ad.util.parameter.ParameterReader instead
// import com.arsdigita.util.parameter.ParameterLoader;
import com.arsdigita.util.parameter.ParameterReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -54,7 +64,10 @@ public abstract class PackageLoader extends AbstractScript {
public final static Logger s_log = Logger.getLogger(PackageLoader.class);
public final static String versionId = "$Id: PackageLoader.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: PackageLoader.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public static boolean exists(Connection conn, String table) {
try {
@ -118,10 +131,23 @@ public abstract class PackageLoader extends AbstractScript {
s_log.info("Loading: Done");
}
public static ParameterLoader loader(String[] args) {
CompoundParameterLoader result = new CompoundParameterLoader();
result.add(new JavaPropertyLoader(props(args)));
result.add(new InteractiveParameterLoader(System.in, System.out));
/**
*
* @param args
* @return
* //@deprecated use reader() instead
* but seems not to be used by any module
*/
//public static ParameterLoader loader(String[] args) {
// return ( this.reader(args) );
// return null;
// }
public static ParameterReader reader(String[] args) {
CompoundParameterReader result = new CompoundParameterReader();
result.add(new JavaPropertyReader(props(args)));
result.add(new InteractiveParameterReader(System.in, System.out));
return result;
}

View File

@ -79,7 +79,7 @@ import java.util.Date;
*
* @author Ron Henderson
* @author David Dao
* @version $Id: Notification.java 287 2005-02-22 00:29:02Z sskracic $ */
* @version $Id: Notification.java 1641 2007-09-17 13:46:27Z chrisg23 $ */
public class Notification extends ACSObject implements NotificationConstants {
// Base DataObject type

View File

@ -16,9 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.core;
package com.arsdigita.packaging;
import com.arsdigita.packaging.Check;
// import com.arsdigita.packaging.Check;
import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException;
import java.io.IOException;
@ -32,38 +32,51 @@ import java.util.Iterator;
import java.util.List;
/**
* BaseCheck
* BaseCheck: Extension of the Check abstract class, which can be used as a
* starting point by packages which have to perform additional checks during
* the installation step. (@see Checklist machinery)
*
* Provides some methods to print out classes and classnames, which can be
* used in the run() method of derived classes.
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #4 $ $Date: 2004/08/16 $
**/
*/
abstract class BaseCheck extends Check {
abstract public class BaseCheck extends Check {
public final static String versionId = "$Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public static final String versionId =
"$Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final MessageMap s_messages = new MessageMap();
public static final MessageMap s_messages = new MessageMap();
static {
final InputStream in = BaseCheck.class.getResourceAsStream
("checks.messages_linux");
("basecheck.messages_linux");
Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in));
}
static String message(final String key) {
public static String message(final String key) {
Assert.exists(key, String.class);
return s_messages.get(key);
}
PrintStream m_out = System.out;
public PrintStream m_out = System.out;
ClassLoader m_loader =
Thread.currentThread().getContextClassLoader();
boolean m_verbose = false;
/**
* Prints the ...
*
* @param classname
*/
void printClassLocations(final String classname) {
final Iterator urls = getClassURLs(classname).iterator();
@ -84,10 +97,20 @@ abstract class BaseCheck extends Check {
}
}
/**
*
* @param classname
* @return
*/
List getClassURLs(final String classname) {
return getResourceURLs(classname.replace('.', '/') + ".class");
}
/**
*
* @param resource
* @return
*/
List getResourceURLs(final String resource) {
final ArrayList list = new ArrayList();
@ -104,7 +127,12 @@ abstract class BaseCheck extends Check {
return list;
}
boolean isClassFound(final String classname) {
/**
*
* @param classname
* @return
*/
public boolean isClassFound(final String classname) {
if (m_verbose) {
m_out.println("Looking for class " + classname);
}
@ -125,7 +153,11 @@ abstract class BaseCheck extends Check {
}
}
void checkDuplicates(final String classname) {
/**
*
* @param classname
*/
public void checkDuplicates(final String classname) {
if (m_verbose) {
m_out.println("Checking for duplicates of " + classname);
}

View File

@ -69,7 +69,10 @@ import com.arsdigita.runtime.AbstractScript;
public abstract class Check extends AbstractScript {
public final static String versionId = "$Id: Check.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Check.java 736 2005-09-01 10:46:05Z sskracic $" +
"by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public static final class Status {
@ -79,6 +82,7 @@ public abstract class Check extends AbstractScript {
m_name = name;
}
@Override
public String toString() {
return m_name;
}

View File

@ -16,26 +16,55 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.core;
package com.arsdigita.packaging;
import com.arsdigita.db.DbHelper;
import com.arsdigita.packaging.ConfigRegistry;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.util.jdbc.Connections;
import com.arsdigita.util.Assert;
import java.sql.Connection;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* DBCheck
* CheckDB
* helper class for the load command worker class Load, checks for
* existence of a database and verifies accessibility
*
* Subject to change!
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #7 $ $Date: 2004/08/16 $
**/
*/
public class DBCheck extends BaseCheck {
public class CheckDB extends BaseCheck {
public final static String versionId = "$Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
// Integration of service class packaging.MessageMap.
// Specifies a package specific message file overriding BaseCheck
static {
final InputStream in = CheckDB.class.getResourceAsStream
("checkdb.messages_linux");
Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in));
}
/**
* Checks the classpath for the Oracle JDBC driver. The driver is no
* longer included in the CCM distribution but must be achieved and
* installed separately.
*
* @return true if driver is in the classpath
*/
private boolean checkOracleJDBC() {
final String classname = "oracle.jdbc.driver.OracleDriver";
@ -52,6 +81,27 @@ public class DBCheck extends BaseCheck {
}
}
/**
* Checks the classpath for the PostgreSQL JDBC driver. The driver is no
* longer included in the CCM distribution,too, but must be achieved and
* installed separately.
*
* @ToDo: An equivalent method for postgres. The driver in not
* included anymore, too.
*
* @return true if driver is in the classpath
*/
private boolean checkPostgresqlJDBC() {
return true;
}
/**
* Checks, if the runtime related registry is properly set up and checks
* the stored initial parameter for database access (which had been asked
* for by the installation script).
*
* @return true if database access is granted
*/
private boolean checkDatabaseConnection() {
if (m_verbose) {
m_out.println("Checking that RuntimeConfig is configured");
@ -108,6 +158,12 @@ public class DBCheck extends BaseCheck {
}
}
/**
* Checks if the database belongs to the set of supported DBs.
*
* @param db
* @return
*/
private boolean checkSupportedDatabase(int db) {
if ( db == DbHelper.DB_DEFAULT ) {
m_out.println(message("unsupported_database"));
@ -120,6 +176,11 @@ public class DBCheck extends BaseCheck {
return true;
}
/**
* Run method required by the script machinery to make things happen.
*
* @param ctx
*/
public void run(ScriptContext ctx) {
int db = DbHelper.getDatabaseFromURL(RuntimeConfig.
getConfig().getJDBCURL());

View File

@ -39,7 +39,10 @@ import org.xml.sax.helpers.DefaultHandler;
class Checklist {
public final static String versionId = "$Id: Checklist.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Checklist.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public static Checklist get(String pkg) {
ClassLoader ldr = Checklist.class.getClassLoader();

View File

@ -18,6 +18,7 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.util.parameter.Parameter;
import java.io.IOException;
import java.util.ArrayList;
@ -31,6 +32,9 @@ import org.apache.commons.cli.PosixParser;
/**
* Clear
*
* Implements the command line interface to clear one or more values
* in a CCM configuration database (registry)
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: Clear.java 736 2005-09-01 10:46:05Z sskracic $
*/

View File

@ -33,7 +33,10 @@ import org.apache.commons.cli.Options;
abstract class Command {
public final static String versionId = "$Id: Command.java 1324 2006-09-21 22:13:16Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Command.java 1324 2006-09-21 22:13:16Z apevec $" +
" by $Author: apevec $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private String m_name;
private String m_summary;
@ -72,7 +75,8 @@ abstract class Command {
static void usage(Options options, PrintStream out, String command,String args) {
String str;
final String debugVar = "To show debugging output set the CCM_TOOLS_DEBUG environmental variable";
final String debugVar =
"To show debugging output set the CCM_TOOLS_DEBUG environmental variable";
if (args == null) {
str = command;
} else {
@ -81,7 +85,8 @@ abstract class Command {
HelpFormatter fmt = new HelpFormatter();
PrintWriter w = new PrintWriter(out);
fmt.printHelp(w, 80, str, "\n"+debugVar+"\n\nOptions:", options, 2, 4, null, true);
fmt.printHelp(w, 80, str, "\n"+debugVar+"\n\nOptions:",
options, 2, 4, null, true);
w.flush();
}

View File

@ -18,7 +18,8 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.CCM;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.runtime.CCMResourceManager;
import com.arsdigita.util.Classes;
import com.arsdigita.util.JavaPropertyWriter;
import com.arsdigita.util.parameter.ErrorList;
@ -34,7 +35,11 @@ import java.util.Map;
import java.util.Properties;
/**
* Config
* PackageTool helper class: Writes a config database to its physical storage
* in file system.
*
* Used by some command worker classes of the packaging package, which handle
* configuration tasks, esp. the "load", "clear", "set" and "get" commands.
*
* This class is <strong>not</strong> supported API.
*
@ -44,10 +49,17 @@ import java.util.Properties;
public final class Config extends ParameterMap {
public final static String versionId = "$Id: Config.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Config.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private ConfigRegistry m_reg;
/**
* Constructor, creates an Config object
* @param reg
**/
public Config(ConfigRegistry reg) {
m_reg = reg;
@ -59,6 +71,10 @@ public final class Config extends ParameterMap {
}
}
/**
*
* @param errs
**/
void load(ErrorList errs) {
for (Iterator it = getContexts().iterator(); it.hasNext(); ) {
ParameterContext ctx = (ParameterContext) it.next();
@ -79,20 +95,26 @@ public final class Config extends ParameterMap {
}
public final void save() throws IOException {
save(CCM.getConfigDirectory());
save(CCMResourceManager.getConfigDirectory());
}
void save(File conf) throws IOException {
if (!conf.exists()) {
throw new IOException("no such directory: " + conf);
/**
* Write the config parameter to the file system.
*
* @param confDir full path of the config directory location in the file system
* @throws java.io.IOException
**/
void save(File confDir) throws IOException {
if (!confDir.exists()) {
throw new IOException("no such directory: " + confDir);
}
if (conf.isFile()) {
throw new IOException("expecting directory: " + conf);
if (confDir.isFile()) {
throw new IOException("expecting directory: " + confDir);
}
if (!conf.canWrite()) {
throw new IOException("cannot write to directory: " + conf);
if (!confDir.canWrite()) {
throw new IOException("cannot write to directory: " + confDir);
}
HashMap stores = new HashMap();
@ -113,7 +135,7 @@ public final class Config extends ParameterMap {
String storage = (String) me.getKey();
Properties props = (Properties) me.getValue();
if (props.size() == 0) { continue; }
File file = new File(conf, storage);
File file = new File(confDir, storage);
File dir = file.getParentFile();
dir.mkdirs();
if (!(dir.exists() && dir.isDirectory())) {

View File

@ -18,6 +18,7 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.util.JavaPropertyWriter;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.ParameterWriter;
@ -40,13 +41,21 @@ import org.apache.commons.cli.PosixParser;
/**
* Get
*
* Implements the command line interface to list one or more values
* from a CCM configuration database (registry)
*
* Called by ccm get command
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #6 $ $Date: 2004/08/16 $
**/
class Get extends Command {
public final static String versionId = "$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $" +
" by $Author: apevec $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Options OPTIONS = getOptions();

View File

@ -27,7 +27,10 @@ package com.arsdigita.packaging;
class Help extends Command {
public final static String versionId = "$Id: Help.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Help.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public Help() {
super("--help", "Print generic help");

View File

@ -18,6 +18,7 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.util.Files;
import com.arsdigita.util.StringUtils;
import java.io.BufferedReader;
@ -37,7 +38,12 @@ import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
/**
* HostInit
* PackageTool worker class, implements the "hostinit" command.
*
* Populates the CCM application directory in webapps.
* Does not create the database nor the config registry.
*
* Called by the ccm hostinit / ccm hostinit-bundle command
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #16 $ $Date: 2004/08/16 $
@ -45,7 +51,10 @@ import org.apache.log4j.Logger;
public class HostInit {
public final static String versionId = "$Id: HostInit.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: HostInit.java 736 2005-09-01 10:46:05Z sskracic $" +
"by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log =
Logger.getLogger(HostInit.class);
@ -141,6 +150,8 @@ public class HostInit {
err("unable to create system: " + system);
}
// check the configuration database (registry) for packages (modules)
// retrieve a list of packages to deal with
ConfigRegistry reg = new ConfigRegistry();
List packages = reg.getPackages();
try {

View File

@ -18,7 +18,6 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.core.DBCheck;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.persistence.ConnectionSource;
import com.arsdigita.persistence.DedicatedConnectionSource;
@ -27,14 +26,24 @@ import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.metadata.MetadataRoot;
import com.arsdigita.persistence.pdl.PDLCompiler;
import com.arsdigita.runtime.InteractiveParameterLoader;
// pboy (Jan.09): deprecated classes and methods removed,
// comments should be deleted after extensiv testing
// deprecated, no replacement specified by author,
// created InteractiveParameterReader analogous to CompoundParameterReader
//import com.arsdigita.runtime.InteractiveParameterLoader;
import com.arsdigita.runtime.InteractiveParameterReader;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.runtime.RegistryConfig;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.runtime.Startup;
import com.arsdigita.util.JavaPropertyReader;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.config.JavaPropertyLoader;
// deprecated, use c.ad.util.JavaPropertyReader instead
// import com.arsdigita.util.config.JavaPropertyLoader;
import com.arsdigita.util.JavaPropertyReader;
import com.arsdigita.util.jdbc.Connections;
import com.arsdigita.util.parameter.CompoundParameterLoader;
// deprecated:
// import com.arsdigita.util.parameter.CompoundParameterLoader;
import com.arsdigita.util.parameter.CompoundParameterReader;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.ParameterContext;
import java.io.ByteArrayInputStream;
@ -64,7 +73,11 @@ import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
/**
* PackageTool
* PackageTool worker class, implements the "load" command.
*
* Loads the database schema and initial content.
*
* Called by PackageTool
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #29 $ $Date: 2004/08/16 $
@ -72,7 +85,10 @@ import org.apache.commons.cli.PosixParser;
class Load extends Command {
public final static String versionId = "$Id: Load.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Load.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Options OPTIONS = getOptions();
@ -216,7 +232,7 @@ class Load extends Command {
ParameterMap contexts = new ParameterMap();
Properties parameters = new Properties();
CompoundParameterLoader loader = new CompoundParameterLoader();
CompoundParameterReader cpr = new CompoundParameterReader();
if (line.hasOption("parameter-file")) {
String file = line.getOptionValue("parameter-file");
try {
@ -227,15 +243,19 @@ class Load extends Command {
System.err.println(e.getMessage());
return false;
}
loader.add(new JavaPropertyLoader(parameters));
// deprecated, use JavaPropertyReader instead
// cpr.add(new JavaPropertyLoader(parameters));
cpr.add(new JavaPropertyReader(parameters));
}
if (line.hasOption("parameters")) {
Properties props = props(line.getOptionValues("parameters"));
loader.add(new JavaPropertyLoader(props));
// deprecated, use JavaPropertyReader instead
// cpr.add(new JavaPropertyLoader(props));
cpr.add(new JavaPropertyReader(props));
parameters.putAll(props);
}
if (line.hasOption("interactive")) {
loader.add(new InteractiveParameterLoader(System.in, System.out));
cpr.add(new InteractiveParameterReader(System.in, System.out));
}
Config config = null;
@ -288,9 +308,10 @@ class Load extends Command {
Session ssn = null;
if (all || line.hasOption("schema") || line.hasOption("data")) {
Check dbcheck = new DBCheck();
dbcheck.run(null);
if (dbcheck.getStatus() == null || dbcheck.getStatus().equals(Check.FAIL)) {
Check checkdb = new CheckDB();
checkdb.run(null);
if (checkdb.getStatus() == null
|| checkdb.getStatus().equals(Check.FAIL)) {
rollbackConfig(config,packages);
return false;
}
@ -377,7 +398,7 @@ class Load extends Command {
}
for (int i = 0; i < sorted.length; i++) {
sorted[i].loadData(ssn, loader);
sorted[i].loadData(ssn, cpr);
}
}
}
@ -443,7 +464,12 @@ class Load extends Command {
for (int i = 0; i < pkgs.length; i++) {
boolean isnew = false;
for (int j = 0; j < packages.size(); j++) {
if (pkgs[i].toString() == packages.get(j).toString()) {
// Operator == compares object identity.
// comparison here refers to package names, so an
// object comparison will never be true.
// instead: equals()
// if (pkgs[i].toString() == packages.get(j).toString()) {
if (pkgs[i].toString().equals(packages.get(j).toString())) {
isnew = true;
}
}

View File

@ -34,7 +34,9 @@ import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.runtime.Startup;
import com.arsdigita.util.Classes;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.parameter.ParameterLoader;
// ParameterLoader is deprecated
// import com.arsdigita.util.parameter.ParameterLoader;
import com.arsdigita.util.parameter.ParameterReader;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
@ -48,6 +50,9 @@ import org.apache.log4j.Logger;
/**
* Loader
*
* Helper class for load which actually performs the loading of
* the database schema and of the initial content.
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #13 $ $Date: 2004/08/16 $
**/
@ -56,7 +61,10 @@ class Loader {
private static final Logger s_log = Logger.getLogger(Loader.class);
public final static String versionId = "$Id: Loader.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Loader.java 736 2005-09-01 10:46:05Z sskracic $" +
"by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final String INIT = "com.arsdigita.runtime.Initializer";
@ -127,7 +135,10 @@ class Loader {
}
}
public void loadData(Session ssn, ParameterLoader loader) {
// deprecated:
// public void loadData(Session ssn, ParameterLoader loader) {
public void loadData(Session ssn, ParameterReader prd) {
final List inits = m_info.getProvidedInitializers();
CompoundInitializer ini = new CompoundInitializer();
for (Iterator it = inits.iterator(); it.hasNext(); ) {
@ -140,7 +151,8 @@ class Loader {
TransactionContext txn = ssn.getTransactionContext();
txn.beginTxn();
final ScriptContext ctx = new ScriptContext(ssn, loader);
// final ScriptContext ctx = new ScriptContext(ssn, loader);
final ScriptContext ctx = new ScriptContext(ssn, prd);
new KernelExcursion() {
protected void excurse() {
setEffectiveParty(Kernel.getSystemParty());
@ -194,6 +206,7 @@ class Loader {
return result;
}
@Override
public String toString() {
return "<loader for " + m_key + ">";
}

View File

@ -28,13 +28,18 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* LoaderInfo
*
* Helper class:
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #6 $ $Date: 2004/08/16 $
**/
class LoaderInfo {
public final static String versionId = "$Id: LoaderInfo.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: LoaderInfo.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private List m_requiredTables = new ArrayList();
private List m_providedTables = new ArrayList();

View File

@ -28,7 +28,17 @@ import java.util.Map;
import org.apache.log4j.Logger;
/**
* Implements the ccm command line tool.
* Main entry point: Implements the ccm command line tool.
*
* Analyses the parameters, esp. the command part (1. parameter), and delegates
* the actual work to specializied classes for each command.
*
* The main purpose is to be called from an operation system specific script
* (or program) which is responsible for delivering the required parameters
* and additional information (e.g. the location where to install the
* application files via environment variable CCM_HOME). The currently
* provided script implementation is ccm, a shell script (sh and bat) backed
* by some PERL scripts, located in the tools directory of CCM trunk.
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: MasterTool.java 1169 2006-06-14 13:08:25Z fabrice $
@ -57,8 +67,18 @@ public class MasterTool {
/**
* Entry point for the the ccm command line tool.
*
* Available commands:
* - load: loads the database schema and initial content
* - hostinit:populates the applications directors (jsp, classes, etc)
* - get: retrieves a configuration parameter
* - set: stores a configuration parameeter
* - upgrade: upgrades database (schema & content) and/or application files
* - status: execution status of the application
* - which: searches for a resource or class
* - unload:
*
* @param args the command line arguments
**/
*/
public static final void main(final String[] args) {
final PrintStream out = System.out;

View File

@ -37,7 +37,10 @@ import java.util.Map;
class Menu {
public final static String versionId = "$Id: Menu.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Menu.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
static final class Layout {
private Layout() {}

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.core;
package com.arsdigita.packaging;
import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException;
@ -27,12 +27,15 @@ import java.util.HashMap;
import org.apache.log4j.Logger;
/**
* Helper class which can be used by the packaging classes and others. Manages
* messages to be printed and makes it easier to handle multi line messages.
*
* Subject to change.
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $
*/
final class MessageMap {
public final class MessageMap {
public static final String versionId =
"$Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +

View File

@ -48,7 +48,10 @@ import java.util.Properties;
class ParameterEditor {
public final static String versionId = "$Id: ParameterEditor.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: ParameterEditor.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private ParameterMap m_map;
private BufferedReader m_in;
@ -352,7 +355,7 @@ class ParameterEditor {
// XXX: for testing
public static final void main(String[] args) {
ParameterMap map = new ParameterMap();
map.addContext(new com.arsdigita.runtime.RuntimeConfig());
map.addContext( com.arsdigita.runtime.RuntimeConfig.getConfig());
map.addContext(new com.arsdigita.web.WebConfig());
map.addContext(new com.arsdigita.kernel.KernelConfig());
ParameterEditor pe = new ParameterEditor(map, System.in, System.out);

View File

@ -40,7 +40,10 @@ import java.util.Map;
class ParameterMap {
public final static String versionId = "$Id: ParameterMap.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: ParameterMap.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private List m_contexts = new ArrayList();
private List m_parameters = new ArrayList();

View File

@ -18,6 +18,7 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.ConfigRegistry;
import com.arsdigita.util.JavaPropertyReader;
import java.io.IOException;
import java.util.Iterator;
@ -31,13 +32,21 @@ import org.apache.commons.cli.PosixParser;
/**
* Set
*
* Implements the command line interface to modify one or more values
* in a CCM configuration database (registry)
*
* Called by ccm set command
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #7 $ $Date: 2004/08/16 $
**/
class Set extends Command {
public final static String versionId = "$Id: Set.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Set.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Options OPTIONS = getOptions();

View File

@ -18,6 +18,7 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.RegistryConfig;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.runtime.ScriptContext;
@ -32,7 +33,10 @@ import com.arsdigita.runtime.Startup;
class Status extends Command {
public final static String versionId = "$Id: Status.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Status.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public Status() {
super("status", "Report on the status of a CCM instance");

View File

@ -18,7 +18,8 @@
*/
package com.arsdigita.packaging;
import com.arsdigita.runtime.CCM;
import com.arsdigita.runtime.CCMResourceManager;
import com.arsdigita.util.Files;
import java.io.File;
import java.io.FileFilter;
import java.util.HashSet;
@ -38,7 +39,10 @@ import org.apache.commons.cli.PosixParser;
class Unload extends Command {
public final static String versionId = "$Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Options OPTIONS = new Options();
@ -80,7 +84,7 @@ class Unload extends Command {
if (line.hasOption("config")) {
// XXX: This just deletes everything.
File conf = CCM.getConfigDirectory();
File conf = CCMResourceManager.getConfigDirectory();
File[] files = conf.listFiles(new FileFilter() {
public boolean accept(File file) {
return !EXCLUDE.contains(file.getName());

View File

@ -27,7 +27,10 @@ package com.arsdigita.packaging;
class Usage extends Command {
public final static String versionId = "$Id: Usage.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: Usage.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
public Usage() {
super("--usage", "Print this message");

View File

@ -0,0 +1,84 @@
[classpath]
The classpath of the CCM runtime includes
* jar files in JAVA_HOME/jre/lib/ext
* jars, zips, or class files under one of the paths listed in
CCM_HOME/ccm.classpath if it exists or /etc/ccm/ccm.classpath
otherwise
* the CLASSPATH environment variable.
[supported_database]
CHECK: The database type is recognized
[unsupported_database]
WARNING: The database type is not recognized
The database that you are trying to use in not recognized. Make sure
you spelled the JDBC URL correctly. The driver name should be
"oracle" or "postgresql".
[oracle_jdbc_found]
CHECK: The Oracle JDBC driver is available
[oracle_jdbc_not_found]
WARNING: Oracle JDBC driver not found
The CCM persistence layer requires the Oracle JDBC driver in order to
function. The Oracle JDBC driver is typically in a file called
"classes12.zip" or "classes12.jar". Check your classpath.
[db_up]
CHECK: The database is accepting connections
[db_down]
WARNING: The database is not accepting connections
Possible explanations:
* The network connection to the database is down or the network is
not configured to permit connections. Try to reach the database
host and connect to the database's port to verify.
For instance, to test a connection to a running PostgreSQL
instance on a remote host:
$ host www.example.com
www.example.com has address 192.0.34.166
$ ping -c 1 192.0.34.166
1 packets transmitted, 1 received, 0% loss, time 0ms
$ telnet 192.0.34.166 5432 # 5432 is the port postgres uses
Trying 192.0.34.166...
telnet: connect to address 192.0.34.166: Connection refused
* The database is not yet started or is down. Verify that its
process is running. Check that it will accept local connections.
For example, to test a PostgreSQL instance:
$ su - postgres
$ pg_ctl status
pg_ctl: postmaster is running (pid: 20925)
$ psql -l
psql: could not connect to server: No such file or directory
* The database did not accept your user and password. Make sure
they appear correctly in your JDBC URL.
* The JDBC URL is malformed. Check the documentation for your
database. Use the ccm tool to find out what your JDBC URL is set
to:
$ ccm get waf.runtime.jdbc_url
jdbc:postgresql:justin-ccm-trunk?user=justin
[runtime_configured]
CHECK: The ccm-core package is configured.
[runtime_unconfigured]
ERROR: The ccm-core package has not been configured.
[jdbc_set]
CHECK: The JDBC URL parameter is set.
[jdbc_unset]
ERROR: The JDBC URL parameter has not been set.

View File

@ -0,0 +1,14 @@
<!-- /com/arsdigita/packaging/package.html -->
Set of classes which provide a command line interface to install, initialize
and configure a CCM application instance with MasterTool.java as the central
entry point.
<p>
Mastertool.java is the central entry point. It delegates the different tasks
to specialized worker classes.
</p>
<p>
The classes of this package are meant not to be called from within the
application running in a servlet container. They serve as a dedicated,
separate external command line interface for set up and configuration.
</p>

View File

@ -18,7 +18,6 @@
*/
package com.arsdigita.runtime;
import com.arsdigita.packaging.ConfigRegistry;
import com.arsdigita.util.parameter.AbstractParameterContext;
import com.arsdigita.util.parameter.ErrorList;
import org.apache.log4j.Logger;

View File

@ -1,117 +0,0 @@
/*
* Copyright (C) 2004 Red Hat Inc. 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
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.runtime;
import com.arsdigita.util.UncheckedWrapperException;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.log4j.Logger;
/**
* Subject to change.
*
* An entry-point class for functions of the CCM runtime package.
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: CCM.java 751 2005-09-02 12:52:23Z sskracic $
*/
public final class CCM {
private static final Logger s_log = Logger.getLogger(CCM.class);
public static final URL getHomeURL() {
try {
return CCM.getHomeDirectory().toURL();
} catch (MalformedURLException e) {
throw new UncheckedWrapperException(e);
}
}
static final File getHomeDirectory() {
final 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");
}
if (!file.isDirectory()) {
throw new IllegalStateException
("The file given in the ccm.home system property " +
"is not a directory");
}
return file;
}
public static final URL getConfigURL() {
try {
return CCM.getConfigDirectory().toURL();
} catch (MalformedURLException e) {
throw new UncheckedWrapperException(e);
}
}
public static final File getConfigDirectory() {
final String conf = System.getProperty("ccm.conf");
File file;
if (conf == null) {
file = new File(new File(CCM.getHomeDirectory(),"conf"), "registry");
} else {
file = new File(conf);
}
if (!file.exists()) {
if (!file.mkdirs()) {
throw new IllegalStateException
("Could not create configuration directory: " + file);
}
}
if (!file.isDirectory()) {
throw new IllegalStateException
("Configuration directory value is not a directory: " + file);
}
return file;
}
public static final File getDataDirectory() {
File file = new File(CCM.getHomeDirectory(),"data");
if (!file.exists()) {
if (!file.mkdirs()) {
throw new IllegalStateException
("Could not create data directory: " + file);
}
}
if (!file.isDirectory()) {
throw new IllegalStateException
("Data directory value is not a directory: " + file);
}
return file;
}
}

View File

@ -0,0 +1,353 @@
/*
* Copyright (C) 2004 Red Hat Inc. 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
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.runtime;
import com.arsdigita.util.UncheckedWrapperException;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.log4j.Logger;
/**
* <p>CCMResourceManager Runtime environment repository object, stores essential
* properties of the runtime environment.</p>
*
* <p>Currently, is is limited to the </p>
* <ul>
* <li>base directory of the running webapp</li>
* </ul>
* <p>It provides public methods to make the properties available.</p>
*
* <p>The singleton is initialised</p>
* <ul>
* <li>either during startup of the container (called by BaseServlet, in future
* by a specialised ApplicationContextListener) </li>
* <li>or by the command line system at the beginning of the processing (esp.
* package c.ad.packaging).</li>
* </ul>
* <p>Currently as a fall back mechanism the environmant Variable CCM_HOME is
* evaluated and used a last resort, if no initialisation has been done when
* a getter is first called.</p>
*
* <p>It is essential for the proper working of CCM that CCMResourceManager is
* initialised before any operation starts, as it is the case with the Startup
* class of the runtime package, which is responsible for organising database
* assess.</p>
*
*
* <p><b>Subject to change!</b></p>
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* rewritten by
* @author pboy &lt;pboy@barkhof.uni-bremen.de&gt;
* @version $Id: CCMResourceManager.java 751 2005-09-02 12:52:23Z sskracic $
*/
public final class CCMResourceManager {
public final static String versionId =
"$Id: CCM.java 1393 2006-11-28 09:12:32Z sskracic $" +
"$Author: pboy $" +
"$DateTime: 2009/01/10 18:10:38 $";
private static final Logger s_log = Logger.getLogger(CCMResourceManager.class);
private static CCMResourceManager s_ccm;
/**
* Full Pathname of the application base directory
* (document root in apache terminology)
*/
private static File m_baseDir;
/**
* Location of the registry in the applications directory tree
* as offset from the base directory
*/
// currently not used, should be refactored as File object for the sake of
// operating system independency!
// public static final String registryPath = "/WEB-INF/conf/registry";
// public static final File registryPath = null; // currently not used, work in progress
/* ************ Section singleton handlers ***************** */
/**
* Sets the singleton configuration property for the runtime
* environment.
*
*/
public static final synchronized void setBaseDirectory(String baseDirName) {
if (s_ccm == null) {
s_ccm = new CCMResourceManager();
s_ccm.storeBaseDir(baseDirName);
}
else {
// baseDir already set, silently discard
s_log.info("baseDir already set as " + m_baseDir + ". Discarded.");
}
}
/**
* Returns the singleton configuration property for the runtime
* environment.
*
* @return The <code>RuntimeConfig</code> record; it cannot be null
*/
public static final synchronized File getBaseDirectory() {
if (s_ccm == null) {
// should never happen, setBaseDirectory has to be executed first
// we try to resolve the problem in fetchBaseDir by search for
// a runtime environment variable (the old way).
s_ccm = new CCMResourceManager();
}
return s_ccm.fetchBaseDir();
}
/* ************ Section singleton handlers END ************** */
/* ************ Constructors Section ************** */
/**
* Following the singleton pattern: Private constructor to prevent other
* clients from instantiating the class (and the compiler from generating
* a default public constructor).
*/
private CCMResourceManager() { }
/* ************ Constructors Section END ************** */
/* ************ Public getter/setter Section *************** */
/**
* Retrieve the homeDir as URL.
*
* Note! API changed. @see getHomeDirectory()
* <b>May be removed in the future!</b>
*
* @return Directory location in the servers file system as URL object.
*/
public static final URL getHomeURL() {
try {
return CCMResourceManager.getHomeDirectory().toURL();
} catch (MalformedURLException e) {
throw new UncheckedWrapperException(e);
}
}
/**
* Retrieve the homeDir, which is the location of the servlet server's
* servlet container directory in the file system of the server machine,
* as File object.
*
* <b>Note! API changed!</b>
*
* Originally it is used to determine all file object locations of a
* CCMResourceManager 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
* 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
* directory (the baseDirectory @see m_baseDir).
*
*
* Method getHomeDirectory() is preserved during the transition phase.
* <b>It may be removed in the future!</b> Or it may be moved to
* c.ad.packaging for assistence of the installation step only.
*
* @return Directory location in the servers file system as File object.
*/
static final File getHomeDirectory() {
final 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");
}
if (!file.isDirectory()) {
throw new IllegalStateException
("The file given in the ccm.home system property " +
"is not a directory");
}
return file;
}
/**
* Provide the configDirectory as URL.
*
* @see getConfigDirectory() for details.
*
* <b>Note! API changed!</b>
*
* @return Directory location in the servers file system as URL object.
*/
public static final URL getConfigURL() {
try {
return CCMResourceManager.getConfigDirectory().toURL();
} catch (MalformedURLException e) {
throw new UncheckedWrapperException(e);
}
}
/**
* Retrieve the configDir, which is the location of the configuration
* database root (registry) in the file system tree of the server machine,
* as File object.
*
* @return Directory location in the servers file system as File object.
*/
public static final File getConfigDirectory() {
// Keep this in sync with informational attribut @see registryPath !
File confdir = new File(new File(new File(CCMResourceManager.getBaseDirectory(),
"WEB-INF"),"conf"), "registry");
if (!confdir.exists()) {
if (!confdir.mkdirs()) {
throw new IllegalStateException
("Could not create configuration directory: " + confdir);
}
}
if (!confdir.isDirectory()) {
throw new IllegalStateException
("Configuration directory value is not a directory: " + confdir);
}
return confdir;
}
/**
* getWorkDirectory retrieves and eventually creates an internal directory
* in the servlet container for temporary files (work files), where subsystems
* may create subdirectories for internal use (e.g. Lucene search enginge or
* the PublishToFile machinery).
*
* The containers work file directory could be used as well, but may be
* inappropriate in case of confidential data.
*
* @return Directory location in the servers file system as File object.
*/
public static final File getWorkDirectory() {
File file = new File(new File(CCMResourceManager.getBaseDirectory(),
"WEB-INF"),"work");
if (!file.exists()) {
if (!file.mkdirs()) {
throw new IllegalStateException
("Could not create work directory: " + file);
}
}
if (!file.isDirectory()) {
throw new IllegalStateException
("Work directory value is not a directory: " + file);
}
return file;
}
/* ************ Public getter/setter Section END *************** */
/* ************ Private Worker Section *************** */
/**
* Stores the passed in String as File object.
*
* XXX contemporary Hack: checks if the last part of the dir is ROOT,
* otherwise replaces the ccm-<module> part. Must be removed as soon as all
* CCMResourceManager modules are relocated in one single context (app directory)
* instead of spreaded as separate applications.
* @param baseDirName String containing the path, must not be null
*/
private final void storeBaseDir(String baseDirName) {
s_log.info("storeBaseDir: BaseDir name is given as " + baseDirName );
m_baseDir = new File(baseDirName);
// temporary: enforce that BaseDir is ROOT!
m_baseDir.renameTo(new File(m_baseDir.getParent(),"ROOT"));
// eventually: check if dir exists, create it if not.
if (!m_baseDir.exists()) {
if (!m_baseDir.mkdirs()) {
throw new IllegalStateException
("Could not create base directory: " + m_baseDir);
}
}
if (!m_baseDir.isDirectory()) {
throw new IllegalStateException
("Base directory value is not a directory: " + m_baseDir);
}
s_log.info("storeBaseDir: BaseDir is stored as " + m_baseDir );
}
/**
* Retrieves the stored BaseDir File object.
*
* @return Base directory location in the servers file system as File object.
*/
private final File fetchBaseDir() {
if (m_baseDir == null) {
// should never happen, but we try to cope with it anyway by
// falling back to getHomeDirectory() and the system wide
// 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");
// eventually: check if dir exists, create it if not.
if (!m_baseDir.exists()) {
if (!m_baseDir.mkdirs()) {
throw new IllegalStateException
("Could not create base directory: " + m_baseDir);
}
}
if (!m_baseDir.isDirectory()) {
throw new IllegalStateException
("Base directory value is not a directory: " + m_baseDir);
}
}
return m_baseDir;
}
/* ************ Private Worker Section END *************** */
}

View File

@ -16,9 +16,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.packaging;
package com.arsdigita.runtime;
import com.arsdigita.runtime.CCM;
// import com.arsdigita.runtime.RegistryConfig;
import com.arsdigita.runtime.CCMResourceManager;
import com.arsdigita.util.Classes;
import com.arsdigita.util.JavaPropertyReader;
import com.arsdigita.util.UncheckedWrapperException;
@ -43,11 +44,13 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* The ConfigRegistry class maps between config classes (subclasses of
* {@link com.arsdigita.runtime.AbstractConfig}), and a location used
* for persisting the values in a config class. The ConfigRegistry
* also stores the set of configured packages for a particular CCM
* instance, and a list of URLs for parent configurations that are
* for persisting the values in a config class.
*
* The ConfigRegistry also stores the set of configured packages for a
* particular CCMResourceManager instance.
* Additionally it stores a list of URLs for parent configurations that are
* used for defaulting values not present in the local configuration.
* This mapping is maintained and extended by CCM developers through
* This mapping is maintained and extended by CCMResourceManager developers through
* the use of an XML configuration file placed in the src tree for a
* particular package. If a particular package is configured, the
* ConfigRegistry class will look in the classpath for a registry
@ -64,10 +67,9 @@ import org.xml.sax.helpers.DefaultHandler;
* &lt;/registry&gt;
* </pre></blockquite>
*
* The mappings stored by this ConfigRegistry will then be extended to
* include the classes and storage locations specified in the
* configuration file. These mappings are then used by the
* ConfigRegistry instance to load config objects.
* The mappings stored by this ConfigRegistry will then be extended to include
* the classes and storage locations specified in the configuration file. These
* mappings are then used by the ConfigRegistry instance to load config objects.
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #15 $ $Date: 2004/08/16 $
@ -75,7 +77,10 @@ import org.xml.sax.helpers.DefaultHandler;
public class ConfigRegistry {
public final static String versionId = "$Id: ConfigRegistry.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
public final static String versionId =
"$Id: ConfigRegistry.java 736 2005-09-01 10:46:05Z sskracic $ " +
"by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger(ConfigRegistry.class);
private URL m_url;
@ -127,7 +132,7 @@ public class ConfigRegistry {
**/
public ConfigRegistry(ClassLoader loader) {
this(CCM.getConfigURL(), loader);
this(CCMResourceManager.getConfigURL(), loader);
}
/**
@ -136,7 +141,7 @@ public class ConfigRegistry {
* ccm.conf system property may or may not include a trailing slash.
**/
public ConfigRegistry() {
this(CCM.getConfigURL());
this(CCMResourceManager.getConfigURL());
}
private void initialize(URL url, ErrorList errs) {

View File

@ -34,10 +34,10 @@ import java.util.Iterator;
/**
* InteractiveParameterLoader
*
* @deprecated
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #7 $ $Date: 2004/08/16 $
*
* @deprecated use {@link InteractiveParameterReader } instead
**/
public final class InteractiveParameterLoader implements ParameterLoader {

View File

@ -0,0 +1,108 @@
/*
* Copyright (C) 2003-2004 Red Hat Inc. 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
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.runtime;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.parameter.ErrorList;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.ParameterInfo;
import com.arsdigita.util.parameter.ParameterReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import org.apache.log4j.Logger;
/**
* InteractiveParameterReader, implementation o ParameterReader which
*
*
* @author Peter Boy &lt;pboy@barkhof.uni-bremen.de&gt; using code by
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #7 $ $Date: 2004/08/16 $
**/
public final class InteractiveParameterReader implements ParameterReader {
public final static String versionId =
"$Id: InteractiveParameterReader.java 287 2005-02-22 00:29:02Z sskracic $" +
" by $Author: sskracic $, " +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger
(InteractiveParameterReader.class);
private final InputStream m_in;
private final PrintStream m_out;
private final BufferedReader m_lines;
public InteractiveParameterReader(InputStream in, PrintStream out) {
m_in = in;
m_out = out;
m_lines = new BufferedReader(new InputStreamReader(m_in));
}
public final String read(final Parameter param, final ErrorList errors) {
if (!param.isRequired()) { return null; }
final Object dephault = param.getDefaultValue();
if (dephault != null) { return null; }
m_out.println("Parameter: " + param.getName());
final ParameterInfo info = param.getInfo();
if (info != null) {
String str = info.getTitle();
if (str != null) {
m_out.println("Title: " + str);
}
str = info.getPurpose();
if (str != null) {
m_out.println("Purpose: " + str);
}
str = info.getExample();
if (str != null) {
m_out.println("Example: " + str);
}
str = info.getFormat();
if (str != null) {
m_out.println("Format: " + str);
}
}
while (true) {
m_out.print("Value: ");
m_out.flush();
try {
final String line = m_lines.readLine();
if (line.equals("")) {
continue;
} else {
return line;
}
} catch (IOException e) {
throw new UncheckedWrapperException(e);
}
}
}
}

View File

@ -19,7 +19,6 @@
package com.arsdigita.runtime;
import com.arsdigita.initializer.Script;
import com.arsdigita.packaging.ConfigRegistry;
import com.arsdigita.util.UncheckedWrapperException;
import java.io.IOException;
import java.io.InputStream;

Some files were not shown because too many files have changed in this diff Show More