Package org.dmd.dmc

Examples of org.dmd.dmc.DmcObject


  // DmcCacheIF
 
  @Override
  public void applyModification(DmcNamedObjectIF referringObject, DmcTypeModifier mods) throws DmcValueExceptionSet, DmcValueException {
    System.out.println("TestDataCache.applyModification() ");
    DmcObject target = (DmcObject) referringObject;
   
    SetRequestDMO request = new SetRequestDMO();
    request.setTarget(referringObject.getObjectName());
    request.add(mods.getAttributeInfo(), mods);
   
    System.out.println(request.toOIF());
   
    System.out.println("Before:\n" + target.toOIF(15) + "\n");
   
    target.applyModifier(mods);
   
    System.out.println("After:\n" + target.toOIF(15) + "\n");
   
  }
View Full Code Here


    return null;
  }

  @Override
  public DmcObject getDMOInstance(DmcInputStreamIF dis) throws Exception {
    DmcObject rc = null;
   
    // READ: the number of classes in the objectClass
    int classCount = dis.readInt();
   
    // READ: the construction class ID
    int classID = dis.readInt();
   
    // Try to find the class in the schema
    ClassDefinition cd = schema.isClass(classID);
   
    if (cd == null)
      throw new IllegalStateException("Unknown class ID: " + classID + " ensure that you have loaded the required schemas.");
   
    // Tricky stuff: we always try to instantiate the wrapper for the object so that
    // we can support the DMW environment i.e. the DMO will have a handle to its
    // container. If something goes wrong, we fall back to directly instantiating
    // the DMO.
    DmwWrapper wrapper = null;
    try {
      wrapper = cd.newInstance();
    }
    catch(Exception ex){
      // Just fall back to instantiating the DMO
    }
   
    if (wrapper == null)
      rc = cd.newDMOInstance();
    else
      rc = wrapper.getDmcObject();
   
    // Add the auxiliary classes if they exist
    if (classCount > 1){
      for(int i=1; i<classCount; i++){
        classID = dis.readInt();
        cd = schema.isClass(classID);
        rc.addAux(new ClassDefinitionREF(cd.getDMO()));
      }
    }
   
    return(rc);
  }
View Full Code Here

    try {
      if ( (getEventTypeDMP() == DMPEventTypeEnum.CREATED) || (getEventTypeDMP() == DMPEventTypeEnum.LOADED)){
        if (getSourceObject() == null)
          throw(new IllegalStateException("Malformed DMPEvent. Missing source object for a CREATE event."));
       
        DmcObject clonedSourceObj = getSourceObject().getNew();
         
        int nonPersistentCount = 0;
        for(DmcAttribute<?> attr: getSourceObject().getAttributes().values()){
          if (attr.getID() == DmcObject.__objectClass.id)
            continue;
          if (attr.getAttributeInfo().dataType == DataTypeEnum.PERSISTENT){
            clonedSourceObj.add(attr.getAttributeInfo(), attr.cloneIt());
          }
          else
            nonPersistentCount++;
        }
       
View Full Code Here

          throw(new IllegalStateException("Dropping the sliced modifier in our shallow copy shouldn't throw an exception!"));
        }
      }
    }
    else if ( (getEventTypeDMP() == DMPEventTypeEnum.CREATED) || (getEventTypeDMP() == DMPEventTypeEnum.LOADED)){
      DmcObject sliced = getSourceObject().getSlice(dsi);
//      if (sliced.numberOfAttributes() > 1){
        // We have more than the objectClass attribute so create the new event
        rc = new DMPEvent((DMPEventDMO) this.getDMO().shallowCopy());
       
        rc.setSlice(dsi.getName());
View Full Code Here

  }


  @Override
  public DmcObject findNamedDMO(DmcObjectName name) {
    DmcObject     rc   = null;
    MvwDefinition   d   = allDefs.get(name);
   
    if (d == null){
      // Fall back and check the schema
      rc = schema.findNamedDMO(name);
View Full Code Here

   * @throws IOException
   * @throws ResultException
   * @throws Exception
   */
  public DmcObject deserialize(DmcInputStreamIF dis) throws Exception {
    DmcObject dmo = null;
   
    // READ: the number of classes in the objectClass
    int classCount = dis.readInt();
   
    // READ: the construction class ID
    int classID = dis.readInt();
   
    // Try to find the class in the schema
    ClassDefinition cd = schema.isClass(classID);
   
    if (cd == null)
      throw new IllegalStateException("Unknown class ID: " + classID + " ensure that you have loaded the required schemas.");
   
    // Instantiate the object
    dmo = cd.newDMOInstance();
   
    // Add the auxiliary classes if they exist
    if (classCount > 1){
      for(int i=1; i<classCount; i++){
        classID = dis.readInt();
        cd = schema.isClass(classID);
        dmo.addAux(new ClassDefinitionREF(cd.getDMO()));
      }
    }
   
    // READ: the number of attributes
    int attrCount = dis.readAttributeCount();
   
    for(int i=0; i<attrCount; i++){
      DmcAttribute<?> attr = dis.getAttributeInstance();
     
      // READ: the current attribute
      attr.deserializeIt(dis);
     
      if (attr.getAttributeInfo().valueType == ValueTypeEnum.SINGLE)
        dmo.set(attr.getAttributeInfo(), attr);
      else
        dmo.add(attr.getAttributeInfo(), attr);
    }
   
    return(dmo);
 
View Full Code Here

     * by this class definition.
     * @throws ResultException
     */
    public DmcObject newDMOInstance() throws ResultException
    {
      DmcObject rc = null;

        if (dmoClass == null){
            // The first time we try to create an object this way, get our
            // object class so we can call Class.newInstance()
            try{
View Full Code Here

 
  ////////////////////////////////////////////////////////////////////////////////
  // DmcAttribute abstract overrides

  public DmcObject typeCheck(Object value) throws DmcValueException {
    DmcObject rc = null;
   
        if (value instanceof DmcObject){
            rc = (DmcObject)value;
        }
        else if (value instanceof DmcContainerIF){
View Full Code Here

    public DmcObject deserializeValue(DmcInputStreamIF dis) throws Exception {
//    DmcTypeClassDefinitionREF  oc   = (DmcTypeClassDefinitionREF) dis.getAttributeInstance();
//    oc.deserializeIt(dis);
//      DmcObject rc = dis.getDMOInstance(oc.getMVnth(0).getObjectName().getNameString());
//      rc.deserializeIt(dis);
      DmcObject rc = dis.getDMOInstance(dis);
      rc.deserializeIt(dis);
      return(rc);
    }
View Full Code Here

  }

  @Override
  public DmcObject findNamedDMO(DmcObjectName name) {
    DmcObject rc = schema.findNamedDMO(name);
   
    if (rc == null)
      return(cache.findNamedDMO(name));
   
    return rc;
View Full Code Here

TOP

Related Classes of org.dmd.dmc.DmcObject

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.