Пример #1
0
AXIS2_EXTERN axutil_date_time_t *AXIS2_CALL
axutil_date_time_utc_to_local(
    axutil_date_time_t *date_time_in,
    const axutil_env_t *env,
    axis2_bool_t is_positive,
    int hour,
    int min)
{
    axutil_date_time_t *date_time = NULL;
    axutil_date_time_t *ret = NULL;
    if (date_time_in->tz_hour && date_time_in->tz_min)
        return NULL;

    date_time->year = date_time_in->year;
    date_time->mon = date_time_in->mon;
    date_time->day = date_time_in->day;
    date_time->hour = date_time_in->hour;
    date_time->min = date_time_in->min;
    date_time->sec = date_time_in->sec;
    date_time->tz_hour = hour;
    date_time->tz_min = min;

    date_time->tz_pos = is_positive ? AXIS2_FALSE : AXIS2_TRUE;
    ret = axutil_date_time_local_to_utc(date_time, env);
    ret->tz_hour = hour;
    ret->tz_min = min;

    ret->tz_pos = is_positive;

    axutil_date_time_free(date_time, env);
    return ret;
}
           /**
            * resetter for lastModifiedDate
            */
           axis2_status_t AXIS2_CALL
           adb_contentItem_type0_reset_lastModifiedDate(
                   adb_contentItem_type0_t* _contentItem_type0,
                   const axutil_env_t *env)
           {
               int i = 0;
               int count = 0;
               void *element = NULL;

               AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
               AXIS2_PARAM_CHECK(env->error, _contentItem_type0, AXIS2_FAILURE);
               

               
            
                
                if(_contentItem_type0->property_lastModifiedDate != NULL)
                {
                   
                   
                      axutil_date_time_free(_contentItem_type0->property_lastModifiedDate, env);
                     _contentItem_type0->property_lastModifiedDate = NULL;
                }
            
                
                
                _contentItem_type0->is_valid_lastModifiedDate = AXIS2_FALSE; 
               return AXIS2_SUCCESS;
           }
Пример #3
0
AXIS2_EXTERN unsigned int AXIS2_CALL
axutil_rand_get_seed_value_based_on_time(
    const axutil_env_t * env)
{
    axutil_date_time_t *date = axutil_date_time_create(env);
    unsigned int rand_var = axutil_date_time_get_year(date, env);
    rand_var += axutil_date_time_get_month(date, env);
    rand_var += axutil_date_time_get_date(date, env);
    rand_var += axutil_date_time_get_hour(date, env);
    rand_var += axutil_date_time_get_minute(date, env);
    rand_var += axutil_date_time_get_second(date, env);
    axutil_date_time_free(date, env);
    return rand_var;
}
Пример #4
0
axis2_status_t AXIS2_CALL 
remote_registry_comment_free(
    remote_registry_comment_t *comment, 
    const axutil_env_t *env)
{
    if(comment->resource_path)
    {
        AXIS2_FREE(env->allocator, comment->resource_path);
        comment->resource_path = NULL;
    }
    
    if(comment->comment_path)
    {
        AXIS2_FREE(env->allocator, comment->comment_path);
        comment->comment_path = NULL;
    }
    
    if(comment->text)
    {
        AXIS2_FREE(env->allocator, comment->text);
        comment->text = NULL;
    }
    
    if(comment->user)
    {
        AXIS2_FREE(env->allocator, comment->user);
        comment->user = NULL;
    }
    
    if(comment->date_time)
    {
        axutil_date_time_free(comment->date_time, env);
        comment->date_time = NULL;
    }

	AXIS2_FREE(env->allocator, comment);

	return AXIS2_SUCCESS;
}
static ncInstance * copy_instance_from_adb (adb_instanceType_t * instance, axutil_env_t * env)
{
    int i;
    adb_virtualMachineType_t * vm_type = adb_instanceType_get_instanceType(instance, env);
    virtualMachine params;
    copy_vm_type_from_adb (&params, vm_type, env);
    netConfig ncnet;
    bzero(&ncnet, sizeof(netConfig));
    adb_netConfigType_t * netconf = adb_instanceType_get_netParams(instance, env);
    if (netconf != NULL) {
        ncnet.vlan = adb_netConfigType_get_vlan(netconf, env);
		ncnet.networkIndex = adb_netConfigType_get_networkIndex(netconf, env);
        strncpy(ncnet.privateMac, adb_netConfigType_get_privateMacAddress(netconf, env), 24);
        strncpy(ncnet.privateIp, adb_netConfigType_get_privateIp(netconf, env), 24);
        strncpy(ncnet.publicIp, adb_netConfigType_get_publicIp(netconf, env), 24);
    }

    int groupNamesSize = adb_instanceType_sizeof_groupNames (instance, env);
    char * groupNames [EUCA_MAX_GROUPS];
    for (i = 0; i<EUCA_MAX_GROUPS && i<groupNamesSize; i++) {
        groupNames[i] = adb_instanceType_get_groupNames_at (instance, env, i);
    }

    ncInstance * outInst = allocate_instance(
        (char *)adb_instanceType_get_instanceId(instance, env),
        (char *)adb_instanceType_get_reservationId(instance, env),
        &params,
        (char *)adb_instanceType_get_imageId(instance, env),
        NULL, // URL is NULL
        (char *)adb_instanceType_get_kernelId(instance, env),
        NULL, // URL is NULL
        (char *)adb_instanceType_get_ramdiskId(instance, env),
        NULL, // URL is NULL
        (char *)adb_instanceType_get_stateName(instance, env),
        0,
        (char *)adb_instanceType_get_userId(instance, env), 
        &ncnet, 
        (char *)adb_instanceType_get_keyName(instance, env),
        (char *)adb_instanceType_get_userData(instance, env),
        (char *)adb_instanceType_get_launchIndex(instance, env),
        groupNames, groupNamesSize
        );

    axutil_date_time_t * dt = adb_instanceType_get_launchTime(instance, env);
    if (dt!=NULL) {
        outInst->launchTime = datetime_to_unix (dt, env);
        axutil_date_time_free(dt, env);
    }

    outInst->volumesSize = adb_instanceType_sizeof_volumes (instance, env);
    if (outInst->volumesSize > 0) {
        for (i=0; i<EUCA_MAX_VOLUMES && i<outInst->volumesSize; i++) {
            adb_volumeType_t * volume = adb_instanceType_get_volumes_at (instance, env, i);
            strncpy (outInst->volumes[i].volumeId, adb_volumeType_get_volumeId (volume, env), CHAR_BUFFER_SIZE);
            strncpy (outInst->volumes[i].remoteDev, adb_volumeType_get_remoteDev (volume, env), CHAR_BUFFER_SIZE);
            strncpy (outInst->volumes[i].localDev, adb_volumeType_get_localDev (volume, env), CHAR_BUFFER_SIZE);
			strncpy (outInst->volumes[i].stateName, adb_volumeType_get_state (volume, env), CHAR_BUFFER_SIZE);
        }
    }

    return outInst;
}
Пример #6
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
remote_registry_resource_free(
    remote_registry_resource_t *resource,
    const axutil_env_t *env)
{

    if(resource->author_name != NULL)
    {
        AXIS2_FREE(env->allocator, resource->author_name);
        resource->author_name = NULL;
    }
    if(resource->created_time != NULL)
    {
        axutil_date_time_free(resource->created_time, env);
        resource->created_time = NULL;
    }
    if(resource->last_updated_username != NULL)
    {
        AXIS2_FREE(env->allocator, resource->last_updated_username);
        resource->last_updated_username = NULL;
    }
    if(resource->description != NULL)
    {
        AXIS2_FREE(env->allocator, resource->description);
        resource->description = NULL;
    }
    if(resource->path != NULL)
    {
        AXIS2_FREE(env->allocator, resource->path);
        resource->path = NULL;
    }
    if(resource->media_type != NULL)
    {
        AXIS2_FREE(env->allocator, resource->media_type);
        resource->media_type = NULL;
    }
    if(resource->parent_path != NULL)
    {
        AXIS2_FREE(env->allocator, resource->parent_path);
        resource->parent_path = NULL;
    }
    if(resource->properties != NULL)
    {
        axutil_hash_index_t *hi;
        void *val;
        void *key;
        int sum = 0;
        for (hi = axutil_hash_first(resource->properties, env); hi; hi = axutil_hash_next(env, hi)) {
            axutil_hash_this(hi, (const void**)&key, NULL, &val);

            AXIS2_FREE(env->allocator, key);
            AXIS2_FREE(env->allocator, val);
        }
        axutil_hash_free(resource->properties, env);
        resource->properties = NULL;
    }
    if(resource->depends_on != NULL)
    {
        axutil_array_list_free(resource->depends_on, env);
        resource->depends_on = NULL;
    }
    if(resource->depended_on_by != NULL)
    {
        AXIS2_FREE(env->allocator, resource->depended_on_by);
        resource->depended_on_by = NULL;
    }
    if(resource->content != NULL)
    {
        AXIS2_FREE(env->allocator, resource->content);
        resource->content = NULL;
    }
    if(resource->subtitle != NULL)
    {
        AXIS2_FREE(env->allocator, resource->subtitle);
        resource->subtitle = NULL;
    }
    if(resource->title != NULL)
    {
        AXIS2_FREE(env->allocator, resource->title);
        resource->title = NULL;
    }
    if(resource->collection != NULL)
    {
        AXIS2_FREE(env->allocator, resource->collection);
        resource->collection = NULL;
    }
    if(resource->entries != NULL)
    {
        int i = 0;

        /* needed to free all the resouces recursively */
        for(i = 0; i < axutil_array_list_size(resource->entries, env); i ++ )
        {
            remote_registry_resource_t *res = NULL;
            res = axutil_array_list_get(resource->entries, env, i);

            remote_registry_resource_free(res, env);
        }
        axutil_array_list_free(resource->entries, env);
        resource->entries = NULL;
    }
	if(resource->child_paths != NULL)
	{
		axutil_array_list_free(resource->child_paths, env);
		resource->child_paths = NULL;
	}

    if(resource->link_self != NULL)
    {
        AXIS2_FREE(env->allocator, resource->link_self);
    }
    if(resource->link_alternate != NULL)
    {
        AXIS2_FREE(env->allocator, resource->link_alternate);
    }
    if(resource->link_path != NULL)
    {
        AXIS2_FREE(env->allocator, resource->link_path);
    }
    if(resource->link_edit != NULL)
    {
        AXIS2_FREE(env->allocator, resource->link_edit);
    }
    if(resource->link_edit_media != NULL)
    {
        AXIS2_FREE(env->allocator, resource->link_edit_media);
    }
    if(resource->content_src_url != NULL)
    {
        AXIS2_FREE(env->allocator, resource->content_src_url);
    }

	AXIS2_FREE(env->allocator, resource);

	return AXIS2_SUCCESS;
}
Пример #7
0
axis2_status_t test_date_time(axutil_env_t *env)
{
    axutil_date_time_t *date_time = NULL;
    axutil_date_time_t *ref = NULL;
    axutil_date_time_t *date_time_offset = NULL;
    axis2_char_t *time_str = "22:45:12";
    axis2_char_t *date_str = "2000-12-12";
    axis2_char_t *date_time_str = "2000-11-11T12:30:24";
    axis2_status_t status = AXIS2_FAILURE;
    axutil_date_time_comp_result_t compare_res = AXIS2_DATE_TIME_COMP_RES_FAILURE;
    axis2_char_t *t_str = NULL, *d_str = NULL, *dt_str = NULL;
    int year , month , date , hour , min , sec , msec;

    date_time_offset = axutil_date_time_create_with_offset(env, 100);
    if(!date_time_offset)
    {
        printf("axutil_date_time_t creation failed.\n");
        return AXIS2_FAILURE;
    }
    date_time = axutil_date_time_create(env);
    if(!date_time)
    {
        printf("axutil_date_time_t creation failed.\n");
        return AXIS2_FAILURE;
    }
    status = axutil_date_time_deserialize_time(date_time, env, time_str);
    if(status)
        printf("axutil_date_time_t time string deserialization success.\n");
    status = axutil_date_time_deserialize_date(date_time, env, date_str);
    if(status)
        printf("axutil_date_time_t date string deserialization success.\n");
    status = axutil_date_time_deserialize_date_time(date_time, env, date_time_str);
    if(status)
        printf("axutil_date_time_t date time string deserialization success.\n");

    ref = axutil_date_time_create(env);
    if(!ref)
    {
        printf("axutil_date_time_t creation failed.\n");
        return AXIS2_FAILURE;
    }
    compare_res = axutil_date_time_compare(date_time, env, ref);
    if(compare_res == AXIS2_DATE_TIME_COMP_RES_FAILURE)
    {
        printf("axutil_date_time comparison failed.\n");
    }

    status = axutil_date_time_deserialize_date_time(ref, env, date_time_str);
    if(status)
        printf("axutil_date_time_t date time string deserialization success.\n");
    compare_res = axutil_date_time_compare(date_time, env, ref);
    if(compare_res == AXIS2_DATE_TIME_COMP_RES_EQUAL)
    {
        printf("axutil_date_time_t comparison success.");
    }
    status = axutil_date_time_set_date_time(date_time, env, 2008, 1, 8, 12, 18, 57, 799);
    if(status)
    {
        printf("axutil_date_time_t set date time success.\n");
    }

    t_str = axutil_date_time_serialize_time(date_time, env);
    if(!t_str)
    {
        printf("axutil_date_time_t time serialization failed.\n");
    }
    else
    {
        printf("axutil_date_time_t Time: %s\n", t_str);
    }
    d_str = axutil_date_time_serialize_date(date_time, env);
    if(!d_str)
    {
        printf("axutil_date_time_t date serialization failed.\n");
    }
    else
    {
        printf("axutil_date_time_t Date: %s\n", d_str);
    }
    dt_str = axutil_date_time_serialize_date_time(date_time, env);
    if(!dt_str)
    {
        printf("axutil_date_time_t date time serialization failed.\n");
    }
    else
    {
        printf("axutil_date_time_t Date Time: %s\n", dt_str);
    }
    year = axutil_date_time_get_year(date_time,env);
    month=axutil_date_time_get_month(date_time,env);
    date = axutil_date_time_get_day(date_time,env);
    hour = axutil_date_time_get_hour(date_time,env);
    min  = axutil_date_time_get_minute(date_time,env);
    sec  = axutil_date_time_get_second(date_time,env);
    msec = axutil_date_time_get_msec(date_time,env);
    printf("axutil_date_time_t year: %d \n",year);
    printf("axutil_date_time_t month: %d \n",month);
    printf("axutil_date_time_t date: %d \n",date);
    printf("axutil_date_time_t hour: %d \n",hour);
    printf("axutil_date_time_t min: %d \n",min);
    printf("axutil_date_time_t sec: %d \n",sec);
    printf("axutil_date_time_t msec: %d \n",msec);

    axutil_date_time_free(date_time,env);
    axutil_date_time_free(ref, env);
    axutil_date_time_free(date_time_offset, env);
    return AXIS2_SUCCESS;
}