WO2012026320A1 - WebAPIサーバプログラム、WebAPI公開方法 - Google Patents

WebAPIサーバプログラム、WebAPI公開方法 Download PDF

Info

Publication number
WO2012026320A1
WO2012026320A1 PCT/JP2011/068112 JP2011068112W WO2012026320A1 WO 2012026320 A1 WO2012026320 A1 WO 2012026320A1 JP 2011068112 W JP2011068112 W JP 2011068112W WO 2012026320 A1 WO2012026320 A1 WO 2012026320A1
Authority
WO
WIPO (PCT)
Prior art keywords
osgi
class
service
bundle
webapi
Prior art date
Application number
PCT/JP2011/068112
Other languages
English (en)
French (fr)
Inventor
真也 信岡
中村 雄一
Original Assignee
株式会社日立ソリューションズ
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 株式会社日立ソリューションズ filed Critical 株式会社日立ソリューションズ
Priority to US13/635,150 priority Critical patent/US8701129B2/en
Priority to EP11819784.7A priority patent/EP2538344A4/en
Publication of WO2012026320A1 publication Critical patent/WO2012026320A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications

Definitions

  • the present invention relates to a technique for publishing an OSGi bundle corresponding to the OSGi framework specification via a Web API.
  • FIG. 1 is a diagram showing the configuration of the OSGi framework.
  • the OSGi framework is a service platform that operates on Java (registered trademark) Virtual Machine, handles a Java program as a Plugin module, and can be dynamically added to an application.
  • the OSGi framework is developed and defined by OSGi Alliance (Non-Patent Document 1).
  • the OSGi framework 13 is implemented as a Java application on an OS (Operating System) 11 operating on the host 10 and a Java VM 12 operating under the OS.
  • the OSGi framework 13 publishes a service registry 131 that is an interface for registering services provided by the Java module on the OSGi platform 13.
  • a Java module that conforms to the OSGi framework specification and is configured to be registered in the OSGi framework 13 (operates on the OSGi framework) is called an OSGi bundle.
  • the entity of the OSGi bundle is a Java class (Java class group or Java package or Java package made up of a plurality of Java classes) and related setting files.
  • a service provided by the OSGi bundle is called an OSGi service.
  • the entity of the OSGi service is a Java class.
  • the Java VM 12 can add the OSGi bundle B15 that operates in cooperation with the OSGi bundle A14 onto the application without restarting the OSGi bundle A14.
  • the term “cooperation” refers to operations such as calling a method possessed by the OSGi bundle B15 from the OSGi bundle A14, calling a method possessed by the OSGi bundle A14 from the OSGi bundle B15, and sharing data between the two bundles.
  • OSGi bundles Cooperation between OSGi bundles is performed via a service registry 131 provided by the OSGi framework 13. For example, when the function B151 (method (class)) included in the OSGi bundle B15 is to be used from the OSGi bundle A14, the OSGi bundle B15 is registered in the service registry 131 by issuing a predetermined command.
  • the function B151 method (class)
  • the OSGi bundle B15 is registered in the service registry 131 by issuing a predetermined command.
  • the function B of the OSGi bundle B15 registered in the service registry 131 is published on the service registry 131 as the OSGi service B132.
  • the OSGi bundle A14 can acquire the OSGi service B132 from the service registry 131 and execute a method corresponding to the function B151 (having the function B).
  • the Web API server here is a generic term for an interface for executing an application via a network using HTTP and acquiring the result, such as CGI (Common Gateway Interface), and a Web server function therefor. Pointed to. Specific mounting means is not limited to CGI, and any mounting method can be used as long as it accepts a request via HTTP and returns the execution result as an HTTP response.
  • CGI Common Gateway Interface
  • the present invention has been made in order to solve the above-described problems, and an object of the present invention is to provide a technology that can easily publish functions provided by an OSGi bundle via WebAPI.
  • the WebAPI server program receives the class name and method name of the OSGi bundle registered on the OSGi framework as an HTTP request, calls and executes an OSGi bundle that matches these, and outputs the result as an HTTP response. Send back.
  • the WebAPI server program it is possible to automatically publish the OSGi bundle (OSGi service) whose function is to be disclosed on the network to the network via the WebAPI only by registering it with the OSGi framework. Therefore, it is not necessary to implement the Web API server function in each OSGi bundle, and the OSGi bundle can be provided as a Web service without applying a development burden.
  • OSGi bundle OSGi service
  • FIG. 1 is a configuration diagram of a Web system 100 according to a first embodiment.
  • a functional block diagram of the WebAPI bundle 17 is shown. It is a figure which shows typically the substance of an OSGi service. It is a conceptual diagram which shows a mode from registering OSGi bundle B15 to the service registry 131, and performing as an OSGi service. It is a figure which shows the correspondence of the HTTP request which requests
  • Embodiment 2 it is a figure which shows a mode that the WebAPI bundle 17 discloses an OSGi service as WebAPI. It is a figure which shows the HTTP request parameter which can be specified when calling an OSGi service via the WebAPI bundle 17, and an example of a response. It is a figure which shows the example which uses XML as a description format of a response.
  • FIG. 2 is a configuration diagram of the Web system 100 according to the first embodiment of the present invention.
  • the Web system 100 is a system that uses an application running on the host 10 from a client 20 via a network.
  • the client 20 accesses the host 10 using HTTP, requests a function to be used, and receives the execution result as an HTTP response.
  • the host 10 includes a WebAPI bundle 17 instead of the OSGi bundle A14 described in FIG.
  • Other configurations are the same as those in FIG. 1 (bundle B does not have a WebAPI server unit).
  • ServiceB132 the name when the function B, which is a Java object of the OSGi bundle B15, is registered in the OSGi framework 13 will be described as ServiceB132.
  • the host 10 includes an arithmetic unit such as a CPU (Central Processing Unit) that executes the OS 11, JavaVM 12, etc., a storage device such as an HDD (Hard Disk Drive) that stores these programs and each OSGi bundle, a necessary memory, a network interface, etc. It is assumed that the host computer has a necessary configuration as appropriate.
  • arithmetic unit such as a CPU (Central Processing Unit) that executes the OS 11, JavaVM 12, etc.
  • a storage device such as an HDD (Hard Disk Drive) that stores these programs and each OSGi bundle, a necessary memory, a network interface, etc. It is assumed that the host computer has a necessary configuration as appropriate.
  • OSGi framework 13 and each OSGi bundle program will be described as the main subject of operation.
  • the WebAPI bundle 17 is implemented as an OSGi bundle.
  • the WebAPI bundle 17 is not for registering (the OSGi service) in the service registry 131, but is a module for receiving a request from the client 20, calling and executing a service registered in the service registry 131, and returning the result. It is.
  • the WebAPI bundle 17 operates under the Java VM 12 and provides a Web server function that waits for an HTTP request from the client 20.
  • the WebAPI bundle 17 corresponds to the “WebAPI server program” in the present invention.
  • the client 20 accesses the Web API published by the Web API bundle 17 using HTTP, and requests to execute the service provided by the Web API bundle 17 (Service B 132 in this case).
  • the WebAPI bundle 17 processes the request and returns an execution result to the client 20 as an HTTP response.
  • FIG. 3 shows a functional block diagram of the WebAPI bundle 17.
  • the WebAPI bundle 17 includes an HTTP server unit 171, an OSGi service execution unit 172, and an OSGi service list acquisition unit 173. These functional units can be implemented as Java methods provided in the Web API bundle 17.
  • the HTTP server unit 171 has a function as a Web server that accepts an HTTP request from the client 20 and returns an HTTP response.
  • the OSGi service execution unit 172 acquires and executes the OSGi service registered in the service registry 131.
  • the OSGi service list acquisition unit 173 acquires a list of OSGi services registered in the service registry 131.
  • FIG. 4 is a diagram schematically showing the substance of the OSGi service.
  • the function B of the OSGi bundle B15 is registered as Service B132 which is an OSGi service.
  • the entity of the OSGi service is an instance of a Java class that constitutes an OSGi bundle registered in the service registry 131 (which the OSGi bundle has). Registering the OSGi service in the service registry 131 means creating an instance of the Java class that constitutes the OSGi bundle (which the OSGi bundle has) and handing over the reference to the service registry 131.
  • the Java instance held by the service registry 131 is acquired using the class name as a key, and the OSGi service is used by executing the method of the class.
  • the Java class (for example, WebAPI bundle 17) on the OSGi service side obtains ServiceB132 from the service registry 131 using the class name “ServiceB” as a key, and the methods “func1”, “func2”, and the like. Execute. These methods correspond to the function 151 provided by the OSGi bundle B15.
  • FIG. 5 is a conceptual diagram showing how the OSGi bundle B15 is registered in the service registry 131 and executed as an OSGi service.
  • OSGi bundle B15 is registered in the service registry 131 and executed as an OSGi service.
  • a very simplified sample source code is also shown. It is added that the source code is for explanation, and does not necessarily indicate actual source code.
  • the OSGi bundle B15 which is the OSGi service provider, generates a ServiceB object and registers it in the service registry 131.
  • the service registry 131 holds a reference to an instance of the ServiceB class.
  • the OSGi service execution unit 172 of the Web API bundle 17 that uses the OSGi service uses the class name “ServiceB” corresponding to the OSGi service bundle to be used as a key to refer to the ServiceB object from the service registry 131. get.
  • the OSGi service execution unit 172 (actually the Java VM 12) secures the acquired ServiceB object on the memory provided in the host 10 (there is no need for a memory for the object because it is a reference.
  • the OSGi service execution unit 172 of the WebAPI bundle 17 executes a method possessed by the ServiceB object, for example, a “func1” method.
  • the HTTP server unit 171 returns the result to the client 20 in the HTTP response format.
  • the class name and method name of the OSGi bundle that provides the OSGi service are known to the WebAPI bundle 17.
  • the class name and method name of the OSGi bundle are not necessarily known, and differ depending on the design specifications of the Web system 100 and the like.
  • the connection between the WebAPI bundle 17 and the OSGi bundle B15 becomes strong, and the advantage of the OSGi framework 13 providing the Plugin mechanism is reduced.
  • a class name and a method name of an OSGi bundle that provides an OSGi service are given from the outside of the Web API bundle 17 and an arbitrary class name and method name can be called from the service registry 131.
  • FIG. 6 is a diagram showing a correspondence relationship between an HTTP request for requesting the Web API bundle 17 to return an execution result by designating a class name and a method name to the Web API bundle 17.
  • the first line shows an example when calling the “func1” method of ServiceB132
  • the second line shows an example when calling the “func2” method of ServiceB132.
  • the client 20 issues an HTTP request to the Web API bundle 17
  • the class name providing the OSGi service, its method name, and method arguments are included in the request as request parameters. If there are multiple arguments, request parameters are provided accordingly.
  • the HTTP server unit 171 of the WebAPI bundle 17 When the HTTP server unit 171 of the WebAPI bundle 17 receives the HTTP request, it cuts out the request parameter portion and delivers it to the OSGi service execution unit 172.
  • the OSGi service execution unit 172 calls the OSGi service corresponding to the class name from the service registry 131 using the class name described in the request parameter as a key.
  • the OSGi service execution unit 172 executes a method corresponding to the method name described in the request parameter, and returns the result to the client 20 via the HTTP server unit 171. Since the HTTP response is in a text format, the description format may be arbitrary. FIG. 6 shows an example using the same format as the request parameter. If there are multiple return values of the method, that effect is also described in the HTTP response.
  • the OSGi service execution unit 172 and the HTTP server unit 171 issues an exception and returns a message to that effect to the client 20.
  • the service registry 131 is a general class type as shown in the upper left source code example of FIG.
  • the OSGi class is delivered as an Object type. This is considered to be a specification necessary for registering an arbitrary class type in the service registry 131.
  • the WebAPI bundle 17 can invoke any method using a character string held in the character string variable. lang. The function of the reflect package is used.
  • any method can be invoked without changing the Object class type to the Service B class type. This is advantageous in that the dependency on a specific class can be eliminated in addition to the merit that an arbitrary method of an arbitrary class can be executed.
  • the Web API bundle 17 once converts the Object type acquired from the service registry 131 into the Service B type, and then “func1” or the like. The method of is executed. This is because the Object type does not have this method. However, for that purpose, the Service B class must be taken in the Web API bundle 17 in advance, and the versatility of the Web API bundle 17 is reduced at that time.
  • FIG. 7 is a diagram illustrating an HTTP request for requesting that the list of OSGi services registered in the service registry 131 is returned from the client 20 to the Web API bundle 17 and a response thereof.
  • the client 20 issues an HTTP request to the Web API bundle 17, the client 20 includes in the request as a request parameter a request to return a list of OSGi services.
  • the HTTP server unit 171 of the WebAPI bundle 17 When the HTTP server unit 171 of the WebAPI bundle 17 receives the HTTP request, it cuts out the request parameter portion and delivers it to the OSGi service execution unit 172.
  • the OSGi service list acquisition unit 173 acquires a class name list of OSGi services registered in the service registry 131. Furthermore, Java. lang. Using the function of the reflect package, information such as a method name, a method argument, a method return type, and the like possessed by each OSGi service class is acquired. The OSGi service list acquisition unit 173 returns the acquisition result to the client 20 via the HTTP server unit 171.
  • the function of the OSGi service list acquisition unit 173 is used, for example, to check whether a class name or a method name corresponding to a service that the client 20 wants to use exists in the service registry 131.
  • FIG. 8 is an operation flow of the WebAPI bundle 17. Hereinafter, each step of FIG. 8 will be described.
  • Step S801 When the WebAPI bundle 17 is activated, the HTTP server unit 171 waits for an HTTP request from the client 20. When an HTTP request arrives from the client 20, the HTTP server unit 171 determines whether the request is a request for acquiring a list of OSGi services or a request for calling an OSGi service. If the former, the process proceeds to step S802, and if the latter, the process proceeds to step S803.
  • the OSGi service list acquisition unit 173 acquires a list of class names, method names, method arguments, method return types, and the like of OSGi services registered in the service registry 131.
  • the HTTP server unit 171 returns the acquisition result as an HTTP response to the client 20 and ends the operation flow.
  • the HTTP server unit 171 waits for an HTTP request again.
  • Step S803 The OSGi service execution unit 172 calls the corresponding OSGi service from the service registry 131 using the class name, method name, and the like specified in the HTTP request from the client 20. If the call is successful, the process proceeds to step S804. If the call is unsuccessful, the process proceeds to step S805.
  • Step S804 The OSGi service execution unit 172 executes the method of the OSGi service (called class) called in step S803. If the execution is successful, the process proceeds to step S806. If the execution is unsuccessful, the process proceeds to step S805.
  • the HTTP server unit 171 returns an HTTP response to the effect that an error has occurred to the client 20.
  • the HTTP server unit 171 waits for an HTTP request again.
  • the fact that an error has occurred may be described in the content part of the HTTP response, or an error code defined by HTTP may simply be returned.
  • the former is preferable from the viewpoint of clearly indicating what kind of error has occurred.
  • the HTTP server unit 171 describes the result of the OSGi service execution unit 172 executing the OSGi service in the HTTP response, and returns it to the client 20.
  • the HTTP server unit 171 waits for an HTTP request again.
  • the Web API bundle 17 receives an HTTP request specifying the class name, method name, and the like of the OSGi service to be executed, executes the method, and returns the result as an HTTP response.
  • the OSGi service possessed by the OSGi bundle to be published on the network is registered in the service registry 131, it can be automatically published to the network as a Web API, so it is necessary to individually implement an HTTP server function or the like. The development burden can be reduced.
  • the Web API bundle 17 acquires the OSGi service from the service registry 131, and then converts the method specified by the client 20 without converting the object type that is a general-purpose class type into the class type of the OSGi bundle. Run as is.
  • the WebAPI bundle 17 can be separated from the class type of the OSGi bundle, and the dependency between the classes can be eliminated to improve versatility. That is, regardless of what OSGi service is registered in the service registry 131, the WebAPI bundle 17 can call and execute a specified class and method without reading the class type in advance.
  • the Web API bundle 17 can provide the client 20 with a list of class names, method names, and the like registered in the service registry 131.
  • the client 20 can know in advance the possibility that an error will occur before issuing the request, so that the non-existence of checking the existence of the method depending on whether or not the error is returned by executing the method. Efficient processing is not required.
  • the OSGi bundle registered in the service registry 131 is unconditionally released on the network.
  • OSGi bundles registered in the service registry 131 to use the functions of the OSGi framework 13 do not want to be disclosed to the network. Therefore, in the second embodiment of the present invention, a method for distinguishing between OSGi bundles disclosed on the network and OSGi bundles that are not so will be described. Since the other configuration is the same as that of the first embodiment, the following description focuses on the differences.
  • FIG. 9 is a diagram illustrating a state in which the Web API bundle 17 publishes the OSGi service as a Web API in the second embodiment.
  • a member variable 153 (field) “openapi” is provided for an OSGi bundle that is disclosed as a Web API on the network.
  • the WebAPI bundle 17 When the WebAPI bundle 17 receives a request to execute an OSGi service or receives a request to acquire a list of OSGi services registered in the service registry 131, the WebAPI bundle 17 includes the OSGi bundle class acquired from the service registry 131.
  • the member variable “openapi” is acquired. If the value of the member variable is “true”, it is determined that the method of the class may be disclosed as a Web API. If the value of the member variable is not “true”, or if the member variable does not exist, the method of the class is not disclosed as a Web API.
  • the WebAPI bundle 17 When the WebAPI bundle 17 receives a service execution request for a class that is not disclosed as a WebAPI, it returns an error. As for a class that is not disclosed as a Web API, when a list of OSGi services registered in the service registry 131 is returned to the client 20, the class is not described in the list.
  • the WebAPI bundle 17 acquires the OSGi bundle class (OSGi service class) from the service registry 131, the class type is the Object type as described with reference to FIG. Therefore, the WebAPI bundle 17 is Java. lang.
  • the member variable “openapi” is accessed using the function of the reflect package. According to this method, even when the member variable is designated for private (declaration that access from outside the class is prohibited), the member variable can be accessed.
  • the OSGi framework 13 can handle all OSGi bundles equally, so special considerations specific to the second embodiment are taken into consideration. This is convenient in that it is not necessary.
  • the WebAPI bundle 17 checks the value of the member variable “openapi” of the OSGi bundle registered in the service registry 131 and determines whether or not the class can be disclosed as a WebAPI. Determine. As a result, only the OSGi bundle that is desired to be released to the network can be selectively released, so that the possibility of inadvertently releasing the OSGi bundle that should not be released to the network can be reduced.
  • the third embodiment of the present invention supplements the format of HTTP requests and HTTP responses between the client 20 and the Web API bundle 17.
  • the configuration of the Web system 100 is the same as in the first and second embodiments.
  • FIG. 10 is a diagram showing an HTTP request parameter and a response example that can be specified when calling the OSGi service via the Web API bundle 17.
  • HTTP is a text-based protocol
  • Java objects it is difficult to use Java objects as they are in requests and responses. Therefore, what can be used on the request from the client 20 and on the response to the client 20 is limited to the Java basic type and the String (string) type that can be expressed in a text base. That is, an original class type or an array including an arbitrary class type (for example, ArrayList) cannot be used.
  • the Dictionary type (a class type similar to an array that stores multiple values internally) can be used in the response, but it is not preferable to use it as a request parameter. This is due to the description format of the HTTP request parameter.
  • HTTP response can be described in any text format including a line feed code, even if the execution result of the Java method is a Dictionary type and multiple values are included in it, all values are included in the response. Can be described in
  • the parameter value is a Dictionary type and includes a plurality of values internally
  • the Dictionary type is not used as the request parameter.
  • FIG. 11 is a diagram illustrating an example in which XML (extensible Markup Language) is used as a response description format.
  • XML extensible Markup Language
  • the content of the response is the same as in FIG.
  • Such an XML format response is also referred to as a REST (Representational State Transfer) format. Since the process of converting the response into the XML format is a process that has little relation to the OSGi service, for example, the HTTP server unit 171 may perform the process.
  • HTTP requests can also be described in XML format.
  • SOAP Simple Object Access Protocol
  • the HTTP server unit 171 analyzes the message and passes only necessary parameters to the OSGi service execution unit 172. Good.
  • the Web API bundle 17 directly receives the class name of the OSGi service as an HTTP request, but it is not always necessary to use a request parameter describing the class name itself.
  • the WebAPI bundle 17 receives a character string obtained by converting a class name and a method name according to a predetermined rule as a request parameter, and the class name and method name of the OSGi service via the WebAPI bundle 17 or an appropriate conversion module. It may be converted to. That is, it is sufficient for the WebAPI bundle 17 to receive a request parameter that can specify at least the class name, method name, etc. of the OSGi service.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

 OSGiバンドルが備える機能をWebAPI経由で容易に公開することのできる技術を提供する。 本発明に係るWebAPIサーバプログラムは、OSGiフレームワーク上に登録されているOSGiバンドル(OSGiサービス)のクラス名とメソッド名をHTTPリクエストとして受け取り、これらに合致するOSGiバンドル(OSGiサービス)を呼び出して実行し、その結果をHTTPレスポンスとして返信する(図2参照)。

Description

WebAPIサーバプログラム、WebAPI公開方法
 本発明は、OSGiフレームワーク仕様に対応したOSGiバンドルをWebAPI経由で公開する技術に関するものである。
 図1は、OSGiフレームワークの構成を示す図である。OSGiフレームワークとは、Java(登録商標)Virtual Machine上で動作し、JavaプログラムをPluginモジュールとして取り扱い、動的にアプリケーションへ追加できるようにする、サービスプラットフォームである。OSGiフレームワークは、OSGi Allianceによって開発・定義されている(非特許文献1)。
 図1において、OSGiフレームワーク13は、ホスト10上で動作するOS(Operating System)11およびその配下で動作するJavaVM12上のJavaアプリケーションとして実装されている。OSGiフレームワーク13は、Javaモジュールの提供するサービスをOSGiプラットフォーム13上に登録するためのインターフェースである、サービスレジストリ131を公開している。OSGiフレームワーク仕様に準拠し、OSGiフレームワーク13に登録することができるよう(OSGiフレームワーク上で動作するよう)に構成されているJavaモジュールのことを、OSGiバンドルと呼ぶ。OSGiバンドルの実体は、Javaクラス(Javaクラス群 or Javaパッケージ or 複数のJavaクラスから成るJavaパッケージ)および関連する設定ファイル等である。また、OSGiバンドルの提供するサービスのことをOSGiサービスと呼ぶ。OSGiサービスの実体は、Javaクラスである。
 例えば、OSGiフレームワーク13上でOSGiバンドルA14が既に動作していると仮定する。JavaVM12は、OSGiフレームワーク13を利用することにより、OSGiバンドルA14と連携して動作するOSGiバンドルB15を、OSGiバンドルA14を再起動することなくアプリケーション上に追加することができる。
 ここでいう連携とは、OSGiバンドルA14からOSGiバンドルB15が有するメソッドを呼び出す、OSGiバンドルB15からOSGiバンドルA14が有するメソッドを呼び出す、両バンドル間でデータを共有する、などの動作のことをいう。
 OSGiバンドル同士の連携は、OSGiフレームワーク13が提供するサービスレジストリ131を介して行なわれる。例えば、OSGiバンドルB15が備える機能B151(メソッド(クラス))をOSGiバンドルA14から使用したい場合、所定のコマンドを発行することにより、OSGiバンドルB15をサービスレジストリ131に登録する。
 サービスレジストリ131に登録されたOSGiバンドルB15の機能Bは、OSGiサービスB132として、サービスレジストリ131上で公開される。OSGiバンドルA14は、サービスレジストリ131からOSGiサービスB132を取得し、機能B151に対応する(機能Bの有する)メソッドを実行することができる。
 一方、OSGiバンドルB15が備える機能151を、ホスト10の外部から使用するためには、そのための通信インターフェースをOSGiバンドルB15内に設けておく必要がある。例えばHTTP(Hyper Text Transfer Protocol)を用いて機能151をクライアント端末20から使用するためには、WebAPIサーバとしての機能を備えたWebAPIサーバ部152をOSGiバンドルB15内に設ける必要がある。
 ここでいうWebAPIサーバとは、例えばCGI(Common Gateway Interface)のように、HTTPを用いてネットワーク経由でアプリケーションを実行してその結果を取得するためのインターフェース、およびそのためのWebサーバ機能のことを総称的に指したものである。具体的な実装手段はCGIに限られるものではなく、HTTPを介してリクエストを受け付け、その実行結果をHTTPレスポンスとして返すものであれば、任意の実装手法を用いることができる。
OSGi Service Platform Release 4、URL:http://www.osgi.org/Release4/HomePage(2010年8月9日取得)
 OSGiバンドルが備える機能をネットワーク上で公開し、ネットワーク経由で使用できるようにするためには、図1に示したWebAPIサーバ部152のようなサーバ機能および機能を公開するためのインターフェースが必要となる。しかし、機能を公開するOSGiバンドル毎に上述のような機能を実装することは、開発工数などの面から負担が大きい。
 本発明は、上記のような課題を解決するためになされたものであり、OSGiバンドルが備える機能をWebAPI経由で容易に公開することのできる技術を提供することを目的とする。
 本発明に係るWebAPIサーバプログラムは、OSGiフレームワーク上に登録されているOSGiバンドルのクラス名とメソッド名をHTTPリクエストとして受け取り、これらに合致するOSGiバンドルを呼び出して実行し、その結果をHTTPレスポンスとして返信する。
 本発明に係るWebAPIサーバプログラムによれば、ネットワーク上で機能を公開したいOSGiバンドル(OSGiサービス)をOSGiフレームワークに登録するのみで、自動的にWebAPI経由でネットワーク上に公開することができる。したがって、個々のOSGiバンドルにはWebAPIサーバ機能を実装する必要がなくなり、開発負担をかけずに、OSGiバンドルをWebサービスとして提供することができる。
OSGiフレームワークの構成を示す図である。 実施形態1に係るWebシステム100の構成図である。 WebAPIバンドル17の機能ブロック図を示す。 OSGiサービスの実体を模式的に示す図である。 OSGiバンドルB15をサービスレジストリ131に登録し、OSGiサービスとして実行するまでの様子を示す概念図である。 クラス名とメソッド名を指定して実行結果を返信するよう要求するHTTPリクエストとそのレスポンスの対応関係を示す図である。 サービスレジストリ131に登録されているOSGiサービスの一覧を返信するよう要求するHTTPリクエストとそのレスポンスを例示する図である。 WebAPIバンドル17の動作フローである。 実施形態2において、WebAPIバンドル17がOSGiサービスをWebAPIとして公開する様子を示す図である。 WebAPIバンドル17を介してOSGiサービスを呼び出す際に指定することのできるHTTPリクエストパラメータとレスポンス例を示す図である。 レスポンスの記述形式としてXMLを用いる例を示す図である。
<実施の形態1>
 図2は、本発明の実施形態1に係るWebシステム100の構成図である。Webシステム100は、ホスト10上で動作するアプリケーションを、ネットワークを介してクライアント20から利用する形態のシステムである。クライアント20は、HTTPを用いてホスト10にアクセスし、利用したい機能をリクエストし、その実行結果をHTTPレスポンスとして受信する。
 ホスト10は、図1で説明したOSGiバンドルA14に代えて、WebAPIバンドル17を備える。その他の構成は、図1と同様である(バンドルBはWebAPIサーバ部を持たない)。なお、以下の説明の便宜上、OSGiバンドルB15が持つJavaオブジェクトである機能BをOSGiフレームワーク13に登録したときの名称を、ServiceB132として表記することにする。
 ホスト10は、OS11、JavaVM12などを実行するCPU(Central Processing Unit)などの演算装置、これらプログラムおよび各OSGiバンドルを格納するHDD(Hard Disk Drive)などの記憶装置、必要なメモリおよびネットワークインターフェースなどの、ホストコンピュータとして必要な構成を適宜備えるものとする。
 以下では説明の便宜上、OSGiフレームワーク13や各OSGiバンドルなどのプログラムを動作主体として説明するが、実際にこれらプログラムを実行するのは、ホスト10が備えるCPU、さらにはCPUが実行するJavaVM12であることを付言しておく。
 WebAPIバンドル17は、OSGiバンドルとして実装されている。WebAPIバンドル17は、サービスレジストリ131に(OSGiサービスを)登録するためのものではなく、クライアント20からリクエストを受け付けてサービスレジストリ131に登録されているサービスを呼び出して実行し、その結果を返信するモジュールである。WebAPIバンドル17は、JavaVM12の配下で動作し、クライアント20からのHTTPリクエストを待ち受けるWebサーバ機能を提供する。WebAPIバンドル17は、本発明における「WebAPIサーバプログラム」に相当する。
 クライアント20は、HTTPを用いてWebAPIバンドル17が公開するWebAPIにアクセスし、WebAPIバンドル17が提供するサービス(ここではServiceB132)を実行するようリクエストする。WebAPIバンドル17はそのリクエストを処理し、実行結果をHTTPレスポンスとしてクライアント20に返信する。
 図3は、WebAPIバンドル17の機能ブロック図を示す。WebAPIバンドル17は、HTTPサーバ部171、OSGiサービス実行部172、OSGiサービス一覧取得部173を備える。これら機能部は、WebAPIバンドル17が備えるJavaメソッドとして実装することができる。
 HTTPサーバ部171は、クライアント20からHTTPリクエストを受け付け、HTTPレスポンスを返信する、Webサーバとしての機能を備える。OSGiサービス実行部172は、サービスレジストリ131に登録されているOSGiサービスを取得し、実行する。OSGiサービス一覧取得部173は、サービスレジストリ131に登録されているOSGiサービスの一覧を取得する。
 図4は、OSGiサービスの実体を模式的に示す図である。ここでは、OSGiバンドルB15の持つ機能BをOSGiサービスであるServiceB132として登録する場合の例を示した。
 OSGiサービスの実体は、サービスレジストリ131に登録されたOSGiバンドルを構成する(OSGiバンドルが持つ)Javaクラスのインスタンスである。OSGiサービスをサービスレジストリ131に登録するとは、OSGiバンドルを構成する(OSGiバンドルが持つ)Javaクラスのインスタンスを生成し、その参照をサービスレジストリ131に引き渡すことである。
 OSGiサービスを利用する側では、サービスレジストリ131が保持しているこのJavaインスタンスを、クラス名をキーとして取得し、そのクラスが有するメソッドを実行することにより、OSGiサービスを利用する。
 図4に示す例では、OSGiサービスを利用する側のJavaクラス(例えばWebAPIバンドル17)は、クラス名「ServiceB」をキーにしてサービスレジストリ131からServiceB132を取得し、メソッド「func1」「func2」などを実行する。これらのメソッドは、OSGiバンドルB15が提供する機能151に相当する。
 図5は、OSGiバンドルB15をサービスレジストリ131に登録し、OSGiサービスとして実行するまでの様子を示す概念図である。OSGiサービスとJavaインスタンスの関連イメージを示すため、ごく簡略化したサンプルソースコードを併記した。同ソースコードは説明のためのものであり、必ずしも実際のソースコードを示すものではないことを付言しておく。
 OSGiサービスの提供元であるOSGiバンドルB15は、ServiceBオブジェクトを生成し、サービスレジストリ131に登録する。サービスレジストリ131は、ServiceBクラスのインスタンスへの参照を保持する。
 OSGiサービスを利用する側であるWebAPIバンドル17のOSGiサービス実行部172は、利用しようとしているOSGiサービスのバンドルに対応するクラス名「ServiceB」をキーにして、サービスレジストリ131からServiceBオブジェクトへの参照を取得する。OSGiサービス実行部172(実際にはJavaVM12)は、取得したServiceBオブジェクトを、ホスト10が備えるメモリ上に確保する(参照なのでオブジェクト用のメモリは不要。参照を入れる変数用のメモリのみ要)。
 WebAPIバンドル17のOSGiサービス実行部172は、ServiceBオブジェクトが有するメソッド、例えば「func1」メソッドを実行する。HTTPサーバ部171は、その結果をクライアント20にHTTPレスポンス形式で返信する。
 図5で説明した例では、OSGiサービスを提供するOSGiバンドルのクラス名およびメソッド名が、WebAPIバンドル17にとって既知であることを前提とした。ただし、一般にはOSGiバンドルのクラス名およびメソッド名は必ずしも既知ではなく、Webシステム100の設計仕様などによって個別に異なる。また、図5のように実装すると、WebAPIバンドル17とOSGiバンドルB15の結びつきが強くなり、OSGiフレームワーク13がPlugin機構を提供することの利点が減じられてしまう。
 そこで以下では、OSGiサービスを提供するOSGiバンドルのクラス名およびメソッド名をWebAPIバンドル17の外部から与え、任意のクラス名およびメソッド名をサービスレジストリ131から呼び出すことができるように構成することを考える。
 図6は、クライアント20からWebAPIバンドル17に対して、クラス名とメソッド名を指定して実行結果を返信するよう要求するHTTPリクエストとそのレスポンスの対応関係を示す図である。1行目はServiceB132の「func1」メソッドを呼び出す場合の例、2行目はServiceB132の「func2」メソッドを呼び出す場合の例を示す。
 クライアント20は、WebAPIバンドル17にHTTPリクエストを発行する際に、リクエストパラメータとして、OSGiサービスを提供するクラス名、そのメソッド名、メソッドの引数を、リクエスト内に含めておく。引数が複数ある場合は、その分だけリクエストパラメータを設ける。
 WebAPIバンドル17のHTTPサーバ部171は、上記HTTPリクエストを受け取ると、リクエストパラメータ部分を切り出してOSGiサービス実行部172に引き渡す。
 OSGiサービス実行部172は、リクエストパラメータに記述されているクラス名をキーにして、サービスレジストリ131から同クラス名に該当するOSGiサービスを呼び出す。OSGiサービス実行部172は、リクエストパラメータに記述されているメソッド名に対応するメソッドを実行し、HTTPサーバ部171を介して、その結果をクライアント20に返信する。HTTPレスポンスはテキスト形式であるため、記述形式は任意でよい。図6では、リクエストパラメータと同様の形式を用いた例を示した。メソッドの戻り値が複数ある場合は、その旨をHTTPレスポンス内に併せて記述する。
 クライアント20が、サービスレジストリ131上に存在しないクラス名またはメソッド名をリクエストパラメータ内で指定した場合、またはクラスとメソッドは存在するが引数の型が合致しない場合、OSGiサービス実行部172およびHTTPサーバ部171は、例外を発行してその旨をクライアント20に返信する。
 OSGiサービス実行部172が、リクエストパラメータに記述されているクラス名を用いてOSGiサービスのクラスを取得するとき、図5の左上ソースコード例に示すように、サービスレジストリ131は、汎用クラス型であるObject型としてOSGiクラスを引き渡す。これは、任意のクラス型をサービスレジストリ131に登録できるようにするために必要な仕様であると思われる。
 ただし、Object型は汎用クラス型であるため、ごく基本的なメソッドしか備えておらず、ServiceBクラスが有する「func1」「func2」のようなメソッドは備えていない。そこでWebAPIバンドル17は、文字列変数が保持している文字列を用いて任意のメソッドを起動することのできる、java.lang.reflectパッケージの機能を利用する。
 同パッケージの機能を用いると、Objectクラス型をServiceBクラス型に変換することなく、Object型のままで任意のメソッドを起動することができる。このことは、任意クラスの任意メソッドを実行することができるメリットの他に、特定クラスへの依存性をなくすことができる点でも有利である。
 すなわち、通常であれば、WebAPIバンドル17は、ServiceB132のクラス名をクライアント20からリクエストパラメータとして与えられたとき、サービスレジストリ131から取得したObject型をいったんServiceB型に変換した上で、「func1」などのメソッドを実行する。Object型は同メソッドを有さないからである。しかしそのためには、WebAPIバンドル17内でServiceBクラスをあらかじめ取り込んでおかなければならず、その時点でWebAPIバンドル17の汎用性が減じられてしまう。
 これに対し上記手法によれば、リクエストパラメータで与えられたクラス型に変換する処理は発生しないので、同クラスを取り込む必要はなくなり、クラス型に対する中立性・汎用性を保つことができる。
 図7は、クライアント20からWebAPIバンドル17に対して、サービスレジストリ131に登録されているOSGiサービスの一覧を返信するよう要求するHTTPリクエストとそのレスポンスを例示する図である。クライアント20は、WebAPIバンドル17にHTTPリクエストを発行する際に、OSGiサービスの一覧を返信するよう要求する旨を、リクエストパラメータとしてリクエスト内に含めておく。図7に示す例ではパラメータ「getservicelist=true」がこれに相当する。
 WebAPIバンドル17のHTTPサーバ部171は、上記HTTPリクエストを受け取ると、リクエストパラメータ部分を切り出してOSGiサービス実行部172に引き渡す。
 OSGiサービス一覧取得部173は、サービスレジストリ131に登録されているOSGiサービスのクラス名一覧を取得する。さらに、java.lang.reflectパッケージの機能を利用して、各OSGiサービスのクラスが有するメソッド名、メソッド引数、メソッド戻り型などの情報を取得する。OSGiサービス一覧取得部173は、HTTPサーバ部171を介して、取得結果をクライアント20に返信する。
 OSGiサービス一覧取得部173の機能は、例えばクライアント20が利用したいサービスに対応するクラス名やメソッド名がサービスレジストリ131内に存在するか否かを確認するためなどに用いられる。
 図8は、WebAPIバンドル17の動作フローである。以下、図8の各ステップについて説明する。
(図8:ステップS801)
 WebAPIバンドル17が起動すると、HTTPサーバ部171はクライアント20からのHTTPリクエストを待機する。クライアント20からHTTPリクエストが到着すると、HTTPサーバ部171は、そのリクエストがOSGiサービスの一覧を取得するリクエストであるか、OSGiサービスを呼び出すリクエストであるかを判定する。前者であればステップS802へ進み、後者であればステップS803へ進む。
(図8:ステップS802)
 OSGiサービス一覧取得部173は、サービスレジストリ131に登録されているOSGiサービスのクラス名、メソッド名、メソッド引数、メソッド戻り型などの一覧を取得する。HTTPサーバ部171は、その取得結果をHTTPレスポンスとしてクライアント20に返信し、本動作フローを終了する。HTTPサーバ部171は、再びHTTPリクエストを待機する。
(図8:ステップS803)
 OSGiサービス実行部172は、クライアント20からのHTTPリクエストで指定されたクラス名、メソッド名などを用いて、サービスレジストリ131から該当するOSGiサービスを呼び出す。呼び出しに成功した場合はステップS804へ進み、失敗した場合はステップS805へ進む。
(図8:ステップS804)
 OSGiサービス実行部172は、ステップS803で呼び出したOSGiサービス(呼び出したクラス)のメソッドを実行する。実行に成功した場合はステップS806へ進み、失敗した場合はステップS805へ進む。
(図8:ステップS805)
 HTTPサーバ部171は、エラーが発生した旨のHTTPレスポンスを、クライアント20に返信する。HTTPサーバ部171は、再びHTTPリクエストを待機する。本ステップにおいて、HTTPレスポンスの内容部分にエラーが発生した旨を記述してもよいし、単純にHTTPが規定するエラーコードを返信してもよい。どのようなエラーが発生したのか明示する観点では、前者のほうが望ましい。
(図8:ステップS806)
 HTTPサーバ部171は、OSGiサービス実行部172がOSGiサービスを実行した結果をHTTPレスポンス内に記述し、クライアント20に返信する。HTTPサーバ部171は、再びHTTPリクエストを待機する。
<実施の形態1:まとめ>
 以上のように、本実施形態1に係るWebAPIバンドル17は、実行したいOSGiサービスのクラス名、メソッド名などを指定するHTTPリクエストを受け取り、当該メソッドを実行してその結果をHTTPレスポンスとして返信する。これにより、ネットワーク上で公開したいOSGiバンドルの持つOSGiサービスをサービスレジストリ131に登録しておけば、自動的にWebAPIとしてネットワークに公開することができるので、個別にHTTPサーバ機能などを実装する必要がなくなり、開発負担を低減することができる。
 また、本実施形態1に係るWebAPIバンドル17は、サービスレジストリ131からOSGiサービスを取得した後、汎用クラス型であるObject型をOSGiバンドルのクラス型に変換することなく、クライアント20が指定したメソッドをそのまま実行する。これにより、WebAPIバンドル17をOSGiバンドルのクラス型から切り離し、クラス間の依存関係をなくして汎用性を高めることができる。すなわち、WebAPIバンドル17は、サービスレジストリ131にどのようなOSGiサービスが登録されていても、そのクラス型をあらかじめ読み込んでおくことなく、指定されたクラスおよびメソッドを呼び出して実行することができる。
 また、本実施形態1に係るWebAPIバンドル17は、サービスレジストリ131に登録されているクラス名、メソッド名などの一覧をクライアント20に提供することができる。これにより、クライアント20はリクエストを発行する前にエラーが発生する可能性を事前に知ることができるので、メソッドを実行してエラーが返ってくるか否かにより当該メソッドの存否を調べるような非効率な処理をしなくてすむ。
<実施の形態2>
 実施形態1では、サービスレジストリ131に登録されているOSGiバンドルは無条件にネットワーク上へ公開される。しかし、OSGiフレームワーク13の機能を利用するためサービスレジストリ131に登録されているOSGiバンドルのなかには、ネットワークに公開したくないものも含まれている可能性がある。そこで本発明の実施形態2では、ネットワーク上に公開するOSGiバンドルとそうでないOSGiバンドルを区別するための手法を説明する。その他の構成は実施形態1と同様であるため、以下では差異点を中心に説明する。
 図9は、本実施形態2において、WebAPIバンドル17がOSGiサービスをWebAPIとして公開する様子を示す図である。本実施形態2では、OSGiバンドルのうちネットワーク上にWebAPIとして公開するものについては、メンバ変数153(フィールド)「openapi」を設けることとする。
 WebAPIバンドル17は、OSGiサービスを実行するようリクエストを受けたとき、またはサービスレジストリ131に登録されているOSGiサービスの一覧を取得するようリクエストを受けたとき、サービスレジストリ131から取得したOSGiバンドルクラスのメンバ変数「openapi」を取得する。同メンバ変数の値が「true」である場合は、当該クラスが有するメソッドをWebAPIとして公開してよいものと判断する。同メンバ変数の値が「true」でない場合、または同メンバ変数が存在しない場合は、当該クラスが有するメソッドをWebAPIとして公開しない。
 WebAPIバンドル17は、WebAPIとして公開しないクラスについてサービス実行リクエストを受けた場合は、エラーを返信する。また、WebAPIとして公開しないクラスについては、サービスレジストリ131に登録されているOSGiサービスの一覧をクライアント20に返信するとき、その一覧に当該クラスを記述しないこととする。
 WebAPIバンドル17がサービスレジストリ131からOSGiバンドルクラス(OSGiサービスクラス)を取得したとき、図5で説明したように、クラス型はObject型となっている。そこでWebAPIバンドル17は、java.lang.reflectパッケージの機能を利用して、メンバ変数「openapi」にアクセスする。この手法によれば、同メンバ変数がprivate指定されている(当該クラスの外部からアクセスすることを禁止する旨の宣言)場合でも、同メンバ変数にアクセスすることができる。
 なお、メンバ変数「openapi」をprivate宣言する場合、他のOSGiバンドルから同変数を参照することはできないので、他のOSGiバンドルにとっては同変数が存在しないに等しい。すなわち、本実施形態2に固有のメンバ変数を設けているか否かによらず、OSGiフレームワーク13にとっては全てのOSGiバンドルを同等に取り扱うことができるので、本実施形態2固有の格別の配慮を要さない点で便宜である。
<実施の形態2:まとめ>
 以上のように、本実施形態2に係るWebAPIバンドル17は、サービスレジストリ131に登録されているOSGiバンドルのメンバ変数「openapi」の値をチェックし、当該クラスをWebAPIとして公開してよいか否かを判定する。これにより、ネットワークに公開したいOSGiバンドルのみを選択的に公開することができるので、公開すべきでないOSGiバンドルを不用意にネットワークへ公開する可能性を低減することができる。
<実施の形態3>
 本発明の実施形態3では、クライアント20とWebAPIバンドル17の間のHTTPリクエストおよびHTTPレスポンスの形式について補足する。Webシステム100の構成は、実施形態1~2と同様である。
 図10は、WebAPIバンドル17を介してOSGiサービスを呼び出す際に指定することのできるHTTPリクエストパラメータとレスポンス例を示す図である。
 HTTPはテキストベースのプロトコルであるため、Javaオブジェクトをそのままリクエストおよびレスポンス内で用いることは難しい。したがって、クライアント20からのリクエスト上およびクライアント20へのレスポンス上で用いることができるのは、テキストベースで表現することのできる、Java基本型およびString(文字列)型に限られる。すなわち、独自のクラス型や、任意のクラス型を含む配列(例えばArrayList)などは用いることができない。
 また、Dictionary型(内部的に複数の値を格納している、配列に似たクラス型)はレスポンス内で用いることはできるが、リクエストパラメータとして用いることは好ましくない。これは、HTTPリクエストパラメータの記述形式に起因する。
 HTTPレスポンスは改行コードを含む任意のテキスト形式で記述することができるため、Javaメソッドの実行結果がDictionary型であり、そのなかに複数の値が含まれている場合でも、全ての値をレスポンス内に記述することができる。
 しかし、HTTPリクエストパラメータは「arg1=1」のように、パラメータ名とその値を1つずつペアにして記述するため、パラメータ値がDictionary型になっていて内部的に複数の値を含む場合、「arg1=(age=30&height=170)」のように多重的に記載せざるを得ず、煩雑になってしまう。また実際上、引数としてDictionary型を用いる必要性はあまりない。そこで図10では、リクエストパラメータとしてDictionary型を用いないこととした。
 図11は、レスポンスの記述形式としてXML(eXtensible Markup Language)を用いる例を示す図である。レスポンスの内容は、図6と同様である。このようなXML形式のレスポンスを、REST(Representational State Transfer)形式とも呼ぶ。レスポンスをXML形式に変換する処理は、OSGiサービスとの関連が少ない処理であるため、例えばHTTPサーバ部171が実施すればよい。
 レスポンスのほか、HTTPリクエストもXML形式で記述することもできる。例えばSOAP(Simple Object Access Protocol)形式のXMLメッセージをクライアント20からWebAPIバンドル17に発行し、HTTPサーバ部171がそのメッセージを解析して必要なパラメータのみをOSGiサービス実行部172に引き渡すようにすればよい。
<実施の形態4>
 以上の実施形態1~3では、WebAPIバンドル17はHTTPリクエストとしてOSGiサービスのクラス名などを直接受け取ることとしたが、必ずしもクラス名などそのものを記述したリクエストパラメータを用いなくともよい。
 例えば、WebAPIバンドル17は、クラス名やメソッド名を所定規則で変換した文字列をリクエストパラメータとして受け取り、WebAPIバンドル17の内部、または適当な変換モジュールなどを介して、OSGiサービスのクラス名、メソッド名などに変換してもよい。すなわち、WebAPIバンドル17は、少なくともOSGiサービスのクラス名、メソッド名などを特定することのできるリクエストパラメータを受け取れば足りる。
 10:ホスト、11:OS、12:JavaVM、13:OSGiフレームワーク、131:サービスレジストリ、132:ServiceB、14:OSGiバンドルA、15:OSGiバンドルB、151:機能B、152:WebAPIサーバ部、153:メンバ変数、17:WebAPIバンドル、171:HTTPサーバ部、172:OSGiサービス実行部、173:OSGiサービス一覧取得部、20:クライアント、100:Webシステム。

Claims (7)

  1.  OSGiフレームワーク仕様に対応したOSGiバンドルをWebAPI経由で公開する処理をコンピュータに実行させるプログラムであって、前記コンピュータに、
     前記OSGiフレームワーク上でOSGiバンドルまたはOSGiサービスとして登録されているクラスのクラス名と当該クラスが有するメソッド名を特定することができるパラメータを含むHTTPリクエストを受け付ける受信ステップと、
     前記OSGiフレームワーク上でOSGiバンドルまたはOSGiサービスとして登録されているクラスのうち前記クラス名に合致するものを、前記OSGiフレームワークが公開しているインターフェースを介して呼び出すサービス呼出ステップと、
     前記サービス呼出ステップで呼び出したクラスが有するメソッドのうち前記メソッド名に合致するものを実行するサービス実行ステップと、
     前記サービス実行ステップの結果を、前記HTTPリクエストの送信元にHTTPレスポンスの形式で返信する返信ステップと、
     を実行させることを特徴とするWebAPIサーバプログラム。
  2.  前記サービス呼出ステップでは、前記コンピュータに、
      前記OSGiフレームワーク上でOSGiバンドル(OSGiサービス)として登録されているクラスのうち前記クラス名に合致するものを、汎用クラス型として呼び出させ、
     前記サービス実行ステップでは、前記コンピュータに、
      前記サービス呼出ステップで呼び出したクラスが有するメソッドのうち前記メソッド名に合致するものを、前記汎用クラス型から前記クラス名に対応するクラス型に変換する処理を介さずに実行させる
     ことを特徴とする請求項1記載のWebAPIサーバプログラム。
  3.  前記OSGiバンドルは、
      当該OSGiバンドルを構成しているクラスが有するメソッドをWebAPI経由で公開してよいか否かを示すメンバ変数を有しており、
     前記WebAPIサーバプログラムは、前記コンピュータに、
      前記サービス呼出ステップで呼び出したクラスが有する前記メンバ変数の値をチェックすることにより、当該クラスが有するメソッドをWebAPI経由で公開してよいか否かを判定する公開判定ステップを実行させ、
      前記公開判定ステップにおいてWebAPI経由で公開してよいと判定したクラスが有するメソッドについてのみ前記サービス実行ステップおよび前記返信ステップを実行させる
     ことを特徴とする請求項1または2記載のWebAPIサーバプログラム。
  4.  前記コンピュータに、
      前記OSGiフレームワーク上でOSGiバンドルまたはOSGiサービスとして登録されているクラスのクラス名、当該クラスが有するメソッド名、当該メソッドの引数、および当該メソッドの戻り型の一覧を取得するサービス一覧取得ステップと、
      前記サービス一覧取得ステップの結果を、前記HTTPリクエストの送信元にHTTPレスポンスの形式で返信するステップと、
     を実行させることを特徴とする請求項1から3のいずれか1項記載のWebAPIサーバプログラム。
  5.  前記WebAPIサーバプログラムは、OSGiフレームワーク仕様に対応したOSGiバンドルとして実装されている
     ことを特徴とする請求項1から4のいずれか1項記載のWebAPIサーバプログラム。
  6.  前記受信ステップおよび前記返信ステップにおいて、前記コンピュータに、
      SOAP形式またはREST形式の通信データを用いて、前記HTTPリクエストの送信元との間で通信させる
     ことを特徴とする請求項1から5のいずれか1項記載のWebAPIサーバプログラム。
  7.  OSGiフレームワーク仕様に対応したOSGiバンドルの提供するOSGiサービスをWebAPI経由で公開する方法であって、
     前記OSGiフレームワーク上でOSGiバンドルまたはOSGiサービスとして登録されているクラスのクラス名と当該クラスが有するメソッド名を特定することができるパラメータを含むHTTPリクエストを受け付けるステップと、
     前記OSGiフレームワーク上でOSGiバンドルとして登録されているクラスのうち前記クラス名に合致するものを、前記OSGiフレームワークが公開しているインターフェースを介して呼び出すサービス呼出ステップと、
     前記サービス呼出ステップで呼び出したクラスが有するメソッドのうち前記メソッド名に合致するものを実行するサービス実行ステップと、
     前記サービス実行ステップの結果を、前記HTTPリクエストの送信元にHTTPレスポンスの形式で返信するステップと、
     を有することを特徴とするWebAPI公開方法。
PCT/JP2011/068112 2010-08-25 2011-08-09 WebAPIサーバプログラム、WebAPI公開方法 WO2012026320A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US13/635,150 US8701129B2 (en) 2010-08-25 2011-08-09 Web API server program, web API publication method
EP11819784.7A EP2538344A4 (en) 2010-08-25 2011-08-09 WEB API SERVER PROGRAM, WEB API RELEASE METHOD

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2010-188642 2010-08-25
JP2010188642A JP5318830B2 (ja) 2010-08-25 2010-08-25 WebAPIサーバプログラム、WebAPI公開方法

Publications (1)

Publication Number Publication Date
WO2012026320A1 true WO2012026320A1 (ja) 2012-03-01

Family

ID=45723325

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2011/068112 WO2012026320A1 (ja) 2010-08-25 2011-08-09 WebAPIサーバプログラム、WebAPI公開方法

Country Status (4)

Country Link
US (1) US8701129B2 (ja)
EP (1) EP2538344A4 (ja)
JP (1) JP5318830B2 (ja)
WO (1) WO2012026320A1 (ja)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102404149B (zh) * 2011-11-23 2014-06-11 华为技术有限公司 一种业务特性的管理系统和方法
JP2014010554A (ja) * 2012-06-28 2014-01-20 Kotobuki Solution Co Ltd ユーザ認証システム
US8990839B2 (en) 2013-04-22 2015-03-24 Microsoft Technology Licensing, Llc Controlling runtime access to application programming interfaces
CN103425495B (zh) * 2013-08-07 2016-08-31 华为软件技术有限公司 业务请求信息的处理方法及系统
JP6366373B2 (ja) * 2014-06-13 2018-08-01 キヤノン株式会社 情報処理装置とその制御方法、及びプログラム
US10021166B2 (en) 2015-09-10 2018-07-10 Ca, Inc. Mechanism for building normalized service model to expose web APIs
CN107592358A (zh) * 2017-09-19 2018-01-16 广州视源电子科技股份有限公司 基于http服务的应用程序接口调用方法和装置
CN108319827B (zh) * 2018-01-25 2020-06-02 烽火通信科技股份有限公司 一种基于osgi框架的api权限管理系统及方法
CN108600389A (zh) * 2018-05-10 2018-09-28 山东浪潮通软信息科技有限公司 一种基于公共接口平台的数据传输方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000076118A (ja) * 1998-09-03 2000-03-14 Fuji Xerox Co Ltd 分散ファイル処理装置および分散ファイル処理方法
JP2004151942A (ja) * 2002-10-30 2004-05-27 Ricoh Co Ltd ウェブサービス提供装置、ウェブサービス提供方法およびウェブサービス提供プログラム
JP2007109236A (ja) * 2005-10-12 2007-04-26 Samsung Electronics Co Ltd ウェブサービスを介してホームネットワーク機器のサービスをホームネットワーク外部に提供する方法及び装置
JP2008172462A (ja) * 2007-01-11 2008-07-24 Hitachi Ltd 機器管理装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7516331B2 (en) * 2003-11-26 2009-04-07 International Business Machines Corporation Tamper-resistant trusted java virtual machine and method of using the same
US8151281B2 (en) * 2004-01-09 2012-04-03 International Business Machines Corporation Method and system of mapping at least one web service to at least one OSGi service
US7818733B2 (en) * 2005-09-27 2010-10-19 International Business Machines Corporation Improving bundle control in computing environment
US8490120B2 (en) * 2007-09-12 2013-07-16 Oracle International Corporation System and method for the service configuration of application server environments
US8863074B2 (en) * 2010-01-27 2014-10-14 Oracle International Corporation Software modeling framework
CN102377796B (zh) * 2010-08-05 2015-06-10 中国人民解放军国防科学技术大学 基于OSGi的异构服务集成系统及方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000076118A (ja) * 1998-09-03 2000-03-14 Fuji Xerox Co Ltd 分散ファイル処理装置および分散ファイル処理方法
JP2004151942A (ja) * 2002-10-30 2004-05-27 Ricoh Co Ltd ウェブサービス提供装置、ウェブサービス提供方法およびウェブサービス提供プログラム
JP2007109236A (ja) * 2005-10-12 2007-04-26 Samsung Electronics Co Ltd ウェブサービスを介してホームネットワーク機器のサービスをホームネットワーク外部に提供する方法及び装置
JP2008172462A (ja) * 2007-01-11 2008-07-24 Hitachi Ltd 機器管理装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
KENTA UEDA ET AL.: "Proposal of Integrated Device Cooperation Method with REST Architecture", IPSJ SIG NOTES, vol. 2008, no. 116, 20 November 2008 (2008-11-20), pages 51 - 57, XP008170893 *

Also Published As

Publication number Publication date
US8701129B2 (en) 2014-04-15
EP2538344A4 (en) 2014-07-30
JP5318830B2 (ja) 2013-10-16
JP2012048391A (ja) 2012-03-08
US20130145381A1 (en) 2013-06-06
EP2538344A1 (en) 2012-12-26

Similar Documents

Publication Publication Date Title
JP5318830B2 (ja) WebAPIサーバプログラム、WebAPI公開方法
US10554734B2 (en) Runtime generation of application programming interfaces for remote procedure call services
Indrasiri et al. gRPC: up and running: building cloud native applications with Go and Java for Docker and Kubernetes
EP2798494B1 (en) Virtual channel for embedded process communication
US7703024B2 (en) Obtaining a graphical user interface to access a remote computing system
US11507351B2 (en) Intent compiler
US8874640B2 (en) Method and system for reducing service overhead in service oriented architectures
JP2010009520A (ja) フロー処理装置及びメッセージ変換方法
US9934029B2 (en) Annotation driven representational state transfer (REST) web services
US20160173648A1 (en) System and method for condition-based application logic shifting between a client and a server
US8626825B2 (en) Facilitating a service application to operate with different service frameworks in application servers
JP5811088B2 (ja) データ処理システム及びデータ処理方法
Pautasso et al. From web service composition to megaprogramming
KR20130068564A (ko) 웹 기반의 운영체제를 탑재한 단말 장치 및 이를 이용한 서비스 제공 방법
Malawski et al. Invocation of operations from script-based grid applications
Kiraly et al. Analysing RPC and testing the performance of solutions
KR20100089831A (ko) 관리 자바빈 객체들의 생성 및 관리
Haja et al. Location, proximity, affinity–the key factors in FaaS
Heil et al. DCM: dynamic client-server code migration
Hong et al. Meso: an object-oriented programming language for building strongly-typed internet-based network applications
JP2003076563A (ja) 分散オブジェクトミドルウェア連携方法及びプログラムを記録した記録媒体並びにプログラム
Christudas et al. Microservice Performance
Giretti Create a gRPC Client
Cheng et al. Service Interaction
Gottardi et al. Run-time Adaptable Service Oriented Architecture in the Context of Repository Systems

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: 11819784

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13635150

Country of ref document: US

WWE Wipo information: entry into national phase

Ref document number: 2011819784

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE