Turns out to not be such a big deal.  I added the following:


===================
to my Properties
===================
ticoon.replacement.classes = (PageWrapper, ticoon.web.LoginPanel)

===================
to my Application class
===================

public void initializeTicoon(NSNotification event)
{
        // startup
NSArray classesToReplace = PropertyTool.ArrayValue ( "ticoon.replacement.classes" );
        if ( ArrayTool.IsEmptyArray( classesToReplace ) == false)
        {
/** install patch components that must be 100% API compatible with each other */
                String baseclasspath = "ticoon.clients." +
                        sponsorShortName() + "." +
                        applicationName();
                for ( int i = 0; i < classesToReplace.count(); i++ )
                {
                        String item = (String)classesToReplace.objectAtIndex(i);
                        String itemName = item;

                        /* class to replace may be 'ticoon.report.Something' we 
want
                           to make that into 
'ticoon.clients.sponsor.AdvisorSomething'
                           not 
'ticoon.clients.sponsor.Advisorticoon.report.Something' */
                        int lastdot = item.lastIndexOf(".");
                        if ( lastdot > 0 )
                                itemName = item.substring(lastdot+1);

                        String fullpath = baseclasspath + itemName;
                        try
                        {
                                // example ticoon.clients.bank.AdministratorMain
                                Class replacement = Class.forName( fullpath );
                                
com.webobjects.foundation._NSUtilities.setClassForName(
                                        replacement, item);
                        }
                        catch ( ClassNotFoundException e )
                        {
                                /* not found, no replacement, use the default */
                                Log.Error( "Failed to replace " + item + " with 
" + fullpath );
                        }
                }
        }
}


/** override parent implementation to redirect component definitions to patched class names. Superclass will use the full class name, and strip off the package name when resolving the component name */ public WOComponentDefinition _componentDefinition(String s, NSArray nsarray)
{
        if ( StringTool.IsBlankContent(s) == false )
        {
Class pageClass = com.webobjects.foundation._NSUtilities.classWithName( s );
                if ( pageClass != null )
                {
                        /** this ensures that if we patch PageWrapper with
                            ticoon.clients.sponsor.AdvisorPageWrapper that the
                            AdvisorPageWrapper.wo is parsed instead of the 
original */
                        s = pageClass.getName();
                }
        }
        
        return super._componentDefinition(s, nsarray);
}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to