Package jade.content.schema

Examples of jade.content.schema.ObjectSchema


  }
 
  private void validate(AbsContentElement content, Ontology onto) throws OntologyException {
    if (validationMode) {
      // Validate the content against the ontology
      ObjectSchema schema = onto.getSchema(content.getTypeName());
      if (schema == null) {
        throw new OntologyException("No schema found for type "+content.getTypeName());
      }
      schema.validate(content, onto);
    }
  }
View Full Code Here


   * @param clazz class to get schema
   * @param elementSchema aggregate element schema  
   * @return associated class schema
   */
  public static ObjectSchema getSchema(Class clazz, TermSchema elementSchema) {
    ObjectSchema schema = null;
   
    // Sequence type
    if (java.util.List.class.isAssignableFrom(clazz) ||
      jade.util.leap.List.class.isAssignableFrom(clazz) ||
      (clazz.isArray() && clazz != byte[].class)) {
View Full Code Here

  }

  private void stringifyComplex(AbsObject val, Ontology onto, StringBuffer str) throws CodecException {
    str.append("(");
    str.append(val.getTypeName());
    ObjectSchema s = null;
    try {
      s = onto.getSchema(val.getTypeName());
    }
    catch (OntologyException oe) {
      throw new CodecException("Error getting the schema for element "+val, oe);
    }
    if (val instanceof AbsConcept && !s.getEncodingByOrder()) {
      encodeSlotsByName(val, val.getNames(), onto, str);
    }
    else {
      encodeSlotsByOrder(val, s.getNames(), onto, str);
    }
    str.append(")");
  }
View Full Code Here

    String name = p.getElement();
    if(logger.isLoggable(Logger.FINE))
      logger.log(Logger.FINE,"Parse complex descriptor: "+name);
    ++indent;
    try {
      ObjectSchema s = o.getSchema(name);
      abs = s.newInstance();
      if (abs instanceof AbsAggregate) {
        fillAggregate((AbsAggregate) abs, p, o);
      }
      else if (p.nextToken().startsWith(":")) {
        fillSlotsByName((AbsConcept) abs, p, o);
View Full Code Here

    }
    return result;
  }

  private ObjectSchema getSchema(Class clazz) throws OntologyException {
    ObjectSchema os;
    // Manage classes that require special handling:
    // Calendar --> Date
    if (java.util.Calendar.class.isAssignableFrom(clazz)) {
      os = ontology.getSchema(java.util.Date.class);
    } else if (clazz == Object.class) {
View Full Code Here

 
  private ObjectSchema doAddSchema(Class clazz, boolean buildHierarchy, boolean manageAsSerializable) throws BeanOntologyException {
    // If slot is marked 'manageAsSerializable' and is present the SerializableOntology use
    // serializable-schema to manage the slot
    if (manageAsSerializable) {
      ObjectSchema serializableSchema = null;
      try {
        serializableSchema = ontology.getSchema(SerializableOntology.SERIALIZABLE);
      } catch(OntologyException oe) {
        throw new BeanOntologyException("Error getting SerializableOntology schema", oe);
      }
View Full Code Here

      throw new BeanOntologyException("Error addind schema for class "+clazz, oe);
    }
  }

  private ObjectSchema doAddHierarchicalSchema(Class clazz) throws OntologyException {
    ObjectSchema schema = getSchema(clazz);
    if (schema != null) {
      return schema;
    }

    schema = createEmptySchema(clazz);
View Full Code Here

   
    return schema;
  }
 
  private ObjectSchema doAddFlatSchema(Class clazz) throws OntologyException {
    ObjectSchema schema = getSchema(clazz);
    if (schema != null) {
      return schema;
    }

    schema = createEmptySchema(clazz);
View Full Code Here

    Class superClazz = clazz.getSuperclass();
    if (superClazz != null) {
      if (!Object.class.equals(superClazz)) {
        if (!isPrivate(superClazz)) {
          // Superclasses do not need to be Concept, Predicate or AgentAction
          ObjectSchema superSchema = doAddHierarchicalSchema(superClazz);
         
          if (schema instanceof ConceptSchema) {
            ((ConceptSchema)schema).addSuperSchema((ConceptSchema)superSchema);
          } else {
            ((PredicateSchema)schema).addSuperSchema((PredicateSchema)superSchema);
View Full Code Here

        if (!isPrivate(interfaceClass)) {
          // We add a new schema only for interfaces that extends Concept (if we are dealing with a Concept)
          // or Predicate (if we are dealing with a Predicate). This is to avoid adding schemas for interfaces
          // like Serializable, Cloanable....
          if (schema instanceof ConceptSchema && Concept.class.isAssignableFrom(interfaceClass) && interfaceClass != Concept.class && interfaceClass != AgentAction.class) {
            ObjectSchema superSchema = doAddHierarchicalSchema(interfaceClass);
            ((ConceptSchema)schema).addSuperSchema((ConceptSchema)superSchema);
          }
          else if (schema instanceof PredicateSchema && Predicate.class.isAssignableFrom(interfaceClass) && interfaceClass != Predicate.class) {
            ObjectSchema superSchema = doAddHierarchicalSchema(interfaceClass);
            ((PredicateSchema)schema).addSuperSchema((PredicateSchema)superSchema);
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of jade.content.schema.ObjectSchema

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.