incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1124247 - in /incubator/deltacloud/trunk/server: lib/deltacloud/helpers.rb lib/deltacloud/helpers/json_helper.rb server.rb
Date Wed, 18 May 2011 13:11:05 GMT
Author: mfojtik
Date: Wed May 18 13:11:05 2011
New Revision: 1124247

URL: http://svn.apache.org/viewvc?rev=1124247&view=rev
Log:
Added features to API JSON entrypoints

Added:
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers/json_helper.rb
      - copied, changed from r1102877, incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb
Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb
    incubator/deltacloud/trunk/server/server.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb?rev=1124247&r1=1124246&r2=1124247&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb Wed May 18 13:11:05 2011
@@ -15,7 +15,8 @@
 # under the License.
 
 require 'deltacloud/helpers/application_helper'
+require 'deltacloud/helpers/json_helper'
 require 'deltacloud/helpers/conversion_helper'
 require 'deltacloud/helpers/hardware_profiles_helper'
 
-helpers ApplicationHelper, ConversionHelper, HardwareProfilesHelper
+helpers ApplicationHelper, ConversionHelper, HardwareProfilesHelper, JSONHelper

Copied: incubator/deltacloud/trunk/server/lib/deltacloud/helpers/json_helper.rb (from r1102877,
incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers/json_helper.rb?p2=incubator/deltacloud/trunk/server/lib/deltacloud/helpers/json_helper.rb&p1=incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb&r1=1102877&r2=1124247&rev=1124247&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/json_helper.rb Wed May 18 13:11:05
2011
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.  The
@@ -14,8 +13,11 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'deltacloud/helpers/application_helper'
-require 'deltacloud/helpers/conversion_helper'
-require 'deltacloud/helpers/hardware_profiles_helper'
+module JSONHelper
+
+  def json_features_for_entrypoint(entrypoint)
+    features = driver.features(entrypoint.first).collect { |feature| feature.name }
+    features.empty? ? {} : { :features => features }
+  end
 
-helpers ApplicationHelper, ConversionHelper, HardwareProfilesHelper
+end

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1124247&r1=1124246&r2=1124247&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Wed May 18 13:11:05 2011
@@ -77,7 +77,9 @@ get '/api\/?' do
       { :api => {
           :version => settings.version,
           :driver => driver_symbol,
-          :links => entry_points.collect { |l| { :rel => l[0], :href => l[1]} }
+          :links => entry_points.collect do |l| 
+            { :rel => l[0], :href => l[1] }.merge(json_features_for_entrypoint(l))
+          end
         }
       }.to_json
     end



Mime
View raw message