diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuth.java b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuth.java index b7cb70dfc..7914f746f 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuth.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuth.java @@ -22,6 +22,7 @@ import com.arsdigita.web.Application; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.DataObject; import com.arsdigita.domain.DataObjectNotFoundException; +import org.apache.log4j.Logger; /** @@ -31,10 +32,13 @@ import com.arsdigita.domain.DataObjectNotFoundException; */ public class HTTPAuth extends Application { + private static final Logger logger = Logger.getLogger(HTTPAuth.class); private static HTTPAuthConfig s_config = new HTTPAuthConfig(); static { + logger.debug("Static initalizer starting..."); s_config.load(); + logger.debug("Static initalizer finished."); } public static HTTPAuthConfig getConfig() { diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthConfig.java b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthConfig.java index 6d3c80b0e..9773d5824 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthConfig.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPAuthConfig.java @@ -15,7 +15,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - package com.arsdigita.auth.http; import com.arsdigita.util.parameter.Converters; @@ -43,29 +42,27 @@ import java.io.InputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.FileNotFoundException; - +import org.apache.log4j.Logger; public class HTTPAuthConfig extends AbstractConfig { - - static { - Converters.set(Inet4AddressRange.class, - new Inet4AddressRangeConvertor()); - } + private static final Logger logger = Logger.getLogger(HTTPAuthConfig.class); + + static { + logger.debug("Static initalizer starting..."); + Converters.set(Inet4AddressRange.class, + new Inet4AddressRangeConvertor()); + logger.debug("Static initalizer finished."); + } private BooleanParameter m_isActive; private BooleanParameter m_isDebugMode; - private IntegerParameter m_nonceTTL; - private StringParameter m_serverName; private IntegerParameter m_serverPort; - private Inet4AddressRangeParameter m_clientIPRange; - private StringParameter m_keyAlias; private StringParameter m_keyCypher; private StringParameter m_keyPassword; - private StringParameter m_keystorePassword; private StringParameter m_keystorePath; @@ -90,11 +87,13 @@ public class HTTPAuthConfig extends AbstractConfig { // XXX bz108251 //Parameter.REQUIRED, null); - m_serverPort = new IntegerParameter("com.arsdigita.auth.http.server_port", + m_serverPort = new IntegerParameter( + "com.arsdigita.auth.http.server_port", Parameter.OPTIONAL, 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, // XXX bz108251 //Parameter.REQUIRED, @@ -106,19 +105,22 @@ public class HTTPAuthConfig extends AbstractConfig { m_keyCypher = new StringParameter("com.arsdigita.auth.http.key_cypher", Parameter.OPTIONAL, "RSA"); - m_keyPassword = new StringParameter("com.arsdigita.auth.http.key_password", + m_keyPassword = new StringParameter( + "com.arsdigita.auth.http.key_password", Parameter.OPTIONAL, // XXX bz108251 //Parameter.REQUIRED, null); - m_keystorePassword = new StringParameter("com.arsdigita.auth.http.keystore_password", + m_keystorePassword = new StringParameter( + "com.arsdigita.auth.http.keystore_password", Parameter.OPTIONAL, // XXX bz108251 //Parameter.REQUIRED, null); - m_keystorePath = new StringParameter("com.arsdigita.auth.http.keystore_path", + m_keystorePath = new StringParameter( + "com.arsdigita.auth.http.keystore_path", Parameter.OPTIONAL, // XXX bz108251 //Parameter.REQUIRED, @@ -153,44 +155,43 @@ public class HTTPAuthConfig extends AbstractConfig { } public final int getNonceTTL() { - return ((Integer)get(m_nonceTTL)).intValue(); + return ((Integer) get(m_nonceTTL)).intValue(); } - + public final String getServerName() { - return (String)get(m_serverName); + return (String) get(m_serverName); } public final int getServerPort() { - return ((Integer)get(m_serverPort)).intValue(); + return ((Integer) get(m_serverPort)).intValue(); } public final Inet4AddressRange getClientIPRange() { - return (Inet4AddressRange)get(m_clientIPRange); + return (Inet4AddressRange) get(m_clientIPRange); } public final String getKeyAlias() { - return (String)get(m_keyAlias); + return (String) get(m_keyAlias); } public final String getKeyCypher() { - return (String)get(m_keyCypher); + return (String) get(m_keyCypher); } public final String getKeyPassword() { - return (String)get(m_keyPassword); + return (String) get(m_keyPassword); } public final String getKeyStorePassword() { - return (String)get(m_keystorePassword); + return (String) get(m_keystorePassword); } - + // Package protected, since we won't neccessarily always // store the keystore in a file on disk final String getKeyStorePath() { return (String) get(m_keystorePath); } - public final InputStream getKeyStoreStream() { String file = getKeyStorePath(); @@ -200,12 +201,12 @@ public class HTTPAuthConfig extends AbstractConfig { is = new FileInputStream(file); } catch (FileNotFoundException ex) { throw new UncheckedWrapperException( - "cannot read keystore file " + file, ex); + "cannot read keystore file " + file, ex); } - + return is; } - + public final KeyStore getKeyStore() { InputStream is = getKeyStoreStream(); KeyStore store = null; @@ -215,23 +216,22 @@ public class HTTPAuthConfig extends AbstractConfig { store = KeyStore.getInstance("JKS"); } catch (KeyStoreException ex) { throw new UncheckedWrapperException( - "cannot get keystore instance JKS", ex); + "cannot get keystore instance JKS", ex); } - + try { store.load(is, getKeyStorePassword().toCharArray()); } catch (IOException ex) { throw new UncheckedWrapperException( - "cannot load keystore from " + - getKeyStorePath(), ex); + "cannot load keystore from " + getKeyStorePath(), ex); } catch (CertificateException ex) { throw new UncheckedWrapperException( - "cannot load keystore certificates from " + - getKeyStorePath(), ex); + "cannot load keystore certificates from " + + getKeyStorePath(), ex); } catch (NoSuchAlgorithmException ex) { throw new UncheckedWrapperException( - "cannot check integrity of keystore " + - getKeyStorePath(), ex); + "cannot check integrity of keystore " + getKeyStorePath(), + ex); } return store; } @@ -244,12 +244,12 @@ public class HTTPAuthConfig extends AbstractConfig { cert = keystore.getCertificate(getKeyAlias()); } catch (KeyStoreException ex) { throw new UncheckedWrapperException( - "cannot get public key from keystore " + - getKeyStorePath(), ex); - } + "cannot get public key from keystore " + getKeyStorePath(), + ex); + } Assert.exists(cert, Certificate.class); - + return cert.getPublicKey(); } @@ -258,44 +258,45 @@ public class HTTPAuthConfig extends AbstractConfig { Key key = null; try { - key = keystore.getKey(getKeyAlias(), + key = keystore.getKey(getKeyAlias(), getKeyPassword().toCharArray()); } catch (KeyStoreException ex) { throw new UncheckedWrapperException( - "cannot get private key from keystore " + - getKeyStorePath(), ex); + "cannot get private key from keystore " + getKeyStorePath(), + ex); } catch (NoSuchAlgorithmException ex) { throw new UncheckedWrapperException( - "cannot get private key from keystore " + - getKeyStorePath(), ex); + "cannot get private key from keystore " + getKeyStorePath(), + ex); } catch (UnrecoverableKeyException ex) { throw new UncheckedWrapperException( - "cannot get private key from keystore " + - getKeyStorePath(), ex); - } + "cannot get private key from keystore " + getKeyStorePath(), + ex); + } Assert.exists(key, Key.class); - - return (PrivateKey)key; + + return (PrivateKey) key; } private static class Inet4AddressRangeConvertor implements Converter { + public Object convert(Class type, Object value) { - return Inet4AddressRange.getByName((String)value); + return Inet4AddressRange.getByName((String) value); } } private static class Inet4AddressRangeParameter extends AbstractParameter { + public Inet4AddressRangeParameter(final String name) { super(name, Inet4AddressRange.class); } - + public Inet4AddressRangeParameter(final String name, - final int multiplicity, - final Object defaalt) { + final int multiplicity, + final Object defaalt) { super(name, multiplicity, defaalt, Inet4AddressRange.class); } - } } diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPLoginModule.java b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPLoginModule.java index ec0586e32..f6347aac4 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/HTTPLoginModule.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/HTTPLoginModule.java @@ -135,6 +135,7 @@ public class HTTPLoginModule extends MappingLoginModule { private static PublicKey s_publicKey = null; static { + s_log.debug("Static initalizer starting..."); if (HTTPAuth.getConfig().isActive()) { if (s_log.isDebugEnabled()) { 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.debug("Static initalizer finished."); } private static BASE64Decoder s_base64Decoder = new BASE64Decoder(); diff --git a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java index 955d44831..bba6e0691 100755 --- a/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java +++ b/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachment.java @@ -50,7 +50,9 @@ public class FileAttachment extends FileAsset { private static final FileAttachmentConfig s_config = new FileAttachmentConfig(); static { + s_log.debug("Static initalizer starting..."); s_config.load(); + s_log.debug("Static initalizer finished."); } diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ItemImageAttachment.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ItemImageAttachment.java index c28d574f3..08236efa9 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ItemImageAttachment.java +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ItemImageAttachment.java @@ -15,7 +15,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - package com.arsdigita.cms.contentassets; import com.arsdigita.cms.ContentItem; @@ -42,28 +41,28 @@ import org.apache.log4j.Logger; public class ItemImageAttachment extends ACSObject implements CustomCopy { /** PDL property name for contact details */ - public static final String IMAGE = "image"; - public static final String ITEM = "item"; - public static final String USE_CONTEXT = "useContext"; - public static final String CAPTION = "caption"; - public static final String DESCRIPTION = "description"; - public static final String TITLE = "title"; + public static final String IMAGE = "image"; + public static final String ITEM = "item"; + public static final String USE_CONTEXT = "useContext"; + public static final String CAPTION = "caption"; + public static final String DESCRIPTION = "description"; + public static final String TITLE = "title"; 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"; - /** Data object type for this domain object */ - public static final String BASE_DATA_OBJECT_TYPE - = "com.arsdigita.cms.contentassets.ItemImageAttachment"; + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contentassets.ItemImageAttachment"; + private static final Logger s_log = Logger.getLogger( + ItemImageAttachment.class); + private static final ItemImageAttachmentConfig s_config = + new ItemImageAttachmentConfig(); - private static final Logger s_log - = Logger.getLogger(ItemImageAttachment.class); - - private static final ItemImageAttachmentConfig s_config = new ItemImageAttachmentConfig(); - - static { - s_config.load(); - } + static { + s_log.debug("Static initalizer starting..."); + s_config.load(); + s_log.debug("Static initalizer finished."); + } private ItemImageAttachment() { this(BASE_DATA_OBJECT_TYPE); @@ -81,57 +80,60 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy { return BASE_DATA_OBJECT_TYPE; } - public ItemImageAttachment( ContentItem item, ReusableImageAsset image ) { + public ItemImageAttachment(ContentItem item, ReusableImageAsset image) { this(); - set( ITEM, item ); - set( IMAGE, image ); + set(ITEM, item); + set(IMAGE, image); } - public static ItemImageAttachment retrieve( OID oid ) { - return (ItemImageAttachment) DomainObjectFactory.newInstance( oid ); + public static ItemImageAttachment retrieve(OID oid) { + return (ItemImageAttachment) DomainObjectFactory.newInstance(oid); + } + + public static ItemImageAttachmentConfig getConfig() { + return s_config; } - public static ItemImageAttachmentConfig getConfig() { - return s_config; - } public ReusableImageAsset getImage() { - if( s_log.isDebugEnabled() ) - s_log.debug( "Getting image for " + getOID() ); + if (s_log.isDebugEnabled()) { + s_log.debug("Getting image for " + getOID()); + } - DataObject dobj = (DataObject) get( IMAGE ); - Assert.exists( dobj ); + DataObject dobj = (DataObject) get(IMAGE); + Assert.exists(dobj); - return (ReusableImageAsset) DomainObjectFactory.newInstance( dobj ); + return (ReusableImageAsset) DomainObjectFactory.newInstance(dobj); } - public void setImage( ReusableImageAsset image ) { - Assert.exists( image, ReusableImageAsset.class ); - set( IMAGE, image ); + public void setImage(ReusableImageAsset image) { + Assert.exists(image, ReusableImageAsset.class); + set(IMAGE, image); } public ContentItem getItem() { - DataObject dobj = (DataObject) get( ITEM ); - Assert.exists( dobj ); + DataObject dobj = (DataObject) get(ITEM); + Assert.exists(dobj); - return (ContentItem) DomainObjectFactory.newInstance( dobj ); + return (ContentItem) DomainObjectFactory.newInstance(dobj); } - public void setItem( ContentItem item ) { - Assert.exists( item, ContentItem.class ); - set( ITEM, item ); + public void setItem(ContentItem item) { + Assert.exists(item, ContentItem.class); + set(ITEM, item); } /** Retrieves links for a content item */ - public static DataCollection getImageAttachments( ContentItem item ) { - Assert.exists( item, ContentItem.class ); + public static DataCollection getImageAttachments(ContentItem item) { + Assert.exists(item, ContentItem.class); - if( s_log.isDebugEnabled() ) - s_log.debug("Getting attachments for " + item.getOID() ); + if (s_log.isDebugEnabled()) { + s_log.debug("Getting attachments for " + item.getOID()); + } - DataCollection attachments = SessionManager.getSession().retrieve - ( BASE_DATA_OBJECT_TYPE ); - attachments.addEqualsFilter( ITEM + ".id", item.getID() ); + DataCollection attachments = SessionManager.getSession().retrieve( + BASE_DATA_OBJECT_TYPE); + attachments.addEqualsFilter(ITEM + ".id", item.getID()); return attachments; } @@ -144,52 +146,50 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy { return (String) get(USE_CONTEXT); } - public void setCaption( String caption ) { - set( CAPTION, caption ); + public void setCaption(String caption) { + set(CAPTION, caption); } public String getCaption() { - return (String) get( CAPTION ); + return (String) get(CAPTION); } - public void setTitle( String title ) { - set( TITLE, title ); - } + public void setTitle(String title) { + set(TITLE, title); + } - public String getTitle() { - return (String) get( TITLE ); - } - - public void setDescription( String description) { - set( DESCRIPTION, description ); - } + public String getTitle() { + return (String) get(TITLE); + } - public String getDescription() { - return (String) get( DESCRIPTION ); - } + public void setDescription(String description) { + set(DESCRIPTION, description); + } + public String getDescription() { + return (String) get(DESCRIPTION); + } /** * Automatically publish an unpublished image */ - public boolean copyProperty( final CustomCopy source, - final Property property, - final ItemCopier copier ) { + public boolean copyProperty(final CustomCopy source, + final Property property, + final ItemCopier copier) { String attribute = property.getName(); - if( ItemCopier.VERSION_COPY == copier.getCopyType() && - IMAGE.equals( attribute ) ) - { + if (ItemCopier.VERSION_COPY == copier.getCopyType() && IMAGE.equals( + attribute)) { ItemImageAttachment attachment = (ItemImageAttachment) source; ReusableImageAsset image = attachment.getImage(); ReusableImageAsset liveImage = - (ReusableImageAsset) image.getLiveVersion(); + (ReusableImageAsset) image.getLiveVersion(); - if( null == liveImage ) { + if (null == liveImage) { liveImage = (ReusableImageAsset) image.createLiveVersion(); } - setImage( liveImage ); + setImage(liveImage); return true; } @@ -197,31 +197,30 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy { } // chris gilbert - optional link + public Link getLink() { + Link link = null; + DataObject dobj = (DataObject) get(IMAGE_LINK); + if (dobj != null) { - public Link getLink() { - Link link = null; - DataObject dobj = (DataObject) get( IMAGE_LINK ); - if (dobj != null) { + link = (Link) DomainObjectFactory.newInstance(dobj); + } + return link; + } - link = (Link) DomainObjectFactory.newInstance( dobj ); - } - return link; - } + public void setLink(Link link) { + Assert.exists(link, Link.class); + set(IMAGE_LINK, link); + } - public void setLink( Link link ) { - Assert.exists( link, Link.class ); - set( IMAGE_LINK, link ); - } - - public void removeLink() { - // 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 - // link. Have to set link to null first (I think) - DomainObject link = DomainObjectFactory.newInstance((DataObject)get(IMAGE_LINK)); - set (IMAGE_LINK, null); - save(); - link.delete(); - - } + public void removeLink() { + // 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 + // link. Have to set link to null first (I think) + DomainObject link = DomainObjectFactory.newInstance((DataObject) get( + IMAGE_LINK)); + set(IMAGE_LINK, null); + save(); + link.delete(); + } } diff --git a/ccm-cms-assets-notes/src/com/arsdigita/cms/contentassets/Note.java b/ccm-cms-assets-notes/src/com/arsdigita/cms/contentassets/Note.java index 4480796a2..7671dde43 100755 --- a/ccm-cms-assets-notes/src/com/arsdigita/cms/contentassets/Note.java +++ b/ccm-cms-assets-notes/src/com/arsdigita/cms/contentassets/Note.java @@ -45,6 +45,7 @@ public class Note extends ACSObject { private static final Logger s_log = Logger.getLogger( Note.class ); static { + s_log.debug("Static initalizer is starting..."); DomainObjectFactory.registerInstantiator( BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() { @@ -58,6 +59,8 @@ public class Note extends ACSObject { } } ); + + s_log.debug("Static initalizer finished."); } public static final String CONTENT = "content"; diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertyForm.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertyForm.java index 97d038266..53672c017 100755 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertyForm.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/ui/RelatedLinkPropertyForm.java @@ -49,13 +49,9 @@ import com.arsdigita.util.Assert; */ public class RelatedLinkPropertyForm extends LinkPropertyForm { - private static boolean isHideAdditionalResourceFields; + private static boolean isHideAdditionalResourceFields = ContentSection.getConfig().isHideAdditionalResourceFields(); private String m_linkListName = ""; - - static { - isHideAdditionalResourceFields = ContentSection.getConfig().isHideAdditionalResourceFields(); - } - + /** * Creates a new form to edit the RelatedLink object specified * by the item selection model passed in. diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/Event.java b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/Event.java index f22de73e5..fafd3ebf5 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/Event.java +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/Event.java @@ -95,7 +95,9 @@ public class Event extends GenericArticle { private static final EventConfig s_config = new EventConfig(); static { + s_log.debug("Static initalizer starting..."); s_config.load(); + s_log.debug("Static initalizer finished."); } public static final EventConfig getConfig() { diff --git a/ccm-cms-types-glossaryitem/src/com/arsdigita/cms/contenttypes/GlossaryItem.java b/ccm-cms-types-glossaryitem/src/com/arsdigita/cms/contenttypes/GlossaryItem.java index 63edb2da3..3bb2507d0 100755 --- a/ccm-cms-types-glossaryitem/src/com/arsdigita/cms/contenttypes/GlossaryItem.java +++ b/ccm-cms-types-glossaryitem/src/com/arsdigita/cms/contenttypes/GlossaryItem.java @@ -24,10 +24,8 @@ import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentPage; import com.arsdigita.util.Assert; - import java.math.BigDecimal; - - +import org.apache.log4j.Logger; /** * This content type represents a GlossaryItem. @@ -36,62 +34,63 @@ import java.math.BigDecimal; */ public class GlossaryItem extends ContentPage { + private static final Logger logger = Logger.getLogger(GlossaryItem.class); /** PDL property name for definition */ public static final String DEFINITION = "definition"; - /** Data object type for this domain object */ - public static final String BASE_DATA_OBJECT_TYPE - = "com.arsdigita.cms.contenttypes.GlossaryItem"; - + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contenttypes.GlossaryItem"; private static GlossaryItemConfig config = new GlossaryItemConfig(); + static { - config.load(); + logger.debug("Static initalizer starting..."); + config.load(); + logger.debug("Static initalizer finished."); } + public static GlossaryItemConfig getConfig() { - return config; + return config; } public GlossaryItem() { - this( BASE_DATA_OBJECT_TYPE ); + this(BASE_DATA_OBJECT_TYPE); } - public GlossaryItem( BigDecimal id ) - throws DataObjectNotFoundException { - this( new OID( BASE_DATA_OBJECT_TYPE, id ) ); + public GlossaryItem(BigDecimal id) + throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); } - public GlossaryItem( OID id ) - throws DataObjectNotFoundException { - super( id ); + public GlossaryItem(OID id) + throws DataObjectNotFoundException { + super(id); } - public GlossaryItem( DataObject obj ) { - super( obj ); + public GlossaryItem(DataObject obj) { + super(obj); } - public GlossaryItem( String type ) { - super( type ); + public GlossaryItem(String type) { + super(type); } - public void beforeSave() { super.beforeSave(); - + Assert.exists(getContentType(), ContentType.class); } /* accessors *****************************************************/ public String getDefinition() { - return (String) get( DEFINITION ); + return (String) get(DEFINITION); } - public void setDefinition( String definition ) { - set( DEFINITION, definition ); + public void setDefinition(String definition) { + set(DEFINITION, definition); } // Search stuff to allow the content type to be searchable public String getSearchSummary() { return getDefinition(); } - } diff --git a/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/HealthCareFacility.java b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/HealthCareFacility.java index 1f78ec9af..d978e2748 100644 --- a/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/HealthCareFacility.java +++ b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/HealthCareFacility.java @@ -62,7 +62,9 @@ public class HealthCareFacility extends GenericOrganization { * Called when the class is loaded by the Java class loader. */ static { + s_log.debug("Static initalizer starting..."); s_config.load(); + s_log.debug("Static initalizer finished."); } /** diff --git a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/MultiPartArticle.java b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/MultiPartArticle.java index c623f4b13..5add8f1d0 100755 --- a/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/MultiPartArticle.java +++ b/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/MultiPartArticle.java @@ -64,7 +64,9 @@ public class MultiPartArticle extends ContentPage { private static MultiPartArticleConfig s_config = new MultiPartArticleConfig(); static { + s_log.debug("Static initalizer starting..."); s_config.load(); + s_log.debug("Static initalizer finished."); } public static MultiPartArticleConfig getConfig() { diff --git a/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java b/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java index 34c3dafb8..6f2b18a1b 100755 --- a/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java +++ b/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java @@ -28,6 +28,7 @@ import com.arsdigita.util.Assert; import java.math.BigDecimal; import java.text.DateFormat; import java.util.Date; +import org.apache.log4j.Logger; /** *
DomainObject class to represent news item ContentType
@@ -57,6 +58,7 @@ import java.util.Date;
**/
public class NewsItem extends GenericArticle {
+ private static final Logger logger = Logger.getLogger(NewsItem.class);
/** PDL property name for lead */
public static final String LEAD = "lead";
/** PDL property name for news date */
@@ -69,7 +71,9 @@ public class NewsItem extends GenericArticle {
private static final NewsItemConfig s_config = new NewsItemConfig();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public static final NewsItemConfig getConfig() {
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java
index 502975fe4..d6a805380 100755
--- a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java
@@ -18,7 +18,6 @@
*/
package com.arsdigita.cms.contenttypes;
-
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.domain.DataObjectNotFoundException;
@@ -42,6 +41,7 @@ import java.math.BigDecimal;
**/
public class SimpleAddress extends ContentPage {
+ private static final Logger logger = Logger.getLogger(SimpleAddress.class);
/** PDL property name for address */
public static final String ADDRESS = "address";
/** PDL property name for country iso code */
@@ -60,18 +60,20 @@ public class SimpleAddress extends ContentPage {
public static final String NOTES = "notes";
/** PDL property name for URI*/
public static final String URI = "uri";
-
/** Data object type for this domain object */
- public static final String BASE_DATA_OBJECT_TYPE
- = "com.arsdigita.cms.contenttypes.Address";
+ public static final String BASE_DATA_OBJECT_TYPE =
+ "com.arsdigita.cms.contenttypes.Address";
+ private static final SimpleAddressConfig s_config =
+ new SimpleAddressConfig();
- private static final SimpleAddressConfig s_config = new SimpleAddressConfig();
static {
- s_config.load();
+ logger.debug("Static initalizer starting...");
+ s_config.load();
+ logger.debug("Static initalizer finisheds. .");
}
- public static final SimpleAddressConfig getConfig()
- {
- return s_config;
+
+ public static final SimpleAddressConfig getConfig() {
+ return s_config;
}
/**
@@ -134,97 +136,96 @@ public class SimpleAddress extends ContentPage {
*/
public void beforeSave() {
super.beforeSave();
-
+
Assert.exists(getContentType(), ContentType.class);
}
/* accessors *****************************************************/
- public String getAddress( ) {
- return ( String ) get( ADDRESS );
+ public String getAddress() {
+ return (String) get(ADDRESS);
}
- public void setAddress( String address ) {
- set( ADDRESS, address );
+ public void setAddress(String address) {
+ set(ADDRESS, address);
}
- public String getCountryIsoCode( ) {
- DataObject obj = ( DataObject ) get( ISO_COUNTRY_CODE );
- if ( obj != null ) {
- IsoCountry country = new IsoCountry( obj );
- return country.getIsoCode( );
+ public String getCountryIsoCode() {
+ DataObject obj = (DataObject) get(ISO_COUNTRY_CODE);
+ if (obj != null) {
+ IsoCountry country = new IsoCountry(obj);
+ return country.getIsoCode();
}
return null;
}
- public void setCountryIsoCode( String isoCode ) {
+ public void setCountryIsoCode(String isoCode) {
IsoCountry assn = null;
try {
- OID oid = new OID( IsoCountry.BASE_DATA_OBJECT_TYPE );
- oid.set( IsoCountry.ISO_CODE, isoCode );
+ OID oid = new OID(IsoCountry.BASE_DATA_OBJECT_TYPE);
+ oid.set(IsoCountry.ISO_CODE, isoCode);
- assn = new IsoCountry( oid );
+ assn = new IsoCountry(oid);
} catch (DataObjectNotFoundException e) {
- assn = new IsoCountry( );
- assn.setIsoCode( isoCode );
+ assn = new IsoCountry();
+ assn.setIsoCode(isoCode);
assn.save();
}
- setAssociation( ISO_COUNTRY_CODE, assn );
+ setAssociation(ISO_COUNTRY_CODE, assn);
}
- public String getPostalCode( ) {
- return ( String ) get( POSTAL_CODE );
+ public String getPostalCode() {
+ return (String) get(POSTAL_CODE);
}
- public void setPostalCode( String postalCode ) {
- set( POSTAL_CODE, postalCode );
+ public void setPostalCode(String postalCode) {
+ set(POSTAL_CODE, postalCode);
}
- public String getPhone( ) {
- return ( String ) get( PHONE );
+ public String getPhone() {
+ return (String) get(PHONE);
}
- public void setPhone( String phone ) {
- set( PHONE, phone );
+ public void setPhone(String phone) {
+ set(PHONE, phone);
}
- public String getMobile( ) {
- return ( String ) get( MOBILE );
+ public String getMobile() {
+ return (String) get(MOBILE);
}
- public void setMobile( String mobile ) {
- set( MOBILE, mobile );
+ public void setMobile(String mobile) {
+ set(MOBILE, mobile);
}
- public String getFax( ) {
- return ( String ) get( FAX );
+ public String getFax() {
+ return (String) get(FAX);
}
- public void setFax( String fax ) {
- set( FAX, fax );
+ public void setFax(String fax) {
+ set(FAX, fax);
}
- public String getEmail( ) {
- return ( String ) get( EMAIL );
+ public String getEmail() {
+ return (String) get(EMAIL);
}
- public void setEmail( String email ) {
- set( EMAIL, email );
+ public void setEmail(String email) {
+ set(EMAIL, email);
}
- public String getNotes( ) {
- return ( String ) get( NOTES );
+ public String getNotes() {
+ return (String) get(NOTES);
}
- public void setNotes( String notes ) {
- set( NOTES, notes );
+ public void setNotes(String notes) {
+ set(NOTES, notes);
}
- public void setURI( String uri) {
+ public void setURI(String uri) {
set(URI, uri);
}
public String getURI() {
- return (String)get(URI);
+ return (String) get(URI);
}
-
}
diff --git a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java
index 0fcb47ab4..e2a7fcb88 100755
--- a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java
+++ b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java
@@ -62,7 +62,9 @@ public class SiteProxyPanel extends ContentPanel {
private static URLPool s_pool = new URLPool();
static {
+ s_log.debug("Static initalizer starting...");
URLFetcher.registerService(s_cacheServiceKey, s_pool, s_cache);
+ s_log.debug("Static initalizer finished.");
};
public SiteProxyPanel() {
diff --git a/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/Survey.java b/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/Survey.java
index 6e9fbbd4d..c25eed738 100755
--- a/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/Survey.java
+++ b/ccm-cms-types-survey/src/com/arsdigita/cms/contenttypes/Survey.java
@@ -20,6 +20,7 @@ import com.arsdigita.kernel.User;
import com.arsdigita.persistence.metadata.Property;
import com.arsdigita.xml.Element;
import java.util.Date;
+import org.apache.log4j.Logger;
/**
* 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";
/* Config */
private static final SurveyConfig s_config = new SurveyConfig();
+ /* Logger to debug to static initializer */
+ private static final Logger logger = Logger.getLogger(Survey.class);
static {
+ logger.debug("Static initializer starting...");
s_config.load();
+ logger.debug("Static initializer finished.");
}
public static final SurveyConfig getConfig() {
diff --git a/ccm-cms/src/com/arsdigita/cms/CMS.java b/ccm-cms/src/com/arsdigita/cms/CMS.java
index 1dd164e93..4e7c555a4 100755
--- a/ccm-cms/src/com/arsdigita/cms/CMS.java
+++ b/ccm-cms/src/com/arsdigita/cms/CMS.java
@@ -60,7 +60,9 @@ public abstract class CMS {
};
private static final CMSConfig s_config = new CMSConfig();
static {
+ s_log.debug("Static initializer starting...");
s_config.load();
+ s_log.debug("Static initializer finished.");
}
diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSection.java b/ccm-cms/src/com/arsdigita/cms/ContentSection.java
index 2e059cc74..88d0fe0b7 100755
--- a/ccm-cms/src/com/arsdigita/cms/ContentSection.java
+++ b/ccm-cms/src/com/arsdigita/cms/ContentSection.java
@@ -125,7 +125,9 @@ public class ContentSection extends Application {
private static final CMSConfig s_config = new CMSConfig();
static {
+ s_log.debug("Static initializer starting...");
s_config.load();
+ s_log.debug("Static initializer finished...");
}
// Cached properties
PageResolver m_pageResolver = null;
diff --git a/ccm-cms/src/com/arsdigita/cms/Template.java b/ccm-cms/src/com/arsdigita/cms/Template.java
index d320f64dd..ea5056e13 100755
--- a/ccm-cms/src/com/arsdigita/cms/Template.java
+++ b/ccm-cms/src/com/arsdigita/cms/Template.java
@@ -63,10 +63,12 @@ public class Template extends TextAsset {
public static final Map SUPPORTED_MIME_TYPES = new HashMap();
static {
+ s_log.debug("Static initalizer is starting...");
SUPPORTED_MIME_TYPES.put(JSP_MIME_TYPE,
GlobalizationUtil.globalize("mime_type_jsp"));
SUPPORTED_MIME_TYPES.put(XSL_MIME_TYPE,
GlobalizationUtil.globalize("mime_type_xsl"));
+ s_log.debug("Static initalizer finished.");
}
/**
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericAddress.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericAddress.java
index 5f721e19c..59b647754 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericAddress.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericAddress.java
@@ -18,7 +18,6 @@
*/
package com.arsdigita.cms.contenttypes;
-
import com.arsdigita.globalization.LocaleNegotiator;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentPage;
@@ -29,6 +28,7 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal;
import java.util.Locale;
import java.util.TreeMap;
+import org.apache.log4j.Logger;
/**
*
@@ -40,15 +41,18 @@ import javax.servlet.http.HttpServletRequest;
*/
public class CharsetEncodingProvider implements ParameterProvider {
+ private static final Logger logger = Logger.getLogger(CharsetEncodingProvider.class);
private static StringParameter s_encodingParam =
new StringParameter(Globalization.ENCODING_PARAM_NAME);
private static Set s_models = new HashSet();
static {
+ logger.debug("Static initalizer starting...");
s_encodingParam.setDefaultValue(Globalization.DEFAULT_ENCODING);
s_encodingParam.setDefaultOverridesNull(true);
s_models.add(s_encodingParam);
+ logger.debug("Static initalizer finished...");
}
public Set getModels() {
diff --git a/ccm-core/src/com/arsdigita/util/ConcurrentDict.java b/ccm-core/src/com/arsdigita/util/ConcurrentDict.java
index 646a162ed..28159650f 100755
--- a/ccm-core/src/com/arsdigita/util/ConcurrentDict.java
+++ b/ccm-core/src/com/arsdigita/util/ConcurrentDict.java
@@ -23,6 +23,7 @@ import java.text.NumberFormat;
import java.util.Arrays;
import java.util.HashMap;
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 $
**/
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
// construction time. Hardcoding it is good enough for now.
private static final int N_BUCKETS = 64;
@@ -59,9 +61,11 @@ public final class ConcurrentDict {
private static final Map[] BUCKETS = new Map[N_BUCKETS];
static {
+ logger.debug("Static initalizer starting...");
for (int ii=0; ii
@@ -66,6 +67,7 @@ import java.math.BigDecimal;
*/
public class SciDepartment extends GenericOrganizationalUnit {
+ private static final Logger logger = Logger.getLogger(SciDepartment.class);
public static final String DEPARTMENT_SHORT_DESCRIPTION =
"departmentShortDescription";
public static final String DEPARTMENT_DESCRIPTION = "departmentDescription";
@@ -81,7 +83,9 @@ public class SciDepartment extends GenericOrganizationalUnit {
new SciOrganizationConfig();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public SciDepartment() {
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java
index 384f1f65b..35411356b 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java
@@ -23,6 +23,7 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import java.math.BigDecimal;
+import org.apache.log4j.Logger;
/**
* A concrete class extending {@link GenericPerson}. Does not add any new
@@ -32,14 +33,17 @@ import java.math.BigDecimal;
* @author Jens Pelzetter
*/
public class SciMember extends GenericPerson {
-
+
+ private static final Logger logger = Logger.getLogger(SciMember.class);
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.SciMember";
private static final SciOrganizationConfig s_config =
new SciOrganizationConfig();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer starting...");
}
public SciMember() {
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
index 3aad68a65..a8216abd1 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
@@ -25,6 +25,7 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;
+import org.apache.log4j.Logger;
/**
*
@@ -56,10 +57,11 @@ import java.math.BigDecimal;
* @author Jens Pelzetter
* @see GenericOrganizationalUnit
* @see SciDepartment
- * @see SciProject^
+ * @see SciProject
*/
public class SciOrganization extends GenericOrganizationalUnit {
+ private static final Logger logger = Logger.getLogger(SciOrganization.class);
public static final String ORGANIZATION_SHORT_DESCRIPTION =
"organizationShortDescription";
public static final String ORGANIZATION_DESCRIPTION =
@@ -74,7 +76,9 @@ public class SciOrganization extends GenericOrganizationalUnit {
new SciOrganizationConfig();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public SciOrganization() {
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
index 56fe97ba6..e47797d11 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
@@ -84,7 +84,9 @@ public class SciProject extends GenericOrganizationalUnit {
private static final Logger logger = Logger.getLogger(SciProject.class);
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public SciProject() {
diff --git a/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java b/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
index 7d31607f7..56da85a78 100755
--- a/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
+++ b/ccm-shp-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
@@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
package com.arsdigita.aplaws;
import com.arsdigita.xml.Element;
@@ -26,18 +25,16 @@ import com.arsdigita.persistence.metadata.Property;
import java.util.HashMap;
import java.util.Stack;
import java.math.BigDecimal;
+import org.apache.log4j.Logger;
public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
+ private static final Logger logger = Logger.getLogger(ObjectTypeSchemaGenerator.class);
private boolean m_wrapRoot = false;
private boolean m_wrapObjects = false;
private boolean m_wrapAttributes = false;
-
-
-
private Stack m_history = new Stack();
private HashMap m_elements = new HashMap();
-
// The xs:element
private Element m_element;
// The (optional) xs:complexType
@@ -47,41 +44,39 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// The (optional property
private Property m_property;
private Stack m_properties = new Stack();
-
private Element m_root;
private String m_rootName;
-
public static final String SCHEMA_PREFIX = "xs:";
-
- public static final String SCHEMA_NS =
- "http://www.w3.org/2001/XMLSchema";
-
+ public static final String SCHEMA_NS =
+ "http://www.w3.org/2001/XMLSchema";
private static HashMap s_types = new HashMap();
+
static {
+ logger.debug("Static initalizer starting...");
s_types.put(String.class, "xs:string");
s_types.put(Boolean.class, "xs:boolean");
s_types.put(Integer.class, "xs:integer");
s_types.put(BigDecimal.class, "xs:double");
+ logger.debug("Static initalizer finished.");
}
protected static String lookupType(Class klass) {
if (s_types.containsKey(klass)) {
- return (String)s_types.get(klass);
+ return (String) s_types.get(klass);
}
return "xs:string";
}
-
+
public static void registerType(Class klass, String type) {
s_types.put(klass, type);
}
-
public ObjectTypeSchemaGenerator(String rootName,
String namespace) {
m_root = new Element(SCHEMA_PREFIX + "schema",
SCHEMA_NS);
m_rootName = rootName;
-
+
// Set the namespace for nodes defined by the schema
m_root.addAttribute("targetNamespace", namespace);
// Set the default namespace for unqualified nodes
@@ -95,7 +90,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
return m_root;
}
-
/**
* Determines XML output for root object.
* If set to true a separate element will
@@ -143,20 +137,23 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
m_sequence = sequence;
}
-
+
Element parent;
String name;
if (m_element == null) {
if (m_wrapRoot) {
- Element element = m_root.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_root.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", m_rootName);
-
- Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
+
+ Element type = element.newChildElement(SCHEMA_PREFIX
+ + "complexType",
SCHEMA_NS);
- Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
-
+
parent = sequence;
name = nameFromPath(path);
} else {
@@ -186,17 +183,17 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
-
+
Element oid = type.newChildElement(SCHEMA_PREFIX + "attribute",
SCHEMA_NS);
oid.addAttribute("name", "oid");
oid.addAttribute("type", "xs:string");
-
+
// Add to the path -> element map, not that we use this info yet
m_elements.put(path, element);
// 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_type = type;
@@ -209,7 +206,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
*/
protected void endObject(ObjectType obj,
String path) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
@@ -223,7 +220,8 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapAttributes) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
@@ -232,7 +230,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
element.addAttribute("name", property.getName());
// XXX pdl type -> xs type mapping
- element.addAttribute("type",lookupType(property.getJavaClass()));
+ element.addAttribute("type", lookupType(property.getJavaClass()));
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
@@ -240,7 +238,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_sequence.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
} else {
@@ -256,7 +254,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_type.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
}
@@ -271,26 +269,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -307,12 +307,12 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
/**
@@ -324,26 +324,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -360,12 +362,11 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
-
}
diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java b/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java
index 72083845d..cf3dc3e0e 100755
--- a/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java
+++ b/ccm-webpage/src/com/arsdigita/cms/webpage/installer/Initializer.java
@@ -12,7 +12,6 @@
* rights and limitations under the License.
*
*/
-
package com.arsdigita.cms.webpage.installer;
import com.arsdigita.cms.webpage.Webpage;
@@ -55,17 +54,12 @@ import java.util.List;
import com.arsdigita.util.Assert;
import com.arsdigita.db.DbHelper;
-
public class Initializer extends CompoundInitializer {
//public static final String CONTENT_SECTION = "contentSection";
-
- private static Logger s_log = Logger.getLogger
- (Initializer.class.getName());
-
+ private static Logger s_log = Logger.getLogger(Initializer.class.getName());
//private Configuration m_conf = new Configuration();
-
public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(url);
@@ -81,31 +75,29 @@ public class Initializer extends CompoundInitializer {
//public Configuration getConfiguration() {
// return m_conf;
//}
-
-
+ @Override
public void init(DomainInitEvent e) {
super.init(e);
-
- e.getFactory().registerInstantiator
- (Webpage.BASE_DATA_OBJECT_TYPE,
- new ACSObjectInstantiator() {
- public DomainObject doNewInstance(DataObject dataObject) {
- return new Webpage(dataObject);
- }
- });
-
+
+ e.getFactory().registerInstantiator(Webpage.BASE_DATA_OBJECT_TYPE,
+ new ACSObjectInstantiator() {
+
+ @Override
+ public DomainObject doNewInstance(DataObject dataObject) {
+ return new Webpage(dataObject);
+ }
+ });
+
startup();
}
-
-
// ============================================================
-
-
private static final WebpageConfig s_config = new WebpageConfig();
// FR: load the parameter values
static {
+ s_log.debug("Static initalizer starting...");
s_config.load();
+ s_log.debug("Static initalizer finished.");
}
public static WebpageConfig getConfig() {
@@ -121,20 +113,19 @@ public class Initializer extends CompoundInitializer {
config.setContentSection(section);
- TransactionContext txn = SessionManager.getSession()
- .getTransactionContext();
+ TransactionContext txn = SessionManager.getSession().
+ getTransactionContext();
txn.beginTxn();
-
+
loadWebpagePortlet();
txn.commitTxn();
}
-
public void shutdown() {
/* Empty */
}
-
+
private void loadWebpagePortlet() {
PortletSetup setup = new PortletSetup(s_log);
setup.setPortletObjectType(WebpagePortlet.BASE_DATA_OBJECT_TYPE);
@@ -142,6 +133,7 @@ public class Initializer extends CompoundInitializer {
setup.setDescription("Displays a webpage");
setup.setProfile(PortletType.WIDE_PROFILE);
setup.setInstantiator(new ACSObjectInstantiator() {
+
protected DomainObject doNewInstance(DataObject dataObject) {
return new WebpagePortlet(dataObject);
}
@@ -149,23 +141,24 @@ public class Initializer extends CompoundInitializer {
setup.run();
new ResourceTypeConfig(WebpagePortlet.BASE_DATA_OBJECT_TYPE) {
- public ResourceConfigFormSection getCreateFormSection
- (final ResourceType resType, final RequestLocal parentAppRL) {
+
+ public ResourceConfigFormSection getCreateFormSection(
+ final ResourceType resType, final RequestLocal parentAppRL) {
final ResourceConfigFormSection config =
- new WebpagePortletEditor(resType, parentAppRL);
-
+ new WebpagePortletEditor(resType,
+ parentAppRL);
+
return config;
}
-
- public ResourceConfigFormSection getModifyFormSection
- (final RequestLocal application) {
+
+ public ResourceConfigFormSection getModifyFormSection(
+ final RequestLocal application) {
final WebpagePortletEditor config =
- new WebpagePortletEditor(application);
-
+ new WebpagePortletEditor(application);
+
return config;
}
};
}
-
}
diff --git a/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java b/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
index 7d31607f7..56da85a78 100644
--- a/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
+++ b/ccm-zes-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
@@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
package com.arsdigita.aplaws;
import com.arsdigita.xml.Element;
@@ -26,18 +25,16 @@ import com.arsdigita.persistence.metadata.Property;
import java.util.HashMap;
import java.util.Stack;
import java.math.BigDecimal;
+import org.apache.log4j.Logger;
public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
+ private static final Logger logger = Logger.getLogger(ObjectTypeSchemaGenerator.class);
private boolean m_wrapRoot = false;
private boolean m_wrapObjects = false;
private boolean m_wrapAttributes = false;
-
-
-
private Stack m_history = new Stack();
private HashMap m_elements = new HashMap();
-
// The xs:element
private Element m_element;
// The (optional) xs:complexType
@@ -47,41 +44,39 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// The (optional property
private Property m_property;
private Stack m_properties = new Stack();
-
private Element m_root;
private String m_rootName;
-
public static final String SCHEMA_PREFIX = "xs:";
-
- public static final String SCHEMA_NS =
- "http://www.w3.org/2001/XMLSchema";
-
+ public static final String SCHEMA_NS =
+ "http://www.w3.org/2001/XMLSchema";
private static HashMap s_types = new HashMap();
+
static {
+ logger.debug("Static initalizer starting...");
s_types.put(String.class, "xs:string");
s_types.put(Boolean.class, "xs:boolean");
s_types.put(Integer.class, "xs:integer");
s_types.put(BigDecimal.class, "xs:double");
+ logger.debug("Static initalizer finished.");
}
protected static String lookupType(Class klass) {
if (s_types.containsKey(klass)) {
- return (String)s_types.get(klass);
+ return (String) s_types.get(klass);
}
return "xs:string";
}
-
+
public static void registerType(Class klass, String type) {
s_types.put(klass, type);
}
-
public ObjectTypeSchemaGenerator(String rootName,
String namespace) {
m_root = new Element(SCHEMA_PREFIX + "schema",
SCHEMA_NS);
m_rootName = rootName;
-
+
// Set the namespace for nodes defined by the schema
m_root.addAttribute("targetNamespace", namespace);
// Set the default namespace for unqualified nodes
@@ -95,7 +90,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
return m_root;
}
-
/**
* Determines XML output for root object.
* If set to true a separate element will
@@ -143,20 +137,23 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
m_sequence = sequence;
}
-
+
Element parent;
String name;
if (m_element == null) {
if (m_wrapRoot) {
- Element element = m_root.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_root.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", m_rootName);
-
- Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
+
+ Element type = element.newChildElement(SCHEMA_PREFIX
+ + "complexType",
SCHEMA_NS);
- Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
-
+
parent = sequence;
name = nameFromPath(path);
} else {
@@ -186,17 +183,17 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
-
+
Element oid = type.newChildElement(SCHEMA_PREFIX + "attribute",
SCHEMA_NS);
oid.addAttribute("name", "oid");
oid.addAttribute("type", "xs:string");
-
+
// Add to the path -> element map, not that we use this info yet
m_elements.put(path, element);
// 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_type = type;
@@ -209,7 +206,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
*/
protected void endObject(ObjectType obj,
String path) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
@@ -223,7 +220,8 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapAttributes) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
@@ -232,7 +230,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
element.addAttribute("name", property.getName());
// XXX pdl type -> xs type mapping
- element.addAttribute("type",lookupType(property.getJavaClass()));
+ element.addAttribute("type", lookupType(property.getJavaClass()));
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
@@ -240,7 +238,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_sequence.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
} else {
@@ -256,7 +254,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_type.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
}
@@ -271,26 +269,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -307,12 +307,12 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
/**
@@ -324,26 +324,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -360,12 +362,11 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
-
}
DomainObject class to represent address ContentType
@@ -44,6 +44,7 @@ import java.util.TreeMap;
**/
public class GenericAddress extends ContentPage {
+ private static final Logger logger = Logger.getLogger(GenericAddress.class);
/** PDL property name for address */
public static final String ADDRESS = "address";
/** PDL property name for postal code */
@@ -54,18 +55,19 @@ public class GenericAddress extends ContentPage {
public static final String STATE = "state";
/** PDL property name for country iso code */
public static final String ISO_COUNTRY_CODE = "isoCountryCode";
-
/** Data object type for this domain object */
- public static final String BASE_DATA_OBJECT_TYPE
- = "com.arsdigita.cms.contenttypes.GenericAddress";
-
+ public static final String BASE_DATA_OBJECT_TYPE =
+ "com.arsdigita.cms.contenttypes.GenericAddress";
private static GenericAddressConfig s_config = new GenericAddressConfig();
+
static {
- s_config.load();
+ logger.debug("Static initializer is starting...");
+ s_config.load();
+ logger.debug("Static initializer finished.");
}
- public static GenericAddressConfig getConfig()
- {
- return s_config;
+
+ public static GenericAddressConfig getConfig() {
+ return s_config;
}
/**
@@ -128,7 +130,7 @@ public class GenericAddress extends ContentPage {
*/
public void beforeSave() {
super.beforeSave();
-
+
Assert.exists(getContentType(), ContentType.class);
}
@@ -175,25 +177,29 @@ public class GenericAddress extends ContentPage {
// Convert the iso country code to country names using the current locale
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);
return locale.getDisplayCountry(negotiatedLocale.getLocale());
}
-
+
// Get a sorted list auf all countries
public static TreeMap getSortedListOfCountries(Locale inLang) {
-
- LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null);
- String[] countries = Locale.getISOCountries();
- TreeMap PresentationManager interface.
*/
public void servePage(final Document doc,
- final HttpServletRequest req,
- final HttpServletResponse resp) {
+ final HttpServletRequest req,
+ final HttpServletResponse resp) {
servePage(doc, req, resp, null);
}
@@ -265,9 +268,9 @@ public class PageTransformer implements PresentationManager {
* to the Transformer
*/
public void servePage(final Document doc,
- final HttpServletRequest req,
- final HttpServletResponse resp,
- final Map params) {
+ final HttpServletRequest req,
+ final HttpServletResponse resp,
+ final Map params) {
if (resp.isCommitted()) {
return;
}
@@ -280,7 +283,8 @@ public class PageTransformer implements PresentationManager {
Profiler.startOp("XSLT");
try {
- final String charset = Globalization.getDefaultCharset(Kernel.getContext().getLocale());
+ final String charset = Globalization.getDefaultCharset(Kernel.
+ getContext().getLocale());
final String output = req.getParameter("output");
s_log.info("output=" + output);
@@ -289,12 +293,14 @@ public class PageTransformer implements PresentationManager {
DeveloperSupport.startStage("PresMgr get stylesheet");
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
// current request.
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");
@@ -322,7 +328,8 @@ public class PageTransformer implements PresentationManager {
while (entries.hasNext()) {
final Map.Entry entry = (Map.Entry) entries.next();
- xf.setParameter((String) entry.getKey(), entry.getValue());
+ xf.setParameter((String) entry.getKey(),
+ entry.getValue());
}
}
@@ -341,7 +348,7 @@ public class PageTransformer implements PresentationManager {
try {
xf.transform(new DOMSource(doc.getInternalDocument()),
- new StreamResult(writer));
+ new StreamResult(writer));
} catch (TransformerException ex) {
throw new UncheckedWrapperException(
"cannot transform document", ex);
@@ -351,8 +358,10 @@ public class PageTransformer implements PresentationManager {
// copy and paste from BasePresentationManager
if (Kernel.getConfig().isDebugEnabled()) {
- Document origDoc = (Document) req.getAttribute("com.arsdigita.xml.Document");
- Debugger.addDebugger(new TransformationDebugger(template.getSource(), template.getDependents()));
+ Document origDoc = (Document) req.getAttribute(
+ "com.arsdigita.xml.Document");
+ Debugger.addDebugger(new TransformationDebugger(template.
+ getSource(), template.getDependents()));
writer.print(Debugger.getDebugging(req));
}
@@ -374,8 +383,10 @@ public class PageTransformer implements PresentationManager {
// current request.
template = Templating.getTemplate(
req,
- Boolean.TRUE.equals(req.getAttribute(PageTransformer.FANCY_ERRORS)),
- !Boolean.TRUE.equals(req.getAttribute(PageTransformer.CACHE_XSL_NONE)));
+ Boolean.TRUE.equals(req.getAttribute(
+ PageTransformer.FANCY_ERRORS)),
+ !Boolean.TRUE.equals(req.getAttribute(
+ PageTransformer.CACHE_XSL_NONE)));
endTransaction(req);
} finally {
DeveloperSupport.endStage("PresMgr get stylesheet");
@@ -393,7 +404,7 @@ public class PageTransformer implements PresentationManager {
resp.reset();
resp.setContentType("application/zip");
resp.setHeader("Content-Disposition",
- "attachment; filename=\"" + prefix + ".zip\"");
+ "attachment; filename=\"" + prefix + ".zip\"");
DispatcherHelper.forceCacheDisable(resp);
template.toZIP(os, prefix);
@@ -406,7 +417,7 @@ public class PageTransformer implements PresentationManager {
}
} else {
throw new IllegalStateException(output
- + " is an unknown output");
+ + " is an unknown output");
}
} finally {
Profiler.stopOp("XSLT");
@@ -435,7 +446,7 @@ public class PageTransformer implements PresentationManager {
* only the last registered generator is used.
*/
public static void registerXSLParameterGenerator(String parameterName,
- XSLParameterGenerator parameterGenerator) {
+ XSLParameterGenerator parameterGenerator) {
s_XSLParameters.put(parameterName, parameterGenerator);
}
@@ -460,9 +471,9 @@ public class PageTransformer implements PresentationManager {
* be used in the XSL for the given name
*/
public static String getXSLParameterValue(String name,
- HttpServletRequest request) {
+ HttpServletRequest request) {
XSLParameterGenerator generator =
- (XSLParameterGenerator) s_XSLParameters.get(name);
+ (XSLParameterGenerator) s_XSLParameters.get(name);
if (generator != null) {
return generator.generateValue(request);
} else {
@@ -475,13 +486,14 @@ public class PageTransformer implements PresentationManager {
* xsl paraemters.
*/
public static void addXSLParameters(Transformer transformer,
- HttpServletRequest request) {
+ HttpServletRequest request) {
final Iterator entries = s_XSLParameters.entrySet().iterator();
while (entries.hasNext()) {
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) {
// XSL does not like nulls
value = "";
diff --git a/ccm-core/src/com/arsdigita/categorization/Category.java b/ccm-core/src/com/arsdigita/categorization/Category.java
index f4452d405..177fdee05 100755
--- a/ccm-core/src/com/arsdigita/categorization/Category.java
+++ b/ccm-core/src/com/arsdigita/categorization/Category.java
@@ -123,7 +123,9 @@ public class Category extends ACSObject {
private static CategorizationConfig s_config = new CategorizationConfig();
static {
+ s_log.debug("Static initalizer starting...");
s_config.load();
+ s_log.debug("Static initalizer finished.");
}
// Quasimodo: End
public static final String ROOT_CATEGORY = "rootCategory";
diff --git a/ccm-core/src/com/arsdigita/core/LibCheck.java b/ccm-core/src/com/arsdigita/core/LibCheck.java
index ddc5fa8a8..021402883 100755
--- a/ccm-core/src/com/arsdigita/core/LibCheck.java
+++ b/ccm-core/src/com/arsdigita/core/LibCheck.java
@@ -24,6 +24,7 @@ import com.arsdigita.util.Assert;
import java.io.InputStream;
import java.io.InputStreamReader;
+import org.apache.log4j.Logger;
/**
* LibCheck uses the checklist mechanism to perform additional checks for
@@ -37,14 +38,16 @@ import java.io.InputStreamReader;
public class LibCheck extends BaseCheck {
-
+ private static final Logger logger = Logger.getLogger(LibCheck.class);
// Integrating the packaging.MessageMap service class providing a
// package specific message file by overriding the variable in BaseCheck.
static {
+ logger.debug("Static initializer starting...");
final InputStream in = LibCheck.class.getResourceAsStream
("libcheck.messages_linux");
Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in));
+ logger.debug("Static initializer finished...");
}
private boolean checkJAAS() {
diff --git a/ccm-core/src/com/arsdigita/developersupport/Comodifications.java b/ccm-core/src/com/arsdigita/developersupport/Comodifications.java
index 31cf85a9c..75f3a93ac 100755
--- a/ccm-core/src/com/arsdigita/developersupport/Comodifications.java
+++ b/ccm-core/src/com/arsdigita/developersupport/Comodifications.java
@@ -155,9 +155,11 @@ public final class Comodifications {
* the Proxy class do most of the work for me.
*/
private static class ListHandler implements InvocationHandler {
+ private static final Logger logger = Logger.getLogger(ListHandler.class);
private final static Set s_mutators = new HashSet();
static {
+ logger.debug("Static initalizer starting...");
registerMutator("add", new Class[] {Integer.TYPE, Object.class});
registerMutator("add", new Class[] {Object.class});
registerMutator("addAll", new Class[] {Collection.class});
@@ -169,6 +171,7 @@ public final class Comodifications {
registerMutator("removeAll", new Class[] {Collection.class});
registerMutator("retainAll", new Class[] {Collection.class});
registerMutator("set", new Class[] {Integer.TYPE, Object.class});
+ logger.debug("Static initalizer finished.");
}
private final static Method s_iteratorMethod =
diff --git a/ccm-core/src/com/arsdigita/developersupport/Counter.java b/ccm-core/src/com/arsdigita/developersupport/Counter.java
index b0ab8fa8b..92302e6b0 100755
--- a/ccm-core/src/com/arsdigita/developersupport/Counter.java
+++ b/ccm-core/src/com/arsdigita/developersupport/Counter.java
@@ -62,8 +62,10 @@ public final class Counter {
private final static DecimalFormat DURATION_FMT = new DecimalFormat();
static {
+ s_log.debug("Static initalizer starting...");
DURATION_FMT.setGroupingSize(3);
DURATION_FMT.setGroupingUsed(true);
+ s_log.debug("Static initalizer finished.");
}
diff --git a/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java b/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java
index 0ad5b90d0..aad3071f1 100755
--- a/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java
+++ b/ccm-core/src/com/arsdigita/developersupport/LoggingProxyFactory.java
@@ -224,16 +224,20 @@ public final class LoggingProxyFactory implements LoggerConfigurator {
}
private static class Handler implements InvocationHandler {
+ private static final Logger logger = Logger.getLogger(Handler.class);
private static final Method s_getProxiedObject;
static {
+ logger.debug("Static initalizer starting...");
try {
s_getProxiedObject =
LoggingProxy.class.getMethod("getProxiedObject",
new Class[] {});
} catch (NoSuchMethodException ex) {
+ logger.error("Statis initalizer failed: ", ex);
throw new UncheckedWrapperException("failed", ex);
}
+ logger.debug("Static initalizer finished...");
}
private Config m_config;
diff --git a/ccm-core/src/com/arsdigita/dispatcher/BaseDispatcherServlet.java b/ccm-core/src/com/arsdigita/dispatcher/BaseDispatcherServlet.java
index e06c3c4ff..605f66c36 100755
--- a/ccm-core/src/com/arsdigita/dispatcher/BaseDispatcherServlet.java
+++ b/ccm-core/src/com/arsdigita/dispatcher/BaseDispatcherServlet.java
@@ -83,58 +83,57 @@ import org.xml.sax.helpers.DefaultHandler;
public abstract class BaseDispatcherServlet extends HttpServlet
implements Dispatcher, DispatcherConstants {
- private static final Logger s_log = Logger.getLogger
- (BaseDispatcherServlet.class);
-
+ private static final Logger s_log = Logger.getLogger(
+ BaseDispatcherServlet.class);
private final static int NOT_FOUND = 0;
private final static int STATIC_FILE = 1;
private final static int JSP_FILE = 2;
-
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 =
- "-//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
* Vector is synchronized.
*/
private static Vector s_listenerList = new Vector();
-
/**
* list of active requests
*/
private static Vector s_activeList = new Vector();
static {
+ s_log.debug("Static initalizer starting...");
// Add the basic request listeners.
BaseDispatcherServlet.addRequestListener(new RequestListener() {
- public void requestStarted(RequestEvent re) {
- DispatcherHelper.setRequest(re.getRequest());
- }
- public void requestFinished(RequestEvent re) {
- // We could do this:
- // DispatcherHelper.setRequest(null);
- // but some later RequestListener might want to access
- // the request or session. So we'll just let the
- // DispatcherHelper hang on to one stale
- // HttpServletRequest (per thread). The reference will
- // be overwritten on the next request, so we keep only
- // a small amount of garbage.
- }
- });
+ public void requestStarted(RequestEvent re) {
+ DispatcherHelper.setRequest(re.getRequest());
+ }
+
+ public void requestFinished(RequestEvent re) {
+ // We could do this:
+ // DispatcherHelper.setRequest(null);
+ // but some later RequestListener might want to access
+ // the request or session. So we'll just let the
+ // DispatcherHelper hang on to one stale
+ // HttpServletRequest (per thread). The reference will
+ // be overwritten on the next request, so we keep only
+ // a small amount of garbage.
+ }
+ });
BaseDispatcherServlet.addRequestListener(new RequestListener() {
- public void requestStarted(RequestEvent re) {
- Kernel.getContext().getTransaction().begin();
- }
- public void requestFinished(RequestEvent re) {
- Kernel.getContext().getTransaction().end();
- }
- });
+ public void requestStarted(RequestEvent re) {
+ Kernel.getContext().getTransaction().begin();
+ }
+
+ public void requestFinished(RequestEvent re) {
+ Kernel.getContext().getTransaction().end();
+ }
+ });
//log to DeveloperSupport
// BaseDispatcherServlet.addRequestListener(new RequestListener() {
@@ -153,19 +152,18 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* it depends upon there being at least one DeveloperSupportListener when counting
* whether to log queries to webdevsupport.
*/
- com.arsdigita.developersupport.DeveloperSupport.addListener
- (new com.arsdigita.developersupport.DeveloperSupportListener() {
- public void requestStart(Object request) {
- s_log.debug("DS: requestStart: " + request);
- }
+ com.arsdigita.developersupport.DeveloperSupport.addListener(new com.arsdigita.developersupport.DeveloperSupportListener() {
- public void requestEnd(Object request) {
- s_log.debug("DS: requestEnd: " + request);
- }
- }
- );
+ public void requestStart(Object request) {
+ s_log.debug("DS: requestStart: " + request);
+ }
+
+ public void requestEnd(Object request) {
+ s_log.debug("DS: requestEnd: " + request);
+ }
+ });
+ s_log.debug("Static initalizer finished.");
}
-
private List m_welcomeFiles = new ArrayList();
/**
@@ -177,7 +175,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
super.init();
try {
File file =
- new File(getServletContext().getRealPath("/WEB-INF/web.xml"));
+ new File(getServletContext().getRealPath("/WEB-INF/web.xml"));
// all we care about is the welcome-file-list element
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(false);
@@ -220,11 +218,10 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* @throws com.arsdigita.dispatcher.RedirectException if the dispatcher
* should redirect the client to the page contained in the exception
**/
- protected abstract RequestContext authenticateUser
- (HttpServletRequest req,
- HttpServletResponse resp,
- RequestContext ctx)
- throws RedirectException;
+ protected abstract RequestContext authenticateUser(HttpServletRequest req,
+ HttpServletResponse resp,
+ RequestContext ctx)
+ throws RedirectException;
/**
* Called directly by the servlet container when this servlet is invoked
@@ -243,18 +240,17 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* throws an IOException
*/
public void service(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ throws ServletException, IOException {
if (s_log.isDebugEnabled()) {
- s_log.debug
- ("\n*** *** *** *** *** ***\n" +
- "Servicing request for URL '" + req.getRequestURI() + "'\n" +
- "*** *** *** *** *** ***");
+ s_log.debug("\n*** *** *** *** *** ***\n"
+ + "Servicing request for URL '" + req.getRequestURI()
+ + "'\n" + "*** *** *** *** *** ***");
}
boolean reentrant = true;
RequestContext reqCtx =
- DispatcherHelper.getRequestContext(req);
+ DispatcherHelper.getRequestContext(req);
boolean finishedNormal = false;
// there are two types of re-entrancy we need to consider:
@@ -307,8 +303,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
// need an identifier for this particular request
String requestId =
- Thread.currentThread().getName() + "|" +
- System.currentTimeMillis();
+ Thread.currentThread().getName() + "|" + System.
+ currentTimeMillis();
req.setAttribute(REENTRANCE_ATTRIBUTE, requestId);
s_activeList.add(requestId);
@@ -345,8 +341,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
// whole object since it might actually be a
// KernelRequestContext with user / session info
if (reqCtx instanceof InitialRequestContext) {
- ((InitialRequestContext)reqCtx)
- .initializeURLFromRequest(req, true);
+ ((InitialRequestContext) reqCtx).
+ initializeURLFromRequest(req, true);
}
}
}
@@ -382,7 +378,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
Throwable rootError;
do {
rootError = t;
- t = ((ServletException)t).getRootCause();
+ t = ((ServletException) t).getRootCause();
} while (t instanceof ServletException);
if (t != null) {
rootError = t;
@@ -393,9 +389,9 @@ public abstract class BaseDispatcherServlet extends HttpServlet
&& (rootError instanceof AbortRequestSignal)) {
finishedNormal = true;
} else if (rootError != null
- && (rootError instanceof RedirectSignal)) {
+ && (rootError instanceof RedirectSignal)) {
s_log.debug("rethrowing RedirectSignal", rootError);
- throw (RedirectSignal)rootError;
+ throw (RedirectSignal) rootError;
} else {
s_log.error("error in BaseDispatcherServlet", rootError);
throw new ServletException(rootError);
@@ -411,13 +407,14 @@ public abstract class BaseDispatcherServlet extends HttpServlet
DeveloperSupport.endStage("BaseDispatcherServlet.service()");
// run the request listener events
fireFinishedListener(
- new RequestEvent(req, resp, reqCtx, false, finishedNormal));
+ new RequestEvent(req, resp, reqCtx, false,
+ finishedNormal));
// at this point, clear the attribute so
// a secondary request will work
// and remove the request from the list of currently-active
// requests
Object requestId = req.getAttribute(REENTRANCE_ATTRIBUTE);
- synchronized(s_activeList) {
+ synchronized (s_activeList) {
s_activeList.remove(requestId);
s_activeList.notifyAll();
}
@@ -438,14 +435,14 @@ public abstract class BaseDispatcherServlet extends HttpServlet
**/
private StartRequestRecord startRequest(HttpServletRequest req,
HttpServletResponse resp)
- throws RedirectException, IOException, ServletException {
+ throws RedirectException, IOException, ServletException {
// turn multipart request into wrapped request
// to make up for servlet 2.2 brokenness
req = DispatcherHelper.maybeWrapRequest(req);
RequestContext reqCtx =
- new InitialRequestContext(req, getServletContext());
+ new InitialRequestContext(req, getServletContext());
// run the request listener events
fireStartListener(new RequestEvent(req, resp, reqCtx, true));
@@ -469,12 +466,12 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* listeners
*/
protected void fireFinishedListener(RequestEvent evt) {
- for (int i = 0 ; i < s_listenerList.size(); i++) {
+ for (int i = 0; i < s_listenerList.size(); i++) {
try {
- ((RequestListener)s_listenerList.get(i)).requestFinished(evt);
+ ((RequestListener) s_listenerList.get(i)).requestFinished(evt);
} catch (Exception e) {
- s_log.error("Error running request finished listener " +
- s_listenerList.get(i) + " (#" + i + ")", e);
+ s_log.error("Error running request finished listener " + s_listenerList.
+ get(i) + " (#" + i + ")", e);
}
}
}
@@ -487,8 +484,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* listeners
*/
protected void fireStartListener(RequestEvent evt) {
- for (int i = 0 ; i < s_listenerList.size(); i++) {
- ((RequestListener)s_listenerList.get(i)).requestStarted(evt);
+ for (int i = 0; i < s_listenerList.size(); i++) {
+ ((RequestListener) s_listenerList.get(i)).requestStarted(evt);
}
}
@@ -496,6 +493,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* Kludge for returning a typed 2-tuple.
*/
private class StartRequestRecord {
+
RequestContext m_reqCtx;
HttpServletRequest m_req;
@@ -517,10 +515,11 @@ public abstract class BaseDispatcherServlet extends HttpServlet
if (sema != null) {
while (s_activeList.indexOf(sema) != -1) {
try {
- synchronized(s_activeList) {
+ synchronized (s_activeList) {
s_activeList.wait();
}
- } catch (InterruptedException ie) { }
+ } catch (InterruptedException ie) {
+ }
}
sess.removeAttribute(REDIRECT_SEMAPHORE);
}
@@ -545,15 +544,15 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* returns NOT_FOUND otherwise.
*/
private int concreteFileType(HttpServletRequest req)
- throws ServletException, IOException {
+ throws ServletException, IOException {
String path = DispatcherHelper.getCurrentResourcePath(req);
ServletContext sctx = this.getServletContext();
File realFile = new File(sctx.getRealPath(path));
- if (realFile.exists() &&
- (!realFile.isDirectory() || hasWelcomeFile(realFile))) {
+ if (realFile.exists() && (!realFile.isDirectory() || hasWelcomeFile(
+ realFile))) {
// yup. Go there, bypass the site map.
// we have a concrete file so no forwarding to
// rewrite the request URL is necessary.
@@ -587,7 +586,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
private boolean trailingSlashRedirect(HttpServletRequest req,
HttpServletResponse resp)
- throws IOException {
+ throws IOException {
String path = DispatcherHelper.getCurrentResourcePath(req);
// first, see if we have an extension
if (path.lastIndexOf(".") <= path.lastIndexOf("/")) {
@@ -612,13 +611,14 @@ public abstract class BaseDispatcherServlet extends HttpServlet
* web.xml
*/
private class WebXMLReader extends DefaultHandler {
+
StringBuffer m_buffer = new StringBuffer();
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException {
// we don't want to read the web.xml dtd
if (WEB_XML_22_PUBLIC_ID.equals(publicId)
- || WEB_XML_23_PUBLIC_ID.equals(publicId)) {
+ || WEB_XML_23_PUBLIC_ID.equals(publicId)) {
StringReader reader = new StringReader(" ");
return new InputSource(reader);
} else {
@@ -645,7 +645,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
String qname) {
if (qname.equals("welcome-file-list")) {
String[] welcomeFiles =
- StringUtils.split(m_buffer.toString(), ',');
+ StringUtils.split(m_buffer.toString(), ',');
for (int i = 0; i < welcomeFiles.length; i++) {
m_welcomeFiles.add(welcomeFiles[i].trim());
}
diff --git a/ccm-core/src/com/arsdigita/formbuilder/AttributeType.java b/ccm-core/src/com/arsdigita/formbuilder/AttributeType.java
index 9cb199de2..47eed8bfe 100755
--- a/ccm-core/src/com/arsdigita/formbuilder/AttributeType.java
+++ b/ccm-core/src/com/arsdigita/formbuilder/AttributeType.java
@@ -18,13 +18,12 @@
*/
package com.arsdigita.formbuilder;
-
import com.arsdigita.bebop.event.ParameterListener;
import com.arsdigita.util.UncheckedWrapperException;
import java.util.List;
-
+import org.apache.log4j.Logger;
/**
* This class contains the attribute data type that are used for form
@@ -36,8 +35,8 @@ import java.util.List;
*/
public class AttributeType {
+ private static final Logger logger = Logger.getLogger(AttributeType.class);
private Class m_parameterModelClass;
-
private List m_validationListeners;
public AttributeType(Class parameterModelClass) {
@@ -46,14 +45,12 @@ public class AttributeType {
m_validationListeners = new java.util.ArrayList();
}
-
/**
* Standard attribute types
*/
public static AttributeType INTEGER;
public static AttributeType TEXT;
public static AttributeType DATE;
-
// The classes of the standard data types
private static Class s_integerClass;
private static Class s_textClass;
@@ -61,12 +58,15 @@ public class AttributeType {
// Initialization of the standard attribute types
static {
-
+ logger.debug("Static initalizer starting...");
try {
- s_integerClass = Class.forName("com.arsdigita.bebop.parameters.IntegerParameter");
- s_textClass = Class.forName("com.arsdigita.bebop.parameters.StringParameter");
- s_dateClass = Class.forName("com.arsdigita.bebop.parameters.DateParameter");
+ s_integerClass = Class.forName(
+ "com.arsdigita.bebop.parameters.IntegerParameter");
+ s_textClass = Class.forName(
+ "com.arsdigita.bebop.parameters.StringParameter");
+ s_dateClass = Class.forName(
+ "com.arsdigita.bebop.parameters.DateParameter");
} catch (ClassNotFoundException e) {
throw new UncheckedWrapperException(e);
@@ -75,10 +75,10 @@ public class AttributeType {
INTEGER = new AttributeType(s_integerClass);
TEXT = new AttributeType(s_textClass);
DATE = new AttributeType(s_dateClass);
+ logger.debug("Static initalizer finished.");
}
//*** Attribute Methods
-
public Class getParameterModelClass() {
return m_parameterModelClass;
}
diff --git a/ccm-core/src/com/arsdigita/kernel/security/Crypto.java b/ccm-core/src/com/arsdigita/kernel/security/Crypto.java
index 50f8de0f5..8b817f3d4 100755
--- a/ccm-core/src/com/arsdigita/kernel/security/Crypto.java
+++ b/ccm-core/src/com/arsdigita/kernel/security/Crypto.java
@@ -67,7 +67,9 @@ public class Crypto {
public static final String CHARACTER_ENCODING = "UTF-8";
static {
+ s_log.debug("Static initalizer starting...");
Security.addProvider(new BouncyCastleProvider());
+ s_log.debug("Static initalizer finished");
}
/**
diff --git a/ccm-core/src/com/arsdigita/kernel/security/URLLoginModule.java b/ccm-core/src/com/arsdigita/kernel/security/URLLoginModule.java
index 2f49327c4..fb81ed90e 100755
--- a/ccm-core/src/com/arsdigita/kernel/security/URLLoginModule.java
+++ b/ccm-core/src/com/arsdigita/kernel/security/URLLoginModule.java
@@ -48,8 +48,10 @@ public class URLLoginModule extends UserLoginModule {
private static Set s_models = new HashSet();
static {
+ s_log.debug("Static initalizer starting...");
s_models.add(NORMAL_PARAM);
s_models.add(SECURE_PARAM);
+ s_log.debug("Static initalizer finished...");
}
/**
diff --git a/ccm-core/src/com/arsdigita/logging/ErrorReport.java b/ccm-core/src/com/arsdigita/logging/ErrorReport.java
index 4e38e5cf1..fec82bb10 100755
--- a/ccm-core/src/com/arsdigita/logging/ErrorReport.java
+++ b/ccm-core/src/com/arsdigita/logging/ErrorReport.java
@@ -63,6 +63,7 @@ public class ErrorReport {
private static final Logger s_log = Logger.getLogger(ErrorReport.class);
static {
+ s_log.debug("Static initalizer starting...");
final JavaPropertyReader reader = new JavaPropertyReader
(System.getProperties());
@@ -76,6 +77,7 @@ public class ErrorReport {
if (dir != null) {
ErrorReport.initializeAppender(dir);
}
+ s_log.debug("Static initalizer finished.");
}
public static void initializeAppender(String directory) {
diff --git a/ccm-core/src/com/arsdigita/mail/Mail.java b/ccm-core/src/com/arsdigita/mail/Mail.java
index 4f640d34f..891f0e0a0 100755
--- a/ccm-core/src/com/arsdigita/mail/Mail.java
+++ b/ccm-core/src/com/arsdigita/mail/Mail.java
@@ -69,9 +69,13 @@ import java.util.Set;
* @author Ron Henderson
* @version $Id: Mail.java 994 2005-11-14 14:29:25Z apevec $
*/
-
public class Mail implements MessageType {
+ /**
+ * Used for logging.
+ */
+ private static final Logger s_log =
+ Logger.getLogger(Mail.class);
private static MailConfig s_config;
public static MailConfig getConfig() {
@@ -82,118 +86,92 @@ public class Mail implements MessageType {
}
return s_config;
}
-
private static final InternetAddress[] EMPTY_ADDRESS_LIST =
- new InternetAddress[0];
-
+ new InternetAddress[0];
/**
* Table of message headers.
*/
private Hashtable m_headers;
-
/**
* Email addresses the message is being sent to.
*/
private InternetAddress[] m_to;
-
private InternetAddress[] m_filteredTo = EMPTY_ADDRESS_LIST;
private InternetAddress[] m_invalidTo = EMPTY_ADDRESS_LIST;
private static Set s_invalidDomains = new HashSet();
static {
+ s_log.debug("Static initalizer starting...");
s_invalidDomains.add("example.com");
+ s_log.debug("Static initalizer finished.");
}
-
/**
* Email address the message is being sent from.
*/
private InternetAddress m_from;
-
/**
* Email address used for replies to this message.
*/
private InternetAddress[] m_replyTo;
-
/**
* Email addresses that the message is being carbon-copied to.
*/
private InternetAddress[] m_cc;
-
/**
* Email addresses that the message is being blind carbon-copied to.
*/
private InternetAddress[] m_bcc;
-
/**
* Message subject.
*/
private String m_subject;
-
/**
* Message body (can be text or HTML).
*/
private String m_body;
-
/**
* Message body alternate (if the body is HTML)
*/
private String m_alternate;
-
/**
* Encoding specification for m_body and m_alternate (optional).
* Default value (null) implies "us-ascii" encoding.
*/
private String m_encoding;
-
/**
* Message attachments (optional)
*/
private MimeMultipart m_attachments;
-
/**
* Unique identifier for each mail send out.
*/
private String m_messageID;
-
/**
* Session object used to send mail.
*/
private static Session s_session;
-
/**
* SMTP host to connect to. Only used to override the default for
* testing purposes.
*/
private static String s_host;
-
/**
* SMTP port to connect to. Only used to override the default for
* testing purposes.
*/
private static String s_port;
-
// Constants used by Mail
-
final static String CONTENT_TYPE = "Content-Type";
- final static String CONTENT_ID = "Content-ID";
- final static String MIXED = "mixed";
- final static String ALTERNATIVE = "alternative";
-
+ final static String CONTENT_ID = "Content-ID";
+ final static String MIXED = "mixed";
+ final static String ALTERNATIVE = "alternative";
/**
* Disposition of "inline"
*/
- public final static String INLINE = javax.mail.Part.INLINE;
-
+ public final static String INLINE = javax.mail.Part.INLINE;
/**
* Disposition of "attachment"
*/
- public final static String ATTACHMENT = javax.mail.Part.ATTACHMENT;
-
- /**
- * Used for logging.
- */
-
- private static final Logger s_log =
- Logger.getLogger(Mail.class);
+ public final static String ATTACHMENT = javax.mail.Part.ATTACHMENT;
/**
* Default constructor. Must use the setTo, setSubject (and so on)
@@ -212,8 +190,7 @@ public class Mail implements MessageType {
*/
public Mail(String to,
String from,
- String subject)
- {
+ String subject) {
this(to, from, subject, null);
}
@@ -228,8 +205,7 @@ public class Mail implements MessageType {
public Mail(String to,
String from,
String subject,
- String body)
- {
+ String body) {
m_to = (to == null ? EMPTY_ADDRESS_LIST : parseAddressField(to));
filterRecipients();
m_from = (from == null ? null : parseAddress(from));
@@ -251,9 +227,8 @@ public class Mail implements MessageType {
String from,
String subject,
String body,
- String enc)
- {
- this(to,from,subject,body);
+ String enc) {
+ this(to, from, subject, body);
setEncoding(enc);
}
@@ -265,26 +240,22 @@ public class Mail implements MessageType {
* @param subject the subject for the message
* @param body the plain text body of the message
*/
-
public static void send(String to,
String from,
String subject,
String body)
- throws MessagingException,
- SendFailedException
- {
- Mail msg = new Mail(to,from,subject,body);
+ throws MessagingException,
+ SendFailedException {
+ Mail msg = new Mail(to, from, subject, body);
msg.send();
}
/**
* Sends the message.
*/
-
public void send()
- throws MessagingException,
- SendFailedException
- {
+ throws MessagingException,
+ SendFailedException {
Transport transport = getSession().getTransport();
transport.connect();
send(transport);
@@ -300,11 +271,9 @@ public class Mail implements MessageType {
* also such returned from the server. Applications might try
* to catch this and re-schedule sending the mail.
*/
-
void send(Transport transport)
- throws MessagingException,
- SendFailedException
- {
+ throws MessagingException,
+ SendFailedException {
Message msg = null;
if (m_filteredTo.length > 0) {
msg = getMessage();
@@ -312,12 +281,12 @@ public class Mail implements MessageType {
try {
transport.sendMessage(msg, msg.getAllRecipients());
} catch (MessagingException mex) {
-
+
// Close the transport agent and rethrow error for
// detailed message.
-
+
transport.close();
-
+
throw new SendFailedException("send failed: ", mex);
}
}
@@ -329,8 +298,8 @@ public class Mail implements MessageType {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
msg.writeTo(os);
- s_log.debug("message sent:\n" + os.toString() +
- "\n-- EOT --");
+ s_log.debug("message sent:\n" + os.toString()
+ + "\n-- EOT --");
} catch (IOException ex) {
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");
}
} else {
- s_log.info("message sent to <" + Arrays.asList(m_filteredTo) + "> from <" + m_from +
- "> subject <" + m_subject + ">");
- s_log.info("messages filtered for <" + Arrays.asList(m_invalidTo) + "> from <" + m_from +
- "> subject <" + m_subject + ">");
+ s_log.info("message sent to <" + Arrays.asList(m_filteredTo)
+ + "> from <" + m_from + "> subject <" + m_subject + ">");
+ s_log.info("messages filtered for <" + Arrays.asList(m_invalidTo)
+ + "> from <" + m_from + "> subject <" + m_subject + ">");
}
}
@@ -413,7 +382,7 @@ public class Mail implements MessageType {
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
*/
-
public void setEncoding(String enc) {
m_encoding = enc;
}
@@ -469,12 +437,10 @@ public class Mail implements MessageType {
*
* @return the string value of the character encoding being used
*/
-
public String getEncoding() {
return m_encoding;
}
-
/**
* Adds an attachment to a message. This method is private but
* 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
*/
-
private void attach(MimeBodyPart part)
- throws MessagingException
- {
+ throws MessagingException {
if (m_attachments == null) {
m_attachments = new MimeMultipart();
}
@@ -501,12 +465,10 @@ public class Mail implements MessageType {
* @param name the name of the attachment
* @param description a description of the attachment
*/
-
public void attach(URL url,
String name,
String description)
- throws MessagingException
- {
+ throws MessagingException {
attach(url, name, description, Mail.ATTACHMENT);
}
@@ -519,13 +481,11 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
public void attach(URL url,
String name,
String description,
String disposition)
- throws MessagingException
- {
+ throws MessagingException {
MimeBodyPart part = new MimeBodyPart();
attach(part);
@@ -546,12 +506,10 @@ public class Mail implements MessageType {
* @param name the name of the attachment
* @param description a description of the attachment
*/
-
public void attach(File path,
String name,
String description)
- throws MessagingException
- {
+ throws MessagingException {
attach(path, name, description, ATTACHMENT);
}
@@ -565,13 +523,11 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
public void attach(File path,
String name,
String description,
String disposition)
- throws MessagingException
- {
+ throws MessagingException {
MimeBodyPart part = new MimeBodyPart();
attach(part);
@@ -592,13 +548,11 @@ public class Mail implements MessageType {
* @param type the MIME type of the attachment
* @param name the name of the attachment
*/
-
public void attach(byte[] data,
String type,
String name)
- throws MessagingException
- {
- attach(data,type,name,null,ATTACHMENT);
+ throws MessagingException {
+ attach(data, type, name, null, ATTACHMENT);
}
/**
@@ -611,16 +565,14 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
public void attach(byte[] data,
String type,
String name,
String description,
String disposition)
- throws MessagingException
- {
- ByteArrayDataSource ds = new ByteArrayDataSource(data,type,name);
- attach(ds,description,disposition);
+ throws MessagingException {
+ ByteArrayDataSource ds = new ByteArrayDataSource(data, type, name);
+ attach(ds, description, disposition);
}
/**
@@ -631,13 +583,11 @@ public class Mail implements MessageType {
* @param type the MIME type of the attachment
* @param name the name of the attachment
*/
-
public void attach(String data,
String type,
String name)
- throws MessagingException
- {
- attach(data,type,name,null,ATTACHMENT);
+ throws MessagingException {
+ attach(data, type, name, null, ATTACHMENT);
}
/**
@@ -650,16 +600,14 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
public void attach(String data,
String type,
String name,
String description,
String disposition)
- throws MessagingException
- {
- ByteArrayDataSource ds = new ByteArrayDataSource(data,type,name);
- attach(ds,description,disposition);
+ throws MessagingException {
+ ByteArrayDataSource ds = new ByteArrayDataSource(data, type, name);
+ attach(ds, description, disposition);
}
/**
@@ -671,13 +619,11 @@ public class Mail implements MessageType {
* @param type the MIME type of the attachment
* @param name the name of the attachment
*/
-
public void attach(ByteArrayInputStream is,
String type,
String name)
- throws MessagingException
- {
- attach(is,type,name,null,ATTACHMENT);
+ throws MessagingException {
+ attach(is, type, name, null, ATTACHMENT);
}
/**
@@ -691,15 +637,13 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
public void attach(ByteArrayInputStream is,
String type,
String name,
String description,
String disposition)
- throws MessagingException
- {
- ByteArrayDataSource ds = new ByteArrayDataSource(is,type,name);
+ throws MessagingException {
+ ByteArrayDataSource ds = new ByteArrayDataSource(is, type, name);
attach(ds, description, disposition);
}
@@ -713,12 +657,10 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
protected void attach(ByteArrayDataSource dataSource,
String description,
String disposition)
- throws MessagingException
- {
+ throws MessagingException {
MimeBodyPart part = new MimeBodyPart();
attach(part);
@@ -730,7 +672,6 @@ public class Mail implements MessageType {
part.setDisposition(disposition);
}
-
/**
* Attaches content to a message by supplying a DataHandler. All
* 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.
*/
-
public void attach(DataHandler dh)
- throws MessagingException
- {
+ throws MessagingException {
attach(dh, null, ATTACHMENT);
}
-
/**
* Attaches content to a message by supplying a DataHandler. Sets
* the description and disposition of the content.
@@ -754,12 +692,10 @@ public class Mail implements MessageType {
* @param description a description of the attachment
* @param disposition Mail.ATTACHMENT or Mail.INLINE
*/
-
public void attach(DataHandler dh,
String description,
String disposition)
- throws MessagingException
- {
+ throws MessagingException {
MimeBodyPart part = new MimeBodyPart();
attach(part);
@@ -775,7 +711,6 @@ public class Mail implements MessageType {
* initializer and any of properties that can be overridden at
* the package level.
*/
-
static synchronized Session getSession() {
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
* than invoke the Mail.send() method for each instance.)
*/
-
private Message getMessage()
- throws MessagingException
- {
+ throws MessagingException {
// Create the message
MimeMessage msg = new MimeMessage(getSession());
@@ -838,7 +771,7 @@ public class Mail implements MessageType {
// Encode the subject
String enc_subj;
try {
- enc_subj = MimeUtility.encodeText(m_subject,m_encoding,null);
+ enc_subj = MimeUtility.encodeText(m_subject, m_encoding, null);
} catch (UnsupportedEncodingException uee) {
s_log.warn("unable to encode subject: " + uee);
enc_subj = m_subject;
@@ -849,11 +782,11 @@ public class Mail implements MessageType {
if (m_headers != null) {
Enumeration e = m_headers.keys();
while (e.hasMoreElements()) {
- String name = (String) e.nextElement();
+ String name = (String) e.nextElement();
String value = (String) m_headers.get(name);
String enc_v;
try {
- enc_v = MimeUtility.encodeText(value,m_encoding,null);
+ enc_v = MimeUtility.encodeText(value, m_encoding, null);
} catch (UnsupportedEncodingException uee) {
s_log.warn("unable to encode header element: " + uee);
enc_v = value;
@@ -875,7 +808,6 @@ public class Mail implements MessageType {
* @param host the SMTP host to connect to
* @param port the port number on that host
*/
-
synchronized static void setSmtpServer(String host, String port) {
s_host = host;
s_port = port;
@@ -884,7 +816,6 @@ public class Mail implements MessageType {
s_session = null;
}
-
/**
* Returns 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;
}
-
/**
* Writes the content of the message to the given output stream.
* Useful for debugging.
*
* @param os the output stream to write the message to
*/
-
public void writeTo(OutputStream os)
- throws MessagingException
- {
+ throws MessagingException {
try {
getMessage().writeTo(os);
} catch (IOException ex) {
@@ -919,7 +847,7 @@ public class Mail implements MessageType {
if (str.indexOf(",") != -1) {
ArrayList a = new ArrayList();
- StringTokenizer st = new StringTokenizer(str,",",false);
+ StringTokenizer st = new StringTokenizer(str, ",", false);
while (st.hasMoreTokens()) {
a.add(st.nextToken());
}
@@ -950,7 +878,7 @@ public class Mail implements MessageType {
* Parses an address.
*/
private static InternetAddress parseAddress(String str) {
- String address = null;
+ String address = null;
String personal = null;
InternetAddress addr = null;
@@ -960,13 +888,13 @@ public class Mail implements MessageType {
if (str.indexOf(" ") == -1) {
address = str;
} else {
- int sp = str.lastIndexOf(" ");
- personal = str.substring(0,sp);
- address = str.substring(sp+1);
+ int sp = str.lastIndexOf(" ");
+ personal = str.substring(0, sp);
+ address = str.substring(sp + 1);
}
try {
- addr = new InternetAddress(address,personal);
+ addr = new InternetAddress(address, personal);
} catch (UnsupportedEncodingException e) {
s_log.error("unable to parse address: " + str);
}
@@ -1014,20 +942,18 @@ public class Mail implements MessageType {
private static void parseHeader(String str, Hashtable headers) {
str = str.trim();
- int sp = str.lastIndexOf(":");
- String name = str.substring(0, sp);
- String value = (str.substring(sp+1)).trim();
+ int sp = str.lastIndexOf(":");
+ String name = str.substring(0, sp);
+ String value = (str.substring(sp + 1)).trim();
- headers.put(name,value);
+ headers.put(name, value);
}
/**
* Utility function to prepare the content of the message.
*/
-
private Message prepareMessageContent(MimeMessage msg)
- throws MessagingException
- {
+ throws MessagingException {
if (m_alternate == null && m_attachments == null) {
// We have a plain-text message with no attachments. Use
@@ -1122,12 +1048,14 @@ public class Mail implements MessageType {
filtered.add(m_to[i]);
} else {
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_invalidTo = (InternetAddress[]) invalid.toArray(new InternetAddress[invalid.size()]);
+ m_filteredTo = (InternetAddress[]) filtered.toArray(new InternetAddress[filtered.
+ size()]);
+ m_invalidTo = (InternetAddress[]) invalid.toArray(new InternetAddress[invalid.
+ size()]);
return m_filteredTo;
}
-
}
diff --git a/ccm-core/src/com/arsdigita/packaging/BaseCheck.java b/ccm-core/src/com/arsdigita/packaging/BaseCheck.java
index 374314411..9ebfe19a6 100755
--- a/ccm-core/src/com/arsdigita/packaging/BaseCheck.java
+++ b/ccm-core/src/com/arsdigita/packaging/BaseCheck.java
@@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
+import org.apache.log4j.Logger;
/**
* 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 {
+ private static final Logger logger = Logger.getLogger(BaseCheck.class);
public static final String versionId =
"$Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
@@ -53,12 +55,14 @@ abstract public class BaseCheck extends Check {
public static final MessageMap s_messages = new MessageMap();
static {
+ logger.debug("Static initalizer starting...");
final InputStream in = BaseCheck.class.getResourceAsStream
("basecheck.messages_linux");
Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in));
+ logger.debug("Static initalizer finished.");
}
public static String message(final String key) {
diff --git a/ccm-core/src/com/arsdigita/packaging/CheckDB.java b/ccm-core/src/com/arsdigita/packaging/CheckDB.java
index 4b7ea1ce4..a1c1710b4 100755
--- a/ccm-core/src/com/arsdigita/packaging/CheckDB.java
+++ b/ccm-core/src/com/arsdigita/packaging/CheckDB.java
@@ -28,6 +28,7 @@ import java.sql.Connection;
import java.io.InputStream;
import java.io.InputStreamReader;
+import org.apache.log4j.Logger;
/**
@@ -43,6 +44,7 @@ import java.io.InputStreamReader;
public class CheckDB extends BaseCheck {
+ private static final Logger logger = Logger.getLogger(CheckDB.class);
public final static String versionId =
"$Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
@@ -51,10 +53,12 @@ public class CheckDB extends BaseCheck {
// Integration of service class packaging.MessageMap.
// Specifies a package specific message file overriding BaseCheck
static {
+ logger.debug("Static initalizer starting...");
final InputStream in = CheckDB.class.getResourceAsStream
("checkdb.messages_linux");
Assert.exists(in, InputStream.class);
s_messages.load(new InputStreamReader(in));
+ logger.debug("Static initalizer finished.");
}
diff --git a/ccm-core/src/com/arsdigita/packaging/Get.java b/ccm-core/src/com/arsdigita/packaging/Get.java
index 561c5d859..625526da3 100755
--- a/ccm-core/src/com/arsdigita/packaging/Get.java
+++ b/ccm-core/src/com/arsdigita/packaging/Get.java
@@ -37,6 +37,7 @@ import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
+import org.apache.log4j.Logger;
/**
* Get
@@ -49,37 +50,31 @@ import org.apache.commons.cli.PosixParser;
* @author Rafael H. Schloming <rhs@mit.edu>
* @version $Revision: #6 $ $Date: 2004/08/16 $
**/
-
class Get extends Command {
- public final static String versionId =
- "$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $" +
- " by $Author: apevec $, " +
- "$DateTime: 2004/08/16 18:10:38 $";
-
+ public static final Logger logger = Logger.getLogger(Get.class);
+ public final static String versionId =
+ "$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $"
+ + " by $Author: apevec $, "
+ + "$DateTime: 2004/08/16 18:10:38 $";
private static final Options OPTIONS = getOptions();
static {
+ logger.debug("Static initalizer starting...");
OptionGroup group = new OptionGroup();
- group.addOption
- (OptionBuilder
- .hasArg(false)
- .withLongOpt("all")
- .withDescription("Lists all configuration parameters")
- .create("all"));
- group.addOption
- (OptionBuilder
- .hasArg()
- .withArgName("PARAMETER")
- .withLongOpt("value")
- .withDescription("Prints a scalar value without the key")
- .create("value"));
+ group.addOption(OptionBuilder.hasArg(false).withLongOpt("all").
+ withDescription("Lists all configuration parameters").create(
+ "all"));
+ group.addOption(OptionBuilder.hasArg().withArgName("PARAMETER").
+ withLongOpt("value").withDescription(
+ "Prints a scalar value without the key").create("value"));
OPTIONS.addOptionGroup(group);
+ logger.debug("Static initalizer finished.");
}
public Get() {
- super("get", "Print one or more values from a CCM " +
- "configuration database");
+ super("get", "Print one or more values from a CCM "
+ + "configuration database");
}
public boolean run(String[] args) {
@@ -107,10 +102,9 @@ class Get extends Command {
String[] names;
if (line.hasOption("value")) {
- names = new String[] { line.getOptionValue("value") };
+ names = new String[]{line.getOptionValue("value")};
if (line.getArgs().length > 0) {
- System.err.println
- ("--value option does not allow parameters");
+ System.err.println("--value option does not allow parameters");
return false;
}
} else {
@@ -138,10 +132,12 @@ class Get extends Command {
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();
Object value = config.get(param);
Properties props = new Properties();
@@ -167,19 +163,20 @@ class Get extends Command {
}
private void write(Properties properties, PrintStream out)
- throws IOException {
+ throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
properties.store(baos, null);
BufferedReader reader =
- new BufferedReader(new StringReader(baos.toString()));
+ new BufferedReader(new StringReader(baos.toString()));
while (true) {
String line = reader.readLine();
- if (line == null) { return; }
+ if (line == null) {
+ return;
+ }
if (line.trim().startsWith("#")) {
continue;
}
out.println(line);
}
}
-
}
diff --git a/ccm-core/src/com/arsdigita/packaging/HostInit.java b/ccm-core/src/com/arsdigita/packaging/HostInit.java
index 7a84210ad..78b702a75 100755
--- a/ccm-core/src/com/arsdigita/packaging/HostInit.java
+++ b/ccm-core/src/com/arsdigita/packaging/HostInit.java
@@ -82,6 +82,7 @@ public class HostInit {
private static final Options OPTIONS = new Options();
static {
+ s_log.debug("Static initalizer starting...");
OPTIONS.addOption
(OptionBuilder
.hasArg()
@@ -109,6 +110,7 @@ public class HostInit {
.withLongOpt("clean")
.withDescription("Remove the destination directory before copying files")
.create());
+ s_log.debug("Static initalizer finsished.");
}
private static final void err(String msg) {
diff --git a/ccm-core/src/com/arsdigita/packaging/Load.java b/ccm-core/src/com/arsdigita/packaging/Load.java
index 035fabaa7..ab389ef70 100755
--- a/ccm-core/src/com/arsdigita/packaging/Load.java
+++ b/ccm-core/src/com/arsdigita/packaging/Load.java
@@ -71,6 +71,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
+import org.apache.log4j.Logger;
/**
* PackageTool worker class, implements the "load" command.
@@ -85,9 +86,11 @@ import org.apache.commons.cli.PosixParser;
class Load extends Command {
+ private static final Logger logger = Logger.getLogger(Load.class);
private static final Options OPTIONS = getOptions();
static {
+ logger.debug("Static initalizer starting...");
OPTIONS.addOption
(OptionBuilder
.hasArg(false)
@@ -146,6 +149,7 @@ class Load extends Command {
.withDescription("Log parameter values as key-value " +
"pairs in FILE")
.create());*/
+ logger.debug("Static initalizer finished.");
}
/**
diff --git a/ccm-core/src/com/arsdigita/packaging/Set.java b/ccm-core/src/com/arsdigita/packaging/Set.java
index f0a08cb12..23ef5c096 100755
--- a/ccm-core/src/com/arsdigita/packaging/Set.java
+++ b/ccm-core/src/com/arsdigita/packaging/Set.java
@@ -28,6 +28,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
+import org.apache.log4j.Logger;
/**
* Set
@@ -43,6 +44,7 @@ import org.apache.commons.cli.PosixParser;
class Set extends Command {
+ private final static Logger logger = Logger.getLogger(Set.class);
public final static String versionId =
"$Id: Set.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
@@ -51,12 +53,14 @@ class Set extends Command {
private static final Options OPTIONS = getOptions();
static {
+ logger.debug("Static initalizer starting...");
OPTIONS.addOption
(OptionBuilder
.hasArg(false)
.withLongOpt("interactive")
.withDescription("Interactively edit configuration values")
.create());
+ logger.debug("Static initalizer finished.");
}
public Set() {
diff --git a/ccm-core/src/com/arsdigita/packaging/Unload.java b/ccm-core/src/com/arsdigita/packaging/Unload.java
index b221f5d33..1c14ae409 100755
--- a/ccm-core/src/com/arsdigita/packaging/Unload.java
+++ b/ccm-core/src/com/arsdigita/packaging/Unload.java
@@ -29,6 +29,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
+import org.apache.log4j.Logger;
/**
* Unload
@@ -39,6 +40,7 @@ import org.apache.commons.cli.PosixParser;
class Unload extends Command {
+ private static final Logger logger = Logger.getLogger(Unload.class);
public final static String versionId =
"$Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $" +
" by $Author: sskracic $, " +
@@ -47,20 +49,24 @@ class Unload extends Command {
private static final Options OPTIONS = new Options();
static {
+ logger.debug("Static initalizer starting...");
OPTIONS.addOption
(OptionBuilder
.hasArg(false)
.withLongOpt("config")
.withDescription("Unload configuration")
.create());
+ logger.debug("Static initalizer finished.");
}
private static final Set EXCLUDE = new HashSet();
static {
+ logger.debug("Static initalizer starting...");
EXCLUDE.add("resin.conf");
EXCLUDE.add("resin.pid");
EXCLUDE.add("server.xml");
+ logger.debug("Static initalizer finished.");
}
public Unload() {
diff --git a/ccm-core/src/com/arsdigita/packaging/Upgrade.java b/ccm-core/src/com/arsdigita/packaging/Upgrade.java
index 513bde261..131826bf6 100755
--- a/ccm-core/src/com/arsdigita/packaging/Upgrade.java
+++ b/ccm-core/src/com/arsdigita/packaging/Upgrade.java
@@ -41,6 +41,7 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
+import org.apache.log4j.Logger;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
@@ -52,6 +53,7 @@ import org.xml.sax.helpers.DefaultHandler;
*/
class Upgrade extends Command {
+ private static final Logger logger = Logger.getLogger(Upgrade.class);
private static final Options s_options = getOptions();
private String m_from;
@@ -59,6 +61,7 @@ class Upgrade extends Command {
private final List m_scripts;
static {
+ logger.debug("Static initalizer starting...");
s_options.addOption
(OptionBuilder
.isRequired()
@@ -79,6 +82,7 @@ class Upgrade extends Command {
.withLongOpt("parameters")
.withDescription("Parameters to pass to upgrade scripts")
.create());
+ logger.debug("Static initalizer finished.");
}
public Upgrade() {
diff --git a/ccm-core/src/com/arsdigita/persistence/SessionManager.java b/ccm-core/src/com/arsdigita/persistence/SessionManager.java
index 394532a96..338fa529f 100755
--- a/ccm-core/src/com/arsdigita/persistence/SessionManager.java
+++ b/ccm-core/src/com/arsdigita/persistence/SessionManager.java
@@ -55,7 +55,9 @@ public class SessionManager {
private static Set s_beforeFlushProcManagers = new HashSet();
static {
+ s_log.debug("Static initalizer starting...");
addBeforeFlushProcManager(Versions.EPM);
+ s_log.debug("Static initalizer finished.");
}
private static Set s_afterFlushProcManagers = new HashSet();
private static Map s_configurations = new HashMap();
diff --git a/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java b/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java
index 343d4f998..154e4f980 100755
--- a/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java
+++ b/ccm-core/src/com/arsdigita/persistence/pdl/PDL.java
@@ -136,6 +136,7 @@ public class PDL {
new CommandLine(PDL.class.getName(), null);
static {
+ s_log.debug("Static initalizer starting...");
CMD.addSwitch(new PathSwitch(
"-library-path",
"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",
Boolean.FALSE));
CMD.addSwitch(new StringSwitch("-testddl", "no clue", null));
+ s_log.debug("Static initalizer finished.");
}
/**
diff --git a/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java b/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java
index fc2f24279..cd131eb75 100755
--- a/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java
+++ b/ccm-core/src/com/arsdigita/persistence/pdl/SQLRegressionGenerator.java
@@ -73,10 +73,12 @@ import org.apache.log4j.Logger;
*/
public class SQLRegressionGenerator {
+ private static final Logger logger = Logger.getLogger(SQLRegressionGenerator.class);
static final CommandLine CMD =
new CommandLine(PDL.class.getName(), null);
static {
+ logger.debug("Static initalizer starting...");
CMD.addSwitch(new PathSwitch(
"-path",
"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",
Boolean.FALSE));
CMD.addSwitch(new StringSwitch("-database", "target database", null));
+ logger.debug("Static initalizer finished.");
}
/**
diff --git a/ccm-core/src/com/arsdigita/profiler/Profiler.java b/ccm-core/src/com/arsdigita/profiler/Profiler.java
index b341e3a27..54587825a 100755
--- a/ccm-core/src/com/arsdigita/profiler/Profiler.java
+++ b/ccm-core/src/com/arsdigita/profiler/Profiler.java
@@ -7,6 +7,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.log4j.Logger;
/**
* Simple Profiler.
@@ -20,16 +21,19 @@ import java.util.Set;
* @author Alan Pevec
*/
public class Profiler {
-
+
+ private static final Logger logger = Logger.getLogger(Profiler.class);
private static final Set enabledOperations = new HashSet();
// TODO add a configuration page under Developer Support
static {
+ logger.debug("Static initalizer starting...");
enabledOperations.add("APP");
enabledOperations.add("FILT");
enabledOperations.add("CMS");
enabledOperations.add("XML");
enabledOperations.add("DB");
enabledOperations.add("XSLT");
+ logger.debug("Static initalizer finished.");
}
private static ProfilerConfig config = null;
diff --git a/ccm-core/src/com/arsdigita/search/QueryEngineRegistry.java b/ccm-core/src/com/arsdigita/search/QueryEngineRegistry.java
index bacc67243..481993818 100755
--- a/ccm-core/src/com/arsdigita/search/QueryEngineRegistry.java
+++ b/ccm-core/src/com/arsdigita/search/QueryEngineRegistry.java
@@ -44,9 +44,11 @@ public class QueryEngineRegistry {
Logger.getLogger(QueryEngineRegistry.class);
static {
+ s_log.debug("Static initalizer starting...");
registerEngine(IndexerType.NOOP,
new FilterType[] {},
new NoopQueryEngine());
+ s_log.debug("Static initalizer finished.");
}
/**
diff --git a/ccm-core/src/com/arsdigita/sitenode/ServletErrorReport.java b/ccm-core/src/com/arsdigita/sitenode/ServletErrorReport.java
index 273ccd7bf..a1cb41552 100755
--- a/ccm-core/src/com/arsdigita/sitenode/ServletErrorReport.java
+++ b/ccm-core/src/com/arsdigita/sitenode/ServletErrorReport.java
@@ -35,6 +35,7 @@ import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.PersonName;
+import org.apache.log4j.Logger;
/**
* This is an advanced servlet error report generator
@@ -44,6 +45,8 @@ import com.arsdigita.kernel.PersonName;
* (guru meditation) code.
*/
public class ServletErrorReport extends ErrorReport {
+
+ private static final Logger logger = Logger.getLogger(ServletErrorReport.class);
/**
* The name of the Servlet request attribute which will
* contain the guru meditation code
@@ -52,16 +55,18 @@ public class ServletErrorReport extends ErrorReport {
public static final String GURU_ERROR_REPORT = "guruErrorReport";
static {
+ logger.debug("Static initalizer starting...");
Exceptions.registerUnwrapper(
- ServletException.class,
- new ExceptionUnwrapper() {
- public Throwable unwrap(Throwable t) {
- ServletException ex = (ServletException)t;
- return ex.getRootCause();
- }
- });
- }
+ ServletException.class,
+ new ExceptionUnwrapper() {
+ public Throwable unwrap(Throwable t) {
+ ServletException ex = (ServletException) t;
+ return ex.getRootCause();
+ }
+ });
+ logger.debug("Static initalizer finished.");
+ }
private HttpServletRequest m_request;
private HttpServletResponse m_response;
@@ -72,7 +77,7 @@ public class ServletErrorReport extends ErrorReport {
m_request = request;
m_response = response;
-
+
// Take great care such that if something goes
// wrong while creating the error report, we don't
// let the new exception propagate thus loosing the
@@ -110,11 +115,11 @@ public class ServletErrorReport extends ErrorReport {
private void addRequest() {
ArrayList lines = new ArrayList();
- lines.add("Context path: "+ m_request.getContextPath());
- lines.add("Request URI: "+ m_request.getRequestURI());
- lines.add("Query string: "+ m_request.getQueryString());
- lines.add("Method: "+ m_request.getMethod());
- lines.add("Remote user: "+ m_request.getRemoteUser());
+ lines.add("Context path: " + m_request.getContextPath());
+ lines.add("Request URI: " + m_request.getRequestURI());
+ lines.add("Query string: " + m_request.getQueryString());
+ lines.add("Method: " + m_request.getMethod());
+ lines.add("Remote user: " + m_request.getRemoteUser());
addSection("Request summary", lines);
}
@@ -127,9 +132,9 @@ public class ServletErrorReport extends ErrorReport {
String lines[] = new String[cookies.length];
- for (int i = 0 ; i < lines.length ;i++) {
- lines[i] = cookies[i].getName() + ": " + cookies[i].getValue() +
- " (expires: " + cookies[i].getMaxAge() + ")";
+ for (int i = 0; i < lines.length; i++) {
+ lines[i] = cookies[i].getName() + ": " + cookies[i].getValue()
+ + " (expires: " + cookies[i].getMaxAge() + ")";
}
addSection("Cookies", lines);
@@ -139,14 +144,14 @@ public class ServletErrorReport extends ErrorReport {
User user;
Party party = Kernel.getContext().getParty();
- if ( party == null ) {
+ if (party == null) {
addSection("CCM User", "Party not logged in");
} else {
String lines[] = new String[5];
lines[0] = "Party ID: " + party.getID();
lines[1] = "Email address: " + party.getPrimaryEmail().toString();
- if ( party instanceof User ) {
+ if (party instanceof User) {
user = (User) party;
PersonName name = null;
@@ -186,9 +191,9 @@ public class ServletErrorReport extends ErrorReport {
Enumeration props = m_request.getAttributeNames();
while (props.hasMoreElements()) {
- String key = (String)props.nextElement();
- if (GURU_ERROR_REPORT.equals(key) ||
- GURU_MEDITATION_CODE.equals(key)) {
+ String key = (String) props.nextElement();
+ if (GURU_ERROR_REPORT.equals(key)
+ || GURU_MEDITATION_CODE.equals(key)) {
continue;
}
Object value = m_request.getAttribute(key);
@@ -203,7 +208,7 @@ public class ServletErrorReport extends ErrorReport {
Enumeration props = m_request.getHeaderNames();
while (props.hasMoreElements()) {
- String key = (String)props.nextElement();
+ String key = (String) props.nextElement();
String value = m_request.getHeader(key);
data.add(key + ": " + value);
}
diff --git a/ccm-core/src/com/arsdigita/templating/ApplyTemplates.java b/ccm-core/src/com/arsdigita/templating/ApplyTemplates.java
index eefa4be39..75f867636 100755
--- a/ccm-core/src/com/arsdigita/templating/ApplyTemplates.java
+++ b/ccm-core/src/com/arsdigita/templating/ApplyTemplates.java
@@ -57,6 +57,7 @@ public class ApplyTemplates {
"-loop [count] -log [loglevel] -verbose -warmup [count] Stylesheet Input Output "
);
static {
+ s_log.debug("Static initalizer starting...");
s_cmd.addSwitch(new StringSwitch(OPT_LOG,
"Log4j debug level",
"warn"));
@@ -69,6 +70,7 @@ public class ApplyTemplates {
s_cmd.addSwitch(new BooleanSwitch(OPT_VERBOSE,
"Display progress",
Boolean.FALSE));
+ s_log.debug("Static initalizer finished.");
}
public final static void main(String[] args) {
diff --git a/ccm-core/src/com/arsdigita/templating/PatternStylesheetResolver.java b/ccm-core/src/com/arsdigita/templating/PatternStylesheetResolver.java
index 2c0507aa8..930c6e8ed 100755
--- a/ccm-core/src/com/arsdigita/templating/PatternStylesheetResolver.java
+++ b/ccm-core/src/com/arsdigita/templating/PatternStylesheetResolver.java
@@ -134,6 +134,7 @@ public class PatternStylesheetResolver implements StylesheetResolver {
}
static {
+ s_log.debug("Static initalizer starting...");
registerPatternGenerator
("locale", new LocalePatternGenerator());
registerPatternGenerator
@@ -148,6 +149,7 @@ public class PatternStylesheetResolver implements StylesheetResolver {
("webapps", new WebAppPatternGenerator());
registerPatternGenerator
("host", new HostPatternGenerator());
+ s_log.debug("Static initalizer finished.");
}
private String m_path = null;
diff --git a/ccm-core/src/com/arsdigita/templating/Templating.java b/ccm-core/src/com/arsdigita/templating/Templating.java
index 3883455c0..b9b67e2c7 100755
--- a/ccm-core/src/com/arsdigita/templating/Templating.java
+++ b/ccm-core/src/com/arsdigita/templating/Templating.java
@@ -17,7 +17,7 @@
*/
package com.arsdigita.templating;
-import com.arsdigita.bebop.Bebop;
+import com.arsdigita.bebop.Bebop;
import com.arsdigita.caching.CacheTable;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.util.Assert;
@@ -58,49 +58,47 @@ import org.apache.log4j.Logger;
public class Templating {
private static final Logger s_log = Logger.getLogger(Templating.class);
-
// just a tag to assure an implementation exists
// public static final Class DEFAULT_PRESENTATION_MANAGER
// = SimplePresentationManager.class;
-
/**
* This is the name of the attribute that is set in the request whose
* value, if present, is a collection of TransformerExceptions that
* can be used to produce a "pretty" error.
*/
public static final String FANCY_ERROR_COLLECTION = "fancyErrorCollection";
-
// this was instantiated with hardcoded values, not anymore
private static CacheTable s_templates = null;
private static final TemplatingConfig s_config = new TemplatingConfig();
static {
+ s_log.debug("Static initalizer starting...");
s_config.load("ccm-core/templating.properties");
- }
-
- static {
- Exceptions.registerUnwrapper(
- TransformerException.class,
- new ExceptionUnwrapper() {
- public Throwable unwrap(Throwable t) {
- TransformerException ex = (TransformerException)t;
- return ex.getCause();
- }
- });
- }
- // now we initiate the CacheTable here
- static {
+ Exceptions.registerUnwrapper(
+ TransformerException.class,
+ new ExceptionUnwrapper() {
+
+ public Throwable unwrap(Throwable t) {
+ TransformerException ex = (TransformerException) t;
+ return ex.getCause();
+ }
+ });
+
+ // now we initiate the CacheTable here
+
// default cache size used to be 50, which is too high I reckon,
// each template can eat up to 4 megs
Integer setting = s_config.getCacheSize();
int cacheSize = (setting == null ? 10 : setting.intValue());
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.setPurgeAllowed(true);
+
+ s_log.debug("Static initalizer finished...");
}
/**
@@ -150,7 +148,7 @@ public class Templating {
public static synchronized XSLTemplate getTemplate(final URL source) {
return getTemplate(source, false, true);
}
-
+
/**
* Retrieves an XSL template. If the template is already loaded in the
* cache, it will be returned. If the template has been modified since
@@ -184,8 +182,8 @@ public class Templating {
if (template == null) {
if (s_log.isInfoEnabled()) {
- s_log.info("The template for URL " + source + " is not " +
- "cached; creating and caching it now");
+ s_log.info("The template for URL " + source + " is not "
+ + "cached; creating and caching it now");
}
if (fancyErrors) {
@@ -207,8 +205,8 @@ public class Templating {
// probably on UtilConfig.
if (s_log.isInfoEnabled()) {
- s_log.info("Template " + template + " has been modified; " +
- "recreating it from scratch");
+ s_log.info("Template " + template + " has been modified; "
+ + "recreating it from scratch");
}
if (fancyErrors) {
@@ -304,11 +302,11 @@ public class Templating {
root.addAttribute("version", "1.0");
while (paths.hasNext()) {
- URL path = (URL)paths.next();
+ URL path = (URL) paths.next();
Element imp = root.newChildElement(
- "xsl:import",
- "http://www.w3.org/1999/XSL/Transform");
+ "xsl:import",
+ "http://www.w3.org/1999/XSL/Transform");
imp.addAttribute("href", path.toString());
if (s_log.isInfoEnabled()) {
@@ -338,9 +336,12 @@ public class Templating {
HttpHost self = Web.getConfig().getHost();
String path = url.getPath();
- if (self.getName().equals(url.getHost()) &&
- ((self.getPort() == url.getPort()) ||
- (url.getPort() == -1 && self.getPort() == 80))) {
+ if (self.getName().equals(url.getHost()) && ((self.getPort() == url.
+ getPort()) || (url.getPort()
+ == -1
+ && self.
+ getPort()
+ == 80))) {
if (path.startsWith("/resource")) {
// A virtual path to the servlet
@@ -352,14 +353,15 @@ public class Templating {
return newURL;
} else {
// A real path to disk
- final String filename = Web.getServletContext().getRealPath(path);
+ final String filename =
+ Web.getServletContext().getRealPath(path);
File file = new File(filename);
if (file.exists()) {
try {
URL newURL = file.toURL();
if (s_log.isDebugEnabled()) {
- s_log.debug("Transforming resource " +
- url + " to " + newURL);
+ s_log.debug("Transforming resource " + url + " to "
+ + newURL);
}
return newURL;
} catch (MalformedURLException ex) {
@@ -367,7 +369,8 @@ public class Templating {
}
} else {
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,34 +385,34 @@ public class Templating {
}
class LoggingErrorListener implements ErrorListener {
- private static final Logger s_log =
- Logger.getLogger(LoggingErrorListener.class);
+ private static final Logger s_log =
+ Logger.getLogger(LoggingErrorListener.class);
private ArrayList m_errors;
-
+
LoggingErrorListener() {
m_errors = new ArrayList();
}
-
+
public Collection getErrors() {
return m_errors;
}
-
+
public void warning(TransformerException e) throws TransformerException {
log(Level.WARN, e);
}
-
+
public void error(TransformerException e) throws TransformerException {
log(Level.ERROR, e);
}
-
+
public void fatalError(TransformerException e) throws TransformerException {
log(Level.FATAL, e);
}
-
+
private void log(Level level, TransformerException ex) {
- s_log.log(level, "Transformer " + level + ": " +
- ex.getLocationAsString() + ": " + ex.getMessage(),
+ s_log.log(level, "Transformer " + level + ": "
+ + ex.getLocationAsString() + ": " + ex.getMessage(),
ex);
m_errors.add(ex);
}
diff --git a/ccm-core/src/com/arsdigita/templating/html/XHTMLParser.java b/ccm-core/src/com/arsdigita/templating/html/XHTMLParser.java
index 199c07adb..c571f527f 100755
--- a/ccm-core/src/com/arsdigita/templating/html/XHTMLParser.java
+++ b/ccm-core/src/com/arsdigita/templating/html/XHTMLParser.java
@@ -60,8 +60,10 @@ public class XHTMLParser implements HTMLParser {
private final static Set s_emptyTags = new HashSet();
static {
+ s_log.debug("Static initalizer is starting...");
s_emptyTags.add("br");
s_emptyTags.add("hr");
+ s_log.debug("Static initalizer finished.");
}
private final Set m_tags;
diff --git a/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java b/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java
index e02e818ca..a60d4da88 100755
--- a/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java
+++ b/ccm-core/src/com/arsdigita/toolbox/CharsetEncodingProvider.java
@@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
+import org.apache.log4j.Logger;
/**
* Class.
@@ -32,8 +33,12 @@ import org.apache.commons.beanutils.converters.ClassConverter;
*/
public class ClassParameter extends AbstractParameter {
+ private static final Logger logger = Logger.getLogger(ClassParameter.class);
+
static {
+ logger.debug("Static initalizer starting...");
Converters.set(Class.class, new ClassConverter());
+ logger.debug("Static initalizer finished.");
}
public ClassParameter(final String name) {
diff --git a/ccm-core/src/com/arsdigita/util/parameter/IntegerParameter.java b/ccm-core/src/com/arsdigita/util/parameter/IntegerParameter.java
index 89597a737..834d30d12 100755
--- a/ccm-core/src/com/arsdigita/util/parameter/IntegerParameter.java
+++ b/ccm-core/src/com/arsdigita/util/parameter/IntegerParameter.java
@@ -19,6 +19,7 @@
package com.arsdigita.util.parameter;
import org.apache.commons.beanutils.converters.IntegerConverter;
+import org.apache.log4j.Logger;
/**
* A parameter representing a Java Integer.
@@ -32,8 +33,12 @@ import org.apache.commons.beanutils.converters.IntegerConverter;
*/
public class IntegerParameter extends AbstractParameter {
+ private final static Logger logger = Logger.getLogger(IntegerParameter.class);
+
static {
+ logger.debug("Static initalizer starting...");
Converters.set(Integer.class, new IntegerConverter());
+ logger.debug("Static initalizer finished.");
}
public IntegerParameter(final String name) {
diff --git a/ccm-core/src/com/arsdigita/util/parameter/ParameterPrinter.java b/ccm-core/src/com/arsdigita/util/parameter/ParameterPrinter.java
index 7fa95fb1d..baf17dd2c 100755
--- a/ccm-core/src/com/arsdigita/util/parameter/ParameterPrinter.java
+++ b/ccm-core/src/com/arsdigita/util/parameter/ParameterPrinter.java
@@ -58,6 +58,7 @@ final class ParameterPrinter {
private static final Options OPTIONS = new Options();
static {
+ s_log.debug("Static initalizer starting...");
OPTIONS.addOption
(OptionBuilder
.hasArg(false)
@@ -77,6 +78,7 @@ final class ParameterPrinter {
.withArgName("FILE")
.withDescription("Use list of additional Config classes from FILE")
.create());
+ s_log.debug("Static initalizer starting...");
}
private static void writeXML(final PrintWriter out) {
diff --git a/ccm-core/src/com/arsdigita/util/parameter/StringParameter.java b/ccm-core/src/com/arsdigita/util/parameter/StringParameter.java
index df6d7fe94..e0acf0aa1 100755
--- a/ccm-core/src/com/arsdigita/util/parameter/StringParameter.java
+++ b/ccm-core/src/com/arsdigita/util/parameter/StringParameter.java
@@ -19,6 +19,7 @@
package com.arsdigita.util.parameter;
import org.apache.commons.beanutils.converters.StringConverter;
+import org.apache.log4j.Logger;
/**
* A parameter representing a Java String.
@@ -32,8 +33,12 @@ import org.apache.commons.beanutils.converters.StringConverter;
*/
public class StringParameter extends AbstractParameter {
+ private static final Logger logger = Logger.getLogger(StringParameter.class);
+
static {
+ logger.debug("Static initalizer starting...");
Converters.set(String.class, new StringConverter());
+ logger.debug("Static initalizer finished.");
}
public StringParameter(final String name,
diff --git a/ccm-core/src/com/arsdigita/versioning/Adapter.java b/ccm-core/src/com/arsdigita/versioning/Adapter.java
index 92723bb48..25282c4a3 100755
--- a/ccm-core/src/com/arsdigita/versioning/Adapter.java
+++ b/ccm-core/src/com/arsdigita/versioning/Adapter.java
@@ -56,7 +56,9 @@ final class Adapter {
private static final Map s_converters = new HashMap();
static {
+ s_log.debug("Static initalizer starting...");
initializeAdapters();
+ s_log.debug("Static initalizer finished.");
}
private Adapter() {}
diff --git a/ccm-core/src/com/arsdigita/versioning/DevSupport.java b/ccm-core/src/com/arsdigita/versioning/DevSupport.java
index be7f5bd96..1af155dc2 100755
--- a/ccm-core/src/com/arsdigita/versioning/DevSupport.java
+++ b/ccm-core/src/com/arsdigita/versioning/DevSupport.java
@@ -32,6 +32,7 @@ import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import org.apache.log4j.Logger;
// new versioning
@@ -206,6 +207,8 @@ final class DevSupport {
private static class DependenceFormatter implements GraphFormatter {
+ private static final Logger logger = Logger.getLogger(DependenceFormatter.class);
+
private static final String GRAPH_ATTRS =
GRAPH_ATTRS_HEADER +
" edge[style=invis];\n" +
@@ -229,6 +232,7 @@ final class DevSupport {
private static final Map COLORS = new HashMap();
static {
+ logger.debug("Static initalizer starting...");
COLORS.put(NodeType.VERSIONED_TYPE,
"[fillcolor=Tomato,comment=\"versioned type\"]");
COLORS.put(NodeType.COVERSIONED_TYPE,
@@ -236,6 +240,7 @@ final class DevSupport {
COLORS.put(NodeType.RECOVERABLE,
"[fillcolor=LemonChiffon,comment=recoverable]");
COLORS.put(NodeType.UNREACHABLE, "[comment=unreachable]");
+ logger.debug("Static initalizer finished.");
}
public String graphAttributes(Graph graph) {
diff --git a/ccm-core/src/com/arsdigita/xml/Document.java b/ccm-core/src/com/arsdigita/xml/Document.java
index 8f8f726fc..bca552e3f 100755
--- a/ccm-core/src/com/arsdigita/xml/Document.java
+++ b/ccm-core/src/com/arsdigita/xml/Document.java
@@ -52,14 +52,13 @@ import java.io.UnsupportedEncodingException;
* @since ACS 4.5a
*/
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 =
- Logger.getLogger(Document.class.getName());
-
+ Logger.getLogger(Document.class.getName());
/**
* this is the identity XSL stylesheet. We need to provide the
* identity transform as XSL explicitly because the default
@@ -71,43 +70,41 @@ public class Document {
// to the output doc with DocumentBuilderFactory to use for
* creating Documents.
*/
protected static DocumentBuilderFactory s_builder = null;
-
/**
* A single DocumentBuilder to use for
* creating Documents.
@@ -119,21 +116,23 @@ public class Document {
// instead to achieve independence from a JVM wide configuration.
// Requires additional modifications in c.ad.util.xml.XML
static {
+ s_log.debug("Static initalizer starting...");
s_builder = DocumentBuilderFactory.newInstance();
s_builder.setNamespaceAware(true);
s_db = new ThreadLocal() {
- public Object initialValue() {
- try {
- return s_builder.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- return null;
- }
+
+ public Object initialValue() {
+ try {
+ return s_builder.newDocumentBuilder();
+ } catch (ParserConfigurationException pce) {
+ return null;
}
- };
+ }
+ };
+ s_log.debug("Static initalized finished.");
}
/* Used to build the DOM Documents that this class wraps */
-
/**
* The internal DOM document being wrapped.
*/
@@ -142,11 +141,11 @@ public class Document {
/**
* Creates a new Document class with no root element.
*/
- public Document( ) throws ParserConfigurationException {
- DocumentBuilder db = (DocumentBuilder)s_db.get();
+ public Document() throws ParserConfigurationException {
+ DocumentBuilder db = (DocumentBuilder) s_db.get();
if (db == null) {
- throw new ParserConfigurationException
- ("Unable to create a DocumentBuilder");
+ throw new ParserConfigurationException(
+ "Unable to create a DocumentBuilder");
}
m_document = db.newDocument();
}
@@ -158,7 +157,7 @@ public class 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;
}
@@ -167,11 +166,11 @@ public class Document {
*
* @param rootNode the element to use as the root node
*/
- public Document( Element rootNode ) throws ParserConfigurationException {
- DocumentBuilder db = (DocumentBuilder)s_db.get();
+ public Document(Element rootNode) throws ParserConfigurationException {
+ DocumentBuilder db = (DocumentBuilder) s_db.get();
if (db == null) {
- throw new ParserConfigurationException
- ("Unable to create a DocumentBuilder");
+ throw new ParserConfigurationException(
+ "Unable to create a DocumentBuilder");
}
m_document = db.newDocument();
@@ -183,24 +182,23 @@ public class Document {
* Creates a document from the passed in string that should
* be properly formatted XML
*/
- public Document( String xmlString )
- throws ParserConfigurationException, org.xml.sax.SAXException {
- this(new org.xml.sax.InputSource
- (new java.io.StringReader(xmlString)));
+ public Document(String xmlString)
+ throws ParserConfigurationException, org.xml.sax.SAXException {
+ this(new org.xml.sax.InputSource(new java.io.StringReader(xmlString)));
}
- public Document( byte[] xmlBytes )
- throws ParserConfigurationException, org.xml.sax.SAXException {
- this(new org.xml.sax.InputSource
- (new java.io.ByteArrayInputStream(xmlBytes)));
+ public Document(byte[] xmlBytes)
+ throws ParserConfigurationException, org.xml.sax.SAXException {
+ this(new org.xml.sax.InputSource(new java.io.ByteArrayInputStream(
+ xmlBytes)));
}
- private Document(org.xml.sax.InputSource inputSource)
- throws ParserConfigurationException, org.xml.sax.SAXException {
- DocumentBuilder db = (DocumentBuilder)s_db.get();
+ private Document(org.xml.sax.InputSource inputSource)
+ throws ParserConfigurationException, org.xml.sax.SAXException {
+ DocumentBuilder db = (DocumentBuilder) s_db.get();
if (db == null) {
- throw new ParserConfigurationException
- ("Unable to create a DocumentBuilder");
+ throw new ParserConfigurationException(
+ "Unable to create a DocumentBuilder");
}
org.w3c.dom.Document domDoc;
@@ -218,7 +216,7 @@ public class Document {
* @param rootNode the element to use as the root node
* @return this document.
*/
- public Document setRootElement( Element rootNode ) {
+ public Document setRootElement(Element rootNode) {
rootNode.importInto(m_document);
m_document.appendChild(rootNode.getInternalElement());
@@ -236,7 +234,7 @@ public class Document {
* @param ns the element's namespace URI
* @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);
m_document.appendChild(root);
Element wrapper = new Element();
@@ -254,7 +252,7 @@ public class Document {
* @param elt the element name
* @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);
m_document.appendChild(root);
Element wrapper = new Element();
@@ -273,8 +271,6 @@ public class Document {
return root;
}
-
-
/**
* Not a part of org.jdom.Document, this function returns
* the internal DOM representation of this document. This method should
@@ -283,7 +279,7 @@ public class Document {
*
* @return this document.
*/
- public org.w3c.dom.Document getInternalDocument( ) {
+ public org.w3c.dom.Document getInternalDocument() {
return m_document;
}
@@ -306,9 +302,9 @@ public class Document {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
StreamSource identitySource =
- new StreamSource(new StringReader(identityXSL));
- identity = TransformerFactory.newInstance()
- .newTransformer(identitySource);
+ new StreamSource(new StringReader(identityXSL));
+ identity = TransformerFactory.newInstance().newTransformer(
+ identitySource);
identity.setOutputProperty("method", "xml");
identity.setOutputProperty("indent", (indent ? "yes" : "no"));
identity.setOutputProperty("encoding", "UTF-8");
diff --git a/ccm-core/src/com/arsdigita/xml/XML.java b/ccm-core/src/com/arsdigita/xml/XML.java
index 10bcad536..5e9cb9d99 100755
--- a/ccm-core/src/com/arsdigita/xml/XML.java
+++ b/ccm-core/src/com/arsdigita/xml/XML.java
@@ -53,7 +53,9 @@ public class XML {
private static Map s_formatters = new HashMap();
static {
+ s_log.debug("Static initalizer starting...");
s_formatters.put(Date.class, new DateTimeFormatter());
+ s_log.debug("Static initalizer finished.");
}
private XML() {}
diff --git a/ccm-core/src/com/redhat/persistence/metadata/Column.java b/ccm-core/src/com/redhat/persistence/metadata/Column.java
index b6a449da1..04cf7f0d2 100755
--- a/ccm-core/src/com/redhat/persistence/metadata/Column.java
+++ b/ccm-core/src/com/redhat/persistence/metadata/Column.java
@@ -27,6 +27,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.apache.log4j.Logger;
/**
* 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 $";
+ private static final Logger logger = Logger.getLogger(Column.class);
+
/**
* The name of this Column.
**/
@@ -353,6 +356,7 @@ public class Column extends Element {
private static final Map ORACLE = new HashMap();
static {
+ logger.debug("Static initalizer starting...");
DEFAULT.put(new Integer(Types.ARRAY), "ARRAY");
DEFAULT.put(new Integer(Types.BIGINT), "BIGINT");
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.VARBINARY), "VARBINARY");
DEFAULT.put(new Integer(Types.VARCHAR), "VARCHAR");
+ logger.debug("Static initalizer finished.");
}
private static final String getDatabaseType(int type) {
diff --git a/ccm-core/src/com/redhat/persistence/oql/Static.java b/ccm-core/src/com/redhat/persistence/oql/Static.java
index d3a5bf45d..f5186c86c 100755
--- a/ccm-core/src/com/redhat/persistence/oql/Static.java
+++ b/ccm-core/src/com/redhat/persistence/oql/Static.java
@@ -34,6 +34,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.log4j.Logger;
/**
* Static
@@ -44,6 +45,8 @@ import java.util.Map;
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 $";
private SQL m_sql;
@@ -55,6 +58,7 @@ public class Static extends Expression {
private static final Collection s_functions = new HashSet();
static {
+ logger.debug("Static initalizer starting...");
String[] functions = {
/* sql standard functions supported by both oracle and postgres.
* 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++) {
s_functions.add(functions[i]);
}
+ logger.debug("Static initalizer finished.");
}
private static final boolean isAllowedFunction(String s) {
diff --git a/ccm-core/src/com/redhat/persistence/profiler/rdbms/SQLSummary.java b/ccm-core/src/com/redhat/persistence/profiler/rdbms/SQLSummary.java
index 0ebf28d9c..b4d2d4ef8 100755
--- a/ccm-core/src/com/redhat/persistence/profiler/rdbms/SQLSummary.java
+++ b/ccm-core/src/com/redhat/persistence/profiler/rdbms/SQLSummary.java
@@ -27,6 +27,7 @@ import com.redhat.persistence.common.SQLParser;
import com.redhat.persistence.common.SQLToken;
import java.io.StringReader;
import java.util.HashMap;
+import org.apache.log4j.Logger;
/**
* SQLSummary
@@ -37,6 +38,8 @@ import java.util.HashMap;
class SQLSummary {
+ private static final Logger logger = Logger.getLogger(SQLSummary.class);
+
private static final HashMap SUMMARIES = new HashMap();
public static SQLSummary get(String text) {
@@ -61,10 +64,12 @@ class SQLSummary {
private static final HashMap TYPES = new HashMap();
static {
+ logger.debug("Static initalizer starting...");
TYPES.put("select", new Integer(SELECT));
TYPES.put("insert into", new Integer(INSERT));
TYPES.put("update", new Integer(UPDATE));
TYPES.put("delete from", new Integer(DELETE));
+ logger.debug("Static initalizer finished.");
}
private final int m_type;
diff --git a/ccm-core/src/log4j.properties b/ccm-core/src/log4j.properties
index f5da30c74..05c91b5b7 100755
--- a/ccm-core/src/log4j.properties
+++ b/ccm-core/src/log4j.properties
@@ -65,4 +65,122 @@ log4j.logger.com.arsdigita.packaging.Loader=INFO
#log4j.logger.com.arsdigita.london.importer=DEBUG
#log4j.logger.com.arsdigita.london.terms.importer.TermItemBuilder=DEBUG
#log4j.logger.com.arsdigita.categorization.Category=DEBUG
-log4j.logger.com.arsdigita.london.util.cmd.BulkPublish=DEBUG
\ No newline at end of file
+
+#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
+
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkSearchTable.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkSearchTable.java
index 019c37544..0c90fbabe 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkSearchTable.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkSearchTable.java
@@ -204,11 +204,14 @@ public class CreateDocLinkSearchTable extends Table implements DMConstants{
*/
private static class ActionCellRenderer implements TableCellRenderer {
+ private final static Logger logger = Logger.getLogger(ActionCellRenderer.class);
private static ControlLink s_link;
static {
+ logger.debug("Static initalizer starting...");
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,
diff --git a/ccm-formbuilder-pdf/src/com/arsdigita/formbuilder/pdf/PDFConfig.java b/ccm-formbuilder-pdf/src/com/arsdigita/formbuilder/pdf/PDFConfig.java
index 4c7fa8b0e..6f377bd21 100755
--- a/ccm-formbuilder-pdf/src/com/arsdigita/formbuilder/pdf/PDFConfig.java
+++ b/ccm-formbuilder-pdf/src/com/arsdigita/formbuilder/pdf/PDFConfig.java
@@ -45,12 +45,14 @@ public class PDFConfig extends AbstractConfig {
private static final PDFConfig s_config = new PDFConfig();
static {
+ s_log.debug("Static initalizer starting...");
try {
s_config.load();
} catch (java.lang.IllegalArgumentException ex) {
s_log.info("Unable to load PDFConfig. This is not a problem " +
"during ccm load, but is a problem at all other times");
}
+ s_log.debug("Static initalizer finished.");
}
public PDFConfig() {
diff --git a/ccm-forum/src/com/arsdigita/forum/Forum.java b/ccm-forum/src/com/arsdigita/forum/Forum.java
index 6bcae3f1e..ced7b1af3 100755
--- a/ccm-forum/src/com/arsdigita/forum/Forum.java
+++ b/ccm-forum/src/com/arsdigita/forum/Forum.java
@@ -80,7 +80,9 @@ public class Forum extends Application {
private static final ForumConfig s_config = new ForumConfig();
static {
+ s_log.debug("Static initalizer starting...");
s_config.load();
+ s_log.debug("Static initalizer finished.");
}
public static ForumConfig getConfig() {
diff --git a/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java b/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java
index 25d60d77d..a29e9c385 100644
--- a/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java
+++ b/ccm-forum/src/com/arsdigita/forum/ForumPageFactory.java
@@ -25,6 +25,7 @@ import java.util.Map;
import com.arsdigita.bebop.Page;
// import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.util.Assert;
+import org.apache.log4j.Logger;
/**
* Factory class that enables projects to provide their own page creators.
@@ -35,38 +36,37 @@ import com.arsdigita.util.Assert;
*/
public class ForumPageFactory {
- public static final String THREAD_PAGE = "thread";
- public static final String FORUM_PAGE = "forum";
-
- private static Map pageBuilders = new HashMap();
-
- static {
- // default pageBuilders are those provided with this project
- pageBuilders.put(THREAD_PAGE, new ThreadPageBuilder());
- pageBuilders.put(FORUM_PAGE, new ForumPageBuilder());
- }
-
+ private static final Logger logger = Logger.getLogger(ForumPageFactory.class);
+ public static final String THREAD_PAGE = "thread";
+ public static final String FORUM_PAGE = "forum";
+ private static Map pageBuilders = new HashMap();
+
+ static {
+ logger.debug("Static initalizer starting...");
+ // default pageBuilders are those provided with this project
+ pageBuilders.put(THREAD_PAGE, new ThreadPageBuilder());
+ pageBuilders.put(FORUM_PAGE, new ForumPageBuilder());
+ logger.debug("Static initalizer finished.");
+ }
+
public static Page getPage(String pageType) {
Assert.isTrue(pageBuilders.containsKey(pageType),
- "Requested page type (" + pageType +
- ") does not have a builder registered" );
- PageBuilder builder = (PageBuilder)pageBuilders.get(pageType);
- Page page = builder.buildPage();
- page.lock();
- return page;
-
-
- }
-
- public static Iterator getPages () {
- return pageBuilders.keySet().iterator();
- }
-
-
- public static void registerPageBuilder (String pageType, PageBuilder builder) {
- pageBuilders.put(pageType, builder);
-
- }
-
+ "Requested page type (" + pageType
+ + ") does not have a builder registered");
+ PageBuilder builder = (PageBuilder) pageBuilders.get(pageType);
+ Page page = builder.buildPage();
+ page.lock();
+ return page;
+
+ }
+
+ public static Iterator getPages() {
+ return pageBuilders.keySet().iterator();
+ }
+
+ public static void registerPageBuilder(String pageType, PageBuilder builder) {
+ pageBuilders.put(pageType, builder);
+
+ }
}
diff --git a/ccm-forum/src/com/arsdigita/forum/ui/TopicsList.java b/ccm-forum/src/com/arsdigita/forum/ui/TopicsList.java
index a79420dd5..ffd9b6c1c 100755
--- a/ccm-forum/src/com/arsdigita/forum/ui/TopicsList.java
+++ b/ccm-forum/src/com/arsdigita/forum/ui/TopicsList.java
@@ -31,6 +31,7 @@ import com.arsdigita.forum.ForumContext;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
+import org.apache.log4j.Logger;
/**
@@ -46,14 +47,17 @@ import java.util.Iterator;
*/
public class TopicsList extends SimpleComponent implements Constants {
+ private static final Logger logger = Logger.getLogger(TopicsList.class);
/** List of properties a topic may have. */
private final static Set s_catProps;
static {
+ logger.debug("Static initalizer starting...");
s_catProps = new HashSet();
s_catProps.add("id");
s_catProps.add("name");
s_catProps.add("numThreads");
s_catProps.add("latestPost");
+ logger.debug("Static initalizer finished.");
}
/**
diff --git a/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java b/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
index 7d31607f7..56da85a78 100755
--- a/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
+++ b/ccm-gen-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
@@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
package com.arsdigita.aplaws;
import com.arsdigita.xml.Element;
@@ -26,18 +25,16 @@ import com.arsdigita.persistence.metadata.Property;
import java.util.HashMap;
import java.util.Stack;
import java.math.BigDecimal;
+import org.apache.log4j.Logger;
public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
+ private static final Logger logger = Logger.getLogger(ObjectTypeSchemaGenerator.class);
private boolean m_wrapRoot = false;
private boolean m_wrapObjects = false;
private boolean m_wrapAttributes = false;
-
-
-
private Stack m_history = new Stack();
private HashMap m_elements = new HashMap();
-
// The xs:element
private Element m_element;
// The (optional) xs:complexType
@@ -47,41 +44,39 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// The (optional property
private Property m_property;
private Stack m_properties = new Stack();
-
private Element m_root;
private String m_rootName;
-
public static final String SCHEMA_PREFIX = "xs:";
-
- public static final String SCHEMA_NS =
- "http://www.w3.org/2001/XMLSchema";
-
+ public static final String SCHEMA_NS =
+ "http://www.w3.org/2001/XMLSchema";
private static HashMap s_types = new HashMap();
+
static {
+ logger.debug("Static initalizer starting...");
s_types.put(String.class, "xs:string");
s_types.put(Boolean.class, "xs:boolean");
s_types.put(Integer.class, "xs:integer");
s_types.put(BigDecimal.class, "xs:double");
+ logger.debug("Static initalizer finished.");
}
protected static String lookupType(Class klass) {
if (s_types.containsKey(klass)) {
- return (String)s_types.get(klass);
+ return (String) s_types.get(klass);
}
return "xs:string";
}
-
+
public static void registerType(Class klass, String type) {
s_types.put(klass, type);
}
-
public ObjectTypeSchemaGenerator(String rootName,
String namespace) {
m_root = new Element(SCHEMA_PREFIX + "schema",
SCHEMA_NS);
m_rootName = rootName;
-
+
// Set the namespace for nodes defined by the schema
m_root.addAttribute("targetNamespace", namespace);
// Set the default namespace for unqualified nodes
@@ -95,7 +90,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
return m_root;
}
-
/**
* Determines XML output for root object.
* If set to true a separate element will
@@ -143,20 +137,23 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
m_sequence = sequence;
}
-
+
Element parent;
String name;
if (m_element == null) {
if (m_wrapRoot) {
- Element element = m_root.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_root.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", m_rootName);
-
- Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
+
+ Element type = element.newChildElement(SCHEMA_PREFIX
+ + "complexType",
SCHEMA_NS);
- Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
-
+
parent = sequence;
name = nameFromPath(path);
} else {
@@ -186,17 +183,17 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
-
+
Element oid = type.newChildElement(SCHEMA_PREFIX + "attribute",
SCHEMA_NS);
oid.addAttribute("name", "oid");
oid.addAttribute("type", "xs:string");
-
+
// Add to the path -> element map, not that we use this info yet
m_elements.put(path, element);
// 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_type = type;
@@ -209,7 +206,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
*/
protected void endObject(ObjectType obj,
String path) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
@@ -223,7 +220,8 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapAttributes) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
@@ -232,7 +230,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
element.addAttribute("name", property.getName());
// XXX pdl type -> xs type mapping
- element.addAttribute("type",lookupType(property.getJavaClass()));
+ element.addAttribute("type", lookupType(property.getJavaClass()));
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
@@ -240,7 +238,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_sequence.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
} else {
@@ -256,7 +254,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_type.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
}
@@ -271,26 +269,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -307,12 +307,12 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
/**
@@ -324,26 +324,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -360,12 +362,11 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
-
}
diff --git a/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java b/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
index 7d31607f7..56da85a78 100755
--- a/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
+++ b/ccm-ldn-aplaws/src/com/arsdigita/aplaws/ObjectTypeSchemaGenerator.java
@@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
package com.arsdigita.aplaws;
import com.arsdigita.xml.Element;
@@ -26,18 +25,16 @@ import com.arsdigita.persistence.metadata.Property;
import java.util.HashMap;
import java.util.Stack;
import java.math.BigDecimal;
+import org.apache.log4j.Logger;
public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
+ private static final Logger logger = Logger.getLogger(ObjectTypeSchemaGenerator.class);
private boolean m_wrapRoot = false;
private boolean m_wrapObjects = false;
private boolean m_wrapAttributes = false;
-
-
-
private Stack m_history = new Stack();
private HashMap m_elements = new HashMap();
-
// The xs:element
private Element m_element;
// The (optional) xs:complexType
@@ -47,41 +44,39 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// The (optional property
private Property m_property;
private Stack m_properties = new Stack();
-
private Element m_root;
private String m_rootName;
-
public static final String SCHEMA_PREFIX = "xs:";
-
- public static final String SCHEMA_NS =
- "http://www.w3.org/2001/XMLSchema";
-
+ public static final String SCHEMA_NS =
+ "http://www.w3.org/2001/XMLSchema";
private static HashMap s_types = new HashMap();
+
static {
+ logger.debug("Static initalizer starting...");
s_types.put(String.class, "xs:string");
s_types.put(Boolean.class, "xs:boolean");
s_types.put(Integer.class, "xs:integer");
s_types.put(BigDecimal.class, "xs:double");
+ logger.debug("Static initalizer finished.");
}
protected static String lookupType(Class klass) {
if (s_types.containsKey(klass)) {
- return (String)s_types.get(klass);
+ return (String) s_types.get(klass);
}
return "xs:string";
}
-
+
public static void registerType(Class klass, String type) {
s_types.put(klass, type);
}
-
public ObjectTypeSchemaGenerator(String rootName,
String namespace) {
m_root = new Element(SCHEMA_PREFIX + "schema",
SCHEMA_NS);
m_rootName = rootName;
-
+
// Set the namespace for nodes defined by the schema
m_root.addAttribute("targetNamespace", namespace);
// Set the default namespace for unqualified nodes
@@ -95,7 +90,6 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
return m_root;
}
-
/**
* Determines XML output for root object.
* If set to true a separate element will
@@ -143,20 +137,23 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
m_sequence = sequence;
}
-
+
Element parent;
String name;
if (m_element == null) {
if (m_wrapRoot) {
- Element element = m_root.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_root.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", m_rootName);
-
- Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
+
+ Element type = element.newChildElement(SCHEMA_PREFIX
+ + "complexType",
SCHEMA_NS);
- Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
-
+
parent = sequence;
name = nameFromPath(path);
} else {
@@ -186,17 +183,17 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
-
+
Element oid = type.newChildElement(SCHEMA_PREFIX + "attribute",
SCHEMA_NS);
oid.addAttribute("name", "oid");
oid.addAttribute("type", "xs:string");
-
+
// Add to the path -> element map, not that we use this info yet
m_elements.put(path, element);
// 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_type = type;
@@ -209,7 +206,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
*/
protected void endObject(ObjectType obj,
String path) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
@@ -223,7 +220,8 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapAttributes) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
@@ -232,7 +230,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
SCHEMA_NS);
element.addAttribute("name", property.getName());
// XXX pdl type -> xs type mapping
- element.addAttribute("type",lookupType(property.getJavaClass()));
+ element.addAttribute("type", lookupType(property.getJavaClass()));
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
@@ -240,7 +238,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_sequence.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
} else {
@@ -256,7 +254,7 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
// Add to element
m_type.addContent(element);
-
+
// Add to the path -> element map
m_elements.put(path, element);
}
@@ -271,26 +269,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -307,12 +307,12 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
/**
@@ -324,26 +324,28 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
Property property) {
if (m_wrapObjects) {
if (m_sequence == null) {
- Element sequence = m_type.newChildElement(SCHEMA_PREFIX + "sequence",
+ Element sequence = m_type.newChildElement(SCHEMA_PREFIX
+ + "sequence",
SCHEMA_NS);
m_sequence = sequence;
}
- Element element = m_sequence.newChildElement(SCHEMA_PREFIX + "element",
+ Element element = m_sequence.newChildElement(SCHEMA_PREFIX
+ + "element",
SCHEMA_NS);
element.addAttribute("name", property.getName());
if (property.isNullable()) {
element.addAttribute("minOccurs", "0");
}
-
+
Element type = element.newChildElement(SCHEMA_PREFIX + "complexType",
SCHEMA_NS);
Element sequence = type.newChildElement(SCHEMA_PREFIX + "sequence",
SCHEMA_NS);
-
+
// 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_type = type;
m_sequence = sequence;
@@ -360,12 +362,11 @@ public class ObjectTypeSchemaGenerator extends ObjectTypeTraversal {
String path,
Property property) {
if (m_wrapObjects) {
- Element[] saved = (Element[])m_history.pop();
+ Element[] saved = (Element[]) m_history.pop();
m_element = saved[0];
m_type = saved[1];
m_sequence = saved[2];
}
- m_property = (Property)m_properties.pop();
+ m_property = (Property) m_properties.pop();
}
-
}
diff --git a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZ.java b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZ.java
index a50aad681..ee0fe8b72 100755
--- a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZ.java
+++ b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZ.java
@@ -33,19 +33,23 @@ import com.arsdigita.util.Assert;
import java.util.List;
import java.util.ArrayList;
+import org.apache.log4j.Logger;
/**
* Base class of the AtoZ application (module)
*
*/
public class AtoZ extends Application {
-
+
+ private static final Logger logger = Logger.getLogger(AtoZ.class);
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.london.atoz.AtoZ";
private static final AtoZConfig s_config = new AtoZConfig();
static {
+ logger.debug("Static initializer is starting...");
s_config.load();
+ logger.debug("Static initializer is finished.");
}
public static final AtoZConfig getConfig() {
diff --git a/ccm-ldn-dublin/src/com/arsdigita/london/cms/dublin/DublinCoreItem.java b/ccm-ldn-dublin/src/com/arsdigita/london/cms/dublin/DublinCoreItem.java
index 4f3ccf1f3..f7eab0e00 100755
--- a/ccm-ldn-dublin/src/com/arsdigita/london/cms/dublin/DublinCoreItem.java
+++ b/ccm-ldn-dublin/src/com/arsdigita/london/cms/dublin/DublinCoreItem.java
@@ -24,6 +24,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.util.Assert;
import com.arsdigita.kernel.ACSObject;
import java.util.Date;
+import org.apache.log4j.Logger;
/***
*
@@ -61,12 +62,15 @@ import java.util.Date;
**/
public class DublinCoreItem extends ContentItem {
+ private static final Logger logger = Logger.getLogger(DublinCoreItem.class);
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.london.cms.dublin.DublinCoreItem";
private static final DublinCoreConfig s_config = new DublinCoreConfig();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public static final DublinCoreConfig getConfig() {
diff --git a/ccm-ldn-exporter/src/com/arsdigita/london/exporter/Exporter.java b/ccm-ldn-exporter/src/com/arsdigita/london/exporter/Exporter.java
index 3f20edaf3..00c16b961 100755
--- a/ccm-ldn-exporter/src/com/arsdigita/london/exporter/Exporter.java
+++ b/ccm-ldn-exporter/src/com/arsdigita/london/exporter/Exporter.java
@@ -18,14 +18,19 @@
package com.arsdigita.london.exporter;
+import org.apache.log4j.Logger;
+
public class Exporter {
+ private static final Logger logger = Logger.getLogger(Exporter.class);
private static ExporterConfig s_config = new ExporterConfig();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public static ExporterConfig getConfig() {
diff --git a/ccm-ldn-importer/src/com/arsdigita/london/importer/cms/ItemParser.java b/ccm-ldn-importer/src/com/arsdigita/london/importer/cms/ItemParser.java
index db9a53dde..29b1a068b 100755
--- a/ccm-ldn-importer/src/com/arsdigita/london/importer/cms/ItemParser.java
+++ b/ccm-ldn-importer/src/com/arsdigita/london/importer/cms/ItemParser.java
@@ -105,6 +105,7 @@ public class ItemParser extends DomainObjectParser {
private Date m_archiveDate;
static {
+ s_log.debug("Static initalizer starting...");
s_ignoredProps = new ArrayList();
s_ignoredProps.add(ID);
s_ignoredProps.add(OID_ATTR);
@@ -115,6 +116,7 @@ public class ItemParser extends DomainObjectParser {
s_ignoredProps.add(ARTICLE_ID);
s_ignoredProps.add(DEFAULT_ANCESTORS);
s_ignoredProps.add(DO_NOT_SAVE);
+ s_log.debug("Static initalizer finished.");
}
public ItemParser(File lobDir, DomainObjectMapper mapper) {
diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ApplicationNavigationModel.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ApplicationNavigationModel.java
index b928fafdb..d96c1cd36 100755
--- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ApplicationNavigationModel.java
+++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ApplicationNavigationModel.java
@@ -42,8 +42,10 @@ public class ApplicationNavigationModel implements NavigationModel {
new GenericNavigationModel();
static {
+ s_log.debug("Static initalizer starting...");
register(ContentSection.BASE_DATA_OBJECT_TYPE, new CMSNavigationModel());
register(Navigation.BASE_DATA_OBJECT_TYPE, new DefaultNavigationModel());
+ s_log.debug("Static initalizer finished.");
}
public ACSObject getObject() {
diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/Navigation.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/Navigation.java
index 1a9b70a43..61d6ef756 100755
--- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/Navigation.java
+++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/Navigation.java
@@ -27,10 +27,13 @@ import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Element;
+import org.apache.log4j.Logger;
public class Navigation extends Application {
+ private static final Logger logger = Logger.getLogger(Navigation.class);
+
public static final String NAV_NS =
"http://ccm.redhat.com/london/navigation";
public static final String NAV_PREFIX = "nav";
@@ -42,7 +45,9 @@ public class Navigation extends Application {
private static NavigationContext s_context = new NavigationContext();
static {
+ logger.debug("Static initalizer starting...");
s_config.load();
+ logger.debug("Static initalizer finished.");
}
public static NavigationConfig getConfig() {
diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/TemplateURLs.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/TemplateURLs.java
index 058dc339f..9a3ef8a8e 100755
--- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/TemplateURLs.java
+++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/TemplateURLs.java
@@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
package com.arsdigita.london.navigation.ui;
import com.arsdigita.london.navigation.NavigationConstants;
@@ -30,54 +29,59 @@ import com.arsdigita.xml.Element;
import java.util.Iterator;
import java.util.LinkedList;
+import org.apache.log4j.Logger;
public class TemplateURLs extends SimpleComponent {
+
+ private static final Logger logger = Logger.getLogger(TemplateURLs.class);
private static final String[] s_contexts;
// 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
// for creating contexts.
static {
+ logger.debug("Static initalizer starting...");
TemplateContextCollection templates = TemplateContext.retrieveAll();
LinkedList buffer = new LinkedList();
- while( templates.next() ) {
- buffer.add( templates.getTemplateContext().getContext() );
+ while (templates.next()) {
+ buffer.add(templates.getTemplateContext().getContext());
}
s_contexts = new String[buffer.size()];
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();
}
+ logger.debug("Static initalizer finished.");
}
public TemplateURLs() {
super();
}
- public void generateXML( PageState ps, Element p ) {
+ public void generateXML(PageState ps, Element p) {
ContentItem item = CMS.getContext().getContentItem();
- if( null == item ) return;
+ if (null == item) {
+ return;
+ }
Element container = p.newChildElement(
- NavigationConstants.NAV_PREFIX + ":templateContexts",
- NavigationConstants.NAV_NS
- );
- container.addAttribute( "type", item.getContentType().getClassName() );
+ NavigationConstants.NAV_PREFIX + ":templateContexts",
+ NavigationConstants.NAV_NS);
+ container.addAttribute("type", item.getContentType().getClassName());
String sectionPath = item.getContentSection().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(
- NavigationConstants.NAV_PREFIX + ":context",
- NavigationConstants.NAV_NS
- );
- context.addAttribute( "name", s_contexts[i] );
+ NavigationConstants.NAV_PREFIX + ":context",
+ NavigationConstants.NAV_NS);
+ context.addAttribute("name", s_contexts[i]);
String path = sectionPath + "/tem_" + s_contexts[i] + '/' + itemPath;
- context.addAttribute( "path", path );
+ context.addAttribute("path", path);
}
}
}
diff --git a/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java b/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java
index ff4d44e8d..02dd3e22d 100755
--- a/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java
+++ b/ccm-ldn-portal/src/com/arsdigita/london/portal/Workspace.java
@@ -12,7 +12,6 @@
* rights and limitations under the License.
*
*/
-
package com.arsdigita.london.portal;
import org.apache.log4j.Logger;
@@ -38,7 +37,7 @@ import com.arsdigita.london.portal.ui.WorkspaceTheme;
import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.persistence.DataAssociationCursor;
import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.DataQueryDataCollectionAdapter;
import com.arsdigita.persistence.Filter;
@@ -61,34 +60,29 @@ import java.util.LinkedList;
*/
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 {
- s_config.load();
- }
-
- public static WorkspaceConfig getConfig() {
- return s_config;
- }
-
- public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.portal.Workspace";
-
- public static final String PARTY = "party";
-
- public static final String PARTY_ID = PARTY + "." + ACSObject.ID;
-
- public static final String DEFAULT_LAYOUT = "defaultLayout";
-
- public static final String PAGES = "pages";
-
- /**
- * store this as a static variable as it cannot change during the lifetime
- * of the ccm service
- */
- private static Workspace defaultHomepageWorkspace = null;
+ static {
+ s_log.debug("Static initalizer starting...");
+ s_config.load();
+ s_log.debug("Static initalizer finished.");
+ }
+ public static WorkspaceConfig getConfig() {
+ return s_config;
+ }
+ public static final String BASE_DATA_OBJECT_TYPE =
+ "com.arsdigita.london.portal.Workspace";
+ public static final String PARTY = "party";
+ public static final String PARTY_ID = PARTY + "." + ACSObject.ID;
+ public static final String DEFAULT_LAYOUT = "defaultLayout";
+ public static final String PAGES = "pages";
+ /**
+ * store this as a static variable as it cannot change during the lifetime
+ * of the ccm service
+ */
+ private static Workspace defaultHomepageWorkspace = null;
/**
* Constructor
@@ -110,7 +104,6 @@ public class Workspace extends Application {
/*
* public String getContextPath() { return "ccm-ldn-portal"; }
*/
-
/**
*
* @return ServletPath (constant) probably should be synchron with web.xml
@@ -162,16 +155,17 @@ public class Workspace extends Application {
* @return
*/
public static Workspace createWorkspace(String url, String title,
- PageLayout layout, Application parent,
+ PageLayout layout,
+ Application parent,
boolean isPublic) {
if (s_log.isDebugEnabled()) {
s_log.debug("Creating group workspace, isPublic:" + isPublic
- + " on " + url + " with parent "
- + (parent == null ? "none" : parent.getOID().toString()));
+ + " on " + url + " with parent "
+ + (parent == null ? "none" : parent.getOID().toString()));
}
Workspace workspace = (Workspace) Application.createApplication(
- BASE_DATA_OBJECT_TYPE, url, title, parent);
+ BASE_DATA_OBJECT_TYPE, url, title, parent);
workspace.setupGroups(title, isPublic);
workspace.setDefaultLayout(layout);
return workspace;
@@ -188,18 +182,19 @@ public class Workspace extends Application {
* @return
*/
public static Workspace createWorkspace(String url, String title,
- PageLayout layout, Application parent, User owner) {
- if (s_log.isDebugEnabled()) {
- s_log.debug("Creating personal workspace for " + owner.getOID()
- + " on " + url + " with parent "
- + (parent == null ? "none" : parent.getOID().toString()));
- }
+ PageLayout layout,
+ Application parent, User owner) {
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("Creating personal workspace for " + owner.getOID()
+ + " on " + url + " with parent "
+ + (parent == null ? "none" : parent.getOID().toString()));
+ }
- Workspace workspace = (Workspace) Application.createApplication(
- BASE_DATA_OBJECT_TYPE, url, title, parent);
- workspace.setParty(owner);
- workspace.setDefaultLayout(layout);
- return workspace;
+ Workspace workspace = (Workspace) Application.createApplication(
+ BASE_DATA_OBJECT_TYPE, url, title, parent);
+ workspace.setParty(owner);
+ workspace.setDefaultLayout(layout);
+ return workspace;
}
/**
@@ -259,150 +254,149 @@ public class Workspace extends Application {
// super.beforeDelete();
// Category.clearRootForObject(this);
// }
-
// This method wouldn't need to exist if permissioning used
// the associations rather than direct queries which require
// the object to be saved
public void afterSave() {
- super.afterSave();
+ super.afterSave();
- Party party = getParty();
- s_log.debug("Party is " + party.getDisplayName() + " for "
- + this.getTitle());
+ Party party = getParty();
+ s_log.debug("Party is " + party.getDisplayName() + " for "
+ + this.getTitle());
- if (party instanceof User) {
- s_log.debug("Party is a user");
+ if (party instanceof User) {
+ s_log.debug("Party is a user");
- // Personal workspace, so give user full admin
- PermissionDescriptor admin = new PermissionDescriptor(
- PrivilegeDescriptor.ADMIN, this, party);
- PermissionService.grantPermission(admin);
+ // Personal workspace, so give user full admin
+ PermissionDescriptor admin = new PermissionDescriptor(
+ PrivilegeDescriptor.ADMIN, this, party);
+ PermissionService.grantPermission(admin);
- } else if (party instanceof Group) {
- s_log.debug("Party is a group");
+ } else if (party instanceof Group) {
+ s_log.debug("Party is a group");
- // Ensure main group has the required permission
- PermissionDescriptor pd = new PermissionDescriptor(
- getConfig().getWorkspacePartyPrivilege(), this, party);
- PermissionService.grantPermission(pd);
+ // Ensure main group has the required permission
+ PermissionDescriptor pd = new PermissionDescriptor(
+ getConfig().getWorkspacePartyPrivilege(), this, party);
+ PermissionService.grantPermission(pd);
- // Now get (or create) the administrators role & grant it admin
- Group members = (Group) party;
- Role admins = members.getRole("Administrators");
- if (admins == null) {
- admins = members.createRole("Administrators");
- admins.save();
- }
- admins.grantPermission(this, PrivilegeDescriptor.ADMIN);
- }
+ // Now get (or create) the administrators role & grant it admin
+ Group members = (Group) party;
+ Role admins = members.getRole("Administrators");
+ if (admins == null) {
+ admins = members.createRole("Administrators");
+ admins.save();
+ }
+ admins.grantPermission(this, PrivilegeDescriptor.ADMIN);
+ }
- // Set permission context for %all pages
- WorkspacePageCollection pages = getPages();
- while (pages.next()) {
- WorkspacePage page = pages.getPage();
- PermissionService.setContext(page, this);
- }
+ // Set permission context for %all pages
+ WorkspacePageCollection pages = getPages();
+ while (pages.next()) {
+ WorkspacePage page = pages.getPage();
+ PermissionService.setContext(page, this);
+ }
}
private void setupGroups(String title, boolean isPublic) {
- Group members = new Group();
- members.setName(title);
- members.save();
- // set this group as subgroup of workspace application type
- // although workspace applications can be nested, place all
- // member groups directly under main container (rather than reflecting
- // hierarchical structure) because (a) workspace already manages its
- // own groups so doesn't need a hierarchy and (b) hierarchy would
- // mean for a given workspace, role would be on the same level
- // as member groups of sub workspaces - messy & confusing
- getApplicationType().getGroup().addSubgroup(members);
+ Group members = new Group();
+ members.setName(title);
+ members.save();
+ // set this group as subgroup of workspace application type
+ // although workspace applications can be nested, place all
+ // member groups directly under main container (rather than reflecting
+ // hierarchical structure) because (a) workspace already manages its
+ // own groups so doesn't need a hierarchy and (b) hierarchy would
+ // mean for a given workspace, role would be on the same level
+ // as member groups of sub workspaces - messy & confusing
+ getApplicationType().getGroup().addSubgroup(members);
- Role admins = members.createRole("Administrators");
- admins.save();
+ Role admins = members.createRole("Administrators");
+ admins.save();
- if (isPublic) {
- Party thePublic;
- try {
- thePublic = (Party) DomainObjectFactory.newInstance(new OID(
- User.BASE_DATA_OBJECT_TYPE,
- PermissionManager.VIRTUAL_PUBLIC_ID));
- } catch (DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException("cannot find the public",
- ex);
- }
+ if (isPublic) {
+ Party thePublic;
+ try {
+ thePublic = (Party) DomainObjectFactory.newInstance(new OID(
+ User.BASE_DATA_OBJECT_TYPE,
+ PermissionManager.VIRTUAL_PUBLIC_ID));
+ } catch (DataObjectNotFoundException ex) {
+ throw new UncheckedWrapperException("cannot find the public",
+ ex);
+ }
- members.addMemberOrSubgroup(thePublic);
- members.save();
- }
+ members.addMemberOrSubgroup(thePublic);
+ members.save();
+ }
- setParty(members);
+ setParty(members);
}
public static WorkspaceCollection retrieveAll() {
return retrieveAll(null);
}
- public static WorkspaceCollection retrieveAll(Application parent) {
- DataCollection wks = SessionManager.getSession().retrieve(
- BASE_DATA_OBJECT_TYPE);
- if (parent != null) {
- wks.addEqualsFilter("parentResource.id", parent.getID());
- }
+ public static WorkspaceCollection retrieveAll(Application parent) {
+ DataCollection wks = SessionManager.getSession().retrieve(
+ BASE_DATA_OBJECT_TYPE);
+ if (parent != null) {
+ wks.addEqualsFilter("parentResource.id", parent.getID());
+ }
- return new WorkspaceCollection(wks);
- }
+ return new WorkspaceCollection(wks);
+ }
- public Workspace retrieveSubworkspaceForParty(Party owner)
- throws DataObjectNotFoundException {
+ public Workspace retrieveSubworkspaceForParty(Party owner)
+ throws DataObjectNotFoundException {
- DataCollection wks = SessionManager.getSession().retrieve(
- BASE_DATA_OBJECT_TYPE);
+ DataCollection wks = SessionManager.getSession().retrieve(
+ BASE_DATA_OBJECT_TYPE);
- wks.addEqualsFilter("parentResource.id", getID());
- wks.addEqualsFilter(PARTY_ID, owner.getID());
+ wks.addEqualsFilter("parentResource.id", getID());
+ wks.addEqualsFilter(PARTY_ID, owner.getID());
- if (wks.next()) {
- Workspace workspace = (Workspace) Application
- .retrieveApplication(wks.getDataObject());
+ if (wks.next()) {
+ Workspace workspace = (Workspace) Application.retrieveApplication(wks.
+ getDataObject());
- wks.close();
+ wks.close();
- return workspace;
- }
+ return workspace;
+ }
- throw new DataObjectNotFoundException("cannot find workspace for party");
- }
+ throw new DataObjectNotFoundException("cannot find workspace for party");
+ }
- public void delete() {
- clearPages();
+ public void delete() {
+ clearPages();
- super.delete();
- }
+ super.delete();
+ }
- public void clearPages() {
- WorkspacePageCollection pages = getPages();
- while (pages.next()) {
- WorkspacePage page = pages.getPage();
- page.delete();
- }
- }
+ public void clearPages() {
+ WorkspacePageCollection pages = getPages();
+ while (pages.next()) {
+ WorkspacePage page = pages.getPage();
+ page.delete();
+ }
+ }
- public void setDefaultLayout(PageLayout layout) {
- setAssociation(DEFAULT_LAYOUT, layout);
- }
+ public void setDefaultLayout(PageLayout layout) {
+ setAssociation(DEFAULT_LAYOUT, layout);
+ }
- public PageLayout getDefaultLayout() {
- return (PageLayout) DomainObjectFactory
- .newInstance((DataObject) get(DEFAULT_LAYOUT));
- }
+ public PageLayout getDefaultLayout() {
+ return (PageLayout) DomainObjectFactory.newInstance((DataObject) get(
+ DEFAULT_LAYOUT));
+ }
- public void setParty(Party party) {
- setAssociation(PARTY, party);
- }
+ public void setParty(Party party) {
+ setAssociation(PARTY, party);
+ }
- public Party getParty() {
- return (Party) DomainObjectFactory.newInstance((DataObject) get(PARTY));
- }
+ public Party getParty() {
+ return (Party) DomainObjectFactory.newInstance((DataObject) get(PARTY));
+ }
public RoleCollection getRoles() {
Party party = getParty();
@@ -461,12 +455,12 @@ public class Workspace extends Application {
public PartyCollection getNonParticipants() {
DataCollection dc =
- SessionManager.getSession()
- .retrieve("com.arsdigita.kernel.User");
+ SessionManager.getSession().retrieve(
+ "com.arsdigita.kernel.User");
// .retrieve("com.arsdigita.kernel.Party");
- Filter f = dc
- .addNotInSubqueryFilter
- ("id", "com.arsdigita.london.portal.WorkspaceParticipantIDs");
+ Filter f =
+ dc.addNotInSubqueryFilter("id",
+ "com.arsdigita.london.portal.WorkspaceParticipantIDs");
f.set("workspaceID", getID());
return new PartyCollection(dc);
}
@@ -484,8 +478,8 @@ public class Workspace extends Application {
* alphabetical order.