• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERXPatcher and component templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERXPatcher and component templates


  • Subject: Re: ERXPatcher and component templates
  • From: David Aspinall <email@hidden>
  • Date: Thu, 15 Feb 2007 13:26:21 -0500

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >ERXPatcher and component templates (From: David Aspinall <email@hidden>)
 >Re: ERXPatcher and component templates (From: Lachlan Deck <email@hidden>)

  • Prev by Date: Re: WOSubmitButton IE Explorer bug
  • Next by Date: Re: WOSubmitButton IE Explorer bug
  • Previous by thread: Re: ERXPatcher and component templates
  • Next by thread: Re: ERXPatcher and component templates
  • Index(es):
    • Date
    • Thread