001package org.intellimate.izou.sdk.util; 002 003import org.intellimate.izou.identification.Identifiable; 004import org.intellimate.izou.identification.IdentificationManager; 005import org.intellimate.izou.sdk.Context; 006 007/** 008 * This is the base-class for all AddOn-Modules, it provides various utility methods. 009 * 010 * @author Leander Kurscheidt 011 * @version 1.0 012 */ 013public abstract class AddOnModule implements ContextProvider, Loggable, LoggedExceptionCallback, Identifiable { 014 private final Context context; 015 private final String ID; 016 017 /** 018 * initializes the Module 019 * @param context the current Context 020 * @param ID the ID 021 */ 022 public AddOnModule(Context context, String ID) { 023 this.context = context; 024 this.ID = ID; 025 if(!IdentificationManager.getInstance().registerIdentification(this)) { 026 context.getLogger().fatal("Failed to register with identification manager " + getID()); 027 } 028 } 029 030 /** 031 * returns the instance of Context 032 * 033 * @return the instance of Context 034 */ 035 @Override 036 public Context getContext() { 037 return context; 038 } 039 040 @Override 041 public String getID() { 042 return ID; 043 } 044}