You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by neykov <gi...@git.apache.org> on 2015/07/21 16:29:17 UTC

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

GitHub user neykov opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/760

    Pluggable YAML parsers

    * Changes brooklyn-core not to depend on camp-base. Instead plugins (in this case offered by brooklyn-camp) are responsible for parsing the input and creating EntitySpecs from it. The idea is to use the approach for different types of inputs, not just camp yaml, while avoiding pulling in dependencies into core.
    * Extract all the code that uses PdpMatcher.parseDeploymentPlan + AssemblyTemplateSpecInstantiator.createSpec/instantiate pairs in a common place - a lot of code repetition
    
    Supersedes #100, #436, #545, #689.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neykov/incubator-brooklyn refactor-camp-dependencies-3

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/760.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #760
    
----
commit 2a7ec8f694ae61c05d6d0d2db6488f7177c33f0d
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2015-07-20T13:02:36Z

    Move all CAMP-related code to a single place - brooklyn-core
    
    EntityManagementUtils and CampCatalogUtils interface to the CAMP parser now.

commit af52c677e4b0bce1db3d4a9bc9d8aff419dcdcfe
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2015-07-20T13:36:32Z

    Move all CAMP-related code to a single place - brooklyn-rest-server
    
    Use existing utils methods wrapping CAMP calls - in EntityManagementUtils.

commit 1212bf228eae15c409f692ae44b2f728e7ce2bca
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2015-07-20T15:55:18Z

    Move all CAMP-related code to a single place - brooklyn-launcher
    
    Use existing utils methods wrapping CAMP calls - in EntityManagementUtils.

commit f97f9a374936c3fbd498ab4f708e4dacf0e26bff
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2015-07-21T10:17:42Z

    Deduplicate code

commit aedce9f7fccbafb1c317155ae5e024d92538f9d2
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2015-07-21T12:01:51Z

    Decrease API surface in CampCatalogUtils

commit 813bcc76b214930a7bd6f9dae8e34ecdfef22243
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2015-07-21T14:25:15Z

    Use plugins to parse yaml plans
    
    Move all CAMP related code to a CAMP implementation of the plugin.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35546650
  
    --- Diff: core/src/main/java/brooklyn/management/internal/EntityManagementUtils.java ---
    @@ -82,55 +79,36 @@
             return app;
         }
     
    -    /** convenience for accessing camp */
    -    public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) {
    -        return BrooklynServerConfig.getCampPlatform(mgmt);
    -    }
    -    
         /** as {@link #createApplication(ManagementContext, EntitySpec)} but for a YAML spec */
         public static <T extends Application> T createUnstarted(ManagementContext mgmt, String yaml) {
    -        AssemblyTemplate at = getCampPlatform(mgmt).get().pdp().registerDeploymentPlan( new StringReader(yaml) );
    -        return createUnstarted(mgmt, at);
    +        EntitySpec<T> spec = createEntitySpec(mgmt, yaml);
    +        return createUnstarted(mgmt, spec);
         }
         
    -    /** as {@link #createApplication(ManagementContext, EntitySpec)} but for an assembly template */
    -    @SuppressWarnings("unchecked")
    -    public static <T extends Application> T createUnstarted(ManagementContext mgmt, AssemblyTemplate at) {
    -        CampPlatform camp = getCampPlatform(mgmt).get();
    -        AssemblyTemplateInstantiator instantiator;
    -        try {
    -            instantiator = at.getInstantiator().newInstance();
    -        } catch (Exception e) {
    -            throw Exceptions.propagate(e);
    +    public static <T extends Application> EntitySpec<T> createEntitySpec(ManagementContext mgmt, String yaml) {
    +        Collection<String> types = new ArrayList<String>();
    +        for(PlanToSpecTransformer c : PlanToSpecFactory.all(mgmt)) {
    +            try {
    +                return c.createApplicationSpec(yaml);
    +            } catch (PlanNotRecognizedException e) {
    +                types.add(c.getName());
    +            }
             }
    -        Assembly assembly;
    -        if (instantiator instanceof AssemblyTemplateSpecInstantiator) {
    -            BrooklynClassLoadingContext loader = JavaBrooklynClassLoadingContext.create(mgmt);
    -            
    -            EntitySpec<?> spec = ((AssemblyTemplateSpecInstantiator) instantiator).createSpec(at, camp, loader, true);
    -            Entity app = mgmt.getEntityManager().createEntity(spec);
    -            Entities.startManagement((Application)app, mgmt);
    -            return (T) app;
    -        } else {
    -            // currently, all brooklyn plans should produce the above; currently this will always throw Unsupported  
    +        throw new PlanNotRecognizedException("Invalid plan, tried parsing with " + types);
    +    }
    +
    +    public static AbstractBrooklynObjectSpec<?, ?> createCatalogSpec(ManagementContext mgmt, CatalogItem<?, ?> item) {
    +        Collection<String> types = new ArrayList<String>();
    +        for(PlanToSpecTransformer c : PlanToSpecFactory.all(mgmt)) {
    --- End diff --
    
    [minor] add trailing space after for


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#issuecomment-123397939
  
    Build failing three times in a row for unrelated reasons. Looks like something is against this PR. Building locally works just fine. 
    Looks like the `CassandraDatacenterTest` needs some attention, not the first time I see it fail:
    
    ```
    testPopulatesInitialSeeds(brooklyn.entity.nosql.cassandra.CassandraDatacenterTest)  Time elapsed: 30.638 sec  <<< FAILURE!
    java.lang.AssertionError: entity=CassandraDatacenterImpl{id=pEek7z14}; attribute=Sensor: cassandra.cluster.seeds.current (java.util.Set) expected [[EmptySoftwareProcessImpl{id=NUNhqLRb}, EmptySoftwareProcessImpl{id=yjHnpC8w}]] but found [[]]
    	at org.testng.Assert.fail(Assert.java:94)
    	at org.testng.Assert.failNotEquals(Assert.java:494)
    	at org.testng.Assert.assertEquals(Assert.java:123)
    	at brooklyn.test.EntityTestUtils.assertAttributeEquals(EntityTestUtils.java:57)
    	at brooklyn.test.EntityTestUtils$1.run(EntityTestUtils.java:72)
    	at brooklyn.test.Asserts$RunnableAdapter.call(Asserts.java:472)
    	at brooklyn.test.Asserts.succeedsEventually(Asserts.java:264)
    	at brooklyn.test.Asserts.succeedsEventually(Asserts.java:189)
    	at brooklyn.test.EntityTestUtils.assertAttributeEqualsEventually(EntityTestUtils.java:70)
    	at brooklyn.test.EntityTestUtils.assertAttributeEqualsEventually(EntityTestUtils.java:65)
    	at brooklyn.entity.nosql.cassandra.CassandraDatacenterTest.testPopulatesInitialSeeds(CassandraDatacenterTest.java:80)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35548167
  
    --- Diff: usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/CampToSpecTransformer.java ---
    @@ -0,0 +1,86 @@
    +/*
    + * 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 ASF licenses this file
    + * to you 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 io.brooklyn.camp.brooklyn.spi.creation;
    +
    +import java.io.StringReader;
    +
    +import brooklyn.basic.AbstractBrooklynObjectSpec;
    +import brooklyn.catalog.CatalogItem;
    +import brooklyn.entity.Application;
    +import brooklyn.entity.proxying.EntitySpec;
    +import brooklyn.management.ManagementContext;
    +import brooklyn.management.classloading.BrooklynClassLoadingContext;
    +import brooklyn.management.classloading.JavaBrooklynClassLoadingContext;
    +import brooklyn.plan.PlanToSpecTransformer;
    +import brooklyn.util.exceptions.Exceptions;
    +import io.brooklyn.camp.CampPlatform;
    +import io.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
    +import io.brooklyn.camp.spi.AssemblyTemplate;
    +import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
    +
    +public class CampToSpecTransformer implements PlanToSpecTransformer {
    +
    +    public static final String YAML_CAMP_PLAN_TYPE = "brooklyn.camp/yaml";
    +
    +    private ManagementContext mgmt;
    +
    +    public String getName() {
    +        return YAML_CAMP_PLAN_TYPE;
    +    }
    +
    +    public boolean accepts(String mime) {
    +        return YAML_CAMP_PLAN_TYPE.equals(mime);
    +    }
    +
    +    public <T extends Application> EntitySpec<T> createApplicationSpec(String plan) {
    +      CampPlatform camp = CampCatalogUtils.getCampPlatform(mgmt);
    +      AssemblyTemplate at = camp.pdp().registerDeploymentPlan( new StringReader(plan) );
    +      AssemblyTemplateInstantiator instantiator;
    +      try {
    +          instantiator = at.getInstantiator().newInstance();
    +      } catch (Exception e) {
    +          throw Exceptions.propagate(e);
    +      }
    +      if (instantiator instanceof AssemblyTemplateSpecInstantiator) {
    +          BrooklynClassLoadingContext loader = JavaBrooklynClassLoadingContext.create(mgmt);
    +          @SuppressWarnings("unchecked")
    +          EntitySpec<T> createSpec = (EntitySpec<T>) ((AssemblyTemplateSpecInstantiator) instantiator).createSpec(at, camp, loader, true);
    +          return createSpec;
    +      } else {
    +          // The unknown instantiator can create the app (Assembly), but not a spec.
    +          // Currently, all brooklyn plans should produce the above.
    +          if (at.getPlatformComponentTemplates()==null || at.getPlatformComponentTemplates().isEmpty()) {
    +              if (at.getCustomAttributes().containsKey("brooklyn.catalog"))
    +                  throw new IllegalArgumentException("Unrecognized application blueprint format: expected an application, not a brooklyn.catalog");
    +              throw new IllegalArgumentException("Unrecognized application blueprint format: no services defined");
    +          }
    +          // map this (expected) error to a nicer message
    +          throw new IllegalArgumentException("Unrecognized application blueprint format");
    +      }
    +    }
    +
    +    public AbstractBrooklynObjectSpec<?, ?> createCatalogSpec(CatalogItem<?, ?> item) {
    +        return CampCatalogUtils.createSpec(mgmt, item);
    +    }
    +
    +    public void injectManagementContext(ManagementContext mgmt) {
    +        this.mgmt = mgmt;
    +    }
    +
    +}
    --- End diff --
    
    [minor] add blank line?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35763502
  
    --- Diff: core/src/main/java/brooklyn/config/BrooklynServerConfig.java ---
    @@ -171,15 +167,6 @@ public static File getBrooklynWebTmpDir(ManagementContext mgmt) {
         }
     
         /**
    -     * @return the CAMP platform associated with a management context, if there is one.
    -     */
    -    public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) {
    --- End diff --
    
    All usages (together with the accessor) are moved to the `brooklyn-camp` project.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#issuecomment-125229670
  
    Fixed merge conflicts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#issuecomment-125968344
  
    Addressed comments, thanks @andreaturli .


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35763585
  
    --- Diff: core/src/main/java/brooklyn/management/internal/EntityManagementUtils.java ---
    @@ -82,55 +79,36 @@
             return app;
         }
     
    -    /** convenience for accessing camp */
    -    public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) {
    -        return BrooklynServerConfig.getCampPlatform(mgmt);
    -    }
    -    
         /** as {@link #createApplication(ManagementContext, EntitySpec)} but for a YAML spec */
    --- End diff --
    
    Good spot, it refers to the overloading `createUnstarted` method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#issuecomment-125244231
  
    I think it is a great PR, @neykov! Thanks for that. Lot of cleanings and nice refactoring!
    
    I've some minor comments only, but as it is quite important PR I'd like to ask for the opinion of @ahgittin and/or @aledsage before merging it.
    
    Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#issuecomment-125155438
  
    @neykov `mvn clean install` works fine for me. I'd like to manually test it a bit more before merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35548005
  
    --- Diff: core/src/main/java/brooklyn/plan/PlanToSpecFactory.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * 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 ASF licenses this file
    + * to you 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 brooklyn.plan;
    +
    +import java.util.Collection;
    +import java.util.ServiceLoader;
    +
    +import com.google.common.collect.Lists;
    +
    +import brooklyn.management.ManagementContext;
    +
    +public class PlanToSpecFactory {
    +    public static PlanToSpecTransformer forMime(ManagementContext mgmt, String mime) {
    +        ServiceLoader<PlanToSpecTransformer> loader = ServiceLoader.load(PlanToSpecTransformer.class);
    +        for (PlanToSpecTransformer transformer : loader) {
    +            transformer.injectManagementContext(mgmt);
    +            if (transformer.accepts(mime)) {
    +                return transformer;
    +            }
    +        }
    +        return null;
    --- End diff --
    
    [minor] wouldn't be better to throw a RuntimeException rather than null. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35763873
  
    --- Diff: core/src/main/java/brooklyn/plan/PlanToSpecFactory.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * 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 ASF licenses this file
    + * to you 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 brooklyn.plan;
    +
    +import java.util.Collection;
    +import java.util.ServiceLoader;
    +
    +import com.google.common.collect.Lists;
    +
    +import brooklyn.management.ManagementContext;
    +
    +public class PlanToSpecFactory {
    +    public static PlanToSpecTransformer forMime(ManagementContext mgmt, String mime) {
    +        ServiceLoader<PlanToSpecTransformer> loader = ServiceLoader.load(PlanToSpecTransformer.class);
    +        for (PlanToSpecTransformer transformer : loader) {
    +            transformer.injectManagementContext(mgmt);
    +            if (transformer.accepts(mime)) {
    +                return transformer;
    +            }
    +        }
    +        return null;
    --- End diff --
    
    I was wondering if I should add this method at all, currently not used. Makes sense to throw if a specific implementation is not found, will change it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35547057
  
    --- Diff: core/src/main/java/brooklyn/management/internal/EntityManagementUtils.java ---
    @@ -82,55 +79,36 @@
             return app;
         }
     
    -    /** convenience for accessing camp */
    -    public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) {
    -        return BrooklynServerConfig.getCampPlatform(mgmt);
    -    }
    -    
         /** as {@link #createApplication(ManagementContext, EntitySpec)} but for a YAML spec */
    --- End diff --
    
    should it be `{@link #createEntitySpec(ManagementContext, EntitySpec)}` ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35546633
  
    --- Diff: core/src/main/java/brooklyn/management/internal/EntityManagementUtils.java ---
    @@ -82,55 +79,36 @@
             return app;
         }
     
    -    /** convenience for accessing camp */
    -    public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) {
    -        return BrooklynServerConfig.getCampPlatform(mgmt);
    -    }
    -    
         /** as {@link #createApplication(ManagementContext, EntitySpec)} but for a YAML spec */
         public static <T extends Application> T createUnstarted(ManagementContext mgmt, String yaml) {
    -        AssemblyTemplate at = getCampPlatform(mgmt).get().pdp().registerDeploymentPlan( new StringReader(yaml) );
    -        return createUnstarted(mgmt, at);
    +        EntitySpec<T> spec = createEntitySpec(mgmt, yaml);
    +        return createUnstarted(mgmt, spec);
         }
         
    -    /** as {@link #createApplication(ManagementContext, EntitySpec)} but for an assembly template */
    -    @SuppressWarnings("unchecked")
    -    public static <T extends Application> T createUnstarted(ManagementContext mgmt, AssemblyTemplate at) {
    -        CampPlatform camp = getCampPlatform(mgmt).get();
    -        AssemblyTemplateInstantiator instantiator;
    -        try {
    -            instantiator = at.getInstantiator().newInstance();
    -        } catch (Exception e) {
    -            throw Exceptions.propagate(e);
    +    public static <T extends Application> EntitySpec<T> createEntitySpec(ManagementContext mgmt, String yaml) {
    +        Collection<String> types = new ArrayList<String>();
    +        for(PlanToSpecTransformer c : PlanToSpecFactory.all(mgmt)) {
    --- End diff --
    
    [minor] add trailing space after for


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#issuecomment-127526513
  
    lgtm @neykov +1
    
    feel free to merge it


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35763421
  
    --- Diff: core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java ---
    @@ -322,45 +309,19 @@ public void load() {
             }
         }
     
    -    @SuppressWarnings("unchecked")
    -    @Override
         public <T, SpecT> SpecT createSpec(CatalogItem<T, SpecT> item) {
    --- End diff --
    
    This is public API so I'd be way of changing it, plus `catalog` is already implicit because it's a method on the catalog interface.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35546170
  
    --- Diff: core/src/main/java/brooklyn/catalog/internal/BasicBrooklynCatalog.java ---
    @@ -322,45 +309,19 @@ public void load() {
             }
         }
     
    -    @SuppressWarnings("unchecked")
    -    @Override
         public <T, SpecT> SpecT createSpec(CatalogItem<T, SpecT> item) {
    --- End diff --
    
    shall we rename this `createCatalogSpec`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/760


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Pluggable YAML parsers

Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/760#discussion_r35546491
  
    --- Diff: core/src/main/java/brooklyn/config/BrooklynServerConfig.java ---
    @@ -171,15 +167,6 @@ public static File getBrooklynWebTmpDir(ManagementContext mgmt) {
         }
     
         /**
    -     * @return the CAMP platform associated with a management context, if there is one.
    -     */
    -    public static Maybe<CampPlatform> getCampPlatform(ManagementContext mgmt) {
    --- End diff --
    
    was that unused previously?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---