Beispiel #1
0
ArrayList registrySerializeToCommands(Registry registry){
	RegistryInternal* internal=(RegistryInternal*)registry;

	ArrayList commands=arrayListCreate();
	Array nodeArray;
	hashmapToArray(internal->nodes,&nodeArray);
	int length=arrayGetLength(nodeArray);
	int i;
        int coreManagerId=SERVER_COREMANAGER_ID;
        int serverSessionId=SERVER_SESSION_ID;
	for(i=0;i<length;i++){
		Node node=arrayGetObject(nodeArray,i);
		int schemaId=node->schemaId;
		int locked=node->locked;
		int version=-1;
		int commandType=CREATE_NEW_ENTITY;
		int entityId=node->id;
                
		Command command=commandCreate();
		commandPush(command,COMMAND_TYPE,INTEGER,&commandType,SIZE_OF_INT);
		commandPush(command,LOCK,INTEGER,&locked,SIZE_OF_INT);
		commandPush(command,SCHEMA_ID,INTEGER,&schemaId,SIZE_OF_INT);
		commandPush(command,ENTITY_ID,INTEGER,&entityId,SIZE_OF_INT);
		commandPush(command,VERSION,INTEGER,&version,SIZE_OF_INT);
                commandPush(command,ATTRIBUTES,ATTRIBUTES_MAP,node->attributes,CONTAINER_SIZE);
                commandPush(command,CORE_MANAGER_ID,INTEGER,&coreManagerId,0);
                commandPush(command,SESSION_ID,INTEGER,&serverSessionId,0);
		arrayListAddLast(commands,command);
	}
	for(i=0;i<length;i++){
		Node node=arrayGetObject(nodeArray,i);
		NodeInternal* nodeInternal=(NodeInternal*)node;
		Array children;
		stringHashmapToArray(nodeInternal->children,&children);
		int childrenAmount=arrayGetLength(children);
		int version=-1;
		int schemaId=node->schemaId;
		int j;
		int commandType=ADD_CHILD_ENTITY_TO_PARENT_ENTITY;
		for(j=0;j<childrenAmount;j++){
			Arc childArc=arrayGetObject(children,j);                       
			Command command=commandCreate();
			commandPush(command,COMMAND_TYPE,INTEGER,&commandType,SIZE_OF_INT);
			commandPush(command,ENTITY_ID,INTEGER,&node->id,SIZE_OF_INT);
			commandPush(command,ENTITY_CHILD_ID,INTEGER,&childArc->child->id,SIZE_OF_INT);
			commandPush(command,SCHEMA_ID,INTEGER,&schemaId,SIZE_OF_INT);
			commandPush(command,VERSION,INTEGER,&version,SIZE_OF_INT);
                        commandPush(command,CORE_MANAGER_ID,INTEGER,&coreManagerId,SIZE_OF_INT);
                        commandPush(command,SESSION_ID,INTEGER,&serverSessionId,SIZE_OF_INT);
                        commandPush(command,ARC_NAME,BYTE_ARRAY,childArc->arcName,childArc->arcLength);
			arrayListAddLast(commands,command);
		}
                arrayFree(children);
	}
        arrayFree(nodeArray);
	return commands;
}       
Beispiel #2
0
/*
 * SDL.enclosePoints(points, clip)
 *
 * Arguments:
 *	points a sequence table of points
 *	clip (optional) a clipping rectangle
 *
 * Returns:
 *	True on success or false on failure
 *	The rectangle or nil
 *	The error message
 */
static int
l_enclosePoints(lua_State *L)
{
	SDL_Rect result, clip, *clipptr = NULL;

	int ret;
	Array points;

	/* Get / check arguments */
	luaL_checktype(L, 1, LUA_TTABLE);

	if (lua_gettop(L) >= 2) {
		videoGetRect(L, 2, &clip);
		clipptr = &clip;
	}

	if (videoGetPoints(L, 1, &points) < 0)
		return commonPushErrno(L, 2);

	ret = SDL_EnclosePoints(points.data, points.length, clipptr, &result);

	lua_pushboolean(L, ret);
	videoPushRect(L, &result);

	/* Get rid of points */
	arrayFree(&points);
	
	return 2;
}
Beispiel #3
0
ArrayList registryGetAllChildsOfNode(Registry registry,Node nodeObject ,int dept){
	ArrayList result=arrayListCreate();
	if(dept==0){
		return result;
	}
	if(nodeObject==NULL){
		return result;
	}
	NodeInternal* node=(NodeInternal*)nodeObject;
	if(node!=NULL){
		Array array;
		stringHashmapToArray(node->children,&array);
		int length=arrayGetLength(array);
		int i;
		for(i=0;i<length;i++){
			Arc arc=arrayGetObject(array,i);
			arrayListAddLast(result,arc->child);
                        ArrayList list=registryGetAllChildsOfNode(registry,arc->child,dept-1);
			arrayListAddAll(result,list);
                        arrayListFree(list);
		}
                arrayFree(array);
	}
	return result;
}
Beispiel #4
0
/**
 * This is a generic function for reading tables to fill an array. It calls
 * the function `func' for entry in the array.
 *
 * The function func should return 0 if we can continue, if the function
 * return -1, the array is free'd and we also return -1 to the caller.
 *
 * @param L the Lua state
 * @param index the table index
 * @param array the array to fill
 * @param unit the size of object
 * @param func the function to call
 * @return 0 on success and -1 on failure
 */
static int
readTable(lua_State *L, int index, Array *array, size_t unit, TableReadFunc func)
{
    int ok = 1;

    luaL_checktype(L, index, LUA_TTABLE);

    /* No memory */
    if (arrayInit(array, unit, 32) < 0)
        return -1;

    if (index < 0)
        index --;

    lua_pushnil(L);
    while (lua_next(L, index) != 0 && ok) {
        ok = func(L, array);
        lua_pop(L, 1);
    }

    /* Should not be needed, but in case of array.c update */
    if (!ok)
        arrayFree(array);

    return (ok) ? 0 : -1;
}
Beispiel #5
0
void a3dsFree(a3dsDataT* a3ds) {
    for (int i = 0; i < arrayLength(a3ds->materials); i++) {
        a3dsMaterialDataT* mat = *(a3dsMaterialDataT**)arrayGet(a3ds->materials, i);
        free(mat);
    }

    arrayFree(a3ds->materials);

    for (int i = 0; i < arrayLength(a3ds->objects); i++) {
        a3dsObjectDataT* obj = *(a3dsObjectDataT**)arrayGet(a3ds->objects, i);

        if (obj->mesh)
            free(obj->mesh);

        free(obj);
    }

    arrayFree(a3ds->objects);
    free(a3ds);
}
Beispiel #6
0
void attributeFreeAll(StringHashMap attributesMap,int deleteData){
    Array attributes;
    stringHashmapToArray(attributesMap,&attributes);
    int length=arrayGetLength(attributes);
    int i;
    for(i=0;i<length;i++){
        Attribute attribute=(Attribute)arrayGetObject(attributes,i);
        stringHashmapRemove(attributesMap,attribute->name,attribute->nameLength);
        attributeFree(attribute,deleteData);
    }
    arrayFree(attributes);
}
Beispiel #7
0
static void exprListClean(Node *node)
{
	ExprList *el = (ExprList *)node;
#ifdef LOG_CLEAN
	info("exprListClean\n");
#endif
	for (int i = 0; i < el->exprs.size; ++i) {
		Expr **arr = (Expr **)el->exprs.data;
		nodeFree((Node *)arr[i]);
	}
	arrayFree(&el->exprs);
}
Beispiel #8
0
static void formulaClean(Node *node)
{
	Formula *f = (Formula *)node;
#ifdef LOG_CLEAN
	info("formulaClean\n");
#endif
	for(int i = 0; i < f->stmts.size; ++i) {
		Stmt **arr = (Stmt **)f->stmts.data;
		nodeFree((Node *)arr[i]);
	}
	arrayFree(&f->stmts);
}
Beispiel #9
0
/*
 * serialize Node;
 */
int nodeSerialize( Node node,char ** result){

        NodeInternal* internal=(NodeInternal*)node;
        Array attributes;
        stringHashmapToArray(node->attributes,&attributes);
        void* attributeBuffer;
        int attributeLength;
	int size=SIZE_OF_INT*4;
	int numberOfAttributes=arrayGetLength(attributes);
        int i;
        Attribute attribute;
        for(i=0;i<numberOfAttributes;i++){
            attribute=arrayGetObject(attributes,i);
            size+=attributeSerializeLocal(attribute,&attributeBuffer);
            memoryFree(attributeBuffer);
        }
        stringHashmapIterate(internal->children,registryUpdateNodeBufferSize,(Object)&size);
	
	char * buffer=memoryAlloc(size);
        *result=buffer;
       	memcpy(buffer+SIZE_OF_INT*0,&(internal->schemaId),SIZE_OF_INT);
        memcpy(buffer+SIZE_OF_INT*1,&(internal->id),SIZE_OF_INT);
        memcpy(buffer+SIZE_OF_INT*2,&numberOfAttributes,SIZE_OF_INT);
        buffer+=SIZE_OF_INT*3;
        for(i=0;i<numberOfAttributes;i++){
            attribute=arrayGetObject(attributes,i);
            attributeLength=attributeSerializeLocal(attribute,&attributeBuffer);
            memcpy(buffer,attributeBuffer,attributeLength);
            buffer+=attributeLength;
            memoryFree(attributeBuffer);
        }
        arrayFree(attributes);
        ArrayList list=arrayListCreate();
        stringHashmapIterate(internal->children,registryCreateChildrenBufferElemrnts,list);
	int numberOfChildren=arrayListSize(list);
	memcpy(buffer,&numberOfChildren,SIZE_OF_INT);
        buffer+=SIZE_OF_INT;
	int j;
        for(j=0;j<numberOfChildren;j++){
            void* bufferElement=arrayListGetValueAt(list,j);
            int bufferSize;
            memcpy(&bufferSize,bufferElement+SIZE_OF_INT,SIZE_OF_INT);
            memcpy(buffer,bufferElement,SIZE_OF_INT*2+bufferSize);
            buffer+=SIZE_OF_INT*2+bufferSize;
            memoryFree(bufferElement);
	}
        arrayListFree(list);
	return size;
}
Beispiel #10
0
static int
writer(lua_State *L, const char *data, size_t sz, LoadState *state)
{
	size_t i;

	for (i = 0; i < sz; ++i) {
		if (arrayAppend(&state->buffer, &data[i]) < 0) {
			arrayFree(&state->buffer);
			lua_pushstring(L, strerror(errno));
			return -1;
		}
	}

	return 0;
}
Beispiel #11
0
int registryAddAttributes(Registry registry,Node node,StringHashMap attributesMap){
        Array array;
        stringHashmapToArray(attributesMap,&array);
        int lenght=arrayGetLength(array);
        int i;
        for(i=0;i<lenght;i++){
            Attribute newAttribute=(Attribute)arrayGetObject(array,i);
            Attribute oldAttribute;
            stringHashmapGet(node->attributes,newAttribute->name,newAttribute->nameLength,(Object) &oldAttribute);
            if(oldAttribute!=NULL){
               stringHashmapRemove(node->attributes,newAttribute->name,newAttribute->nameLength);
               attributeFree(oldAttribute,TRUE);
            }
        }
        arrayFree(array);
        stringHashmapPutAll(node->attributes,attributesMap);
        return VALID;
}
Beispiel #12
0
int updateChildren(Registry registry, Array array, int parentId) {
    Node parent;
    Node child;
    registryGetNode(registry, parentId, &parent);
    int size = arrayGetLength(array);
    int i;
    for (i = 0; i < size; i++) {
        int childId;
        int keyLength;
        void *bufferElement = arrayGetObject(array, i);
        memcpy(&childId, bufferElement, SIZE_OF_INT);
        memcpy(&keyLength, bufferElement + SIZE_OF_INT, SIZE_OF_INT);
        registryGetNode(registry, childId, &child);
        registryAddChild(registry, parent, child, bufferElement + SIZE_OF_INT * 2, keyLength);
        memoryFree(bufferElement);
    }
    arrayFree(array);
    return VALID;
}
Beispiel #13
0
int validationManagerValidateOnCoreExecuteInternalRecurcive(ValidationManager validationManager,ArrayList commands,int administrator,int dept){
    ValidationManagerStruct* internal=(ValidationManagerStruct*)validationManager;
                if(commands!=NULL&&dept<arrayListSize(commands)){
        Command command=arrayListGetValueAt(commands,dept);
        int coreManagerId=commandGetInt(command,CORE_MANAGER_ID);
	int sessionId=commandGetInt(command,SESSION_ID);
	int transaction=commandGetInt(command,TRANSACTION);
        int schimaId=commandGetInt(command,SCHEMA_ID);
        int type=commandGetInt(command,COMMAND_TYPE);
        int version=commandGetInt(command,VERSION);
        int entityId=commandGetInt(command,ENTITY_ID);
        
        VALIDATE_TRANSACTION(transaction);
	VALIDATE_CORE_MANAGER_ID(coreManagerId);
	VALIDATE_SESSION_ID(sessionId);
	if(IS_CREATE_NEW_ENTITY(type)){                
                int lock=commandGetInt(command,LOCK);
                StringHashMap newAttributesMap=commandGetAttributes(command,ATTRIBUTES);
                VALIDATE(registryValidateNodeCreate(internal->registry,entityId));
                Node node;
                nodeCreate(internal->registry,entityId,schimaId,lock,&node);
                stringHashmapPutAll(node->attributes,newAttributesMap);
                stringHashmapFree(newAttributesMap);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);
                if( VALID!= result){
                    registryDeleteNode(internal->registry,node);
                    return result;
                }
        char* buf;
        int length=nodeSerialize(node,&buf);
        commandPush(command,SERIALIZED_NODE,BYTE_ARRAY,buf,length);
        memoryFree(buf);
	}
	if(IS_ADD_CHILD_ENTITY_TO_PARENT_ENTITY(type)){
                char* arcName;
		int childEntityId=commandGetInt(command,ENTITY_CHILD_ID);
                int arcNameLenght=commandGetString(command,ARC_NAME,&arcName);
                Node parent;
                registryGetNode(internal->registry,entityId,&parent);
                Node child;
                registryGetNode(internal->registry,childEntityId,&child);
                VALIDATE(registryValidateAddChild(parent,child,arcName,arcNameLenght,sessionId));
                registryAddChild(internal->registry,parent,child,arcName,arcNameLenght);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);
                if( VALID!= result){
                    registryRemoveChild(internal->registry,parent,arcName,arcNameLenght);
                    return result;
                }
                char* buf;
                int length=nodeSerialize(parent,&buf);
                commandPush(command,SERIALIZED_NODE,BYTE_ARRAY,buf,length);
                memoryFree(buf);
	}
	if(IS_REMOVE_CHILD_ENTITY_FROM_PARENT_ENTITY(type)){
                char* arcName;
		int childEntityId=commandGetInt(command,ENTITY_CHILD_ID);
                int arcNameLenght=commandGetString(command,ARC_NAME,&arcName);
		Node parent;
                registryGetNode(internal->registry,entityId,&parent);
                Node child;
                registryGetNode(internal->registry,childEntityId,&child);
                VALIDATE(registryValidateRemoveChild(parent,arcName,arcNameLenght,sessionId));
                registryRemoveChild(internal->registry,parent,arcName,arcNameLenght);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);
                if( VALID!= result){
                    registryAddChild(internal->registry,parent,child,arcName,arcNameLenght);
                    return result;
                }
        char* buf;
        int length=nodeSerialize(parent,&buf);
        commandPush(command,SERIALIZED_NODE,BYTE_ARRAY,buf,length);
        memoryFree(buf);
	}
	if(IS_LOCK_ENTITY(type)){
                int lock=commandGetInt(command,LOCK);
                int forceLock=commandGetInt(command,FORCE_LOCK);
                Node node;
                registryGetNode(internal->registry,entityId,&node);
		VALIDATE(registryValidateUpdateLock(node,lock,sessionId,forceLock,administrator));
                registryUpdateLock(internal->registry,node,lock,sessionId);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);
                if( VALID!= result){
                    int revertedLock=lock==TRUE?FALSE:TRUE;                    		
                    registryUpdateLock(internal->registry,node,revertedLock,sessionId);
                    return result;
                }
	}
        if(IS_DELETE_ENTITY(type)){
                int lock=commandGetInt(command,LOCK);
                Node node;
                VALIDATE(registryGetNode(internal->registry,entityId,&node));
		VALIDATE(registryValidateDeleteNode(node,sessionId));
		registryDeleteNode(internal->registry,node);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);
                if( VALID!= result){
                    nodeCreate(internal->registry,entityId,schimaId,lock,&node);                    
                    return result;
                }                
        }
        if(IS_ADD_ATTRIBUTE(type)){
                StringHashMap newAttributesMap=commandGetAttributes(command,ATTRIBUTES);
                Node node;
                registryGetNode(internal->registry,entityId,&node);
                VALIDATE(registryValidateUpdate(node,sessionId));
                Array array;
                stringHashmapToArray(newAttributesMap,&array);
                int lenght=arrayGetLength(array);
                int i;
                StringHashMap toRemove = stringHashmapCreate(SMALL_CONTAINER_SIZE);                
                for(i=0;i<lenght;i++){
                    Attribute newAttribute=(Attribute)arrayGetObject(array,i);
                    Attribute oldAttribute;
                    stringHashmapGet(node->attributes,newAttribute->name,newAttribute->nameLength,(Object) &oldAttribute);
                    if(oldAttribute!=NULL){
                        stringHashmapPut(toRemove,newAttribute->name,newAttribute->nameLength,oldAttribute);
                        stringHashmapRemove(node->attributes,newAttribute->name,newAttribute->nameLength);
                    }
                    stringHashmapPut(node->attributes,newAttribute->name,newAttribute->nameLength,(Object)newAttribute);
                }
                arrayFree(array);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);                
                if(result!=VALID){
                    stringHashmapToArray(newAttributesMap,&array);
                    lenght=arrayGetLength(array);                    
                    for(i=0;i<lenght;i++){
                        Attribute newAttribute=(Attribute)arrayGetObject(array,i);                       
                        stringHashmapRemove(node->attributes,newAttribute->name,newAttribute->nameLength);
                        attributeFree(newAttribute,TRUE);                  
                    }                 
                    stringHashmapPutAll(node->attributes,toRemove);  
                    arrayFree(array);
                    stringHashmapFree(toRemove);
                }else{
                    stringHashmapToArray(toRemove,&array);
                    lenght=arrayGetLength(array);
                    for(i=0;i<lenght;i++){
                        Attribute oldAttribute=(Attribute)arrayGetObject(array,i);
                        stringHashmapRemove(toRemove,oldAttribute->name,oldAttribute->nameLength);
                        attributeFree(oldAttribute,TRUE);                                           
                    }
                    arrayFree(array);
                    stringHashmapFree(toRemove);                    
                }
                stringHashmapFree(newAttributesMap);     
                char* buf;
                int length=nodeSerialize(node,&buf);
                commandPush(command,SERIALIZED_NODE,BYTE_ARRAY,buf,length);
                memoryFree(buf);
        }
        if(IS_REMOVE_ATTRIBUTE(type)){
                StringHashMap toRemoveAttributeMap=commandGetAttributes(command,ATTRIBUTES);
                Node node;
                registryGetNode(internal->registry,entityId,&node);
                VALIDATE(registryValidateUpdate(node,sessionId));
                Array array;
                stringHashmapToArray(toRemoveAttributeMap,&array);
                int lenght=arrayGetLength(array);
                int i;
                StringHashMap oldAttributes = stringHashmapCreate(SMALL_CONTAINER_SIZE);
                for(i=0;i<lenght;i++){
                    Attribute toRemoveAttribute=(Attribute)arrayGetObject(array,i);
                    Attribute oldAttribute;
                    stringHashmapGet(node->attributes,toRemoveAttribute->name,toRemoveAttribute->nameLength,(Object) &oldAttribute);
                    if(oldAttribute!=NULL){
                        stringHashmapPut(oldAttributes,toRemoveAttribute->name,toRemoveAttribute->nameLength,(Object)oldAttribute);
                        stringHashmapRemove(node->attributes,toRemoveAttribute->name,toRemoveAttribute->nameLength);
                    }                    
                }   
                 arrayFree(array);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);                
                if(result!=VALID){
                    stringHashmapToArray(oldAttributes,&array);
                    lenght=arrayGetLength(array);                    
                    for(i=0;i<lenght;i++){
                        Attribute oldAttribute=(Attribute)arrayGetObject(array,i);                       
                        stringHashmapPut(node->attributes,oldAttribute->name,oldAttribute->nameLength,(Object)oldAttribute);            
                    }    
                     arrayFree(array);
                    stringHashmapToArray(toRemoveAttributeMap,&array);
                    lenght=arrayGetLength(array);                    
                    for(i=0;i<lenght;i++){
                        Attribute toRemoveAttribute=(Attribute)arrayGetObject(array,i);                       
                        stringHashmapPut(toRemoveAttributeMap,toRemoveAttribute->name,toRemoveAttribute->nameLength,(Object)toRemoveAttribute);            
                        attributeFree(toRemoveAttribute,TRUE);                        
                    }
                     arrayFree(array);
                    stringHashmapFree(toRemoveAttributeMap);                    
                }else{
                    stringHashmapToArray(oldAttributes,&array);
                    lenght=arrayGetLength(array);                    
                    for(i=0;i<lenght;i++){
                        Attribute oldAttribute=(Attribute)arrayGetObject(array,i);                       
                        stringHashmapRemove(oldAttributes,oldAttribute->name,oldAttribute->nameLength);            
                        attributeFree(oldAttribute,TRUE);                        
                    }   
                     arrayFree(array);
                    stringHashmapToArray(toRemoveAttributeMap,&array);
                    lenght=arrayGetLength(array);
                    for(i=0;i<lenght;i++){
                        Attribute toAddAttribute=(Attribute)arrayGetObject(array,i);                       
                        stringHashmapPut(toRemoveAttributeMap,toAddAttribute->name,toAddAttribute->nameLength,(Object)toAddAttribute);            
                        attributeFree(toAddAttribute,TRUE);                        
                    }
                     arrayFree(array);
                    stringHashmapFree(toRemoveAttributeMap);                    
                }        
        char* buf;
        int length=nodeSerialize(node,&buf);
        commandPush(command,SERIALIZED_NODE,BYTE_ARRAY,buf,length);
        memoryFree(buf);
        }
        if(IS_UPDATE_ENTITY(type)){
                StringHashMap newAttributesMap=commandGetAttributes(command,ATTRIBUTES);
                Node node;
                registryGetNode(internal->registry,entityId,&node);
                StringHashMap oldAttributesMap=stringHashmapCreate(SMALL_CONTAINER_SIZE);                
                stringHashmapPutAll(oldAttributesMap,node->attributes);
                Array array;
                stringHashmapToArray(node->attributes,&array);
                int lenght=arrayGetLength(array);
                int i;                
                for(i=0;i<lenght;i++){
                    Attribute toRemoveAttribute=(Attribute)arrayGetObject(array,i);                                        
                    stringHashmapRemove(node->attributes,toRemoveAttribute->name,toRemoveAttribute->nameLength);                    
                }    
                stringHashmapPutAll(node->attributes,newAttributesMap);
                int result=validationManagerValidateOnCoreExecuteInternalRecurcive(validationManager,commands,administrator,dept+1);                
                if(result!=VALID){
                    stringHashmapToArray(node->attributes,&array);
                    lenght=arrayGetLength(array);
                    for(i=0;i<lenght;i++){
                        Attribute toRemoveAttribute=(Attribute)arrayGetObject(array,i);                                            
                        stringHashmapRemove(node->attributes,toRemoveAttribute->name,toRemoveAttribute->nameLength);                        
                        attributeFree(toRemoveAttribute,TRUE);
                    }
                    stringHashmapPutAll(node->attributes,oldAttributesMap);
                    stringHashmapFree(newAttributesMap);
                    stringHashmapFree(oldAttributesMap);
                }else{
                    stringHashmapToArray(oldAttributesMap,&array);
                    lenght=arrayGetLength(array);
                    for(i=0;i<lenght;i++){
                        Attribute oldAttribute=(Attribute)arrayGetObject(array,i);                       
                        stringHashmapRemove(oldAttributesMap,oldAttribute->name,oldAttribute->nameLength);            
                        attributeFree(oldAttribute,TRUE);                        
                    }                 
                    stringHashmapFree(oldAttributesMap);
                    stringHashmapFree(newAttributesMap);
                }
        char* buf;
        int length=nodeSerialize(node,&buf);
        commandPush(command,SERIALIZED_NODE,BYTE_ARRAY,buf,length);
        memoryFree(buf);
        }
        
    }
    return VALID;
}