WO2020223845A1 - 资源添加方法、管理设备及计算机存储介质 - Google Patents

资源添加方法、管理设备及计算机存储介质 Download PDF

Info

Publication number
WO2020223845A1
WO2020223845A1 PCT/CN2019/085458 CN2019085458W WO2020223845A1 WO 2020223845 A1 WO2020223845 A1 WO 2020223845A1 CN 2019085458 W CN2019085458 W CN 2019085458W WO 2020223845 A1 WO2020223845 A1 WO 2020223845A1
Authority
WO
WIPO (PCT)
Prior art keywords
collection
parameter
resource
nesting
add
Prior art date
Application number
PCT/CN2019/085458
Other languages
English (en)
French (fr)
Inventor
张军
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2019/085458 priority Critical patent/WO2020223845A1/zh
Priority to CN201980079218.1A priority patent/CN113168323A/zh
Publication of WO2020223845A1 publication Critical patent/WO2020223845A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units

Definitions

  • FIG. 2 is a schematic diagram 1 of the implementation process of a method for adding resources proposed in an embodiment of the application;
  • FIG. 3 is a second schematic diagram of the implementation process of a resource adding method proposed in an embodiment of the application
  • FIG. 4 is a third schematic diagram of the implementation process of a method for adding resources proposed in an embodiment of the application.
  • FIG. 5 is a fourth schematic diagram of the implementation process of a method for adding resources proposed in an embodiment of this application.
  • FIG. 6 is a schematic diagram five of the implementation process of a method for adding resources proposed in an embodiment of the application.
  • FIG. 7 is a sixth schematic diagram of the implementation process of a resource adding method proposed by an embodiment of the application.
  • FIG. 8 is a schematic diagram 1 of the composition structure of the management device proposed in an embodiment of the application.
  • FIG. 9 is a second schematic diagram of the composition structure of the management device proposed in an embodiment of the application.
  • OCF is an emerging IoT application layer technology standard organization. OCF develops a Restful service framework for interconnection between IoT devices. In the OCF service framework, resources are used to characterize IoT entities, entity functional services, and device status information , The entity that provides the resource is the OCF server, and the entity that accesses the resource is the OCF client. For example, the mobile application of a smartphone that obtains indoor environment status data is the OCF client, and the sensor that monitors indoor environment status data is the OCF server. The business interaction between the OCF client and the OCF server is through the creation and reading of OCF resources , Update, delete, or notify.
  • FIG 1 is a schematic diagram of the interaction in the OCF service framework.
  • the OCF client sends a request to operate on the resource.
  • the request carries the resource operation method and the resource's Uniform Resource Identifier (URI), OCF service
  • URI Uniform Resource Identifier
  • OCF service The terminal returns a response, and the response carries the characterization of the resource.
  • the characterization of OCF resources includes information such as resource URI, resource type, and interface.
  • OCF defines a resource link.
  • the OCF server can provide its own resources in the form of a resource link, so as to facilitate the OCF client to discover resources.
  • Collection resources include OCF Links, which represent a collection of one or more Link resources. Collection resources can reference multiple target resources or other Collection resources. For example, a collection resource contains the switch resource of device A and the switch resource of device B, forming a centralized resource group. Clients can request multiple resources at the same time through the interface of accessing Collection resources. Collection will send the request to each resource in Links, collect the response returned by each resource, and return it to the client in a unified manner.
  • the Collection resource contains another Collection resource
  • a nesting of the Collection resource is formed.
  • the resources corresponding to the Links contained in the collection resource are called the sub-resources of the collection, also called the lower-level resources of the collection.
  • a resource addition method proposed in this application can add a depth attribute representing the nesting depth in the Collection, that is, increase the corresponding nesting parameter, and at the same time introduce a management device in the OCF framework, and the management device can add resources based on the nested parameters To manage. Specifically, after the management device completes the registration of the Collection according to the nested parameters corresponding to the Collection, it can compare with the nested parameters corresponding to the Collection to be added to determine whether the Collection to be added can be added. In this way, the loop nesting between Collection resources can be avoided in the process of resource addition, the problem that the instruction cannot run due to the repeated instruction cycle is solved, and the defect of instruction flooding is overcome.
  • the management device when the management device is introduced into the OCF framework, the management device can be integrated with the server in the OCF framework, the client in the OCF framework, or the integrated In the third-party device in the OCF framework, therefore, the management device that receives the addition request can be any one of the client, server, or third-party device in the OCF framework.
  • the client when the management device is integrated into the server or third-party device in the OCF framework, the client can update the second collection first, and then the second collection can be managed according to the Collection Manager ID.
  • the device sends an add request to add the first Collection; when the management device is integrated into the client in the OCF framework, the management device can directly obtain the add request sent by the client, and after confirming that the first Collection can be added to the second collection After the collection, the client is instructed to add to the first collection.
  • the URI is represented by "href” in the OCF resource characterization, and is used to provide the address of the OCF server resource.
  • the value of "href” is the specific resource URI.
  • the OCF client uses the resource URI To access the resources of the OCF server; RT is represented by “rt” in the OCF resource characterization, which means the type of resource; the interface is represented by "if" in the OCF resource characterization, and provides resource viewing and resource support responses.
  • the Collection resource may include a Link pointing to itself, and the value self must be included in the rel attribute of the Link.
  • the attributes of the Link containing the self value will not be further called by the batch command. Therefore, the batch instruction will not call the Link that points to itself, and avoid calling it indefinitely through self-loop. In other words, the Link that the Collection resource points to itself will not cause an infinite loop.
  • the management device can be any terminal with communication and storage functions, such as: tablet computer, mobile phone, e-reader, remote control, personal computer (PC), notebook Terminals such as computers, in-vehicle devices, Internet TVs, and wearable devices.
  • terminals such as: tablet computer, mobile phone, e-reader, remote control, personal computer (PC), notebook Terminals such as computers, in-vehicle devices, Internet TVs, and wearable devices.
  • Step 102 Obtain the first nesting parameter corresponding to the first Collection according to the first identifier and the preset collection list.
  • the management device may obtain the first nesting parameter corresponding to the first Collection according to the first identifier and the preset collection list.
  • the first nesting parameter is used to characterize the nesting depth of the first Collection.
  • a depth attribute that is, a nesting parameter
  • a nesting parameter can be added to the Collection resource to indicate the nesting depth of the Collection. If a Collection contains only non-Collection resource Links, the nesting parameter of the Collection is 1. This is because non-Collection resources have no depth attribute, and the default nesting parameter is 0. For example, if Collection1 contains Collection2 with a nested parameter of 2, and Collection2 contains Collection3 with a nested parameter of 1, then Collection1 has three levels of nesting, that is, the nested parameter of Collection1 is 3.
  • the management device may further obtain the first nesting parameter corresponding to the first Collection according to the first identifier and the preset collection list. Specifically, the management device may first search for the first Collection in the pre-stored preset collection list according to the first identifier. If the first Collection is stored in the preset collection list, the management device may directly select the preset collection list. Read the first nested parameter corresponding to the first Collection; if the first Collection is not stored in the preset collection list, the management device can send a first query request to the first Collection according to the first identifier to obtain the corresponding The first nested parameter.
  • the management device may send a first query request to the first Collection according to the first identifier corresponding to the first Collection, so as to The first nested parameter is queried.
  • the management device can determine whether to add the first Collection to the first collection according to the first nesting parameter.
  • the second Collection is
  • the second collection is a collection resource that has been registered. Therefore, the management device stores the second nesting parameter corresponding to the second collection in the preset collection list.
  • the management device may compare the first nested parameter with the second nested parameter to obtain the comparison result, and then further according to the comparison result Determine whether to add the first Collection to the second Collection.
  • the management device compares the first nested parameter with the second nested parameter, if the comparison result is that the first nested parameter is less than or equal to the second nested parameter, then The management device can consider that the child Collection resources of the first Collection do not include the second Collection, so it can be determined to add the first Collection to the second Collection; if the comparison result is that the first nested parameter is greater than the second nested parameter, then the management device can It is considered that the child Collection resources of the first Collection may include the second Collection, so it can be determined not to add the first Collection to the second Collection.
  • the management device may also combine The preset nesting threshold further determines whether to add the first Collection. Specifically, if the first nesting parameter is greater than the second nesting parameter, the management device may continue to compare the first nesting parameter with the preset nesting threshold, so as to further determine whether to add the first Collection according to the comparison result. Wherein, the preset nesting threshold is greater than the second nesting parameter.
  • the Link corresponding to the first Collection may be added to the Links corresponding to the second Collection.
  • the management device can send the addition permission instruction to the second collection after determining to add the first collection to the second collection After the second Collection receives the add instruction, the Link corresponding to the first Collection can be added to the Links corresponding to the second Collection.
  • the management device can send an add permission instruction to the client after determining to add the first Collection to the second Collection, and the client After receiving the add instruction, the terminal can update the second Collection and add the Link corresponding to the first Collection to the Links corresponding to the second Collection.
  • a requestadd resource in the preset collection list of the management device, in addition to storing the collection managed by it and the corresponding nested parameters, a requestadd resource can also be set for each Collection managed by it.
  • the requestadd resource is used to indicate the sub-resource that is requested to be added to the Collection. Therefore, the specific way for the management device to receive the add request sent by the second Collection can be that the second Collection adds the first Collection to the requestadd resource corresponding to the second Collection stored in the management device, and the management device determines whether to add the first collection. After Collection. If allowed, the management device sends an add permission instruction to the second collection to return a success response; otherwise, it returns a failure response.
  • the management device may also receive the addition request sent by the client according to the requestadd resource.
  • the management device when the adding request is sent from the second Collection to the management device, that is, when the management device interacts with the second Collection, the management device not only implements resource addition according to the requestadd resource, but also
  • the adding of resources can be realized by adding pendingadd attribute and addpermission attribute to the Collection resource, where pendingadd attribute indicates the sub-resource to be added, and addpermission attribute indicates whether adding is allowed. Therefore, the specific way for the management device to receive the add request sent by the second Collection can be that the second Collection adds the first Collection to the pendingadd resource corresponding to the second Collection stored in the management device, and the management device determines whether to add the first collection.
  • addpermission can be set, so that after the addpermission attribute value is valid, whether to add it can be determined according to addpermission. It should be noted that after the addition is completed or the addition is rejected, the management device can clear the pendingadd attribute value and the addpermission attribute value corresponding to the second collection.
  • the management device determines whether to add the first Collection, when setting the addpermission, if the management device allows the first Collection to be added to the second Collection, the management device can add the first collection to the second collection.
  • the addpermission attribute value corresponding to the second Collection is set to True to realize the sending of an add permission instruction to the second Collection; if not allowed, the management device can set the addpermission attribute value corresponding to the second Collection to False,
  • the management device may cyclically traverse the subordinate Collection of the first Collection to be added to the second Collection until the sub-resource type is a non-Collection resource, and then determine all sub-resources of the first Collection one by one. Whether the Collection includes the second Collection. If all the child collections of the first collection include the second collection, reject the add request corresponding to the first collection and return a failure response; if all the child collections of the first collection do not include the second collection, add the first collection to the second collection Collection, and return a successful response.
  • the overhead will be relatively large. In order to save resources, it is possible to traverse all the sub-Collections of the first Collection while checking whether to include the second Collection. Once it is determined that the second Collection is included, the traversal is stopped without waiting for all the sub-Collections of the first Collection to be traversed.
  • Step 105 Receive a registration request; where the registration request carries a second identifier corresponding to the second Collection.
  • the management device may first receive the registration request before receiving the addition request.
  • the registration request carries the second identifier corresponding to the second Collection.
  • the registration request can be used to create and register the second Collection. In other words, the management device needs to register the second Collection first before adding sub-Collection resources to the second Collection.
  • the registration request received by the management device may be sent by the second collection or sent by the client.
  • the management device when the management device is integrated into the server or third-party device in the OCF framework, it can receive the registration request sent by the second collection; when the management device is integrated into the client or third-party device in the OCF framework, it can be used with The interaction of the client application program directly receives the registration request sent by the client.
  • the client when the management device is integrated into the server or third-party device in the OCF framework, the client can first create a second Collection, and then the second Collection can be managed according to the Collection Manager ID.
  • the device sends a registration request to register the second collection; when the management device is integrated into the client in the OCF framework, the management device can directly obtain the registration request sent by the client, and instruct the client to create the second collection after registering The second Collection.
  • the management device may obtain the sub-resource corresponding to the second Collection according to the second identifier.
  • the management device may further determine the second nesting parameter corresponding to the second Collection according to the subresource.
  • the management device may store the second Collection and the second nested parameter in the preset collection list, thereby completing the registration of the second Collection . Specifically, the management device may save the correspondence between the second Collection and the second nested parameter in the preset collection list.
  • the management device may also register the first collection through the method described in step 105 to step 108 above.
  • the embodiment of the present application provides a method for adding resources.
  • the management device receives an adding request; wherein the adding request carries a first identifier corresponding to a first collection resource Collection; the first Collection is a collection resource to be added to the second Collection; An identification and a list of preset collections to obtain the first nested parameter corresponding to the first collection; determine whether to add the first collection according to the first nested parameter; when it is determined to add the first collection, respond to the adding request and send the adding permission instruction, To add the first Collection to the second Collection.
  • Step 102b When the first Collection is included in the pre-stored collection list, obtain the first nested parameter from the pre-stored collection list.
  • Step 103b When the first nested parameter is greater than the second nested parameter, it is determined not to add the first collection.
  • first nested parameter is greater than the second nested parameter, it can be considered that all the child collections of the first Collection may include the second Collection, that is, the first Collection is added to the second Collection. Loop nesting may occur later, so it can be determined not to add the first Collection.
  • Step 203 When the second Collection is included, it is determined not to add the first Collection.
  • Step 107a Determine the third identifier corresponding to the sub-resource.
  • the management device may first determine the third identifier corresponding to the sub-resource.
  • the management device when it determines the second nested parameter according to the third nested parameter, it may first determine the nested parameter with the largest value in the third nested parameter; and then log the value The largest nested parameter is incremented by 1 to obtain the second nested parameter.
  • the third nested parameter corresponding to the child resource of the second Collection includes 2 and 4, then the second nested parameter can be determined to be 5 according to the nested parameter 4 with the largest value in the third nested parameter, that is, the second collection
  • the nesting depth is 5.
  • the method for the management device to obtain the third nesting parameter corresponding to the sub-resource according to the third identifier may include the following steps:
  • Step 301 Determine the resource type corresponding to the sub-resource according to the third identifier.
  • the management device may determine the resource type corresponding to the sub-resource of the second Collection according to the third identifier.
  • the resource types corresponding to the sub-resources of the second Collection can include Collection resources and non-Collection resources
  • the management device can check the resource types of the sub-resources according to the third identifier of the sub-resource. determine.
  • the management device may determine the resource type of the sub-resource according to the RT in the third identifier. For example, when the RT of the Link in the third identifier is oic.wk.col, the management device may determine that the corresponding resource type is a Collection resource.
  • Step 302 When the resource type is a non-Collection resource, set the third nested parameter to zero.
  • the management device may set the third nesting parameter to zero .
  • the sub-resources of non-Collection resources have no depth attribute, so the depth may be 0 by default, that is, the corresponding nesting parameter is 0.
  • Step 303 When the resource type is Collection resource, obtain the third nested parameter corresponding to the sub-resource according to the third identifier and the pre-stored resource list.
  • the management device may further based on the third identifier and the pre-stored resource list Get the third nested parameter corresponding to the child resource.
  • the management device may first determine whether the preset collection list includes sub-resources according to the third identifier; if the pre-stored collection list includes the sub-resources, the management device may select from the pre-stored collection list Obtain the third nested parameter; if the sub-resource is not included in the pre-stored set list, the management device can send a second query request to the sub-resource, so that the third nested parameter can be obtained.
  • the embodiment of the present application provides a method for adding resources.
  • the management device receives an adding request; wherein the adding request carries a first identifier corresponding to a first collection resource Collection; the first Collection is a collection resource to be added to the second Collection; An identification and a list of preset collections to obtain the first nested parameter corresponding to the first collection; determine whether to add the first collection according to the first nested parameter; when it is determined to add the first collection, respond to the adding request and send the adding permission instruction, To add the first Collection to the second Collection.
  • the management device may first obtain the first nesting parameter corresponding to the first Collection, and then may obtain the first nesting parameter according to the first nesting.
  • the set of parameters determines whether to add to the first Collection. Since the nested parameters can represent the nesting depth of the Collection, the first nested parameter can be compared with the second nested parameter corresponding to the second collection to determine the first nested parameter.
  • FIG. 4 is a schematic diagram of the implementation process of a resource adding method proposed in an embodiment of this application.
  • the method for the management device to register the resource collection may include the following steps:
  • the first device may be a client in the OCF framework, that is, the first device and the management device are different devices in the OCF framework.
  • Step 402 Collection1 sends a registration request to the management device.
  • the management device may obtain the subresource corresponding to Collection1 according to the flag corresponding to Collection1.
  • the management device may first determine the nesting parameter corresponding to the subresource.
  • the management device may store the nested parameters corresponding to Collection1 in the preset collection list according to the corresponding relationship with Collection1, so as to realize the registration of Collection1.
  • the property of the nesting parameter depth representing the nesting depth is added to Collection1, and at the same time, a management device is introduced into the OCF framework to manage the creation and registration of Collection1, and to register Collection1 At this time, the Collection1 and its corresponding nested parameters are stored in the preset collection list, so that when resources are subsequently added to Collection1, the selection of sub-resources can be performed according to the nested parameters to avoid the loop nesting of resources.
  • Figure 5 is a schematic diagram four of the implementation process of a resource adding method proposed in the embodiment of this application, as shown in Figure 5, if the management introduced in the OCF framework
  • the device is integrated on the server or third-party device in the OCF framework, and the method for managing the device to add resources can include the following steps:
  • Collection1 after Collection1 is updated, it can send an adding request to the management device.
  • the add request carries the identifier corresponding to Collection3, and the add request is used to add Collection3 to Collection1.
  • any sub-Collection is Collection1, that is, whether Collection1 is a sub-Collection of Collection3, if Collection1 is not a sub-Collection of Collection3, then it is determined to add Collection3, if Collection1 is a sub-Collection of Collection3, it is determined not to add Collection3, which can avoid collection Loop nesting of resources.
  • Step 502 The management device determines the child resource corresponding to Collection1.
  • Step 506 The management device sends a registration instruction to the first device; where the registration instruction carries the nested parameter corresponding to Collection1.
  • the management device can compare Collection3 with the nested parameter corresponding to Collection1 stored in the preset collection list, and then determine whether to add Collection3 to Collection3 according to the comparison result. Collection1.
  • the management device can decide to add Collection3; if depth3 is greater than depth1, then manage The device can decide not to add Collection3, or it can make the next decision according to the preset nesting threshold depth0. Specifically, when Collection3 is greater than depth0, it is determined not to add Collection3; when Collection3 is greater than depth1 and less than depth0, the management device can traverse and query all the sub-Collections of Collection3 until the sub-resource type is non-Collection resources, and then determine the status of Collection3 one by one.
  • Step 511 When it is determined to add Collection3, the management device sends an adding permission instruction to the first device.
  • Step 512 The first device updates Collection1 according to Collection3.
  • the management device after the management device determines to add Collection3 to Collection1, it can send an addition permission instruction to the first device. After receiving the addition instruction, the first device can update Collection1 according to Collection3.
  • the embodiment of the present application provides a method for adding resources.
  • the management device receives an adding request; wherein the adding request carries a first identifier corresponding to a first collection resource Collection; the first Collection is a collection resource to be added to the second Collection; An identification and a list of preset collections to obtain the first nested parameter corresponding to the first collection; determine whether to add the first collection according to the first nested parameter; when it is determined to add the first collection, respond to the adding request and send the adding permission instruction, To add the first Collection to the second Collection.
  • FIG. 8 is a schematic diagram 1 of the composition structure of the management device proposed in this embodiment of the application.
  • the device 1 may include a receiving part 11, an acquiring part 12, a judging part 13, a sending part 14, a determining part 15, and a storing part 16.
  • the determining part 15 is configured to receive a registration request before receiving the adding request; wherein, the registration request carries the second identifier corresponding to the second Collection.
  • the acquiring part 12 is further configured to acquire the sub-resource corresponding to the second Collection according to the second identifier.
  • the storage part 16 is configured to store the second nested parameter in the preset collection list to register the second collection.
  • the acquiring part 12 is further specifically configured to send the first query request to the first Collection according to the first identifier; and receive the data sent by the first Collection Query response; wherein the query response carries the first nested parameter.
  • the determining part 13 is further specifically configured to determine to add the first Collection when the first nesting parameter is less than or equal to the second nesting parameter; and When the first nesting parameter is greater than the second nesting parameter and less than or equal to the preset nesting threshold, all sub-Collections corresponding to the first Collection are acquired to determine whether to add according to all the sub-Collections The first Collection; wherein the preset nesting threshold is greater than the second nesting parameter; and when the first nesting parameter is greater than the preset nesting threshold, it is determined not to add the first Collection.
  • the judging part 13 is also specifically configured to traverse all the sub-Collections, and judge whether all the sub-Collections include the second Collection; and when the second Collection is not included When collecting, it is determined to add the first Collection; and when the second Collection is included, it is determined not to add the first Collection.
  • the determining part 15 is further specifically configured to determine the resource type corresponding to the sub-resource according to the third identifier; and when the resource type is a non-Collection resource, The third nesting parameter is set to zero; and when the resource type is a Collection resource, the third nesting parameter corresponding to the sub-resource is acquired according to the third identifier and the pre-stored resource list.
  • the determining part 15 is also specifically configured to determine the nested parameter with the largest value among the third nested parameters; and perform the calculation on the nested parameter with the largest value. Add 1 to obtain the second nested parameter.
  • the aforementioned processor 17 may be an Application Specific Integrated Circuit (ASIC), a digital signal processor (Digital Signal Processor, DSP), or a digital signal processing device (Digital Signal Processing Device, DSPD). ), Programmable Logic Device (ProgRAMmable Logic Device, PLD), Field Programmable Gate Array (Field ProgRAMmable Gate Array, FPGA), Central Processing Unit (CPU), Controller, Microcontroller, Microprocessor At least one of. It is understandable that, for different devices, the electronic devices used to implement the above-mentioned processor functions may also be other, which is not specifically limited in the embodiment of the present application.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processor
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic Device
  • Field Programmable Gate Array Field ProgRAMmable Gate Array
  • CPU Central Processing Unit
  • Controller Microcontroller
  • Microprocessor At least one of. It is understandable that, for different devices, the electronic devices used to implement the above-mentioned processor functions may
  • the above-mentioned memory 18 may be a volatile memory (volatile memory), such as a random-access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory). ), such as Read-Only Memory (ROM), Flash Memory (Flash Memory), Hard Disk Drive (HDD) or Solid-State Drive (SSD); or the above types A combination of the first memory and provide instructions and data to the processor 17.
  • volatile memory such as a random-access memory (Random-Access Memory, RAM); or a non-volatile memory (non-volatile memory).
  • ROM Read-Only Memory
  • Flash Memory Flash Memory
  • HDD Hard Disk Drive
  • SSD Solid-State Drive
  • the functional modules in this embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional module.
  • the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this embodiment is essentially or correct
  • the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal A computer, a server, or a network device, etc.) or a processor (processor) execute all or part of the steps of the method in this embodiment.
  • the aforementioned storage media include: U disk, mobile hard disk, read only memory (Read Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.
  • the set of parameters determines whether to add to the first Collection. Since the nested parameters can represent the nesting depth of the Collection, the first nested parameter can be compared with the second nested parameter corresponding to the second collection to determine the first nested parameter. Whether the first Collection and the second Collection are nested in each other to determine whether to add the first Collection, so that the loop nesting between Collection resources can be avoided during the process of resource addition, and the problem that the instructions generated by the instruction cycle cannot run is solved , To overcome the shortcomings of the flood of instructions.
  • the embodiment of the present application provides a first computer-readable storage medium on which a program is stored, and when the program is executed by a processor, the method as in the foregoing embodiment is implemented.
  • the program instructions corresponding to a resource adding method in this embodiment can be stored on storage media such as optical disks, hard disks, USB flash drives, etc.
  • storage media such as optical disks, hard disks, USB flash drives, etc.
  • an adding permission instruction is sent to add the first Collection to the second Collection.
  • this application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program codes.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device realizes the functions specified in one or more processes in the schematic diagram and/or one block or more in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in one or more processes in the schematic diagram and/or one block or more in the block diagram.
  • the embodiments of the present application provide a method for adding resources, a management device, and a computer storage medium.
  • the management device receives an addition request; wherein the addition request carries a first identifier corresponding to the first collection of resources; the first Collection is to be added to the second collection.
  • Collection resource get the first nested parameter corresponding to the first collection according to the first identifier and the preset collection list; determine whether to add the first collection according to the first nested parameter; when it is determined to add the first collection, respond to add Request, send an add permission instruction to add the first collection to the second collection.
  • the management device may first obtain the first nesting parameter corresponding to the first Collection, and then may obtain the first nesting parameter according to the first nesting.
  • the set of parameters determines whether to add to the first Collection. Since the nested parameters can represent the nesting depth of the Collection, the first nested parameter can be compared with the second nested parameter corresponding to the second collection to determine the first nested parameter.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种资源添加方法、管理设备及计算机存储介质,该资源添加方法包括:接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。

Description

资源添加方法、管理设备及计算机存储介质 技术领域
本申请实施例涉及物联网资源领域,尤其涉及一种资源添加方法、管理设备及计算机存储介质。
背景技术
全球已经进入物联网加快部署的阶段,庞大的连接设备必然对应着众多技术标准,开放互联基金会(Open Connectivity Foundation,OCF)是新兴的物联网应用层技术标准组织,OCF为物联网设备之间实现互联互通制定服务框架。OCF网络由客户端和服务端构成,客户端和服务端基于OCF协议通信,其中,提供资源的实体是OCF服务端,访问资源的实体是OCF客户端。为表示资源之间的关联关系,OCF定义了资源链Link,OCF服务端可以以Link的形式提供自己所拥有的资源,而一个或者多个Link的集合可以定义为Collection资源。
当Collection资源中包含另一个Collection资源时,就形成了Collection资源的嵌套,而两个Collection资源互相包含时,便形成了循环嵌套。在物联网系统中,如果需要添加的子Collection资源与原有的父Collection资源形成了循环嵌套,就会存在指令循环往复的问题,从而导致指令无法运行,造成指令泛滥的缺陷。
发明内容
本申请实施例提供一种资源添加方法、管理设备及计算机存储介质,可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
本申请实施例的技术方案是这样实现的:
本申请实施例提出了一种资源添加方法,所述方法包括:
接收添加请求;其中,所述添加请求携第一集合资源Collection对应的第一标识;所述第一Collection为待添加至第二Collection的集合资源;
根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数;
根据所述第一嵌套参数判断是否添加所述第一Collection;
当判定添加所述第一Collection时,响应所述添加请求,发送添加许可指令,以将所述第一Collection添加至所述第二Collection。
本申请实施例提供了一种资源添加方法、管理设备及计算机存储介质,管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对 应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
附图说明
图1为OCF服务框架中的交互示意图;
图2为本申请实施例提出的一种资源添加方法的实现流程示意图一;
图3为本申请实施例提出的一种资源添加方法的实现流程示意图二;
图4为本申请实施例提出的一种资源添加方法的实现流程示意图三;
图5为本申请实施例提出的一种资源添加方法的实现流程示意图四;
图6为本申请实施例提出的一种资源添加方法的实现流程示意图五;
图7为本申请实施例提出的一种资源添加方法的实现流程示意图六;
图8为本申请实施例提出的管理设备的组成结构示意图一;
图9为本申请实施例提出的管理设备的组成结构示意图二。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。可以理解的是,此处所描述的具体实施例仅仅用于解释相关申请,而非对该申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关申请相关的部分。
OCF是新兴的物联网应用层技术标准组织,OCF为物联网设备之间实现互联互通制定Restful服务框架,在OCF服务框架中,通过资源来表征物联网实体、实体的功能服务以及设备状态等信息,提供资源的实体是OCF服务端,访问资源的实体是OCF客户端。例如,获取室内环境状态数据的智能手机的移动应用程序是OCF客户端,监测室内环境状态数据的传感器是OCF服务端,OCF客户端和OCF服务端的业务交互是通过对OCF资源的创建、读取、更新、删除或者通知等资源操作方法实现的。
图1为OCF服务框架中的交互示意图,如图1所示,OCF客户端发送请求对资源进行操作,请求中携带资源操作方法和资源的统一资源标识符(Uniform Resource Identifier,URI),OCF服务端返回响应,响应中携带资源的表征。其中,OCF资源的表征包括资源URI、资源类型、接口等信息。
为了表示资源之间的关联关系,OCF定义了资源Link,OCF服务端可以以资源Link的形式提供自身所拥有的资源,从而便于OCF客户端发现资源。
Collection资源包含OCF Links,表示一个或多个Link资源的集合,Collection资源可以引用多个目标资源或其他Collection资源。例如,一个Collection资源包含设备A的开关资源和设备B的开关资源,形成了集中的资源组。客户端可以通过访问Collection资源的接口同时请求多个资源,Collection会把请求发送给Links中的每一个资源,并收集每个资源返回的响应,集中后统一返回给客户端。
若Collection资源中包含另一个Collection资源,就形成了Collection资源的嵌套。在Collection嵌套关系中,将Collection资源包含的Links所对应的资源称为该Collection的子资源,也称为Collection的下级资源。
若在Collection嵌套中,处于外层的Collection又被添加到处于内层的Collection中,则形成了循环嵌套。现有技术中,Collection添加子Collection资源时,由于无法获知所引用的子Collection资源以及子Collection资源的下级Collection是否包含对父Collection 资源的引用,因此无法避免形成循环嵌套,由于循环嵌套会产生指令的循环往复,从而导致指令无法运行,造成指令泛滥的缺陷。
本申请提出的一种资源添加方法,可以在Collection中增加表示嵌套深度depth属性,即增加对应的嵌套参数,同时在OCF框架中引入管理设备,管理设备可以根据嵌套参数对资源的添加进行管理。具体地,当管理设备按照Collection对应的嵌套参数通过完成Collection的注册之后,可以与待添加Collection对应的嵌套参数进行比较,从而判断能否添加该待添加Collection。从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
在本申请的一实施例中,提供了一种资源添加方法,图2为本申请实施例提出的一种资源添加方法的实现流程示意图一,如图2所示,在本申请的实施例中,管理设备进行资源添加的方法可以包括以下步骤:
步骤101、接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源。
在本申请的实施例中,管理设备可以先接收添加请求。其中,添加请求中携带有第一Collection对应的第一标识,添加请求用于将第一Collection添加至第二Collection中,即第一Collection为待添加至第二Collection的集合资源。具体地,第一Collection和第二Collection均为已经完成注册的集合资源。
需要说明的是,在本申请的实施例中,接收添加请求的管理设备可以为OCF框架中的客户端,也可以为OCF框架中的服务端,还可以为OCF框架中的第三方设备。
进一步地,在本申请的实施中,管理设备可以接收由OCF框架中的客户端发送的添加请求,也可以接收由第二Collection直接发送的添加请求。
需要说明的是,在本申请的实施例中,可以在OCF框架中引入集合资源管理服务Collection Manager Service,即管理设备对Collection的创建、添加等操作进行管理。其中,管理设备可以通过Collection Manager身份(identification,ID)进行标识,任意一个Collection可以通过Collection Manager ID在至少一个管理设备中确定出与Collection Manager ID对应的管理设备。也就是说,第二Collection向管理设备发送的添加请求时,具体可以通过Collection Manager ID定位出对应的管理设备,然后便可以向管理设备发送添加请求。
进一步地,在本申请的实施例中,管理设备在对Collection进行管理时,可以将其管理的全部Collection以及全部Collection对应的标识存储在预设集合列表中。
需要说明的是,在本申请的实施例中,在OCF框架中引入管理设备时,管理设备既可以集成在OCF框架中的服务端,也可以集成在OCF框架中的客户端,还可以为集成在OCF框架中的第三方设备中,因此,接收添加请求的管理设备可以为OCF框架中客户端、服务端或者第三方设备中的任意一个。
进一步地,在本申请的实施例中,管理设备接收到的添加请求可以是由第二Collection发送的,也可以是由客户端发送的。例如,当管理设备集成在OCF框架中的服务端或者第三方设备时,可以接收由第二Collection发送的添加请求;当管理设备集成在OCF框架中的客户端或者第三方设备时,可以通过与客户端的应用程序的交互直接接收由客户端发送的添加请求。
需要说明的是,在本申请的实施中,当管理设备集成在OCF框架中的服务端或者第三方设备时,客户端可以先更新第二Collection,然后第二Collection便可以按照 Collection Manager ID向管理设备发送添加请求,以对第一Collection进行添加;当管理设备集成在OCF框架中的客户端时,管理设备可以直接获取客户端发送的添加请求,并在确认可以将第一Collection添加至第二Collection后指示客户端对第一Collection进行添加。
需要说明的是,在本申请的实施中,添加请求中携带有第一Collection对应的第一标识,具体地,第一标识可以用于表征第一Collection的具体标识信息,例如,第一标识可以包括第一Collection对应的URI、资源类型(Resource Type,RT)以及接口等具体信息。
进一步地,在本申请的实施例中,URI在OCF资源表征中用“href”表示,用于提供OCF服务端资源的地址,“href”的值是具体的资源URI,OCF客户端通过资源URI来访问OCF服务端的资源;RT在OCF资源表征中用“rt”表示,表示资源的类型;接口在OCF资源表征中用“if”表示,提供对资源的查看以及资源支持的响应。
为表示资源之间的关联关系,OCF定义了资源Link,OCF服务端可以以资源Link的形式提供自己所拥有的资源,便于OCF客户端发现自己的资源。其中,Link对应的标识信息可以包括表示包含Link的属主资源的UR的anchor、表示Link引用的目标资源的URI的href、表示引用的资源URI和上下文URI的关系的rel、表示目标资源的资源类型RT的rt以及表示可以访问目标资源的消息端点Endpoints的eps。
进一步地,在本申请的实施例中,Collection资源中可能包含指向自身的Link,需在该Link的rel属性中包含值self。包含self值的Link,其属性不会被批处理指令进一步调用。因此,批处理指令不会调用指向自身的Link,避免通过自我循环无限调用下去。也就是说,Collection资源指向自身的Link不会引起无限循环。
需要说明的是,在本申请的实施例中,管理设备可以为任何具备通信和存储功能的终端,例如:平板电脑、手机、电子阅读器、遥控器、个人计算机(Personal Computer,PC)、笔记本电脑、车载设备、网络电视、可穿戴设备等终端。
步骤102、根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数。
在本申请的实施例中,管理设备在接收携带有第一Collection的第一标识的添加请求之后,可以根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数。其中,第一嵌套参数用于表征第一Collection的嵌套深度。
进一步地,在本申请的实施中,可以在Collection资源中增加depth属性,即嵌套参数,用于表示Collection嵌套深度。若一个Collection仅包含非Collection的资源Links,则该Collection的嵌套参数为1,这是因为非Collection的资源无depth属性,默认嵌套参数为0。例如,Collection1包含嵌套参数为2的Collection2,Collection2包含嵌套参数为1的Collection3,那么Collection1为三层嵌套,即Collection1的嵌套参数为3。
需要说明的是,在本申请的实施中,管理设备在获得第一Collection对应的第一标识之后,可以根据第一标识和预设集合列表,进一步获得第一Collection对应的第一嵌套参数。具体地,管理设备可以先根据第一标识在预先存储的预设集合列表中对第一Collection进行查找,如果预设集合列表中存储有第一Collection,那么管理设备可以直接从预设集合列表中读取第一Collection对应的第一嵌套参数;如果预设集合列表中没有存储第一Collection,那么管理设备可以根据第一标识向第一Collection发送第一查询请求,以获得第一Collection对应的第一嵌套参数。
需要说明的是,在本申请的实施中,管理设备可以在存储的预设集合列表中保存其管理的全部Collection的具体信息,例如,预设集合列表中保存有Collection1和Collection1对应的嵌套参数3。因此,当预设集合列表中包括有第一Collection时,管 理设备便可以从预设集合列表中读取第一Collection对应的第一嵌套参数。
进一步地,在本申请的实施中,当预设集合列表中不包括第一Collection时,管理设备可以根据第一Collection对应的第一标识向第一Collection发送第一查询请求,以对第一Collection的第一嵌套参数进行查询。
步骤103、根据第一嵌套参数判断是否添加第一Collection。
在本申请的实施例中,管理设备在根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数之后,便可以根据第一嵌套参数判断是否将第一Collection添加至第二Collection。
需要说明的是,在本申请的实施中,第二Collection为已经完成注册的集合资源,因此,管理设备在预设集合列表中存储有第二Collection对应的第二嵌套参数。
进一步地,在本申请的实施中,管理设备在根据第一标识获得第一嵌套参数之后,可以将第一嵌套参数和第二嵌套参数进行比较,获得比较结果,然后根据比较结果进一步确定是否将第一Collection添加至第二Collection。
需要说明的是,在本申请的实施中,管理设备在将第一嵌套参数和第二嵌套参数进行比较之后,如果比较结果为第一嵌套参数小于或者等于第二嵌套参数,那么管理设备可以认为第一Collection的子Collection资源不包括第二Collection,因此可以确定将第一Collection添加至第二Collection;如果比较结果为第一嵌套参数大于第二嵌套参数,那么管理设备可以认为第一Collection的子Collection资源可能包括第二Collection,因此可以确定不将第一Collection添加至第二Collection。
进一步地,在本申请的实施中,管理设备在将第一嵌套参数和第二嵌套参数进行比较之后,如果比较结果为第一嵌套参数大于第二嵌套参数,管理设备还可以结合预设嵌套阈值进一步对是否添加第一Collection进行判定。具体地,如果第一嵌套参数大于第二嵌套参数,管理设备可以继续将第一嵌套参数与预设嵌套阈值进行比较,从而根据比较结果进一步确定是否添加第一Collection。其中,预设嵌套阈值大于第二嵌套参数。
需要说明的是,在本申请的实施例中,如果第一嵌套参数大于第二嵌套参数且小于或者等于预设嵌套阈值,那么管理设备可以获取第一Collection对应的全部子Collection,然后根据全部子Collection进一步对是否添加第一Collection进行判定;如果第一嵌套参数大于预设嵌套阈值,那么管理设备可以确定不将第一Collection添加至第二Collection。
步骤104、当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。
在本申请的实施例中,管理设备在根据第一嵌套参数判断是否添加第一Collection之后,如果判定将第一Collection添加至第二Collection中,那么管理设备可以发送表征允许进行集合资源添加的添加许可指令,以指示第二Collection添加第一Collection。
需要说明的是,在本申请的实施例中,在添加第一Collection时,可以将第一Collection对应的Link添加至第二Collection对应的Links中。
进一步地,在本申请的实施中,如果添加请求是由第二Collection发送至管理设备的,那么管理设备在判定将第一Collection添加至第二Collection之后,便可以向第二Collection发送添加许可指令,第二Collection在接收到添加指令之后,便可以将第一Collection对应的Link添加至第二Collection对应的Links中。
进一步地,在本申请的实施中,如果添加请求是由客户端发送至管理设备的,那么管理设备在判定将第一Collection添加至第二Collection之后,便可以向客户端发送添加许可指令,客户端在接收到添加指令之后,便可以对第二Collection进行更新,并将第一Collection对应的Link添加至第二Collection对应的Links中。
需要说明的是,在本申请的实施例中,在管理设备的预设集合列表中,除了保存其管理的Collection及对应的嵌套参数以外,还可以对其管理的每一个Collection设置一个requestadd资源,requestadd资源用于表示请求添加到该Collection的子资源。因此,管理设备接收第二Collection发送的添加请求的具体方式,可以为第二Collection将第一Collection添加至管理设备中存储的、第二Collection对应的requestadd资源中,管理设备在判断是否添加第一Collection之后。若允许,则管理设备向第二Collection发送添加许可指令,以返回成功响应;否则返回失败响应。
进一步地,在本申请的实施例中,如果添加请求是由客户端发送至管理设备的,即管理设备和客户端直接时,管理设备也可以根据requestadd资源接收客户端发送的添加请求。
需要说明的是,在本申请的实施例中,当添加请求是由第二Collection发送至管理设备的,即管理设备和第二Collection进行交互时,管理设备除了根据requestadd资源实现资源的添加,还可以通过在Collection资源中增加pendingadd属性和addpermission属性来实现资源的添加,其中,pendingadd属性表示待添加的子资源,addpermission属性表示是否允许添加。因此,管理设备接收第二Collection发送的添加请求的具体方式,可以为第二Collection将第一Collection添加至管理设备中存储的、第二Collection对应的pendingadd资源中,管理设备在确定是否添加第一Collection之后,可以对addpermission进行设置,从而可以在addpermission属性值有效后,根据addpermission决定是否添加。需要说明的是,在完成添加或拒绝添加后,管理设备可以清空第二Collection对应的pendingadd属性值和addpermission属性值。
需要说明的是,在本申请的实施例中,管理设备在确定是否添加第一Collection之后,对addpermission进行设置时,如果管理设备允许第一Collection添加到第二Collection中,那么管理设备可以将第二Collection对应的addpermission属性值设置为True,以实现向第二Collection发送添加许可指令;若不允许,管理设备可以将第二Collection对应的addpermission属性值设置为False,
在本申请的实施中,进一步地,管理设备在根据第一嵌套参数判断是否添加第一Collection之后,如果判定不添加第一Collection时,管理设备可以返回添加失败响应。
需要说明的是,在本申请的实施例中,如果管理设备判定不将第一Collection添加至第二Collection中,那么管理设备可以向客户端或者第二Collection返回添加失败的响应。其中,如果管理设备向客户端返回添加失败响应,客户端在接收到添加失败响应之后,可以取消对第一Collection的添加处理,还可以向用户展示失败界面或将添加操作变为不可用状态。
在本申请的实施例中,进一步地,管理设备在进行资源添加时,也可以直接循环遍历第一Collection的全部子Collection,即循环遍历第一Collection的下级Collection,而不需要对第一Collection进行第一嵌套参数的获取,即不需要对Collection增加depth属性。
进一步地,在本申请的实施例中,管理设备可以将待添加至第二Collection的第一Collection的下级Collection进行循环遍历,直至子资源类型为非Collection资源,然后逐一判断第一Collection的全部子Collection是否包括第二Collection。如果第一Collection的全部子Collection包括第二Collection,则拒绝第一Collection对应的添加请求并返回失败响应;如果第一Collection的全部子Collection不包括第二Collection,则将第一Collection添加至第二Collection,并返回成功响应。
需要说明的是,在本申请的实施例中,在第一Collection嵌套层级比较多时,开销会比较大,为节约资源,可在遍历第一Collection的全部子Collection的同时进行是否 包括第二Collection的判定,一旦确定包括第二Collection,则停止遍历,而不需等到第一Collection的全部子Collection遍历完毕。
本申请实施例提供了一种资源添加方法,管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
基于上述实施例,在本申请的又一实施例中,图3为本本申请实施例提出的一种资源添加方法的实现流程示意图二,如图3所示,管理设备在接收添加请求之前,即步骤101之前,管理设备进行资源添加的方法还可以包括以下步骤:
步骤105、接收注册请求;其中,注册请求携带第二Collection对应的第二标识。
在本申请的实施例中,管理设备在接收添加请求之前,可以先接收注册请求。其中,注册请求中携带有第二Collection对应的第二标识,进一步地,注册请求可以用于对第二Collection进行创建和注册。也就是说,管理设备在对第二Collection进行子Collection资源的添加之前,需要先对第二Collection进行注册。
需要说明的是,在本申请的实施例中,管理设备可以接收由OCF框架中的客户端发送的注册请求,也可以接收由第二Collection直接发送的注册请求。
进一步地,在本申请的实施例中,由于在OCF框架中引入了管理设备对Collection的创建、添加等操作进行管理,且管理设备可以通过Collection Manager ID进行标识,任意一个Collection可以通过Collection Manager ID在至少一个管理设备中确定出对应的管理设备。也就是说,第二Collection向管理设备发送的注册请求时,具体可以通过Collection Manager ID定位到对应的管理设备,然后向管理设备发送注册请求。
进一步地,在本申请的实施例中,管理设备接收到的注册请求可以是由第二Collection发送的,也可以是由客户端发送的。例如,当管理设备集成在OCF框架中的服务端或者第三方设备时,可以接收由第二Collection发送的注册请求;当管理设备集成在OCF框架中的客户端或者第三方设备时,可以通过与客户端的应用程序的交互直接接收由客户端发送的注册请求。
需要说明的是,在本申请的实施中,当管理设备集成在OCF框架中的服务端或者第三方设备时,客户端可以先创建第二Collection,然后第二Collection便可以按照Collection Manager ID向管理设备发送注册请求,以对第二Collection进行注册;当管理设备集成在OCF框架中的客户端时,管理设备可以直接获取客户端发送的注册请求,并在对第二Collection注册后指示客户端创建第二Collection。
需要说明的是,在本申请的实施中,注册请求中携带有第二Collection对应的第二标识,具体地,第二标识可以用于表征第二Collection的具体标识信息,例如,第二标识可以包括第二Collection对应的URI和资源类型(Resource Type,RT)等具体信息。
步骤106、根据第二标识,获取第二Collection对应的子资源。
在本申请的实施例中,管理设备在接收注册请求之后,可以根据第二标识,获取第 二Collection对应的子资源。
需要说明的是,在本申请的实施例中,第二Collection对应的子资源可以包括Collection资源和/或非Collection资源。例如,第二Collection的子资源可以包括Endpoint1和Collection2,Endpoint1表征非Collection资源,Collection2表征Collection资源。
进一步地,在本申请的实施例中,管理设备在根据第二标识获取第二Collection的子资源时,可以通过第二标识获取第二Collection对应的Links,从而可以进一步确定第二Collection的子资源。
步骤107、根据子资源确定第二Collection对应的第二嵌套参数。
在本申请的实施例中,管理设备在根据第二标识,获取第二Collection对应的子资源之后,可以进一步根据子资源确定第二Collection对应的第二嵌套参数。
需要说明的是,在本申请的实施例中,管理设备在获取第二Collection对应的子资源之后,可以确定出子资源对应的第三标识,然后根据第三标识确定出子资源对应的第三嵌套参数,便可以进一步根据第三嵌套参数确定出第二Collection对应的第二嵌套参数。
进一步地,在本申请的实施例中,由于第二Collection的子资源可以包括至少一个Collection资源和/或非Collection资源,因此,子资源对应的第三标识可以为至少一个,相应地,第三嵌套参数也可以为至少一个。
需要说明的是,在本申请的实施例中,管理设备在根据第三标识进一步确定子资源对应的第三嵌套参数时,可以根据第三标识判断预设集合列表中是否包括有子资源,如果预存集合列表中包括有子资源,那么管理设备可以从预存集合列表中获取第三嵌套参数;如果预存集合列表中不包括子资源,那么管理设备可以向子资源发送第二查询请求,从而可以获得子资源对应的第三嵌套参数。
进一步地,在本申请的实施例中,管理设备在按照第三嵌套参数,确定第二嵌套参数时,可以对第三嵌套参数进行数值比较,确定出第三嵌套参数中数据最大的嵌套参数,然后对数据最大的嵌套参数进行加1运算,从而便可以获得第二嵌套参数。例如,第二Collection的子资源对应的第三嵌套参数包括0、1、4,那么根据第三嵌套参数中数值最大的嵌套参数4可以确定出第二嵌套参数为5,即第二Collection的嵌套深度为5。
步骤108、将第二嵌套参数存储至预设集合列表中,以对第二Collection进行注册。
在本申请的实施例中,管理设备在根据子资源确定第二Collection对应的第二嵌套参数之后,可以将第二嵌套参数存储至预设集合列表中,便可以按照第二嵌套参数对第二Collection进行注册。
需要说明的是,在本申请的实施例中,管理设备在获得第二嵌套参数之后,可以将第二Collection和第二嵌套参数存储至预设集合列表中,从而完成第二Collection的注册。具体地,管理设备可以将第二Collection和第二嵌套参数的对应关系保存至预设集合列表中。
进一步地,在本申请的实施中,如果注册请求是由客户端发送至管理设备的,那么管理设备在对第二Collection完成注册之后,可以向客户端发送注册响应,其中,注册响应中携带有第二嵌套参数。客户端在接收到注册响应之后,便可以根据第二标识和第二嵌套参数对第二Collection进行创建。
需要说明的是,在本申请的实施中,管理设备也可以通过上述步骤105至步骤108所述的方法对第一Collection进行注册。
本申请实施例提供了一种资源添加方法,管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数; 根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
基于上述实施例,在本申请的又一实施例中,对于上述步骤102所述的方法,管理设备根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数的方法可以包括以下步骤:
步骤102a、根据第一标识判断预设集合列表中是否包括第一Collection。
步骤102b、当预存集合列表中包括第一Collection时,从预存集合列表中获取第一嵌套参数。
在本申请的实施例中,管理设备在接收携带有第一Collection的第一标识的添加请求之后,可以先根据第一标识判断预设集合列表中是否存储有第一Collection。进一步地,如果根据第一标识进行查询后确定预设集合列表中存储有第一Collection,那么管理设备可以直接从预设集合列表中读取与第一Collection对应的第一嵌套参数。
需要说明的是,在本申请的实施例中,预设集合列表中存储有其管理的全部Collection和全部Collection对应的嵌套参数,因此,如果通过第一标识确定预设集合列表中存储有第一Collection,那么便可以获取相对应的第一嵌套参数。
步骤102c、当预存集合列表中不包括第一Collection时,向第一Collection发送第一查询请求,以获得第一嵌套参数。
在本申请的实施例中,管理设备在根据第一标识判断预设集合列表中是否存储有第一Collection之后,如果根据第一标识进行查询后确定预设集合列表中没有存储第一Collection,即管理设备不能直接从预设集合列表中读取与第一Collection对应的第一嵌套参数,那么管理设备可以向第一Collection发送用于查询第一嵌套参数的第一查询请求。
需要说明的是,在本申请的实施例中,如果通过第一标识确定预设集合列表中没有存储第一Collection,那么管理设备可以根据第一标识向第一Collection发送第一查询请求,然后接收第一Collection发送的查询响应,其中,查询响应携带第一Collection对应的第一嵌套参数。
在本申请的实施例中,进一步地,对于上述步骤103所述的方法,管理设备根据第一嵌套参数判断是否添加第一Collection的方法可以包括以下步骤:
步骤103a、当第一嵌套参数小于或者等于第二嵌套参数时,判定添加第一Collection。
在本申请的实施例中,管理设备在根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数之后,可以将第一嵌套参数和第二Collection对应的第二嵌套参数进行比较,如果第一嵌套参数小于或者等于第二嵌套参数,可以判定添加第一Collection。
需要说明的是,在本申请的实施中,管理设备在将第一嵌套参数和第二嵌套参数进行比较之后,如果第一嵌套参数小于或者等于第二嵌套参数,可以认为第一Collection的全部子Collection中并不包括第二Collection,即将第一Collection添加至第二Collection之后不会产生循环嵌套,因此可以判定添加第一Collection。
步骤103b、当第一嵌套参数大于第二嵌套参数时,判定不添加第一Collection。
在本申请的实施例中,管理设备在将第一嵌套参数和第二Collection对应的第二嵌套参数进行比较,如果第一嵌套参数大于第二嵌套参数,那么管理设备可以判定不添加第一Collection。
需要说明的是,在本申请的实施中,如果第一嵌套参数大于第二嵌套参数,可以认为第一Collection的全部子Collection中可能包括第二Collection,即将第一Collection添加至第二Collection之后可能会产生循环嵌套,因此可以判定不添加第一Collection。
在本申请的实施例中,进一步地,对于上述步骤103所述的方法,管理设备根据第一嵌套参数判断是否添加第一Collection的方法可以包括以下步骤:
步骤103a、当第一嵌套参数小于或者等于第二嵌套参数时,判定添加第一Collection。
步骤103c、当第一嵌套参数大于第二嵌套参数,且小于或者等于预设嵌套阈值时,获取第一Collection对应的全部子Collection,以根据全部子Collection判断是否添加第一Collection。
在本申请的实施例中,管理设备在将第一嵌套参数和第二Collection对应的第二嵌套参数进行比较,如果第一嵌套参数大于第二嵌套参数,那么管理设备可以继续根据预设嵌套阈值进一步判定是否添加第一Collection。
需要说明的是,在本申请的实施例中,如果第一嵌套参数大于第二嵌套参数,且小于预设嵌套阈值,可以认为第一Collection的全部子Collection中可能包括第二Collection,那么管理设备可以继续获取第一Collection对应的全部子Collection,然后根据全部子Collection进一步判断是否添加第一Collection。
步骤103d、当第一嵌套参数大于预设嵌套阈值时,判定不添加第一Collection。
在本申请的实施例中,管理设备在将第一嵌套参数和第二嵌套参数、预设嵌套阈值分别进行比较之后,如果第一嵌套参数大于预设嵌套阈值,那么管理设备可以直接判定不添加第一Collection。
需要说明的是,在本申请的实施例中,如果第一嵌套参数大于预设嵌套阈值,那么可以认为第一Collection的嵌套层数过大,对层数较多的第一Collection对应的全部子Collection进行遍历的开销比较大,因此可以直接判定不添加第一Collection。
在本申请的实施例中,进一步地,对于上述步骤103c所述的方法,管理设备根据全部子Collection判断是否添加第一Collection的方法可以包括以下步骤:
步骤201、遍历全部子Collection,判断全部子Collection是否包括第二Collection。
步骤202、当不包括第二Collection时,判定添加第一Collection。
步骤203、当包括第二Collection时,判定不添加第一Collection。
在本申请的实施例中,如果第一嵌套参数大于第二嵌套参数,且小于预设嵌套阈值,那么管理设备在继续获取第一Collection对应的全部子Collection,然后遍历全部子Collection,进一步判断全部子Collection包括第二Collection。如果第一Collection对应的全部子Collection中包括第二Collection,那么将第一Collection添加至第二Collection中便会产生循环嵌套,因此管理设备可以判定不进行第一Collection的添加;如果第一Collection对应的全部子Collection中不包括第二Collection,那么将第一Collection添加至第二Collection中也不会产生循环嵌套,因此管理设备可以判定进行第一Collection的添加。
需要说明的是,在本申请的实施中,为节约资源,管理设备可以在遍历第一Collection对应的全部子Collection的同时进行是否包括第二Collection判断,即第一Collection对应的子Collection一旦出现第二Collection,则停止遍历,而不需等到全部遍历完毕。
本申请实施例提供了一种资源添加方法,管理设备接收添加请求;其中,添加请求 携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
基于上述实施例,在本申请的另一实施例中,对于上述步骤107所述的方法,管理设备根据子资源确定第二Collection对应的第二嵌套参数的方法可以包括以下步骤:
步骤107a、确定子资源对应的第三标识。
在本申请的实施例中,管理设备在根据第二标识,获取第二Collection对应的子资源之后,可以先确定出子资源对应的第三标识。
需要说明的是,在本申请的实施例中,第二Collection的子资源可以包括Collection资源和非Collection资源两种资源类型,因此,管理设备可以通过第三标识的获取进一步确定第二Collection的子资源对应的资源类型,从而可以确定出相应的嵌套参数。
步骤107b、根据第三标识,获取子资源对应的第三嵌套参数。
在本申请的实施例中,管理设备在确定子资源对应的第三标识之后,可以根据第三标识,确定出子资源对应的第三嵌套参数。
需要说明的是,在本申请的实施例中,如果根据第三标识确定出子资源的资源类型为Collection资源,那么管理设备可以根据第三标识和预设集合列表进一步确定对应的第三嵌套参数;如果根据第三标识确定出子资源的资源类型为非Collection资源,那么管理设备可以直接将第三嵌套参数设置为0。
步骤107c、按照第三嵌套参数,确定第二嵌套参数。
在本申请的实施例中,管理设备在根据第三标识确定出子资源对应的第三嵌套参数之后,便可以按照第三嵌套参数,进一步确定出第二嵌套参数。
需要说明的是,在本申请的实施中,管理设备在按照第三嵌套参数确定第二嵌套参数时,可以先在第三嵌套参数中确定出数值最大的嵌套参数;然后对数值最大的嵌套参数进行加1运算,从而获得第二嵌套参数。例如,第二Collection的子资源对应的第三嵌套参数包括2和4,那么根据第三嵌套参数中数值最大的嵌套参数4可以确定出第二嵌套参数为5,即第二Collection的嵌套深度为5。
在本申请的实施例中,进一步地,对于上述步骤107b所述的方法,管理设备根据第三标识,获取子资源对应的第三嵌套参数的方法可以包括以下步骤:
步骤301、根据第三标识确定子资源对应的资源类型。
在本申请的实施例中,管理设备在确定子资源对应的第三标识之后,可以根据第三标识确定出第二Collection的子资源对应的资源类型。
需要说明的是,在本申请的实施中,第二Collection的子资源对应的资源类型可以包括Collection资源和非Collection资源两种,管理设备可以根据子资源的第三标识对子资源的资源类型进行确定。具体地,管理设备可以根据第三标识中的RT对子资源的资源类型进行确定。例如,第三标识中Link的RT为oic.wk.col时,管理设备可以确定对应的资源类型为Collection资源。
步骤302、当资源类型为非Collection资源时,将第三嵌套参数设置为零。
在本申请的实施例中,管理设备在根据第三标识确定出第二Collection的子资源对应的资源类型之后,如果资源类型为非Collection资源,那么管理设备可以将第三嵌套参数设置为零。
需要说明的是,在本申请的实施例中,非Collection资源的子资源无depth属性,因此可以默认为其depth为0,即对应的嵌套参数为0。
步骤303、当资源类型为Collection资源时,根据第三标识和预存资源列表,获取子资源对应的第三嵌套参数。
在本申请的实施例中,管理设备在根据第三标识确定出第二Collection的子资源对应的资源类型之后,如果资源类型为Collection资源,那么管理设备可以根据第三标识和预存资源列表,进一步获取子资源对应的第三嵌套参数。
需要说明的是,在本申请的实施例中,管理设备可以先根据第三标识判断预设集合列表中是否包括子资源;如果预存集合列表中包括子资源,那么管理设备可以从预存集合列表中获取第三嵌套参数;如果预存集合列表中不包括子资源,那么管理设备可以向子资源发送第二查询请求,从而便可以获得第三嵌套参数。
本申请实施例提供了一种资源添加方法,管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
基于上述实施例,在本申请的再一实施例中,图4为本申请实施例提出的一种资源添加方法的实现流程示意图三,如图4所示,如果在OCF框架中引入的管理设备集成在OCF框架中的服务端或者第三方设备上,管理设备对资源集合进行注册的方法可以包括以下步骤:
步骤401、第一设备创建Collection1,同时确定Collection1对应的管理ID。
在本申请的实施例中,第一设备可以先创建集合资源Collection1,其中,Collection1的子资源可以包括非Collection资源和/Collection资源。例如,Collection1的子资源可以包括Endpoint1和Collection2,Endpoint1为非Collection资源,Collection2为Collection资源。
需要说明的是,在本申请的实施例中,第一设备可以为OCF框架中的客户端,也就是说,第一设备和管理设备在OCF框架中为不同的设备。
进一步地,在本申请的实施中,第一设备在创建Collection1的同时,可以确定Collection1对应的管理ID,其中,管理ID为与Collection1对应的管理设备的ID,即Collection Manager ID。
步骤402、Collection1向管理设备发送注册请求。
在本申请的实施中,管理设备可以接收Collection1发送的注册请求,且注册请求中携带有Collection1对应的标识,该标识包括Collection1对应的URI和RT等具体信息。
需要说明的是,在本申请的实施例中,Collection1向管理设备发送注册请求时,可以直接将自身添加到管理设备的管理设备存储的预设集合列表中,具体地,Collection1根据管理ID获得管理设备的预设集合列表的地址,然后按照该地址进行添加。
需要说明的是,在本申请的实施例中,将Collection1添加至预设集合列表时,可以将Collection1包含的Links添加至预设集合列表中。
步骤403、管理设备确定Collection1对应的子资源。
在本申请的实施例中,管理设备在接收Collection1发送的注册请求之后,可以根据Collection1对应的标志,获取Collection1对应的子资源。
进一步地,在本申请的实施例中,管理设备在根据Collection1对应的标志获取Collection1的子资源时,可以通过Collection1对应的标志获取Collection1对应的Links,从而可以进一步确定Collection1的子资源。例如,管理设备可以根据Collection1对应的Links确定出子资源为Endpoint1和Collection2。
步骤404、管理设备确定子资源对应的嵌套参数。
在本申请的实施例中,管理设备在确定Collection1对应的子资源之后,可以先确定出子资源对应的嵌套参数。
需要说明的是,在本申请的实施例中,管理设备可以先确定子资源对应的标识,然后根据子资源对应的标识确定出子资源对应的嵌套参数。例如,当Collection1的子资源为Endpoint1和Collection2时,管理设备可以根据通过Endpoint1的资源类型,如Link的RT确定Endpoint1为非Collection资源,因此可以将Endpoint1的depth属性确定为0,即Endpoint1对应的嵌套参数为0;同时,管理设备可以根据通过Collection2的资源类型,如Link的RT确定Collection2为Collection资源,因此可以根据Collection2的URI在预存集合列表中进行查询,如果预存集合列表中存储有Collection2,那么管理设备可以直接从预存集合列表中获取Collection2对应的嵌套参数,如果预存集合列表中没有存储Collection2,那么管理设备可以向Collection2发送查询请求,以获得Collection2对应的嵌套参数。
步骤405、管理设备根据子资源对应的嵌套参数,确定Collection1对应的嵌套参数。
在本申请的实施例中,管理设备在根据子资源对应的嵌套参数确定Collection1对应的嵌套参数时,可以对子资源对应的嵌套参数进行数值比较,确定出子资源对应的嵌套参数中数据最大的嵌套参数,然后对数据最大的嵌套参数进行加1运算,从而便可以获得Collection1对应的嵌套参数。例如,Endpoint1的嵌套参数为0,Collection2的嵌套参数为2,那么管理设备可以根据max(0,2)+1确定出Collection1对应的嵌套参数为3,即第Collection1对应的嵌套深度为3。
步骤406、管理设备根据Collection1对应的嵌套参数对Collection1进行注册。
在本申请的实施例中,管理设备在确定Collection1对应的嵌套参数之后,可以按照Collection1对应的嵌套参数完成Collection1的注册。
需要说明的是,在本申请的实施例中,管理设备可以将Collection1对应的嵌套参数,按照与Collection1的对应关系存储至预设集合列表中,从而实现Collection1的注册。
在本申请的实施例中,进一步地,在Collection1中增加了表示嵌套深度的嵌套参数depth的属性,同时在OCF框架中引入管理设备对Collection1的创建和注册进行管理,在对Collection1进行注册时,将Collection1和其对应的嵌套参数存储至预设集合列表中,从而在后续对Collection1进行资源的添加时,能够按照嵌套参数进行子资源的选择,避免资源的循环嵌套。
在本申请的实施例中,进一步地,基于上述图4,图5为本申请实施例提出的一种资源添加方法的实现流程示意图四,如图5所示,如果在OCF框架中引入的管理设备 集成在OCF框架中的服务端或者第三方设备上,管理设备进行资源添加的方法可以包括以下步骤:
步骤407、第一设备按照Collection3对Collection1进行更新。
在本申请的实施例中,第一设备在完成Collection1的创建和注册之后,如果需要将Collection3添加至Collection1中,可以按照Collection3对Collection1进行更新。
进一步地,在本申请的实施例中,第一设备在按照Collection3对Collection1进行更新时,可以指示Collection1将Collection3对应的Link添加至Collection1对应的Links中。
步骤408、Collection1向管理设备发送添加请求。
在本申请的实施例中,Collection1在更新后,可以向管理设备发送添加请求。其中,添加请求中携带有Collection3对应的标识,添加请求用于将Collection3添加至Collection1中。
步骤409、管理设备根据Collection3对应的标识和预设集合列表,获取Collection3对应的嵌套参数。
在本申请的实施中,管理设备在获得Collection3对应的标识之后,可以根据Collection3对应的标识和预设集合列表,进一步获得Collection3对应的嵌套参数。
进一步地,在本申请的实施中,管理设备可以先根据Collection3对应的标识在预先存储的预设集合列表中对Collection3进行查找,如果预设集合列表中存储有Collection3,那么管理设备可以直接从预设集合列表中读取Collection3对应的嵌套参数;如果预设集合列表中没有存储Collection3,那么管理设备可以根据向Collection3发送查询请求,以获得Collection3对应的嵌套参数。
步骤410、管理设备根据Collection3对应的嵌套参数判断是否添加Collection3。
在本申请的实施例中,管理设备在确定Collection3对应的嵌套参数之后,可以将Collection3和预设集合列表中存储的Collection1对应的嵌套参数进行比较,然后根据比较结果判断是否将Collection3添加至Collection1中。
进一步地,若Collection3对应的嵌套参数为depth3,Collection1对应的嵌套参数为depth1,比较depth3和depth1之后,如果depth3小于或者等于depth1,那么管理设备可以判定添加Collection3;如果depth3大于depth1,那么管理设备可以判定不添加Collection3,也可以再根据预设嵌套阈值depth0进行下一步的判定。具体地,当Collection3大于depth0时,判定不添加Collection3;当Collection3大于depth1且小于depth0时,管理设备可以循环遍历查询Collection3的全部子Collection,直至子资源类型为非Collection资源为止,然后逐一判断Collection3的任意一个子Collection是否为Collection1,即确定Collection1是否为Collection3的子Collection,如果Collection1不为Collection3的子Collection,则判定添加Collection3,如果Collection1为Collection3的子Collection,则判定不添加Collection3,从而可以避免集合资源的循环嵌套。
步骤411、当判定添加Collection3时,管理设备向Collection1发送添加许可指令。
在本申请的实施例中,管理设备在确定将Collection3添加至Collection1之后,便可以向Collection1发送添加许可指令,Collection1在接收到添加指令之后,可以接受资源的添加,并将Collection3对应的Link添加至Collection1对应的Links中。
进一步地,在本申请的实施例中,如果管理设备判定不将Collection3添加至Collection1中,那么管理设备可以向Collection1发送禁止添加的指令,Collection1则在接收到禁止添加的指令之后,拒绝将Collection3对应的Link添加至Collection1对应的Links中,并向第一设备返回添加失败的响应。
本申请实施例提供了一种资源添加方法,管理设备接收添加请求;其中,添加请求 携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
基于上述实施例,在本申请的另一实施例中,图6为本申请实施例提出的一种资源添加方法的实现流程示意图五,如图6所示,如果在OCF框架中引入的管理设备集成在OCF框架中的客户端上,管理设备对资源集合进行注册的方法可以包括以下步骤:
步骤501、第一设备生成Collection1对应的标志,并向管理设备发送注册请求。
在本申请的实施例中,第一设备可以先生成集合资源Collection1对应的标志,然后可以向管理设备发送注册请求,其中,注册请求中携带有Collection1对应的标志,该标识包括Collection1对应的URI和RT等具体信息。
需要说明的是,在本申请的实施例中,第一设备可以为OCF框架中的客户端,也就是说,第一设备和管理设备在OCF框架中为相同的设备。
进一步地,在本申请的实施例中,由于管理设备集成在OCF框架中的客户端中,因此管理设备可以通过与第一设备的应用程序的交互直接接收由第一设备发送的添加请求。
需要说明的是,在本申请的实施例中,第一设备向管理设备发送注册请求时,可以直接将Collection1添加到管理设备的管理设备存储的预设集合列表中,具体地,第一设备获得管理设备的预设集合列表的地址,然后按照该地址进行Collection1的添加。
需要说明的是,在本申请的实施例中,将Collection1添加至预设集合列表时,可以将Collection1包含的Links添加至预设集合列表中。
步骤502、管理设备确定Collection1对应的子资源。
在本申请的实施例中,管理设备在接收第一设备发送的注册请求之后,可以根据Collection1对应的标志,获取Collection1对应的子资源。
进一步地,在本申请的实施例中,管理设备在根据Collection1对应的标志获取Collection1的子资源时,可以通过Collection1对应的标志获取Collection1对应的Links,从而可以进一步确定Collection1的子资源。例如,管理设备可以根据Collection1对应的Links确定出子资源为Endpoint1和Collection2。
进一步地,在本申请的实施例中,Collection1的子资源可以包括非Collection资源和/Collection资源。例如,Collection1的子资源可以包括Endpoint1和Collection2,Endpoint1为非Collection资源,Collection2为Collection资源。
步骤503、管理设备确定子资源对应的嵌套参数。
在本申请的实施例中,管理设备在确定Collection1对应的子资源之后,可以先确定出子资源对应的嵌套参数。
需要说明的是,在本申请的实施例中,管理设备可以先确定子资源对应的标识,然后根据子资源对应的标识确定出子资源对应的嵌套参数。例如,当Collection1的子资源为Endpoint1和Collection2时,管理设备可以根据通过Endpoint1的资源类型,如Link 的RT确定Endpoint1为非Collection资源,因此可以将Endpoint1的depth属性确定为0,即Endpoint1对应的嵌套参数为0;同时,管理设备可以根据通过Collection2的资源类型,如Link的RT确定Collection2为Collection资源,因此可以根据Collection2的URI在预存集合列表中进行查询,如果预存集合列表中存储有Collection2,那么管理设备可以直接从预存集合列表中获取Collection2对应的嵌套参数,如果预存集合列表中没有存储Collection2,那么管理设备可以向Collection2发送查询请求,以获得Collection2对应的嵌套参数。
步骤504、管理设备根据子资源对应的嵌套参数,确定Collection1对应的嵌套参数。
在本申请的实施例中,管理设备在根据子资源对应的嵌套参数确定Collection1对应的嵌套参数时,可以对子资源对应的嵌套参数进行数值比较,确定出子资源对应的嵌套参数中数据最大的嵌套参数,然后对数据最大的嵌套参数进行加1运算,从而便可以获得Collection1对应的嵌套参数。例如,Endpoint1的嵌套参数为0,Collection2的嵌套参数为2,那么管理设备可以根据max(0,2)+1确定出Collection1对应的嵌套参数为3,即第Collection1对应的嵌套深度为3。
步骤505、管理设备根据Collection1对应的嵌套参数对Collection1进行注册。
在本申请的实施例中,管理设备在确定Collection1对应的嵌套参数之后,可以按照Collection1对应的嵌套参数完成Collection1的注册。
需要说明的是,在本申请的实施例中,管理设备可以将Collection1对应的嵌套参数,按照与Collection1的对应关系存储至预设集合列表中,从而实现Collection1的注册。
步骤506、管理设备向第一设备发送注册指令;其中,注册指令携带Collection1对应的嵌套参数。
步骤507、第一设备根据Collection1对应的标识和Collection1对应的嵌套参数,创建Collection1。
在本申请的实施例中,管理设备在将Collection1对应的嵌套参数存储至预设集合列表之后,可以向第一设备返回表征注册成功的注册指令,第一设备在接收到注册指令后,可以从注册指令中获取Collection1对应的嵌套参数。
进一步地,在本申请的实施例中,第一设备在获取Collection1对应的嵌套参数之后,便可以按照Collection1对应的标识和Collection1对应的嵌套参数,对已经完成注册的Collection1进行创建。
在本申请的实施例中,进一步地,在Collection1中增加了表示嵌套深度的嵌套参数depth的属性,同时在OCF框架中引入管理设备对Collection1的创建和注册进行管理,在对Collection1进行注册时,将Collection1和其对应的嵌套参数存储至预设集合列表中,从而在后续对Collection1进行资源的添加时,能够按照嵌套参数进行子资源的选择,避免资源的循环嵌套。
在本申请的实施例中,进一步地,基于上述图6,图7为本申请实施例提出的一种资源添加方法的实现流程示意图六,如图7所示,如果在OCF框架中引入的管理设备集成在OCF框架中的客户端上,管理设备进行资源添加的方法可以包括以下步骤:
步骤508、第一设备向管理设备发送添加请求。
在本申请的实施例中,第一设备在创建Collection1之后,可以向管理设备发送添加请求。其中,添加请求中携带有Collection3对应的标识,添加请求用于将Collection3添加至Collection1中。
步骤509、管理设备根据Collection3对应的标识和预设集合列表,获取Collection3对应的嵌套参数。
在本申请的实施中,管理设备在获得Collection3对应的标识之后,可以根据 Collection3对应的标识和预设集合列表,进一步获得Collection3对应的嵌套参数。
进一步地,在本申请的实施中,管理设备可以先根据Collection3对应的标识在预先存储的预设集合列表中对Collection3进行查找,如果预设集合列表中存储有Collection3,那么管理设备可以直接从预设集合列表中读取Collection3对应的嵌套参数;如果预设集合列表中没有存储Collection3,那么管理设备可以根据向Collection3发送查询请求,以获得Collection3对应的嵌套参数。
步骤510、管理设备根据Collection3对应的嵌套参数判断是否添加Collection3。
在本申请的实施例中,管理设备在确定Collection3对应的嵌套参数之后,可以将Collection3和预设集合列表中存储的Collection1对应的嵌套参数进行比较,然后根据比较结果判断是否将Collection3添加至Collection1中。
进一步地,若Collection3对应的嵌套参数为depth3,Collection1对应的嵌套参数为depth1,比较depth3和depth1之后,如果depth3小于或者等于depth1,那么管理设备可以判定添加Collection3;如果depth3大于depth1,那么管理设备可以判定不添加Collection3,也可以再根据预设嵌套阈值depth0进行下一步的判定。具体地,当Collection3大于depth0时,判定不添加Collection3;当Collection3大于depth1且小于depth0时,管理设备可以循环遍历查询Collection3的全部子Collection,直至子资源类型为非Collection资源为止,然后逐一判断Collection3的任意一个子Collection是否为Collection1,即确定Collection1是否为Collection3的子Collection,如果Collection1不为Collection3的子Collection,则判定添加Collection3,如果Collection1为Collection3的子Collection,则判定不添加Collection3,从而可以避免集合资源的循环嵌套。
步骤511、当判定添加Collection3时,管理设备向第一设备发送添加许可指令。
步骤512、第一设备按照Collection3对Collection1进行更新。
在本申请的实施例中,管理设备在确定将Collection3添加至Collection1之后,便可以向第一设备发送添加许可指令,第一设备在接收到添加指令之后,可以按照Collection3对Collection1进行更新。
进一步地,在本申请的实施例中,第一设备在按照Collection3对Collection1进行更新时,可以指示Collection1将Collection3对应的Link添加至Collection1对应的Links中。Collection1在接收到第一设备的指示之后,可以接受资源的添加,并将Collection3对应的Link添加至Collection1对应的Links中。
进一步地,在本申请的实施例中,如果管理设备判定不将Collection3添加至Collection1中,那么管理设备可以向第一设备返回添加失败的响应,第一设备则在接收到添加失败的响应之后,取消Collection3的添加。
本申请实施例提供了一种资源添加方法,管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
基于上述实施例的同一发明构思下,在本申请的另一实施例中,图8为本申请实施例提出的管理设备的组成结构示意图一,如图8所示,本申请实施例提出的管理设备1可以包括接收部分11,获取部分12,判断部分13、发送部分14、确定部分15以及存储部分16。
所述接收部分11,配置于接收添加请求;其中,所述添加请求携第一集合资源Collection对应的第一标识;所述第一Collection为待添加至第二Collection的集合资源。
所述获取部分12,配置于根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数。
所述判断部分13,配置于根据所述第一嵌套参数判断是否添加所述第一Collection。
所述发送部分14,配置于当判定添加所述第一Collection时,响应所述添加请求,发送添加许可指令,以将所述第一Collection添加至所述第二Collection。
进一步地,在本申请的实施例中,所述确定部分15,配置于接收添加请求之前,接收注册请求;其中,所述注册请求携带所述第二Collection对应的第二标识。
所述获取部分12,还配置于根据所述第二标识,获取所述第二Collection对应的子资源。
所述确定部分15,还配置于根据所述子资源确定所述第二Collection对应的第二嵌套参数。
所述存储部分16,配置于将所述第二嵌套参数存储至所述预设集合列表中,以对所述第二Collection进行注册。
进一步地,在本申请的实施例中,所述获取部分12,具体配置于根据所述第一标识判断所述预设集合列表中是否包括所述第一Collection;以及当所述预存集合列表中包括所述第一Collection时,从所述预存集合列表中获取所述第一嵌套参数;以及当所述预存集合列表中不包括所述第一Collection时,向所述第一Collection发送第一查询请求,以获得所述第一嵌套参数。
进一步地,在本申请的实施例中,所述获取部分12,还具体配置于根据所述第一标识向所述第一Collection发送所述第一查询请求;以及接收所述第一Collection发送的查询响应;其中,所述查询响应携带所述第一嵌套参数。
进一步地,在本申请的实施例中,所述判断部分13,具体配置于当所述第一嵌套参数小于或者等于所述第二嵌套参数时,判定添加所述第一Collection;以及当所述第一嵌套参数大于所述第二嵌套参数时,判定不添加所述第一Collection。
进一步地,在本申请的实施例中,所述判断部分13,还具体配置于当所述第一嵌套参数小于或者等于所述第二嵌套参数时,判定添加所述第一Collection;以及当所述第一嵌套参数大于所述第二嵌套参数,且小于或者等于预设嵌套阈值时,获取所述第一Collection对应的全部子Collection,以根据所述全部子Collection判断是否添加所述第一Collection;其中,所述预设嵌套阈值大于所述第二嵌套参数;以及当所述第一嵌套参数大于所述预设嵌套阈值时,判定不添加所述第一Collection。
进一步地,在本申请的实施例中,所述判断部分13,还具体配置于遍历所述全部子Collection,判断所述全部子Collection是否包括所述第二Collection;以及当不包括所述第二Collection时,判定添加所述第一Collection;以及当包括所述第二Collection时,判定不添加所述第一Collection。
进一步地,在本申请的实施例中,所述确定部分15,具体配置于确定所述子资源对应的第三标识;以及根据所述第三标识,获取所述子资源对应的第三嵌套参数;以及按照所述第三嵌套参数,确定所述第二嵌套参数。
进一步地,在本申请的实施例中,所述确定部分15,还具体配置于根据所述第三标 识确定所述子资源对应的资源类型;以及当所述资源类型为非Collection资源时,将所述第三嵌套参数设置为零;以及当所述资源类型为Collection资源时,根据所述第三标识和所述预存资源列表,获取所述子资源对应的第三嵌套参数。
进一步地,在本申请的实施例中,所述确定部分15,还具体配置于根据所述第三标识判断所述预设集合列表中是否包括所述子资源;以及当所述预存集合列表中包括所述子资源时,从所述预存集合列表中获取所述第三嵌套参数;以及当所述预存集合列表中不包括所述子资源时,向所述子资源发送第二查询请求,以获得所述第三嵌套参数。
进一步地,在本申请的实施例中,所述确定部分15,还具体配置于在所述第三嵌套参数中确定出数值最大的嵌套参数;以及对所述数值最大的嵌套参数进行加1运算,获得所述第二嵌套参数。
进一步地,在本申请的实施例中,所述发送部分14,还配置于所述根据所述第一嵌套参数判断是否添加所述第一Collection之后,当判定不添加所述第一Collection时,返回添加失败响应。
图9为本申请实施例提出的管理设备的组成结构示意图二,如图9所示,本申请实施例提出的管理设备1还可以包括处理器17、存储有处理器17可执行指令的存储器18,进一步地,管理设备1还可以包括通信接口19,和用于连接处理器17、存储器18以及通信接口19的总线110。
在本申请的实施例中,上述处理器17可以为特定用途集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Processor,DSP)、数字信号处理装置(Digital Signal Processing Device,DSPD)、可编程逻辑装置(ProgRAMmable Logic Device,PLD)、现场可编程门阵列(Field ProgRAMmable Gate Array,FPGA)、中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本申请实施例不作具体限定。装置1还可以包括存储器18,该存储器18可以与处理器17连接,其中,存储器18用于存储可执行程序代码,该程序代码包括计算机操作指令,存储器18可能包含高速RAM存储器,也可能还包括非易失性存储器,例如,至少两个磁盘存储器。
在本申请的实施例中,总线110用于连接通信接口19、处理器17以及存储器18以及这些器件之间的相互通信。
在本申请的实施例中,存储器18,用于存储指令和数据。
进一步地,在本申请的实施例中,上述处理器17,用于接收添加请求;其中,所述添加请求携第一集合资源Collection对应的第一标识;所述第一Collection为待添加至第二Collection的集合资源;根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数;根据所述第一嵌套参数判断是否添加所述第一Collection;当判定添加所述第一Collection时,响应所述添加请求,发送添加许可指令,以将所述第一Collection添加至所述第二Collection。
在实际应用中,上述存储器18可以是易失性第一存储器(volatile memory),例如随机存取第一存储器(Random-Access Memory,RAM);或者非易失性第一存储器(non-volatile memory),例如只读第一存储器(Read-Only Memory,ROM),快闪第一存储器(flash memory),硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD);或者上述种类的第一存储器的组合,并向处理器17提供指令和数据。
另外,在本实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
本申请实施例提供了一种管理设备,该管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。
本申请实施例提供第一计算机可读存储介质,其上存储有程序,该程序被处理器执行时实现如上述实施例的方法。
具体来讲,本实施例中的一种资源添加方法对应的程序指令可以被存储在光盘,硬盘,U盘等存储介质上,当存储介质中的与一种资源添加方法对应的程序指令被一电子设备读取或被执行时,包括如下步骤:
接收添加请求;其中,所述添加请求携第一集合资源Collection对应的第一标识;所述第一Collection为待添加至第二Collection的集合资源;
根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数;
根据所述第一嵌套参数判断是否添加所述第一Collection;
当判定添加所述第一Collection时,响应所述添加请求,发送添加许可指令,以将所述第一Collection添加至所述第二Collection。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的实现流程示意图和/或方框图来描述的。应理解可由计算机程序指令实现流程示意图和/或方框图中的每一流程和/或方框、以及实现流程示意图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定 方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上所述,仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。
工业实用性
本申请实施例提供了一种资源添加方法、管理设备及计算机存储介质,管理设备接收添加请求;其中,添加请求携第一集合资源Collection对应的第一标识;第一Collection为待添加至第二Collection的集合资源;根据第一标识和预设集合列表,获取第一Collection对应的第一嵌套参数;根据第一嵌套参数判断是否添加第一Collection;当判定添加第一Collection时,响应添加请求,发送添加许可指令,以将第一Collection添加至第二Collection。由此可见,在本申请的实施例中,管理设备在接收将第一Collection添加至第二Collection的添加请求之后,可以先获取第一Collection对应的第一嵌套参数,然后可以根据第一嵌套参数判断是否对第一Collection进行添加,由于嵌套参数便可以表征Collection的嵌套深度,因此,可以通过对第一嵌套参数和第二Collection对应的第二嵌套参数的比较,判断第一Collection和第二Collection是否互相嵌套,以判断是否添加第一Collection,从而可以在资源添加的过程中避免Collection资源之间的循环嵌套,解决了由于指令循环往复产生的指令无法运行的问题,克服了指令泛滥的缺陷。

Claims (26)

  1. 一种资源添加方法,所述方法包括:
    接收添加请求;其中,所述添加请求携第一集合资源Collection对应的第一标识;所述第一Collection为待添加至第二Collection的集合资源;
    根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数;
    根据所述第一嵌套参数判断是否添加所述第一Collection;
    当判定添加所述第一Collection时,响应所述添加请求,发送添加许可指令,以将所述第一Collection添加至所述第二Collection。
  2. 根据权利要求1所述的方法,其中,所述接收添加请求之前,所述方法还包括:
    接收注册请求;其中,所述注册请求携带所述第二Collection对应的第二标识;
    根据所述第二标识,获取所述第二Collection对应的子资源;
    根据所述子资源确定所述第二Collection对应的第二嵌套参数;
    将所述第二嵌套参数存储至所述预设集合列表中,以对所述第二Collection进行注册。
  3. 根据权利要求1所述的方法,其中,所述根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数,包括:
    根据所述第一标识判断所述预设集合列表中是否包括所述第一Collection;
    当所述预存集合列表中包括所述第一Collection时,从所述预存集合列表中获取所述第一嵌套参数;
    当所述预存集合列表中不包括所述第一Collection时,向所述第一Collection发送第一查询请求,以获得所述第一嵌套参数。
  4. 根据权利要求3所述的方法,其中,所述向所述第一Collection发送第一查询请求,以获得所述第一嵌套参数,包括:
    根据所述第一标识向所述第一Collection发送所述第一查询请求;
    接收所述第一Collection发送的查询响应;其中,所述查询响应携带所述第一嵌套参数。
  5. 根据权利要求2所述的方法,其中,所述根据所述第一嵌套参数判断是否添加所述第一Collection,包括:
    当所述第一嵌套参数小于或者等于所述第二嵌套参数时,判定添加所述第一Collection;
    当所述第一嵌套参数大于所述第二嵌套参数时,判定不添加所述第一Collection。
  6. 根据权利要求2所述的方法,其中,所述根据所述第一嵌套参数判断是否添加所述第一Collection,包括:
    当所述第一嵌套参数小于或者等于所述第二嵌套参数时,判定添加所述第一Collection;
    当所述第一嵌套参数大于所述第二嵌套参数,且小于或者等于预设嵌套阈值时,获取所述第一Collection对应的全部子Collection,以根据所述全部子Collection判断是否添加所述第一Collection;其中,所述预设嵌套阈值大于所述第二嵌套参数;
    当所述第一嵌套参数大于所述预设嵌套阈值时,判定不添加所述第一Collection。
  7. 根据权利要求6所述的方法,其中,所述根据所述全部子Collection判断是否添加所述第一Collection,包括:
    遍历所述全部子Collection,判断所述全部子Collection是否包括所述第二Collection;
    当不包括所述第二Collection时,判定添加所述第一Collection;
    当包括所述第二Collection时,判定不添加所述第一Collection。
  8. 根据权利要求2所述的方法,其中,所述根据所述子资源确定所述第二Collection对应的第二嵌套参数,包括:
    确定所述子资源对应的第三标识;
    根据所述第三标识,获取所述子资源对应的第三嵌套参数;
    按照所述第三嵌套参数,确定所述第二嵌套参数。
  9. 根据权利要求8所述的方法,其中,所述根据所述第三标识,获取所述子资源对应的第三嵌套参数,包括:
    根据所述第三标识确定所述子资源对应的资源类型;
    当所述资源类型为非Collection资源时,将所述第三嵌套参数设置为零;
    当所述资源类型为Collection资源时,根据所述第三标识和所述预存资源列表,获取所述子资源对应的第三嵌套参数。
  10. 根据权利要求9所述的方法,其中,所述根据所述第三标识和所述预存资源列表,获取所述子资源对应的第三嵌套参数,包括:
    根据所述第三标识判断所述预设集合列表中是否包括所述子资源;
    当所述预存集合列表中包括所述子资源时,从所述预存集合列表中获取所述第三嵌套参数;
    当所述预存集合列表中不包括所述子资源时,向所述子资源发送第二查询请求,以获得所述第三嵌套参数。
  11. 根据权利要求8所述的方法,其中,所述按照所述第三嵌套参数,确定所述第二嵌套参数,包括:
    在所述第三嵌套参数中确定出数值最大的嵌套参数;
    对所述数值最大的嵌套参数进行加1运算,获得所述第二嵌套参数。
  12. 根据权利要求1所述的方法,其中,所述根据所述第一嵌套参数判断是否添加所述第一Collection之后,所述方法还包括:
    当判定不添加所述第一Collection时,返回添加失败响应。
  13. 一种管理设备,所述管理设备包括:接收部分,获取部分,判断部分以及发送部分,
    所述接收部分,配置于接收添加请求;其中,所述添加请求携第一集合资源Collection对应的第一标识;所述第一Collection为待添加至第二Collection的集合资源;
    所述获取部分,配置于根据所述第一标识和预设集合列表,获取所述第一Collection对应的第一嵌套参数;
    所述判断部分,配置于根据所述第一嵌套参数判断是否添加所述第一Collection;
    所述发送部分,配置于当判定添加所述第一Collection时,响应所述添加请求,发送添加许可指令,以将所述第一Collection添加至所述第二Collection。
  14. 根据权利要求13所述的管理设备,其中,所述管理设备还包括:确定部分和存储部分,
    所述确定部分,配置于接收添加请求之前,接收注册请求;其中,所述注册请求携带所述第二Collection对应的第二标识;
    所述获取部分,还配置于根据所述第二标识,获取所述第二Collection对应的子资源;
    所述确定部分,还配置于根据所述子资源确定所述第二Collection对应的第二嵌套参数;
    所述存储部分,配置于将所述第二嵌套参数存储至所述预设集合列表中,以对所述第二Collection进行注册。
  15. 根据权利要求13所述的管理设备,
    所述获取部分,具体配置于根据所述第一标识判断所述预设集合列表中是否包括所述第一Collection;以及当所述预存集合列表中包括所述第一Collection时,从所述预存集合列表中获取所述第一嵌套参数;以及当所述预存集合列表中不包括所述第一Collection时,向所述第一Collection发送第一查询请求,以获得所述第一嵌套参数。
  16. 根据权利要求15所述的管理设备,
    所述获取部分,还具体配置于根据所述第一标识向所述第一Collection发送所述第一查询请求;以及接收所述第一Collection发送的查询响应;其中,所述查询响应携带所述第一嵌套参数。
  17. 根据权利要求14所述的管理设备,
    所述判断部分,具体配置于当所述第一嵌套参数小于或者等于所述第二嵌套参数时,判定添加所述第一Collection;以及当所述第一嵌套参数大于所述第二嵌套参数时,判定不添加所述第一Collection。
  18. 根据权利要求14所述的管理设备,
    所述判断部分,还具体配置于当所述第一嵌套参数小于或者等于所述第二嵌套参数时,判定添加所述第一Collection;以及当所述第一嵌套参数大于所述第二嵌套参数,且小于或者等于预设嵌套阈值时,获取所述第一Collection对应的全部子Collection,以根据所述全部子Collection判断是否添加所述第一Collection;其中,所述预设嵌套阈值大于所述第二嵌套参数;以及当所述第一嵌套参数大于所述预设嵌套阈值时,判定不添加所述第一Collection。
  19. 根据权利要求18所述的管理设备,
    所述判断部分,还具体配置于遍历所述全部子Collection,判断所述全部子Collection是否包括所述第二Collection;以及当不包括所述第二Collection时,判定添加所述第一Collection;以及当包括所述第二Collection时,判定不添加所述第一Collection。
  20. 根据权利要求14所述的管理设备,
    所述确定部分,具体配置于确定所述子资源对应的第三标识;以及根据所述第三标识,获取所述子资源对应的第三嵌套参数;以及按照所述第三嵌套参数,确定所述第二嵌套参数。
  21. 根据权利要求20所述的管理设备,
    所述确定部分,还具体配置于根据所述第三标识确定所述子资源对应的资源类型;以及当所述资源类型为非Collection资源时,将所述第三嵌套参数设置为零;以及当所述资源类型为Collection资源时,根据所述第三标识和所述预存资源列表,获取所述子资源对应的第三嵌套参数。
  22. 根据权利要求21所述的管理设备,
    所述确定部分,还具体配置于根据所述第三标识判断所述预设集合列表中是否包括所述子资源;以及当所述预存集合列表中包括所述子资源时,从所述预存集合列表中获取所述第三嵌套参数;以及当所述预存集合列表中不包括所述子资源时,向所述子资源发送第二查询请求,以获得所述第三嵌套参数。
  23. 根据权利要求20所述的管理设备,
    所述确定部分,还具体配置于在所述第三嵌套参数中确定出数值最大的嵌套参数;以及对所述数值最大的嵌套参数进行加1运算,获得所述第二嵌套参数。
  24. 根据权利要求13所述的管理设备,
    所述发送部分,还配置于所述根据所述第一嵌套参数判断是否添加所述第一Collection之后,当判定不添加所述第一Collection时,返回添加失败响应。
  25. 一种管理设备,所述管理设备包括处理器、存储有所述处理器可执行指令的存储器,当所述指令被所述处理器执行时,实现如权利要求1-12任一项所述的方法。
  26. 一种计算机可读存储介质,其上存储有程序,应用于管理设备中,所述程序被处理器执行时,实现如权利要求1-12任一项所述的方法。
PCT/CN2019/085458 2019-05-05 2019-05-05 资源添加方法、管理设备及计算机存储介质 WO2020223845A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/085458 WO2020223845A1 (zh) 2019-05-05 2019-05-05 资源添加方法、管理设备及计算机存储介质
CN201980079218.1A CN113168323A (zh) 2019-05-05 2019-05-05 资源添加方法、管理设备及计算机存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/085458 WO2020223845A1 (zh) 2019-05-05 2019-05-05 资源添加方法、管理设备及计算机存储介质

Publications (1)

Publication Number Publication Date
WO2020223845A1 true WO2020223845A1 (zh) 2020-11-12

Family

ID=73050976

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/085458 WO2020223845A1 (zh) 2019-05-05 2019-05-05 资源添加方法、管理设备及计算机存储介质

Country Status (2)

Country Link
CN (1) CN113168323A (zh)
WO (1) WO2020223845A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095518A (zh) * 2016-06-28 2016-11-09 东软集团股份有限公司 应用程序安装方法及装置
CN106254947A (zh) * 2016-08-05 2016-12-21 青岛海信电器股份有限公司 处理资源的扩展方法和装置
CN109474990A (zh) * 2017-09-08 2019-03-15 华为技术有限公司 资源配置方法、终端和网络设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7970728B2 (en) * 2008-10-23 2011-06-28 International Business Machines Corporation Dynamically building and populating data marts with data stored in repositories
CN107196983A (zh) * 2016-03-15 2017-09-22 阿里巴巴集团控股有限公司 一种资源分发方法及装置
CN109446445B (zh) * 2018-10-23 2022-03-22 北京乐我无限科技有限责任公司 一种资源获取方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095518A (zh) * 2016-06-28 2016-11-09 东软集团股份有限公司 应用程序安装方法及装置
CN106254947A (zh) * 2016-08-05 2016-12-21 青岛海信电器股份有限公司 处理资源的扩展方法和装置
CN109474990A (zh) * 2017-09-08 2019-03-15 华为技术有限公司 资源配置方法、终端和网络设备

Also Published As

Publication number Publication date
CN113168323A (zh) 2021-07-23

Similar Documents

Publication Publication Date Title
US11677820B2 (en) Peer-to-peer syncable storage system
CN108897628B (zh) 一种分布式锁的实现方法、装置及电子设备
CN109936571B (zh) 一种海量数据共享方法、开放共享平台及电子设备
EP2477355A1 (en) Method and device for managing association of network resources
CN109964507B (zh) 网络功能的管理方法、管理单元及系统
EP3035216A1 (en) Cloud bursting a database
US11347808B1 (en) Dynamically-adaptive bloom-filter
US9471896B2 (en) Memo synchronization system, mobile system, and method for synchronizing memo data
CN108173839B (zh) 权限管理方法及系统
CN112783760B (zh) 测试用例的处理方法、装置和存储介质
WO2016141783A1 (zh) 访问控制、策略获取、属性获取方法及相关装置
CN107306247B (zh) 资源访问控制方法及装置
WO2020253344A1 (zh) 一种授权控制的方法、装置以及存储介质
CN113315811A (zh) 基于联盟区块链的标识解析方法、装置、存储介质及服务器
CN107395623B (zh) 接口访问数据验证方法及装置、计算机存储介质和设备
CN112579319A (zh) 一种基于LRU Cache优化的服务调用方法及装置
CN113722114A (zh) 一种数据服务的处理方法、装置、计算设备及存储介质
CN110659019A (zh) 参数校验方法、装置和服务器
CN111008873B (zh) 一种用户确定方法、装置、电子设备及存储介质
WO2020223845A1 (zh) 资源添加方法、管理设备及计算机存储介质
CN112181599A (zh) 模型训练方法、装置及存储介质
CN113742050B (zh) 操作数据对象的方法、装置、计算设备和存储介质
CN115309756A (zh) 缓存数据的更新方法、装置和电子设备
US11349926B1 (en) Protected smart contracts for managing internet of things devices
US10114864B1 (en) List element query support and processing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19927772

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19927772

Country of ref document: EP

Kind code of ref document: A1