Changed mote creation to always be done by the MoteType (allows application motes to be loaded with the right class loader)

This commit is contained in:
nifi 2010-01-24 20:10:57 +00:00
parent 7922108cbd
commit 115ee7b936

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: Simulation.java,v 1.57 2010/01/15 14:00:06 fros4943 Exp $
* $Id: Simulation.java,v 1.58 2010/01/24 20:10:57 nifi Exp $
*/
package se.sics.cooja;
@ -633,15 +633,9 @@ public class Simulation extends Observable implements Runnable {
if (moteType == null) {
throw new Exception("No mote type for mote: " + moteClassName);
}
/* Load mote class using mote type's class loader */
Class<? extends Mote> moteClass = myGUI.tryLoadClass(moteType, Mote.class, moteClassName);
if (moteClass == null) {
throw new Exception("Could not load mote class: " + element.getText().trim());
}
Mote mote = moteClass.getConstructor((Class[]) null).newInstance((Object[]) null);
mote.setType(moteType);
/* Create mote using mote type */
Mote mote = moteType.generateMote(this);
if (mote.setConfigXML(this, element.getChildren(), visAvailable)) {
addMote(mote);
} else {