01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package org.codehaus.aspectwerkz.extension.hotswap;
08:
09: import java.util.Iterator;
10:
11: import org.codehaus.aspectwerkz.transform.inlining.compiler.JoinPointFactory;
12: import org.codehaus.aspectwerkz.transform.inlining.deployer.Redefiner;
13: import org.codehaus.aspectwerkz.transform.inlining.deployer.ChangeSet;
14:
15: /**
16: * Redefines classes using Java 1.4 HotSwap.
17: *
18: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
19: */
20: public class HotSwapRedefiner implements Redefiner {
21:
22: /**
23: * Redefines all classes affected by the change set according to the rules defined in the change set.
24: *
25: * @param changeSet
26: */
27: public void redefine(final ChangeSet changeSet) {
28: for (Iterator it = changeSet.getElements().iterator(); it
29: .hasNext();) {
30: ChangeSet.Element changeSetElement = (ChangeSet.Element) it
31: .next();
32: final byte[] bytecode = JoinPointFactory
33: .redefineJoinPoint(changeSetElement
34: .getCompilationInfo());
35: HotSwapClient.hotswap(changeSetElement.getJoinPointInfo()
36: .getJoinPointClass(), bytecode);
37: }
38: }
39: }
|