Package sg.edu.nus.comp.simTL.engine.exceptions

Examples of sg.edu.nus.comp.simTL.engine.exceptions.InjectionException


 
  protected String loadAttribute(EObject tElement, String eAttribute) throws InjectionException{
    try{
      return (String)tElement.eGet(tElement.eClass().getEStructuralFeature(eAttribute));
    } catch(Exception e){
      throw new InjectionException("Couldn't find attribute " + eAttribute + " in " + tElement.eClass().getName());
    }
  }
View Full Code Here


      log.error("BUG: Cannot cast the returned object of " + eReference + " to a list");
      Vector<EObject> returnList = new Vector<EObject>();
      returnList.add(loadReferencedEObject(eReference));
      return returnList;
    } catch(Exception e){
      throw new InjectionException("Couldn't find reference " + eReference + " in " + tElement);
    }
  }
View Full Code Here

      //template manipulates only OL-elements under an TElement!
      return (EObject)tElement.eGet(tElement.eClass().getEStructuralFeature(eReference));
    } catch(ClassCastException e){
      log.error("BUG: Cannot cast the returned object of " + eReference + " to an eObject");
    } catch(Exception e){
      throw new InjectionException("Couldn't find reference " + eReference + " in " + tElement);
    }
    return null;
  }
View Full Code Here

  }
 
  private EAnnotation findTemplateAnnotation() throws SimTLException{
    //find superclass XFrame
    EClass templateClass = findTemplateClass(getTElement().eClass());
    if(templateClass==null) throw new InjectionException("There is no "+CLASS_TEMPLATE+" super class?!");
   
    EAnnotation ann = templateClass.getEAnnotation(ANNOTATION_TEMPLATE_CLASS);
    if(ann==null){
      throw new InjectionException("No \"" + ANNOTATION_TEMPLATE_CLASS + "\" annotation on XFrame Root");
    }
    return ann;
  }
View Full Code Here

  }
 
  protected EPackage resolveObjectLanguagePackage() throws SimTLException{
    String olS = findTemplateAnnotation().getDetails().get(ANNOTATION_OBJECT_LANGUAGE);
    if(olS==null){
      throw new InjectionException("No \"" + ANNOTATION_OBJECT_LANGUAGE + "\" annotation details at annotation " + ANNOTATION_TEMPLATE_CLASS);
    }
    URI objectLanguageURI = null;
    try{
      objectLanguageURI = URI.createURI(olS);
    } catch (Exception e){
View Full Code Here

  }
 
  protected Resource.Factory resolveTextResourceFactory() throws SimTLException{
    String olS = findTemplateAnnotation().getDetails().get(ANNOTATION_OBJECT_LANGUAGE_FACTORY);
    if(olS==null){
      throw new InjectionException("No \"" + ANNOTATION_OBJECT_LANGUAGE_FACTORY + "\" annotation details at annotation " + ANNOTATION_TEMPLATE_CLASS);
    }
    //FIXME use Eclipse class loader and remove dependency to object language
    Class<?> factoryClass=null;
    try {
      factoryClass = Class.forName(olS);
    } catch (ClassNotFoundException e) {
      throw new ValidationException("No such class found:"+ olS+". Please make this language available",e);
    }
    Object factoryO=null;
    try {
      factoryO = factoryClass.getConstructor().newInstance();
    } catch (Exception e){
      throw new InjectionException("Couldn't instantiate with empty constructor. Please make this language available",e);
    }
    if(!(factoryO instanceof Resource.Factory)){
      throw new InjectionException("Referenced class is no ResourceFactory: " + olS);
    }
    return (Resource.Factory)factoryO;
  }
View Full Code Here

  }
 
  protected String resolveObjectLanguageExtension() throws SimTLException{
    String olS = findTemplateAnnotation().getDetails().get(ANNOTATION_OBJECT_LANGUAGE_EXTENSION);
    if(olS==null){
      throw new InjectionException("No \"" + ANNOTATION_OBJECT_LANGUAGE_EXTENSION + "\" annotation details at annotation " + ANNOTATION_TEMPLATE_CLASS);
    }
    return olS;
  }
View Full Code Here

    log.debug("Unify attributes of " + Util.getFullName(iObject) + "("+iObject.eClass().getEAllAttributes().size()+")");
    for(EAttribute iAtt : iObject.eClass().getEAllAttributes()){
      log.debug("Unify attribute " + iAtt.getName());
      EAttribute tAtt = (EAttribute)tObject.eClass().getEStructuralFeature(iAtt.getName());
      if(tAtt==null){
        throw new InjectionException("tiObject has an eAttribute which doesn't exist in tObject: " + iAtt.getName()
            +". Size of attributeList in class of tObject: " +tObject.eClass().getEAttributes().size());
      }
     
      Object iAttO =iObject.eGet(iAtt);
      Object tAttO = tObject.eGet(tAtt);
View Full Code Here

   * @param tiObject The respective eObject in template instance corresponding to the <code>tObject</code>
   */
  private void evaluateTAttribute(EAttribute tAttributeClass, EObject tObject, EObject iObject) throws SimTLException{
    EAttribute iAttributeClass = (EAttribute)iObject.eClass().getEStructuralFeature(tAttributeClass.getName());
    if(iAttributeClass==null){
      throw new InjectionException("No tiAttributeClass found for tAttributeClass " + tObject.eClass().getName()+"."+tAttributeClass.getName());
    }
    //TODO validate that not both attribute and placeholder are set
   
    if(checkActualAttribute(tAttributeClass,iAttributeClass,tObject,iObject)){
      modelCorrespondence.add(
View Full Code Here

TOP

Related Classes of sg.edu.nus.comp.simTL.engine.exceptions.InjectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.