- Einige static initalizer (static {...} Blöcke in ccm-cms::com.arsdigita.cms.dispatcher.BaseAsset und ccm-cms-assets-relatedlink::com.arsdigita.cms.contentassets.ui.RelatedLinkPropertyForm entfernt

- Alle anderen static initalizers haben jetzt am Anfang und Ende eine Log-Ausgabe (Level debug), in Klassen die bisher keinen Logger hatten wurde ein Logger eingebaut
- log4j.properties in ccm-core enthält jetzt vorbereitetet, auskommentierte Zeilen für alle Klassen mit static Blöcken


git-svn-id: https://svn.libreccm.org/ccm/trunk@748 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-02-13 12:16:13 +00:00
parent 0a96c0fed6
commit 32aec3251d
116 changed files with 3574 additions and 3168 deletions

View File

@ -22,6 +22,7 @@ import com.arsdigita.web.Application;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import org.apache.log4j.Logger;
/** /**
@ -31,10 +32,13 @@ import com.arsdigita.domain.DataObjectNotFoundException;
*/ */
public class HTTPAuth extends Application { public class HTTPAuth extends Application {
private static final Logger logger = Logger.getLogger(HTTPAuth.class);
private static HTTPAuthConfig s_config = new HTTPAuthConfig(); private static HTTPAuthConfig s_config = new HTTPAuthConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static HTTPAuthConfig getConfig() { public static HTTPAuthConfig getConfig() {

View File

@ -15,7 +15,6 @@
* 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
*/ */
package com.arsdigita.auth.http; package com.arsdigita.auth.http;
import com.arsdigita.util.parameter.Converters; import com.arsdigita.util.parameter.Converters;
@ -43,29 +42,27 @@ import java.io.InputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import org.apache.log4j.Logger;
public class HTTPAuthConfig extends AbstractConfig { public class HTTPAuthConfig extends AbstractConfig {
private static final Logger logger = Logger.getLogger(HTTPAuthConfig.class);
static { static {
logger.debug("Static initalizer starting...");
Converters.set(Inet4AddressRange.class, Converters.set(Inet4AddressRange.class,
new Inet4AddressRangeConvertor()); new Inet4AddressRangeConvertor());
logger.debug("Static initalizer finished.");
} }
private BooleanParameter m_isActive; private BooleanParameter m_isActive;
private BooleanParameter m_isDebugMode; private BooleanParameter m_isDebugMode;
private IntegerParameter m_nonceTTL; private IntegerParameter m_nonceTTL;
private StringParameter m_serverName; private StringParameter m_serverName;
private IntegerParameter m_serverPort; private IntegerParameter m_serverPort;
private Inet4AddressRangeParameter m_clientIPRange; private Inet4AddressRangeParameter m_clientIPRange;
private StringParameter m_keyAlias; private StringParameter m_keyAlias;
private StringParameter m_keyCypher; private StringParameter m_keyCypher;
private StringParameter m_keyPassword; private StringParameter m_keyPassword;
private StringParameter m_keystorePassword; private StringParameter m_keystorePassword;
private StringParameter m_keystorePath; private StringParameter m_keystorePath;
@ -90,11 +87,13 @@ public class HTTPAuthConfig extends AbstractConfig {
// XXX bz108251 // XXX bz108251
//Parameter.REQUIRED, //Parameter.REQUIRED,
null); null);
m_serverPort = new IntegerParameter("com.arsdigita.auth.http.server_port", m_serverPort = new IntegerParameter(
"com.arsdigita.auth.http.server_port",
Parameter.OPTIONAL, Parameter.OPTIONAL,
new Integer(80)); new Integer(80));
m_clientIPRange = new Inet4AddressRangeParameter("com.arsdigita.auth.http.client_ip_range", m_clientIPRange = new Inet4AddressRangeParameter(
"com.arsdigita.auth.http.client_ip_range",
Parameter.OPTIONAL, Parameter.OPTIONAL,
// XXX bz108251 // XXX bz108251
//Parameter.REQUIRED, //Parameter.REQUIRED,
@ -106,19 +105,22 @@ public class HTTPAuthConfig extends AbstractConfig {
m_keyCypher = new StringParameter("com.arsdigita.auth.http.key_cypher", m_keyCypher = new StringParameter("com.arsdigita.auth.http.key_cypher",
Parameter.OPTIONAL, Parameter.OPTIONAL,
"RSA"); "RSA");
m_keyPassword = new StringParameter("com.arsdigita.auth.http.key_password", m_keyPassword = new StringParameter(
"com.arsdigita.auth.http.key_password",
Parameter.OPTIONAL, Parameter.OPTIONAL,
// XXX bz108251 // XXX bz108251
//Parameter.REQUIRED, //Parameter.REQUIRED,
null); null);
m_keystorePassword = new StringParameter("com.arsdigita.auth.http.keystore_password", m_keystorePassword = new StringParameter(
"com.arsdigita.auth.http.keystore_password",
Parameter.OPTIONAL, Parameter.OPTIONAL,
// XXX bz108251 // XXX bz108251
//Parameter.REQUIRED, //Parameter.REQUIRED,
null); null);
m_keystorePath = new StringParameter("com.arsdigita.auth.http.keystore_path", m_keystorePath = new StringParameter(
"com.arsdigita.auth.http.keystore_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
// XXX bz108251 // XXX bz108251
//Parameter.REQUIRED, //Parameter.REQUIRED,
@ -153,35 +155,35 @@ public class HTTPAuthConfig extends AbstractConfig {
} }
public final int getNonceTTL() { public final int getNonceTTL() {
return ((Integer)get(m_nonceTTL)).intValue(); return ((Integer) get(m_nonceTTL)).intValue();
} }
public final String getServerName() { public final String getServerName() {
return (String)get(m_serverName); return (String) get(m_serverName);
} }
public final int getServerPort() { public final int getServerPort() {
return ((Integer)get(m_serverPort)).intValue(); return ((Integer) get(m_serverPort)).intValue();
} }
public final Inet4AddressRange getClientIPRange() { public final Inet4AddressRange getClientIPRange() {
return (Inet4AddressRange)get(m_clientIPRange); return (Inet4AddressRange) get(m_clientIPRange);
} }
public final String getKeyAlias() { public final String getKeyAlias() {
return (String)get(m_keyAlias); return (String) get(m_keyAlias);
} }
public final String getKeyCypher() { public final String getKeyCypher() {
return (String)get(m_keyCypher); return (String) get(m_keyCypher);
} }
public final String getKeyPassword() { public final String getKeyPassword() {
return (String)get(m_keyPassword); return (String) get(m_keyPassword);
} }
public final String getKeyStorePassword() { public final String getKeyStorePassword() {
return (String)get(m_keystorePassword); return (String) get(m_keystorePassword);
} }
// Package protected, since we won't neccessarily always // Package protected, since we won't neccessarily always
@ -190,7 +192,6 @@ public class HTTPAuthConfig extends AbstractConfig {
return (String) get(m_keystorePath); return (String) get(m_keystorePath);
} }
public final InputStream getKeyStoreStream() { public final InputStream getKeyStoreStream() {
String file = getKeyStorePath(); String file = getKeyStorePath();
@ -222,16 +223,15 @@ public class HTTPAuthConfig extends AbstractConfig {
store.load(is, getKeyStorePassword().toCharArray()); store.load(is, getKeyStorePassword().toCharArray());
} catch (IOException ex) { } catch (IOException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot load keystore from " + "cannot load keystore from " + getKeyStorePath(), ex);
getKeyStorePath(), ex);
} catch (CertificateException ex) { } catch (CertificateException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot load keystore certificates from " + "cannot load keystore certificates from "
getKeyStorePath(), ex); + getKeyStorePath(), ex);
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot check integrity of keystore " + "cannot check integrity of keystore " + getKeyStorePath(),
getKeyStorePath(), ex); ex);
} }
return store; return store;
} }
@ -244,8 +244,8 @@ public class HTTPAuthConfig extends AbstractConfig {
cert = keystore.getCertificate(getKeyAlias()); cert = keystore.getCertificate(getKeyAlias());
} catch (KeyStoreException ex) { } catch (KeyStoreException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot get public key from keystore " + "cannot get public key from keystore " + getKeyStorePath(),
getKeyStorePath(), ex); ex);
} }
Assert.exists(cert, Certificate.class); Assert.exists(cert, Certificate.class);
@ -262,31 +262,33 @@ public class HTTPAuthConfig extends AbstractConfig {
getKeyPassword().toCharArray()); getKeyPassword().toCharArray());
} catch (KeyStoreException ex) { } catch (KeyStoreException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot get private key from keystore " + "cannot get private key from keystore " + getKeyStorePath(),
getKeyStorePath(), ex); ex);
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot get private key from keystore " + "cannot get private key from keystore " + getKeyStorePath(),
getKeyStorePath(), ex); ex);
} catch (UnrecoverableKeyException ex) { } catch (UnrecoverableKeyException ex) {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"cannot get private key from keystore " + "cannot get private key from keystore " + getKeyStorePath(),
getKeyStorePath(), ex); ex);
} }
Assert.exists(key, Key.class); Assert.exists(key, Key.class);
return (PrivateKey)key; return (PrivateKey) key;
} }
private static class Inet4AddressRangeConvertor implements Converter { private static class Inet4AddressRangeConvertor implements Converter {
public Object convert(Class type, public Object convert(Class type,
Object value) { Object value) {
return Inet4AddressRange.getByName((String)value); return Inet4AddressRange.getByName((String) value);
} }
} }
private static class Inet4AddressRangeParameter extends AbstractParameter { private static class Inet4AddressRangeParameter extends AbstractParameter {
public Inet4AddressRangeParameter(final String name) { public Inet4AddressRangeParameter(final String name) {
super(name, Inet4AddressRange.class); super(name, Inet4AddressRange.class);
} }
@ -296,6 +298,5 @@ public class HTTPAuthConfig extends AbstractConfig {
final Object defaalt) { final Object defaalt) {
super(name, multiplicity, defaalt, Inet4AddressRange.class); super(name, multiplicity, defaalt, Inet4AddressRange.class);
} }
} }
} }

View File

@ -135,6 +135,7 @@ public class HTTPLoginModule extends MappingLoginModule {
private static PublicKey s_publicKey = null; private static PublicKey s_publicKey = null;
static { static {
s_log.debug("Static initalizer starting...");
if (HTTPAuth.getConfig().isActive()) { if (HTTPAuth.getConfig().isActive()) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Loading public key"); s_log.debug("Loading public key");
@ -145,6 +146,7 @@ public class HTTPLoginModule extends MappingLoginModule {
s_log.info("HTTP auth is not active"); s_log.info("HTTP auth is not active");
} }
} }
s_log.debug("Static initalizer finished.");
} }
private static BASE64Decoder s_base64Decoder = new BASE64Decoder(); private static BASE64Decoder s_base64Decoder = new BASE64Decoder();

View File

@ -50,7 +50,9 @@ public class FileAttachment extends FileAsset {
private static final FileAttachmentConfig s_config = new FileAttachmentConfig(); private static final FileAttachmentConfig s_config = new FileAttachmentConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }

View File

@ -15,7 +15,6 @@
* 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
*/ */
package com.arsdigita.cms.contentassets; package com.arsdigita.cms.contentassets;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
@ -51,18 +50,18 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
public static final String IMAGE_ATTACHMENTS = "imageAttachments"; public static final String IMAGE_ATTACHMENTS = "imageAttachments";
public static final String ITEM_ATTACHMENTS = "itemAttachments"; public static final String ITEM_ATTACHMENTS = "itemAttachments";
public static final String IMAGE_LINK = "imageLink"; public static final String IMAGE_LINK = "imageLink";
/** Data object type for this domain object */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE =
= "com.arsdigita.cms.contentassets.ItemImageAttachment"; "com.arsdigita.cms.contentassets.ItemImageAttachment";
private static final Logger s_log = Logger.getLogger(
private static final Logger s_log ItemImageAttachment.class);
= Logger.getLogger(ItemImageAttachment.class); private static final ItemImageAttachmentConfig s_config =
new ItemImageAttachmentConfig();
private static final ItemImageAttachmentConfig s_config = new ItemImageAttachmentConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
private ItemImageAttachment() { private ItemImageAttachment() {
@ -81,57 +80,60 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
return BASE_DATA_OBJECT_TYPE; return BASE_DATA_OBJECT_TYPE;
} }
public ItemImageAttachment( ContentItem item, ReusableImageAsset image ) { public ItemImageAttachment(ContentItem item, ReusableImageAsset image) {
this(); this();
set( ITEM, item ); set(ITEM, item);
set( IMAGE, image ); set(IMAGE, image);
} }
public static ItemImageAttachment retrieve( OID oid ) { public static ItemImageAttachment retrieve(OID oid) {
return (ItemImageAttachment) DomainObjectFactory.newInstance( oid ); return (ItemImageAttachment) DomainObjectFactory.newInstance(oid);
} }
public static ItemImageAttachmentConfig getConfig() { public static ItemImageAttachmentConfig getConfig() {
return s_config; return s_config;
} }
public ReusableImageAsset getImage() { public ReusableImageAsset getImage() {
if( s_log.isDebugEnabled() ) if (s_log.isDebugEnabled()) {
s_log.debug( "Getting image for " + getOID() ); s_log.debug("Getting image for " + getOID());
DataObject dobj = (DataObject) get( IMAGE );
Assert.exists( dobj );
return (ReusableImageAsset) DomainObjectFactory.newInstance( dobj );
} }
public void setImage( ReusableImageAsset image ) { DataObject dobj = (DataObject) get(IMAGE);
Assert.exists( image, ReusableImageAsset.class ); Assert.exists(dobj);
set( IMAGE, image );
return (ReusableImageAsset) DomainObjectFactory.newInstance(dobj);
}
public void setImage(ReusableImageAsset image) {
Assert.exists(image, ReusableImageAsset.class);
set(IMAGE, image);
} }
public ContentItem getItem() { public ContentItem getItem() {
DataObject dobj = (DataObject) get( ITEM ); DataObject dobj = (DataObject) get(ITEM);
Assert.exists( dobj ); Assert.exists(dobj);
return (ContentItem) DomainObjectFactory.newInstance( dobj ); return (ContentItem) DomainObjectFactory.newInstance(dobj);
} }
public void setItem( ContentItem item ) { public void setItem(ContentItem item) {
Assert.exists( item, ContentItem.class ); Assert.exists(item, ContentItem.class);
set( ITEM, item ); set(ITEM, item);
} }
/** Retrieves links for a content item */ /** Retrieves links for a content item */
public static DataCollection getImageAttachments( ContentItem item ) { public static DataCollection getImageAttachments(ContentItem item) {
Assert.exists( item, ContentItem.class ); Assert.exists(item, ContentItem.class);
if( s_log.isDebugEnabled() ) if (s_log.isDebugEnabled()) {
s_log.debug("Getting attachments for " + item.getOID() ); s_log.debug("Getting attachments for " + item.getOID());
}
DataCollection attachments = SessionManager.getSession().retrieve DataCollection attachments = SessionManager.getSession().retrieve(
( BASE_DATA_OBJECT_TYPE ); BASE_DATA_OBJECT_TYPE);
attachments.addEqualsFilter( ITEM + ".id", item.getID() ); attachments.addEqualsFilter(ITEM + ".id", item.getID());
return attachments; return attachments;
} }
@ -144,52 +146,50 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
return (String) get(USE_CONTEXT); return (String) get(USE_CONTEXT);
} }
public void setCaption( String caption ) { public void setCaption(String caption) {
set( CAPTION, caption ); set(CAPTION, caption);
} }
public String getCaption() { public String getCaption() {
return (String) get( CAPTION ); return (String) get(CAPTION);
} }
public void setTitle( String title ) { public void setTitle(String title) {
set( TITLE, title ); set(TITLE, title);
} }
public String getTitle() { public String getTitle() {
return (String) get( TITLE ); return (String) get(TITLE);
} }
public void setDescription( String description) { public void setDescription(String description) {
set( DESCRIPTION, description ); set(DESCRIPTION, description);
} }
public String getDescription() { public String getDescription() {
return (String) get( DESCRIPTION ); return (String) get(DESCRIPTION);
} }
/** /**
* Automatically publish an unpublished image * Automatically publish an unpublished image
*/ */
public boolean copyProperty( final CustomCopy source, public boolean copyProperty(final CustomCopy source,
final Property property, final Property property,
final ItemCopier copier ) { final ItemCopier copier) {
String attribute = property.getName(); String attribute = property.getName();
if( ItemCopier.VERSION_COPY == copier.getCopyType() && if (ItemCopier.VERSION_COPY == copier.getCopyType() && IMAGE.equals(
IMAGE.equals( attribute ) ) attribute)) {
{
ItemImageAttachment attachment = (ItemImageAttachment) source; ItemImageAttachment attachment = (ItemImageAttachment) source;
ReusableImageAsset image = attachment.getImage(); ReusableImageAsset image = attachment.getImage();
ReusableImageAsset liveImage = ReusableImageAsset liveImage =
(ReusableImageAsset) image.getLiveVersion(); (ReusableImageAsset) image.getLiveVersion();
if( null == liveImage ) { if (null == liveImage) {
liveImage = (ReusableImageAsset) image.createLiveVersion(); liveImage = (ReusableImageAsset) image.createLiveVersion();
} }
setImage( liveImage ); setImage(liveImage);
return true; return true;
} }
@ -197,31 +197,30 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
} }
// chris gilbert - optional link // chris gilbert - optional link
public Link getLink() { public Link getLink() {
Link link = null; Link link = null;
DataObject dobj = (DataObject) get( IMAGE_LINK ); DataObject dobj = (DataObject) get(IMAGE_LINK);
if (dobj != null) { if (dobj != null) {
link = (Link) DomainObjectFactory.newInstance( dobj ); link = (Link) DomainObjectFactory.newInstance(dobj);
} }
return link; return link;
} }
public void setLink( Link link ) { public void setLink(Link link) {
Assert.exists( link, Link.class ); Assert.exists(link, Link.class);
set( IMAGE_LINK, link ); set(IMAGE_LINK, link);
} }
public void removeLink() { public void removeLink() {
// when we delete the link, the image still references it in DB // when we delete the link, the image still references it in DB
// can't make it composite because then image is deleted if we delete // can't make it composite because then image is deleted if we delete
// link. Have to set link to null first (I think) // link. Have to set link to null first (I think)
DomainObject link = DomainObjectFactory.newInstance((DataObject)get(IMAGE_LINK)); DomainObject link = DomainObjectFactory.newInstance((DataObject) get(
set (IMAGE_LINK, null); IMAGE_LINK));
set(IMAGE_LINK, null);
save(); save();
link.delete(); link.delete();
} }
} }

View File

@ -45,6 +45,7 @@ public class Note extends ACSObject {
private static final Logger s_log = Logger.getLogger( Note.class ); private static final Logger s_log = Logger.getLogger( Note.class );
static { static {
s_log.debug("Static initalizer is starting...");
DomainObjectFactory.registerInstantiator( DomainObjectFactory.registerInstantiator(
BASE_DATA_OBJECT_TYPE, BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() { new DomainObjectInstantiator() {
@ -58,6 +59,8 @@ public class Note extends ACSObject {
} }
} }
); );
s_log.debug("Static initalizer finished.");
} }
public static final String CONTENT = "content"; public static final String CONTENT = "content";

View File

@ -49,13 +49,9 @@ import com.arsdigita.util.Assert;
*/ */
public class RelatedLinkPropertyForm extends LinkPropertyForm { public class RelatedLinkPropertyForm extends LinkPropertyForm {
private static boolean isHideAdditionalResourceFields; private static boolean isHideAdditionalResourceFields = ContentSection.getConfig().isHideAdditionalResourceFields();
private String m_linkListName = ""; private String m_linkListName = "";
static {
isHideAdditionalResourceFields = ContentSection.getConfig().isHideAdditionalResourceFields();
}
/** /**
* Creates a new form to edit the RelatedLink object specified * Creates a new form to edit the RelatedLink object specified
* by the item selection model passed in. * by the item selection model passed in.

View File

@ -95,7 +95,9 @@ public class Event extends GenericArticle {
private static final EventConfig s_config = new EventConfig(); private static final EventConfig s_config = new EventConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
public static final EventConfig getConfig() { public static final EventConfig getConfig() {

View File

@ -24,10 +24,8 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger;
/** /**
* This content type represents a GlossaryItem. * This content type represents a GlossaryItem.
@ -36,44 +34,46 @@ import java.math.BigDecimal;
*/ */
public class GlossaryItem extends ContentPage { public class GlossaryItem extends ContentPage {
private static final Logger logger = Logger.getLogger(GlossaryItem.class);
/** PDL property name for definition */ /** PDL property name for definition */
public static final String DEFINITION = "definition"; public static final String DEFINITION = "definition";
/** Data object type for this domain object */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE =
= "com.arsdigita.cms.contenttypes.GlossaryItem"; "com.arsdigita.cms.contenttypes.GlossaryItem";
private static GlossaryItemConfig config = new GlossaryItemConfig(); private static GlossaryItemConfig config = new GlossaryItemConfig();
static { static {
logger.debug("Static initalizer starting...");
config.load(); config.load();
logger.debug("Static initalizer finished.");
} }
public static GlossaryItemConfig getConfig() { public static GlossaryItemConfig getConfig() {
return config; return config;
} }
public GlossaryItem() { public GlossaryItem() {
this( BASE_DATA_OBJECT_TYPE ); this(BASE_DATA_OBJECT_TYPE);
} }
public GlossaryItem( BigDecimal id ) public GlossaryItem(BigDecimal id)
throws DataObjectNotFoundException { throws DataObjectNotFoundException {
this( new OID( BASE_DATA_OBJECT_TYPE, id ) ); this(new OID(BASE_DATA_OBJECT_TYPE, id));
} }
public GlossaryItem( OID id ) public GlossaryItem(OID id)
throws DataObjectNotFoundException { throws DataObjectNotFoundException {
super( id ); super(id);
} }
public GlossaryItem( DataObject obj ) { public GlossaryItem(DataObject obj) {
super( obj ); super(obj);
} }
public GlossaryItem( String type ) { public GlossaryItem(String type) {
super( type ); super(type);
} }
public void beforeSave() { public void beforeSave() {
super.beforeSave(); super.beforeSave();
@ -82,16 +82,15 @@ public class GlossaryItem extends ContentPage {
/* accessors *****************************************************/ /* accessors *****************************************************/
public String getDefinition() { public String getDefinition() {
return (String) get( DEFINITION ); return (String) get(DEFINITION);
} }
public void setDefinition( String definition ) { public void setDefinition(String definition) {
set( DEFINITION, definition ); set(DEFINITION, definition);
} }
// Search stuff to allow the content type to be searchable // Search stuff to allow the content type to be searchable
public String getSearchSummary() { public String getSearchSummary() {
return getDefinition(); return getDefinition();
} }
} }

View File

@ -62,7 +62,9 @@ public class HealthCareFacility extends GenericOrganization {
* Called when the class is loaded by the Java class loader. * Called when the class is loaded by the Java class loader.
*/ */
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
/** /**

View File

@ -64,7 +64,9 @@ public class MultiPartArticle extends ContentPage {
private static MultiPartArticleConfig s_config = new MultiPartArticleConfig(); private static MultiPartArticleConfig s_config = new MultiPartArticleConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
public static MultiPartArticleConfig getConfig() { public static MultiPartArticleConfig getConfig() {

View File

@ -28,6 +28,7 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import org.apache.log4j.Logger;
/** /**
* <p><code>DomainObject</code> class to represent news item <code>ContentType</code> * <p><code>DomainObject</code> class to represent news item <code>ContentType</code>
@ -57,6 +58,7 @@ import java.util.Date;
**/ **/
public class NewsItem extends GenericArticle { public class NewsItem extends GenericArticle {
private static final Logger logger = Logger.getLogger(NewsItem.class);
/** PDL property name for lead */ /** PDL property name for lead */
public static final String LEAD = "lead"; public static final String LEAD = "lead";
/** PDL property name for news date */ /** PDL property name for news date */
@ -69,7 +71,9 @@ public class NewsItem extends GenericArticle {
private static final NewsItemConfig s_config = new NewsItemConfig(); private static final NewsItemConfig s_config = new NewsItemConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static final NewsItemConfig getConfig() { public static final NewsItemConfig getConfig() {

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
@ -42,6 +41,7 @@ import java.math.BigDecimal;
**/ **/
public class SimpleAddress extends ContentPage { public class SimpleAddress extends ContentPage {
private static final Logger logger = Logger.getLogger(SimpleAddress.class);
/** PDL property name for address */ /** PDL property name for address */
public static final String ADDRESS = "address"; public static final String ADDRESS = "address";
/** PDL property name for country iso code */ /** PDL property name for country iso code */
@ -60,17 +60,19 @@ public class SimpleAddress extends ContentPage {
public static final String NOTES = "notes"; public static final String NOTES = "notes";
/** PDL property name for URI*/ /** PDL property name for URI*/
public static final String URI = "uri"; public static final String URI = "uri";
/** Data object type for this domain object */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE =
= "com.arsdigita.cms.contenttypes.Address"; "com.arsdigita.cms.contenttypes.Address";
private static final SimpleAddressConfig s_config =
new SimpleAddressConfig();
private static final SimpleAddressConfig s_config = new SimpleAddressConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finisheds. .");
} }
public static final SimpleAddressConfig getConfig()
{ public static final SimpleAddressConfig getConfig() {
return s_config; return s_config;
} }
@ -139,92 +141,91 @@ public class SimpleAddress extends ContentPage {
} }
/* accessors *****************************************************/ /* accessors *****************************************************/
public String getAddress( ) { public String getAddress() {
return ( String ) get( ADDRESS ); return (String) get(ADDRESS);
} }
public void setAddress( String address ) { public void setAddress(String address) {
set( ADDRESS, address ); set(ADDRESS, address);
} }
public String getCountryIsoCode( ) { public String getCountryIsoCode() {
DataObject obj = ( DataObject ) get( ISO_COUNTRY_CODE ); DataObject obj = (DataObject) get(ISO_COUNTRY_CODE);
if ( obj != null ) { if (obj != null) {
IsoCountry country = new IsoCountry( obj ); IsoCountry country = new IsoCountry(obj);
return country.getIsoCode( ); return country.getIsoCode();
} }
return null; return null;
} }
public void setCountryIsoCode( String isoCode ) { public void setCountryIsoCode(String isoCode) {
IsoCountry assn = null; IsoCountry assn = null;
try { try {
OID oid = new OID( IsoCountry.BASE_DATA_OBJECT_TYPE ); OID oid = new OID(IsoCountry.BASE_DATA_OBJECT_TYPE);
oid.set( IsoCountry.ISO_CODE, isoCode ); oid.set(IsoCountry.ISO_CODE, isoCode);
assn = new IsoCountry( oid ); assn = new IsoCountry(oid);
} catch (DataObjectNotFoundException e) { } catch (DataObjectNotFoundException e) {
assn = new IsoCountry( ); assn = new IsoCountry();
assn.setIsoCode( isoCode ); assn.setIsoCode(isoCode);
assn.save(); assn.save();
} }
setAssociation( ISO_COUNTRY_CODE, assn ); setAssociation(ISO_COUNTRY_CODE, assn);
} }
public String getPostalCode( ) { public String getPostalCode() {
return ( String ) get( POSTAL_CODE ); return (String) get(POSTAL_CODE);
} }
public void setPostalCode( String postalCode ) { public void setPostalCode(String postalCode) {
set( POSTAL_CODE, postalCode ); set(POSTAL_CODE, postalCode);
} }
public String getPhone( ) { public String getPhone() {
return ( String ) get( PHONE ); return (String) get(PHONE);
} }
public void setPhone( String phone ) { public void setPhone(String phone) {
set( PHONE, phone ); set(PHONE, phone);
} }
public String getMobile( ) { public String getMobile() {
return ( String ) get( MOBILE ); return (String) get(MOBILE);
} }
public void setMobile( String mobile ) { public void setMobile(String mobile) {
set( MOBILE, mobile ); set(MOBILE, mobile);
} }
public String getFax( ) { public String getFax() {
return ( String ) get( FAX ); return (String) get(FAX);
} }
public void setFax( String fax ) { public void setFax(String fax) {
set( FAX, fax ); set(FAX, fax);
} }
public String getEmail( ) { public String getEmail() {
return ( String ) get( EMAIL ); return (String) get(EMAIL);
} }
public void setEmail( String email ) { public void setEmail(String email) {
set( EMAIL, email ); set(EMAIL, email);
} }
public String getNotes( ) { public String getNotes() {
return ( String ) get( NOTES ); return (String) get(NOTES);
} }
public void setNotes( String notes ) { public void setNotes(String notes) {
set( NOTES, notes ); set(NOTES, notes);
} }
public void setURI( String uri) { public void setURI(String uri) {
set(URI, uri); set(URI, uri);
} }
public String getURI() { public String getURI() {
return (String)get(URI); return (String) get(URI);
} }
} }

View File

@ -62,7 +62,9 @@ public class SiteProxyPanel extends ContentPanel {
private static URLPool s_pool = new URLPool(); private static URLPool s_pool = new URLPool();
static { static {
s_log.debug("Static initalizer starting...");
URLFetcher.registerService(s_cacheServiceKey, s_pool, s_cache); URLFetcher.registerService(s_cacheServiceKey, s_pool, s_cache);
s_log.debug("Static initalizer finished.");
}; };
public SiteProxyPanel() { public SiteProxyPanel() {

View File

@ -20,6 +20,7 @@ import com.arsdigita.kernel.User;
import com.arsdigita.persistence.metadata.Property; import com.arsdigita.persistence.metadata.Property;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.util.Date; import java.util.Date;
import org.apache.log4j.Logger;
/** /**
* A survey content type that represents a survey. This is partially based on * A survey content type that represents a survey. This is partially based on
@ -50,9 +51,13 @@ public class Survey extends ContentPage implements XMLGenerator {
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Survey"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Survey";
/* Config */ /* Config */
private static final SurveyConfig s_config = new SurveyConfig(); private static final SurveyConfig s_config = new SurveyConfig();
/* Logger to debug to static initializer */
private static final Logger logger = Logger.getLogger(Survey.class);
static { static {
logger.debug("Static initializer starting...");
s_config.load(); s_config.load();
logger.debug("Static initializer finished.");
} }
public static final SurveyConfig getConfig() { public static final SurveyConfig getConfig() {

View File

@ -60,7 +60,9 @@ public abstract class CMS {
}; };
private static final CMSConfig s_config = new CMSConfig(); private static final CMSConfig s_config = new CMSConfig();
static { static {
s_log.debug("Static initializer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initializer finished.");
} }

View File

@ -125,7 +125,9 @@ public class ContentSection extends Application {
private static final CMSConfig s_config = new CMSConfig(); private static final CMSConfig s_config = new CMSConfig();
static { static {
s_log.debug("Static initializer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initializer finished...");
} }
// Cached properties // Cached properties
PageResolver m_pageResolver = null; PageResolver m_pageResolver = null;

View File

@ -63,10 +63,12 @@ public class Template extends TextAsset {
public static final Map SUPPORTED_MIME_TYPES = new HashMap(); public static final Map SUPPORTED_MIME_TYPES = new HashMap();
static { static {
s_log.debug("Static initalizer is starting...");
SUPPORTED_MIME_TYPES.put(JSP_MIME_TYPE, SUPPORTED_MIME_TYPES.put(JSP_MIME_TYPE,
GlobalizationUtil.globalize("mime_type_jsp")); GlobalizationUtil.globalize("mime_type_jsp"));
SUPPORTED_MIME_TYPES.put(XSL_MIME_TYPE, SUPPORTED_MIME_TYPES.put(XSL_MIME_TYPE,
GlobalizationUtil.globalize("mime_type_xsl")); GlobalizationUtil.globalize("mime_type_xsl"));
s_log.debug("Static initalizer finished.");
} }
/** /**

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.globalization.LocaleNegotiator; import com.arsdigita.globalization.LocaleNegotiator;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
@ -29,6 +28,7 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Locale; import java.util.Locale;
import java.util.TreeMap; import java.util.TreeMap;
import org.apache.log4j.Logger;
/** /**
* <p><code>DomainObject</code> class to represent address <code>ContentType</code> * <p><code>DomainObject</code> class to represent address <code>ContentType</code>
@ -44,6 +44,7 @@ import java.util.TreeMap;
**/ **/
public class GenericAddress extends ContentPage { public class GenericAddress extends ContentPage {
private static final Logger logger = Logger.getLogger(GenericAddress.class);
/** PDL property name for address */ /** PDL property name for address */
public static final String ADDRESS = "address"; public static final String ADDRESS = "address";
/** PDL property name for postal code */ /** PDL property name for postal code */
@ -54,17 +55,18 @@ public class GenericAddress extends ContentPage {
public static final String STATE = "state"; public static final String STATE = "state";
/** PDL property name for country iso code */ /** PDL property name for country iso code */
public static final String ISO_COUNTRY_CODE = "isoCountryCode"; public static final String ISO_COUNTRY_CODE = "isoCountryCode";
/** Data object type for this domain object */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE =
= "com.arsdigita.cms.contenttypes.GenericAddress"; "com.arsdigita.cms.contenttypes.GenericAddress";
private static GenericAddressConfig s_config = new GenericAddressConfig(); private static GenericAddressConfig s_config = new GenericAddressConfig();
static { static {
logger.debug("Static initializer is starting...");
s_config.load(); s_config.load();
logger.debug("Static initializer finished.");
} }
public static GenericAddressConfig getConfig()
{ public static GenericAddressConfig getConfig() {
return s_config; return s_config;
} }
@ -176,7 +178,8 @@ public class GenericAddress extends ContentPage {
// Convert the iso country code to country names using the current locale // Convert the iso country code to country names using the current locale
public static String getCountryNameFromIsoCode(String isoCountryCode) { public static String getCountryNameFromIsoCode(String isoCountryCode) {
LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null); LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "",
null);
java.util.Locale locale = new java.util.Locale("", isoCountryCode); java.util.Locale locale = new java.util.Locale("", isoCountryCode);
return locale.getDisplayCountry(negotiatedLocale.getLocale()); return locale.getDisplayCountry(negotiatedLocale.getLocale());
@ -185,15 +188,18 @@ public class GenericAddress extends ContentPage {
// Get a sorted list auf all countries // Get a sorted list auf all countries
public static TreeMap getSortedListOfCountries(Locale inLang) { public static TreeMap getSortedListOfCountries(Locale inLang) {
LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null); LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "",
null);
String[] countries = Locale.getISOCountries(); String[] countries = Locale.getISOCountries();
TreeMap <String,String> countryNames = new TreeMap<String,String>(); TreeMap<String, String> countryNames = new TreeMap<String, String>();
for(String country : countries) { for (String country : countries) {
if(inLang != null) { if (inLang != null) {
countryNames.put(new java.util.Locale("", country).getDisplayCountry(inLang), country); countryNames.put(new java.util.Locale("", country).
getDisplayCountry(inLang), country);
} else { } else {
countryNames.put(new java.util.Locale("", country).getDisplayCountry(negotiatedLocale.getLocale()), country); countryNames.put(new java.util.Locale("", country).
getDisplayCountry(negotiatedLocale.getLocale()), country);
} }
} }

View File

@ -29,6 +29,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.log4j.Logger;
/** /**
* This content type represents an basic contact * This content type represents an basic contact
@ -37,6 +38,7 @@ import java.util.StringTokenizer;
public class GenericContact extends ContentPage implements public class GenericContact extends ContentPage implements
RelationAttributeInterface { RelationAttributeInterface {
private static final Logger logger = Logger.getLogger(GenericContact.class);
/** PDL property names */ /** PDL property names */
public static final String PERSON = "person"; public static final String PERSON = "person";
// public static final String CONTACT_TYPE = ""; // public static final String CONTACT_TYPE = "";
@ -51,9 +53,11 @@ public class GenericContact extends ContentPage implements
new GenericContactConfig(); new GenericContactConfig();
static { static {
logger.debug("Static initializer is starting...");
s_config.load(); s_config.load();
logger.debug("Static initializer finished");
} }
/** Data object type for tihs domain object */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.GenericContact"; "com.arsdigita.cms.contenttypes.GenericContact";

View File

@ -50,14 +50,18 @@ class BaseAsset extends ResourceHandlerImpl {
private final static String s_defaultName = "File"; private final static String s_defaultName = "File";
private static final BigDecimalParameter s_assetId; private static final BigDecimalParameter s_assetId = new BigDecimalParameter(ASSET_ID);
private static final OIDParameter s_oid; private static final OIDParameter s_oid = new OIDParameter(OID_PARAM);
static { /*
* jensp 2011-02-11: No need for static initalizer block here. Moved
* to variable declaration (see above).
*/
/*static {
s_assetId = new BigDecimalParameter(ASSET_ID); s_assetId = new BigDecimalParameter(ASSET_ID);
s_oid = new OIDParameter(OID_PARAM); s_oid = new OIDParameter(OID_PARAM);
//s_assetId.addParameterListener(new NotNullValidationListener()); //s_assetId.addParameterListener(new NotNullValidationListener());
} }*/
private final boolean m_download; private final boolean m_download;
private String m_disposition; private String m_disposition;

View File

@ -53,13 +53,14 @@ import java.util.Iterator;
*/ */
public class SimpleXMLGenerator implements XMLGenerator { public class SimpleXMLGenerator implements XMLGenerator {
private static Logger s_log = private static final Logger s_log =
Logger.getLogger(SimpleXMLGenerator.class); Logger.getLogger(SimpleXMLGenerator.class);
public static final String ADAPTER_CONTEXT = SimpleXMLGenerator.class. public static final String ADAPTER_CONTEXT = SimpleXMLGenerator.class.
getName(); getName();
// Register general purpose adaptor for all content items // Register general purpose adaptor for all content items
static { static {
s_log.debug("Static initializer starting...");
SimpleDomainObjectTraversalAdapter adapter = SimpleDomainObjectTraversalAdapter adapter =
new SimpleDomainObjectTraversalAdapter(); new SimpleDomainObjectTraversalAdapter();
adapter.addAssociationProperty("/object/type"); adapter.addAssociationProperty("/object/type");
@ -69,6 +70,7 @@ public class SimpleXMLGenerator implements XMLGenerator {
ContentItem.BASE_DATA_OBJECT_TYPE, ContentItem.BASE_DATA_OBJECT_TYPE,
adapter, adapter,
ADAPTER_CONTEXT); ADAPTER_CONTEXT);
s_log.debug("Static initializer finished");
} }
public SimpleXMLGenerator() { public SimpleXMLGenerator() {

View File

@ -62,57 +62,67 @@ import org.apache.oro.text.regex.Perl5Matcher;
*/ */
class LinkScanner { class LinkScanner {
private static Logger s_log = Logger.getLogger(LinkScanner.class.getName()); private static final Logger s_log = Logger.getLogger(LinkScanner.class);
// Regexp magic. We deliberately don't use the JDK 1.4 regex features, so // Regexp magic. We deliberately don't use the JDK 1.4 regex features, so
// that this class can also be used under JDK 1.3 // that this class can also be used under JDK 1.3
// The option we use for matching // The option we use for matching
private static final int MATCH_MASK = Perl5Compiler.CASE_INSENSITIVE_MASK private static final int MATCH_MASK = Perl5Compiler.CASE_INSENSITIVE_MASK
| Perl5Compiler.MULTILINE_MASK; | Perl5Compiler.MULTILINE_MASK;
// The HTML elements we are interested in. This must match exactly the // The HTML elements we are interested in. This must match exactly the
// elements listed in TAGS // elements listed in TAGS
private static final String ELEMS_RE = "(a|img|link)"; private static final String ELEMS_RE = "(a|img|link)";
// Regexp to find a tag // Regexp to find a tag
private static final String TAG_RE = "\\<\\s*" + ELEMS_RE + "\\s*([^>]*?)\\s*/?\\>"; private static final String TAG_RE = "\\<\\s*" + ELEMS_RE
+ "\\s*([^>]*?)\\s*/?\\>";
// Regexp to find an attribute/value pair within a tag // Regexp to find an attribute/value pair within a tag
private static final String ATTR_RE = "([a-z][a-z0-9]*)\\s*=\\s*([^\\s'\"]+|'[^']*'|\"[^\"]*\")"; private static final String ATTR_RE =
"([a-z][a-z0-9]*)\\s*=\\s*([^\\s'\"]+|'[^']*'|\"[^\"]*\")";
// These two variables will be initialized with precompiled patterns // These two variables will be initialized with precompiled patterns
private static final Pattern TAG_PAT; private static final Pattern TAG_PAT;
private static final Pattern ATTR_PAT; private static final Pattern ATTR_PAT;
// The tags that we are interested in. The regexp ELEMS_RE must match // The tags that we are interested in. The regexp ELEMS_RE must match
// exactly these tags. // exactly these tags.
// REF_ATTR contains for each of the TAGS which of their attribute holds // REF_ATTR contains for each of the TAGS which of their attribute holds
// the link that we are going to alter. // the link that we are going to alter.
private static final String [] TAGS = {"img", "link", "a"}; private static final String[] TAGS = {"img", "link", "a"};
private static final String [] REF_ATTR = {"src", "href", "href"}; private static final String[] REF_ATTR = {"src", "href", "href"};
// The special oid attribute we use to figure out which tags we need to // The special oid attribute we use to figure out which tags we need to
// futz with. // futz with.
private static final String OID_ATTR = "oid"; private static final String OID_ATTR = "oid";
// FIXME: These are references to what should be displayed when tag // FIXME: These are references to what should be displayed when tag
// rewriting can't find the live target item. These values only work for // rewriting can't find the live target item. These values only work for
// DP. // DP.
private static final String [] NOT_FOUND = { "/notfound.jpg", private static final String[] NOT_FOUND = {"/notfound.jpg",
"/notfound.html", "/notfound.html",
"/notfound.html" }; "/notfound.html"};
static { static {
s_log.debug("Static initializer is starting...s");
Perl5Compiler comp = new Perl5Compiler(); Perl5Compiler comp = new Perl5Compiler();
try { try {
TAG_PAT = comp.compile(TAG_RE, MATCH_MASK); TAG_PAT = comp.compile(TAG_RE, MATCH_MASK);
} catch (MalformedPatternException e) { } catch (MalformedPatternException e) {
throw new RuntimeException("Failed to compile \n'" + TAG_RE +"' " + e.getMessage()); s_log.error(String.format("Failed to compile regex tag '%s' "
+ "with match mask '%s':",
TAG_RE,
MATCH_MASK),
e);
throw new RuntimeException("Failed to compile \n'" + TAG_RE + "' " + e.
getMessage());
} }
try { try {
ATTR_PAT = comp.compile(ATTR_RE, MATCH_MASK); ATTR_PAT = comp.compile(ATTR_RE, MATCH_MASK);
} catch (MalformedPatternException e) { } catch (MalformedPatternException e) {
throw new RuntimeException("Failed to compile \n'" + ATTR_RE +"' " + e.getMessage()); s_log.error(String.format("Failed to compile regex tag '%s' "
+ "with match mask '%s':",
ATTR_RE,
MATCH_MASK),
e);
throw new RuntimeException("Failed to compile \n'" + ATTR_RE + "' " + e.
getMessage());
} }
s_log.debug("Static initalizer finshed.");
} }
private String m_content; private String m_content;
private TagRef[] m_tags; private TagRef[] m_tags;
@ -125,7 +135,7 @@ class LinkScanner {
public void transform(Writer out) public void transform(Writer out)
throws IOException { throws IOException {
if ( m_tags == null || m_tags.length == 0 ) { if (m_tags == null || m_tags.length == 0) {
// Nothing to do // Nothing to do
out.write(m_content); out.write(m_content);
return; return;
@ -135,14 +145,14 @@ class LinkScanner {
int i = 0; int i = 0;
out.write(m_content.substring(0, m_tags[0].tagStart)); out.write(m_content.substring(0, m_tags[0].tagStart));
for (i = 0; i < m_tags.length; i ++) { for (i = 0; i < m_tags.length; i++) {
ta = m_tags[i]; ta = m_tags[i];
if (i > 0) { if (i > 0) {
out.write(m_content.substring(m_tags[i - 1].tagEnd, ta.tagStart)); out.write(m_content.substring(m_tags[i - 1].tagEnd, ta.tagStart));
} }
ta.replaceReference(out); ta.replaceReference(out);
} }
out.write( m_content.substring(m_tags[m_tags.length - 1].tagEnd) ); out.write(m_content.substring(m_tags[m_tags.length - 1].tagEnd));
} }
public int size() { public int size() {
@ -169,7 +179,7 @@ class LinkScanner {
PatternMatcher tagMatcher = new Perl5Matcher(); PatternMatcher tagMatcher = new Perl5Matcher();
PatternMatcher attrMatcher = new Perl5Matcher(); PatternMatcher attrMatcher = new Perl5Matcher();
while ( tagMatcher.contains(body, TAG_PAT) ) { while (tagMatcher.contains(body, TAG_PAT)) {
MatchResult t = tagMatcher.getMatch(); MatchResult t = tagMatcher.getMatch();
int tagType = getTagType(t.group(1)); int tagType = getTagType(t.group(1));
int tagStart = t.beginOffset(2); int tagStart = t.beginOffset(2);
@ -181,28 +191,29 @@ class LinkScanner {
int linkEnd = -1; int linkEnd = -1;
while (attrMatcher.contains(tag, ATTR_PAT)) { while (attrMatcher.contains(tag, ATTR_PAT)) {
MatchResult a = attrMatcher.getMatch(); MatchResult a = attrMatcher.getMatch();
if ( OID_ATTR.equalsIgnoreCase(a.group(1)) ) { if (OID_ATTR.equalsIgnoreCase(a.group(1))) {
oid = extractOID(a.beginOffset(2), a.endOffset(2)); oid = extractOID(a.beginOffset(2), a.endOffset(2));
} else if ( REF_ATTR[tagType].equalsIgnoreCase(a.group(1)) ) { } else if (REF_ATTR[tagType].equalsIgnoreCase(a.group(1))) {
linkStart = a.beginOffset(2); linkStart = a.beginOffset(2);
linkEnd = a.endOffset(2); linkEnd = a.endOffset(2);
} }
} }
if ( oid != null ) { if (oid != null) {
TagRef ref = new TagRef(tagType, tagStart, tagEnd, linkStart, linkEnd, TagRef ref = new TagRef(tagType, tagStart, tagEnd, linkStart,
linkEnd,
oid); oid);
foundTags.add(ref); foundTags.add(ref);
} }
} }
int size = foundTags.size(); int size = foundTags.size();
return ( size > 0 ? (TagRef [])foundTags.toArray(new TagRef[size]) : null); return (size > 0 ? (TagRef[]) foundTags.toArray(new TagRef[size]) : null);
} }
private BigDecimal extractOID(int begin, int end) { private BigDecimal extractOID(int begin, int end) {
String val = null; String val = null;
if ( m_content.charAt(begin) == '"' if (m_content.charAt(begin) == '"'
|| m_content.charAt(begin) == '\'' ) { || m_content.charAt(begin) == '\'') {
val = m_content.substring(begin+1, end-1); val = m_content.substring(begin + 1, end - 1);
} else { } else {
val = m_content.substring(begin, end); val = m_content.substring(begin, end);
} }
@ -210,10 +221,14 @@ class LinkScanner {
} }
private int getTagType(String tag) { private int getTagType(String tag) {
for (int i=0; i < TAGS.length; i++) { for (int i = 0; i < TAGS.length; i++) {
if (TAGS[i].equalsIgnoreCase(tag)) return i; if (TAGS[i].equalsIgnoreCase(tag)) {
return i;
} }
throw new IllegalStateException("Tag '" + tag + "' found, but no information registered for it in TAGS. This is a programming error."); }
throw new IllegalStateException(
"Tag '" + tag
+ "' found, but no information registered for it in TAGS. This is a programming error.");
} }
/*** /***
@ -228,13 +243,12 @@ class LinkScanner {
int linkEnd; int linkEnd;
String url; String url;
BigDecimal oid; BigDecimal oid;
private ContentItem m_item; private ContentItem m_item;
public TagRef(int type, int start, int end, int lstart, int lend, public TagRef(int type, int start, int end, int lstart, int lend,
BigDecimal oid) { BigDecimal oid) {
tagType = type; tagType = type;
tagStart= start; tagStart = start;
tagEnd = end; tagEnd = end;
linkStart = lstart; linkStart = lstart;
linkEnd = lend; linkEnd = lend;
@ -245,7 +259,7 @@ class LinkScanner {
throws IOException { throws IOException {
String target = (url == null) ? NOT_FOUND[tagType] : url; String target = (url == null) ? NOT_FOUND[tagType] : url;
if ( linkStart == -1 ) { if (linkStart == -1) {
// There was no link attribute on the original tag. Insert one at // There was no link attribute on the original tag. Insert one at
// the end. // the end.
out.write(m_content.substring(tagStart, tagEnd)); out.write(m_content.substring(tagStart, tagEnd));
@ -259,23 +273,24 @@ class LinkScanner {
out.write('\''); out.write('\'');
out.write(target); out.write(target);
out.write("' "); out.write("' ");
if ( tagEnd > linkEnd ) { if (tagEnd > linkEnd) {
out.write(m_content.substring(linkEnd+1, tagEnd)); out.write(m_content.substring(linkEnd + 1, tagEnd));
} }
} }
} }
public ContentItem getItem() { public ContentItem getItem() {
if ( m_item == null ) { if (m_item == null) {
m_item = Utilities.getContentItemOrNull( oid ); m_item = Utilities.getContentItemOrNull(oid);
// FIXME: The page with editor will contain references to draft // FIXME: The page with editor will contain references to draft
// items. Fixing that requires parsing the HTML of the page // items. Fixing that requires parsing the HTML of the page
// separately. Here, we just kludge around it by getting the live // separately. Here, we just kludge around it by getting the live
// version of referenced items. [lutter] // version of referenced items. [lutter]
if ( m_item != null ) m_item = m_item.getLiveVersion(); if (m_item != null) {
m_item = m_item.getLiveVersion();
}
} }
return m_item; return m_item;
} }
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -67,7 +66,6 @@ import com.arsdigita.mimetypes.converters.ConvertFormat;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
/** /**
* Displays the mime-type and the body of a single {@link TextAsset}. Maintains * Displays the mime-type and the body of a single {@link TextAsset}. Maintains
* a form or uploading files into the text body of the asset, and a form for * a form or uploading files into the text body of the asset, and a form for
@ -92,19 +90,18 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
private static Logger s_log = private static Logger s_log =
Logger.getLogger(TextAssetBody.class); Logger.getLogger(TextAssetBody.class);
private ItemSelectionModel m_assetModel; private ItemSelectionModel m_assetModel;
public static final String FILE_UPLOAD = "file"; public static final String FILE_UPLOAD = "file";
public static final String TEXT_ENTRY = "text"; public static final String TEXT_ENTRY = "text";
private StringParameter m_streamlinedCreationParam; private StringParameter m_streamlinedCreationParam;
private static final String STREAMLINED = "_streamlined"; private static final String STREAMLINED = "_streamlined";
private static final String STREAMLINED_DONE = "1"; private static final String STREAMLINED_DONE = "1";
private static final CMSConfig s_config = new CMSConfig(); private static final CMSConfig s_config = new CMSConfig();
static { static {
s_log.debug("Static initializer is starting...");
s_config.load(); s_config.load();
s_log.debug("Static initializer finished.");
} }
/** /**
@ -114,8 +111,9 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
* be responsible for maintaining the current asset * be responsible for maintaining the current asset
*/ */
public TextAssetBody(ItemSelectionModel assetModel) { public TextAssetBody(ItemSelectionModel assetModel) {
this(assetModel,null); this(assetModel, null);
} }
/** /**
* Construct a new GenericArticleBody component * Construct a new GenericArticleBody component
* *
@ -125,13 +123,14 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
* may use the wizard's methods, such as stepForward and stepBack, * may use the wizard's methods, such as stepForward and stepBack,
* in its process listener. * in its process listener.
*/ */
public TextAssetBody(ItemSelectionModel assetModel, AuthoringKitWizard parent) { public TextAssetBody(ItemSelectionModel assetModel,
AuthoringKitWizard parent) {
super(); super();
m_assetModel = assetModel; m_assetModel = assetModel;
m_streamlinedCreationParam = m_streamlinedCreationParam =
new StringParameter(parent == null ? "item" : new StringParameter(parent == null ? "item" : parent.getContentType().
parent.getContentType().getAssociatedObjectType() + "_body_done"); getAssociatedObjectType() + "_body_done");
if (!s_config.getHideTextAssetUploadFile()) { if (!s_config.getHideTextAssetUploadFile()) {
PageFileForm f = getPageFileForm(); PageFileForm f = getPageFileForm();
@ -149,7 +148,8 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
DomainObjectPropertySheet sheet = getBodyPropertySheet(assetModel); DomainObjectPropertySheet sheet = getBodyPropertySheet(assetModel);
sheet.add("Text&nbsp;Type:", sheet.add("Text&nbsp;Type:",
Asset.MIME_TYPE + "." + MimeType.LABEL); Asset.MIME_TYPE + "." + MimeType.LABEL);
sheet.add((String) GlobalizationUtil.globalize("cms.ui.authoring.body").localize(), TextAsset.CONTENT); sheet.add((String) GlobalizationUtil.globalize("cms.ui.authoring.body").
localize(), TextAsset.CONTENT);
setDisplayComponent(sheet); setDisplayComponent(sheet);
@ -157,7 +157,8 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
} }
protected DomainObjectPropertySheet getBodyPropertySheet(ItemSelectionModel assetModel) { protected DomainObjectPropertySheet getBodyPropertySheet(
ItemSelectionModel assetModel) {
return new TextAssetBodyPropertySheet(assetModel); return new TextAssetBodyPropertySheet(assetModel);
} }
@ -175,7 +176,7 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
* @param state represents the current request * @param state represents the current request
*/ */
public TextAsset getTextAsset(PageState state) { public TextAsset getTextAsset(PageState state) {
return (TextAsset)m_assetModel.getSelectedObject(state); return (TextAsset) m_assetModel.getSelectedObject(state);
} }
/** /**
@ -194,7 +195,7 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// Get the text asset or create a new one // Get the text asset or create a new one
TextAsset t = getTextAsset(s); TextAsset t = getTextAsset(s);
if(t == null) { if (t == null) {
t = createTextAsset(s); t = createTextAsset(s);
assetModel.setSelectedObject(s, t); assetModel.setSelectedObject(s, t);
} }
@ -238,8 +239,8 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
* @param state the PageState * @param state the PageState
*/ */
protected void maybeForwardToNextStep(PageState state) { protected void maybeForwardToNextStep(PageState state) {
if (ContentItemPage.isStreamlinedCreationActive(state) && if (ContentItemPage.isStreamlinedCreationActive(state) && !STREAMLINED_DONE.
!STREAMLINED_DONE.equals(state.getValue(m_streamlinedCreationParam))) { equals(state.getValue(m_streamlinedCreationParam))) {
state.setValue(m_streamlinedCreationParam, STREAMLINED_DONE); state.setValue(m_streamlinedCreationParam, STREAMLINED_DONE);
fireCompletionEvent(state); fireCompletionEvent(state);
} }
@ -270,8 +271,8 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
//if (getTextAsset(state) != null) { //if (getTextAsset(state) != null) {
// ComponentAccess ca = (ComponentAccess) getAccessMap().get(TEXT_ENTRY); // ComponentAccess ca = (ComponentAccess) getAccessMap().get(TEXT_ENTRY);
if (ContentItemPage.isStreamlinedCreationActive(state) && if (ContentItemPage.isStreamlinedCreationActive(state) && !STREAMLINED_DONE.
!STREAMLINED_DONE.equals(state.getValue(m_streamlinedCreationParam))) { equals(state.getValue(m_streamlinedCreationParam))) {
showComponent(state, TEXT_ENTRY); showComponent(state, TEXT_ENTRY);
} }
//} //}
@ -298,7 +299,6 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// Variables saved by validate for processing // Variables saved by validate for processing
private RequestLocal m_file_upload_content; private RequestLocal m_file_upload_content;
private RequestLocal m_file_upload_usedINSO; private RequestLocal m_file_upload_usedINSO;
/** /**
* The text entry widget * The text entry widget
*/ */
@ -314,7 +314,7 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
} }
protected String getFileUploadContent(PageState state) { protected String getFileUploadContent(PageState state) {
return (String)m_file_upload_content.get(state); return (String) m_file_upload_content.get(state);
} }
/** /**
@ -323,14 +323,12 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
private void validateFileType(MimeType mime, boolean textType) private void validateFileType(MimeType mime, boolean textType)
throws FormProcessException { throws FormProcessException {
boolean validType = textType || ( boolean validType = textType || ((mime instanceof TextMimeType) && ((TextMimeType) mime).
(mime instanceof TextMimeType) && allowINSOConvert().booleanValue());
((TextMimeType)mime).allowINSOConvert().booleanValue()
);
if (!validType) { if (!validType) {
throw new FormProcessException("Cannot load " + throw new FormProcessException("Cannot load " + "files of type " + mime.
"files of type " + mime.getMimeType() + " into the article body."); getMimeType() + " into the article body.");
} }
boolean insoWorks = MimeTypeStatus.getMimeTypeStatus(). boolean insoWorks = MimeTypeStatus.getMimeTypeStatus().
@ -338,35 +336,36 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
if (!textType && !insoWorks) { if (!textType && !insoWorks) {
// Can't convert. inso filter is not working. Give message. // Can't convert. inso filter is not working. Give message.
throw new FormProcessException("Could not convert to html " + throw new FormProcessException(
"format because interMedia INSO filter is not installed."); "Could not convert to html "
+ "format because interMedia INSO filter is not installed.");
} }
} }
/** /**
* read in the content of the file (in bytes). * read in the content of the file (in bytes).
*/ */
private byte[] readFileBytes(File file) throws FormProcessException { private byte[] readFileBytes(File file) throws FormProcessException {
byte [] file_bytes; byte[] file_bytes;
try { try {
FileInputStream fs = new FileInputStream(file); FileInputStream fs = new FileInputStream(file);
file_bytes = new byte[fs.available()]; file_bytes = new byte[fs.available()];
fs.read(file_bytes); fs.read(file_bytes);
fs.close(); fs.close();
} catch (Exception e) { } catch (Exception e) {
throw new FormProcessException( (String) GlobalizationUtil.globalize("cms.ui.authoring.unable_to_load_file").localize() + e.getMessage()); throw new FormProcessException((String) GlobalizationUtil.
globalize("cms.ui.authoring.unable_to_load_file").
localize() + e.getMessage());
} }
return file_bytes; return file_bytes;
} }
/** /**
* Convert bytes to String, possibly using INSO filter to convert to * Convert bytes to String, possibly using INSO filter to convert to
* HTML type * HTML type
*/ */
private String convertBytes(byte [] file_bytes, boolean text_type, private String convertBytes(byte[] file_bytes, boolean text_type,
boolean [] used_inso) boolean[] used_inso)
throws FormProcessException { throws FormProcessException {
String file_content; String file_content;
// If mime type is not text type, try to convert to html // If mime type is not text type, try to convert to html
@ -376,23 +375,25 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// Converted successfully, flag type should be html // Converted successfully, flag type should be html
used_inso[0] = true; used_inso[0] = true;
} else { } else {
throw new FormProcessException("Could not convert to html format. " + throw new FormProcessException(
"interMedia INSO filter conversion failed."); "Could not convert to html format. "
+ "interMedia INSO filter conversion failed.");
} }
} else { } else {
// Text type, no need to convert // Text type, no need to convert
String enc = Globalization.getDefaultCharset(Kernel.getContext().getLocale()); String enc = Globalization.getDefaultCharset(Kernel.getContext().
getLocale());
try { try {
file_content = new String(file_bytes, enc); file_content = new String(file_bytes, enc);
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
throw new UncheckedWrapperException("cannot convert to encoding " + enc, ex); throw new UncheckedWrapperException("cannot convert to encoding "
+ enc, ex);
} }
used_inso[0] = false; used_inso[0] = false;
} }
return file_content; return file_content;
} }
/** /**
* Extract the contents of the html Body tag. * Extract the contents of the html Body tag.
* (Done to prevent base and other header tags * (Done to prevent base and other header tags
@ -402,14 +403,15 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
throws FormProcessException { throws FormProcessException {
String lc = htmlText.toLowerCase(); String lc = htmlText.toLowerCase();
int bodyStart = lc.indexOf("<body"); int bodyStart = lc.indexOf("<body");
int bodyStart_v = lc.indexOf(">",bodyStart); int bodyStart_v = lc.indexOf(">", bodyStart);
int bodyEnd = lc.indexOf("</body>", bodyStart_v); int bodyEnd = lc.indexOf("</body>", bodyStart_v);
if (bodyStart == -1 || bodyEnd == -1) { if (bodyStart == -1 || bodyEnd == -1) {
final String errMsg = "The file (which should be type " final String errMsg =
"The file (which should be type "
+ "HTML) is missing the <body> or </body> tag."; + "HTML) is missing the <body> or </body> tag.";
throw new FormProcessException(errMsg); throw new FormProcessException(errMsg);
} }
return htmlText.substring(bodyStart_v+1, bodyEnd); return htmlText.substring(bodyStart_v + 1, bodyEnd);
} }
/** /**
@ -424,19 +426,19 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// Convert the file to HTML, if possible // Convert the file to HTML, if possible
File file = m_fileUploadSection.getFile(e); File file = m_fileUploadSection.getFile(e);
byte [] file_bytes = readFileBytes(file); byte[] file_bytes = readFileBytes(file);
boolean [] used_inso = new boolean [1]; boolean[] used_inso = new boolean[1];
String file_content = convertBytes(file_bytes, textType, used_inso); String file_content = convertBytes(file_bytes, textType, used_inso);
if (TextMimeType.MIME_TEXT_HTML.equals(mime.getMimeType())) if (TextMimeType.MIME_TEXT_HTML.equals(mime.getMimeType())) {
file_content = extractHTMLBody(file_content); file_content = extractHTMLBody(file_content);
}
PageState state = e.getPageState(); PageState state = e.getPageState();
m_file_upload_content.set(state, file_content); m_file_upload_content.set(state, file_content);
m_file_upload_usedINSO.set(state, new Boolean(used_inso[0])); m_file_upload_usedINSO.set(state, new Boolean(used_inso[0]));
} }
/** /**
* Process file upload. Must be validated first. * Process file upload. Must be validated first.
*/ */
@ -449,14 +451,15 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// Get info created during validation // Get info created during validation
String upload_content = (String) m_file_upload_content.get(state); String upload_content = (String) m_file_upload_content.get(state);
boolean usedINSO = ((Boolean) m_file_upload_usedINSO.get(state)) boolean usedINSO = ((Boolean) m_file_upload_usedINSO.get(state)).
.booleanValue(); booleanValue();
// Set the mime type // Set the mime type
MimeType mime = m_fileUploadSection.getMimeType(e); MimeType mime = m_fileUploadSection.getMimeType(e);
if (usedINSO) if (usedINSO) {
mime = MimeType.loadMimeType("text/html"); mime = MimeType.loadMimeType("text/html");
if(mime != null) { }
if (mime != null) {
t.setMimeType(mime); t.setMimeType(mime);
} }
@ -469,7 +472,9 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// Save everything // Save everything
updateTextAsset(state, t); updateTextAsset(state, t);
if(t.isNew() || t.isModified()) t.save(); if (t.isNew() || t.isModified()) {
t.save();
}
} }
@ -486,24 +491,23 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
public FileUploadSection getFileUploadSection() { public FileUploadSection getFileUploadSection() {
return m_fileUploadSection; return m_fileUploadSection;
} }
} }
/** /**
* A form for editing the body of the text. * A form for editing the body of the text.
*/ */
public class PageTextForm extends Form public class PageTextForm extends Form
implements FormInitListener, FormProcessListener, FormSubmissionListener { implements FormInitListener, FormProcessListener,
FormSubmissionListener {
private SingleSelect m_mimeWidget; private SingleSelect m_mimeWidget;
private Label m_mimeLabel; private Label m_mimeLabel;
private TextArea m_textWidget; private TextArea m_textWidget;
private SaveCancelSection m_saveCancelSection; private SaveCancelSection m_saveCancelSection;
/** /**
* The text entry widget * The text entry widget
*/ */
public static final String TEXT_ENTRY = "text_entry"; public static final String TEXT_ENTRY = "text_entry";
/** /**
* The mime type widget * The mime type widget
*/ */
@ -523,7 +527,6 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
} }
// These are here so that TemplateBody can set them. // These are here so that TemplateBody can set them.
public final void setMimeWidget(final SingleSelect widget) { public final void setMimeWidget(final SingleSelect widget) {
m_mimeWidget = widget; m_mimeWidget = widget;
} }
@ -544,20 +547,20 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
PageState state = e.getPageState(); PageState state = e.getPageState();
TextAsset t = (TextAsset)m_assetModel.getSelectedObject(state); TextAsset t = (TextAsset) m_assetModel.getSelectedObject(state);
if(t != null) { if (t != null) {
data.put(TEXT_ENTRY, t.getText()); data.put(TEXT_ENTRY, t.getText());
MimeType m = t.getMimeType(); MimeType m = t.getMimeType();
if(m != null) { if (m != null) {
data.put(MIME_TYPE, m.getMimeType()); data.put(MIME_TYPE, m.getMimeType());
} }
} }
} }
/** Cancels streamlined editing. */ /** Cancels streamlined editing. */
public void submitted( FormSectionEvent e ) { public void submitted(FormSectionEvent e) {
if (getSaveCancelSection().getCancelButton() if (getSaveCancelSection().getCancelButton().isSelected(e.
.isSelected( e.getPageState())) { getPageState())) {
TextAssetBody.this.cancelStreamlinedCreation(e.getPageState()); TextAssetBody.this.cancelStreamlinedCreation(e.getPageState());
} }
} }
@ -570,19 +573,23 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
TextAsset t = createOrGetTextAsset(m_assetModel, state); TextAsset t = createOrGetTextAsset(m_assetModel, state);
// Set the mime type // Set the mime type
MimeType m = MimeType.loadMimeType((String)data.get(MIME_TYPE)); MimeType m = MimeType.loadMimeType((String) data.get(MIME_TYPE));
t.setMimeType(m); t.setMimeType(m);
// Get the string and normalize it // Get the string and normalize it
String text = (String)data.get(TEXT_ENTRY); String text = (String) data.get(TEXT_ENTRY);
if(text == null) text = ""; if (text == null) {
text = "";
}
t.setText((String)data.get(TEXT_ENTRY)); t.setText((String) data.get(TEXT_ENTRY));
// Save everything // Save everything
updateTextAsset(state, t); updateTextAsset(state, t);
if(t.isNew() || t.isModified()) t.save(); if (t.isNew() || t.isModified()) {
t.save();
}
TextAssetBody.this.maybeForwardToNextStep(e.getPageState()); TextAssetBody.this.maybeForwardToNextStep(e.getPageState());
} }
@ -593,7 +600,6 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
public SaveCancelSection getSaveCancelSection() { public SaveCancelSection getSaveCancelSection() {
return m_saveCancelSection; return m_saveCancelSection;
} }
} }
protected String getDefaultMimeType() { protected String getDefaultMimeType() {
@ -605,10 +611,11 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
c.m_fileUploadSection = c.m_fileUploadSection =
new FileUploadSection("Text Type:", "text", getDefaultMimeType()); new FileUploadSection("Text Type:", "text", getDefaultMimeType());
c.m_fileUploadSection.getFileUploadWidget() c.m_fileUploadSection.getFileUploadWidget().addValidationListener(
.addValidationListener(new NotNullValidationListener()); new NotNullValidationListener());
// Default to -guess- because want to use file extension to determine type. // Default to -guess- because want to use file extension to determine type.
c.m_fileUploadSection.getMimeTypeWidget().setDefaultValue(FileUploadSection.GUESS_MIME); c.m_fileUploadSection.getMimeTypeWidget().setDefaultValue(
FileUploadSection.GUESS_MIME);
c.add(c.m_fileUploadSection); c.add(c.m_fileUploadSection);
c.m_saveCancelSection = new SaveCancelSection(); c.m_saveCancelSection = new SaveCancelSection();
@ -630,20 +637,22 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
/* overridable method to put together the PageTextForm Component */ /* overridable method to put together the PageTextForm Component */
protected void addTextWidgets(PageTextForm c) { protected void addTextWidgets(PageTextForm c) {
ColumnPanel panel = (ColumnPanel)c.getPanel(); ColumnPanel panel = (ColumnPanel) c.getPanel();
panel.setBorder(false); panel.setBorder(false);
panel.setPadColor("#FFFFFF"); panel.setPadColor("#FFFFFF");
panel.setColumnWidth(1, "20%"); panel.setColumnWidth(1, "20%");
panel.setColumnWidth(2, "80%"); panel.setColumnWidth(2, "80%");
panel.setWidth("100%"); panel.setWidth("100%");
c.add(new Label(GlobalizationUtil.globalize("cms.ui.authoring.text_type"))); c.add(new Label(
GlobalizationUtil.globalize("cms.ui.authoring.text_type")));
c.m_mimeWidget = new SingleSelect(PageTextForm.MIME_TYPE); c.m_mimeWidget = new SingleSelect(PageTextForm.MIME_TYPE);
c.m_mimeWidget.setClassAttr("displayOneOptionAsLabel"); c.m_mimeWidget.setClassAttr("displayOneOptionAsLabel");
setMimeTypeOptions(c.m_mimeWidget); setMimeTypeOptions(c.m_mimeWidget);
c.add(c.m_mimeWidget, ColumnPanel.LEFT); c.add(c.m_mimeWidget, ColumnPanel.LEFT);
c.add(new Label(GlobalizationUtil.globalize("cms.ui.authoring.edit_body_text")), c.add(new Label(GlobalizationUtil.globalize(
"cms.ui.authoring.edit_body_text")),
ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH); ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH);
c.m_textWidget = new CMSDHTMLEditor(PageTextForm.TEXT_ENTRY); c.m_textWidget = new CMSDHTMLEditor(PageTextForm.TEXT_ENTRY);
@ -663,7 +672,9 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
// optionally, we clear the text of MSWord tags every time // optionally, we clear the text of MSWord tags every time
// the text is submitted/saved // the text is submitted/saved
if (ContentSection.getConfig().getSaveTextCleansWordTags()) { if (ContentSection.getConfig().getSaveTextCleansWordTags()) {
c.m_saveCancelSection.getSaveButton().setOnClick("wordClean_"+PageTextForm.TEXT_ENTRY+"();"); c.m_saveCancelSection.getSaveButton().setOnClick("wordClean_"
+ PageTextForm.TEXT_ENTRY
+ "();");
} }
c.addInitListener(c); c.addInitListener(c);

View File

@ -189,6 +189,7 @@ public class FolderBrowser extends Table {
Assert.exists( m_currentFolder.getStateParameter() ); Assert.exists( m_currentFolder.getStateParameter() );
} }
@Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
@ -217,6 +218,7 @@ public class FolderBrowser extends Table {
m_deleteColumn.setVisible(state, canDelete); m_deleteColumn.setVisible(state, canDelete);
} }
@Override
public void respond(PageState state) throws ServletException { public void respond(PageState state) throws ServletException {
String key = state.getControlEventName(); String key = state.getControlEventName();
String value = state.getControlEventValue(); String value = state.getControlEventValue();
@ -407,6 +409,7 @@ public class FolderBrowser extends Table {
super(true); super(true);
} }
@Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
@ -438,12 +441,15 @@ public class FolderBrowser extends Table {
private static class ActionCellRenderer implements TableCellRenderer { private static class ActionCellRenderer implements TableCellRenderer {
private static Label s_noAction; private static Label s_noAction;
private static ControlLink s_link; private static ControlLink s_link;
private static final Logger logger = Logger.getLogger(ActionCellRenderer.class);
static { static {
logger.debug("Static initializer is starting...");
s_noAction = new Label("&nbsp;", false); s_noAction = new Label("&nbsp;", false);
s_noAction.lock(); s_noAction.lock();
s_link = new ControlLink(new Label(globalize("cms.ui.folder.delete"))); s_link = new ControlLink(new Label(globalize("cms.ui.folder.delete")));
s_link.setConfirmation("Permanently delete this item?"); // XXX G11N ? s_link.setConfirmation("Permanently delete this item?"); // XXX G11N ?
logger.debug("Static initializer finished.");
} }
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,

View File

@ -44,6 +44,7 @@ import com.arsdigita.toolbox.ui.DataTable;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger;
/** /**
@ -115,17 +116,20 @@ public class ItemLanguagesTable extends DataTable {
* Delete language instance action link. * Delete language instance action link.
*/ */
private static class ActionCellRenderer implements TableCellRenderer { private static class ActionCellRenderer implements TableCellRenderer {
private static final Logger logger = Logger.getLogger(ActionCellRenderer.class);
private static Label s_noAction; private static Label s_noAction;
private static Label s_primary; private static Label s_primary;
private static ControlLink s_link; private static ControlLink s_link;
static { static {
logger.debug("Static initializer is starting...");
s_noAction = new Label("&nbsp;", false); s_noAction = new Label("&nbsp;", false);
s_noAction.lock(); s_noAction.lock();
s_primary = new Label(GlobalizationUtil.globalize("cms.ui.primary_instance"), false); s_primary = new Label(GlobalizationUtil.globalize("cms.ui.primary_instance"), false);
s_primary.lock(); s_primary.lock();
s_link = new ControlLink(new Label(GlobalizationUtil.globalize("cms.ui.delete"))); s_link = new ControlLink(new Label(GlobalizationUtil.globalize("cms.ui.delete")));
s_link.setConfirmation("Permanently delete this item?"); // XXX G11N ? s_link.setConfirmation("Permanently delete this item?"); // XXX G11N ?
logger.debug("Static initalizer finished.");
} }
private ItemSelectionModel m_model; private ItemSelectionModel m_model;

View File

@ -56,6 +56,7 @@ import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.toolbox.ui.DataTable; import com.arsdigita.toolbox.ui.DataTable;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger;
/** /**
@ -171,10 +172,13 @@ public abstract class ItemTemplatesListing extends TemplatesListing {
// Static is safe since these components will never ever change // Static is safe since these components will never ever change
private static ControlLink s_link; private static ControlLink s_link;
private static final Logger logger = Logger.getLogger(AssignCellRenderer.class);
static { static {
logger.debug("Static initializer is starting...");
s_link = new ControlLink(new Label(GlobalizationUtil.globalize("cms.ui.templates.assign_template"))); s_link = new ControlLink(new Label(GlobalizationUtil.globalize("cms.ui.templates.assign_template")));
s_link.setClassAttr("assignTemplateLink"); s_link.setClassAttr("assignTemplateLink");
logger.debug("Static initializer finished.");
} }
public AssignCellRenderer() {} public AssignCellRenderer() {}

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui.type; package com.arsdigita.cms.ui.type;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
@ -45,7 +44,6 @@ import org.apache.log4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Iterator; import java.util.Iterator;
/** /**
* This class contains the component to generate a table * This class contains the component to generate a table
* of elements for a particular content type * of elements for a particular content type
@ -54,7 +52,6 @@ public class TypeElements extends BoxPanel {
private static Logger s_log = private static Logger s_log =
Logger.getLogger(TypeElements.class); Logger.getLogger(TypeElements.class);
private SingleSelectionModel m_types; private SingleSelectionModel m_types;
private Table m_elementsTable; private Table m_elementsTable;
private TableColumn m_removeColumn; private TableColumn m_removeColumn;
@ -91,7 +88,9 @@ public class TypeElements extends BoxPanel {
try { try {
type = new ContentType(typeId); type = new ContentType(typeId);
} catch (DataObjectNotFoundException e) { } catch (DataObjectNotFoundException e) {
UncheckedWrapperException.throwLoggedException(getClass(), "Unable to make content type for id: " + typeId, e); UncheckedWrapperException.throwLoggedException(getClass(), "Unable to make content type for id: "
+ typeId,
e);
} }
return type; return type;
} }
@ -100,20 +99,25 @@ public class TypeElements extends BoxPanel {
* Produce remove links. * Produce remove links.
*/ */
private static class RemoveCellRenderer implements TableCellRenderer { private static class RemoveCellRenderer implements TableCellRenderer {
private static final Logger logger = Logger.getLogger(RemoveCellRenderer.class);
private static Label s_noAction; private static Label s_noAction;
private static ControlLink s_link; private static ControlLink s_link;
static { static {
logger.debug("Static initializer is starting...");
s_noAction = new Label("&nbsp;", false); s_noAction = new Label("&nbsp;", false);
s_noAction.lock(); s_noAction.lock();
s_link = new ControlLink(new Label(GlobalizationUtil.globalize("cms.ui.type.element.delete"))); s_link = new ControlLink(new Label(GlobalizationUtil.globalize(
"cms.ui.type.element.delete")));
s_link.setConfirmation("Permanently remove this element?"); s_link.setConfirmation("Permanently remove this element?");
logger.debug("Static initalizer finished.");
} }
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
if ( ((Boolean) value).booleanValue() ) { if (((Boolean) value).booleanValue()) {
return s_link; return s_link;
} else { } else {
return s_noAction; return s_noAction;
@ -123,10 +127,11 @@ public class TypeElements extends BoxPanel {
// Removes an element // Removes an element
private class ElementRemover extends TableActionAdapter { private class ElementRemover extends TableActionAdapter {
public void cellSelected(TableActionEvent e) { public void cellSelected(TableActionEvent e) {
int col = e.getColumn().intValue(); int col = e.getColumn().intValue();
if ( m_removeColumn != m_elementsTable.getColumn(col) ) { if (m_removeColumn != m_elementsTable.getColumn(col)) {
return; return;
} }
@ -154,9 +159,11 @@ public class TypeElements extends BoxPanel {
*/ */
private Table makeElementsTable() { private Table makeElementsTable() {
final String[] headers = { "Name", "Element Type", "Multiplicity", "Remove" }; final String[] headers = {"Name", "Element Type", "Multiplicity",
"Remove"};
TableModelBuilder b = new TableModelBuilder() {
TableModelBuilder b = new TableModelBuilder () {
private boolean m_locked; private boolean m_locked;
public TableModel makeModel(final Table t, final PageState s) { public TableModel makeModel(final Table t, final PageState s) {
@ -164,11 +171,10 @@ public class TypeElements extends BoxPanel {
return new TableModel() { return new TableModel() {
DynamicObjectType dot = getDynamicObjectType(s); DynamicObjectType dot = getDynamicObjectType(s);
//NOTE: this only gets the non-inherited properties of //NOTE: this only gets the non-inherited properties of
// the object type // the object type
Iterator declaredProperties = dot.getObjectType().
Iterator declaredProperties = dot.getObjectType().getDeclaredProperties(); getDeclaredProperties();
Property currentProperty = null; Property currentProperty = null;
public int getColumnCount() { public int getColumnCount() {
@ -178,7 +184,8 @@ public class TypeElements extends BoxPanel {
public boolean nextRow() { public boolean nextRow() {
boolean next = declaredProperties.hasNext(); boolean next = declaredProperties.hasNext();
if (next) { if (next) {
currentProperty = (Property) declaredProperties.next(); currentProperty =
(Property) declaredProperties.next();
} }
return next; return next;
} }
@ -192,7 +199,8 @@ public class TypeElements extends BoxPanel {
case 0: case 0:
return currentProperty.getName(); return currentProperty.getName();
case 1: case 1:
String dataType = currentProperty.getType().getName(); String dataType = currentProperty.getType().
getName();
if (dataType.equals("String")) { if (dataType.equals("String")) {
return "text"; return "text";
} else if (dataType.equals("BigDecimal")) { } else if (dataType.equals("BigDecimal")) {
@ -210,13 +218,15 @@ public class TypeElements extends BoxPanel {
} else if (currentProperty.isCollection()) { } else if (currentProperty.isCollection()) {
return "0 to n"; return "0 to n";
} else { } else {
return new Integer(currentProperty.getMultiplicity()); return new Integer(currentProperty.
getMultiplicity());
} }
case 3: case 3:
return new Boolean(isRemovable()); return new Boolean(isRemovable());
default: default:
throw new IllegalArgumentException("columnIndex exceeds " + throw new IllegalArgumentException(
"number of columns available"); "columnIndex exceeds "
+ "number of columns available");
} }
} }
@ -232,7 +242,6 @@ public class TypeElements extends BoxPanel {
private boolean isRemovable() { private boolean isRemovable() {
return true; return true;
} }
}; };
} }
@ -244,7 +253,6 @@ public class TypeElements extends BoxPanel {
public boolean isLocked() { public boolean isLocked() {
return m_locked; return m_locked;
} }
}; };
Table result = new Table(b, headers); Table result = new Table(b, headers);
@ -256,5 +264,4 @@ public class TypeElements extends BoxPanel {
return result; return result;
} }
} }

View File

@ -109,10 +109,12 @@ public class Page extends BlockStylable implements Container {
static final Collection CONTROL_EVENT_KEYS; static final Collection CONTROL_EVENT_KEYS;
static { static {
s_log.debug("Static initalizer is starting...");
CONTROL_EVENT_KEYS = new ArrayList(3); CONTROL_EVENT_KEYS = new ArrayList(3);
CONTROL_EVENT_KEYS.add(SELECTED); CONTROL_EVENT_KEYS.add(SELECTED);
CONTROL_EVENT_KEYS.add(CONTROL_EVENT); CONTROL_EVENT_KEYS.add(CONTROL_EVENT);
CONTROL_EVENT_KEYS.add(CONTROL_VALUE); CONTROL_EVENT_KEYS.add(CONTROL_VALUE);
s_log.debug("Static initalizer finished.");
} }
/** /**

View File

@ -22,6 +22,7 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.list.ListModel; import com.arsdigita.bebop.list.ListModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.apache.log4j.Logger;
/** /**
* A class that provides a sample set of workflows and tasks. The class * A class that provides a sample set of workflows and tasks. The class
@ -37,6 +38,7 @@ import java.util.NoSuchElementException;
*/ */
public class SampleProcesses { public class SampleProcesses {
private static final Logger logger = Logger.getLogger(SampleProcesses.class);
private static SampleProcesses m_instance; private static SampleProcesses m_instance;
/** /**
@ -51,6 +53,7 @@ public class SampleProcesses {
// Set up some default task types // Set up some default task types
static { static {
logger.debug("Static initalizer starting...");
Task write = new Task("Write"); Task write = new Task("Write");
write.setAssignee("Authors"); write.setAssignee("Authors");
Task edit = new Task("Edit"); Task edit = new Task("Edit");
@ -68,6 +71,7 @@ public class SampleProcesses {
m_allTasks.add(approve); m_allTasks.add(approve);
m_allTasks.add(publish); m_allTasks.add(publish);
m_allTasks.add(review); m_allTasks.add(review);
logger.debug("Static initalizer finished...");
} }
public synchronized static SampleProcesses getInstance() { public synchronized static SampleProcesses getInstance() {

View File

@ -84,6 +84,7 @@ public class PageTransformer implements PresentationManager {
// load the default xsl parameter generators // load the default xsl parameter generators
static { static {
s_log.debug("Static initalizer starting...");
registerXSLParameterGenerator("contextPath", registerXSLParameterGenerator("contextPath",
new XSLParameterGenerator() { new XSLParameterGenerator() {
@ -167,6 +168,7 @@ public class PageTransformer implements PresentationManager {
return DispatcherHelper.getNegotiatedLocale().getLanguage(); return DispatcherHelper.getNegotiatedLocale().getLanguage();
} }
}); });
s_log.debug("Static initalizer finished.");
} }
// XXX These need to move somewhere else. // XXX These need to move somewhere else.
/** /**
@ -229,7 +231,8 @@ public class PageTransformer implements PresentationManager {
s_log.warn("Using getOutputStream instead of getWriter"); s_log.warn("Using getOutputStream instead of getWriter");
try { try {
return new PrintWriter(new OutputStreamWriter(resp.getOutputStream(), return new PrintWriter(new OutputStreamWriter(resp.
getOutputStream(),
charset)); charset));
} catch (IOException ex) { } catch (IOException ex) {
throw new UncheckedWrapperException(ex); throw new UncheckedWrapperException(ex);
@ -280,7 +283,8 @@ public class PageTransformer implements PresentationManager {
Profiler.startOp("XSLT"); Profiler.startOp("XSLT");
try { try {
final String charset = Globalization.getDefaultCharset(Kernel.getContext().getLocale()); final String charset = Globalization.getDefaultCharset(Kernel.
getContext().getLocale());
final String output = req.getParameter("output"); final String output = req.getParameter("output");
s_log.info("output=" + output); s_log.info("output=" + output);
@ -289,12 +293,14 @@ public class PageTransformer implements PresentationManager {
DeveloperSupport.startStage("PresMgr get stylesheet"); DeveloperSupport.startStage("PresMgr get stylesheet");
boolean fancyErrors = Bebop.getConfig().wantFancyXSLErrors() boolean fancyErrors = Bebop.getConfig().wantFancyXSLErrors()
|| Boolean.TRUE.equals(req.getAttribute(FANCY_ERRORS)); || Boolean.TRUE.equals(req.getAttribute(
FANCY_ERRORS));
// Get the stylesheet transformer object corresponding to the // Get the stylesheet transformer object corresponding to the
// current request. // current request.
final XSLTemplate template = Templating.getTemplate(req, final XSLTemplate template = Templating.getTemplate(req,
fancyErrors, !Boolean.TRUE.equals(req.getAttribute(CACHE_XSL_NONE))); fancyErrors, !Boolean.TRUE.
equals(req.getAttribute(CACHE_XSL_NONE)));
DeveloperSupport.endStage("PresMgr get stylesheet"); DeveloperSupport.endStage("PresMgr get stylesheet");
@ -322,7 +328,8 @@ public class PageTransformer implements PresentationManager {
while (entries.hasNext()) { while (entries.hasNext()) {
final Map.Entry entry = (Map.Entry) entries.next(); final Map.Entry entry = (Map.Entry) entries.next();
xf.setParameter((String) entry.getKey(), entry.getValue()); xf.setParameter((String) entry.getKey(),
entry.getValue());
} }
} }
@ -351,8 +358,10 @@ public class PageTransformer implements PresentationManager {
// copy and paste from BasePresentationManager // copy and paste from BasePresentationManager
if (Kernel.getConfig().isDebugEnabled()) { if (Kernel.getConfig().isDebugEnabled()) {
Document origDoc = (Document) req.getAttribute("com.arsdigita.xml.Document"); Document origDoc = (Document) req.getAttribute(
Debugger.addDebugger(new TransformationDebugger(template.getSource(), template.getDependents())); "com.arsdigita.xml.Document");
Debugger.addDebugger(new TransformationDebugger(template.
getSource(), template.getDependents()));
writer.print(Debugger.getDebugging(req)); writer.print(Debugger.getDebugging(req));
} }
@ -374,8 +383,10 @@ public class PageTransformer implements PresentationManager {
// current request. // current request.
template = Templating.getTemplate( template = Templating.getTemplate(
req, req,
Boolean.TRUE.equals(req.getAttribute(PageTransformer.FANCY_ERRORS)), Boolean.TRUE.equals(req.getAttribute(
!Boolean.TRUE.equals(req.getAttribute(PageTransformer.CACHE_XSL_NONE))); PageTransformer.FANCY_ERRORS)),
!Boolean.TRUE.equals(req.getAttribute(
PageTransformer.CACHE_XSL_NONE)));
endTransaction(req); endTransaction(req);
} finally { } finally {
DeveloperSupport.endStage("PresMgr get stylesheet"); DeveloperSupport.endStage("PresMgr get stylesheet");
@ -481,7 +492,8 @@ public class PageTransformer implements PresentationManager {
while (entries.hasNext()) { while (entries.hasNext()) {
final Map.Entry entry = (Map.Entry) entries.next(); final Map.Entry entry = (Map.Entry) entries.next();
String value = ((XSLParameterGenerator) entry.getValue()).generateValue(request); String value = ((XSLParameterGenerator) entry.getValue()).
generateValue(request);
if (value == null) { if (value == null) {
// XSL does not like nulls // XSL does not like nulls
value = ""; value = "";

View File

@ -123,7 +123,9 @@ public class Category extends ACSObject {
private static CategorizationConfig s_config = new CategorizationConfig(); private static CategorizationConfig s_config = new CategorizationConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
// Quasimodo: End // Quasimodo: End
public static final String ROOT_CATEGORY = "rootCategory"; public static final String ROOT_CATEGORY = "rootCategory";

View File

@ -24,6 +24,7 @@ import com.arsdigita.util.Assert;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import org.apache.log4j.Logger;
/** /**
* LibCheck uses the checklist mechanism to perform additional checks for * LibCheck uses the checklist mechanism to perform additional checks for
@ -37,14 +38,16 @@ import java.io.InputStreamReader;
public class LibCheck extends BaseCheck { public class LibCheck extends BaseCheck {
private static final Logger logger = Logger.getLogger(LibCheck.class);
// Integrating the packaging.MessageMap service class providing a // Integrating the packaging.MessageMap service class providing a
// package specific message file by overriding the variable in BaseCheck. // package specific message file by overriding the variable in BaseCheck.
static { static {
logger.debug("Static initializer starting...");
final InputStream in = LibCheck.class.getResourceAsStream final InputStream in = LibCheck.class.getResourceAsStream
("libcheck.messages_linux"); ("libcheck.messages_linux");
Assert.exists(in, InputStream.class); Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in)); s_messages.load(new InputStreamReader(in));
logger.debug("Static initializer finished...");
} }
private boolean checkJAAS() { private boolean checkJAAS() {

View File

@ -155,9 +155,11 @@ public final class Comodifications {
* the Proxy class do most of the work for me. * the Proxy class do most of the work for me.
*/ */
private static class ListHandler implements InvocationHandler { private static class ListHandler implements InvocationHandler {
private static final Logger logger = Logger.getLogger(ListHandler.class);
private final static Set s_mutators = new HashSet(); private final static Set s_mutators = new HashSet();
static { static {
logger.debug("Static initalizer starting...");
registerMutator("add", new Class[] {Integer.TYPE, Object.class}); registerMutator("add", new Class[] {Integer.TYPE, Object.class});
registerMutator("add", new Class[] {Object.class}); registerMutator("add", new Class[] {Object.class});
registerMutator("addAll", new Class[] {Collection.class}); registerMutator("addAll", new Class[] {Collection.class});
@ -169,6 +171,7 @@ public final class Comodifications {
registerMutator("removeAll", new Class[] {Collection.class}); registerMutator("removeAll", new Class[] {Collection.class});
registerMutator("retainAll", new Class[] {Collection.class}); registerMutator("retainAll", new Class[] {Collection.class});
registerMutator("set", new Class[] {Integer.TYPE, Object.class}); registerMutator("set", new Class[] {Integer.TYPE, Object.class});
logger.debug("Static initalizer finished.");
} }
private final static Method s_iteratorMethod = private final static Method s_iteratorMethod =

View File

@ -62,8 +62,10 @@ public final class Counter {
private final static DecimalFormat DURATION_FMT = new DecimalFormat(); private final static DecimalFormat DURATION_FMT = new DecimalFormat();
static { static {
s_log.debug("Static initalizer starting...");
DURATION_FMT.setGroupingSize(3); DURATION_FMT.setGroupingSize(3);
DURATION_FMT.setGroupingUsed(true); DURATION_FMT.setGroupingUsed(true);
s_log.debug("Static initalizer finished.");
} }

View File

@ -224,16 +224,20 @@ public final class LoggingProxyFactory implements LoggerConfigurator {
} }
private static class Handler implements InvocationHandler { private static class Handler implements InvocationHandler {
private static final Logger logger = Logger.getLogger(Handler.class);
private static final Method s_getProxiedObject; private static final Method s_getProxiedObject;
static { static {
logger.debug("Static initalizer starting...");
try { try {
s_getProxiedObject = s_getProxiedObject =
LoggingProxy.class.getMethod("getProxiedObject", LoggingProxy.class.getMethod("getProxiedObject",
new Class[] {}); new Class[] {});
} catch (NoSuchMethodException ex) { } catch (NoSuchMethodException ex) {
logger.error("Statis initalizer failed: ", ex);
throw new UncheckedWrapperException("failed", ex); throw new UncheckedWrapperException("failed", ex);
} }
logger.debug("Static initalizer finished...");
} }
private Config m_config; private Config m_config;

View File

@ -83,33 +83,31 @@ import org.xml.sax.helpers.DefaultHandler;
public abstract class BaseDispatcherServlet extends HttpServlet public abstract class BaseDispatcherServlet extends HttpServlet
implements Dispatcher, DispatcherConstants { implements Dispatcher, DispatcherConstants {
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger(
(BaseDispatcherServlet.class); BaseDispatcherServlet.class);
private final static int NOT_FOUND = 0; private final static int NOT_FOUND = 0;
private final static int STATIC_FILE = 1; private final static int STATIC_FILE = 1;
private final static int JSP_FILE = 2; private final static int JSP_FILE = 2;
private final static String WEB_XML_22_PUBLIC_ID = private final static String WEB_XML_22_PUBLIC_ID =
"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"; "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN";
private final static String WEB_XML_23_PUBLIC_ID = private final static String WEB_XML_23_PUBLIC_ID =
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"; "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN";
/** /**
* We use a Vector here instead of another collection because * We use a Vector here instead of another collection because
* Vector is synchronized. * Vector is synchronized.
*/ */
private static Vector s_listenerList = new Vector(); private static Vector s_listenerList = new Vector();
/** /**
* list of active requests * list of active requests
*/ */
private static Vector s_activeList = new Vector(); private static Vector s_activeList = new Vector();
static { static {
s_log.debug("Static initalizer starting...");
// Add the basic request listeners. // Add the basic request listeners.
BaseDispatcherServlet.addRequestListener(new RequestListener() { BaseDispatcherServlet.addRequestListener(new RequestListener() {
public void requestStarted(RequestEvent re) { public void requestStarted(RequestEvent re) {
DispatcherHelper.setRequest(re.getRequest()); DispatcherHelper.setRequest(re.getRequest());
} }
@ -127,6 +125,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
}); });
BaseDispatcherServlet.addRequestListener(new RequestListener() { BaseDispatcherServlet.addRequestListener(new RequestListener() {
public void requestStarted(RequestEvent re) { public void requestStarted(RequestEvent re) {
Kernel.getContext().getTransaction().begin(); Kernel.getContext().getTransaction().begin();
} }
@ -153,8 +152,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* it depends upon there being at least one DeveloperSupportListener when counting * it depends upon there being at least one DeveloperSupportListener when counting
* whether to log queries to webdevsupport. * whether to log queries to webdevsupport.
*/ */
com.arsdigita.developersupport.DeveloperSupport.addListener com.arsdigita.developersupport.DeveloperSupport.addListener(new com.arsdigita.developersupport.DeveloperSupportListener() {
(new com.arsdigita.developersupport.DeveloperSupportListener() {
public void requestStart(Object request) { public void requestStart(Object request) {
s_log.debug("DS: requestStart: " + request); s_log.debug("DS: requestStart: " + request);
} }
@ -162,10 +161,9 @@ public abstract class BaseDispatcherServlet extends HttpServlet
public void requestEnd(Object request) { public void requestEnd(Object request) {
s_log.debug("DS: requestEnd: " + request); s_log.debug("DS: requestEnd: " + request);
} }
});
s_log.debug("Static initalizer finished.");
} }
);
}
private List m_welcomeFiles = new ArrayList(); private List m_welcomeFiles = new ArrayList();
/** /**
@ -220,8 +218,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* @throws com.arsdigita.dispatcher.RedirectException if the dispatcher * @throws com.arsdigita.dispatcher.RedirectException if the dispatcher
* should redirect the client to the page contained in the exception * should redirect the client to the page contained in the exception
**/ **/
protected abstract RequestContext authenticateUser protected abstract RequestContext authenticateUser(HttpServletRequest req,
(HttpServletRequest req,
HttpServletResponse resp, HttpServletResponse resp,
RequestContext ctx) RequestContext ctx)
throws RedirectException; throws RedirectException;
@ -246,10 +243,9 @@ public abstract class BaseDispatcherServlet extends HttpServlet
throws ServletException, IOException { throws ServletException, IOException {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug s_log.debug("\n*** *** *** *** *** ***\n"
("\n*** *** *** *** *** ***\n" + + "Servicing request for URL '" + req.getRequestURI()
"Servicing request for URL '" + req.getRequestURI() + "'\n" + + "'\n" + "*** *** *** *** *** ***");
"*** *** *** *** *** ***");
} }
boolean reentrant = true; boolean reentrant = true;
@ -307,8 +303,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
// need an identifier for this particular request // need an identifier for this particular request
String requestId = String requestId =
Thread.currentThread().getName() + "|" + Thread.currentThread().getName() + "|" + System.
System.currentTimeMillis(); currentTimeMillis();
req.setAttribute(REENTRANCE_ATTRIBUTE, requestId); req.setAttribute(REENTRANCE_ATTRIBUTE, requestId);
s_activeList.add(requestId); s_activeList.add(requestId);
@ -345,8 +341,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
// whole object since it might actually be a // whole object since it might actually be a
// KernelRequestContext with user / session info // KernelRequestContext with user / session info
if (reqCtx instanceof InitialRequestContext) { if (reqCtx instanceof InitialRequestContext) {
((InitialRequestContext)reqCtx) ((InitialRequestContext) reqCtx).
.initializeURLFromRequest(req, true); initializeURLFromRequest(req, true);
} }
} }
} }
@ -382,7 +378,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
Throwable rootError; Throwable rootError;
do { do {
rootError = t; rootError = t;
t = ((ServletException)t).getRootCause(); t = ((ServletException) t).getRootCause();
} while (t instanceof ServletException); } while (t instanceof ServletException);
if (t != null) { if (t != null) {
rootError = t; rootError = t;
@ -395,7 +391,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
} else if (rootError != null } else if (rootError != null
&& (rootError instanceof RedirectSignal)) { && (rootError instanceof RedirectSignal)) {
s_log.debug("rethrowing RedirectSignal", rootError); s_log.debug("rethrowing RedirectSignal", rootError);
throw (RedirectSignal)rootError; throw (RedirectSignal) rootError;
} else { } else {
s_log.error("error in BaseDispatcherServlet", rootError); s_log.error("error in BaseDispatcherServlet", rootError);
throw new ServletException(rootError); throw new ServletException(rootError);
@ -411,13 +407,14 @@ public abstract class BaseDispatcherServlet extends HttpServlet
DeveloperSupport.endStage("BaseDispatcherServlet.service()"); DeveloperSupport.endStage("BaseDispatcherServlet.service()");
// run the request listener events // run the request listener events
fireFinishedListener( fireFinishedListener(
new RequestEvent(req, resp, reqCtx, false, finishedNormal)); new RequestEvent(req, resp, reqCtx, false,
finishedNormal));
// at this point, clear the attribute so // at this point, clear the attribute so
// a secondary request will work // a secondary request will work
// and remove the request from the list of currently-active // and remove the request from the list of currently-active
// requests // requests
Object requestId = req.getAttribute(REENTRANCE_ATTRIBUTE); Object requestId = req.getAttribute(REENTRANCE_ATTRIBUTE);
synchronized(s_activeList) { synchronized (s_activeList) {
s_activeList.remove(requestId); s_activeList.remove(requestId);
s_activeList.notifyAll(); s_activeList.notifyAll();
} }
@ -469,12 +466,12 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* listeners * listeners
*/ */
protected void fireFinishedListener(RequestEvent evt) { protected void fireFinishedListener(RequestEvent evt) {
for (int i = 0 ; i < s_listenerList.size(); i++) { for (int i = 0; i < s_listenerList.size(); i++) {
try { try {
((RequestListener)s_listenerList.get(i)).requestFinished(evt); ((RequestListener) s_listenerList.get(i)).requestFinished(evt);
} catch (Exception e) { } catch (Exception e) {
s_log.error("Error running request finished listener " + s_log.error("Error running request finished listener " + s_listenerList.
s_listenerList.get(i) + " (#" + i + ")", e); get(i) + " (#" + i + ")", e);
} }
} }
} }
@ -487,8 +484,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* listeners * listeners
*/ */
protected void fireStartListener(RequestEvent evt) { protected void fireStartListener(RequestEvent evt) {
for (int i = 0 ; i < s_listenerList.size(); i++) { for (int i = 0; i < s_listenerList.size(); i++) {
((RequestListener)s_listenerList.get(i)).requestStarted(evt); ((RequestListener) s_listenerList.get(i)).requestStarted(evt);
} }
} }
@ -496,6 +493,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* Kludge for returning a typed 2-tuple. * Kludge for returning a typed 2-tuple.
*/ */
private class StartRequestRecord { private class StartRequestRecord {
RequestContext m_reqCtx; RequestContext m_reqCtx;
HttpServletRequest m_req; HttpServletRequest m_req;
@ -517,10 +515,11 @@ public abstract class BaseDispatcherServlet extends HttpServlet
if (sema != null) { if (sema != null) {
while (s_activeList.indexOf(sema) != -1) { while (s_activeList.indexOf(sema) != -1) {
try { try {
synchronized(s_activeList) { synchronized (s_activeList) {
s_activeList.wait(); s_activeList.wait();
} }
} catch (InterruptedException ie) { } } catch (InterruptedException ie) {
}
} }
sess.removeAttribute(REDIRECT_SEMAPHORE); sess.removeAttribute(REDIRECT_SEMAPHORE);
} }
@ -552,8 +551,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
ServletContext sctx = this.getServletContext(); ServletContext sctx = this.getServletContext();
File realFile = new File(sctx.getRealPath(path)); File realFile = new File(sctx.getRealPath(path));
if (realFile.exists() && if (realFile.exists() && (!realFile.isDirectory() || hasWelcomeFile(
(!realFile.isDirectory() || hasWelcomeFile(realFile))) { realFile))) {
// yup. Go there, bypass the site map. // yup. Go there, bypass the site map.
// we have a concrete file so no forwarding to // we have a concrete file so no forwarding to
// rewrite the request URL is necessary. // rewrite the request URL is necessary.
@ -612,6 +611,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* web.xml * web.xml
*/ */
private class WebXMLReader extends DefaultHandler { private class WebXMLReader extends DefaultHandler {
StringBuffer m_buffer = new StringBuffer(); StringBuffer m_buffer = new StringBuffer();
public InputSource resolveEntity(String publicId, String systemId) public InputSource resolveEntity(String publicId, String systemId)

View File

@ -18,13 +18,12 @@
*/ */
package com.arsdigita.formbuilder; package com.arsdigita.formbuilder;
import com.arsdigita.bebop.event.ParameterListener; import com.arsdigita.bebop.event.ParameterListener;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger;
/** /**
* This class contains the attribute data type that are used for form * This class contains the attribute data type that are used for form
@ -36,8 +35,8 @@ import java.util.List;
*/ */
public class AttributeType { public class AttributeType {
private static final Logger logger = Logger.getLogger(AttributeType.class);
private Class m_parameterModelClass; private Class m_parameterModelClass;
private List m_validationListeners; private List m_validationListeners;
public AttributeType(Class parameterModelClass) { public AttributeType(Class parameterModelClass) {
@ -46,14 +45,12 @@ public class AttributeType {
m_validationListeners = new java.util.ArrayList(); m_validationListeners = new java.util.ArrayList();
} }
/** /**
* Standard attribute types * Standard attribute types
*/ */
public static AttributeType INTEGER; public static AttributeType INTEGER;
public static AttributeType TEXT; public static AttributeType TEXT;
public static AttributeType DATE; public static AttributeType DATE;
// The classes of the standard data types // The classes of the standard data types
private static Class s_integerClass; private static Class s_integerClass;
private static Class s_textClass; private static Class s_textClass;
@ -61,12 +58,15 @@ public class AttributeType {
// Initialization of the standard attribute types // Initialization of the standard attribute types
static { static {
logger.debug("Static initalizer starting...");
try { try {
s_integerClass = Class.forName("com.arsdigita.bebop.parameters.IntegerParameter"); s_integerClass = Class.forName(
s_textClass = Class.forName("com.arsdigita.bebop.parameters.StringParameter"); "com.arsdigita.bebop.parameters.IntegerParameter");
s_dateClass = Class.forName("com.arsdigita.bebop.parameters.DateParameter"); s_textClass = Class.forName(
"com.arsdigita.bebop.parameters.StringParameter");
s_dateClass = Class.forName(
"com.arsdigita.bebop.parameters.DateParameter");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new UncheckedWrapperException(e); throw new UncheckedWrapperException(e);
@ -75,10 +75,10 @@ public class AttributeType {
INTEGER = new AttributeType(s_integerClass); INTEGER = new AttributeType(s_integerClass);
TEXT = new AttributeType(s_textClass); TEXT = new AttributeType(s_textClass);
DATE = new AttributeType(s_dateClass); DATE = new AttributeType(s_dateClass);
logger.debug("Static initalizer finished.");
} }
//*** Attribute Methods //*** Attribute Methods
public Class getParameterModelClass() { public Class getParameterModelClass() {
return m_parameterModelClass; return m_parameterModelClass;
} }

View File

@ -67,7 +67,9 @@ public class Crypto {
public static final String CHARACTER_ENCODING = "UTF-8"; public static final String CHARACTER_ENCODING = "UTF-8";
static { static {
s_log.debug("Static initalizer starting...");
Security.addProvider(new BouncyCastleProvider()); Security.addProvider(new BouncyCastleProvider());
s_log.debug("Static initalizer finished");
} }
/** /**

View File

@ -48,8 +48,10 @@ public class URLLoginModule extends UserLoginModule {
private static Set s_models = new HashSet(); private static Set s_models = new HashSet();
static { static {
s_log.debug("Static initalizer starting...");
s_models.add(NORMAL_PARAM); s_models.add(NORMAL_PARAM);
s_models.add(SECURE_PARAM); s_models.add(SECURE_PARAM);
s_log.debug("Static initalizer finished...");
} }
/** /**

View File

@ -63,6 +63,7 @@ public class ErrorReport {
private static final Logger s_log = Logger.getLogger(ErrorReport.class); private static final Logger s_log = Logger.getLogger(ErrorReport.class);
static { static {
s_log.debug("Static initalizer starting...");
final JavaPropertyReader reader = new JavaPropertyReader final JavaPropertyReader reader = new JavaPropertyReader
(System.getProperties()); (System.getProperties());
@ -76,6 +77,7 @@ public class ErrorReport {
if (dir != null) { if (dir != null) {
ErrorReport.initializeAppender(dir); ErrorReport.initializeAppender(dir);
} }
s_log.debug("Static initalizer finished.");
} }
public static void initializeAppender(String directory) { public static void initializeAppender(String directory) {

View File

@ -69,9 +69,13 @@ import java.util.Set;
* @author Ron Henderson * @author Ron Henderson
* @version $Id: Mail.java 994 2005-11-14 14:29:25Z apevec $ * @version $Id: Mail.java 994 2005-11-14 14:29:25Z apevec $
*/ */
public class Mail implements MessageType { public class Mail implements MessageType {
/**
* Used for logging.
*/
private static final Logger s_log =
Logger.getLogger(Mail.class);
private static MailConfig s_config; private static MailConfig s_config;
public static MailConfig getConfig() { public static MailConfig getConfig() {
@ -82,119 +86,93 @@ public class Mail implements MessageType {
} }
return s_config; return s_config;
} }
private static final InternetAddress[] EMPTY_ADDRESS_LIST = private static final InternetAddress[] EMPTY_ADDRESS_LIST =
new InternetAddress[0]; new InternetAddress[0];
/** /**
* Table of message headers. * Table of message headers.
*/ */
private Hashtable m_headers; private Hashtable m_headers;
/** /**
* Email addresses the message is being sent to. * Email addresses the message is being sent to.
*/ */
private InternetAddress[] m_to; private InternetAddress[] m_to;
private InternetAddress[] m_filteredTo = EMPTY_ADDRESS_LIST; private InternetAddress[] m_filteredTo = EMPTY_ADDRESS_LIST;
private InternetAddress[] m_invalidTo = EMPTY_ADDRESS_LIST; private InternetAddress[] m_invalidTo = EMPTY_ADDRESS_LIST;
private static Set s_invalidDomains = new HashSet(); private static Set s_invalidDomains = new HashSet();
static { static {
s_log.debug("Static initalizer starting...");
s_invalidDomains.add("example.com"); s_invalidDomains.add("example.com");
s_log.debug("Static initalizer finished.");
} }
/** /**
* Email address the message is being sent from. * Email address the message is being sent from.
*/ */
private InternetAddress m_from; private InternetAddress m_from;
/** /**
* Email address used for replies to this message. * Email address used for replies to this message.
*/ */
private InternetAddress[] m_replyTo; private InternetAddress[] m_replyTo;
/** /**
* Email addresses that the message is being carbon-copied to. * Email addresses that the message is being carbon-copied to.
*/ */
private InternetAddress[] m_cc; private InternetAddress[] m_cc;
/** /**
* Email addresses that the message is being blind carbon-copied to. * Email addresses that the message is being blind carbon-copied to.
*/ */
private InternetAddress[] m_bcc; private InternetAddress[] m_bcc;
/** /**
* Message subject. * Message subject.
*/ */
private String m_subject; private String m_subject;
/** /**
* Message body (can be text or HTML). * Message body (can be text or HTML).
*/ */
private String m_body; private String m_body;
/** /**
* Message body alternate (if the body is HTML) * Message body alternate (if the body is HTML)
*/ */
private String m_alternate; private String m_alternate;
/** /**
* Encoding specification for m_body and m_alternate (optional). * Encoding specification for m_body and m_alternate (optional).
* Default value (null) implies "us-ascii" encoding. * Default value (null) implies "us-ascii" encoding.
*/ */
private String m_encoding; private String m_encoding;
/** /**
* Message attachments (optional) * Message attachments (optional)
*/ */
private MimeMultipart m_attachments; private MimeMultipart m_attachments;
/** /**
* Unique identifier for each mail send out. * Unique identifier for each mail send out.
*/ */
private String m_messageID; private String m_messageID;
/** /**
* Session object used to send mail. * Session object used to send mail.
*/ */
private static Session s_session; private static Session s_session;
/** /**
* SMTP host to connect to. Only used to override the default for * SMTP host to connect to. Only used to override the default for
* testing purposes. * testing purposes.
*/ */
private static String s_host; private static String s_host;
/** /**
* SMTP port to connect to. Only used to override the default for * SMTP port to connect to. Only used to override the default for
* testing purposes. * testing purposes.
*/ */
private static String s_port; private static String s_port;
// Constants used by Mail // Constants used by Mail
final static String CONTENT_TYPE = "Content-Type"; final static String CONTENT_TYPE = "Content-Type";
final static String CONTENT_ID = "Content-ID"; final static String CONTENT_ID = "Content-ID";
final static String MIXED = "mixed"; final static String MIXED = "mixed";
final static String ALTERNATIVE = "alternative"; final static String ALTERNATIVE = "alternative";
/** /**
* Disposition of "inline" * Disposition of "inline"
*/ */
public final static String INLINE = javax.mail.Part.INLINE; public final static String INLINE = javax.mail.Part.INLINE;
/** /**
* Disposition of "attachment" * Disposition of "attachment"
*/ */
public final static String ATTACHMENT = javax.mail.Part.ATTACHMENT; public final static String ATTACHMENT = javax.mail.Part.ATTACHMENT;
/**
* Used for logging.
*/
private static final Logger s_log =
Logger.getLogger(Mail.class);
/** /**
* Default constructor. Must use the setTo, setSubject (and so on) * Default constructor. Must use the setTo, setSubject (and so on)
* methods to create a valid mail message. * methods to create a valid mail message.
@ -212,8 +190,7 @@ public class Mail implements MessageType {
*/ */
public Mail(String to, public Mail(String to,
String from, String from,
String subject) String subject) {
{
this(to, from, subject, null); this(to, from, subject, null);
} }
@ -228,8 +205,7 @@ public class Mail implements MessageType {
public Mail(String to, public Mail(String to,
String from, String from,
String subject, String subject,
String body) String body) {
{
m_to = (to == null ? EMPTY_ADDRESS_LIST : parseAddressField(to)); m_to = (to == null ? EMPTY_ADDRESS_LIST : parseAddressField(to));
filterRecipients(); filterRecipients();
m_from = (from == null ? null : parseAddress(from)); m_from = (from == null ? null : parseAddress(from));
@ -251,9 +227,8 @@ public class Mail implements MessageType {
String from, String from,
String subject, String subject,
String body, String body,
String enc) String enc) {
{ this(to, from, subject, body);
this(to,from,subject,body);
setEncoding(enc); setEncoding(enc);
} }
@ -265,26 +240,22 @@ public class Mail implements MessageType {
* @param subject the subject for the message * @param subject the subject for the message
* @param body the plain text body of the message * @param body the plain text body of the message
*/ */
public static void send(String to, public static void send(String to,
String from, String from,
String subject, String subject,
String body) String body)
throws MessagingException, throws MessagingException,
SendFailedException SendFailedException {
{ Mail msg = new Mail(to, from, subject, body);
Mail msg = new Mail(to,from,subject,body);
msg.send(); msg.send();
} }
/** /**
* Sends the message. * Sends the message.
*/ */
public void send() public void send()
throws MessagingException, throws MessagingException,
SendFailedException SendFailedException {
{
Transport transport = getSession().getTransport(); Transport transport = getSession().getTransport();
transport.connect(); transport.connect();
send(transport); send(transport);
@ -300,11 +271,9 @@ public class Mail implements MessageType {
* also such returned from the server. Applications might try * also such returned from the server. Applications might try
* to catch this and re-schedule sending the mail. * to catch this and re-schedule sending the mail.
*/ */
void send(Transport transport) void send(Transport transport)
throws MessagingException, throws MessagingException,
SendFailedException SendFailedException {
{
Message msg = null; Message msg = null;
if (m_filteredTo.length > 0) { if (m_filteredTo.length > 0) {
msg = getMessage(); msg = getMessage();
@ -329,8 +298,8 @@ public class Mail implements MessageType {
try { try {
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
msg.writeTo(os); msg.writeTo(os);
s_log.debug("message sent:\n" + os.toString() + s_log.debug("message sent:\n" + os.toString()
"\n-- EOT --"); + "\n-- EOT --");
} catch (IOException ex) { } catch (IOException ex) {
s_log.error("unable to log message"); s_log.error("unable to log message");
} }
@ -338,10 +307,10 @@ public class Mail implements MessageType {
s_log.debug("no message sent. No valid recipients:\n"); s_log.debug("no message sent. No valid recipients:\n");
} }
} else { } else {
s_log.info("message sent to <" + Arrays.asList(m_filteredTo) + "> from <" + m_from + s_log.info("message sent to <" + Arrays.asList(m_filteredTo)
"> subject <" + m_subject + ">"); + "> from <" + m_from + "> subject <" + m_subject + ">");
s_log.info("messages filtered for <" + Arrays.asList(m_invalidTo) + "> from <" + m_from + s_log.info("messages filtered for <" + Arrays.asList(m_invalidTo)
"> subject <" + m_subject + ">"); + "> from <" + m_from + "> subject <" + m_subject + ">");
} }
} }
@ -413,7 +382,7 @@ public class Mail implements MessageType {
m_headers = new Hashtable(); m_headers = new Hashtable();
} }
m_headers.put(name,value); m_headers.put(name, value);
} }
/** /**
@ -458,7 +427,6 @@ public class Mail implements MessageType {
* *
* @param enc the requested encoding * @param enc the requested encoding
*/ */
public void setEncoding(String enc) { public void setEncoding(String enc) {
m_encoding = enc; m_encoding = enc;
} }
@ -469,12 +437,10 @@ public class Mail implements MessageType {
* *
* @return the string value of the character encoding being used * @return the string value of the character encoding being used
*/ */
public String getEncoding() { public String getEncoding() {
return m_encoding; return m_encoding;
} }
/** /**
* Adds an attachment to a message. This method is private but * Adds an attachment to a message. This method is private but
* is invoked by all of the other attach methods once they've * is invoked by all of the other attach methods once they've
@ -482,10 +448,8 @@ public class Mail implements MessageType {
* *
* @param part the message part to attach * @param part the message part to attach
*/ */
private void attach(MimeBodyPart part) private void attach(MimeBodyPart part)
throws MessagingException throws MessagingException {
{
if (m_attachments == null) { if (m_attachments == null) {
m_attachments = new MimeMultipart(); m_attachments = new MimeMultipart();
} }
@ -501,12 +465,10 @@ public class Mail implements MessageType {
* @param name the name of the attachment * @param name the name of the attachment
* @param description a description of the attachment * @param description a description of the attachment
*/ */
public void attach(URL url, public void attach(URL url,
String name, String name,
String description) String description)
throws MessagingException throws MessagingException {
{
attach(url, name, description, Mail.ATTACHMENT); attach(url, name, description, Mail.ATTACHMENT);
} }
@ -519,13 +481,11 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
public void attach(URL url, public void attach(URL url,
String name, String name,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{
MimeBodyPart part = new MimeBodyPart(); MimeBodyPart part = new MimeBodyPart();
attach(part); attach(part);
@ -546,12 +506,10 @@ public class Mail implements MessageType {
* @param name the name of the attachment * @param name the name of the attachment
* @param description a description of the attachment * @param description a description of the attachment
*/ */
public void attach(File path, public void attach(File path,
String name, String name,
String description) String description)
throws MessagingException throws MessagingException {
{
attach(path, name, description, ATTACHMENT); attach(path, name, description, ATTACHMENT);
} }
@ -565,13 +523,11 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
public void attach(File path, public void attach(File path,
String name, String name,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{
MimeBodyPart part = new MimeBodyPart(); MimeBodyPart part = new MimeBodyPart();
attach(part); attach(part);
@ -592,13 +548,11 @@ public class Mail implements MessageType {
* @param type the MIME type of the attachment * @param type the MIME type of the attachment
* @param name the name of the attachment * @param name the name of the attachment
*/ */
public void attach(byte[] data, public void attach(byte[] data,
String type, String type,
String name) String name)
throws MessagingException throws MessagingException {
{ attach(data, type, name, null, ATTACHMENT);
attach(data,type,name,null,ATTACHMENT);
} }
/** /**
@ -611,16 +565,14 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
public void attach(byte[] data, public void attach(byte[] data,
String type, String type,
String name, String name,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{ ByteArrayDataSource ds = new ByteArrayDataSource(data, type, name);
ByteArrayDataSource ds = new ByteArrayDataSource(data,type,name); attach(ds, description, disposition);
attach(ds,description,disposition);
} }
/** /**
@ -631,13 +583,11 @@ public class Mail implements MessageType {
* @param type the MIME type of the attachment * @param type the MIME type of the attachment
* @param name the name of the attachment * @param name the name of the attachment
*/ */
public void attach(String data, public void attach(String data,
String type, String type,
String name) String name)
throws MessagingException throws MessagingException {
{ attach(data, type, name, null, ATTACHMENT);
attach(data,type,name,null,ATTACHMENT);
} }
/** /**
@ -650,16 +600,14 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
public void attach(String data, public void attach(String data,
String type, String type,
String name, String name,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{ ByteArrayDataSource ds = new ByteArrayDataSource(data, type, name);
ByteArrayDataSource ds = new ByteArrayDataSource(data,type,name); attach(ds, description, disposition);
attach(ds,description,disposition);
} }
/** /**
@ -671,13 +619,11 @@ public class Mail implements MessageType {
* @param type the MIME type of the attachment * @param type the MIME type of the attachment
* @param name the name of the attachment * @param name the name of the attachment
*/ */
public void attach(ByteArrayInputStream is, public void attach(ByteArrayInputStream is,
String type, String type,
String name) String name)
throws MessagingException throws MessagingException {
{ attach(is, type, name, null, ATTACHMENT);
attach(is,type,name,null,ATTACHMENT);
} }
/** /**
@ -691,15 +637,13 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
public void attach(ByteArrayInputStream is, public void attach(ByteArrayInputStream is,
String type, String type,
String name, String name,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{ ByteArrayDataSource ds = new ByteArrayDataSource(is, type, name);
ByteArrayDataSource ds = new ByteArrayDataSource(is,type,name);
attach(ds, description, disposition); attach(ds, description, disposition);
} }
@ -713,12 +657,10 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
protected void attach(ByteArrayDataSource dataSource, protected void attach(ByteArrayDataSource dataSource,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{
MimeBodyPart part = new MimeBodyPart(); MimeBodyPart part = new MimeBodyPart();
attach(part); attach(part);
@ -730,7 +672,6 @@ public class Mail implements MessageType {
part.setDisposition(disposition); part.setDisposition(disposition);
} }
/** /**
* Attaches content to a message by supplying a DataHandler. All * Attaches content to a message by supplying a DataHandler. All
* relevant parameters (MIME type, name, ...) are determined * relevant parameters (MIME type, name, ...) are determined
@ -738,14 +679,11 @@ public class Mail implements MessageType {
* *
* @param dh a DataHandler for some piece of content. * @param dh a DataHandler for some piece of content.
*/ */
public void attach(DataHandler dh) public void attach(DataHandler dh)
throws MessagingException throws MessagingException {
{
attach(dh, null, ATTACHMENT); attach(dh, null, ATTACHMENT);
} }
/** /**
* Attaches content to a message by supplying a DataHandler. Sets * Attaches content to a message by supplying a DataHandler. Sets
* the description and disposition of the content. * the description and disposition of the content.
@ -754,12 +692,10 @@ public class Mail implements MessageType {
* @param description a description of the attachment * @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE * @param disposition Mail.ATTACHMENT or Mail.INLINE
*/ */
public void attach(DataHandler dh, public void attach(DataHandler dh,
String description, String description,
String disposition) String disposition)
throws MessagingException throws MessagingException {
{
MimeBodyPart part = new MimeBodyPart(); MimeBodyPart part = new MimeBodyPart();
attach(part); attach(part);
@ -775,7 +711,6 @@ public class Mail implements MessageType {
* initializer and any of properties that can be overridden at * initializer and any of properties that can be overridden at
* the package level. * the package level.
*/ */
static synchronized Session getSession() { static synchronized Session getSession() {
if (s_session == null) { if (s_session == null) {
@ -805,10 +740,8 @@ public class Mail implements MessageType {
* example, to queue a number of messages to send all at once rather * example, to queue a number of messages to send all at once rather
* than invoke the Mail.send() method for each instance.) * than invoke the Mail.send() method for each instance.)
*/ */
private Message getMessage() private Message getMessage()
throws MessagingException throws MessagingException {
{
// Create the message // Create the message
MimeMessage msg = new MimeMessage(getSession()); MimeMessage msg = new MimeMessage(getSession());
@ -838,7 +771,7 @@ public class Mail implements MessageType {
// Encode the subject // Encode the subject
String enc_subj; String enc_subj;
try { try {
enc_subj = MimeUtility.encodeText(m_subject,m_encoding,null); enc_subj = MimeUtility.encodeText(m_subject, m_encoding, null);
} catch (UnsupportedEncodingException uee) { } catch (UnsupportedEncodingException uee) {
s_log.warn("unable to encode subject: " + uee); s_log.warn("unable to encode subject: " + uee);
enc_subj = m_subject; enc_subj = m_subject;
@ -853,7 +786,7 @@ public class Mail implements MessageType {
String value = (String) m_headers.get(name); String value = (String) m_headers.get(name);
String enc_v; String enc_v;
try { try {
enc_v = MimeUtility.encodeText(value,m_encoding,null); enc_v = MimeUtility.encodeText(value, m_encoding, null);
} catch (UnsupportedEncodingException uee) { } catch (UnsupportedEncodingException uee) {
s_log.warn("unable to encode header element: " + uee); s_log.warn("unable to encode header element: " + uee);
enc_v = value; enc_v = value;
@ -875,7 +808,6 @@ public class Mail implements MessageType {
* @param host the SMTP host to connect to * @param host the SMTP host to connect to
* @param port the port number on that host * @param port the port number on that host
*/ */
synchronized static void setSmtpServer(String host, String port) { synchronized static void setSmtpServer(String host, String port) {
s_host = host; s_host = host;
s_port = port; s_port = port;
@ -884,7 +816,6 @@ public class Mail implements MessageType {
s_session = null; s_session = null;
} }
/** /**
* Returns the SMTP mail host for debugging and account information. * Returns the SMTP mail host for debugging and account information.
* @return the SMTP mail host for debugging and account information. * @return the SMTP mail host for debugging and account information.
@ -893,17 +824,14 @@ public class Mail implements MessageType {
return s_host; return s_host;
} }
/** /**
* Writes the content of the message to the given output stream. * Writes the content of the message to the given output stream.
* Useful for debugging. * Useful for debugging.
* *
* @param os the output stream to write the message to * @param os the output stream to write the message to
*/ */
public void writeTo(OutputStream os) public void writeTo(OutputStream os)
throws MessagingException throws MessagingException {
{
try { try {
getMessage().writeTo(os); getMessage().writeTo(os);
} catch (IOException ex) { } catch (IOException ex) {
@ -919,7 +847,7 @@ public class Mail implements MessageType {
if (str.indexOf(",") != -1) { if (str.indexOf(",") != -1) {
ArrayList a = new ArrayList(); ArrayList a = new ArrayList();
StringTokenizer st = new StringTokenizer(str,",",false); StringTokenizer st = new StringTokenizer(str, ",", false);
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
a.add(st.nextToken()); a.add(st.nextToken());
} }
@ -961,12 +889,12 @@ public class Mail implements MessageType {
address = str; address = str;
} else { } else {
int sp = str.lastIndexOf(" "); int sp = str.lastIndexOf(" ");
personal = str.substring(0,sp); personal = str.substring(0, sp);
address = str.substring(sp+1); address = str.substring(sp + 1);
} }
try { try {
addr = new InternetAddress(address,personal); addr = new InternetAddress(address, personal);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
s_log.error("unable to parse address: " + str); s_log.error("unable to parse address: " + str);
} }
@ -1016,18 +944,16 @@ public class Mail implements MessageType {
int sp = str.lastIndexOf(":"); int sp = str.lastIndexOf(":");
String name = str.substring(0, sp); String name = str.substring(0, sp);
String value = (str.substring(sp+1)).trim(); String value = (str.substring(sp + 1)).trim();
headers.put(name,value); headers.put(name, value);
} }
/** /**
* Utility function to prepare the content of the message. * Utility function to prepare the content of the message.
*/ */
private Message prepareMessageContent(MimeMessage msg) private Message prepareMessageContent(MimeMessage msg)
throws MessagingException throws MessagingException {
{
if (m_alternate == null && m_attachments == null) { if (m_alternate == null && m_attachments == null) {
// We have a plain-text message with no attachments. Use // We have a plain-text message with no attachments. Use
@ -1122,12 +1048,14 @@ public class Mail implements MessageType {
filtered.add(m_to[i]); filtered.add(m_to[i]);
} else { } else {
invalid.add(m_to[i]); invalid.add(m_to[i]);
s_log.debug("filtering message to non-existent email address " + m_to[i]); s_log.debug("filtering message to non-existent email address "
+ m_to[i]);
} }
} }
m_filteredTo = (InternetAddress[]) filtered.toArray(new InternetAddress[filtered.size()]); m_filteredTo = (InternetAddress[]) filtered.toArray(new InternetAddress[filtered.
m_invalidTo = (InternetAddress[]) invalid.toArray(new InternetAddress[invalid.size()]); size()]);
m_invalidTo = (InternetAddress[]) invalid.toArray(new InternetAddress[invalid.
size()]);
return m_filteredTo; return m_filteredTo;
} }
} }

View File

@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger;
/** /**
* BaseCheck: Extension of the Check abstract class, which can be used as a * BaseCheck: Extension of the Check abstract class, which can be used as a
@ -45,6 +46,7 @@ import java.util.List;
abstract public class BaseCheck extends Check { abstract public class BaseCheck extends Check {
private static final Logger logger = Logger.getLogger(BaseCheck.class);
public static final String versionId = public static final String versionId =
"$Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic $" + "$Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " + " by $Author: sskracic $, " +
@ -53,12 +55,14 @@ abstract public class BaseCheck extends Check {
public static final MessageMap s_messages = new MessageMap(); public static final MessageMap s_messages = new MessageMap();
static { static {
logger.debug("Static initalizer starting...");
final InputStream in = BaseCheck.class.getResourceAsStream final InputStream in = BaseCheck.class.getResourceAsStream
("basecheck.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));
logger.debug("Static initalizer finished.");
} }
public static String message(final String key) { public static String message(final String key) {

View File

@ -28,6 +28,7 @@ import java.sql.Connection;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import org.apache.log4j.Logger;
/** /**
@ -43,6 +44,7 @@ import java.io.InputStreamReader;
public class CheckDB extends BaseCheck { public class CheckDB extends BaseCheck {
private static final Logger logger = Logger.getLogger(CheckDB.class);
public final static String versionId = public final static String versionId =
"$Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $" + "$Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " + " by $Author: sskracic $, " +
@ -51,10 +53,12 @@ public class CheckDB extends BaseCheck {
// Integration of service class packaging.MessageMap. // Integration of service class packaging.MessageMap.
// Specifies a package specific message file overriding BaseCheck // Specifies a package specific message file overriding BaseCheck
static { static {
logger.debug("Static initalizer starting...");
final InputStream in = CheckDB.class.getResourceAsStream final InputStream in = CheckDB.class.getResourceAsStream
("checkdb.messages_linux"); ("checkdb.messages_linux");
Assert.exists(in, InputStream.class); Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in)); s_messages.load(new InputStreamReader(in));
logger.debug("Static initalizer finished.");
} }

View File

@ -37,6 +37,7 @@ import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
/** /**
* Get * Get
@ -49,37 +50,31 @@ import org.apache.commons.cli.PosixParser;
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt; * @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Revision: #6 $ $Date: 2004/08/16 $ * @version $Revision: #6 $ $Date: 2004/08/16 $
**/ **/
class Get extends Command { class Get extends Command {
public static final Logger logger = Logger.getLogger(Get.class);
public final static String versionId = public final static String versionId =
"$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $" + "$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $"
" by $Author: apevec $, " + + " by $Author: apevec $, "
"$DateTime: 2004/08/16 18:10:38 $"; + "$DateTime: 2004/08/16 18:10:38 $";
private static final Options OPTIONS = getOptions(); private static final Options OPTIONS = getOptions();
static { static {
logger.debug("Static initalizer starting...");
OptionGroup group = new OptionGroup(); OptionGroup group = new OptionGroup();
group.addOption group.addOption(OptionBuilder.hasArg(false).withLongOpt("all").
(OptionBuilder withDescription("Lists all configuration parameters").create(
.hasArg(false) "all"));
.withLongOpt("all") group.addOption(OptionBuilder.hasArg().withArgName("PARAMETER").
.withDescription("Lists all configuration parameters") withLongOpt("value").withDescription(
.create("all")); "Prints a scalar value without the key").create("value"));
group.addOption
(OptionBuilder
.hasArg()
.withArgName("PARAMETER")
.withLongOpt("value")
.withDescription("Prints a scalar value without the key")
.create("value"));
OPTIONS.addOptionGroup(group); OPTIONS.addOptionGroup(group);
logger.debug("Static initalizer finished.");
} }
public Get() { public Get() {
super("get", "Print one or more values from a CCM " + super("get", "Print one or more values from a CCM "
"configuration database"); + "configuration database");
} }
public boolean run(String[] args) { public boolean run(String[] args) {
@ -107,10 +102,9 @@ class Get extends Command {
String[] names; String[] names;
if (line.hasOption("value")) { if (line.hasOption("value")) {
names = new String[] { line.getOptionValue("value") }; names = new String[]{line.getOptionValue("value")};
if (line.getArgs().length > 0) { if (line.getArgs().length > 0) {
System.err.println System.err.println("--value option does not allow parameters");
("--value option does not allow parameters");
return false; return false;
} }
} else { } else {
@ -138,10 +132,12 @@ class Get extends Command {
parameters.add(param); parameters.add(param);
} }
} }
if (err) { return false; } if (err) {
return false;
}
} }
for (Iterator it = parameters.iterator(); it.hasNext(); ) { for (Iterator it = parameters.iterator(); it.hasNext();) {
Parameter param = (Parameter) it.next(); Parameter param = (Parameter) it.next();
Object value = config.get(param); Object value = config.get(param);
Properties props = new Properties(); Properties props = new Properties();
@ -174,12 +170,13 @@ class Get extends Command {
new BufferedReader(new StringReader(baos.toString())); new BufferedReader(new StringReader(baos.toString()));
while (true) { while (true) {
String line = reader.readLine(); String line = reader.readLine();
if (line == null) { return; } if (line == null) {
return;
}
if (line.trim().startsWith("#")) { if (line.trim().startsWith("#")) {
continue; continue;
} }
out.println(line); out.println(line);
} }
} }
} }

View File

@ -82,6 +82,7 @@ public class HostInit {
private static final Options OPTIONS = new Options(); private static final Options OPTIONS = new Options();
static { static {
s_log.debug("Static initalizer starting...");
OPTIONS.addOption OPTIONS.addOption
(OptionBuilder (OptionBuilder
.hasArg() .hasArg()
@ -109,6 +110,7 @@ public class HostInit {
.withLongOpt("clean") .withLongOpt("clean")
.withDescription("Remove the destination directory before copying files") .withDescription("Remove the destination directory before copying files")
.create()); .create());
s_log.debug("Static initalizer finsished.");
} }
private static final void err(String msg) { private static final void err(String msg) {

View File

@ -71,6 +71,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
/** /**
* PackageTool worker class, implements the "load" command. * PackageTool worker class, implements the "load" command.
@ -85,9 +86,11 @@ import org.apache.commons.cli.PosixParser;
class Load extends Command { class Load extends Command {
private static final Logger logger = Logger.getLogger(Load.class);
private static final Options OPTIONS = getOptions(); private static final Options OPTIONS = getOptions();
static { static {
logger.debug("Static initalizer starting...");
OPTIONS.addOption OPTIONS.addOption
(OptionBuilder (OptionBuilder
.hasArg(false) .hasArg(false)
@ -146,6 +149,7 @@ class Load extends Command {
.withDescription("Log parameter values as key-value " + .withDescription("Log parameter values as key-value " +
"pairs in FILE") "pairs in FILE")
.create());*/ .create());*/
logger.debug("Static initalizer finished.");
} }
/** /**

View File

@ -28,6 +28,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
/** /**
* Set * Set
@ -43,6 +44,7 @@ import org.apache.commons.cli.PosixParser;
class Set extends Command { class Set extends Command {
private final static Logger logger = Logger.getLogger(Set.class);
public final static String versionId = public final static String versionId =
"$Id: Set.java 736 2005-09-01 10:46:05Z sskracic $" + "$Id: Set.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " + " by $Author: sskracic $, " +
@ -51,12 +53,14 @@ class Set extends Command {
private static final Options OPTIONS = getOptions(); private static final Options OPTIONS = getOptions();
static { static {
logger.debug("Static initalizer starting...");
OPTIONS.addOption OPTIONS.addOption
(OptionBuilder (OptionBuilder
.hasArg(false) .hasArg(false)
.withLongOpt("interactive") .withLongOpt("interactive")
.withDescription("Interactively edit configuration values") .withDescription("Interactively edit configuration values")
.create()); .create());
logger.debug("Static initalizer finished.");
} }
public Set() { public Set() {

View File

@ -29,6 +29,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
/** /**
* Unload * Unload
@ -39,6 +40,7 @@ import org.apache.commons.cli.PosixParser;
class Unload extends Command { class Unload extends Command {
private static final Logger logger = Logger.getLogger(Unload.class);
public final static String versionId = public final static String versionId =
"$Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $" + "$Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " + " by $Author: sskracic $, " +
@ -47,20 +49,24 @@ class Unload extends Command {
private static final Options OPTIONS = new Options(); private static final Options OPTIONS = new Options();
static { static {
logger.debug("Static initalizer starting...");
OPTIONS.addOption OPTIONS.addOption
(OptionBuilder (OptionBuilder
.hasArg(false) .hasArg(false)
.withLongOpt("config") .withLongOpt("config")
.withDescription("Unload configuration") .withDescription("Unload configuration")
.create()); .create());
logger.debug("Static initalizer finished.");
} }
private static final Set EXCLUDE = new HashSet(); private static final Set EXCLUDE = new HashSet();
static { static {
logger.debug("Static initalizer starting...");
EXCLUDE.add("resin.conf"); EXCLUDE.add("resin.conf");
EXCLUDE.add("resin.pid"); EXCLUDE.add("resin.pid");
EXCLUDE.add("server.xml"); EXCLUDE.add("server.xml");
logger.debug("Static initalizer finished.");
} }
public Unload() { public Unload() {

View File

@ -41,6 +41,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
@ -52,6 +53,7 @@ import org.xml.sax.helpers.DefaultHandler;
*/ */
class Upgrade extends Command { class Upgrade extends Command {
private static final Logger logger = Logger.getLogger(Upgrade.class);
private static final Options s_options = getOptions(); private static final Options s_options = getOptions();
private String m_from; private String m_from;
@ -59,6 +61,7 @@ class Upgrade extends Command {
private final List m_scripts; private final List m_scripts;
static { static {
logger.debug("Static initalizer starting...");
s_options.addOption s_options.addOption
(OptionBuilder (OptionBuilder
.isRequired() .isRequired()
@ -79,6 +82,7 @@ class Upgrade extends Command {
.withLongOpt("parameters") .withLongOpt("parameters")
.withDescription("Parameters to pass to upgrade scripts") .withDescription("Parameters to pass to upgrade scripts")
.create()); .create());
logger.debug("Static initalizer finished.");
} }
public Upgrade() { public Upgrade() {

View File

@ -55,7 +55,9 @@ public class SessionManager {
private static Set s_beforeFlushProcManagers = new HashSet(); private static Set s_beforeFlushProcManagers = new HashSet();
static { static {
s_log.debug("Static initalizer starting...");
addBeforeFlushProcManager(Versions.EPM); addBeforeFlushProcManager(Versions.EPM);
s_log.debug("Static initalizer finished.");
} }
private static Set s_afterFlushProcManagers = new HashSet(); private static Set s_afterFlushProcManagers = new HashSet();
private static Map s_configurations = new HashMap(); private static Map s_configurations = new HashMap();

View File

@ -136,6 +136,7 @@ public class PDL {
new CommandLine(PDL.class.getName(), null); new CommandLine(PDL.class.getName(), null);
static { static {
s_log.debug("Static initalizer starting...");
CMD.addSwitch(new PathSwitch( CMD.addSwitch(new PathSwitch(
"-library-path", "-library-path",
"PDL files appearing in this path will be searched " + "PDL files appearing in this path will be searched " +
@ -167,6 +168,7 @@ public class PDL {
CMD.addSwitch(new BooleanSwitch("-quiet", "sets logging to ERROR and does not complain if no PDL files are found", CMD.addSwitch(new BooleanSwitch("-quiet", "sets logging to ERROR and does not complain if no PDL files are found",
Boolean.FALSE)); Boolean.FALSE));
CMD.addSwitch(new StringSwitch("-testddl", "no clue", null)); CMD.addSwitch(new StringSwitch("-testddl", "no clue", null));
s_log.debug("Static initalizer finished.");
} }
/** /**

View File

@ -73,10 +73,12 @@ import org.apache.log4j.Logger;
*/ */
public class SQLRegressionGenerator { public class SQLRegressionGenerator {
private static final Logger logger = Logger.getLogger(SQLRegressionGenerator.class);
static final CommandLine CMD = static final CommandLine CMD =
new CommandLine(PDL.class.getName(), null); new CommandLine(PDL.class.getName(), null);
static { static {
logger.debug("Static initalizer starting...");
CMD.addSwitch(new PathSwitch( CMD.addSwitch(new PathSwitch(
"-path", "-path",
"PDL files appearing in this path will be processed", "PDL files appearing in this path will be processed",
@ -95,6 +97,7 @@ public class SQLRegressionGenerator {
CMD.addSwitch(new BooleanSwitch("-quiet", "sets logging to ERROR and does not complain if no PDL files are found", CMD.addSwitch(new BooleanSwitch("-quiet", "sets logging to ERROR and does not complain if no PDL files are found",
Boolean.FALSE)); Boolean.FALSE));
CMD.addSwitch(new StringSwitch("-database", "target database", null)); CMD.addSwitch(new StringSwitch("-database", "target database", null));
logger.debug("Static initalizer finished.");
} }
/** /**

View File

@ -7,6 +7,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.log4j.Logger;
/** /**
* Simple Profiler. * Simple Profiler.
@ -21,15 +22,18 @@ import java.util.Set;
*/ */
public class Profiler { public class Profiler {
private static final Logger logger = Logger.getLogger(Profiler.class);
private static final Set enabledOperations = new HashSet(); private static final Set enabledOperations = new HashSet();
// TODO add a configuration page under Developer Support // TODO add a configuration page under Developer Support
static { static {
logger.debug("Static initalizer starting...");
enabledOperations.add("APP"); enabledOperations.add("APP");
enabledOperations.add("FILT"); enabledOperations.add("FILT");
enabledOperations.add("CMS"); enabledOperations.add("CMS");
enabledOperations.add("XML"); enabledOperations.add("XML");
enabledOperations.add("DB"); enabledOperations.add("DB");
enabledOperations.add("XSLT"); enabledOperations.add("XSLT");
logger.debug("Static initalizer finished.");
} }
private static ProfilerConfig config = null; private static ProfilerConfig config = null;

View File

@ -44,9 +44,11 @@ public class QueryEngineRegistry {
Logger.getLogger(QueryEngineRegistry.class); Logger.getLogger(QueryEngineRegistry.class);
static { static {
s_log.debug("Static initalizer starting...");
registerEngine(IndexerType.NOOP, registerEngine(IndexerType.NOOP,
new FilterType[] {}, new FilterType[] {},
new NoopQueryEngine()); new NoopQueryEngine());
s_log.debug("Static initalizer finished.");
} }
/** /**

View File

@ -35,6 +35,7 @@ import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.PersonName; import com.arsdigita.kernel.PersonName;
import org.apache.log4j.Logger;
/** /**
* This is an advanced servlet error report generator * This is an advanced servlet error report generator
@ -44,6 +45,8 @@ import com.arsdigita.kernel.PersonName;
* (guru meditation) code. * (guru meditation) code.
*/ */
public class ServletErrorReport extends ErrorReport { public class ServletErrorReport extends ErrorReport {
private static final Logger logger = Logger.getLogger(ServletErrorReport.class);
/** /**
* The name of the Servlet request attribute which will * The name of the Servlet request attribute which will
* contain the guru meditation code * contain the guru meditation code
@ -52,16 +55,18 @@ public class ServletErrorReport extends ErrorReport {
public static final String GURU_ERROR_REPORT = "guruErrorReport"; public static final String GURU_ERROR_REPORT = "guruErrorReport";
static { static {
logger.debug("Static initalizer starting...");
Exceptions.registerUnwrapper( Exceptions.registerUnwrapper(
ServletException.class, ServletException.class,
new ExceptionUnwrapper() { new ExceptionUnwrapper() {
public Throwable unwrap(Throwable t) { public Throwable unwrap(Throwable t) {
ServletException ex = (ServletException)t; ServletException ex = (ServletException) t;
return ex.getRootCause(); return ex.getRootCause();
} }
}); });
logger.debug("Static initalizer finished.");
} }
private HttpServletRequest m_request; private HttpServletRequest m_request;
private HttpServletResponse m_response; private HttpServletResponse m_response;
@ -110,11 +115,11 @@ public class ServletErrorReport extends ErrorReport {
private void addRequest() { private void addRequest() {
ArrayList lines = new ArrayList(); ArrayList lines = new ArrayList();
lines.add("Context path: "+ m_request.getContextPath()); lines.add("Context path: " + m_request.getContextPath());
lines.add("Request URI: "+ m_request.getRequestURI()); lines.add("Request URI: " + m_request.getRequestURI());
lines.add("Query string: "+ m_request.getQueryString()); lines.add("Query string: " + m_request.getQueryString());
lines.add("Method: "+ m_request.getMethod()); lines.add("Method: " + m_request.getMethod());
lines.add("Remote user: "+ m_request.getRemoteUser()); lines.add("Remote user: " + m_request.getRemoteUser());
addSection("Request summary", lines); addSection("Request summary", lines);
} }
@ -127,9 +132,9 @@ public class ServletErrorReport extends ErrorReport {
String lines[] = new String[cookies.length]; String lines[] = new String[cookies.length];
for (int i = 0 ; i < lines.length ;i++) { for (int i = 0; i < lines.length; i++) {
lines[i] = cookies[i].getName() + ": " + cookies[i].getValue() + lines[i] = cookies[i].getName() + ": " + cookies[i].getValue()
" (expires: " + cookies[i].getMaxAge() + ")"; + " (expires: " + cookies[i].getMaxAge() + ")";
} }
addSection("Cookies", lines); addSection("Cookies", lines);
@ -139,14 +144,14 @@ public class ServletErrorReport extends ErrorReport {
User user; User user;
Party party = Kernel.getContext().getParty(); Party party = Kernel.getContext().getParty();
if ( party == null ) { if (party == null) {
addSection("CCM User", "Party not logged in"); addSection("CCM User", "Party not logged in");
} else { } else {
String lines[] = new String[5]; String lines[] = new String[5];
lines[0] = "Party ID: " + party.getID(); lines[0] = "Party ID: " + party.getID();
lines[1] = "Email address: " + party.getPrimaryEmail().toString(); lines[1] = "Email address: " + party.getPrimaryEmail().toString();
if ( party instanceof User ) { if (party instanceof User) {
user = (User) party; user = (User) party;
PersonName name = null; PersonName name = null;
@ -186,9 +191,9 @@ public class ServletErrorReport extends ErrorReport {
Enumeration props = m_request.getAttributeNames(); Enumeration props = m_request.getAttributeNames();
while (props.hasMoreElements()) { while (props.hasMoreElements()) {
String key = (String)props.nextElement(); String key = (String) props.nextElement();
if (GURU_ERROR_REPORT.equals(key) || if (GURU_ERROR_REPORT.equals(key)
GURU_MEDITATION_CODE.equals(key)) { || GURU_MEDITATION_CODE.equals(key)) {
continue; continue;
} }
Object value = m_request.getAttribute(key); Object value = m_request.getAttribute(key);
@ -203,7 +208,7 @@ public class ServletErrorReport extends ErrorReport {
Enumeration props = m_request.getHeaderNames(); Enumeration props = m_request.getHeaderNames();
while (props.hasMoreElements()) { while (props.hasMoreElements()) {
String key = (String)props.nextElement(); String key = (String) props.nextElement();
String value = m_request.getHeader(key); String value = m_request.getHeader(key);
data.add(key + ": " + value); data.add(key + ": " + value);
} }

View File

@ -57,6 +57,7 @@ public class ApplyTemplates {
"-loop [count] -log [loglevel] -verbose -warmup [count] Stylesheet Input Output " "-loop [count] -log [loglevel] -verbose -warmup [count] Stylesheet Input Output "
); );
static { static {
s_log.debug("Static initalizer starting...");
s_cmd.addSwitch(new StringSwitch(OPT_LOG, s_cmd.addSwitch(new StringSwitch(OPT_LOG,
"Log4j debug level", "Log4j debug level",
"warn")); "warn"));
@ -69,6 +70,7 @@ public class ApplyTemplates {
s_cmd.addSwitch(new BooleanSwitch(OPT_VERBOSE, s_cmd.addSwitch(new BooleanSwitch(OPT_VERBOSE,
"Display progress", "Display progress",
Boolean.FALSE)); Boolean.FALSE));
s_log.debug("Static initalizer finished.");
} }
public final static void main(String[] args) { public final static void main(String[] args) {

View File

@ -134,6 +134,7 @@ public class PatternStylesheetResolver implements StylesheetResolver {
} }
static { static {
s_log.debug("Static initalizer starting...");
registerPatternGenerator registerPatternGenerator
("locale", new LocalePatternGenerator()); ("locale", new LocalePatternGenerator());
registerPatternGenerator registerPatternGenerator
@ -148,6 +149,7 @@ public class PatternStylesheetResolver implements StylesheetResolver {
("webapps", new WebAppPatternGenerator()); ("webapps", new WebAppPatternGenerator());
registerPatternGenerator registerPatternGenerator
("host", new HostPatternGenerator()); ("host", new HostPatternGenerator());
s_log.debug("Static initalizer finished.");
} }
private String m_path = null; private String m_path = null;

View File

@ -58,49 +58,47 @@ import org.apache.log4j.Logger;
public class Templating { public class Templating {
private static final Logger s_log = Logger.getLogger(Templating.class); private static final Logger s_log = Logger.getLogger(Templating.class);
// just a tag to assure an implementation exists // just a tag to assure an implementation exists
// public static final Class DEFAULT_PRESENTATION_MANAGER // public static final Class DEFAULT_PRESENTATION_MANAGER
// = SimplePresentationManager.class; // = SimplePresentationManager.class;
/** /**
* This is the name of the attribute that is set in the request whose * This is the name of the attribute that is set in the request whose
* value, if present, is a collection of TransformerExceptions that * value, if present, is a collection of TransformerExceptions that
* can be used to produce a "pretty" error. * can be used to produce a "pretty" error.
*/ */
public static final String FANCY_ERROR_COLLECTION = "fancyErrorCollection"; public static final String FANCY_ERROR_COLLECTION = "fancyErrorCollection";
// this was instantiated with hardcoded values, not anymore // this was instantiated with hardcoded values, not anymore
private static CacheTable s_templates = null; private static CacheTable s_templates = null;
private static final TemplatingConfig s_config = new TemplatingConfig(); private static final TemplatingConfig s_config = new TemplatingConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load("ccm-core/templating.properties"); s_config.load("ccm-core/templating.properties");
}
static {
Exceptions.registerUnwrapper( Exceptions.registerUnwrapper(
TransformerException.class, TransformerException.class,
new ExceptionUnwrapper() { new ExceptionUnwrapper() {
public Throwable unwrap(Throwable t) { public Throwable unwrap(Throwable t) {
TransformerException ex = (TransformerException)t; TransformerException ex = (TransformerException) t;
return ex.getCause(); return ex.getCause();
} }
}); });
}
// now we initiate the CacheTable here // now we initiate the CacheTable here
static {
// default cache size used to be 50, which is too high I reckon, // default cache size used to be 50, which is too high I reckon,
// each template can eat up to 4 megs // each template can eat up to 4 megs
Integer setting = s_config.getCacheSize(); Integer setting = s_config.getCacheSize();
int cacheSize = (setting == null ? 10 : setting.intValue()); int cacheSize = (setting == null ? 10 : setting.intValue());
setting = s_config.getCacheAge(); setting = s_config.getCacheAge();
int cacheAge = (setting == null ? 60*60*24*3 : setting.intValue()); int cacheAge = (setting == null ? 60 * 60 * 24 * 3 : setting.intValue());
s_templates = new CacheTable("templating", cacheSize, cacheAge); s_templates = new CacheTable("templating", cacheSize, cacheAge);
s_templates.setPurgeAllowed(true); s_templates.setPurgeAllowed(true);
s_log.debug("Static initalizer finished...");
} }
/** /**
@ -184,8 +182,8 @@ public class Templating {
if (template == null) { if (template == null) {
if (s_log.isInfoEnabled()) { if (s_log.isInfoEnabled()) {
s_log.info("The template for URL " + source + " is not " + s_log.info("The template for URL " + source + " is not "
"cached; creating and caching it now"); + "cached; creating and caching it now");
} }
if (fancyErrors) { if (fancyErrors) {
@ -207,8 +205,8 @@ public class Templating {
// probably on UtilConfig. // probably on UtilConfig.
if (s_log.isInfoEnabled()) { if (s_log.isInfoEnabled()) {
s_log.info("Template " + template + " has been modified; " + s_log.info("Template " + template + " has been modified; "
"recreating it from scratch"); + "recreating it from scratch");
} }
if (fancyErrors) { if (fancyErrors) {
@ -304,7 +302,7 @@ public class Templating {
root.addAttribute("version", "1.0"); root.addAttribute("version", "1.0");
while (paths.hasNext()) { while (paths.hasNext()) {
URL path = (URL)paths.next(); URL path = (URL) paths.next();
Element imp = root.newChildElement( Element imp = root.newChildElement(
"xsl:import", "xsl:import",
@ -338,9 +336,12 @@ public class Templating {
HttpHost self = Web.getConfig().getHost(); HttpHost self = Web.getConfig().getHost();
String path = url.getPath(); String path = url.getPath();
if (self.getName().equals(url.getHost()) && if (self.getName().equals(url.getHost()) && ((self.getPort() == url.
((self.getPort() == url.getPort()) || getPort()) || (url.getPort()
(url.getPort() == -1 && self.getPort() == 80))) { == -1
&& self.
getPort()
== 80))) {
if (path.startsWith("/resource")) { if (path.startsWith("/resource")) {
// A virtual path to the servlet // A virtual path to the servlet
@ -352,14 +353,15 @@ public class Templating {
return newURL; return newURL;
} else { } else {
// A real path to disk // A real path to disk
final String filename = Web.getServletContext().getRealPath(path); final String filename =
Web.getServletContext().getRealPath(path);
File file = new File(filename); File file = new File(filename);
if (file.exists()) { if (file.exists()) {
try { try {
URL newURL = file.toURL(); URL newURL = file.toURL();
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Transforming resource " + s_log.debug("Transforming resource " + url + " to "
url + " to " + newURL); + newURL);
} }
return newURL; return newURL;
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
@ -367,7 +369,8 @@ public class Templating {
} }
} else { } else {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("File " + filename + " doesn't exist on disk"); s_log.debug("File " + filename
+ " doesn't exist on disk");
} }
} }
} }
@ -382,9 +385,9 @@ public class Templating {
} }
class LoggingErrorListener implements ErrorListener { class LoggingErrorListener implements ErrorListener {
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(LoggingErrorListener.class); Logger.getLogger(LoggingErrorListener.class);
private ArrayList m_errors; private ArrayList m_errors;
LoggingErrorListener() { LoggingErrorListener() {
@ -408,8 +411,8 @@ class LoggingErrorListener implements ErrorListener {
} }
private void log(Level level, TransformerException ex) { private void log(Level level, TransformerException ex) {
s_log.log(level, "Transformer " + level + ": " + s_log.log(level, "Transformer " + level + ": "
ex.getLocationAsString() + ": " + ex.getMessage(), + ex.getLocationAsString() + ": " + ex.getMessage(),
ex); ex);
m_errors.add(ex); m_errors.add(ex);
} }

View File

@ -60,8 +60,10 @@ public class XHTMLParser implements HTMLParser {
private final static Set s_emptyTags = new HashSet(); private final static Set s_emptyTags = new HashSet();
static { static {
s_log.debug("Static initalizer is starting...");
s_emptyTags.add("br"); s_emptyTags.add("br");
s_emptyTags.add("hr"); s_emptyTags.add("hr");
s_log.debug("Static initalizer finished.");
} }
private final Set m_tags; private final Set m_tags;

View File

@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
/** /**
* <p> * <p>
@ -40,15 +41,18 @@ import javax.servlet.http.HttpServletRequest;
*/ */
public class CharsetEncodingProvider implements ParameterProvider { public class CharsetEncodingProvider implements ParameterProvider {
private static final Logger logger = Logger.getLogger(CharsetEncodingProvider.class);
private static StringParameter s_encodingParam = private static StringParameter s_encodingParam =
new StringParameter(Globalization.ENCODING_PARAM_NAME); new StringParameter(Globalization.ENCODING_PARAM_NAME);
private static Set s_models = new HashSet(); private static Set s_models = new HashSet();
static { static {
logger.debug("Static initalizer starting...");
s_encodingParam.setDefaultValue(Globalization.DEFAULT_ENCODING); s_encodingParam.setDefaultValue(Globalization.DEFAULT_ENCODING);
s_encodingParam.setDefaultOverridesNull(true); s_encodingParam.setDefaultOverridesNull(true);
s_models.add(s_encodingParam); s_models.add(s_encodingParam);
logger.debug("Static initalizer finished...");
} }
public Set getModels() { public Set getModels() {

View File

@ -23,6 +23,7 @@ import java.text.NumberFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
/** /**
@ -52,6 +53,7 @@ import java.util.Map;
* @version $Revision: #4 $ $DateTime: 2004/08/16 18:10:38 $ * @version $Revision: #4 $ $DateTime: 2004/08/16 18:10:38 $
**/ **/
public final class ConcurrentDict { public final class ConcurrentDict {
private static final Logger logger = Logger.getLogger(ConcurrentDict.class);
// We may want to make it possible to specify the bucket size at // We may want to make it possible to specify the bucket size at
// construction time. Hardcoding it is good enough for now. // construction time. Hardcoding it is good enough for now.
private static final int N_BUCKETS = 64; private static final int N_BUCKETS = 64;
@ -59,9 +61,11 @@ public final class ConcurrentDict {
private static final Map[] BUCKETS = new Map[N_BUCKETS]; private static final Map[] BUCKETS = new Map[N_BUCKETS];
static { static {
logger.debug("Static initalizer starting...");
for (int ii=0; ii<N_BUCKETS; ii++) { for (int ii=0; ii<N_BUCKETS; ii++) {
BUCKETS[ii] = new HashMap(); BUCKETS[ii] = new HashMap();
} }
logger.debug("Static initalizer finished.");
} }
private final EntrySupplier m_supplier; private final EntrySupplier m_supplier;

View File

@ -249,12 +249,14 @@ public class StringUtils {
private static Map s_entities = new HashMap(); private static Map s_entities = new HashMap();
static { static {
s_log.debug("Static initalizer starting...");
s_entities.put("fraction12", "&frac12;"); s_entities.put("fraction12", "&frac12;");
s_entities.put("fraction14", "&frac14;"); s_entities.put("fraction14", "&frac14;");
s_entities.put("fraction34", "&frac34;"); s_entities.put("fraction34", "&frac34;");
s_entities.put("copyright", "&copy;"); s_entities.put("copyright", "&copy;");
s_entities.put("registered", "&reg;"); s_entities.put("registered", "&reg;");
s_entities.put("trademark", "<sup>TM</sup>"); s_entities.put("trademark", "<sup>TM</sup>");
s_log.debug("Static initalizer finished.");
} }
private static String smartTextInline(String s) { private static String smartTextInline(String s) {

View File

@ -42,17 +42,23 @@ import org.apache.log4j.Logger;
*/ */
public class UncheckedWrapperException extends RuntimeException { public class UncheckedWrapperException extends RuntimeException {
private static final Logger logger = Logger.getLogger(
UncheckedWrapperException.class);
static { static {
logger.debug("Static initalizer starting...");
Exceptions.registerUnwrapper( Exceptions.registerUnwrapper(
UncheckedWrapperException.class, UncheckedWrapperException.class,
new ExceptionUnwrapper() { new ExceptionUnwrapper() {
public Throwable unwrap(Throwable t) { public Throwable unwrap(Throwable t) {
UncheckedWrapperException ex = (UncheckedWrapperException)t; UncheckedWrapperException ex =
(UncheckedWrapperException) t;
return ex.getRootCause(); return ex.getRootCause();
} }
}); });
logger.debug("Static initalizer finished.");
} }
Throwable m_rootCause; Throwable m_rootCause;
/** /**
@ -62,7 +68,7 @@ public class UncheckedWrapperException extends RuntimeException {
* exception that doesn't wrap anything, this is needed so that it * exception that doesn't wrap anything, this is needed so that it
* can be used as a direct replacement for RuntimeException. * can be used as a direct replacement for RuntimeException.
*/ */
public UncheckedWrapperException (String msg) { public UncheckedWrapperException(String msg) {
this(msg, null); this(msg, null);
} }
@ -74,7 +80,7 @@ public class UncheckedWrapperException extends RuntimeException {
* Constructor which takes a root cause * Constructor which takes a root cause
* that this exception will be wrapping. * that this exception will be wrapping.
*/ */
public UncheckedWrapperException (Throwable rootCause) { public UncheckedWrapperException(Throwable rootCause) {
this(null, rootCause); this(null, rootCause);
} }
@ -84,7 +90,7 @@ public class UncheckedWrapperException extends RuntimeException {
* should be something different than rootCause.getMessage() * should be something different than rootCause.getMessage()
* would normally provide. * would normally provide.
*/ */
public UncheckedWrapperException (String s, Throwable rootCause) { public UncheckedWrapperException(String s, Throwable rootCause) {
super(s); super(s);
this.m_rootCause = rootCause; this.m_rootCause = rootCause;
} }
@ -98,7 +104,9 @@ public class UncheckedWrapperException extends RuntimeException {
* *
* @throws UncheckedWrapperException * @throws UncheckedWrapperException
*/ */
public static void throwLoggedException(Class source, String msg, Throwable rootCause) throws UncheckedWrapperException { public static void throwLoggedException(Class source, String msg,
Throwable rootCause) throws
UncheckedWrapperException {
Logger log = Logger.getLogger(source); Logger log = Logger.getLogger(source);
log.error(msg, rootCause); log.error(msg, rootCause);
@ -121,7 +129,6 @@ public class UncheckedWrapperException extends RuntimeException {
// All further methods override normal throwable behavior to // All further methods override normal throwable behavior to
// combine information w/ the root cause. // combine information w/ the root cause.
/** /**
* Get a string representing this exception and the root cause. * Get a string representing this exception and the root cause.
*/ */
@ -158,7 +165,8 @@ public class UncheckedWrapperException extends RuntimeException {
*/ */
public String getMessage() { public String getMessage() {
if (m_rootCause != null) { if (m_rootCause != null) {
return super.getMessage() + " (root cause: " + m_rootCause.getMessage() + ")"; return super.getMessage() + " (root cause: " + m_rootCause.
getMessage() + ")";
} else { } else {
return super.getMessage(); return super.getMessage();
} }

View File

@ -35,7 +35,10 @@ import org.apache.log4j.Logger;
*/ */
public class WrappedError extends Error { public class WrappedError extends Error {
private static final Logger logger = Logger.getLogger(WrappedError.class);
static { static {
logger.debug("Static initalizer starting...");
Exceptions.registerUnwrapper( Exceptions.registerUnwrapper(
WrappedError.class, WrappedError.class,
new ExceptionUnwrapper() { new ExceptionUnwrapper() {
@ -44,6 +47,7 @@ public class WrappedError extends Error {
return ex.getRootCause(); return ex.getRootCause();
} }
}); });
logger.debug("Static initalizer finished.");
} }
Throwable m_rootCause; Throwable m_rootCause;

View File

@ -19,6 +19,7 @@
package com.arsdigita.util.parameter; package com.arsdigita.util.parameter;
import org.apache.commons.beanutils.converters.ClassConverter; import org.apache.commons.beanutils.converters.ClassConverter;
import org.apache.log4j.Logger;
/** /**
* A parameter representing a Java <code>Class</code>. * A parameter representing a Java <code>Class</code>.
@ -32,8 +33,12 @@ import org.apache.commons.beanutils.converters.ClassConverter;
*/ */
public class ClassParameter extends AbstractParameter { public class ClassParameter extends AbstractParameter {
private static final Logger logger = Logger.getLogger(ClassParameter.class);
static { static {
logger.debug("Static initalizer starting...");
Converters.set(Class.class, new ClassConverter()); Converters.set(Class.class, new ClassConverter());
logger.debug("Static initalizer finished.");
} }
public ClassParameter(final String name) { public ClassParameter(final String name) {

View File

@ -19,6 +19,7 @@
package com.arsdigita.util.parameter; package com.arsdigita.util.parameter;
import org.apache.commons.beanutils.converters.IntegerConverter; import org.apache.commons.beanutils.converters.IntegerConverter;
import org.apache.log4j.Logger;
/** /**
* A parameter representing a Java <code>Integer</code>. * A parameter representing a Java <code>Integer</code>.
@ -32,8 +33,12 @@ import org.apache.commons.beanutils.converters.IntegerConverter;
*/ */
public class IntegerParameter extends AbstractParameter { public class IntegerParameter extends AbstractParameter {
private final static Logger logger = Logger.getLogger(IntegerParameter.class);
static { static {
logger.debug("Static initalizer starting...");
Converters.set(Integer.class, new IntegerConverter()); Converters.set(Integer.class, new IntegerConverter());
logger.debug("Static initalizer finished.");
} }
public IntegerParameter(final String name) { public IntegerParameter(final String name) {

View File

@ -58,6 +58,7 @@ final class ParameterPrinter {
private static final Options OPTIONS = new Options(); private static final Options OPTIONS = new Options();
static { static {
s_log.debug("Static initalizer starting...");
OPTIONS.addOption OPTIONS.addOption
(OptionBuilder (OptionBuilder
.hasArg(false) .hasArg(false)
@ -77,6 +78,7 @@ final class ParameterPrinter {
.withArgName("FILE") .withArgName("FILE")
.withDescription("Use list of additional Config classes from FILE") .withDescription("Use list of additional Config classes from FILE")
.create()); .create());
s_log.debug("Static initalizer starting...");
} }
private static void writeXML(final PrintWriter out) { private static void writeXML(final PrintWriter out) {

View File

@ -19,6 +19,7 @@
package com.arsdigita.util.parameter; package com.arsdigita.util.parameter;
import org.apache.commons.beanutils.converters.StringConverter; import org.apache.commons.beanutils.converters.StringConverter;
import org.apache.log4j.Logger;
/** /**
* A parameter representing a Java <code>String</code>. * A parameter representing a Java <code>String</code>.
@ -32,8 +33,12 @@ import org.apache.commons.beanutils.converters.StringConverter;
*/ */
public class StringParameter extends AbstractParameter { public class StringParameter extends AbstractParameter {
private static final Logger logger = Logger.getLogger(StringParameter.class);
static { static {
logger.debug("Static initalizer starting...");
Converters.set(String.class, new StringConverter()); Converters.set(String.class, new StringConverter());
logger.debug("Static initalizer finished.");
} }
public StringParameter(final String name, public StringParameter(final String name,

View File

@ -56,7 +56,9 @@ final class Adapter {
private static final Map s_converters = new HashMap(); private static final Map s_converters = new HashMap();
static { static {
s_log.debug("Static initalizer starting...");
initializeAdapters(); initializeAdapters();
s_log.debug("Static initalizer finished.");
} }
private Adapter() {} private Adapter() {}

View File

@ -32,6 +32,7 @@ import java.io.PrintWriter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
// new versioning // new versioning
@ -206,6 +207,8 @@ final class DevSupport {
private static class DependenceFormatter implements GraphFormatter { private static class DependenceFormatter implements GraphFormatter {
private static final Logger logger = Logger.getLogger(DependenceFormatter.class);
private static final String GRAPH_ATTRS = private static final String GRAPH_ATTRS =
GRAPH_ATTRS_HEADER + GRAPH_ATTRS_HEADER +
" edge[style=invis];\n" + " edge[style=invis];\n" +
@ -229,6 +232,7 @@ final class DevSupport {
private static final Map COLORS = new HashMap(); private static final Map COLORS = new HashMap();
static { static {
logger.debug("Static initalizer starting...");
COLORS.put(NodeType.VERSIONED_TYPE, COLORS.put(NodeType.VERSIONED_TYPE,
"[fillcolor=Tomato,comment=\"versioned type\"]"); "[fillcolor=Tomato,comment=\"versioned type\"]");
COLORS.put(NodeType.COVERSIONED_TYPE, COLORS.put(NodeType.COVERSIONED_TYPE,
@ -236,6 +240,7 @@ final class DevSupport {
COLORS.put(NodeType.RECOVERABLE, COLORS.put(NodeType.RECOVERABLE,
"[fillcolor=LemonChiffon,comment=recoverable]"); "[fillcolor=LemonChiffon,comment=recoverable]");
COLORS.put(NodeType.UNREACHABLE, "[comment=unreachable]"); COLORS.put(NodeType.UNREACHABLE, "[comment=unreachable]");
logger.debug("Static initalizer finished.");
} }
public String graphAttributes(Graph graph) { public String graphAttributes(Graph graph) {

View File

@ -52,14 +52,13 @@ import java.io.UnsupportedEncodingException;
* @since ACS 4.5a * @since ACS 4.5a
*/ */
public class Document { public class Document {
public static final String versionId =
"$Id: Document.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: Document.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(Document.class.getName()); Logger.getLogger(Document.class.getName());
/** /**
* this is the identity XSL stylesheet. We need to provide the * this is the identity XSL stylesheet. We need to provide the
* identity transform as XSL explicitly because the default * identity transform as XSL explicitly because the default
@ -101,13 +100,11 @@ public class Document {
+ " xmlns:bebop=\"http://www.arsdigita.com/bebop/1.0\">\n" + " xmlns:bebop=\"http://www.arsdigita.com/bebop/1.0\">\n"
+ "</xsl:template>\n" + "</xsl:template>\n"
+ "</xsl:stylesheet>"; + "</xsl:stylesheet>";
/** /**
* A single <code>DocumentBuilderFactory</code> to use for * A single <code>DocumentBuilderFactory</code> to use for
* creating Documents. * creating Documents.
*/ */
protected static DocumentBuilderFactory s_builder = null; protected static DocumentBuilderFactory s_builder = null;
/** /**
* A single <code>DocumentBuilder</code> to use for * A single <code>DocumentBuilder</code> to use for
* creating Documents. * creating Documents.
@ -119,9 +116,11 @@ public class Document {
// instead to achieve independence from a JVM wide configuration. // instead to achieve independence from a JVM wide configuration.
// Requires additional modifications in c.ad.util.xml.XML // Requires additional modifications in c.ad.util.xml.XML
static { static {
s_log.debug("Static initalizer starting...");
s_builder = DocumentBuilderFactory.newInstance(); s_builder = DocumentBuilderFactory.newInstance();
s_builder.setNamespaceAware(true); s_builder.setNamespaceAware(true);
s_db = new ThreadLocal() { s_db = new ThreadLocal() {
public Object initialValue() { public Object initialValue() {
try { try {
return s_builder.newDocumentBuilder(); return s_builder.newDocumentBuilder();
@ -130,10 +129,10 @@ public class Document {
} }
} }
}; };
s_log.debug("Static initalized finished.");
} }
/* Used to build the DOM Documents that this class wraps */ /* Used to build the DOM Documents that this class wraps */
/** /**
* The internal DOM document being wrapped. * The internal DOM document being wrapped.
*/ */
@ -142,11 +141,11 @@ public class Document {
/** /**
* Creates a new Document class with no root element. * Creates a new Document class with no root element.
*/ */
public Document( ) throws ParserConfigurationException { public Document() throws ParserConfigurationException {
DocumentBuilder db = (DocumentBuilder)s_db.get(); DocumentBuilder db = (DocumentBuilder) s_db.get();
if (db == null) { if (db == null) {
throw new ParserConfigurationException throw new ParserConfigurationException(
("Unable to create a DocumentBuilder"); "Unable to create a DocumentBuilder");
} }
m_document = db.newDocument(); m_document = db.newDocument();
} }
@ -158,7 +157,7 @@ public class Document {
* @param doc the org.w3c.dom.Document * @param doc the org.w3c.dom.Document
* *
*/ */
public Document( org.w3c.dom.Document doc ) { public Document(org.w3c.dom.Document doc) {
m_document = doc; m_document = doc;
} }
@ -167,11 +166,11 @@ public class Document {
* *
* @param rootNode the element to use as the root node * @param rootNode the element to use as the root node
*/ */
public Document( Element rootNode ) throws ParserConfigurationException { public Document(Element rootNode) throws ParserConfigurationException {
DocumentBuilder db = (DocumentBuilder)s_db.get(); DocumentBuilder db = (DocumentBuilder) s_db.get();
if (db == null) { if (db == null) {
throw new ParserConfigurationException throw new ParserConfigurationException(
("Unable to create a DocumentBuilder"); "Unable to create a DocumentBuilder");
} }
m_document = db.newDocument(); m_document = db.newDocument();
@ -183,24 +182,23 @@ public class Document {
* Creates a document from the passed in string that should * Creates a document from the passed in string that should
* be properly formatted XML * be properly formatted XML
*/ */
public Document( String xmlString ) public Document(String xmlString)
throws ParserConfigurationException, org.xml.sax.SAXException { throws ParserConfigurationException, org.xml.sax.SAXException {
this(new org.xml.sax.InputSource this(new org.xml.sax.InputSource(new java.io.StringReader(xmlString)));
(new java.io.StringReader(xmlString)));
} }
public Document( byte[] xmlBytes ) public Document(byte[] xmlBytes)
throws ParserConfigurationException, org.xml.sax.SAXException { throws ParserConfigurationException, org.xml.sax.SAXException {
this(new org.xml.sax.InputSource this(new org.xml.sax.InputSource(new java.io.ByteArrayInputStream(
(new java.io.ByteArrayInputStream(xmlBytes))); xmlBytes)));
} }
private Document(org.xml.sax.InputSource inputSource) private Document(org.xml.sax.InputSource inputSource)
throws ParserConfigurationException, org.xml.sax.SAXException { throws ParserConfigurationException, org.xml.sax.SAXException {
DocumentBuilder db = (DocumentBuilder)s_db.get(); DocumentBuilder db = (DocumentBuilder) s_db.get();
if (db == null) { if (db == null) {
throw new ParserConfigurationException throw new ParserConfigurationException(
("Unable to create a DocumentBuilder"); "Unable to create a DocumentBuilder");
} }
org.w3c.dom.Document domDoc; org.w3c.dom.Document domDoc;
@ -218,7 +216,7 @@ public class Document {
* @param rootNode the element to use as the root node * @param rootNode the element to use as the root node
* @return this document. * @return this document.
*/ */
public Document setRootElement( Element rootNode ) { public Document setRootElement(Element rootNode) {
rootNode.importInto(m_document); rootNode.importInto(m_document);
m_document.appendChild(rootNode.getInternalElement()); m_document.appendChild(rootNode.getInternalElement());
@ -236,7 +234,7 @@ public class Document {
* @param ns the element's namespace URI * @param ns the element's namespace URI
* @return The newly created root element. * @return The newly created root element.
*/ */
public Element createRootElement( String elt, String ns ) { public Element createRootElement(String elt, String ns) {
org.w3c.dom.Element root = m_document.createElementNS(ns, elt); org.w3c.dom.Element root = m_document.createElementNS(ns, elt);
m_document.appendChild(root); m_document.appendChild(root);
Element wrapper = new Element(); Element wrapper = new Element();
@ -254,7 +252,7 @@ public class Document {
* @param elt the element name * @param elt the element name
* @return The newly created root element. * @return The newly created root element.
*/ */
public Element createRootElement( String elt ) { public Element createRootElement(String elt) {
org.w3c.dom.Element root = m_document.createElement(elt); org.w3c.dom.Element root = m_document.createElement(elt);
m_document.appendChild(root); m_document.appendChild(root);
Element wrapper = new Element(); Element wrapper = new Element();
@ -273,8 +271,6 @@ public class Document {
return root; return root;
} }
/** /**
* Not a part of <code>org.jdom.Document</code>, this function returns * Not a part of <code>org.jdom.Document</code>, this function returns
* the internal DOM representation of this document. This method should * the internal DOM representation of this document. This method should
@ -283,7 +279,7 @@ public class Document {
* *
* @return this document. * @return this document.
*/ */
public org.w3c.dom.Document getInternalDocument( ) { public org.w3c.dom.Document getInternalDocument() {
return m_document; return m_document;
} }
@ -307,8 +303,8 @@ public class Document {
try { try {
StreamSource identitySource = StreamSource identitySource =
new StreamSource(new StringReader(identityXSL)); new StreamSource(new StringReader(identityXSL));
identity = TransformerFactory.newInstance() identity = TransformerFactory.newInstance().newTransformer(
.newTransformer(identitySource); identitySource);
identity.setOutputProperty("method", "xml"); identity.setOutputProperty("method", "xml");
identity.setOutputProperty("indent", (indent ? "yes" : "no")); identity.setOutputProperty("indent", (indent ? "yes" : "no"));
identity.setOutputProperty("encoding", "UTF-8"); identity.setOutputProperty("encoding", "UTF-8");

View File

@ -53,7 +53,9 @@ public class XML {
private static Map s_formatters = new HashMap(); private static Map s_formatters = new HashMap();
static { static {
s_log.debug("Static initalizer starting...");
s_formatters.put(Date.class, new DateTimeFormatter()); s_formatters.put(Date.class, new DateTimeFormatter());
s_log.debug("Static initalizer finished.");
} }
private XML() {} private XML() {}

View File

@ -27,6 +27,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.log4j.Logger;
/** /**
* The Column class is used to keep information about the physical schema in * The Column class is used to keep information about the physical schema in
@ -40,6 +41,8 @@ public class Column extends Element {
public final static String versionId = "$Id: Column.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: Column.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger logger = Logger.getLogger(Column.class);
/** /**
* The name of this Column. * The name of this Column.
**/ **/
@ -353,6 +356,7 @@ public class Column extends Element {
private static final Map ORACLE = new HashMap(); private static final Map ORACLE = new HashMap();
static { static {
logger.debug("Static initalizer starting...");
DEFAULT.put(new Integer(Types.ARRAY), "ARRAY"); DEFAULT.put(new Integer(Types.ARRAY), "ARRAY");
DEFAULT.put(new Integer(Types.BIGINT), "BIGINT"); DEFAULT.put(new Integer(Types.BIGINT), "BIGINT");
ORACLE.put(new Integer(Types.BIGINT), "integer"); ORACLE.put(new Integer(Types.BIGINT), "integer");
@ -389,6 +393,7 @@ public class Column extends Element {
DEFAULT.put(new Integer(Types.TINYINT), "TINYINT"); DEFAULT.put(new Integer(Types.TINYINT), "TINYINT");
DEFAULT.put(new Integer(Types.VARBINARY), "VARBINARY"); DEFAULT.put(new Integer(Types.VARBINARY), "VARBINARY");
DEFAULT.put(new Integer(Types.VARCHAR), "VARCHAR"); DEFAULT.put(new Integer(Types.VARCHAR), "VARCHAR");
logger.debug("Static initalizer finished.");
} }
private static final String getDatabaseType(int type) { private static final String getDatabaseType(int type) {

View File

@ -34,6 +34,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
/** /**
* Static * Static
@ -44,6 +45,8 @@ import java.util.Map;
public class Static extends Expression { public class Static extends Expression {
private static final Logger logger = Logger.getLogger(Static.class);
public final static String versionId = "$Id: Static.java 1130 2006-04-30 13:40:54Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $"; public final static String versionId = "$Id: Static.java 1130 2006-04-30 13:40:54Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $";
private SQL m_sql; private SQL m_sql;
@ -55,6 +58,7 @@ public class Static extends Expression {
private static final Collection s_functions = new HashSet(); private static final Collection s_functions = new HashSet();
static { static {
logger.debug("Static initalizer starting...");
String[] functions = { String[] functions = {
/* sql standard functions supported by both oracle and postgres. /* sql standard functions supported by both oracle and postgres.
* there is an added caveat that the function uses normal function * there is an added caveat that the function uses normal function
@ -70,6 +74,7 @@ public class Static extends Expression {
for (int i = 0; i < functions.length; i++) { for (int i = 0; i < functions.length; i++) {
s_functions.add(functions[i]); s_functions.add(functions[i]);
} }
logger.debug("Static initalizer finished.");
} }
private static final boolean isAllowedFunction(String s) { private static final boolean isAllowedFunction(String s) {

View File

@ -27,6 +27,7 @@ import com.redhat.persistence.common.SQLParser;
import com.redhat.persistence.common.SQLToken; import com.redhat.persistence.common.SQLToken;
import java.io.StringReader; import java.io.StringReader;
import java.util.HashMap; import java.util.HashMap;
import org.apache.log4j.Logger;
/** /**
* SQLSummary * SQLSummary
@ -37,6 +38,8 @@ import java.util.HashMap;
class SQLSummary { class SQLSummary {
private static final Logger logger = Logger.getLogger(SQLSummary.class);
private static final HashMap SUMMARIES = new HashMap(); private static final HashMap SUMMARIES = new HashMap();
public static SQLSummary get(String text) { public static SQLSummary get(String text) {
@ -61,10 +64,12 @@ class SQLSummary {
private static final HashMap TYPES = new HashMap(); private static final HashMap TYPES = new HashMap();
static { static {
logger.debug("Static initalizer starting...");
TYPES.put("select", new Integer(SELECT)); TYPES.put("select", new Integer(SELECT));
TYPES.put("insert into", new Integer(INSERT)); TYPES.put("insert into", new Integer(INSERT));
TYPES.put("update", new Integer(UPDATE)); TYPES.put("update", new Integer(UPDATE));
TYPES.put("delete from", new Integer(DELETE)); TYPES.put("delete from", new Integer(DELETE));
logger.debug("Static initalizer finished.");
} }
private final int m_type; private final int m_type;

View File

@ -65,4 +65,122 @@ log4j.logger.com.arsdigita.packaging.Loader=INFO
#log4j.logger.com.arsdigita.london.importer=DEBUG #log4j.logger.com.arsdigita.london.importer=DEBUG
#log4j.logger.com.arsdigita.london.terms.importer.TermItemBuilder=DEBUG #log4j.logger.com.arsdigita.london.terms.importer.TermItemBuilder=DEBUG
#log4j.logger.com.arsdigita.categorization.Category=DEBUG #log4j.logger.com.arsdigita.categorization.Category=DEBUG
log4j.logger.com.arsdigita.london.util.cmd.BulkPublish=DEBUG
#For debugging static initalizer blocks (static {})
#com.arsdigita.auth.http.HTTPAuth=DEBUG
#com.arsdigita.auth.http.HTTPAuthConfig=DEBUG
#com.arsdigita.auth.http.HTTPLoginModule=DEBUG
#com.arsdigita.cms.dispatcher.SimpleXMLGenerator=DEBUG
#com.arsdigita.cms.contenttypes.GenericAddress=DEBUG
#com.arsdigita.cms.contenttypes.GenericContact=DEBUG
#com.arsdigita.cms.publishtofile.LinkScanner=DEBUG
#com.arsdigita.cms.ui.type.TypeElements=DEBUG
#com.arsdigita.cms.ui.item.ItemLanguagesTable=DEBUG
#com.arsdigita.cms.ui.templates.ItemTemplateListing=DEBUG
#com.arsdigita.cms.ui.folder.FolderBrowser=DEBUG
#com.arsdigita.cms.ui.authoring.TextAssetBody=DEBUG
#com.arsdigita.cms.ContentSection=DEBUG
#com.arsdigita.cms.CMS=DEBUG
#com.arsdigita.cms.Loader=DEBUG
#com.arsdigita.cms.Template=DEBUG
#com.arsdigita.cms.Initalizer=DEBUG
#com.arsdigita.cms.contentassets.FileAttachment=DEBUG
#com.arsdigita.cms.contentassets.ItemImageAttachment=DEBUG
#com.arsdigita.cms.contentassets.Note=DEBUG
#com.arsdigita.cms.contentassets.ui=RelatedLinkPropertyForm=DEBUG
#com.arsdigita.cms.contenttypes.Event=DEBUG
#com.arsdigita.cms.contenttypes.GenericOrganization=DEBUG
#com.arsdigita.cms.contenttypes.GlossaryItem=DEBUG
#com.arsdigita.cms.contenttypes.HealthCareFacility=DEBUG
#com.arsdigita.cms.contenttypes.MultiPartArticle=DEBUG
#com.arsdigita.cms.contenttypes.NewsItem=DEBUG
#com.arsdigita.cms.contenttypes.SimpleAddress=DEBUG
#com.arsdigita.cms.dispatcherSiteProxyPanel=DEBUG
#com.arsdigita.cms.contenttypes.Survey=DEBUG
#com.arsdigita.kernel.security.KernelLoginException=DEBUG
#com.arsdigita.kernel.security.URLLoginModule=DEBUG
#com.arsdigita.kernel.security.Crypto=DEBUG
#com.arsdigita.profiler.Profiler=DEBUG
#com.arsdigita.categorization.Category=DEBUG
#com.arsdigita.developersupport.#Comodifications=DEBUG
#com.arsdigita.developersupport.Counter=DEBUG
#com.arsdigita.developersupport.LoggingProxyFactory=DEBUG
#com.arsdigita.persistence.pdl.PDL=DEBUG
#com.arsdigita.persistence.pdl.SQLRegressionGenerator=DEBUG
#com.arsdigita.persistence.SessionManager=DEBUG
#com.arsdigita.packaging.HostInit=DEBUG
#com.arsdigita.packaging.BaseCheck=DEBUG
#com.arsdigita.packaging.Load=DEBUG
#com.arsdigita.packaging.Get=DEBUG
#com.arsdigita.packaging.Unload=DEBUG
#com.arsdigita.packaging.CheckDB=DEBUG
#com.arsdigita.packaging.Upgrade=DEBUG
#com.arsdigita.packaging.Set=DEBUG
#com.arsdigita.toolbox.CharsetEncodingProvider=DEBUG
#com.arsdigita.bebop.demo.workflow.SampleProcess=DEBUG
#com.arsdigita.bebop.page.PageTransformer=DEBUG
#com.arsdigita.bebop.parameters.TidyHTMLValidationListener=DEBUG
#com.arsdigita.bebop.Page=DEBUG
#com.arsdigita.core.LibCheck=DEBUG
#com.arsdigita.templating.html.XHTMLParser=DEBUG
#com.arsdigita.templating.ApplyTemplates=DEBUG
#com.arsdigita.templating.Templating=DEBUG
#com.arsdigita.templating.PatternStylesheetResolver=DEBUG
#com.arsdigita.search.QueryEngineRegistry=DEBUG
#com.arsdigita.formbuilder.AttributeType=DEBUG
#com.arsdigita.mail.Mail=DEBUG
#com.arsdigita.versioning.DevSupport=DEBUG
#com.arsdigita.versioning.Adapter=DEBUG
#com.arsdigita.dispatcher.BaseDispatcherServlet=DEBUG
#com.arsdigita.logging.ErrorReport=DEBUG
#com.arsdigita.xml.XML=DEBUG
#com.arsdigita.xml.Document=DEBUG
#com.arsdigita.sitenode.ServletErrorReport=DEBUG
#com.arsdigita.util.parameter.IntegerParameter=DEBUG
#com.arsdigita.util.parameter.ClassParameter=DEBUG
#com.arsdigita.util.parameter.StringParameter=DEBUG
#com.arsdigita.util.parameter.ParameterPrinter=DEBUG
#com.arsdigita.util.Assert=DEBUG
#com.arsdigita.util.StringUtils=DEBUG
#com.arsdigita.util.UncheckedWrapperException=DEBUG
#com.arsdigita.util.WrappedError=DEBUG
#com.arsdigita.util.ConcurrentDict=DEBUG
#com.redhat.persistence.profiler.rdbms.SQLSummary=DEBUG
#com.redhat.persistence.metadata.Column=DEBUG
#com.redhat.persistence.ogl.Static=DEBUG
#com.arsdigita.cms.docmgr.ui.CreateDocLinkSearchTable=DEBUG
#com.arsdigita.formbuilder.pdf.PDFConfig=DEBUG
#com.arsdigita.ui.TopicsList=DEBUG
#com.arsdigita.forum.ForumPageFactory=DEBUG
#com.arsdigita.forum.Forum=DEBUG
#com.arsdigita.aplaws.ObjectTypeSchemaGenerator=DEBUG
#com.arsdigita.london.atoz.AtoZ=DEBUG
#com.arsdigita.london.cms.dublin.DublinCoreItem=DEBUG
#com.arsdigita.london.exporter.Exporter=DEBUG
#com.arsdigita.london.importer.cms.ItemParser=DEBUG
#com.arsdigita.london.navigation.ui.TemplateURLs=DEBUG
#com.arsdigita.london.navigation.Navigation=DEBUG
#com.arsdigita.london.navigation.ApplicationNavigationModel=DEBUG
#com.arsdigita.london.portal.portlet.RSSFeedPortletHelper=DEBUG
#com.arsdigita.london.portal.ui.admin.GrantsTable=DEBUG
#com.arsdigita.london.portal.ui.Icons=DEBUG
#com.arsdigita.london.Workspace=DEBUG
#com.arsdigita.london.rss.RSS=DEBUG
#com.arsdigita.london.rss.RSSService=DEBUG
#com.arsdigita.london.search.Search=DEBUG
#com.arsdigita.london.shortcuts.Shortcuts=DEBUG
#com.arsdigita.london.subsite.Subsite=DEBUG
#kea.stemmers.LovinsStemmer=DEBUG
#kea.stemmers.StopwordsFrench=DEBUG
#kea.stemmers.StopwordsSpanish=DEBUG
#kea.stemmers.StopwordsEnglish=DEBUG
#kea.stemmers.StopwordsGerman=DEBUG
#com.arsdigita.london.terms.Terms=DEBUG
#com.arsdigita.london.theme.ThemeApplication=DEBUG
#com.arsdigita.cms.contenttypes.ContactInitalizer=DEBUG
#com.arsdigita.cms.contenttypes.SciDepartment=DEBUG
#com.arsdigita.cms.contenttypes.SciOrganization=DEBUG
#com.arsdigita.cms.contenttypes.SciProject=DEBUG
#com.arsdigita.cms.contenttypes.SciMember=DEBUG
#com.arsdigita.cms.webpage.installer.Initializer=DEBUG

View File

@ -204,11 +204,14 @@ public class CreateDocLinkSearchTable extends Table implements DMConstants{
*/ */
private static class ActionCellRenderer implements TableCellRenderer { private static class ActionCellRenderer implements TableCellRenderer {
private final static Logger logger = Logger.getLogger(ActionCellRenderer.class);
private static ControlLink s_link; private static ControlLink s_link;
static { static {
logger.debug("Static initalizer starting...");
s_link = new ControlLink(new Label(DMConstants.FOLDER_NEW_CREATE_LINK)); s_link = new ControlLink(new Label(DMConstants.FOLDER_NEW_CREATE_LINK));
s_link.setConfirmation("Create Link to this Document ?"); s_link.setConfirmation("Create Link to this Document ?");
logger.debug("Static initalizer finished.");
} }
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,

View File

@ -45,12 +45,14 @@ public class PDFConfig extends AbstractConfig {
private static final PDFConfig s_config = new PDFConfig(); private static final PDFConfig s_config = new PDFConfig();
static { static {
s_log.debug("Static initalizer starting...");
try { try {
s_config.load(); s_config.load();
} catch (java.lang.IllegalArgumentException ex) { } catch (java.lang.IllegalArgumentException ex) {
s_log.info("Unable to load PDFConfig. This is not a problem " + s_log.info("Unable to load PDFConfig. This is not a problem " +
"during ccm load, but is a problem at all other times"); "during ccm load, but is a problem at all other times");
} }
s_log.debug("Static initalizer finished.");
} }
public PDFConfig() { public PDFConfig() {

View File

@ -80,7 +80,9 @@ public class Forum extends Application {
private static final ForumConfig s_config = new ForumConfig(); private static final ForumConfig s_config = new ForumConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
public static ForumConfig getConfig() { public static ForumConfig getConfig() {

View File

@ -25,6 +25,7 @@ import java.util.Map;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
// import com.arsdigita.bebop.parameters.ParameterModel; // import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import org.apache.log4j.Logger;
/** /**
* Factory class that enables projects to provide their own page creators. * Factory class that enables projects to provide their own page creators.
@ -35,22 +36,24 @@ import com.arsdigita.util.Assert;
*/ */
public class ForumPageFactory { public class ForumPageFactory {
private static final Logger logger = Logger.getLogger(ForumPageFactory.class);
public static final String THREAD_PAGE = "thread"; public static final String THREAD_PAGE = "thread";
public static final String FORUM_PAGE = "forum"; public static final String FORUM_PAGE = "forum";
private static Map pageBuilders = new HashMap(); private static Map pageBuilders = new HashMap();
static { static {
logger.debug("Static initalizer starting...");
// default pageBuilders are those provided with this project // default pageBuilders are those provided with this project
pageBuilders.put(THREAD_PAGE, new ThreadPageBuilder()); pageBuilders.put(THREAD_PAGE, new ThreadPageBuilder());
pageBuilders.put(FORUM_PAGE, new ForumPageBuilder()); pageBuilders.put(FORUM_PAGE, new ForumPageBuilder());
logger.debug("Static initalizer finished.");
} }
public static Page getPage(String pageType) { public static Page getPage(String pageType) {
Assert.isTrue(pageBuilders.containsKey(pageType), Assert.isTrue(pageBuilders.containsKey(pageType),
"Requested page type (" + pageType + "Requested page type (" + pageType
") does not have a builder registered" ); + ") does not have a builder registered");
PageBuilder builder = (PageBuilder)pageBuilders.get(pageType); PageBuilder builder = (PageBuilder) pageBuilders.get(pageType);
Page page = builder.buildPage(); Page page = builder.buildPage();
page.lock(); page.lock();
return page; return page;
@ -58,15 +61,12 @@ public class ForumPageFactory {
} }
public static Iterator getPages () { public static Iterator getPages() {
return pageBuilders.keySet().iterator(); return pageBuilders.keySet().iterator();
} }
public static void registerPageBuilder(String pageType, PageBuilder builder) {
public static void registerPageBuilder (String pageType, PageBuilder builder) {
pageBuilders.put(pageType, builder); pageBuilders.put(pageType, builder);
} }
} }

View File

@ -31,6 +31,7 @@ import com.arsdigita.forum.ForumContext;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.apache.log4j.Logger;
/** /**
@ -46,14 +47,17 @@ import java.util.Iterator;
*/ */
public class TopicsList extends SimpleComponent implements Constants { public class TopicsList extends SimpleComponent implements Constants {
private static final Logger logger = Logger.getLogger(TopicsList.class);
/** List of properties a topic may have. */ /** List of properties a topic may have. */
private final static Set s_catProps; private final static Set s_catProps;
static { static {
logger.debug("Static initalizer starting...");
s_catProps = new HashSet(); s_catProps = new HashSet();
s_catProps.add("id"); s_catProps.add("id");
s_catProps.add("name"); s_catProps.add("name");
s_catProps.add("numThreads"); s_catProps.add("numThreads");
s_catProps.add("latestPost"); s_catProps.add("latestPost");
logger.debug("Static initalizer finished.");
} }
/** /**

View File

@ -15,7 +15,6 @@
* 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
*/ */
package com.arsdigita.aplaws; package com.arsdigita.aplaws;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
@ -26,18 +25,16 @@ import com.arsdigita.persistence.metadata.Property;
import java.util.HashMap; import java.util.HashMap;
import java.util.Stack; import java.util.Stack;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger;
public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal { public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
private static final Logger logger = Logger.getLogger(ObjectTypeSchemaGenerator.class);
private boolean m_wrapRoot = false; private boolean m_wrapRoot = false;
private boolean m_wrapObjects = false; private boolean m_wrapObjects = false;
private boolean m_wrapAttributes = false; private boolean m_wrapAttributes = false;
private Stack m_history = new Stack(); private Stack m_history = new Stack();
private HashMap m_elements = new HashMap(); private HashMap m_elements = new HashMap();
// The xs:element // The xs:element
private Element m_element; private Element m_element;
// The (optional) xs:complexType // The (optional) xs:complexType
@ -47,26 +44,25 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// The (optional property // The (optional property
private Property m_property; private Property m_property;
private Stack m_properties = new Stack(); private Stack m_properties = new Stack();
private Element m_root; private Element m_root;
private String m_rootName; private String m_rootName;
public static final String SCHEMA_PREFIX = "xs:"; public static final String SCHEMA_PREFIX = "xs:";
public static final String SCHEMA_NS = public static final String SCHEMA_NS =
"http://www.w3.org/2001/XMLSchema"; "http://www.w3.org/2001/XMLSchema";
private static HashMap s_types = new HashMap(); private static HashMap s_types = new HashMap();
static { static {
logger.debug("Static initalizer starting...");
s_types.put(String.class, "xs:string"); s_types.put(String.class, "xs:string");
s_types.put(Boolean.class, "xs:boolean"); s_types.put(Boolean.class, "xs:boolean");
s_types.put(Integer.class, "xs:integer"); s_types.put(Integer.class, "xs:integer");
s_types.put(BigDecimal.class, "xs:double"); s_types.put(BigDecimal.class, "xs:double");
logger.debug("Static initalizer finished.");
} }
protected static String lookupType(Class klass) { protected static String lookupType(Class klass) {
if (s_types.containsKey(klass)) { if (s_types.containsKey(klass)) {
return (String)s_types.get(klass); return (String) s_types.get(klass);
} }
return "xs:string"; return "xs:string";
} }
@ -75,7 +71,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
s_types.put(klass, type); s_types.put(klass, type);
} }
public ObjectTypeSchemaGenerator(String rootName, public ObjectTypeSchemaGenerator(String rootName,
String namespace) { String namespace) {
m_root = new Element(SCHEMA_PREFIX + "schema", m_root = new Element(SCHEMA_PREFIX + "schema",
@ -95,7 +90,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
return m_root; return m_root;
} }
/** /**
* Determines XML output for root object. * Determines XML output for root object.
* If set to true a separate element will * If set to true a separate element will
@ -148,13 +142,16 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String name; String name;
if (m_element == null) { if (m_element == null) {
if (m_wrapRoot) { if (m_wrapRoot) {
Element element = m_root.newChildElement(SCHEMA_PREFIX + "element", Element element = m_root.newChildElement(SCHEMA_PREFIX
+ "element",
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", m_rootName); element.addAttribute("name", m_rootName);
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType", Element type = element.newChildElement(SCHEMA_PREFIX
+ "complexType",
SCHEMA_NS); SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
parent = sequence; parent = sequence;
@ -196,7 +193,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
m_elements.put(path, element); m_elements.put(path, element);
// Preserve context // Preserve context
m_history.push(new Element[] { m_element, m_type, m_sequence }); m_history.push(new Element[]{m_element, m_type, m_sequence});
m_element = element; m_element = element;
m_type = type; m_type = type;
@ -209,7 +206,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
*/ */
protected void endObject(ObjectType obj, protected void endObject(ObjectType obj,
String path) { String path) {
Element[] saved = (Element[])m_history.pop(); Element[] saved = (Element[]) m_history.pop();
m_element = saved[0]; m_element = saved[0];
m_type = saved[1]; m_type = saved[1];
m_sequence = saved[2]; m_sequence = saved[2];
@ -223,7 +220,8 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) { Property property) {
if (m_wrapAttributes) { if (m_wrapAttributes) {
if (m_sequence == null) { if (m_sequence == null) {
Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
m_sequence = sequence; m_sequence = sequence;
} }
@ -232,7 +230,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", property.getName()); element.addAttribute("name", property.getName());
// XXX pdl type -> xs type mapping // XXX pdl type -> xs type mapping
element.addAttribute("type",lookupType(property.getJavaClass())); element.addAttribute("type", lookupType(property.getJavaClass()));
if (property.isNullable()) { if (property.isNullable()) {
element.addAttribute("minOccurs", "0"); element.addAttribute("minOccurs", "0");
@ -271,12 +269,14 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
if (m_sequence == null) { if (m_sequence == null) {
Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
m_sequence = sequence; m_sequence = sequence;
} }
Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element", Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ "element",
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", property.getName()); element.addAttribute("name", property.getName());
if (property.isNullable()) { if (property.isNullable()) {
@ -289,7 +289,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS); SCHEMA_NS);
// Preserve context // Preserve context
m_history.push(new Element[] { m_element, m_type, m_sequence }); m_history.push(new Element[]{m_element, m_type, m_sequence});
m_element = element; m_element = element;
m_type = type; m_type = type;
@ -307,12 +307,12 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path, String path,
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
Element[] saved = (Element[])m_history.pop(); Element[] saved = (Element[]) m_history.pop();
m_element = saved[0]; m_element = saved[0];
m_type = saved[1]; m_type = saved[1];
m_sequence = saved[2]; m_sequence = saved[2];
} }
m_property = (Property)m_properties.pop(); m_property = (Property) m_properties.pop();
} }
/** /**
@ -324,12 +324,14 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
if (m_sequence == null) { if (m_sequence == null) {
Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
m_sequence = sequence; m_sequence = sequence;
} }
Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element", Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ "element",
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", property.getName()); element.addAttribute("name", property.getName());
if (property.isNullable()) { if (property.isNullable()) {
@ -342,7 +344,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS); SCHEMA_NS);
// Preserve context // Preserve context
m_history.push(new Element[] { m_element, m_type, m_sequence }); m_history.push(new Element[]{m_element, m_type, m_sequence});
m_element = element; m_element = element;
m_type = type; m_type = type;
@ -360,12 +362,11 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path, String path,
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
Element[] saved = (Element[])m_history.pop(); Element[] saved = (Element[]) m_history.pop();
m_element = saved[0]; m_element = saved[0];
m_type = saved[1]; m_type = saved[1];
m_sequence = saved[2]; m_sequence = saved[2];
} }
m_property = (Property)m_properties.pop(); m_property = (Property) m_properties.pop();
} }
} }

View File

@ -15,7 +15,6 @@
* 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
*/ */
package com.arsdigita.aplaws; package com.arsdigita.aplaws;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
@ -26,18 +25,16 @@ import com.arsdigita.persistence.metadata.Property;
import java.util.HashMap; import java.util.HashMap;
import java.util.Stack; import java.util.Stack;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger;
public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal { public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
private static final Logger logger = Logger.getLogger(ObjectTypeSchemaGenerator.class);
private boolean m_wrapRoot = false; private boolean m_wrapRoot = false;
private boolean m_wrapObjects = false; private boolean m_wrapObjects = false;
private boolean m_wrapAttributes = false; private boolean m_wrapAttributes = false;
private Stack m_history = new Stack(); private Stack m_history = new Stack();
private HashMap m_elements = new HashMap(); private HashMap m_elements = new HashMap();
// The xs:element // The xs:element
private Element m_element; private Element m_element;
// The (optional) xs:complexType // The (optional) xs:complexType
@ -47,26 +44,25 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// The (optional property // The (optional property
private Property m_property; private Property m_property;
private Stack m_properties = new Stack(); private Stack m_properties = new Stack();
private Element m_root; private Element m_root;
private String m_rootName; private String m_rootName;
public static final String SCHEMA_PREFIX = "xs:"; public static final String SCHEMA_PREFIX = "xs:";
public static final String SCHEMA_NS = public static final String SCHEMA_NS =
"http://www.w3.org/2001/XMLSchema"; "http://www.w3.org/2001/XMLSchema";
private static HashMap s_types = new HashMap(); private static HashMap s_types = new HashMap();
static { static {
logger.debug("Static initalizer starting...");
s_types.put(String.class, "xs:string"); s_types.put(String.class, "xs:string");
s_types.put(Boolean.class, "xs:boolean"); s_types.put(Boolean.class, "xs:boolean");
s_types.put(Integer.class, "xs:integer"); s_types.put(Integer.class, "xs:integer");
s_types.put(BigDecimal.class, "xs:double"); s_types.put(BigDecimal.class, "xs:double");
logger.debug("Static initalizer finished.");
} }
protected static String lookupType(Class klass) { protected static String lookupType(Class klass) {
if (s_types.containsKey(klass)) { if (s_types.containsKey(klass)) {
return (String)s_types.get(klass); return (String) s_types.get(klass);
} }
return "xs:string"; return "xs:string";
} }
@ -75,7 +71,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
s_types.put(klass, type); s_types.put(klass, type);
} }
public ObjectTypeSchemaGenerator(String rootName, public ObjectTypeSchemaGenerator(String rootName,
String namespace) { String namespace) {
m_root = new Element(SCHEMA_PREFIX + "schema", m_root = new Element(SCHEMA_PREFIX + "schema",
@ -95,7 +90,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
return m_root; return m_root;
} }
/** /**
* Determines XML output for root object. * Determines XML output for root object.
* If set to true a separate element will * If set to true a separate element will
@ -148,13 +142,16 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String name; String name;
if (m_element == null) { if (m_element == null) {
if (m_wrapRoot) { if (m_wrapRoot) {
Element element = m_root.newChildElement(SCHEMA_PREFIX + "element", Element element = m_root.newChildElement(SCHEMA_PREFIX
+ "element",
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", m_rootName); element.addAttribute("name", m_rootName);
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType", Element type = element.newChildElement(SCHEMA_PREFIX
+ "complexType",
SCHEMA_NS); SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
parent = sequence; parent = sequence;
@ -196,7 +193,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
m_elements.put(path, element); m_elements.put(path, element);
// Preserve context // Preserve context
m_history.push(new Element[] { m_element, m_type, m_sequence }); m_history.push(new Element[]{m_element, m_type, m_sequence});
m_element = element; m_element = element;
m_type = type; m_type = type;
@ -209,7 +206,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
*/ */
protected void endObject(ObjectType obj, protected void endObject(ObjectType obj,
String path) { String path) {
Element[] saved = (Element[])m_history.pop(); Element[] saved = (Element[]) m_history.pop();
m_element = saved[0]; m_element = saved[0];
m_type = saved[1]; m_type = saved[1];
m_sequence = saved[2]; m_sequence = saved[2];
@ -223,7 +220,8 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) { Property property) {
if (m_wrapAttributes) { if (m_wrapAttributes) {
if (m_sequence == null) { if (m_sequence == null) {
Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
m_sequence = sequence; m_sequence = sequence;
} }
@ -232,7 +230,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", property.getName()); element.addAttribute("name", property.getName());
// XXX pdl type -> xs type mapping // XXX pdl type -> xs type mapping
element.addAttribute("type",lookupType(property.getJavaClass())); element.addAttribute("type", lookupType(property.getJavaClass()));
if (property.isNullable()) { if (property.isNullable()) {
element.addAttribute("minOccurs", "0"); element.addAttribute("minOccurs", "0");
@ -271,12 +269,14 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
if (m_sequence == null) { if (m_sequence == null) {
Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
m_sequence = sequence; m_sequence = sequence;
} }
Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element", Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ "element",
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", property.getName()); element.addAttribute("name", property.getName());
if (property.isNullable()) { if (property.isNullable()) {
@ -289,7 +289,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS); SCHEMA_NS);
// Preserve context // Preserve context
m_history.push(new Element[] { m_element, m_type, m_sequence }); m_history.push(new Element[]{m_element, m_type, m_sequence});
m_element = element; m_element = element;
m_type = type; m_type = type;
@ -307,12 +307,12 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path, String path,
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
Element[] saved = (Element[])m_history.pop(); Element[] saved = (Element[]) m_history.pop();
m_element = saved[0]; m_element = saved[0];
m_type = saved[1]; m_type = saved[1];
m_sequence = saved[2]; m_sequence = saved[2];
} }
m_property = (Property)m_properties.pop(); m_property = (Property) m_properties.pop();
} }
/** /**
@ -324,12 +324,14 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
if (m_sequence == null) { if (m_sequence == null) {
Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence", Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ "sequence",
SCHEMA_NS); SCHEMA_NS);
m_sequence = sequence; m_sequence = sequence;
} }
Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element", Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ "element",
SCHEMA_NS); SCHEMA_NS);
element.addAttribute("name", property.getName()); element.addAttribute("name", property.getName());
if (property.isNullable()) { if (property.isNullable()) {
@ -342,7 +344,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS); SCHEMA_NS);
// Preserve context // Preserve context
m_history.push(new Element[] { m_element, m_type, m_sequence }); m_history.push(new Element[]{m_element, m_type, m_sequence});
m_element = element; m_element = element;
m_type = type; m_type = type;
@ -360,12 +362,11 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path, String path,
Property property) { Property property) {
if (m_wrapObjects) { if (m_wrapObjects) {
Element[] saved = (Element[])m_history.pop(); Element[] saved = (Element[]) m_history.pop();
m_element = saved[0]; m_element = saved[0];
m_type = saved[1]; m_type = saved[1];
m_sequence = saved[2]; m_sequence = saved[2];
} }
m_property = (Property)m_properties.pop(); m_property = (Property) m_properties.pop();
} }
} }

View File

@ -33,6 +33,7 @@ import com.arsdigita.util.Assert;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.log4j.Logger;
/** /**
* Base class of the AtoZ application (module) * Base class of the AtoZ application (module)
@ -40,12 +41,15 @@ import java.util.ArrayList;
*/ */
public class AtoZ extends Application { public class AtoZ extends Application {
private static final Logger logger = Logger.getLogger(AtoZ.class);
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.london.atoz.AtoZ"; = "com.arsdigita.london.atoz.AtoZ";
private static final AtoZConfig s_config = new AtoZConfig(); private static final AtoZConfig s_config = new AtoZConfig();
static { static {
logger.debug("Static initializer is starting...");
s_config.load(); s_config.load();
logger.debug("Static initializer is finished.");
} }
public static final AtoZConfig getConfig() { public static final AtoZConfig getConfig() {

View File

@ -24,6 +24,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import java.util.Date; import java.util.Date;
import org.apache.log4j.Logger;
/*** /***
* *
@ -61,12 +62,15 @@ import java.util.Date;
**/ **/
public class DublinCoreItem extends ContentItem { public class DublinCoreItem extends ContentItem {
private static final Logger logger = Logger.getLogger(DublinCoreItem.class);
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.london.cms.dublin.DublinCoreItem"; "com.arsdigita.london.cms.dublin.DublinCoreItem";
private static final DublinCoreConfig s_config = new DublinCoreConfig(); private static final DublinCoreConfig s_config = new DublinCoreConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static final DublinCoreConfig getConfig() { public static final DublinCoreConfig getConfig() {

View File

@ -18,14 +18,19 @@
package com.arsdigita.london.exporter; package com.arsdigita.london.exporter;
import org.apache.log4j.Logger;
public class Exporter { public class Exporter {
private static final Logger logger = Logger.getLogger(Exporter.class);
private static ExporterConfig s_config = new ExporterConfig(); private static ExporterConfig s_config = new ExporterConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static ExporterConfig getConfig() { public static ExporterConfig getConfig() {

View File

@ -105,6 +105,7 @@ public class ItemParser extends DomainObjectParser {
private Date m_archiveDate; private Date m_archiveDate;
static { static {
s_log.debug("Static initalizer starting...");
s_ignoredProps = new ArrayList(); s_ignoredProps = new ArrayList();
s_ignoredProps.add(ID); s_ignoredProps.add(ID);
s_ignoredProps.add(OID_ATTR); s_ignoredProps.add(OID_ATTR);
@ -115,6 +116,7 @@ public class ItemParser extends DomainObjectParser {
s_ignoredProps.add(ARTICLE_ID); s_ignoredProps.add(ARTICLE_ID);
s_ignoredProps.add(DEFAULT_ANCESTORS); s_ignoredProps.add(DEFAULT_ANCESTORS);
s_ignoredProps.add(DO_NOT_SAVE); s_ignoredProps.add(DO_NOT_SAVE);
s_log.debug("Static initalizer finished.");
} }
public ItemParser(File lobDir, DomainObjectMapper mapper) { public ItemParser(File lobDir, DomainObjectMapper mapper) {

View File

@ -42,8 +42,10 @@ public class ApplicationNavigationModel implements NavigationModel {
new GenericNavigationModel(); new GenericNavigationModel();
static { static {
s_log.debug("Static initalizer starting...");
register(ContentSection.BASE_DATA_OBJECT_TYPE, new CMSNavigationModel()); register(ContentSection.BASE_DATA_OBJECT_TYPE, new CMSNavigationModel());
register(Navigation.BASE_DATA_OBJECT_TYPE, new DefaultNavigationModel()); register(Navigation.BASE_DATA_OBJECT_TYPE, new DefaultNavigationModel());
s_log.debug("Static initalizer finished.");
} }
public ACSObject getObject() { public ACSObject getObject() {

View File

@ -27,10 +27,13 @@ import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
import com.arsdigita.web.Web; import com.arsdigita.web.Web;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
public class Navigation extends Application { public class Navigation extends Application {
private static final Logger logger = Logger.getLogger(Navigation.class);
public static final String NAV_NS = public static final String NAV_NS =
"http://ccm.redhat.com/london/navigation"; "http://ccm.redhat.com/london/navigation";
public static final String NAV_PREFIX = "nav"; public static final String NAV_PREFIX = "nav";
@ -42,7 +45,9 @@ public class Navigation extends Application {
private static NavigationContext s_context = new NavigationContext(); private static NavigationContext s_context = new NavigationContext();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static NavigationConfig getConfig() { public static NavigationConfig getConfig() {

View File

@ -15,7 +15,6 @@
* 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
*/ */
package com.arsdigita.london.navigation.ui; package com.arsdigita.london.navigation.ui;
import com.arsdigita.london.navigation.NavigationConstants; import com.arsdigita.london.navigation.NavigationConstants;
@ -30,54 +29,59 @@ import com.arsdigita.xml.Element;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.apache.log4j.Logger;
public class TemplateURLs extends SimpleComponent { public class TemplateURLs extends SimpleComponent {
private static final Logger logger = Logger.getLogger(TemplateURLs.class);
private static final String[] s_contexts; private static final String[] s_contexts;
// Pull out and pre-populate the template use contexts. Note that this will // Pull out and pre-populate the template use contexts. Note that this will
// only be done once per server load, but this is ok because there's no UI // only be done once per server load, but this is ok because there's no UI
// for creating contexts. // for creating contexts.
static { static {
logger.debug("Static initalizer starting...");
TemplateContextCollection templates = TemplateContext.retrieveAll(); TemplateContextCollection templates = TemplateContext.retrieveAll();
LinkedList buffer = new LinkedList(); LinkedList buffer = new LinkedList();
while( templates.next() ) { while (templates.next()) {
buffer.add( templates.getTemplateContext().getContext() ); buffer.add(templates.getTemplateContext().getContext());
} }
s_contexts = new String[buffer.size()]; s_contexts = new String[buffer.size()];
Iterator iter = buffer.iterator(); Iterator iter = buffer.iterator();
for( int i = 0; i < s_contexts.length; i++ ) { for (int i = 0; i < s_contexts.length; i++) {
s_contexts[i] = iter.next().toString(); s_contexts[i] = iter.next().toString();
} }
logger.debug("Static initalizer finished.");
} }
public TemplateURLs() { public TemplateURLs() {
super(); super();
} }
public void generateXML( PageState ps, Element p ) { public void generateXML(PageState ps, Element p) {
ContentItem item = CMS.getContext().getContentItem(); ContentItem item = CMS.getContext().getContentItem();
if( null == item ) return; if (null == item) {
return;
}
Element container = p.newChildElement( Element container = p.newChildElement(
NavigationConstants.NAV_PREFIX + ":templateContexts", NavigationConstants.NAV_PREFIX + ":templateContexts",
NavigationConstants.NAV_NS NavigationConstants.NAV_NS);
); container.addAttribute("type", item.getContentType().getClassName());
container.addAttribute( "type", item.getContentType().getClassName() );
String sectionPath = item.getContentSection().getPath(); String sectionPath = item.getContentSection().getPath();
String itemPath = item.getPath(); String itemPath = item.getPath();
for( int i = 0; i < s_contexts.length; i++ ) { for (int i = 0; i < s_contexts.length; i++) {
Element context = container.newChildElement( Element context = container.newChildElement(
NavigationConstants.NAV_PREFIX + ":context", NavigationConstants.NAV_PREFIX + ":context",
NavigationConstants.NAV_NS NavigationConstants.NAV_NS);
); context.addAttribute("name", s_contexts[i]);
context.addAttribute( "name", s_contexts[i] );
String path = sectionPath + "/tem_" + s_contexts[i] + '/' + itemPath; String path = sectionPath + "/tem_" + s_contexts[i] + '/' + itemPath;
context.addAttribute( "path", path ); context.addAttribute("path", path);
} }
} }
} }

View File

@ -12,7 +12,6 @@
* rights and limitations under the License. * rights and limitations under the License.
* *
*/ */
package com.arsdigita.london.portal; package com.arsdigita.london.portal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -62,34 +61,29 @@ import java.util.LinkedList;
public class Workspace extends Application { public class Workspace extends Application {
private static final Logger s_log = Logger.getLogger(Workspace.class); private static final Logger s_log = Logger.getLogger(Workspace.class);
private static final WorkspaceConfig s_config = new WorkspaceConfig(); private static final WorkspaceConfig s_config = new WorkspaceConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
public static WorkspaceConfig getConfig() { public static WorkspaceConfig getConfig() {
return s_config; return s_config;
} }
public static final String BASE_DATA_OBJECT_TYPE =
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.portal.Workspace"; "com.arsdigita.london.portal.Workspace";
public static final String PARTY = "party"; public static final String PARTY = "party";
public static final String PARTY_ID = PARTY + "." + ACSObject.ID; public static final String PARTY_ID = PARTY + "." + ACSObject.ID;
public static final String DEFAULT_LAYOUT = "defaultLayout"; public static final String DEFAULT_LAYOUT = "defaultLayout";
public static final String PAGES = "pages"; public static final String PAGES = "pages";
/** /**
* store this as a static variable as it cannot change during the lifetime * store this as a static variable as it cannot change during the lifetime
* of the ccm service * of the ccm service
*/ */
private static Workspace defaultHomepageWorkspace = null; private static Workspace defaultHomepageWorkspace = null;
/** /**
* Constructor * Constructor
* @param obj * @param obj
@ -110,7 +104,6 @@ public class Workspace extends Application {
/* /*
* public String getContextPath() { return "ccm-ldn-portal"; } * public String getContextPath() { return "ccm-ldn-portal"; }
*/ */
/** /**
* *
* @return ServletPath (constant) probably should be synchron with web.xml * @return ServletPath (constant) probably should be synchron with web.xml
@ -162,7 +155,8 @@ public class Workspace extends Application {
* @return * @return
*/ */
public static Workspace createWorkspace(String url, String title, public static Workspace createWorkspace(String url, String title,
PageLayout layout, Application parent, PageLayout layout,
Application parent,
boolean isPublic) { boolean isPublic) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Creating group workspace, isPublic:" + isPublic s_log.debug("Creating group workspace, isPublic:" + isPublic
@ -188,7 +182,8 @@ public class Workspace extends Application {
* @return * @return
*/ */
public static Workspace createWorkspace(String url, String title, public static Workspace createWorkspace(String url, String title,
PageLayout layout, Application parent, User owner) { PageLayout layout,
Application parent, User owner) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Creating personal workspace for " + owner.getOID() s_log.debug("Creating personal workspace for " + owner.getOID()
+ " on " + url + " with parent " + " on " + url + " with parent "
@ -259,7 +254,6 @@ public class Workspace extends Application {
// super.beforeDelete(); // super.beforeDelete();
// Category.clearRootForObject(this); // Category.clearRootForObject(this);
// } // }
// This method wouldn't need to exist if permissioning used // This method wouldn't need to exist if permissioning used
// the associations rather than direct queries which require // the associations rather than direct queries which require
// the object to be saved // the object to be saved
@ -362,8 +356,8 @@ public class Workspace extends Application {
wks.addEqualsFilter(PARTY_ID, owner.getID()); wks.addEqualsFilter(PARTY_ID, owner.getID());
if (wks.next()) { if (wks.next()) {
Workspace workspace = (Workspace) Application Workspace workspace = (Workspace) Application.retrieveApplication(wks.
.retrieveApplication(wks.getDataObject()); getDataObject());
wks.close(); wks.close();
@ -392,8 +386,8 @@ public class Workspace extends Application {
} }
public PageLayout getDefaultLayout() { public PageLayout getDefaultLayout() {
return (PageLayout) DomainObjectFactory return (PageLayout) DomainObjectFactory.newInstance((DataObject) get(
.newInstance((DataObject) get(DEFAULT_LAYOUT)); DEFAULT_LAYOUT));
} }
public void setParty(Party party) { public void setParty(Party party) {
@ -461,12 +455,12 @@ public class Workspace extends Application {
public PartyCollection getNonParticipants() { public PartyCollection getNonParticipants() {
DataCollection dc = DataCollection dc =
SessionManager.getSession() SessionManager.getSession().retrieve(
.retrieve("com.arsdigita.kernel.User"); "com.arsdigita.kernel.User");
// .retrieve("com.arsdigita.kernel.Party"); // .retrieve("com.arsdigita.kernel.Party");
Filter f = dc Filter f =
.addNotInSubqueryFilter dc.addNotInSubqueryFilter("id",
("id", "com.arsdigita.london.portal.WorkspaceParticipantIDs"); "com.arsdigita.london.portal.WorkspaceParticipantIDs");
f.set("workspaceID", getID()); f.set("workspaceID", getID());
return new PartyCollection(dc); return new PartyCollection(dc);
} }
@ -484,8 +478,8 @@ public class Workspace extends Application {
* alphabetical order.</p> * alphabetical order.</p>
**/ **/
public Iterator getParticipantInitials() { public Iterator getParticipantInitials() {
DataQuery query = SessionManager.getSession().retrieveQuery DataQuery query = SessionManager.getSession().retrieveQuery(
("com.arsdigita.london.portal.WorkspaceParticipantInitials"); "com.arsdigita.london.portal.WorkspaceParticipantInitials");
query.setParameter("workspaceID", getID()); query.setParameter("workspaceID", getID());
LinkedList result = new LinkedList(); LinkedList result = new LinkedList();
@ -516,10 +510,11 @@ public class Workspace extends Application {
// ("id", "com.arsdigita.london.portal.WorkspaceParticipantsWithInitial"); // ("id", "com.arsdigita.london.portal.WorkspaceParticipantsWithInitial");
DataCollection dc = DataCollection dc =
SessionManager.getSession() SessionManager.getSession().retrieve(
.retrieve("com.arsdigita.kernel.User"); "com.arsdigita.kernel.User");
Filter f = dc.addInSubqueryFilter Filter f =
("id", "com.arsdigita.london.portal.WorkspaceParticipantsWithInitial"); dc.addInSubqueryFilter("id",
"com.arsdigita.london.portal.WorkspaceParticipantsWithInitial");
f.set("workspaceID", getID()); f.set("workspaceID", getID());
f.set("nameInitial", initial); f.set("nameInitial", initial);
@ -621,9 +616,9 @@ public class Workspace extends Application {
dobj = (DataObject) get("theme"); dobj = (DataObject) get("theme");
if (dobj == null) if (dobj == null) {
return null; return null;
else { } else {
WorkspaceTheme theme = new WorkspaceTheme(dobj); WorkspaceTheme theme = new WorkspaceTheme(dobj);
return theme; return theme;
} }
@ -638,8 +633,8 @@ public class Workspace extends Application {
} }
public WorkspaceCollection getChildWorkspaces() { public WorkspaceCollection getChildWorkspaces() {
DataQuery query = SessionManager.getSession().retrieveQuery DataQuery query = SessionManager.getSession().retrieveQuery(
("com.arsdigita.london.portal.childWorkspacesForApplicationID"); "com.arsdigita.london.portal.childWorkspacesForApplicationID");
query.setParameter("applicationID", getID()); query.setParameter("applicationID", getID());
DataCollection collection = DataCollection collection =
@ -676,14 +671,12 @@ public class Workspace extends Application {
// public String getDescription() { // public String getDescription() {
// return (String) get("description"); // return (String) get("description");
// } // }
/** /**
* Set's the description for a Workspace. * Set's the description for a Workspace.
*/ */
// public void setDescription(String description) { // public void setDescription(String description) {
// set("description", description); // set("description", description);
// } // }
/** /**
* Sets the user who owns the workspace * Sets the user who owns the workspace
* *
@ -705,8 +698,8 @@ public class Workspace extends Application {
String url = "" + owner.getID(); String url = "" + owner.getID();
String title = "Personal Workspace for " + owner.getDisplayName(); String title = "Personal Workspace for " + owner.getDisplayName();
Application parent = Application Application parent = Application.retrieveApplicationForPath(
.retrieveApplicationForPath(PersonalPortalPage.PERSONAL_PORTAL_PATH); PersonalPortalPage.PERSONAL_PORTAL_PATH);
final Workspace workspace = createWorkspace(url, title, parent, false); final Workspace workspace = createWorkspace(url, title, parent, false);
// TODO the setOwner method should probably deal with all the // TODO the setOwner method should probably deal with all the
@ -715,6 +708,7 @@ public class Workspace extends Application {
group.addMember(owner); group.addMember(owner);
workspace.setOwner(owner); workspace.setOwner(owner);
new KernelExcursion() { new KernelExcursion() {
public void excurse() { public void excurse() {
setEffectiveParty(Kernel.getSystemParty()); setEffectiveParty(Kernel.getSystemParty());
PermissionDescriptor pd = new PermissionDescriptor( PermissionDescriptor pd = new PermissionDescriptor(
@ -743,20 +737,20 @@ public class Workspace extends Application {
} }
public static Workspace retrievePersonalWorkspace(User owner) { public static Workspace retrievePersonalWorkspace(User owner) {
DataCollection personalWorkspaces = SessionManager.getSession() DataCollection personalWorkspaces = SessionManager.getSession().retrieve(
.retrieve(BASE_DATA_OBJECT_TYPE); BASE_DATA_OBJECT_TYPE);
personalWorkspaces.addEqualsFilter("owner", owner.getID()); personalWorkspaces.addEqualsFilter("owner", owner.getID());
if (personalWorkspaces.next()) { if (personalWorkspaces.next()) {
Workspace workspace = (Workspace) Application Workspace workspace = (Workspace) Application.retrieveApplication(personalWorkspaces.
.retrieveApplication(personalWorkspaces.getDataObject()); getDataObject());
if (personalWorkspaces.next()) if (personalWorkspaces.next()) {
s_log.error("more than one personal workspaces for this user!!"); s_log.error("more than one personal workspaces for this user!!");
}
personalWorkspaces.close(); personalWorkspaces.close();
return workspace; return workspace;
} }
return null; return null;
} }
} }

View File

@ -12,7 +12,6 @@
* rights and limitations under the License. * rights and limitations under the License.
* *
*/ */
package com.arsdigita.london.portal.portlet; package com.arsdigita.london.portal.portlet;
import java.io.IOException; import java.io.IOException;
@ -42,18 +41,17 @@ import com.arsdigita.xml.Element;
public class RSSFeedPortletHelper { public class RSSFeedPortletHelper {
private static final Logger s_log = Logger private static final Logger s_log = Logger.getLogger(
.getLogger(RSSFeedPortletHelper.class); RSSFeedPortletHelper.class);
private static final String CACHE_SERVICE_KEY = "RSSFeedPortletHelper"; private static final String CACHE_SERVICE_KEY = "RSSFeedPortletHelper";
private static final URLCache cache = new URLCache(1000000, 15 * 60 * 1000); private static final URLCache cache = new URLCache(1000000, 15 * 60 * 1000);
private static final URLPool pool = new URLPool(); private static final URLPool pool = new URLPool();
static { static {
s_log.debug("Static initalizer starting...");
URLFetcher.registerService(CACHE_SERVICE_KEY, pool, cache); URLFetcher.registerService(CACHE_SERVICE_KEY, pool, cache);
}; s_log.debug("Static initalizer finished.");
}
public static Element getRSSElement(String location) { public static Element getRSSElement(String location) {
s_log.debug("getRSSElement from " + location); s_log.debug("getRSSElement from " + location);
@ -115,13 +113,9 @@ public class RSSFeedPortletHelper {
protected static class ItemExtractor extends DefaultHandler { protected static class ItemExtractor extends DefaultHandler {
private List m_items; private List m_items;
private boolean m_item; private boolean m_item;
private String m_url; private String m_url;
private String m_title; private String m_title;
private StringBuffer m_scratch; private StringBuffer m_scratch;
public ItemExtractor(List items) { public ItemExtractor(List items) {
@ -158,7 +152,7 @@ public class RSSFeedPortletHelper {
} else if (qn.equals("link")) { } else if (qn.equals("link")) {
m_url = m_scratch.toString(); m_url = m_scratch.toString();
} else if (qn.equals("item")) { } else if (qn.equals("item")) {
m_items.add(new String[] { m_url, m_title }); m_items.add(new String[]{m_url, m_title});
m_item = false; m_item = false;
} }
} }

View File

@ -16,6 +16,7 @@
package com.arsdigita.london.portal.ui; package com.arsdigita.london.portal.ui;
import com.arsdigita.bebop.Image; import com.arsdigita.bebop.Image;
import org.apache.log4j.Logger;
/** /**
* This class contains Images for the various CW icons. These image * This class contains Images for the various CW icons. These image
@ -25,6 +26,8 @@ import com.arsdigita.bebop.Image;
**/ **/
public class Icons { public class Icons {
private static final Logger logger = Logger.getLogger(Icons.class);
public static final Image USER_16; public static final Image USER_16;
public static final Image GROUP_16; public static final Image GROUP_16;
public static final Image LEFT_16; public static final Image LEFT_16;
@ -40,6 +43,7 @@ public class Icons {
public static final Image TRASH_16; public static final Image TRASH_16;
static { static {
logger.debug("Static initalizer starting...");
USER_16 = new Image("/packages/workspace/www/assets/User16.gif"); USER_16 = new Image("/packages/workspace/www/assets/User16.gif");
USER_16.setBorder("0"); USER_16.setBorder("0");
USER_16.lock(); USER_16.lock();
@ -97,5 +101,6 @@ public class Icons {
TRASH_16 = new Image("/packages/workspace/www/assets/delete.gif"); TRASH_16 = new Image("/packages/workspace/www/assets/delete.gif");
TRASH_16.setBorder("0"); TRASH_16.setBorder("0");
TRASH_16.lock(); TRASH_16.lock();
logger.debug("Static initalizer finished.");
} }
}; };

View File

@ -125,6 +125,7 @@ abstract class GrantsTable extends Table {
private static TableCellRenderer[] s_viewCellRenderers; private static TableCellRenderer[] s_viewCellRenderers;
static { static {
s_log.debug("Static initalizer starting...");
int n = Grant.s_interestingPrivileges.length; int n = Grant.s_interestingPrivileges.length;
s_editCellRenderers = new TableCellRenderer[n]; s_editCellRenderers = new TableCellRenderer[n];
s_viewCellRenderers = new TableCellRenderer[n]; s_viewCellRenderers = new TableCellRenderer[n];
@ -134,6 +135,7 @@ abstract class GrantsTable extends Table {
s_viewCellRenderers[i] = s_viewCellRenderers[i] =
new ViewPrivilegeCellRenderer(Grant.s_interestingPrivileges[i]); new ViewPrivilegeCellRenderer(Grant.s_interestingPrivileges[i]);
} }
s_log.debug("Static initalizer finished.");
} }
// Per-request label for renderer getComponent calls // Per-request label for renderer getComponent calls

View File

@ -22,6 +22,7 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import org.apache.log4j.Logger;
/** /**
* Base class of the RSS application (module). * Base class of the RSS application (module).
@ -29,14 +30,17 @@ import com.arsdigita.web.Application;
*/ */
public class RSS extends Application { public class RSS extends Application {
private static final Logger logger = Logger.getLogger(RSS.class);
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.london.rss.RSS"; = "com.arsdigita.london.rss.RSS";
private static final RSSConfig s_config = new RSSConfig(); private static final RSSConfig s_config = new RSSConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
/** /**

View File

@ -69,7 +69,9 @@ public class RSSService {
private static final RSSConfig s_config = new RSSConfig(); private static final RSSConfig s_config = new RSSConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
public static RSSConfig getConfig() { public static RSSConfig getConfig() {

View File

@ -22,6 +22,7 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import org.apache.log4j.Logger;
/** /**
* Base class for the search application (module) * Base class for the search application (module)
@ -29,13 +30,16 @@ import com.arsdigita.web.Application;
*/ */
public class Search extends Application { public class Search extends Application {
private static final Logger logger = Logger.getLogger(Search.class);
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.london.search.Search"; = "com.arsdigita.london.search.Search";
private static SearchConfig s_config = new SearchConfig(); private static SearchConfig s_config = new SearchConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static SearchConfig getConfig() { public static SearchConfig getConfig() {

View File

@ -22,6 +22,7 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import org.apache.log4j.Logger;
/** /**
* Base class of the shortcuts application. * Base class of the shortcuts application.
@ -29,13 +30,17 @@ import com.arsdigita.web.Application;
*/ */
public class Shortcuts extends Application { public class Shortcuts extends Application {
private static final Logger logger = Logger.getLogger(Shortcuts.class);
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.london.shortcuts.Shortcuts"; = "com.arsdigita.london.shortcuts.Shortcuts";
private static ShortcutsConfig s_config = new ShortcutsConfig(); private static ShortcutsConfig s_config = new ShortcutsConfig();
static { static {
logger.debug("Static initalizer starting...");
s_config.load(); s_config.load();
logger.debug("Static initalizer finished.");
} }
public static ShortcutsConfig getConfig() { public static ShortcutsConfig getConfig() {

View File

@ -43,7 +43,9 @@ public class Subsite extends Application {
private static final SubsiteConfig s_config = new SubsiteConfig(); private static final SubsiteConfig s_config = new SubsiteConfig();
static { static {
s_log.debug("Static initalizer starting...");
s_config.load(); s_config.load();
s_log.debug("Static initalizer finished.");
} }
private static final SubsiteContext s_context = new SubsiteContext(); private static final SubsiteContext s_context = new SubsiteContext();

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