コード例 #1
0
ファイル: jni_partition.c プロジェクト: AmitShah/opensplice
jni_partition
jni_partitionNew(
    jni_participant p, 
    const c_char* name,
    v_partitionQos qos)
{
    jni_partition _this;
    u_partition upartition;
    
    _this = NULL;
    
    if((p != NULL) && (p->uparticipant != NULL) && (name != NULL)){
        upartition = u_partitionNew(p->uparticipant, name, qos);

        if(upartition != NULL){            
            _this = jni_partition(os_malloc((size_t)(C_SIZEOF(jni_partition))));
            _this->name = name;
            _this->upartition = upartition;
        }
    }
    return _this;
}
コード例 #2
0
ファイル: d_groupInfo.c プロジェクト: diorahman/opensplice
d_storeResult
d_groupInfoInject(
    d_groupInfo _this,
    const d_store store,
    u_participant participant,
    d_group* group)
{
    d_storeResult result;
    u_group ugroup;
    u_partition upartition;
    v_partitionQos partitionQos;
    v_duration timeout;
    c_string name;

    if(_this && store && participant){
        result = d_topicInfoInject(_this->topic, store, participant);

        if(result == D_STORE_RESULT_OK){
           partitionQos = u_partitionQosNew(NULL);

           if(partitionQos) {
               d_storeReport(store, D_LEVEL_FINE, "PartitionQoS created.\n");

               upartition = u_partitionNew(participant, _this->partition,
                       partitionQos);

               if(upartition) {
                   name = d_topicInfoGetName(_this->topic);
                   d_storeReport(store, D_LEVEL_FINE,
                           "Partition %s created.\n", _this->partition);

                   timeout.seconds = 0;
                   timeout.nanoseconds = 0;
                   ugroup = u_groupNew(participant, _this->partition, name,
                           timeout);

                   if(ugroup) {
                       d_storeReport(store,
                               D_LEVEL_INFO, "Group %s.%s created.\n",
                               _this->partition, name);

                       *group = d_groupNew(_this->partition, name,
                               D_DURABILITY_PERSISTENT, _this->completeness,
                               _this->quality);

                       u_entityAction(u_entity(ugroup), setKernelGroup, *group);
                       u_entityFree(u_entity(ugroup));
                       result = D_STORE_RESULT_OK;
                   } else {
                       result = D_STORE_RESULT_OUT_OF_RESOURCES;
                       d_storeReport(store, D_LEVEL_SEVERE,
                               "Group %s.%s could NOT be created.\n",
                               _this->partition, name);
                       OS_REPORT_2(OS_ERROR, "d_groupInfoInject",
                               (os_int32)result,
                               "Group %s.%s could NOT be created.\n",
                               _this->partition, name);
                   }
                   c_free(name);
                   u_partitionFree(upartition);
               } else {
                   result = D_STORE_RESULT_OUT_OF_RESOURCES;
                   d_storeReport(store, D_LEVEL_SEVERE,
                           "Partition %s could NOT be created.\n",
                           _this->partition);
                   OS_REPORT_1(OS_ERROR, "d_groupInfoInject", (os_int32)result,
                           "Partition %s could NOT be created.\n",
                           _this->partition);
               }
               u_partitionQosFree(partitionQos);
           } else {
               result = D_STORE_RESULT_OUT_OF_RESOURCES;
               d_storeReport(store, D_LEVEL_SEVERE,
                       "PartitionQos could NOT be created.\n");
               OS_REPORT(OS_ERROR, "d_groupInfoInject", (os_int32)result,
                       "PartitionQos could NOT be created.\n");
           }
        }
    } else {
        result = D_STORE_RESULT_ILL_PARAM;
    }
    return result;
}