33 Commits

Author SHA1 Message Date
Rohit Yadav
1b9e5c3006 ApiDiscovery: Discovery apis provided by PluggableServices as well
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-06 16:54:46 +05:30
Kelven Yang
1b2b369ecb Merge latest master into javelin 2013-01-31 11:34:49 -08:00
Min Chen
85de14f6a4 Increase sleep time to allow token expire to account for windows
environment clock issue.
2013-01-29 11:19:09 -08:00
Min Chen
1c20c80cb5 Fix unit test failure only on Windows environment. 2013-01-29 11:09:06 -08:00
Rohit Yadav
356866c72b Merge branch 'master' into javelin
- Fixed new join dao impls as spring components
- Fixed component context xml to load api rate limit checker
- Fixed root pom.xml for duplicate plugin
- Fixed list data centers method
- Fixed following conflicts:
	api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
	api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
	api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
	api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
	plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
	server/src/com/cloud/api/ApiDBUtils.java
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/api/query/QueryManagerImpl.java
	server/src/com/cloud/configuration/DefaultComponentLibrary.java
	server/src/com/cloud/server/ManagementServerImpl.java
	server/src/com/cloud/storage/swift/SwiftManagerImpl.java

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-24 19:18:53 -08:00
Rohit Yadav
34f3e1c9a1 ApiDiscoveryServiceImpl: Fix fields variable definition from array to set
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-23 14:57:41 -08:00
Rohit Yadav
6482e27081 ApiDiscovery: Add mockito, unit test for ApiDiscovery service impl
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-22 14:28:31 -08:00
Rohit Yadav
26d8113f99 plugins: Indentation fix for pom.xml, add build/test rules for api discovery
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-22 14:28:31 -08:00
Rohit Yadav
179db40e3a ApiDiscovery: Fix response and service impl to make them test-able 2013-01-22 14:28:30 -08:00
Alex Huang
10d9c019a9 All merge conflicts resolved 2013-01-18 12:14:57 -08:00
Min Chen
805261a93f Change a debug message to TRACE level. 2013-01-17 15:16:50 -08:00
Min Chen
86ada92ffa Fix some bugs and add java integration test for api rate limit plugin. 2013-01-17 15:13:51 -08:00
Min Chen
3dabd5fbf3 Clean up ApiServer, ApiServlet and ApiDispatcher flow to handle various CloudRuntimeException
and CloudException in one place, and Introduced ApiErrorCode to handle CloudStack API error
code to standard Http code mapping.

Signed-off-by: Min Chen <min.chen@citrix.com>
2013-01-16 22:36:34 -08:00
Min Chen
06fa338d42 Add some tests for api rate limit plugin. 2013-01-16 21:56:25 -08:00
Min Chen
bdcfa1919b Clean up ApiServer, ApiServlet and ApiDispatcher in handling various
exceptions, and Introduced ApiErrorCode to handle CloudStack API error
code to standard Http code mapping.
2013-01-16 21:52:48 -08:00
Kelven Yang
497dcd5044 Get rid of PlugService annotation, replace it with Spring standard injection in command classes 2013-01-16 18:44:44 -08:00
Min Chen
97cb16944f Merge branch 'master' into api_limit 2013-01-15 18:18:34 -08:00
Rohit Yadav
f6a8b45de5 ApiDiscovery: Use UserContext getCallerUser, do a lazy eval to get account service
Impl. and use UserContext to get User.
CloudStack's @Inject is horrible, it may sometimes fail to inject account service
during startup. Do a lazy injection using ComponentLocator when needed.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-15 16:11:51 -08:00
Min Chen
4355d06a86 Reuse APIChecker adapter interface for APi Rate limit checking and optimize ApiRateLimitService interface.
Signed-off-by: Min Chen <min.chen@citrix.com>
2013-01-15 15:53:19 -08:00
Rohit Yadav
c318561d6c ApiDiscovery: Get rid of redundant code, use apichecker to generate role based maps
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-14 19:01:26 -08:00
Min Chen
4d0c850dc8 Fix plugin component configuration. 2013-01-14 17:13:18 -08:00
Rohit Yadav
38eaa04b98 Pull changes from master into javelin
- Disables simulator plugin, breaks build, available via simulator profile
- Fixes spring injections
- Fix api,acl plugins, ApiServer, ApiDispatcher
- Fix other merge conflicts

Conflicts:
	docs/en-US/external-firewalls-and-load-balancers.xml
	plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
	server/src/com/cloud/api/ApiDispatcher.java
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
	utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-12 06:02:54 -08:00
Min Chen
57e67c57d7 Merge branch 'master' into api_limit
Conflicts:
	server/src/com/cloud/api/ApiServer.java

Signed-off-by: Min Chen <min.chen@citrix.com>
2013-01-11 15:50:21 -08:00
Rohit Yadav
86a77e29dc ApiDiscovery: Fix listApis to return api response, related apis etc.
- Fix method to return listApis per api name basis
- Return api response, api related cmd etc. as part of response
- Caching and processing all cmd, response classes when plugin starts, made class
  list, maps static so they are shared by multiple instances in case, takes about
  1306ms to do the processsing but only on load time
- Cache for first listApi() and return precached data thereon, takes 2.2ms
  for first call, during runtime and 0ms thereon

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 22:52:10 -08:00
Rohit Yadav
f170075558 ApiDiscovery: Fix response add response class that will hold api response
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 22:48:56 -08:00
Rohit Yadav
3df026bd51 ApiDiscoveryServiceImpl: Implement listApis to return response based on role
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 18:51:38 -08:00
Min Chen
d900345a20 Ehcache implementation of APi Rate limit plugin. 2013-01-10 17:47:48 -08:00
Rohit Yadav
0b1c2a5981 ApiDiscovery: Fix listApis interface, fix getProperties
In case of api discovery, it does not make sense to create a separate properties file
If this plugin is enabled in components.xml, a user should be able to discover
all the apis accessible to their role.

listApis based on role type of caller user

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 15:55:02 -08:00
Rohit Yadav
c6d9877d64 ApiDiscoveryService: Move refactor, interface should be in plugins and not in cloud-api
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 10:59:38 -08:00
Rohit Yadav
d13cc7e7e4 ApiDiscoveryService: Use only as pluggable service
Remove usage and impl as adapter.
We have duplicate code that generates apiname:cmd class maps which is
unavoidable right now as:

- Plugin should not depend on ApiServer or any other component
- cloud-utils cannot depend on cloud-api for the APICommand annotation
- Use java reflect to create a static method in cloud-utils that does the job
  would be unsafe.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-09 17:25:29 -08:00
Rohit Yadav
2eee2cd999 plugins: Fix getPropertiesFiles() for pluggable service plugins, CiscoNexusVSMEElement
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-09 04:56:32 -08:00
Rohit Yadav
d613c59dcb plugins: Fix apidiscovery's annotation field values and example plugin's name
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-08 20:00:13 -08:00
Rohit Yadav
2c04dad529 ApiDiscovery: New plugin to help discover apis on mgmt server
- Introduces api/discovery plugin that helps discover apis on the mgmt server
- It's a pluggable service, therefore has it's own api-discovery_commands.properties
  where the discovery api, listApi can be blacklisted (by removing it), or it's
  role mask can be changed
- By default its response has all the apis
- Changes in other parts of the code to make it work, viz. components.xml, pom.xml,
  and in ApiServer where it is used as an adapter to get apiname, cmd mappings

The ApiDiscoveryService interface is a contract that the implementing class will
provide:

1. A means to get all the apis as a list of response, plugin is free to implement
   the response class, as long as it extends on the BaseResponse:

    ListResponse<? extends BaseResponse> listApis();

2. Provides a map of apiname as the key and cmd class as the value:

    Map<String, Class<?>> getApiNameCmdClassMapping();

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-08 18:54:29 -08:00