Fixed this in the commit f11401a342ec74e17fd6dc8dcf3c4d6477e221bf. On Thu, Oct 9, 2014 at 3:40 PM, Isuru Haththotuwa <isu...@apache.org> wrote:
> > Hi Martin, > > Seems that you have commented out the public static Set<StartupOrder> > convert (org.apache.stratos.cloud.controller.pojo.StartupOrder [] > startupOrderArr, GroupContext groupContext) methos in the ParseUtils class. > Any specific reason to do it? > > This change has broken the logic in the startup order parsing, currently > I'm trying to fix it. > > ---------- Forwarded message ---------- > From: <mep...@apache.org> > Date: Thu, Oct 9, 2014 at 6:22 AM > Subject: git commit: startupOrder format change II > To: comm...@stratos.apache.org > > > Repository: stratos > Updated Branches: > refs/heads/4.0.0-grouping cb67a8096 -> cff0ace65 > > > startupOrder format change II > > > Project: http://git-wip-us.apache.org/repos/asf/stratos/repo > Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/cff0ace6 > Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/cff0ace6 > Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/cff0ace6 > > Branch: refs/heads/4.0.0-grouping > Commit: cff0ace658e805738b939289b2bb1d95afb83463 > Parents: cb67a80 > Author: Martin Eppel <mep...@cisco..com> > Authored: Wed Oct 8 17:50:22 2014 -0700 > Committer: Martin Eppel <mep...@cisco..com> > Committed: Wed Oct 8 17:52:36 2014 -0700 > > ---------------------------------------------------------------------- > .../grouping/dependency/DependencyBuilder.java | 44 +++++------- > .../parser/DefaultApplicationParser.java | 70 +++++--------------- > .../application/parser/ParserUtils.java | 2 + > .../cloud/controller/pojo/StartupOrder.java | 3 + > .../deployer/DefaultServiceGroupDeployer.java | 1 - > .../domain/topology/DependencyOrder.java | 39 +++++++---- > .../messaging/domain/topology/StartupOrder.java | 3 + > 7 files changed, 65 insertions(+), 97 deletions(-) > ---------------------------------------------------------------------- > > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java > b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java > index a4f9b54..7c087ec 100644 > --- > a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java > +++ > b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java > @@ -81,43 +81,31 @@ public class DependencyBuilder { > } > > //Parsing the start up order > - Set<StartupOrder> startupOrderSet = > dependencyOrder.getStartupOrders(); > - ApplicationContext foundContext = null; > - for (StartupOrder startupOrder : startupOrderSet) { > + String [] startupOrders = dependencyOrder.getStartupOrders(); > + ApplicationContext foundContext = null; > + if (startupOrders == null) { > + if (log.isDebugEnabled()) { > + log.debug("startupOrders is null, returning default > dependency tree (empty)"); > + } > + > + return dependencyTree; > + } > + for (String startupOrder : startupOrders) { > + String start = > dependencyOrder.getStartStartupOrder(startupOrder); > foundContext = null; > - for (String start : startupOrder.getStartList()) { > + > + if (start != null) { > ApplicationContext applicationContext = > ApplicationContextFactory. > getApplicationContext(start, > component, dependencyTree); > String id = applicationContext.getId(); //TODO change > the id > + > + > > ApplicationContext existingApplicationContext = > > dependencyTree.findApplicationContextWithId(id); > - if (existingApplicationContext == null) { > - if (foundContext != null) { > - //appending the start up order to existing > group/cluster > - > foundContext.addApplicationContext(applicationContext); > - if (log.isDebugEnabled()) { > - log.debug("Found an existing [dependency] > " + foundContext.getId() + > - " and adding the [dependency] " + > id + " as the child"); > - } > - } else { > + if (existingApplicationContext == null) { > //adding list of startup order to the > dependency tree > > dependencyTree.addApplicationContext(applicationContext); > - } > - } else { > - if (foundContext == null) { > - //assigning the found context to the later > use. > - foundContext = existingApplicationContext; > - if (log.isDebugEnabled()) { > - log.debug("Found an existing [dependency] > " + id + " and setting it " + > - "for the next dependency to > follow"); > - } > - } else { > - //TODO Throw exception, since another same > start order already found > - log.warn("Startup order is not consistent. It > contains the group/cluster " + > - "which has been used more than one in > another startup order"); > - } > - > } > > } > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java > b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java > index d01674d..efeccd7 100644 > --- > a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java > +++ > b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java > @@ -268,9 +268,17 @@ public class DefaultApplicationParser implements > ApplicationParser { > // get top level Dependency definitions > if (appCtxt.getComponents().getDependencyContext() != null) { > DependencyOrder appDependencyOrder = new > DependencyOrder(); > - Set<StartupOrder> startupOrders = > getStartupOrderForApplicationComponents(appCtxt.getComponents().getDependencyContext().getStartupOrdersContexts()); > + String [] startupOrders = > appCtxt.getComponents().getDependencyContext().getStartupOrdersContexts(); > if (startupOrders != null) { > + if (log.isDebugEnabled()) { > + log.debug("parsing application ... > buildCompositeAppStructure: startupOrders != null for app alias: " + > + appCtxt.getAlias() + " #: > " + startupOrders.length); > + } > appDependencyOrder.setStartupOrders(startupOrders); > + } else { > + if (log.isDebugEnabled()) { > + log.debug("parsing application ... > buildCompositeAppStructure: startupOrders == null for app alias: " + > appCtxt.getAlias()); > + } > } > > > appDependencyOrder.setKillbehavior(appCtxt.getComponents().getDependencyContext().getKillBehaviour()); > > @@ -391,7 +399,7 @@ public class DefaultApplicationParser implements > ApplicationParser { > group.setDeploymentPolicy(groupCtxt.getDeploymentPolicy()); > DependencyOrder dependencyOrder = new DependencyOrder(); > // create the Dependency Ordering > - Set<StartupOrder> startupOrders = > getStartupOrderForGroup(groupCtxt); > + String [] startupOrders = getStartupOrderForGroup(groupCtxt); > if (startupOrders != null) { > dependencyOrder.setStartupOrders(startupOrders); > } > @@ -434,7 +442,7 @@ public class DefaultApplicationParser implements > ApplicationParser { > * > * @throws ApplicationDefinitionException > */ > - private Set<StartupOrder> getStartupOrderForGroup(GroupContext > groupContext) throws ApplicationDefinitionException { > + private String [] getStartupOrderForGroup(GroupContext groupContext) > throws ApplicationDefinitionException { > > ServiceGroup serviceGroup = > FasterLookUpDataHolder.getInstance().getServiceGroup(groupContext.getName()); > > @@ -448,23 +456,14 @@ public class DefaultApplicationParser implements > ApplicationParser { > > assert serviceGroup != null; > if (serviceGroup.getDependencies() != null) { > + if (log.isDebugEnabled()) { > + log.debug("parsing application ... > getStartupOrderForGroup: dependencies != null " ); > + } > if (serviceGroup.getDependencies().getStartupOrders() != > null) { > > - Set<StartupOrder> startupOrders = new > HashSet<StartupOrder>(); > - String [] st = > serviceGroup.getDependencies().getStartupOrders(); > - > + String [] startupOrders = > serviceGroup.getDependencies().getStartupOrders(); > if (log.isDebugEnabled()) { > - log.debug("parsing application ... > getStartupOrderForGroup # of startupOrders: " + st.length); > - } > - > - for (String startupOrderContext : st) { > - > - String [] order = startupOrderContext.split(","); > - > - startupOrders.add(new StartupOrder(order[0], > order[1])); > - if (log.isDebugEnabled()) { > - log.debug("parsing application ... > getStartupOrderForGroup startupOrders:start: " + order[0] + " after: " + > order[1]); > - } > + log.debug("parsing application ... > getStartupOrderForGroup: startupOrders != null # of: " + > startupOrders.length); > } > return startupOrders; > } > @@ -474,43 +473,6 @@ public class DefaultApplicationParser implements > ApplicationParser { > } > > /** > - * Find the startup order for an Application > - * > - * @param startupOrderCtxts Startup Order information related to the > Application > - * @return Set of Startup Orders > - * > - * @throws ApplicationDefinitionException if an error occurs > - */ > - private Set<StartupOrder> getStartupOrderForApplicationComponents > (String [] startupOrdersCtxts) > - throws ApplicationDefinitionException { > - > - if (startupOrdersCtxts == null) { > - return null; > - } > - > - if (log.isDebugEnabled()) { > - log.debug("parsing application ... > getStartupOrderForApplicationComponents: # of: " + > startupOrdersCtxts.length); > - } > - > - Set<StartupOrder> startupOrders = new HashSet<StartupOrder>(); > - > - /* > - for (StartupOrderContext startupOrderContext : startupOrderCtxts) > { > - startupOrders.add(new > StartupOrder(startupOrderContext.getStart(), > startupOrderContext.getAfter())); > - } > - */ > - for (String startupOrderContext : startupOrdersCtxts) { > - String [] order = startupOrderContext.split(","); > - startupOrders.add(new StartupOrder(order[0], order[1])); > - if (log.isDebugEnabled()) { > - log.debug("parsing application ... > getStartupOrderForApplicationComponents: start: " + order[0] + " /after: " > + order[1]); > - } > - } > - > - return startupOrders; > - } > - > - /** > * Get kill behaviour related to a Group > * > * @param serviceGroupName Group name > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/ParserUtils.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/ParserUtils.java > b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/ParserUtils.java > index f47970c..707fd0a 100644 > --- > a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/ParserUtils.java > +++ > b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/ParserUtils.java > @@ -28,6 +28,7 @@ import java.util.Set; > > public class ParserUtils { > > + /* > public static Set<StartupOrder> convert > (org.apache.stratos.cloud.controller.pojo.StartupOrder [] startupOrderArr, > GroupContext groupContext) { > > Set<StartupOrder> startupOrders = new HashSet<StartupOrder>(); > @@ -108,6 +109,7 @@ public class ParserUtils { > return null; > } > > +*/ > private static String getAliasForServiceType (String serviceType, > GroupContext groupContext) { > > for (SubscribableContext subCtxt : > groupContext.getSubscribableContexts()) { > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/StartupOrder.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/StartupOrder.java > b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/StartupOrder.java > index 0f1c647..ed9626b 100644 > --- > a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/StartupOrder.java > +++ > b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/StartupOrder.java > @@ -24,6 +24,8 @@ import java.io.Serializable; > public class StartupOrder implements Serializable { > > private static final long serialVersionUID = 280860334002791396L; > + > + /* > > private String start; > > @@ -44,4 +46,5 @@ public class StartupOrder implements Serializable { > public void setAfter(String after) { > this.after = after; > } > + */ > } > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java > b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java > index f4d42f6..8885ebd 100644 > --- > a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java > +++ > b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java > @@ -28,7 +28,6 @@ import > org.apache.stratos.manager.exception.InvalidServiceGroupException; > import > org.apache.stratos.manager.exception.ServiceGroupDefinitioException; > import > org.apache.stratos.manager.grouping.definitions.ServiceGroupDefinition; > import > org.apache.stratos.manager.grouping.definitions.DependencyDefinitions; > -import > org.apache.stratos.manager.grouping.definitions.StartupOrderDefinition; > import org.apache.stratos.cloud.controller.stub.pojo.ServiceGroup; > import org.apache.stratos.cloud.controller.stub.pojo.Dependencies; > import > org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidServiceGroupExceptionException; > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/DependencyOrder.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/DependencyOrder.java > b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/DependencyOrder.java > index 5fb694a..ff08a4c 100644 > --- > a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/DependencyOrder.java > +++ > b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/DependencyOrder.java > @@ -25,24 +25,17 @@ import java.util.Set; > > public class DependencyOrder implements Serializable { > > - private Set<StartupOrder> startupOrders; > + /** > + * > + */ > + private static final long serialVersionUID = -599600831844477527L; > + > + private String [] startupOrders; > > private String killbehavior; > > public DependencyOrder () { > - this.startupOrders = new HashSet<StartupOrder>(); > - } > - > - public void setStartupOrders (Set<StartupOrder> startupOrders) { > - this.startupOrders.addAll(startupOrders); > - } > - > - public Set<StartupOrder> getStartupOrders() { > - return startupOrders; > - } > - > - public void addStartupOrders(StartupOrder startupOrder) { > - this.startupOrders.add(startupOrder); > + this.setStartupOrders(null); > } > > public String getKillbehavior() { > @@ -52,4 +45,22 @@ public class DependencyOrder implements Serializable { > public void setKillbehavior(String killbehavior) { > this.killbehavior = killbehavior; > } > + > + public String [] getStartupOrders() { > + return startupOrders; > + } > + > + public void setStartupOrders(String [] startupOrders) { > + this.startupOrders = startupOrders; > + } > + > + public String getStartStartupOrder(String startupOrder) { > + String [] splitStartupOrder = startupOrder.split(","); > + return splitStartupOrder[0]; > + } > + > + public String getAfterStartupOrder(String startupOrder) { > + String [] splitStartupOrder = startupOrder.split(","); > + return splitStartupOrder[1]; > + } > } > > > http://git-wip-us.apache.org/repos/asf/stratos/blob/cff0ace6/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/StartupOrder.java > ---------------------------------------------------------------------- > diff --git > a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/StartupOrder.java > b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/StartupOrder.java > index 220380e..6263070 100644 > --- > a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/StartupOrder.java > +++ > b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/StartupOrder.java > @@ -23,6 +23,8 @@ import java.io.Serializable; > import java.util.List; > > public class StartupOrder implements Serializable { > + > + /* > > private String start; > > @@ -50,4 +52,5 @@ public class StartupOrder implements Serializable { > public void setStartList(List<String> startList) { > this.startList = startList; > } > + */ > } > > -- > Thanks and Regards, > > Isuru H. > +94 716 358 048 > > -- > Thanks and Regards, > > Isuru H. > +94 716 358 048* <http://wso2.com/>* > > > * <http://wso2.com/>* > > >