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
parent
743ff9b5d4
commit
4ab614055a
|
|
@ -2,7 +2,7 @@
|
||||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
name="ccm-cms"
|
name="ccm-cms"
|
||||||
prettyName="Red Hat CCM Content Management System"
|
prettyName="Red Hat CCM Content Management System"
|
||||||
version="6.5.4"
|
version="6.5.5"
|
||||||
release="1"
|
release="1"
|
||||||
webapp="ROOT">
|
webapp="ROOT">
|
||||||
<ccm:dependencies>
|
<ccm:dependencies>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ public abstract class AbstractItemResolver implements ItemResolver {
|
||||||
protected static final String TEMPLATE_CONTEXT_PREFIX = "tem_";
|
protected static final String TEMPLATE_CONTEXT_PREFIX = "tem_";
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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(
|
public abstract ContentItem getItem(
|
||||||
ContentSection section,
|
ContentSection section,
|
||||||
|
|
@ -43,12 +44,16 @@ public abstract class AbstractItemResolver implements ItemResolver {
|
||||||
String context);
|
String context);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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);
|
public abstract String getCurrentContext(PageState state);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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(
|
public abstract String generateItemURL(
|
||||||
PageState state,
|
PageState state,
|
||||||
|
|
@ -58,7 +63,12 @@ public abstract class AbstractItemResolver implements ItemResolver {
|
||||||
String context);
|
String context);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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(
|
public abstract String generateItemURL(
|
||||||
PageState state,
|
PageState state,
|
||||||
|
|
@ -69,7 +79,11 @@ public abstract class AbstractItemResolver implements ItemResolver {
|
||||||
String templateContext);
|
String templateContext);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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(
|
public abstract String generateItemURL(
|
||||||
PageState state,
|
PageState state,
|
||||||
|
|
@ -78,7 +92,11 @@ public abstract class AbstractItemResolver implements ItemResolver {
|
||||||
String context);
|
String context);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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(
|
public abstract String generateItemURL(
|
||||||
PageState state,
|
PageState state,
|
||||||
|
|
@ -88,9 +106,12 @@ public abstract class AbstractItemResolver implements ItemResolver {
|
||||||
String templateContext);
|
String templateContext);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (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.
|
* 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();
|
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());
|
return templateContext.substring(TEMPLATE_CONTEXT_PREFIX.length());
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,10 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
|
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 =
|
private static Logger s_log =
|
||||||
Logger.getLogger(CMSDispatcher.class);
|
Logger.getLogger(CMSDispatcher.class);
|
||||||
|
|
@ -385,8 +388,8 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
|
||||||
}
|
}
|
||||||
if ( !sm.canAccess(user, SecurityManager.ADMIN_PAGES ) ) {
|
if ( !sm.canAccess(user, SecurityManager.ADMIN_PAGES ) ) {
|
||||||
throw new AccessDeniedException(
|
throw new AccessDeniedException(
|
||||||
"You do not have access to the administrative pages for the " +
|
"You do not have access to the administrative pages for the " +
|
||||||
section.getName() + " content section.");
|
section.getName() + " content section.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -395,8 +398,8 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
|
||||||
if ( !sm.canAccess(user, SecurityManager.PUBLIC_PAGES) &&
|
if ( !sm.canAccess(user, SecurityManager.PUBLIC_PAGES) &&
|
||||||
!LocalRequestPassword.validLocalRequest(request)) {
|
!LocalRequestPassword.validLocalRequest(request)) {
|
||||||
throw new AccessDeniedException(
|
throw new AccessDeniedException(
|
||||||
"You do not have access to the public pages for the " +
|
"You do not have access to the public pages for the " +
|
||||||
section.getName() + " content section.");
|
section.getName() + " content section.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves items to URLs and URLs to items with category-based URLs for multiple language
|
* Resolves items to URLs and URLs to items with category-based URLs for
|
||||||
* variants.
|
* multiple language variants.
|
||||||
*
|
*
|
||||||
* Created Mon Jan 20 14:30:03 2003.
|
* Created Mon Jan 20 14:30:03 2003.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:sseago@redhat.com">Scott Seago</a>
|
* @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
|
public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
implements CategoryItemResolver, TemplateResolver {
|
implements CategoryItemResolver, TemplateResolver {
|
||||||
|
|
@ -138,6 +138,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
* #getCurrentContext}.
|
* #getCurrentContext}.
|
||||||
* @return The content item, or null if no such item exists
|
* @return The content item, or null if no such item exists
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ContentItem getItem(final ContentSection section,
|
public ContentItem getItem(final ContentSection section,
|
||||||
String url,
|
String url,
|
||||||
final String context) {
|
final String context) {
|
||||||
|
|
@ -146,9 +147,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
" at URL '" + url + "' for context " + context);
|
" at URL '" + url + "' for context " + context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertNotNull(section, "ContentSection section");
|
Assert.exists(section, "ContentSection section");
|
||||||
Assert.assertNotNull(url, "String url");
|
Assert.exists(url, "String url");
|
||||||
Assert.assertNotNull(context, "String context");
|
Assert.exists(context, "String context");
|
||||||
url = stripTemplateFromURL(url);
|
url = stripTemplateFromURL(url);
|
||||||
|
|
||||||
if ( ContentItem.DRAFT.equals(context) ||
|
if ( ContentItem.DRAFT.equals(context) ||
|
||||||
|
|
@ -158,7 +159,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
}
|
}
|
||||||
String categoryURL = url.substring(("/"+CATEGORIES_PREFIX).length());
|
String categoryURL = url.substring(("/"+CATEGORIES_PREFIX).length());
|
||||||
Category root = section.getRootCategory();
|
Category root = section.getRootCategory();
|
||||||
Assert.assertNotNull (root);
|
Assert.exists(root);
|
||||||
|
|
||||||
|
|
||||||
String file = null;
|
String file = null;
|
||||||
|
|
@ -191,7 +192,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
cats = root.getChildrenByURL (path + "/" + file);
|
cats = root.getChildrenByURL (path + "/" + file);
|
||||||
if (cats == null) {
|
if (cats == null) {
|
||||||
// final element wasn't category. assume an item.
|
// 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 = new Category[1];
|
||||||
cats[0] = root;
|
cats[0] = root;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -204,7 +207,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertTrue (cats.length >= 1);
|
Assert.isTrue (cats.length >= 1);
|
||||||
Category cat = cats[cats.length-1];
|
Category cat = cats[cats.length-1];
|
||||||
s_log.debug ("Category is " + cat.getDisplayName());
|
s_log.debug ("Category is " + cat.getDisplayName());
|
||||||
String lang = null;
|
String lang = null;
|
||||||
|
|
@ -312,9 +315,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
"' in category '" + category + "'");
|
"' in category '" + category + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertNotNull(itemId, "BigDecimal itemId");
|
Assert.exists(itemId, "BigDecimal itemId");
|
||||||
Assert.assertNotNull(context, "Sring context");
|
Assert.exists(context, "Sring context");
|
||||||
Assert.assertNotNull(section, "ContentSection section");
|
Assert.exists(section, "ContentSection section");
|
||||||
|
|
||||||
if (ContentItem.DRAFT.equals(context)) {
|
if (ContentItem.DRAFT.equals(context)) {
|
||||||
// No template context here.
|
// No template context here.
|
||||||
|
|
@ -332,11 +335,11 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
.newInstance(new OID(ContentItem.BASE_DATA_OBJECT_TYPE,
|
.newInstance(new OID(ContentItem.BASE_DATA_OBJECT_TYPE,
|
||||||
itemId));
|
itemId));
|
||||||
|
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertNotNull(item, "item");
|
Assert.exists(item, "item");
|
||||||
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
|
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
|
||||||
"Generating " + ContentItem.LIVE + " " +
|
"Generating " + ContentItem.LIVE + " " +
|
||||||
"URL; this item must be the live version");
|
"URL; this item must be the live version");
|
||||||
}
|
}
|
||||||
|
|
||||||
return generateLiveURL(section, item, templateContext, category);
|
return generateLiveURL(section, item, templateContext, category);
|
||||||
|
|
@ -392,18 +395,18 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
context + " in category " + category);
|
context + " in category " + category);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertNotNull(item, "ContentItem item");
|
Assert.exists(item, "ContentItem item");
|
||||||
Assert.assertNotNull(context, "String context");
|
Assert.exists(context, "String context");
|
||||||
|
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
section = item.getContentSection();
|
section = item.getContentSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContentItem.DRAFT.equals(context)) {
|
if (ContentItem.DRAFT.equals(context)) {
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()),
|
Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()),
|
||||||
"Generating " + ContentItem.DRAFT +
|
"Generating " + ContentItem.DRAFT +
|
||||||
" url: item must be draft version");
|
" url: item must be draft version");
|
||||||
}
|
}
|
||||||
// CategoryItemResolver doesn't change resolution of
|
// CategoryItemResolver doesn't change resolution of
|
||||||
// back-end URLs
|
// back-end URLs
|
||||||
|
|
@ -411,10 +414,10 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
} else if (CMSDispatcher.PREVIEW.equals(context)) {
|
} else if (CMSDispatcher.PREVIEW.equals(context)) {
|
||||||
return generatePreviewURL(section, item, templateContext, category);
|
return generatePreviewURL(section, item, templateContext, category);
|
||||||
} else if (ContentItem.LIVE.equals(context)) {
|
} else if (ContentItem.LIVE.equals(context)) {
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
|
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
|
||||||
"Generating " + ContentItem.LIVE +
|
"Generating " + ContentItem.LIVE +
|
||||||
" url: item must be live version");
|
" url: item must be live version");
|
||||||
}
|
}
|
||||||
|
|
||||||
return generateLiveURL(section, item, templateContext, category);
|
return generateLiveURL(section, item, templateContext, category);
|
||||||
|
|
@ -436,6 +439,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
* @return The URL of the item
|
* @return The URL of the item
|
||||||
* @see #getCurrentContext
|
* @see #getCurrentContext
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String generateItemURL(final PageState state,
|
public String generateItemURL(final PageState state,
|
||||||
final BigDecimal itemId,
|
final BigDecimal itemId,
|
||||||
final String name,
|
final String name,
|
||||||
|
|
@ -459,6 +463,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
* @return The URL of the item
|
* @return The URL of the item
|
||||||
* @see #getCurrentContext
|
* @see #getCurrentContext
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String generateItemURL(final PageState state,
|
public String generateItemURL(final PageState state,
|
||||||
final BigDecimal itemId,
|
final BigDecimal itemId,
|
||||||
final String name,
|
final String name,
|
||||||
|
|
@ -481,6 +486,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
* @return The URL of the item
|
* @return The URL of the item
|
||||||
* @see #getCurrentContext
|
* @see #getCurrentContext
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String generateItemURL(final PageState state,
|
public String generateItemURL(final PageState state,
|
||||||
final ContentItem item,
|
final ContentItem item,
|
||||||
final ContentSection section,
|
final ContentSection section,
|
||||||
|
|
@ -502,6 +508,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
* @return The URL of the item
|
* @return The URL of the item
|
||||||
* @see #getCurrentContext
|
* @see #getCurrentContext
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String generateItemURL(final PageState state,
|
public String generateItemURL(final PageState state,
|
||||||
final ContentItem item,
|
final ContentItem item,
|
||||||
ContentSection section,
|
ContentSection section,
|
||||||
|
|
@ -638,8 +645,8 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
ContentItem item,
|
ContentItem item,
|
||||||
String templateContext,
|
String templateContext,
|
||||||
Category category) {
|
Category category) {
|
||||||
Assert.assertNotNull(section, "ContentSection section");
|
Assert.exists(section, "ContentSection section");
|
||||||
Assert.assertNotNull(item, "ContentItem item");
|
Assert.exists(item, "ContentItem item");
|
||||||
|
|
||||||
Category urlCategory = getURLCategory(item,category);
|
Category urlCategory = getURLCategory(item,category);
|
||||||
// Use passed-in category, if item is in it, else use default
|
// 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)
|
* Returns the template associated with the item (if any)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String getItemTemplate(ContentSection section,
|
protected String getItemTemplate(ContentSection section,
|
||||||
ContentItem item,
|
ContentItem item,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
|
|
@ -838,6 +846,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver
|
||||||
return encodeAsString().equals(obj.encodeAsString());
|
return encodeAsString().equals(obj.encodeAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return encodeAsString().hashCode();
|
return encodeAsString().hashCode();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,12 @@ import org.apache.log4j.Logger;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* ------- May be outdated. TemplateResolver has been reworked. ----------
|
||||||
* Resolves the JSP template to use for dispatching an
|
* Resolves the JSP template to use for dispatching an
|
||||||
* item. This replaces TemplateResolver since the latter
|
* item. This replaces TemplateResolver since the latter
|
||||||
* has a useless API.
|
* has a useless API.
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*
|
||||||
* <p>In general, the process for resolving a template involves two
|
* <p>In general, the process for resolving a template involves two
|
||||||
* steps:</p>
|
* steps:</p>
|
||||||
*
|
*
|
||||||
|
|
@ -58,8 +61,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
* </ol>
|
* </ol>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DefaultTemplateResolver extends AbstractTemplateResolver
|
public class DefaultTemplateResolver extends AbstractTemplateResolver
|
||||||
implements TemplateResolver {
|
implements TemplateResolver {
|
||||||
|
|
||||||
private static Logger s_log = Logger.getLogger(DefaultTemplateResolver.class);
|
private static Logger s_log = Logger.getLogger(DefaultTemplateResolver.class);
|
||||||
|
|
||||||
|
|
@ -93,7 +96,7 @@ public class DefaultTemplateResolver extends AbstractTemplateResolver
|
||||||
|
|
||||||
template = getDefaultTemplate(section, item, request);
|
template = getDefaultTemplate(section, item, request);
|
||||||
|
|
||||||
Assert.assertNotNull(template, "default template");
|
Assert.exists(template, "default template");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_log.isInfoEnabled()) {
|
if (s_log.isInfoEnabled()) {
|
||||||
|
|
@ -174,7 +177,8 @@ public class DefaultTemplateResolver extends AbstractTemplateResolver
|
||||||
template = manager.getDefaultTemplate(section, type, context, mimeType);
|
template = manager.getDefaultTemplate(section, type, context, mimeType);
|
||||||
} else {
|
} else {
|
||||||
if (s_log.isDebugEnabled()) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ import java.util.StringTokenizer;
|
||||||
* Created Mon Jan 20 14:30:03 2003.
|
* Created Mon Jan 20 14:30:03 2003.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:mhanisch@redhat.com">Michael Hanisch</a>
|
* @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 class MultilingualItemResolver extends AbstractItemResolver implements ItemResolver {
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: MultilingualItemResolver.java 1160 2006-06-13 16:42:30Z apevec $" +
|
"$Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $" +
|
||||||
"$Author: apevec $" +
|
"$Author: pboy $" +
|
||||||
"$DateTime: 2004/08/17 23:15:09 $";
|
"$DateTime: 2004/08/17 23:15:09 $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
|
|
@ -98,12 +98,12 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
" at URL '" + url + "' for context " + context);
|
" at URL '" + url + "' for context " + context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertNotNull(section, "ContentSection section");
|
Assert.exists(section, "ContentSection section");
|
||||||
Assert.assertNotNull(url, "String url");
|
Assert.exists(url, "String url");
|
||||||
Assert.assertNotNull(context, "String context");
|
Assert.exists(context, "String context");
|
||||||
|
|
||||||
Folder rootFolder = section.getRootFolder();
|
Folder rootFolder = section.getRootFolder();
|
||||||
url = stripTemplateFromURL(url);
|
url = stripTemplateFromURL(url);
|
||||||
|
|
||||||
// nothing to do, if root folder is null
|
// nothing to do, if root folder is null
|
||||||
if (rootFolder == null) {
|
if (rootFolder == null) {
|
||||||
|
|
@ -164,8 +164,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
// and return FIXME: Please hack this if there is
|
// and return FIXME: Please hack this if there is
|
||||||
// more graceful solution. [aavetyan]
|
// more graceful solution. [aavetyan]
|
||||||
|
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue
|
Assert.isTrue
|
||||||
(url.indexOf(ITEM_ID) >= 0,
|
(url.indexOf(ITEM_ID) >= 0,
|
||||||
"url must contain parameter " + ITEM_ID);
|
"url must contain parameter " + ITEM_ID);
|
||||||
}
|
}
|
||||||
|
|
@ -300,9 +300,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
context + "' with name '" + name + "'");
|
context + "' with name '" + name + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertNotNull(itemId, "BigDecimal itemId");
|
Assert.exists(itemId, "BigDecimal itemId");
|
||||||
Assert.assertNotNull(context, "Sring context");
|
Assert.exists(context, "String context");
|
||||||
Assert.assertNotNull(section, "ContentSection section");
|
Assert.exists(section, "ContentSection section");
|
||||||
|
|
||||||
if (ContentItem.DRAFT.equals(context)) {
|
if (ContentItem.DRAFT.equals(context)) {
|
||||||
// No template context here.
|
// No template context here.
|
||||||
|
|
@ -314,9 +314,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
} else if (ContentItem.LIVE.equals(context)) {
|
} else if (ContentItem.LIVE.equals(context)) {
|
||||||
ContentItem item = new ContentItem(itemId);
|
ContentItem item = new ContentItem(itemId);
|
||||||
|
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertNotNull(item, "item");
|
Assert.exists(item, "item");
|
||||||
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
|
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
|
||||||
"Generating " + ContentItem.LIVE + " " +
|
"Generating " + ContentItem.LIVE + " " +
|
||||||
"URL; this item must be the live version");
|
"URL; this item must be the live version");
|
||||||
}
|
}
|
||||||
|
|
@ -370,16 +370,16 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertNotNull(item, "ContentItem item");
|
Assert.exists(item, "ContentItem item");
|
||||||
Assert.assertNotNull(context, "String context");
|
Assert.exists(context, "String context");
|
||||||
|
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
section = item.getContentSection();
|
section = item.getContentSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContentItem.DRAFT.equals(context)) {
|
if (ContentItem.DRAFT.equals(context)) {
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()),
|
Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()),
|
||||||
"Generating " + ContentItem.DRAFT +
|
"Generating " + ContentItem.DRAFT +
|
||||||
" url: item must be draft version");
|
" url: item must be draft version");
|
||||||
}
|
}
|
||||||
|
|
@ -388,8 +388,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
} else if (CMSDispatcher.PREVIEW.equals(context)) {
|
} else if (CMSDispatcher.PREVIEW.equals(context)) {
|
||||||
return generatePreviewURL(section, item, templateContext);
|
return generatePreviewURL(section, item, templateContext);
|
||||||
} else if (ContentItem.LIVE.equals(context)) {
|
} else if (ContentItem.LIVE.equals(context)) {
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()),
|
Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()),
|
||||||
"Generating " + ContentItem.LIVE +
|
"Generating " + ContentItem.LIVE +
|
||||||
" url: item must be live version");
|
" url: item must be live version");
|
||||||
}
|
}
|
||||||
|
|
@ -442,10 +442,10 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
" and section " + section);
|
" and section " + section);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue(section != null && itemId != null,
|
Assert.isTrue(section != null && itemId != null,
|
||||||
"get draft url: neither secion nor item " +
|
"get draft url: neither secion nor item " +
|
||||||
"can be null");
|
"can be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
final String url = ContentItemPage.getItemURL
|
final String url = ContentItemPage.getItemURL
|
||||||
|
|
@ -495,7 +495,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
* add template context, if one is given
|
* add template context, if one is given
|
||||||
*/
|
*/
|
||||||
// This is breaking URL's...not sure why it's here. XXX
|
// This is breaking URL's...not sure why it's here. XXX
|
||||||
// this should work with the appropriate logic. trying again.
|
// this should work with the appropriate logic. trying again.
|
||||||
if (!(templateContext == null || templateContext.length() == 0)) {
|
if (!(templateContext == null || templateContext.length() == 0)) {
|
||||||
url.append(TEMPLATE_CONTEXT_PREFIX + templateContext + "/");
|
url.append(TEMPLATE_CONTEXT_PREFIX + templateContext + "/");
|
||||||
}
|
}
|
||||||
|
|
@ -569,8 +569,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
protected String generatePreviewURL(ContentSection section,
|
protected String generatePreviewURL(ContentSection section,
|
||||||
ContentItem item,
|
ContentItem item,
|
||||||
String templateContext) {
|
String templateContext) {
|
||||||
Assert.assertNotNull(section, "ContentSection section");
|
Assert.exists(section, "ContentSection section");
|
||||||
Assert.assertNotNull(item, "ContentItem item");
|
Assert.exists(item, "ContentItem item");
|
||||||
|
|
||||||
final StringBuffer url = new StringBuffer(100);
|
final StringBuffer url = new StringBuffer(100);
|
||||||
url.append(section.getPath());
|
url.append(section.getPath());
|
||||||
|
|
@ -644,9 +644,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
|
|
||||||
// XXX this is wrong: here we abort on not finding the
|
// XXX this is wrong: here we abort on not finding the
|
||||||
// parameter; below we return null.
|
// parameter; below we return null.
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertTrue(pos >= 0,
|
Assert.isTrue(pos >= 0,
|
||||||
"Draft URL must contain parameter " + ITEM_ID);
|
"Draft URL must contain parameter " + ITEM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
String item_id = url.substring(pos); // item_id == ITEM_ID=.... ?
|
String item_id = url.substring(pos); // item_id == ITEM_ID=.... ?
|
||||||
|
|
@ -720,7 +720,12 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
// will have deal with 'foo' folder.
|
// will have deal with 'foo' folder.
|
||||||
|
|
||||||
String name = index > 0 ? url.substring(0, index) : "";
|
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) : "";
|
url = index + 1 < len ? url.substring(index + 1) : "";
|
||||||
|
|
||||||
return getItemFromLiveURL(url, parentFolder);
|
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
|
lang = null; // no extension, so we cannot guess the language
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Assert.isAssertEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.assertNotNull(name, "String name");
|
Assert.exists(name, "String name");
|
||||||
Assert.assertTrue(lang == null || lang.length() == 2);
|
Assert.exists(lang == null || lang.length() == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,25 @@ init com.arsdigita.cms.publishToFile.Initializer {
|
||||||
// "url stub" }'.
|
// "url stub" }'.
|
||||||
// "Content type" is the object type of the content type.
|
// "Content type" is the object type of the content type.
|
||||||
// "Root directory" must be a path to a writable directory, relative
|
// "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"
|
// directory is shared NFS storage, _false_ otherwise. "URL stub"
|
||||||
// must be the path component of the URL from which the live server
|
// must be the path component of the URL from which the live server
|
||||||
// will serve from this directory.
|
// will serve from this directory.
|
||||||
destination = {
|
destination = {
|
||||||
{ "com.arsdigita.cms.ContentItem",
|
{ "com.arsdigita.cms.ContentItem",
|
||||||
"data/p2fs",
|
"p2fs",
|
||||||
false,
|
false,
|
||||||
"/p2fs" },
|
"/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",
|
{ "com.arsdigita.cms.Template",
|
||||||
"webapps/ROOT/packages/content-section/templates",
|
// "webapps/ROOT/packages/content-section/templates",
|
||||||
|
"packages/content-section/templates",
|
||||||
false,
|
false,
|
||||||
"/templates" }
|
"/templates" }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,13 @@ import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.TransactionContext;
|
import com.arsdigita.persistence.TransactionContext;
|
||||||
import com.arsdigita.persistence.metadata.MetadataRoot;
|
import com.arsdigita.persistence.metadata.MetadataRoot;
|
||||||
import com.arsdigita.persistence.metadata.ObjectType;
|
import com.arsdigita.persistence.metadata.ObjectType;
|
||||||
import com.arsdigita.runtime.CCM;
|
import com.arsdigita.runtime.CCMResourceManager;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
|
// import java.io.File;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
@ -47,6 +48,9 @@ import java.util.Iterator;
|
||||||
* Initializes the publish-to-file service. The configuration is described in
|
* Initializes the publish-to-file service. The configuration is described in
|
||||||
* the {@link com.arsdigita.cms.publishToFile} page.
|
* 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)
|
* @author Jeff Teeters (teeters@arsdigita.com)
|
||||||
* @version $Revision: #24 $ $Date: 2004/08/17 $
|
* @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);
|
String contentType = (String)entry.get(0);
|
||||||
|
// destRoot is here relative to webapp root!
|
||||||
String destRoot = (String) entry.get(1);
|
String destRoot = (String) entry.get(1);
|
||||||
Boolean sharedRoot = (Boolean) entry.get(2);
|
Boolean sharedRoot = (Boolean) entry.get(2);
|
||||||
String destURL = (String) entry.get(3);
|
String destURL = (String) entry.get(3);
|
||||||
|
|
@ -267,8 +272,11 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
|
||||||
"' must not end with a '/'");
|
"' 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();
|
destRoot).getPath();
|
||||||
|
s_log.info("Destination Root is set to : " + destRoot);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (sharedRoot == null) {
|
if (sharedRoot == null) {
|
||||||
|
|
@ -299,10 +307,24 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
|
||||||
File file = dest.getFile();
|
File file = dest.getFile();
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
|
s_log.info(file.getPath() + " created");
|
||||||
}
|
}
|
||||||
boolean writable = false;
|
boolean writable = false;
|
||||||
|
FileWriter fl;
|
||||||
|
File fname = new File(file.getPath(),"placeholder.txt");
|
||||||
|
s_log.info("Try to create : " + destRoot);
|
||||||
try {
|
try {
|
||||||
writable = file.canWrite() && file.isDirectory();
|
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 ) {
|
} catch ( SecurityException ex ) {
|
||||||
// Will be reported as an initalization error
|
// 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,
|
// 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
|
// then we're running as ccmadmin inside of ccm load, and there is no
|
||||||
// need to thrown an exception.
|
// need to thrown an exception.
|
||||||
File conf = CCM.getConfigDirectory();
|
File conf = CCMResourceManager.getConfigDirectory();
|
||||||
if (conf.isDirectory() && conf.canWrite()) {
|
if (conf.isDirectory() && conf.canWrite()) {
|
||||||
// we're ok
|
// we're ok
|
||||||
} else {
|
} 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,
|
PublishToFile.addDestination(contentType,
|
||||||
dest);
|
dest);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ public class PublishToFile implements PublishToFileListener {
|
||||||
|
|
||||||
private final PublishedHTMLProvider m_provider;
|
private final PublishedHTMLProvider m_provider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
public PublishToFile() {
|
public PublishToFile() {
|
||||||
m_provider = new HttpHTMLProvider(s_timeout);
|
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".
|
* Returns an extension given a content type. If the content-type is null
|
||||||
* @param contentType Content-Type returned from the request, e.g. text/html;charset=ISO-8859-1
|
* assume "html".
|
||||||
|
* @param contentType Content-Type returned from the request,
|
||||||
|
* e.g. text/html;charset=ISO-8859-1
|
||||||
**/
|
**/
|
||||||
private static String getFileExtension(String contentType) {
|
private static String getFileExtension(String contentType) {
|
||||||
if ( contentType == null || contentType == "" )
|
if ( contentType == null || contentType == "" )
|
||||||
|
|
@ -371,11 +376,13 @@ public class PublishToFile implements PublishToFileListener {
|
||||||
MimeType type = MimeType.loadMimeType(contentType);
|
MimeType type = MimeType.loadMimeType(contentType);
|
||||||
|
|
||||||
if (type == null) {
|
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";
|
return ".html";
|
||||||
} else {
|
} else {
|
||||||
if (s_log.isDebugEnabled()) {
|
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();
|
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 item ContentItem being published.
|
||||||
* @param where Location Folder, where item will be 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
|
// Read 'public' Template in HTML format and write to FS
|
||||||
// It can be either 'deault' or specified template
|
// 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) )
|
if ( !publishPageAtDocRoot(readHTML(publicUrl), where, item, null, host) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -470,7 +479,8 @@ public class PublishToFile implements PublishToFileListener {
|
||||||
final String fileExt = getFileExtension(rf.contentType);
|
final String fileExt = getFileExtension(rf.contentType);
|
||||||
final String html = rf.body;
|
final String html = rf.body;
|
||||||
if (s_log.isDebugEnabled()) {
|
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);
|
scanner.transform(out);
|
||||||
out.close();
|
out.close();
|
||||||
} catch ( IOException ex ) {
|
} 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()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public abstract class SortableList extends List {
|
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 =
|
private static final org.apache.log4j.Logger s_log =
|
||||||
org.apache.log4j.Logger.getLogger(SortableList.class);
|
org.apache.log4j.Logger.getLogger(SortableList.class);
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ import org.apache.log4j.Logger;
|
||||||
* A split pane for the Category Administration UI.
|
* A split pane for the Category Administration UI.
|
||||||
*
|
*
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @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 final class CategoryAdminPane extends BaseAdminPane {
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: CategoryAdminPane.java 287 2005-02-22 00:29:02Z sskracic $" +
|
"$Id: CategoryAdminPane.java 1795 2009-02-07 10:47:32Z pboy $" +
|
||||||
"$Author: sskracic $" +
|
"$Author: pboy $" +
|
||||||
"$DateTime: 2004/08/17 23:15:09 $";
|
"$DateTime: 2004/08/17 23:15:09 $";
|
||||||
|
|
||||||
public static final String CONTEXT_SELECTED="sel_context";
|
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));
|
m_contextModel = new UseContextSelectionModel(new StringParameter(CONTEXT_SELECTED));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Left column */
|
/* Left column */
|
||||||
/* Use context section */
|
/* Use context section */
|
||||||
List list = new List(new CategoryUseContextModelBuilder());
|
List list = new List(new CategoryUseContextModelBuilder());
|
||||||
|
|
@ -102,6 +103,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
|
||||||
m_categoryTree.addChangeListener(new SelectionListener());
|
m_categoryTree.addChangeListener(new SelectionListener());
|
||||||
m_model = m_categoryTree.getSelectionModel();
|
m_model = m_categoryTree.getSelectionModel();
|
||||||
|
|
||||||
|
|
||||||
setSelectionModel(m_model);
|
setSelectionModel(m_model);
|
||||||
setSelector(m_categoryTree);
|
setSelector(m_categoryTree);
|
||||||
|
|
||||||
|
|
@ -111,8 +113,6 @@ public final class CategoryAdminPane extends BaseAdminPane {
|
||||||
ActionGroup contextGroup = new ActionGroup();
|
ActionGroup contextGroup = new ActionGroup();
|
||||||
contextSection.setBody(contextGroup);
|
contextSection.setBody(contextGroup);
|
||||||
contextGroup.setSubject(list);
|
contextGroup.setSubject(list);
|
||||||
|
|
||||||
/* Add use context form to pane */
|
|
||||||
ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context")));
|
ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context")));
|
||||||
Form addContextForm = new AddUseContextForm(m_contextModel);
|
Form addContextForm = new AddUseContextForm(m_contextModel);
|
||||||
getBody().add(addContextForm);
|
getBody().add(addContextForm);
|
||||||
|
|
@ -135,10 +135,6 @@ public final class CategoryAdminPane extends BaseAdminPane {
|
||||||
m_parent = new ParentRequestLocal();
|
m_parent = new ParentRequestLocal();
|
||||||
m_category = new SelectionRequestLocal();
|
m_category = new SelectionRequestLocal();
|
||||||
|
|
||||||
/* Right column */
|
|
||||||
/* Context section aka category details */
|
|
||||||
|
|
||||||
/* Action links */
|
|
||||||
setAdd(gz("cms.ui.category.add"),
|
setAdd(gz("cms.ui.category.add"),
|
||||||
new CategoryAddForm(m_category, m_model));
|
new CategoryAddForm(m_category, m_model));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,12 @@ public final class CategoryCollectionListModel implements ListModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Liest den Namen der Kategorie aus. Angepaßt, damit hier immer
|
* Reads the name of the category.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* 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() {
|
public Object getElement() {
|
||||||
return getCategory().getName("");
|
return getCategory().getName("");
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ import com.arsdigita.dispatcher.AccessDeniedException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* XXX
|
||||||
|
*
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @version $Id: CategoryEditForm.java 287 2005-02-22 00:29:02Z sskracic $
|
* @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 PageState state = e.getPageState();
|
||||||
final Category category = m_category.getCategory(state);
|
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_name.setValue(state, category.getName(""));
|
||||||
m_description.setValue(state, category.getDescription(""));
|
m_description.setValue(state, category.getDescription(""));
|
||||||
m_url.setValue(state, category.getURL(""));
|
m_url.setValue(state, category.getURL(""));
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ import org.apache.log4j.Logger;
|
||||||
* Edits a single category.
|
* Edits a single category.
|
||||||
*
|
*
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
|
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||||
* @version $Id: CategoryItemPane.java 1329 2006-09-27 11:47:05Z sskracic $
|
* @version $Id: CategoryItemPane.java 1329 2006-09-27 11:47:05Z sskracic $
|
||||||
*/
|
*/
|
||||||
class CategoryItemPane extends BaseItemPane {
|
class CategoryItemPane extends BaseItemPane {
|
||||||
|
|
@ -101,7 +102,8 @@ class CategoryItemPane extends BaseItemPane {
|
||||||
add(m_detailPane);
|
add(m_detailPane);
|
||||||
setDefault(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) {
|
public boolean isVisible(PageState state) {
|
||||||
// update for live items only
|
// update for live items only
|
||||||
if (!super.isVisible(state)) {
|
if (!super.isVisible(state)) {
|
||||||
|
|
@ -123,23 +125,32 @@ class CategoryItemPane extends BaseItemPane {
|
||||||
add(orderItemsForm2);
|
add(orderItemsForm2);
|
||||||
|
|
||||||
// Change index item
|
// 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);
|
final Form indexForm = new IndexItemSelectionForm(m_category);
|
||||||
add(indexForm);
|
add(indexForm);
|
||||||
|
|
||||||
ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz("cms.ui.category.view_index_item")),"");
|
ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz(
|
||||||
EditItemLink editIndexLink = new EditItemLink(new Label(gz("cms.ui.category.edit_index_item")),"");
|
"cms.ui.category.view_index_item")),"");
|
||||||
|
EditItemLink editIndexLink = new EditItemLink(new Label(gz(
|
||||||
|
"cms.ui.category.edit_index_item")),"");
|
||||||
|
|
||||||
// Summary
|
// 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
|
// Quasimodo: BEGIN
|
||||||
// Localizations
|
// 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) {
|
public boolean isVisible(PageState state) {
|
||||||
// Only show addLanguage button, if there are langauges to add
|
// Only show addLanguage button, if there are langauges to add
|
||||||
int countSupportedLanguages = (new CategorizationConfig()).getSupportedLanguages().countTokens();
|
int countSupportedLanguages = (
|
||||||
long countLanguages = m_category.getCategory(state).getCategoryLocalizationCollection().size();
|
new CategorizationConfig()).getSupportedLanguages()
|
||||||
|
.countTokens();
|
||||||
|
long countLanguages =
|
||||||
|
m_category.getCategory(state)
|
||||||
|
.getCategoryLocalizationCollection().size();
|
||||||
|
|
||||||
if(countLanguages < countSupportedLanguages) {
|
if(countLanguages < countSupportedLanguages) {
|
||||||
return true;
|
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));
|
m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink));
|
||||||
add(addCategoryLocalizationForm);
|
add(addCategoryLocalizationForm);
|
||||||
connect(addCategoryLocalizationLink, 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
|
* This alternative constructor sets two additional links, allowing
|
||||||
* edit the content index item.
|
* the user to view and edit the content index item.
|
||||||
*/
|
*/
|
||||||
SummarySection(final ActionLink editLink,
|
SummarySection(final ActionLink editLink,
|
||||||
final ActionLink deleteLink,
|
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) {
|
public boolean isVisible(PageState ps) {
|
||||||
Category cat = m_category.getCategory(ps);
|
Category cat = m_category.getCategory(ps);
|
||||||
return PermissionService.getContext(cat) == null;
|
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) {
|
public boolean isVisible(PageState ps) {
|
||||||
Category cat = m_category.getCategory(ps);
|
Category cat = m_category.getCategory(ps);
|
||||||
return PermissionService.getContext(cat) != null;
|
return PermissionService.getContext(cat) != null;
|
||||||
|
|
@ -466,11 +480,13 @@ class CategoryItemPane extends BaseItemPane {
|
||||||
super(c,s);
|
super(c,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the preview link. This uses a standard redirect link to find the content.
|
// Build the preview link. This uses a standard redirect link to find
|
||||||
// The prepareURL method is called by the printwriter
|
// the content. The prepareURL method is called by the printwriter
|
||||||
protected String prepareURL(final PageState state, String location) {
|
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) {
|
if(indexItem==null) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -497,11 +513,17 @@ class CategoryItemPane extends BaseItemPane {
|
||||||
super(c,s);
|
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) {
|
protected String prepareURL(final PageState state, String location) {
|
||||||
boolean canEdit = false;
|
boolean canEdit = false;
|
||||||
ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state).getDirectIndexObject())).getPrimaryInstance();
|
ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state)
|
||||||
|
.getDirectIndexObject()))
|
||||||
|
.getPrimaryInstance();
|
||||||
if(indexItem==null) {
|
if(indexItem==null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -509,12 +531,18 @@ class CategoryItemPane extends BaseItemPane {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
BigDecimal draftID = indexItem.getDraftVersion().getID();
|
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) {
|
public boolean isVisible(PageState state) {
|
||||||
if (!super.isVisible(state)) {
|
if (!super.isVisible(state)) {
|
||||||
return false;
|
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) {
|
private boolean isItemEditable(ContentItem item, PageState state) {
|
||||||
BigDecimal id = item.getID();
|
BigDecimal id = item.getID();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getContext().getUser();
|
||||||
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(), Integer.parseInt(id.toString())));
|
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(),
|
||||||
Iterator permissions = PermissionService.getImpliedPrivileges(ci.getOID(), user.getOID());
|
Integer.parseInt(id.toString())));
|
||||||
|
Iterator permissions = PermissionService.getImpliedPrivileges(
|
||||||
|
ci.getOID(), user.getOID());
|
||||||
while (permissions.hasNext()) {
|
while (permissions.hasNext()) {
|
||||||
PrivilegeDescriptor permission = (PrivilegeDescriptor)permissions.next();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.cms.ui.category;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,18 +36,19 @@ import java.util.StringTokenizer;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erzeugt ein Formular zum Anlegen einer neuen Lokalisierungen zu der aktuellen Kategorie.
|
* Generates a form for creating new localisations for the given category.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* @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 {
|
public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
|
||||||
|
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $" +
|
"$Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||||
"$Author: sskracic $" +
|
"$Author: sskracic $" +
|
||||||
"$DateTime: 2004/08/17 23:15:09 $";
|
"$DateTime: 2004/08/17 23:15:09 $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
(CategoryAddForm.class);
|
(CategoryAddForm.class);
|
||||||
|
|
@ -46,7 +56,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
|
||||||
/** Creates a new instance of CategoryLocalizationAddForm */
|
/** Creates a new instance of CategoryLocalizationAddForm */
|
||||||
public CategoryLocalizationAddForm(final CategoryRequestLocal category) {
|
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());
|
addInitListener(new InitListener());
|
||||||
addProcessListener(new ProcessListener());
|
addProcessListener(new ProcessListener());
|
||||||
|
|
@ -66,9 +77,11 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
|
||||||
final Category category = m_category.getCategory(state);
|
final Category category = m_category.getCategory(state);
|
||||||
|
|
||||||
// Select one entry
|
// 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();
|
CategorizationConfig catConfig = new CategorizationConfig();
|
||||||
StringTokenizer strTok = catConfig.getSupportedLanguages();
|
StringTokenizer strTok = catConfig.getSupportedLanguages();
|
||||||
|
|
||||||
|
|
@ -76,9 +89,11 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
|
||||||
|
|
||||||
String code = strTok.nextToken();
|
String code = strTok.nextToken();
|
||||||
|
|
||||||
// Wenn die Sprache bereits existiert, dann entferne sie aus der Auswahlliste
|
// If lanuage exists, remove it from the selection list
|
||||||
if(!category.getCategoryLocalizationCollection().localizationExists(code)) {
|
if(!category.getCategoryLocalizationCollection().
|
||||||
m_locale.addOption(new Option(code, new Locale(code).getDisplayLanguage()), state);
|
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");
|
//Assert.assertNotNull(parent, "Category parent");
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
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()) {
|
if (category.canEdit()) {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.cms.ui.category;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -22,18 +31,19 @@ import java.util.Locale;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erzeugt ein Formular zum Bearbeiten einer vorhandenen Lokalisierungen zu der aktuellen Kategorie.
|
* Generates a form for editing an existing localisation for the given category.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* @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 {
|
public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||||
|
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: CategoryLocalizationEditForm.java 287 2005-02-22 00:29:02Z sskracic $" +
|
"$Id: CategoryLocalizationEditForm.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||||
"$Author: sskracic $" +
|
"$Author: sskracic $" +
|
||||||
"$DateTime: 2004/08/17 23:15:09 $";
|
"$DateTime: 2004/08/17 23:15:09 $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
(CategoryLocalizationEditForm.class);
|
(CategoryLocalizationEditForm.class);
|
||||||
|
|
@ -46,7 +56,8 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||||
public CategoryLocalizationEditForm(final CategoryRequestLocal category,
|
public CategoryLocalizationEditForm(final CategoryRequestLocal category,
|
||||||
final String locale) {
|
final String locale) {
|
||||||
|
|
||||||
super("EditCategoryLocalization", gz("cms.ui.category.localization.edit"), category);
|
super("EditCategoryLocalization", gz(
|
||||||
|
"cms.ui.category.localization.edit"), category);
|
||||||
|
|
||||||
// Speichere Locale ab
|
// Speichere Locale ab
|
||||||
m_categoryLocalizationLocale = locale;
|
m_categoryLocalizationLocale = locale;
|
||||||
|
|
@ -56,6 +67,9 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* please add: purpose of this class
|
||||||
|
*/
|
||||||
private class InitListener implements FormInitListener {
|
private class InitListener implements FormInitListener {
|
||||||
public final void init(final FormSectionEvent e)
|
public final void init(final FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
@ -63,15 +77,18 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final Category category = m_category.getCategory(state);
|
final Category category = m_category.getCategory(state);
|
||||||
|
|
||||||
// Verstecke Locale-Widget und sperre es (read-only)
|
// Hide Locale-Widget and lock it (read-only)
|
||||||
m_locale.addOption(new Option(m_categoryLocalizationLocale, new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state);
|
m_locale.addOption(new Option(m_categoryLocalizationLocale,
|
||||||
|
new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state);
|
||||||
// m_locale.setValue(state, m_categoryLocalizationLocale);
|
// m_locale.setValue(state, m_categoryLocalizationLocale);
|
||||||
// m_locale.setVisible(state, false);
|
// m_locale.setVisible(state, false);
|
||||||
m_locale.lock();
|
m_locale.lock();
|
||||||
|
|
||||||
m_name.setValue(state, category.getName((String) m_locale.getValue(state)));
|
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)));
|
m_url.setValue(state, category.getURL((String) m_locale.getValue(state)));
|
||||||
|
|
||||||
if (category.isEnabled((String) m_locale.getValue(state))) {
|
if (category.isEnabled((String) m_locale.getValue(state))) {
|
||||||
m_isEnabled.setValue(state, "yes");
|
m_isEnabled.setValue(state, "yes");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -80,6 +97,9 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ##todo: document purpose of this
|
||||||
|
*/
|
||||||
private class ProcessListener implements FormProcessListener {
|
private class ProcessListener implements FormProcessListener {
|
||||||
public final void process(final FormSectionEvent e)
|
public final void process(final FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
@ -88,14 +108,20 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||||
final Category category = m_category.getCategory(state);
|
final Category category = m_category.getCategory(state);
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
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()) {
|
if (category.canEdit()) {
|
||||||
category.setName((String) m_name.getValue(state), (String) m_locale.getValue(state));
|
category.setName((String) m_name.getValue(state),
|
||||||
category.setDescription((String) m_description.getValue(state), (String) m_locale.getValue(state));
|
(String) m_locale.getValue(state));
|
||||||
category.setURL((String) m_url.getValue(state), (String) m_locale.getValue(state));
|
category.setDescription((String) m_description.getValue(state),
|
||||||
category.setEnabled("yes".equals((String) m_isEnabled.getValue(state)), (String) m_locale.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();
|
category.save();
|
||||||
} else {
|
} else {
|
||||||
throw new AccessDeniedException();
|
throw new AccessDeniedException();
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.cms.ui.category;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -34,11 +43,12 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basisklasse für CategoryLocalizationAddForm und CategoryLocalizationEditForm.
|
* Base class for CategoryLocalizationAddForm and 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.
|
|
||||||
*
|
*
|
||||||
* @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 {
|
public class CategoryLocalizationForm extends BaseForm {
|
||||||
|
|
||||||
|
|
@ -48,7 +58,9 @@ public class CategoryLocalizationForm extends BaseForm {
|
||||||
final TextArea m_description;
|
final TextArea m_description;
|
||||||
final TextField m_url;
|
final TextField m_url;
|
||||||
final RadioGroup m_isEnabled;
|
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 LOCALE = "locale";
|
||||||
private final static String NAME = "name";
|
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 URL = "url";
|
||||||
private final static String IS_ENABLED = "isEnabled";
|
private final static String IS_ENABLED = "isEnabled";
|
||||||
|
|
||||||
/** Creates a new instance of CategoryLocalizationForm */
|
/**
|
||||||
|
* Creates a new instance of CategoryLocalizationForm.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public CategoryLocalizationForm(final String key,
|
public CategoryLocalizationForm(final String key,
|
||||||
final GlobalizedMessage heading,
|
final GlobalizedMessage heading,
|
||||||
final CategoryRequestLocal category) {
|
final CategoryRequestLocal category) {
|
||||||
|
|
@ -65,7 +80,7 @@ public class CategoryLocalizationForm extends BaseForm {
|
||||||
|
|
||||||
m_category = category;
|
m_category = category;
|
||||||
|
|
||||||
// Parameter-Model für den SingleSelect
|
// Parameter-Model for SingleSelect
|
||||||
ParameterModel localeParam = new StringParameter(LOCALE);
|
ParameterModel localeParam = new StringParameter(LOCALE);
|
||||||
localeParam.addParameterListener(new StringInRangeValidationListener(0, 2));
|
localeParam.addParameterListener(new StringInRangeValidationListener(0, 2));
|
||||||
|
|
||||||
|
|
@ -145,8 +160,12 @@ public class CategoryLocalizationForm extends BaseForm {
|
||||||
super.generateXML(ps, parent);
|
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 {
|
class NameUniqueListener implements ParameterListener {
|
||||||
private final CategoryRequestLocal m_category;
|
private final CategoryRequestLocal m_category;
|
||||||
private final Widget m_widget;
|
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)
|
public final void validate(final ParameterEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.cms.ui.category;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
|
|
@ -33,11 +42,12 @@ import java.math.BigDecimal;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listet alle vorhandenen Lokalisierungen zu der aktuellen Kategorie auf. Diese Klasse ist Teil
|
* Lists all existing localizations for a selected category.
|
||||||
* der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare um die Formulare für die
|
|
||||||
* Bearbeitung der neuen, mehrsprachigen Kategorien.
|
|
||||||
*
|
*
|
||||||
* @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 {
|
public class CategoryLocalizationTable extends Table implements TableActionListener {
|
||||||
|
|
||||||
|
|
@ -58,17 +68,23 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
|
||||||
m_category = category;
|
m_category = category;
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
|
||||||
// Falls die Tabelle leer ist
|
// if table is empty:
|
||||||
setEmptyView(new Label(GlobalizationUtil.globalize("cms.ui.category.localization.none")));
|
setEmptyView(new Label(GlobalizationUtil.globalize(
|
||||||
|
"cms.ui.category.localization.none")));
|
||||||
TableColumnModel tab_model = getColumnModel();
|
TableColumnModel tab_model = getColumnModel();
|
||||||
|
|
||||||
// Spalten definieren
|
// define columns
|
||||||
// XXX Globalisieren
|
// XXX globalize
|
||||||
tab_model.add(new TableColumn(0, GlobalizationUtil.globalize("cms.ui.category.localization.locale").localize(), TABLE_COL_LANG));
|
tab_model.add(new TableColumn(0, GlobalizationUtil.globalize(
|
||||||
tab_model.add(new TableColumn(1, GlobalizationUtil.globalize("cms.ui.category.localization.name").localize()));
|
"cms.ui.category.localization.locale").localize(), TABLE_COL_LANG));
|
||||||
tab_model.add(new TableColumn(2, GlobalizationUtil.globalize("cms.ui.category.localization.description").localize()));
|
tab_model.add(new TableColumn(1, GlobalizationUtil.globalize(
|
||||||
tab_model.add(new TableColumn(3, GlobalizationUtil.globalize("cms.ui.category.localization.url").localize()));
|
"cms.ui.category.localization.name").localize()));
|
||||||
tab_model.add(new TableColumn(4, GlobalizationUtil.globalize("cms.ui.category.localization.action").localize(), TABLE_COL_DEL));
|
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());
|
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) {
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
final Category category = m_category.getCategory(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 {
|
private class CategoryLocalizationTableModel implements TableModel {
|
||||||
|
|
||||||
final private int MAX_DESC_LENGTH = 25;
|
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
|
* Check collection for the existence of another row.
|
||||||
* value of current CategoryLocalization object into m_categoryLocalization class variable.
|
*
|
||||||
|
* If exists, fetch the value of current CategoryLocalization object
|
||||||
|
* into m_categoryLocalization class variable.
|
||||||
*/
|
*/
|
||||||
public boolean nextRow() {
|
public boolean nextRow() {
|
||||||
|
|
||||||
|
|
@ -139,7 +166,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
|
||||||
return m_categoryLocalization.getName();
|
return m_categoryLocalization.getName();
|
||||||
case 2:
|
case 2:
|
||||||
String desc = m_categoryLocalization.getDescription();
|
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;
|
return desc;
|
||||||
case 3:
|
case 3:
|
||||||
return m_categoryLocalization.getURL();
|
return m_categoryLocalization.getURL();
|
||||||
|
|
@ -172,7 +200,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
|
|
||||||
SecurityManager sm = Utilities.getSecurityManager(state);
|
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(),
|
// boolean canEdit = sm.canAccess(state.getRequest(),
|
||||||
// SecurityManager.DELETE_ITEM,
|
// SecurityManager.DELETE_ITEM,
|
||||||
|
|
@ -198,7 +227,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
|
|
||||||
// SecurityManager sm = Utilities.getSecurityManager(state);
|
// 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(),
|
// boolean canDelete = sm.canAccess(state.getRequest(),
|
||||||
// SecurityManager.DELETE_ITEM,
|
// SecurityManager.DELETE_ITEM,
|
||||||
|
|
@ -206,7 +236,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
|
||||||
// if (canDelete) {
|
// if (canDelete) {
|
||||||
if (true) {
|
if (true) {
|
||||||
ControlLink link = new ControlLink(value.toString());
|
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?");
|
// link.setConfirmation("Delete this localization?");
|
||||||
return link;
|
return link;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -225,7 +256,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe
|
||||||
PageState state = evt.getPageState();
|
PageState state = evt.getPageState();
|
||||||
|
|
||||||
// Get selected CategoryLocalization
|
// Get selected CategoryLocalization
|
||||||
CategoryLocalization categoryLocalization = new CategoryLocalization(new BigDecimal(evt.getRowKey().toString()));
|
CategoryLocalization categoryLocalization =
|
||||||
|
new CategoryLocalization(new BigDecimal(evt.getRowKey().toString()));
|
||||||
|
|
||||||
// Get Category
|
// Get Category
|
||||||
Category category = m_category.getCategory(state);
|
Category category = m_category.getCategory(state);
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,12 @@ import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||||
* @author Michael Pih
|
* @author Michael Pih
|
||||||
* @author Xixi D'moon <xdmoon@redhat.com>
|
* @author Xixi D'moon <xdmoon@redhat.com>
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @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 {
|
class ItemLifecycleSelectForm extends BaseForm {
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: ItemLifecycleSelectForm.java 1563 2007-04-18 15:58:17Z apevec $" +
|
"$Id: ItemLifecycleSelectForm.java 1643 2007-09-17 14:19:06Z chrisg23 $" +
|
||||||
"$Author: apevec $" +
|
"$Author: chrisg23 $" +
|
||||||
"$DateTime: $";
|
"$DateTime: $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ import java.util.Set;
|
||||||
**/
|
**/
|
||||||
public class CMSTask extends UserTask {
|
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 =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.workflow.CMSTask";
|
"com.arsdigita.cms.workflow.CMSTask";
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
name="ccm-core"
|
name="ccm-core"
|
||||||
prettyName="Core"
|
prettyName="Core"
|
||||||
version="6.5.5"
|
version="6.5.6"
|
||||||
release="1"
|
release="1"
|
||||||
webapp="ROOT"
|
webapp="ROOT"
|
||||||
buildHooks="build-hooks.xml">
|
buildHooks="build-hooks.xml">
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.kernel.*;
|
||||||
|
|
||||||
object type Category extends ACSObject {
|
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[0..1] description = cat_categories.description VARCHAR(4000);
|
||||||
String[1..1] name = cat_categories.name VARCHAR(200);
|
String[1..1] name = cat_categories.name VARCHAR(200);
|
||||||
String[0..1] url = cat_categories.url VARCHAR(200);
|
String[0..1] url = cat_categories.url VARCHAR(200);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
-- License along with this library; if not, write to the Free Software
|
-- License along with this library; if not, write to the Free Software
|
||||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
-- 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 $
|
-- $DateTime: 2004/08/16 18:10:38 $
|
||||||
|
|
||||||
@@ oracle-se/function-currentDate.sql
|
@@ oracle-se/function-currentDate.sql
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
-- License along with this library; if not, write to the Free Software
|
-- License along with this library; if not, write to the Free Software
|
||||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
-- 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 $
|
-- $DateTime: 2004/08/16 18:10:38 $
|
||||||
|
|
||||||
create table messages (
|
create table messages (
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
-- License along with this library; if not, write to the Free Software
|
-- License along with this library; if not, write to the Free Software
|
||||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
-- 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 $
|
-- $DateTime: 2004/08/16 18:10:38 $
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
|
|
|
||||||
|
|
@ -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
|
-- This library is free software; you can redistribute it and/or
|
||||||
-- modify it under the terms of the GNU Lesser General Public License
|
-- modify it under the terms of the GNU Lesser General Public License
|
||||||
|
|
|
||||||
|
|
@ -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>
|
<checklist>
|
||||||
|
<!-- type "schema" will be run before the schema for
|
||||||
|
a package is loaded. -->
|
||||||
<checks type="schema">
|
<checks type="schema">
|
||||||
<check class="com.arsdigita.core.LibCheck"/>
|
<check class="com.arsdigita.core.LibCheck"/>
|
||||||
</checks>
|
</checks>
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
<script sql="ccm-core/upgrade/::database::-6.0.0-6.0.1.sql"/>
|
<script sql="ccm-core/upgrade/::database::-6.0.0-6.0.1.sql"/>
|
||||||
</version>
|
</version>
|
||||||
<version from="6.0.1" to="6.1.0">
|
<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 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>
|
||||||
<version from="6.1.0" to="6.1.1">
|
<version from="6.1.0" to="6.1.1">
|
||||||
<script sql="ccm-core/upgrade/::database::-6.1.0-6.1.1.sql"/>
|
<script sql="ccm-core/upgrade/::database::-6.1.0-6.1.1.sql"/>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ public final class Bebop {
|
||||||
public static final BebopConfig getConfig() {
|
public static final BebopConfig getConfig() {
|
||||||
if (s_config == null) {
|
if (s_config == null) {
|
||||||
s_config = new BebopConfig();
|
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;
|
return s_config;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class PropertyEditor extends SimpleContainer {
|
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_forms;
|
||||||
private SequentialMap m_labels;
|
private SequentialMap m_labels;
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,12 @@ import javax.servlet.ServletException;
|
||||||
* is identified by an integer.
|
* is identified by an integer.
|
||||||
*
|
*
|
||||||
* @author David Lutterkort
|
* @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 TableModel
|
||||||
* @see TableColumnModel */
|
* @see TableColumnModel */
|
||||||
public class Table extends BlockStylable implements BebopConstants {
|
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
|
// Names for HTML Attributes
|
||||||
private static final String WIDTH = "width";
|
private static final String WIDTH = "width";
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.bebop.demo;
|
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.Link;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
@ -36,7 +36,10 @@ import org.apache.log4j.Logger;
|
||||||
* */
|
* */
|
||||||
public class AutoDispatcher extends BebopMapDispatcher {
|
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 =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(AutoDispatcher.class);
|
Logger.getLogger(AutoDispatcher.class);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.bebop.demo;
|
package com.arsdigita.bebop.demo;
|
||||||
|
|
||||||
import com.arsdigita.bebop.BebopMapDispatcher;
|
import com.arsdigita.bebop.page.BebopMapDispatcher;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
|
@ -28,7 +28,10 @@ import java.util.HashMap;
|
||||||
*/
|
*/
|
||||||
public class MinimalDispatcher extends BebopMapDispatcher {
|
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. */
|
/** Constructor. Instantiates the subsite url/page mapping. */
|
||||||
public MinimalDispatcher() {
|
public MinimalDispatcher() {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.bebop.demo;
|
package com.arsdigita.bebop.demo;
|
||||||
|
|
||||||
import com.arsdigita.bebop.BebopMapDispatcher;
|
import com.arsdigita.bebop.page.BebopMapDispatcher;
|
||||||
import com.arsdigita.db.ConnectionManager;
|
import com.arsdigita.db.ConnectionManager;
|
||||||
import com.arsdigita.dispatcher.Dispatcher;
|
import com.arsdigita.dispatcher.Dispatcher;
|
||||||
import com.arsdigita.dispatcher.RequestContext;
|
import com.arsdigita.dispatcher.RequestContext;
|
||||||
|
|
@ -41,7 +41,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
*/
|
*/
|
||||||
public class OtherDispatcher extends BebopMapDispatcher {
|
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() {
|
public OtherDispatcher() {
|
||||||
super();
|
super();
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,12 @@ import org.apache.log4j.Logger;
|
||||||
* associated with the <em>package</em> mounted on each site node.
|
* associated with the <em>package</em> mounted on each site node.
|
||||||
*
|
*
|
||||||
* @author Bill Schneider
|
* @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 class PageTransformer implements PresentationManager {
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: PageTransformer.java 1314 2006-09-06 15:47:44Z apevec $" +
|
"$Id: PageTransformer.java 1655 2007-09-18 11:16:54Z chrisg23 $" +
|
||||||
"$Author: apevec $" +
|
"$Author: chrisg23 $" +
|
||||||
"$DateTime: 2004/08/16 18:10:38 $";
|
"$DateTime: 2004/08/16 18:10:38 $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
|
|
|
||||||
|
|
@ -18,20 +18,21 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.bebop.parameters;
|
package com.arsdigita.bebop.parameters;
|
||||||
|
|
||||||
import java.awt.Image;
|
// pboy: unused imports, to be deleted
|
||||||
|
// import java.awt.Image;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
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.FormProcessException;
|
||||||
import com.arsdigita.bebop.event.ParameterListener;
|
// import com.arsdigita.bebop.event.ParameterListener;
|
||||||
import com.arsdigita.bebop.event.ParameterEvent;
|
import com.arsdigita.bebop.event.ParameterEvent;
|
||||||
import com.arsdigita.dispatcher.MultipartHttpServletRequest;
|
import com.arsdigita.dispatcher.MultipartHttpServletRequest;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
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
|
* Verifies that the File is smaller than the specified size in bytes
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,9 @@ import com.arsdigita.bebop.event.ParameterEvent;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies that the
|
* Verifies that the parameter's value is non-empty.
|
||||||
* parameter's value is non-empty. A value is considererd non-empty
|
* A value is considererd non-empty if it exists in the page state,
|
||||||
* if it exists in the page state, and it contains some data besides
|
* and it contains some data besides whitespace.
|
||||||
* whitespace.
|
|
||||||
*
|
*
|
||||||
* @author Karl Goldstein
|
* @author Karl Goldstein
|
||||||
* @author Uday Mathur
|
* @author Uday Mathur
|
||||||
|
|
@ -37,7 +36,10 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
*/
|
*/
|
||||||
public class NotEmptyValidationListener extends GlobalizedParameterListener {
|
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) {
|
public NotEmptyValidationListener(String label) {
|
||||||
setError(new GlobalizedMessage(label, getBundleBaseName()));
|
setError(new GlobalizedMessage(label, getBundleBaseName()));
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ import com.arsdigita.xml.Element;
|
||||||
* of the column headers is clicked.
|
* of the column headers is clicked.
|
||||||
*
|
*
|
||||||
* @author David Lutterkort
|
* @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 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.
|
* The control event when the user clicks on a column header.
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.categorization;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author quasi
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.arsdigita.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
// unused imports
|
||||||
import com.arsdigita.util.Assert;
|
// import com.arsdigita.runtime.RuntimeConfig;
|
||||||
|
// import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.parameter.BooleanParameter;
|
import com.arsdigita.util.parameter.BooleanParameter;
|
||||||
import com.arsdigita.util.parameter.StringParameter;
|
import com.arsdigita.util.parameter.StringParameter;
|
||||||
import com.arsdigita.util.parameter.ErrorList;
|
// import com.arsdigita.util.parameter.ErrorList;
|
||||||
import com.arsdigita.util.parameter.IntegerParameter;
|
// import com.arsdigita.util.parameter.IntegerParameter;
|
||||||
import com.arsdigita.util.parameter.Parameter;
|
import com.arsdigita.util.parameter.Parameter;
|
||||||
import com.arsdigita.util.parameter.ParameterError;
|
// import com.arsdigita.util.parameter.ParameterError;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Map;
|
// import java.util.Map;
|
||||||
import java.util.HashMap;
|
// import java.util.HashMap;
|
||||||
import java.util.Set;
|
// import java.util.Set;
|
||||||
import java.util.HashSet;
|
// 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 final class CategorizationConfig extends AbstractConfig {
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
|
|
@ -46,13 +53,28 @@ public final class CategorizationConfig extends AbstractConfig {
|
||||||
private final Parameter m_showInternalName;
|
private final Parameter m_showInternalName;
|
||||||
private final Parameter m_supportedLanguages;
|
private final Parameter m_supportedLanguages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public Constructor
|
||||||
|
*/
|
||||||
public CategorizationConfig() {
|
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
|
m_showInternalName = new BooleanParameter
|
||||||
("waf.categorization.show_internal_name",
|
("waf.categorization.show_internal_name",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
new Boolean(false));
|
new Boolean(true));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String containing the supported languages. The first one is considered
|
||||||
|
* as default.
|
||||||
|
*/
|
||||||
m_supportedLanguages = new StringParameter
|
m_supportedLanguages = new StringParameter
|
||||||
("waf.categorization.supported_languages",
|
("waf.categorization.supported_languages",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
waf.categorization.show_internal_name.title=Activate output of internal keys for categorization
|
waf.categorization.show_internal_name.title=Activate output of internal keys (labels) 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.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=false
|
waf.categorization.show_internal_name.example=true
|
||||||
waf.categorization.show_internal_name.format=[boolean]
|
waf.categorization.show_internal_name.format=[boolean]
|
||||||
waf.categorization.supported_languages.title=Set the supported languages for categorization
|
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
|
waf.categorization.supported_languages.purpose=Set the supported languages for categorization. First entry is the default language
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,6 @@ public class Category extends ACSObject {
|
||||||
return getName(this.getNegotiatedLocale());
|
return getName(this.getNegotiatedLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the display name of the category. This overrides the parent
|
* Returns the display name of the category. This overrides the parent
|
||||||
* implementation.
|
* implementation.
|
||||||
|
|
@ -729,7 +728,6 @@ public class Category extends ACSObject {
|
||||||
return isEnabled(this.getNegotiatedLocale());
|
return isEnabled(this.getNegotiatedLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the category is enabled.
|
* Sets whether the category is enabled.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.categorization;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
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 {
|
public class CategoryLocalization extends ACSObject {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
package com.arsdigita.categorization;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.kernel.ACSObjectCollection;
|
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.DataCollection;
|
||||||
import com.arsdigita.persistence.DataObject;
|
// import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a collection of categoryLocalizations.
|
* Represents a collection of categoryLocalizations.
|
||||||
|
|
@ -21,6 +33,7 @@ import com.arsdigita.persistence.DataObject;
|
||||||
* Category} and other classes. See, for example, {@link Category#getChildren()}
|
* Category} and other classes. See, for example, {@link Category#getChildren()}
|
||||||
* or {@link Category#getDescendants()}.</p>
|
* or {@link Category#getDescendants()}.</p>
|
||||||
*
|
*
|
||||||
|
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||||
* @author Randy Graebner (randyg@alum.mit.edu)
|
* @author Randy Graebner (randyg@alum.mit.edu)
|
||||||
* @version $Revision: #15 $ $DateTime: 2004/08/16 18:10:38 $
|
* @version $Revision: #15 $ $DateTime: 2004/08/16 18:10:38 $
|
||||||
**/
|
**/
|
||||||
|
|
@ -107,7 +120,8 @@ public class CategoryLocalizationCollection extends ACSObjectCollection {
|
||||||
*/
|
*/
|
||||||
public boolean localizationExists(String locale) {
|
public boolean localizationExists(String locale) {
|
||||||
|
|
||||||
//
|
// Really string comparison using != ??
|
||||||
|
// && !locale.isEmpty() ?
|
||||||
if(!m_dataCollection.isEmpty() && locale != "") {
|
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
|
// First check, if we are already at the right position. This will speed up repeated access for the same locale
|
||||||
|
|
|
||||||
|
|
@ -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 <rhs@mit.edu>
|
|
||||||
* @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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -18,18 +18,38 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.core;
|
package com.arsdigita.core;
|
||||||
|
|
||||||
|
import com.arsdigita.packaging.BaseCheck;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #5 $ $Date: 2004/08/16 $
|
* @version $Revision: #5 $ $Date: 2004/08/16 $
|
||||||
**/
|
*/
|
||||||
|
|
||||||
public class LibCheck extends BaseCheck {
|
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() {
|
private boolean checkJAAS() {
|
||||||
final String classname = "javax.security.auth.Policy";
|
final String classname = "javax.security.auth.Policy";
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
init com.arsdigita.versioning.Initializer { }
|
// init com.arsdigita.versioning.Initializer { }
|
||||||
|
|
||||||
init com.arsdigita.globalization.Initializer {
|
init com.arsdigita.globalization.Initializer {
|
||||||
// See http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc
|
// 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 {
|
init com.arsdigita.search.intermedia.Initializer {
|
||||||
timerDelay = 60; // Parameters for search timer/indexing
|
timerDelay = 60; // Parameters for search timer/indexing
|
||||||
syncDelay = 60; // All units are time in seconds
|
syncDelay = 60; // All units are time in seconds
|
||||||
|
|
@ -50,8 +51,9 @@ init com.arsdigita.search.intermedia.Initializer {
|
||||||
indexingRetryDelay = 60;
|
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 {
|
init com.arsdigita.notification.Initializer {
|
||||||
RequestManagerDelay = 900; // in seconds
|
RequestManagerDelay = 900; // in seconds
|
||||||
RequestManagerPeriod = 900; // in seconds
|
RequestManagerPeriod = 900; // in seconds
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,7 +41,10 @@ import java.util.Set;
|
||||||
|
|
||||||
public class Script {
|
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 =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(Script.class);
|
Logger.getLogger(Script.class);
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,12 @@ public class Kernel {
|
||||||
s_securityConfig = new SecurityConfig();
|
s_securityConfig = new SecurityConfig();
|
||||||
|
|
||||||
s_initialContext.setLocale(Locale.getDefault());
|
s_initialContext.setLocale(Locale.getDefault());
|
||||||
s_config.load("ccm-core/kernel.properties");
|
// deprecated, use load() instead which loads ccm-core/kernel.properties
|
||||||
s_securityConfig.load("ccm-core/security.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() {
|
s_context = new ThreadLocal() {
|
||||||
public Object initialValue() {
|
public Object initialValue() {
|
||||||
return s_initialContext;
|
return s_initialContext;
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,9 @@ public class SecurityConfig extends AbstractConfig {
|
||||||
private final Parameter m_userBanOn = new BooleanParameter
|
private final Parameter m_userBanOn = new BooleanParameter
|
||||||
("waf.user_ban_on", Parameter.REQUIRED, Boolean.FALSE);
|
("waf.user_ban_on", Parameter.REQUIRED, Boolean.FALSE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an empty SecurityConfig object
|
||||||
|
*/
|
||||||
public SecurityConfig() {
|
public SecurityConfig() {
|
||||||
register(m_rootPage);
|
register(m_rootPage);
|
||||||
register(m_loginPage);
|
register(m_loginPage);
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.dispatcher.RedirectException;
|
import com.arsdigita.dispatcher.RedirectException;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
// import com.arsdigita.kernel.KernelHelper;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.kernel.UserAuthentication;
|
import com.arsdigita.kernel.UserAuthentication;
|
||||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
import com.arsdigita.kernel.security.HTTPRequestCallback;
|
// import com.arsdigita.kernel.security.HTTPRequestCallback;
|
||||||
import com.arsdigita.kernel.security.HTTPResponseCallback;
|
// import com.arsdigita.kernel.security.HTTPResponseCallback;
|
||||||
import com.arsdigita.kernel.security.LifetimeCallback;
|
// import com.arsdigita.kernel.security.LifetimeCallback;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
|
|
|
||||||
|
|
@ -18,20 +18,29 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.loader;
|
package com.arsdigita.loader;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.parameter.Parameter;
|
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 com.arsdigita.util.parameter.StringParameter;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MimeTypeRow
|
* MimeTypeRow
|
||||||
|
* A configuration record for MimeTypes
|
||||||
*
|
*
|
||||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #5 $ $Date: 2004/08/16 $
|
* @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
|
private StringParameter m_type = new StringParameter
|
||||||
("waf.mime.type", Parameter.REQUIRED, null);
|
("waf.mime.type", Parameter.REQUIRED, null);
|
||||||
|
|
@ -49,7 +58,7 @@ class MimeTypeRow extends ParameterRecord {
|
||||||
("waf.mime.sizer_or_inso", Parameter.OPTIONAL, null);
|
("waf.mime.sizer_or_inso", Parameter.OPTIONAL, null);
|
||||||
|
|
||||||
public MimeTypeRow() {
|
public MimeTypeRow() {
|
||||||
super("mime-type-row");
|
// super();
|
||||||
register(m_type);
|
register(m_type);
|
||||||
register(m_label);
|
register(m_label);
|
||||||
register(m_extensions);
|
register(m_extensions);
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,21 @@ import com.arsdigita.installer.SQLLoader;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.persistence.Session;
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.runtime.AbstractScript;
|
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.UncheckedWrapperException;
|
||||||
import com.arsdigita.util.config.JavaPropertyLoader;
|
// deprecated, use c.ad.util.JavaPropertyReader instead
|
||||||
import com.arsdigita.util.parameter.CompoundParameterLoader;
|
// import com.arsdigita.util.config.JavaPropertyLoader;
|
||||||
import com.arsdigita.util.parameter.ParameterLoader;
|
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.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
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 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) {
|
public static boolean exists(Connection conn, String table) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -118,10 +131,23 @@ public abstract class PackageLoader extends AbstractScript {
|
||||||
s_log.info("Loading: Done");
|
s_log.info("Loading: Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParameterLoader loader(String[] args) {
|
/**
|
||||||
CompoundParameterLoader result = new CompoundParameterLoader();
|
*
|
||||||
result.add(new JavaPropertyLoader(props(args)));
|
* @param args
|
||||||
result.add(new InteractiveParameterLoader(System.in, System.out));
|
* @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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ import java.util.Date;
|
||||||
*
|
*
|
||||||
* @author Ron Henderson
|
* @author Ron Henderson
|
||||||
* @author David Dao
|
* @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 {
|
public class Notification extends ACSObject implements NotificationConstants {
|
||||||
// Base DataObject type
|
// Base DataObject type
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Assert;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -32,38 +32,51 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #4 $ $Date: 2004/08/16 $
|
* @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 {
|
static {
|
||||||
final InputStream in = BaseCheck.class.getResourceAsStream
|
final InputStream in = BaseCheck.class.getResourceAsStream
|
||||||
("checks.messages_linux");
|
("basecheck.messages_linux");
|
||||||
|
|
||||||
Assert.exists(in, InputStream.class);
|
Assert.exists(in, InputStream.class);
|
||||||
|
|
||||||
s_messages.load(new InputStreamReader(in));
|
s_messages.load(new InputStreamReader(in));
|
||||||
}
|
}
|
||||||
|
|
||||||
static String message(final String key) {
|
public static String message(final String key) {
|
||||||
Assert.exists(key, String.class);
|
Assert.exists(key, String.class);
|
||||||
|
|
||||||
return s_messages.get(key);
|
return s_messages.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintStream m_out = System.out;
|
public PrintStream m_out = System.out;
|
||||||
ClassLoader m_loader =
|
ClassLoader m_loader =
|
||||||
Thread.currentThread().getContextClassLoader();
|
Thread.currentThread().getContextClassLoader();
|
||||||
boolean m_verbose = false;
|
boolean m_verbose = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the ...
|
||||||
|
*
|
||||||
|
* @param classname
|
||||||
|
*/
|
||||||
void printClassLocations(final String classname) {
|
void printClassLocations(final String classname) {
|
||||||
final Iterator urls = getClassURLs(classname).iterator();
|
final Iterator urls = getClassURLs(classname).iterator();
|
||||||
|
|
||||||
|
|
@ -84,10 +97,20 @@ abstract class BaseCheck extends Check {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param classname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List getClassURLs(final String classname) {
|
List getClassURLs(final String classname) {
|
||||||
return getResourceURLs(classname.replace('.', '/') + ".class");
|
return getResourceURLs(classname.replace('.', '/') + ".class");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param resource
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List getResourceURLs(final String resource) {
|
List getResourceURLs(final String resource) {
|
||||||
final ArrayList list = new ArrayList();
|
final ArrayList list = new ArrayList();
|
||||||
|
|
||||||
|
|
@ -104,7 +127,12 @@ abstract class BaseCheck extends Check {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isClassFound(final String classname) {
|
/**
|
||||||
|
*
|
||||||
|
* @param classname
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isClassFound(final String classname) {
|
||||||
if (m_verbose) {
|
if (m_verbose) {
|
||||||
m_out.println("Looking for class " + classname);
|
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) {
|
if (m_verbose) {
|
||||||
m_out.println("Checking for duplicates of " + classname);
|
m_out.println("Checking for duplicates of " + classname);
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,10 @@ import com.arsdigita.runtime.AbstractScript;
|
||||||
|
|
||||||
public abstract class Check extends 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 {
|
public static final class Status {
|
||||||
|
|
||||||
|
|
@ -79,6 +82,7 @@ public abstract class Check extends AbstractScript {
|
||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,26 +16,55 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.db.DbHelper;
|
||||||
import com.arsdigita.packaging.ConfigRegistry;
|
import com.arsdigita.runtime.ConfigRegistry;
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
import com.arsdigita.runtime.RuntimeConfig;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
import com.arsdigita.util.jdbc.Connections;
|
import com.arsdigita.util.jdbc.Connections;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
import java.sql.Connection;
|
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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #7 $ $Date: 2004/08/16 $
|
* @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() {
|
private boolean checkOracleJDBC() {
|
||||||
final String classname = "oracle.jdbc.driver.OracleDriver";
|
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() {
|
private boolean checkDatabaseConnection() {
|
||||||
if (m_verbose) {
|
if (m_verbose) {
|
||||||
m_out.println("Checking that RuntimeConfig is configured");
|
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) {
|
private boolean checkSupportedDatabase(int db) {
|
||||||
if ( db == DbHelper.DB_DEFAULT ) {
|
if ( db == DbHelper.DB_DEFAULT ) {
|
||||||
m_out.println(message("unsupported_database"));
|
m_out.println(message("unsupported_database"));
|
||||||
|
|
@ -120,6 +176,11 @@ public class DBCheck extends BaseCheck {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run method required by the script machinery to make things happen.
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
*/
|
||||||
public void run(ScriptContext ctx) {
|
public void run(ScriptContext ctx) {
|
||||||
int db = DbHelper.getDatabaseFromURL(RuntimeConfig.
|
int db = DbHelper.getDatabaseFromURL(RuntimeConfig.
|
||||||
getConfig().getJDBCURL());
|
getConfig().getJDBCURL());
|
||||||
|
|
@ -39,7 +39,10 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
class Checklist {
|
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) {
|
public static Checklist get(String pkg) {
|
||||||
ClassLoader ldr = Checklist.class.getClassLoader();
|
ClassLoader ldr = Checklist.class.getClassLoader();
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
package com.arsdigita.packaging;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.ConfigRegistry;
|
||||||
import com.arsdigita.util.parameter.Parameter;
|
import com.arsdigita.util.parameter.Parameter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -31,6 +32,9 @@ import org.apache.commons.cli.PosixParser;
|
||||||
/**
|
/**
|
||||||
* Clear
|
* Clear
|
||||||
*
|
*
|
||||||
|
* Implements the command line interface to clear one or more values
|
||||||
|
* in a CCM configuration database (registry)
|
||||||
|
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @version $Id: Clear.java 736 2005-09-01 10:46:05Z sskracic $
|
* @version $Id: Clear.java 736 2005-09-01 10:46:05Z sskracic $
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,10 @@ import org.apache.commons.cli.Options;
|
||||||
|
|
||||||
abstract class Command {
|
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_name;
|
||||||
private String m_summary;
|
private String m_summary;
|
||||||
|
|
@ -72,7 +75,8 @@ abstract class Command {
|
||||||
|
|
||||||
static void usage(Options options, PrintStream out, String command,String args) {
|
static void usage(Options options, PrintStream out, String command,String args) {
|
||||||
String str;
|
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) {
|
if (args == null) {
|
||||||
str = command;
|
str = command;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -81,7 +85,8 @@ abstract class Command {
|
||||||
|
|
||||||
HelpFormatter fmt = new HelpFormatter();
|
HelpFormatter fmt = new HelpFormatter();
|
||||||
PrintWriter w = new PrintWriter(out);
|
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();
|
w.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
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.Classes;
|
||||||
import com.arsdigita.util.JavaPropertyWriter;
|
import com.arsdigita.util.JavaPropertyWriter;
|
||||||
import com.arsdigita.util.parameter.ErrorList;
|
import com.arsdigita.util.parameter.ErrorList;
|
||||||
|
|
@ -34,7 +35,11 @@ import java.util.Map;
|
||||||
import java.util.Properties;
|
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.
|
* This class is <strong>not</strong> supported API.
|
||||||
*
|
*
|
||||||
|
|
@ -44,10 +49,17 @@ import java.util.Properties;
|
||||||
|
|
||||||
public final class Config extends ParameterMap {
|
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;
|
private ConfigRegistry m_reg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor, creates an Config object
|
||||||
|
* @param reg
|
||||||
|
**/
|
||||||
public Config(ConfigRegistry reg) {
|
public Config(ConfigRegistry reg) {
|
||||||
m_reg = reg;
|
m_reg = reg;
|
||||||
|
|
||||||
|
|
@ -59,6 +71,10 @@ public final class Config extends ParameterMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param errs
|
||||||
|
**/
|
||||||
void load(ErrorList errs) {
|
void load(ErrorList errs) {
|
||||||
for (Iterator it = getContexts().iterator(); it.hasNext(); ) {
|
for (Iterator it = getContexts().iterator(); it.hasNext(); ) {
|
||||||
ParameterContext ctx = (ParameterContext) it.next();
|
ParameterContext ctx = (ParameterContext) it.next();
|
||||||
|
|
@ -79,20 +95,26 @@ public final class Config extends ParameterMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void save() throws IOException {
|
public final void save() throws IOException {
|
||||||
save(CCM.getConfigDirectory());
|
save(CCMResourceManager.getConfigDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void save(File conf) throws IOException {
|
/**
|
||||||
if (!conf.exists()) {
|
* Write the config parameter to the file system.
|
||||||
throw new IOException("no such directory: " + conf);
|
*
|
||||||
|
* @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()) {
|
if (confDir.isFile()) {
|
||||||
throw new IOException("expecting directory: " + conf);
|
throw new IOException("expecting directory: " + confDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!conf.canWrite()) {
|
if (!confDir.canWrite()) {
|
||||||
throw new IOException("cannot write to directory: " + conf);
|
throw new IOException("cannot write to directory: " + confDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap stores = new HashMap();
|
HashMap stores = new HashMap();
|
||||||
|
|
@ -113,7 +135,7 @@ public final class Config extends ParameterMap {
|
||||||
String storage = (String) me.getKey();
|
String storage = (String) me.getKey();
|
||||||
Properties props = (Properties) me.getValue();
|
Properties props = (Properties) me.getValue();
|
||||||
if (props.size() == 0) { continue; }
|
if (props.size() == 0) { continue; }
|
||||||
File file = new File(conf, storage);
|
File file = new File(confDir, storage);
|
||||||
File dir = file.getParentFile();
|
File dir = file.getParentFile();
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
if (!(dir.exists() && dir.isDirectory())) {
|
if (!(dir.exists() && dir.isDirectory())) {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
package com.arsdigita.packaging;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.ConfigRegistry;
|
||||||
import com.arsdigita.util.JavaPropertyWriter;
|
import com.arsdigita.util.JavaPropertyWriter;
|
||||||
import com.arsdigita.util.parameter.Parameter;
|
import com.arsdigita.util.parameter.Parameter;
|
||||||
import com.arsdigita.util.parameter.ParameterWriter;
|
import com.arsdigita.util.parameter.ParameterWriter;
|
||||||
|
|
@ -40,13 +41,21 @@ import org.apache.commons.cli.PosixParser;
|
||||||
/**
|
/**
|
||||||
* Get
|
* 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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #6 $ $Date: 2004/08/16 $
|
* @version $Revision: #6 $ $Date: 2004/08/16 $
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class Get extends Command {
|
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();
|
private static final Options OPTIONS = getOptions();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ package com.arsdigita.packaging;
|
||||||
|
|
||||||
class Help extends Command {
|
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() {
|
public Help() {
|
||||||
super("--help", "Print generic help");
|
super("--help", "Print generic help");
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
package com.arsdigita.packaging;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.ConfigRegistry;
|
||||||
import com.arsdigita.util.Files;
|
import com.arsdigita.util.Files;
|
||||||
import com.arsdigita.util.StringUtils;
|
import com.arsdigita.util.StringUtils;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
|
@ -37,7 +38,12 @@ import org.apache.commons.cli.PosixParser;
|
||||||
import org.apache.log4j.Logger;
|
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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #16 $ $Date: 2004/08/16 $
|
* @version $Revision: #16 $ $Date: 2004/08/16 $
|
||||||
|
|
@ -45,7 +51,10 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class HostInit {
|
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 =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(HostInit.class);
|
Logger.getLogger(HostInit.class);
|
||||||
|
|
@ -141,6 +150,8 @@ public class HostInit {
|
||||||
err("unable to create system: " + system);
|
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();
|
ConfigRegistry reg = new ConfigRegistry();
|
||||||
List packages = reg.getPackages();
|
List packages = reg.getPackages();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
package com.arsdigita.packaging;
|
||||||
|
|
||||||
import com.arsdigita.core.DBCheck;
|
|
||||||
import com.arsdigita.loader.PackageLoader;
|
import com.arsdigita.loader.PackageLoader;
|
||||||
import com.arsdigita.persistence.ConnectionSource;
|
import com.arsdigita.persistence.ConnectionSource;
|
||||||
import com.arsdigita.persistence.DedicatedConnectionSource;
|
import com.arsdigita.persistence.DedicatedConnectionSource;
|
||||||
|
|
@ -27,14 +26,24 @@ import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.metadata.MetadataRoot;
|
import com.arsdigita.persistence.metadata.MetadataRoot;
|
||||||
import com.arsdigita.persistence.pdl.PDLCompiler;
|
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.RuntimeConfig;
|
||||||
import com.arsdigita.runtime.Startup;
|
import com.arsdigita.runtime.Startup;
|
||||||
import com.arsdigita.util.JavaPropertyReader;
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
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.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.Parameter;
|
||||||
import com.arsdigita.util.parameter.ParameterContext;
|
import com.arsdigita.util.parameter.ParameterContext;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
|
@ -64,7 +73,11 @@ import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.commons.cli.PosixParser;
|
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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #29 $ $Date: 2004/08/16 $
|
* @version $Revision: #29 $ $Date: 2004/08/16 $
|
||||||
|
|
@ -72,7 +85,10 @@ import org.apache.commons.cli.PosixParser;
|
||||||
|
|
||||||
class Load extends Command {
|
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();
|
private static final Options OPTIONS = getOptions();
|
||||||
|
|
||||||
|
|
@ -216,7 +232,7 @@ class Load extends Command {
|
||||||
ParameterMap contexts = new ParameterMap();
|
ParameterMap contexts = new ParameterMap();
|
||||||
|
|
||||||
Properties parameters = new Properties();
|
Properties parameters = new Properties();
|
||||||
CompoundParameterLoader loader = new CompoundParameterLoader();
|
CompoundParameterReader cpr = new CompoundParameterReader();
|
||||||
if (line.hasOption("parameter-file")) {
|
if (line.hasOption("parameter-file")) {
|
||||||
String file = line.getOptionValue("parameter-file");
|
String file = line.getOptionValue("parameter-file");
|
||||||
try {
|
try {
|
||||||
|
|
@ -227,15 +243,19 @@ class Load extends Command {
|
||||||
System.err.println(e.getMessage());
|
System.err.println(e.getMessage());
|
||||||
return false;
|
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")) {
|
if (line.hasOption("parameters")) {
|
||||||
Properties props = props(line.getOptionValues("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);
|
parameters.putAll(props);
|
||||||
}
|
}
|
||||||
if (line.hasOption("interactive")) {
|
if (line.hasOption("interactive")) {
|
||||||
loader.add(new InteractiveParameterLoader(System.in, System.out));
|
cpr.add(new InteractiveParameterReader(System.in, System.out));
|
||||||
}
|
}
|
||||||
|
|
||||||
Config config = null;
|
Config config = null;
|
||||||
|
|
@ -288,9 +308,10 @@ class Load extends Command {
|
||||||
Session ssn = null;
|
Session ssn = null;
|
||||||
if (all || line.hasOption("schema") || line.hasOption("data")) {
|
if (all || line.hasOption("schema") || line.hasOption("data")) {
|
||||||
|
|
||||||
Check dbcheck = new DBCheck();
|
Check checkdb = new CheckDB();
|
||||||
dbcheck.run(null);
|
checkdb.run(null);
|
||||||
if (dbcheck.getStatus() == null || dbcheck.getStatus().equals(Check.FAIL)) {
|
if (checkdb.getStatus() == null
|
||||||
|
|| checkdb.getStatus().equals(Check.FAIL)) {
|
||||||
rollbackConfig(config,packages);
|
rollbackConfig(config,packages);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +398,7 @@ class Load extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < sorted.length; i++) {
|
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++) {
|
for (int i = 0; i < pkgs.length; i++) {
|
||||||
boolean isnew = false;
|
boolean isnew = false;
|
||||||
for (int j = 0; j < packages.size(); j++) {
|
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;
|
isnew = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ import com.arsdigita.runtime.ScriptContext;
|
||||||
import com.arsdigita.runtime.Startup;
|
import com.arsdigita.runtime.Startup;
|
||||||
import com.arsdigita.util.Classes;
|
import com.arsdigita.util.Classes;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
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.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
@ -48,6 +50,9 @@ import org.apache.log4j.Logger;
|
||||||
/**
|
/**
|
||||||
* Loader
|
* Loader
|
||||||
*
|
*
|
||||||
|
* Helper class for load which actually performs the loading of
|
||||||
|
* the database schema and of the initial content.
|
||||||
|
*
|
||||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #13 $ $Date: 2004/08/16 $
|
* @version $Revision: #13 $ $Date: 2004/08/16 $
|
||||||
**/
|
**/
|
||||||
|
|
@ -56,7 +61,10 @@ class Loader {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
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";
|
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();
|
final List inits = m_info.getProvidedInitializers();
|
||||||
CompoundInitializer ini = new CompoundInitializer();
|
CompoundInitializer ini = new CompoundInitializer();
|
||||||
for (Iterator it = inits.iterator(); it.hasNext(); ) {
|
for (Iterator it = inits.iterator(); it.hasNext(); ) {
|
||||||
|
|
@ -140,7 +151,8 @@ class Loader {
|
||||||
TransactionContext txn = ssn.getTransactionContext();
|
TransactionContext txn = ssn.getTransactionContext();
|
||||||
txn.beginTxn();
|
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() {
|
new KernelExcursion() {
|
||||||
protected void excurse() {
|
protected void excurse() {
|
||||||
setEffectiveParty(Kernel.getSystemParty());
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
@ -194,6 +206,7 @@ class Loader {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "<loader for " + m_key + ">";
|
return "<loader for " + m_key + ">";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,18 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
/**
|
/**
|
||||||
* LoaderInfo
|
* LoaderInfo
|
||||||
*
|
*
|
||||||
|
* Helper class:
|
||||||
|
*
|
||||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #6 $ $Date: 2004/08/16 $
|
* @version $Revision: #6 $ $Date: 2004/08/16 $
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class LoaderInfo {
|
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_requiredTables = new ArrayList();
|
||||||
private List m_providedTables = new ArrayList();
|
private List m_providedTables = new ArrayList();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,17 @@ import java.util.Map;
|
||||||
import org.apache.log4j.Logger;
|
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 <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @version $Id: MasterTool.java 1169 2006-06-14 13:08:25Z fabrice $
|
* @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.
|
* 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
|
* @param args the command line arguments
|
||||||
**/
|
*/
|
||||||
|
|
||||||
public static final void main(final String[] args) {
|
public static final void main(final String[] args) {
|
||||||
final PrintStream out = System.out;
|
final PrintStream out = System.out;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ import java.util.Map;
|
||||||
|
|
||||||
class Menu {
|
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 {
|
static final class Layout {
|
||||||
private Layout() {}
|
private Layout() {}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Assert;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
@ -27,12 +27,15 @@ import java.util.HashMap;
|
||||||
import org.apache.log4j.Logger;
|
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.
|
* Subject to change.
|
||||||
*
|
*
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @version $Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*/
|
*/
|
||||||
final class MessageMap {
|
public final class MessageMap {
|
||||||
public static final String versionId =
|
public static final String versionId =
|
||||||
"$Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $" +
|
"$Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||||
"$Author: sskracic $" +
|
"$Author: sskracic $" +
|
||||||
|
|
@ -48,7 +48,10 @@ import java.util.Properties;
|
||||||
|
|
||||||
class ParameterEditor {
|
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 ParameterMap m_map;
|
||||||
private BufferedReader m_in;
|
private BufferedReader m_in;
|
||||||
|
|
@ -352,7 +355,7 @@ class ParameterEditor {
|
||||||
// XXX: for testing
|
// XXX: for testing
|
||||||
public static final void main(String[] args) {
|
public static final void main(String[] args) {
|
||||||
ParameterMap map = new ParameterMap();
|
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.web.WebConfig());
|
||||||
map.addContext(new com.arsdigita.kernel.KernelConfig());
|
map.addContext(new com.arsdigita.kernel.KernelConfig());
|
||||||
ParameterEditor pe = new ParameterEditor(map, System.in, System.out);
|
ParameterEditor pe = new ParameterEditor(map, System.in, System.out);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ import java.util.Map;
|
||||||
|
|
||||||
class ParameterMap {
|
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_contexts = new ArrayList();
|
||||||
private List m_parameters = new ArrayList();
|
private List m_parameters = new ArrayList();
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
package com.arsdigita.packaging;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.ConfigRegistry;
|
||||||
import com.arsdigita.util.JavaPropertyReader;
|
import com.arsdigita.util.JavaPropertyReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
@ -31,13 +32,21 @@ import org.apache.commons.cli.PosixParser;
|
||||||
/**
|
/**
|
||||||
* Set
|
* 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 <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #7 $ $Date: 2004/08/16 $
|
* @version $Revision: #7 $ $Date: 2004/08/16 $
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class Set extends Command {
|
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();
|
private static final Options OPTIONS = getOptions();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
package com.arsdigita.packaging;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.RegistryConfig;
|
||||||
import com.arsdigita.persistence.Session;
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
|
|
@ -32,7 +33,10 @@ import com.arsdigita.runtime.Startup;
|
||||||
|
|
||||||
class Status extends Command {
|
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() {
|
public Status() {
|
||||||
super("status", "Report on the status of a CCM instance");
|
super("status", "Report on the status of a CCM instance");
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.packaging;
|
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.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
@ -38,7 +39,10 @@ import org.apache.commons.cli.PosixParser;
|
||||||
|
|
||||||
class Unload extends Command {
|
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();
|
private static final Options OPTIONS = new Options();
|
||||||
|
|
||||||
|
|
@ -80,7 +84,7 @@ class Unload extends Command {
|
||||||
|
|
||||||
if (line.hasOption("config")) {
|
if (line.hasOption("config")) {
|
||||||
// XXX: This just deletes everything.
|
// XXX: This just deletes everything.
|
||||||
File conf = CCM.getConfigDirectory();
|
File conf = CCMResourceManager.getConfigDirectory();
|
||||||
File[] files = conf.listFiles(new FileFilter() {
|
File[] files = conf.listFiles(new FileFilter() {
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
return !EXCLUDE.contains(file.getName());
|
return !EXCLUDE.contains(file.getName());
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ package com.arsdigita.packaging;
|
||||||
|
|
||||||
class Usage extends Command {
|
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() {
|
public Usage() {
|
||||||
super("--usage", "Print this message");
|
super("--usage", "Print this message");
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.runtime;
|
package com.arsdigita.runtime;
|
||||||
|
|
||||||
import com.arsdigita.packaging.ConfigRegistry;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.util.parameter.ErrorList;
|
import com.arsdigita.util.parameter.ErrorList;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
|
||||||
|
|
@ -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 <jross@redhat.com>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 <jross@redhat.com>
|
||||||
|
* rewritten by
|
||||||
|
* @author pboy <pboy@barkhof.uni-bremen.de>
|
||||||
|
* @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 *************** */
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,9 +16,10 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Classes;
|
||||||
import com.arsdigita.util.JavaPropertyReader;
|
import com.arsdigita.util.JavaPropertyReader;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
@ -43,11 +44,13 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
/**
|
/**
|
||||||
* The ConfigRegistry class maps between config classes (subclasses of
|
* The ConfigRegistry class maps between config classes (subclasses of
|
||||||
* {@link com.arsdigita.runtime.AbstractConfig}), and a location used
|
* {@link com.arsdigita.runtime.AbstractConfig}), and a location used
|
||||||
* for persisting the values in a config class. The ConfigRegistry
|
* for persisting the values in a config class.
|
||||||
* also stores the set of configured packages for a particular CCM
|
*
|
||||||
* instance, and a list of URLs for parent configurations that are
|
* 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.
|
* 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
|
* the use of an XML configuration file placed in the src tree for a
|
||||||
* particular package. If a particular package is configured, the
|
* particular package. If a particular package is configured, the
|
||||||
* ConfigRegistry class will look in the classpath for a registry
|
* ConfigRegistry class will look in the classpath for a registry
|
||||||
|
|
@ -64,10 +67,9 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
* </registry>
|
* </registry>
|
||||||
* </pre></blockquite>
|
* </pre></blockquite>
|
||||||
*
|
*
|
||||||
* The mappings stored by this ConfigRegistry will then be extended to
|
* The mappings stored by this ConfigRegistry will then be extended to include
|
||||||
* include the classes and storage locations specified in the
|
* the classes and storage locations specified in the configuration file. These
|
||||||
* configuration file. These mappings are then used by the
|
* mappings are then used by the ConfigRegistry instance to load config objects.
|
||||||
* ConfigRegistry instance to load config objects.
|
|
||||||
*
|
*
|
||||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #15 $ $Date: 2004/08/16 $
|
* @version $Revision: #15 $ $Date: 2004/08/16 $
|
||||||
|
|
@ -75,7 +77,10 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
public class ConfigRegistry {
|
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 static final Logger s_log = Logger.getLogger(ConfigRegistry.class);
|
||||||
|
|
||||||
private URL m_url;
|
private URL m_url;
|
||||||
|
|
@ -127,7 +132,7 @@ public class ConfigRegistry {
|
||||||
**/
|
**/
|
||||||
|
|
||||||
public ConfigRegistry(ClassLoader loader) {
|
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.
|
* ccm.conf system property may or may not include a trailing slash.
|
||||||
**/
|
**/
|
||||||
public ConfigRegistry() {
|
public ConfigRegistry() {
|
||||||
this(CCM.getConfigURL());
|
this(CCMResourceManager.getConfigURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(URL url, ErrorList errs) {
|
private void initialize(URL url, ErrorList errs) {
|
||||||
|
|
@ -34,10 +34,10 @@ import java.util.Iterator;
|
||||||
/**
|
/**
|
||||||
* InteractiveParameterLoader
|
* InteractiveParameterLoader
|
||||||
*
|
*
|
||||||
* @deprecated
|
|
||||||
*
|
|
||||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Revision: #7 $ $Date: 2004/08/16 $
|
* @version $Revision: #7 $ $Date: 2004/08/16 $
|
||||||
|
*
|
||||||
|
* @deprecated use {@link InteractiveParameterReader } instead
|
||||||
**/
|
**/
|
||||||
|
|
||||||
public final class InteractiveParameterLoader implements ParameterLoader {
|
public final class InteractiveParameterLoader implements ParameterLoader {
|
||||||
|
|
|
||||||
|
|
@ -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 <pboy@barkhof.uni-bremen.de> using code by
|
||||||
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
package com.arsdigita.runtime;
|
package com.arsdigita.runtime;
|
||||||
|
|
||||||
import com.arsdigita.initializer.Script;
|
import com.arsdigita.initializer.Script;
|
||||||
import com.arsdigita.packaging.ConfigRegistry;
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue