[jboss-cvs] JBossAS SVN: r63865 - in projects/microcontainer/trunk: deployers-impl/src/main/org/jboss/deployers/plugins/deployers and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 6 09:05:54 EDT 2007
Author: alesj
Date: 2007-07-06 09:05:54 -0400 (Fri, 06 Jul 2007)
New Revision: 63865
Added:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerDomino.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorter.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Domino.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoOrdering.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Dots.java
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/SetDots.java
projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/modules/glossary.xml
Modified:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java
projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/master.xml
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java
Log:
Changed the deployers sort - using transitive closure.
Added glossary, removed JIRA issue from AAMD.
Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java 2007-07-06 12:53:54 UTC (rev 63864)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -41,9 +41,10 @@
import org.jboss.deployers.client.spi.IncompleteDeploymentException;
import org.jboss.deployers.client.spi.IncompleteDeployments;
import org.jboss.deployers.client.spi.MissingDependency;
+import org.jboss.deployers.plugins.sort.DeployerSorter;
+import org.jboss.deployers.plugins.sort.DeployerSorterFactory;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.DeploymentState;
-import org.jboss.deployers.spi.Ordered;
import org.jboss.deployers.spi.deployer.Deployer;
import org.jboss.deployers.spi.deployer.Deployers;
import org.jboss.deployers.spi.deployer.DeploymentStage;
@@ -175,7 +176,7 @@
List<Deployer> deployers = deployersByStage.get(stageName);
if (deployers == null)
deployers = Collections.emptyList();
- deployers = sort(deployers, wrapper);
+ deployers = insert(deployers, wrapper);
deployersByStage.put(stageName, deployers);
this.deployers.add(wrapper);
@@ -803,17 +804,33 @@
}
/**
+ * Insert the new Deployer.
+ *
+ * @param original the original deployers
+ * @param newDeployer the new deployer
+ * @return the sorted deployers
+ */
+ protected List<Deployer> insert(List<Deployer> original, Deployer newDeployer)
+ {
+ DeployerSorter sorter = DeployerSorterFactory.newSorter();
+ return sorter.sortDeployers(original, newDeployer);
+ }
+
+/*
+ */
+/**
* Sort the deployers
*
* @param original the original deployers
* @param newDeployer the new deployer
* @return the sorted deployers
*/
+/*
protected List<Deployer> sort(List<Deployer> original, Deployer newDeployer)
{
List<Deployer> result = new ArrayList<Deployer>(original);
result.add(newDeployer);
-
+
// Bubble sort :-)
boolean changed = true;
while (changed)
@@ -823,12 +840,12 @@
for (int i = 0; i < result.size() -1; ++i)
{
int j = i+1;
-
+
Deployer one = result.get(i);
Deployer two = result.get(j);
-
+
Set<String> oneOutputs = one.getOutputs();
-
+
// Don't move if one outputs something for two
boolean swap = true;
if (oneOutputs.isEmpty() == false)
@@ -842,11 +859,11 @@
break;
}
}
-
+
if (swap == false)
continue;
}
-
+
// Move if one inputs from two
swap = false;
Set<String> twoOutputs = two.getOutputs();
@@ -862,11 +879,11 @@
}
}
}
-
+
// Move if the order is not correct
if (Ordered.COMPARATOR.compare(one, two) > 0)
swap = true;
-
+
if (swap)
{
Collections.swap(result, i, j);
@@ -874,7 +891,7 @@
}
}
}
-
+
// Now check the consistency
// The new deployer should be before anything that accepts its outputs
Set<String> outputs = newDeployer.getOutputs();
@@ -908,7 +925,8 @@
}
}
}
-
+
return result;
}
+*/
}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerDomino.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerDomino.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerDomino.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,88 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+import java.util.Set;
+
+import org.jboss.deployers.spi.deployer.Deployer;
+
+/**
+ * Representing deployer as a domino.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class DeployerDomino implements Domino<Set<String>>
+{
+ private Deployer deployer;
+ private Dots<Set<String>> head;
+ private Dots<Set<String>> tail;
+
+ public DeployerDomino(Deployer deployer)
+ {
+ if (deployer == null)
+ throw new IllegalArgumentException("Null deployer!");
+ this.deployer = deployer;
+ this.head = new SetDots<String>(deployer.getInputs());
+ this.tail = new SetDots<String>(deployer.getOutputs());
+ }
+
+ public Deployer getDeployer()
+ {
+ return deployer;
+ }
+
+ public Dots<Set<String>> getHead()
+ {
+ return head;
+ }
+
+ public Dots<Set<String>> getTail()
+ {
+ return tail;
+ }
+
+ public int getRelativeOrder()
+ {
+ return deployer.getRelativeOrder();
+ }
+
+ public void setRelativeOrder(int order)
+ {
+ deployer.setRelativeOrder(order);
+ }
+
+ public String getInfo()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(deployer);
+ builder.append("{inputs=").append(deployer.getInputs());
+ builder.append(" outputs=").append(deployer.getOutputs());
+ builder.append("}\n");
+ return builder.toString();
+ }
+
+ @Override
+ public String toString()
+ {
+ return deployer + ", " + head + "|" + tail;
+ }
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorter.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorter.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorter.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+import java.util.List;
+
+import org.jboss.deployers.spi.deployer.Deployer;
+
+/**
+ * Deployer sorter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface DeployerSorter
+{
+ /**
+ * Sort original + newDeployer.
+ *
+ * @param original the original
+ * @param newDeployer new deployer to insert
+ * @return sorted deployer
+ * @throws IllegalStateException on found cycle
+ */
+ List<Deployer> sortDeployers(List<Deployer> original, Deployer newDeployer);
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DeployerSorterFactory.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+/**
+ * Sorter factory.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class DeployerSorterFactory
+{
+ public static DeployerSorter newSorter()
+ {
+ return new DominoDeployerSorter();
+ }
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Domino.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Domino.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Domino.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+import org.jboss.deployers.spi.Ordered;
+
+/**
+ * Simple domino presentation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @param <T> dots type
+ */
+public interface Domino<T> extends Ordered
+{
+ /**
+ * Head dots.
+ *
+ * @return head
+ */
+ Dots<T> getHead();
+
+ /**
+ * Tail dots.
+ *
+ * @return tail
+ */
+ Dots<T> getTail();
+
+ /**
+ * Get the info.
+ *
+ * @return info string
+ */
+ String getInfo();
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.deployers.spi.deployer.Deployer;
+
+/**
+ * Deployer sorter using domino sorting.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class DominoDeployerSorter implements DeployerSorter
+{
+ public List<Deployer> sortDeployers(List<Deployer> original, Deployer newDeployer)
+ {
+ int capacity = original.size() + 1;
+
+ List<DeployerDomino> dominoes = new ArrayList<DeployerDomino>(capacity);
+ for (Deployer deployer : original)
+ dominoes.add(new DeployerDomino(deployer));
+ dominoes.add(new DeployerDomino(newDeployer));
+
+ DominoOrdering<DeployerDomino> sorter = new DominoOrdering<DeployerDomino>("Cannot add %1s it will cause a loop\n");
+ dominoes = sorter.orderDominoes(dominoes);
+
+ List<Deployer> deployers = new ArrayList<Deployer>(capacity);
+ for (DeployerDomino domino : dominoes)
+ deployers.add(domino.getDeployer());
+ return deployers;
+ }
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoOrdering.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoOrdering.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoOrdering.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,186 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.jboss.deployers.spi.Ordered;
+
+/**
+ * Simple transition ordering using transitive closure.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @param <T> exact domino type
+ */
+public class DominoOrdering<T extends Domino>
+{
+ private static final Ordered.OrderedComparator ORDERED_COMPARATOR = new Ordered.OrderedComparator();
+
+ private String message;
+
+ private List<T> dominoes;
+ private int size;
+ private int[][] connections;
+
+ public DominoOrdering(String message)
+ {
+ this.message = message;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void init(List<T> dominoes)
+ {
+ this.dominoes = dominoes;
+ this.size = dominoes.size();
+ this.connections = new int[size][size];
+
+ for (int i = 0; i < size - 1; i++)
+ {
+ for (int j = i + 1; j < size; j++)
+ {
+ Domino one = dominoes.get(i);
+ Domino two = dominoes.get(j);
+ Dots oneHead = one.getHead();
+ Dots oneTail = one.getTail();
+ Dots twoHead = two.getHead();
+ Dots twoTail = two.getTail();
+ boolean fstXsnd = oneTail.match(twoHead);
+ boolean sndXfst = twoTail.match(oneHead);
+ int relation = 0;
+ if (fstXsnd && sndXfst)
+ {
+ // pass-through deployers
+ if (one.getHead().match(twoHead) && oneTail.match(twoTail))
+ relation = ORDERED_COMPARATOR.compare(one, two);
+ else
+ // short circut cycle - throw exception immediately
+ throwCycleException(i);
+ }
+ else
+ relation = fstXsnd ? -1 : (sndXfst ? 1 : 0);
+ if (relation == 0)
+ relation = one.getRelativeOrder() - two.getRelativeOrder();
+ connections[i][j] = relation;
+ connections[j][i] = -connections[i][j];
+ }
+ }
+
+ }
+
+ public List<T> orderDominoes(List<T> dominoes)
+ {
+ init(dominoes);
+ fillTransitions();
+ List<Integer> indexes = new ArrayList<Integer>();
+ for (int i = 0; i < size; i++)
+ indexes.add(i);
+ Collections.sort(indexes, new IndexComparator());
+ List<T> list = new ArrayList<T>(size);
+ for(Integer index : indexes)
+ list.add(dominoes.get(index));
+ return list;
+ }
+
+ protected void fillTransitions()
+ {
+ boolean changed = true;
+ while(changed)
+ {
+ changed = false;
+ for (int i = 0; i < size; i++)
+ {
+ for (int j = 0; j < size; j++)
+ {
+ if (j == i || connections[i][j] == 0)
+ continue;
+ for (int k = 0; k < size; k++)
+ {
+ if (k == i || k == j)
+ continue;
+ if (connections[i][j] > 0)
+ {
+ if (connections[j][k] > 0)
+ {
+ // already set
+ if (connections[i][k] > 0)
+ continue;
+ // cycle
+ else if (connections[i][k] < 0)
+ throwCycleException(i);
+ connections[i][k] = 1;
+ changed = true;
+ }
+ }
+ else if (connections[i][j] < 0)
+ {
+ if (connections[j][k] < 0)
+ {
+ // already set
+ if (connections[i][k] < 0)
+ continue;
+ // cycle
+ else if (connections[i][k] > 0)
+ throwCycleException(i);
+ connections[i][k] = -1;
+ changed = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void throwCycleException(int index)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(String.format(message, dominoes.get(index)));
+ for (T d : dominoes)
+ builder.append(d.getInfo());
+ throw new IllegalStateException(builder.toString());
+ }
+
+ private class IndexComparator implements Comparator<Integer>
+ {
+ public int compare(Integer i1, Integer i2)
+ {
+ return connections[i1][i2];
+ }
+ }
+
+ protected void print()
+ {
+ for(int i = 0; i < size; i++)
+ {
+ for(int j = 0; j < size; j++)
+ {
+ System.out.print(String.format("%2d ", connections[i][j]));
+ }
+ System.out.println();
+ }
+ System.out.println();
+ }
+
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Dots.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Dots.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/Dots.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+/**
+ * The domino dots presentation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @param <T> holder information
+ */
+public interface Dots<T>
+{
+ /**
+ * Get the value.
+ *
+ * @return dots value
+ */
+ T getValue();
+
+ /**
+ * Do this dots match with the param dots.
+ *
+ * @param dots the dots
+ * @return true if these dots match param dots
+ */
+ boolean match(Dots<T> dots);
+}
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/SetDots.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/SetDots.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/SetDots.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.sort;
+
+import java.util.Set;
+
+/**
+ * Domino dots as a set of values.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @param <V> exact set element type
+ */
+public class SetDots<V> implements Dots<Set<V>>
+{
+ private Set<V> set;
+
+ public SetDots(Set<V> set)
+ {
+ if (set == null)
+ throw new IllegalArgumentException("Set is null!");
+ this.set = set;
+ }
+
+ public Set<V> getValue()
+ {
+ return set;
+ }
+
+ public boolean match(Dots<Set<V>> containable)
+ {
+ if (set.isEmpty() == false)
+ {
+ for(V value : containable.getValue())
+ {
+ if (set.contains(value))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return set.toString();
+ }
+}
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java 2007-07-06 12:53:54 UTC (rev 63864)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -288,7 +288,7 @@
assertEquals(6, deployer3.getUndeployOrder());
assertEquals(5, deployer4.getUndeployOrder());
}
-
+
public void testMultipleOutput() throws Exception
{
DeployerClient main = createMainDeployer();
@@ -453,11 +453,11 @@
main.addDeployment(deployment);
main.process();
- assertEquals(1, deployer1.getDeployOrder());
- assertEquals(2, deployer2.getDeployOrder());
- assertEquals(3, deployer3.getDeployOrder());
- assertEquals(4, deployer4.getDeployOrder());
- assertEquals(5, deployer5.getDeployOrder());
+ assertEquals(5, deployer1.getDeployOrder());
+ assertEquals(4, deployer2.getDeployOrder());
+ assertEquals(1, deployer3.getDeployOrder());
+ assertEquals(2, deployer4.getDeployOrder());
+ assertEquals(3, deployer5.getDeployOrder());
assertEquals(6, deployer6.getDeployOrder());
assertEquals(-1, deployer1.getUndeployOrder());
assertEquals(-1, deployer2.getUndeployOrder());
@@ -469,33 +469,33 @@
main.removeDeployment(deployment);
main.process();
- assertEquals(1, deployer1.getDeployOrder());
- assertEquals(2, deployer2.getDeployOrder());
- assertEquals(3, deployer3.getDeployOrder());
- assertEquals(4, deployer4.getDeployOrder());
- assertEquals(5, deployer5.getDeployOrder());
+ assertEquals(5, deployer1.getDeployOrder());
+ assertEquals(4, deployer2.getDeployOrder());
+ assertEquals(1, deployer3.getDeployOrder());
+ assertEquals(2, deployer4.getDeployOrder());
+ assertEquals(3, deployer5.getDeployOrder());
assertEquals(6, deployer6.getDeployOrder());
- assertEquals(12, deployer1.getUndeployOrder());
- assertEquals(11, deployer2.getUndeployOrder());
- assertEquals(10, deployer3.getUndeployOrder());
- assertEquals(9, deployer4.getUndeployOrder());
- assertEquals(8, deployer5.getUndeployOrder());
+ assertEquals(8, deployer1.getUndeployOrder());
+ assertEquals(9, deployer2.getUndeployOrder());
+ assertEquals(12, deployer3.getUndeployOrder());
+ assertEquals(11, deployer4.getUndeployOrder());
+ assertEquals(10, deployer5.getUndeployOrder());
assertEquals(7, deployer6.getUndeployOrder());
main.addDeployment(deployment);
main.process();
- assertEquals(13, deployer1.getDeployOrder());
- assertEquals(14, deployer2.getDeployOrder());
- assertEquals(15, deployer3.getDeployOrder());
- assertEquals(16, deployer4.getDeployOrder());
- assertEquals(17, deployer5.getDeployOrder());
+ assertEquals(17, deployer1.getDeployOrder());
+ assertEquals(16, deployer2.getDeployOrder());
+ assertEquals(13, deployer3.getDeployOrder());
+ assertEquals(14, deployer4.getDeployOrder());
+ assertEquals(15, deployer5.getDeployOrder());
assertEquals(18, deployer6.getDeployOrder());
- assertEquals(12, deployer1.getUndeployOrder());
- assertEquals(11, deployer2.getUndeployOrder());
- assertEquals(10, deployer3.getUndeployOrder());
- assertEquals(9, deployer4.getUndeployOrder());
- assertEquals(8, deployer5.getUndeployOrder());
+ assertEquals(8, deployer1.getUndeployOrder());
+ assertEquals(9, deployer2.getUndeployOrder());
+ assertEquals(12, deployer3.getUndeployOrder());
+ assertEquals(11, deployer4.getUndeployOrder());
+ assertEquals(10, deployer5.getUndeployOrder());
assertEquals(7, deployer6.getUndeployOrder());
}
@@ -515,9 +515,9 @@
main.addDeployment(deployment);
main.process();
- assertEquals(1, deployer1.getDeployOrder());
- assertEquals(2, deployer2.getDeployOrder());
- assertEquals(3, deployer3.getDeployOrder());
+ assertEquals(3, deployer1.getDeployOrder());
+ assertEquals(1, deployer2.getDeployOrder());
+ assertEquals(2, deployer3.getDeployOrder());
assertEquals(-1, deployer1.getUndeployOrder());
assertEquals(-1, deployer2.getUndeployOrder());
assertEquals(-1, deployer3.getUndeployOrder());
@@ -525,21 +525,121 @@
main.removeDeployment(deployment);
main.process();
- assertEquals(1, deployer1.getDeployOrder());
+ assertEquals(3, deployer1.getDeployOrder());
+ assertEquals(1, deployer2.getDeployOrder());
+ assertEquals(2, deployer3.getDeployOrder());
+ assertEquals(4, deployer1.getUndeployOrder());
+ assertEquals(6, deployer2.getUndeployOrder());
+ assertEquals(5, deployer3.getUndeployOrder());
+
+ main.addDeployment(deployment);
+ main.process();
+
+ assertEquals(9, deployer1.getDeployOrder());
+ assertEquals(7, deployer2.getDeployOrder());
+ assertEquals(8, deployer3.getDeployOrder());
+ assertEquals(4, deployer1.getUndeployOrder());
+ assertEquals(6, deployer2.getUndeployOrder());
+ assertEquals(5, deployer3.getUndeployOrder());
+ }
+
+ public void testTransitionOrdering() throws Exception
+ {
+ DeployerClient main = createMainDeployer();
+ TestFlowDeployer deployer1 = new TestFlowDeployer("A");
+ deployer1.setInputs("3");
+ deployer1.setOutputs("4");
+ addDeployer(main, deployer1);
+
+ TestFlowDeployer deployer2 = new TestFlowDeployer("B");
+ deployer2.setInputs("1");
+ deployer2.setOutputs("2");
+ addDeployer(main, deployer2);
+
+ TestFlowDeployer deployer3 = new TestFlowDeployer("C");
+ deployer3.setInputs("2");
+ deployer3.setOutputs("3");
+ addDeployer(main, deployer3);
+
+ Deployment deployment = createSimpleDeployment("TransitionOrdering");
+ main.addDeployment(deployment);
+ main.process();
+
+ assertEquals(3, deployer1.getDeployOrder());
+ assertEquals(1, deployer2.getDeployOrder());
+ assertEquals(2, deployer3.getDeployOrder());
+ assertEquals(-1, deployer1.getUndeployOrder());
+ assertEquals(-1, deployer2.getUndeployOrder());
+ assertEquals(-1, deployer3.getUndeployOrder());
+
+ main.removeDeployment(deployment);
+ main.process();
+
+ assertEquals(3, deployer1.getDeployOrder());
+ assertEquals(1, deployer2.getDeployOrder());
+ assertEquals(2, deployer3.getDeployOrder());
+ assertEquals(4, deployer1.getUndeployOrder());
+ assertEquals(6, deployer2.getUndeployOrder());
+ assertEquals(5, deployer3.getUndeployOrder());
+
+ main.addDeployment(deployment);
+ main.process();
+
+ assertEquals(9, deployer1.getDeployOrder());
+ assertEquals(7, deployer2.getDeployOrder());
+ assertEquals(8, deployer3.getDeployOrder());
+ assertEquals(4, deployer1.getUndeployOrder());
+ assertEquals(6, deployer2.getUndeployOrder());
+ assertEquals(5, deployer3.getUndeployOrder());
+ }
+
+ public void testSymetricDots() throws Exception
+ {
+ DeployerClient main = createMainDeployer();
+ TestFlowDeployer deployer1 = new TestFlowDeployer("1");
+ deployer1.setInputs("X");
+ deployer1.setOutputs("B");
+ addDeployer(main, deployer1);
+
+ TestFlowDeployer deployer2 = new TestFlowDeployer("2");
+ deployer2.setInputs("X");
+ deployer2.setOutputs("X");
+ addDeployer(main, deployer2);
+
+ TestFlowDeployer deployer3 = new TestFlowDeployer("3");
+ deployer3.setInputs("A");
+ deployer3.setOutputs("X");
+ addDeployer(main, deployer3);
+
+ Deployment deployment = createSimpleDeployment("SymetricDots");
+ main.addDeployment(deployment);
+ main.process();
+
+ assertEquals(3, deployer1.getDeployOrder());
assertEquals(2, deployer2.getDeployOrder());
- assertEquals(3, deployer3.getDeployOrder());
- assertEquals(6, deployer1.getUndeployOrder());
+ assertEquals(1, deployer3.getDeployOrder());
+ assertEquals(-1, deployer1.getUndeployOrder());
+ assertEquals(-1, deployer2.getUndeployOrder());
+ assertEquals(-1, deployer3.getUndeployOrder());
+
+ main.removeDeployment(deployment);
+ main.process();
+
+ assertEquals(3, deployer1.getDeployOrder());
+ assertEquals(2, deployer2.getDeployOrder());
+ assertEquals(1, deployer3.getDeployOrder());
+ assertEquals(4, deployer1.getUndeployOrder());
assertEquals(5, deployer2.getUndeployOrder());
- assertEquals(4, deployer3.getUndeployOrder());
+ assertEquals(6, deployer3.getUndeployOrder());
main.addDeployment(deployment);
main.process();
-
- assertEquals(7, deployer1.getDeployOrder());
+
+ assertEquals(9, deployer1.getDeployOrder());
assertEquals(8, deployer2.getDeployOrder());
- assertEquals(9, deployer3.getDeployOrder());
- assertEquals(6, deployer1.getUndeployOrder());
+ assertEquals(7, deployer3.getDeployOrder());
+ assertEquals(4, deployer1.getUndeployOrder());
assertEquals(5, deployer2.getUndeployOrder());
- assertEquals(4, deployer3.getUndeployOrder());
+ assertEquals(6, deployer3.getUndeployOrder());
}
}
Modified: projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/master.xml
===================================================================
--- projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/master.xml 2007-07-06 12:53:54 UTC (rev 63864)
+++ projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/master.xml 2007-07-06 13:05:54 UTC (rev 63865)
@@ -47,6 +47,9 @@
<xi:include href="modules/installation.xml"
xml:base="./"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
+ <xi:include href="modules/glossary.xml"
+ xml:base="./"
+ xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="modules/examples.xml"
xml:base="./"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
Added: projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/modules/glossary.xml
===================================================================
--- projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/modules/glossary.xml (rev 0)
+++ projects/microcontainer/trunk/docs/gettingstarted/src/docbkx/en/modules/glossary.xml 2007-07-06 13:05:54 UTC (rev 63865)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
+
+<chapter id="glossary">
+ <title>Glossary</title>
+
+ <section>
+ <title>A glossary to start</title>
+
+ <para>
+ The glossary ...
+ </para>
+
+ </section>
+</chapter>
\ No newline at end of file
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java 2007-07-06 12:53:54 UTC (rev 63864)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java 2007-07-06 13:05:54 UTC (rev 63865)
@@ -84,7 +84,6 @@
try
{
String annString = annotation;
- // TODO - JBMICROCONT-143 + any better way?
if (replace)
{
annString = StringPropertyReplacer.replaceProperties(annString);
More information about the jboss-cvs-commits
mailing list