• 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: James Cicenia <email@hidden>
  • Date: Tue, 13 Feb 2007 08:49:30 -0600

I have used Wirehose for this and it works very well for me. I have 8 different catalogs with different UIs sharing the same and different databases.

It is now free too.

www.wirehose.com

- James Cicenia

On Feb 12, 2007, at 9:45 AM, David Aspinall wrote:

Many of you have probably encountered a situation where different clients like minor changes to a shipping application's user interface. As we strive to hold onto a common codebase for 90% of our product we start to see pages with large numbers of WOConditionals checking for one client code vs another.

I am investigating use of a feature like ERXPatcher to switch two components at runtime in a simple way. For example if component looks like:

== HTML ==

... <webobject name="wrap">...content...</webobject>

== WOD ==

wrap: PageWrapper
{
	api = value;
}

Now assuming all my PageWrapper classes are API compatible, I would like to switch ticoon.client.name.AjaxPageWrapper for the generic version. After examining the the Wonder code I have been able to replace the classes (trivial), but the template parser seems to insist on parsing the original PageWrapper.wo instead of the AjaxPageWrapper.wo I assume the parser is not using the _NSUtilities.classForName() method and simply using the name as defined in the WOD.

I was able to intercept this process for Page level components by overriding WOApplication with

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 fullpath = baseclasspath + item;
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 );
}
}
}
}


public WOComponent pageWithName(String s, WOContext wocontext)
{
if ( s == null )
s = "Main";

// pass the alternate component name to super
Class pageClass = com.webobjects.foundation._NSUtilities.classWithName( s );
if ( pageClass != null )
s = pageClass.getName();
return super.pageWithName( s, wocontext);
}


So I can replace even the Main page with a custom ticoon.client.name.CustomMain and the application will parse CustomMain.wo

My next step will be to implement my own template parser and try replacing the component name during the parsing process, I just was hoping someone had done it already. Or is there a hook somewhere I can override and get the app to parse AjaxPageWrapper.wo instead of PageWrapper.wo?


David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40jimijon.com


This email sent to email@hidden

_______________________________________________ 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>)

  • Prev by Date: Re: ERXPatcher and component templates
  • Next by Date: Re: Webobjects 5.3.2 deployment update?
  • Previous by thread: Re: ERXPatcher and component templates
  • Next by thread: Direct Action Redirect / error page ?
  • Index(es):
    • Date
    • Thread