/*
 * Copyright 2012 Canoo Engineering AG.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.canoo.dolphin.demo;

import com.canoo.dolphin.core.comm.InitializeAttributeCommand;
import com.canoo.dolphin.core.comm.NamedCommand;
import com.canoo.dolphin.core.server.action.ServerAction;
import com.canoo.dolphin.core.server.comm.ActionRegistry;
import groovy.lang.Closure;

import java.util.List;

public class JavaAction implements ServerAction {
    public void registerIn(ActionRegistry registry) {

        registry.register("javaAction", new Closure(this) {
            public Object call(NamedCommand cmd, List response) {

                InitializeAttributeCommand initializeAttributeCommand = new InitializeAttributeCommand();
                initializeAttributeCommand.setPmId("JAVA");
                initializeAttributeCommand.setPropertyName("purpose");
                initializeAttributeCommand.setNewValue("works without JavaFX");

                response.add(initializeAttributeCommand);
                return response;
            }
        });
    }
}

@@ -667,35 +667,16 @@
 re.comm.
-InitializeAttribute
 Command;
@@ -711,21 +711,35 @@
 re.comm.
-Named
+InitializeAttribute
 Command;
@@ -866,27 +866,57 @@
 ort 
-groovy.lang.Closure
+com.canoo.dolphin.core.server.comm.CommandHandler
 ;%0A%0Ai
@@ -1092,59 +1092,95 @@
 ew C
-losure(this) %7B%0A            public Object call(Named
+ommandHandler%3CCommand%3E() %7B%0A            @Override%0A            public void handleCommand(
 Comm
@@ -1188,16 +1188,29 @@
 nd c
-m
+omman
 d, List
+%3CCommand%3E
  res
@@ -1214,25 +1214,24 @@
 response) %7B%0A
-%0A
             
@@ -1536,16 +1536,16 @@
 aFX%22);%0A%0A
+
         
@@ -1598,41 +1598,8 @@
 d);%0A
-                return response;%0A
     

update JavaAction to use CommandHandler instead of Closure. Thanks to Kai Toedter for posting.