// Path: brooklyn-tosca-common/src/main/java/io/cloudsoft/tosca/metadata/BrooklynToscaTypeProvider.java
// public class BrooklynToscaTypeProvider implements ToscaTypeProvider, RequiresBrooklynApi {
// 
//     private static final Logger LOG = LoggerFactory.getLogger(BrooklynToscaTypeProvider.class);
// 
//     private Map<String, String> typeMapping = ImmutableMap.<String, String>builder()
//             .put("org.apache.brooklyn.entity.proxy.LoadBalancer", "brooklyn.nodes.LoadBalancer")
//             .put("org.apache.brooklyn.entity.database.DatabaseNode", "brooklyn.nodes.Database")
//             .put("org.apache.brooklyn.entity.database.mysql.MySqlNode", "brooklyn.nodes.Database")
//             .put("org.apache.brooklyn.entity.webapp.WebAppService", "brooklyn.nodes.WebServer")
//             .build();
// 
//     private BrooklynApi brooklynApi;
// 
//     public void setTypeMapping(Map<String, String> typeMapping) {
//         this.typeMapping = typeMapping;
//     }
// 
//     @Override
//     public void setBrooklynApi(BrooklynApi brooklynApi) {
//         this.brooklynApi = brooklynApi;
//     }
// 
//     @Override
//     public Optional<String> getToscaType(String type, String version) {
//         try {
//             CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version);
//             Collection<Object> tags = Objects.firstNonNull(catalogEntitySummary.getTags(), ImmutableList.of());
//             for (Object o : tags) {
//                 Map<String, ?> map = (Map<String, ?>) o;
//                 if (map.containsKey("traits")) {
//                     Collection<String> traits = ImmutableSet.copyOf((Collection<String>) map.get("traits"));
//                     for (String key : typeMapping.keySet()) {
//                         if (traits.contains(key)) {
//                             return Optional.of(typeMapping.get(key));
//                         }
//                     }
//                 }
//             }
//         } catch (Exception e) {
//             LOG.info("Error getting entity {}: {}", type, e);
//         }
//         return Optional.fromNullable(typeMapping.get(type));
//     }
// 
// }


import java.util.List;
import java.util.Map;
import io.cloudsoft.tosca.metadata.BrooklynToscaTypeProvider;
import io.cloudsoft.tosca.metadata.DefaultToscaTypeProvider;
import lombok.extern.slf4j.Slf4j;
import org.apache.brooklyn.util.collections.MutableList;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import alien4cloud.model.components.PropertyDefinition;
import alien4cloud.model.orchestrators.ArtifactSupport;
import alien4cloud.model.orchestrators.locations.LocationSupport;
import alien4cloud.orchestrators.plugin.IOrchestratorPluginFactory;
package alien4cloud.brooklyn;





@Slf4j
@Component("brooklyn-orchestrator-factory")
public class BrooklynOrchestratorFactory implements IOrchestratorPluginFactory<BrooklynOrchestrator, Configuration> {

    public static final String BROOKLYN = "Brooklyn";

    @Autowired
    private BeanFactory beanFactory;

    @Override
    public BrooklynOrchestrator newInstance() {
        BrooklynOrchestrator instance = beanFactory.getBean(BrooklynOrchestrator.class);
        log.info("Init brooklyn provider and beanFactory is {}", beanFactory);
        return instance;
    }

// Path: brooklyn-tosca-common/src/main/java/io/cloudsoft/tosca/metadata/BrooklynToscaTypeProvider.java
// public class BrooklynToscaTypeProvider implements ToscaTypeProvider, RequiresBrooklynApi {
// 
//     private static final Logger LOG = LoggerFactory.getLogger(BrooklynToscaTypeProvider.class);
// 
//     private Map<String, String> typeMapping = ImmutableMap.<String, String>builder()
//             .put("org.apache.brooklyn.entity.proxy.LoadBalancer", "brooklyn.nodes.LoadBalancer")
//             .put("org.apache.brooklyn.entity.database.DatabaseNode", "brooklyn.nodes.Database")
//             .put("org.apache.brooklyn.entity.database.mysql.MySqlNode", "brooklyn.nodes.Database")
//             .put("org.apache.brooklyn.entity.webapp.WebAppService", "brooklyn.nodes.WebServer")
//             .build();
// 
//     private BrooklynApi brooklynApi;
// 
//     public void setTypeMapping(Map<String, String> typeMapping) {
//         this.typeMapping = typeMapping;
//     }
// 
//     @Override
//     public void setBrooklynApi(BrooklynApi brooklynApi) {
//         this.brooklynApi = brooklynApi;
//     }
// 
//     @Override
//     public Optional<String> getToscaType(String type, String version) {
//         try {
//             CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version);
//             Collection<Object> tags = Objects.firstNonNull(catalogEntitySummary.getTags(), ImmutableList.of());
//             for (Object o : tags) {
//                 Map<String, ?> map = (Map<String, ?>) o;
//                 if (map.containsKey("traits")) {
//                     Collection<String> traits = ImmutableSet.copyOf((Collection<String>) map.get("traits"));
//                     for (String key : typeMapping.keySet()) {
//                         if (traits.contains(key)) {
//                             return Optional.of(typeMapping.get(key));
//                         }
//                     }
//                 }
//             }
//         } catch (Exception e) {
//             LOG.info("Error getting entity {}: {}", type, e);
//         }
//         return Optional.fromNullable(typeMapping.get(type));
//     }
// 
// }


// Path: a4c-brooklyn-plugin/src/main/java/alien4cloud/brooklyn/BrooklynOrchestratorFactory.java
import java.util.List;
import java.util.Map;
import io.cloudsoft.tosca.metadata.BrooklynToscaTypeProvider;
import io.cloudsoft.tosca.metadata.DefaultToscaTypeProvider;
import lombok.extern.slf4j.Slf4j;
import org.apache.brooklyn.util.collections.MutableList;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import alien4cloud.model.components.PropertyDefinition;
import alien4cloud.model.orchestrators.ArtifactSupport;
import alien4cloud.model.orchestrators.locations.LocationSupport;
import alien4cloud.orchestrators.plugin.IOrchestratorPluginFactory;

package alien4cloud.brooklyn;





@Slf4j
@Component("brooklyn-orchestrator-factory")
public class BrooklynOrchestratorFactory implements IOrchestratorPluginFactory<BrooklynOrchestrator, Configuration> {

    public static final String BROOKLYN = "Brooklyn";

    @Autowired
    private BeanFactory beanFactory;

    @Override
    public BrooklynOrchestrator newInstance() {
        BrooklynOrchestrator instance = beanFactory.getBean(BrooklynOrchestrator.class);
        log.info("Init brooklyn provider and beanFactory is {}", beanFactory);
        return instance;
    }

    @Override