Assuming that there is a significant interest in Jericho, which from
the work on chain as well as other notes and discussions on the list,
I think I can assume there is, would there also be an interest in
making the significant class factories in Jericho hot deploy
factories?  I would like to open a discussion on this to see if anyone
even thinks that would be a good idea.  I think it would be a great
idea, letting us build a small Struts kernel.

If interfaces are in WEB-INF/classes/org/apache./struts/, then the hot
deploy factory could be, for example, in
WEB-INF/classes/deploy/org/apache/struts/.

A hot (deploy) factory would look something like the following.  Other
options, of course, exist.  But this is really simple.

package com.crackwillow.hot;

import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;

import com.crackwillow.constant.SiteConstant;
import com.crackwillow.hot.Point;

public class PointHotFactory {

  static ClassLoader pointClassLoader;
  static Class       pointClass;

  public static synchronized Point createPoint(Point existingPoint)
                throws Exception {

    // Startup implementation
    if (pointClass == null) { loadPointImpl(); }

    // Factory
    Point newPoint = (Point) pointClass.newInstance();

    // Copy state when going to a new implementation.
    if (existingPoint != null) {
      transferState(existingPoint,newPoint);
    }

    return newPoint;
  }

  public static synchronized void loadPointImpl()
      throws Exception {
    pointClass = new URLClassLoader(new URL[]{new
URL(SiteConstant.DEPLOY)}).loadClass("com.crackwillow.hot.PointImpl");
  }

  private static synchronized void transferState(Point existingPoint,
Point newPoint) {
    newPoint.move(existingPoint.getX(), existingPoint.getY());
  }
}

Which brings up the last part of the Subject.  Does anyone have a
class that runs shell and batch scripts that compile classes?  I've
not done that and don't have a clue.  Talk to me!  LOL  ;-)

Jack


-- 


"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to