Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2784 - development/main/transit/core/handler/src/main/net/dpml/transit

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2784 - development/main/transit/core/handler/src/main/net/dpml/transit
  • Date: Tue, 07 Jun 2005 17:49:07 -0400

Author: mcconnell AT dpml.net
Date: Tue Jun 7 17:49:06 2005
New Revision: 2784

Modified:

development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
Log:
improve cache plugin handling

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
Tue Jun 7 17:49:06 2005
@@ -310,88 +310,116 @@
}

/**
- * Cache initialization. If the cache model delcares a plugin uri
- * then we load a replacement cache handler. Otherwise we initialize
- * the default cache handler during which any custom hosts are loaded.
+ * ContentRegistry initialization.
*
* @exception TransitException if an initialization error occurs
*/
- private void initializeCache() throws TransitException
+ private void initializeRegistry() throws TransitException
{
synchronized( m_listener )
{
- CacheModel model = m_model.getCacheModel();
+ ContentRegistryModel model = m_model.getContentRegistryModel();
model.addPluginListener( m_listener );
URI uri = model.getPluginURI();
- if( null == uri )
+ if( null != uri )
{
- ((DefaultCacheHandler)m_cacheHandler).initialize();
+ setContentRegistry( model );
}
- else
+ }
+ }
+
+ /**
+ * ContentRegistry initialization.
+ *
+ * @exception TransitException if an initialization error occurs
+ */
+ private void setContentRegistry( ContentRegistryModel model )
+ {
+ synchronized( m_registry )
+ {
+ URI uri = model.getPluginURI();
+ if( null != uri )
{
- m_logger.debug( "loading custom cache handler" );
+ m_logger.info( "loading custom content handler registry" );
try
{
Object[] args = new Object[]{ model };
ClassLoader classloader = Transit.class.getClassLoader();
- CacheHandler handler = (CacheHandler)
getRepository().getPlugin( classloader, uri, args );
- m_cacheHandler = handler;
+ ContentRegistry registry =
+ (ContentRegistry) getRepository().getPlugin(
classloader, uri, args );
+ handleDisposal( m_registry );
+ m_registry = registry;
}
catch( Throwable e )
{
final String error =
- "Bypassing custom cache hander assignment due to
internal error.";
+ "Bypassing custom content hander registry assignment
due to internal error.";
m_logger.error( error, e );
}
}
+ else
+ {
+ try
+ {
+ m_logger.info( "loading standard content handler
registry" );
+ handleDisposal( m_registry );
+ m_registry = new DefaultContentRegistry( model );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Critical error while attempting to establish content
management subsystem.";
+ throw new TransitError( error, e );
+ }
+ }
}
}

/**
- * ContentRegistry initialization.
+ * Cache initialization.
*
* @exception TransitException if an initialization error occurs
*/
- private void initializeRegistry() throws TransitException
+ private void initializeCache() throws TransitException
{
synchronized( m_listener )
{
- ContentRegistryModel model = m_model.getContentRegistryModel();
+ CacheModel model = m_model.getCacheModel();
model.addPluginListener( m_listener );
URI uri = model.getPluginURI();
if( null != uri )
{
- setContentRegistry( model );
+ setCacheHandler( model );
}
}
}

/**
- * ContentRegistry initialization.
+ * Cache initialization.
*
* @exception TransitException if an initialization error occurs
*/
- private void setContentRegistry( ContentRegistryModel model )
+ private void setCacheHandler( CacheModel model )
{
- synchronized( m_registry )
+ synchronized( m_cacheHandler )
{
URI uri = model.getPluginURI();
if( null != uri )
{
- m_logger.info( "loading custom content handler registry" );
+ m_logger.info( "loading custom cache handler" );
try
{
Object[] args = new Object[]{ model };
ClassLoader classloader = Transit.class.getClassLoader();
- ContentRegistry registry =
- (ContentRegistry) getRepository().getPlugin(
classloader, uri, args );
- handleDisposal( m_registry );
- m_registry = registry;
+ CacheHandler handler =
+ (CacheHandler) getRepository().getPlugin( classloader,
uri, args );
+ handleDisposal( m_cacheHandler );
+ m_cacheHandler = handler;
}
catch( Throwable e )
{
final String error =
- "Bypassing custom content hander registry assignment
due to internal error.";
+ "Bypassing custom cache hander assignment due to
internal error.";
m_logger.error( error, e );
}
}
@@ -399,9 +427,9 @@
{
try
{
- m_logger.info( "loading standard content handler
registry" );
- handleDisposal( m_registry );
- m_registry = new DefaultContentRegistry( model );
+ m_logger.info( "loading standard cache handler" );
+ handleDisposal( m_cacheHandler );
+ m_cacheHandler = new DefaultCacheHandler( model );
}
catch( Throwable e )
{
@@ -413,6 +441,7 @@
}
}

+
private void handleDisposal( Object object )
{
if( object instanceof Handler )



  • svn commit: r2784 - development/main/transit/core/handler/src/main/net/dpml/transit, mcconnell, 06/07/2005

Archive powered by MHonArc 2.6.24.

Top of Page