> On April 1, 2015, 3:04 p.m., Nate Cole wrote: > > ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java, > > line 837 > > <https://reviews.apache.org/r/32710/diff/1/?file=911912#file911912line837> > > > > getCluster(String) gets a cluster by name not by id. In fact, you > > define cluster_id as a string, should you instead be using a long id? In > > the case of "remote clusters" it's possible to have duplicate the name in > > that case? ("c1" for dev, "c1" for staging, "c1" for prod?) I guess that's > > true for the id as well.
Thanks for reviewing! The reason that I used id and not name is that in the near future we want to support view association with a remote cluster. So in the case of the local cluster, the id is the local name (which needs to be unique). For a remote cluster I was thinking about using the same field for the remote cluster endpoint. The code in the ViewRegistry would be smart enough to tell the difference and pull the cluster information either directly (local) or through the REST APIs (remote). So, from the end user point of view they just deal with a single field for view / cluster association whether its local or remote. I'll use cluster_handle like you suggested. Thanks. - Tom ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/32710/#review78523 ----------------------------------------------------------- On April 1, 2015, 2:22 a.m., Tom Beerbower wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/32710/ > ----------------------------------------------------------- > > (Updated April 1, 2015, 2:22 a.m.) > > > Review request for Ambari, Jonathan Hurley and Nate Cole. > > > Bugs: AMBARI-10306 > https://issues.apache.org/jira/browse/AMBARI-10306 > > > Repository: ambari > > > Description > ------- > > Ability for a view instance to be associated to a cluster for configuration > (so the view can have access to cluster config information via view context). > This enables the view instance to be configured w/o the admin having to > wire-up properties. Whether the view is auto instantiated or instantiated > manually, the Ambari Admin should have an option to relate an instance of a > cluster to the view instance. This make the cluster config information > available to the view so the view can "auto-configure". Therefore, in > addition to today's manual configure option, need to add options for picking > a cluster in same ambari, or picking remote ambari server to > "auto-configure". Based on the configuration option the user chooses, the > way the user gets configuration changes. If the user chooses today mode of > config, they can use the same ViewContext.getProperties() as they do today. > If they choose a local cluster, they need a way to get access to all cluster > configurations. For remote cluster, ma ybe we just provide convenient method way to get rest endpoint to the cluster resource to limit scope? In any of the three cases, the view developer needs to know how he is to get his configurations (custom, local or remote), and have a way to get access via ViewContext. Also, need ability to flag properties as cluster "configuration" or "setting" so the UI can organize properties that can be derived from cluster configuration properties vs. settings props related to the view itself. > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java > 28e5e12 > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java > 95703fd > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java > f77c97e > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java > d55f949 > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewParameterEntity.java > a8ddcdb > > ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java > ba4dd2d > ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java > PRE-CREATION > > ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java > b7a48a8 > ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java > 419ba02 > > ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ParameterConfig.java > e983609 > ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 26ff9bb > ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 13e8939 > ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 622fca3 > ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql > 9fe9cd7 > ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql a722d2a > > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java > 31c65c3 > > ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewEntityTest.java > a9ceb93 > > ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java > 07b8410 > > ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java > PRE-CREATION > > ambari-server/src/test/java/org/apache/ambari/server/view/ViewContextImplTest.java > 84794e8 > > ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ParameterConfigTest.java > 278e441 > > ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java > 75ab10a > ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java 432babb > > ambari-views/src/main/java/org/apache/ambari/view/ViewInstanceDefinition.java > ff9090b > ambari-views/src/main/java/org/apache/ambari/view/cluster/Cluster.java > PRE-CREATION > ambari-views/src/main/resources/view.xsd e994faf > > Diff: https://reviews.apache.org/r/32710/diff/ > > > Testing > ------- > > Manual testing. > > New unit tests. > > All pass. > > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 37:16 min > [INFO] Finished at: 2015-03-31T21:38:06-04:00 > [INFO] Final Memory: 44M/531M > [INFO] > ------------------------------------------------------------------------ > > > Thanks, > > Tom Beerbower > >
