KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > aspectwerkz > extension > hotswap > HotSwapRedefiner


1 /**************************************************************************************
2  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3  * http://aspectwerkz.codehaus.org *
4  * ---------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of the LGPL license *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  **************************************************************************************/

8 package org.codehaus.aspectwerkz.extension.hotswap;
9
10 import java.util.Iterator JavaDoc;
11
12 import org.codehaus.aspectwerkz.transform.inlining.compiler.JoinPointFactory;
13 import org.codehaus.aspectwerkz.transform.inlining.deployer.Redefiner;
14 import org.codehaus.aspectwerkz.transform.inlining.deployer.ChangeSet;
15
16 /**
17  * Redefines classes using Java 1.4 HotSwap.
18  *
19  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
20  */

21 public class HotSwapRedefiner implements Redefiner {
22
23     /**
24      * Redefines all classes affected by the change set according to the rules defined in the change set.
25      *
26      * @param changeSet
27      */

28     public void redefine(final ChangeSet changeSet) {
29         for (Iterator JavaDoc it = changeSet.getElements().iterator(); it.hasNext();) {
30             ChangeSet.Element changeSetElement = (ChangeSet.Element) it.next();
31             final byte[] bytecode = JoinPointFactory.redefineJoinPoint(changeSetElement.getCompilationInfo());
32             HotSwapClient.hotswap(changeSetElement.getJoinPointInfo().getJoinPointClass(), bytecode);
33         }
34     }
35 }
36
Popular Tags