labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r745418 - in /labs/magma/trunk: foundation-website/src/main/java/org/apache/magma/website/ foundation-website/src/main/java/org/apache/magma/website/context/ foundation-website/src/test/java/org/apache/magma/website/ maps-google/src/main/ja...
Date Wed, 18 Feb 2009 08:13:33 GMT
Author: simoneg
Date: Wed Feb 18 08:13:33 2009
New Revision: 745418

URL: http://svn.apache.org/viewvc?rev=745418&view=rev
Log:
Refactored the separator char in a static variable

Modified:
    labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
    labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/context/WebMethodContextElement.java
    labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java
    labs/magma/trunk/maps-google/src/main/java/org/apache/magma/maps/google/AddMapLink.aj
    labs/magma/trunk/maven-magma-plugin/pom.xml
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingClassloader.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingProvider.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java
    labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java
    labs/magma/trunk/website-administration/src/main/java/org/apache/magma/website/admin/AdminAction.java
    labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java
    labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java

Modified: labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
(original)
+++ labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
Wed Feb 18 08:13:33 2009
@@ -36,6 +36,7 @@
 
 	public static final String defaultPostfix = "_default";
 	public static final String defaultMethod = "do_default";
+	public static final char paramSeparator = '!';
 	
 	protected Template template;
 	
@@ -94,7 +95,7 @@
 		if (pathInfo == null) {
 			info = new String[] { "" };
 		} else {
-			StringTokenizer stok = new StringTokenizer(pathInfo, "/;");
+			StringTokenizer stok = new StringTokenizer(pathInfo, "/" + paramSeparator);
 			info = new String[stok.countTokens()];
 			int pos = 0;
 			while (stok.hasMoreTokens()) {

Modified: labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/context/WebMethodContextElement.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/context/WebMethodContextElement.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/context/WebMethodContextElement.java
(original)
+++ labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/context/WebMethodContextElement.java
Wed Feb 18 08:13:33 2009
@@ -39,7 +39,7 @@
 					Converter converter = Converters.getConverterFor(object.getClass());
 					if (converter != null) {
 						try {
-							sb.append(';');
+							sb.append(WebHandler.paramSeparator);
 							sb.append(converter.toString(object));
 						} catch (Throwable e) {
 							valid = false;
@@ -50,7 +50,7 @@
 						break;
 					}
 				} else {
-					sb.append(';');					
+					sb.append(WebHandler.paramSeparator);					
 				}
 			}
 		}

Modified: labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java
(original)
+++ labs/magma/trunk/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java
Wed Feb 18 08:13:33 2009
@@ -182,7 +182,7 @@
 	@Test
 	public void parametrizedSimple() throws Exception {
 		DefaultExpectations def = new DefaultExpectations() {{
-			one(session).setAttribute("__magma_lastmain","/test/named;ciao");
+			one(session).setAttribute("__magma_lastmain","/test/named" + WebHandler.paramSeparator
+ "ciao");
 			one(session).setAttribute("name", "ciao");			
 		}};
 		def.setupDefaults("/test/named/ciao");
@@ -192,7 +192,7 @@
 	@Test
 	public void parametrizedObject() throws Exception {
 		DefaultExpectations def = new DefaultExpectations() {{
-			one(session).setAttribute("__magma_lastmain","/test/userEntered;Arianna");
+			one(session).setAttribute("__magma_lastmain","/test/userEntered" + WebHandler.paramSeparator
+ "Arianna");
 			one(req).setAttribute("user", Person.getPerson("Arianna"));
 		}};
 		def.setupDefaults("/test/userEntered/Arianna");
@@ -202,9 +202,9 @@
 	@Test
 	public void parametrizedPrimitive() throws Exception {
 		DefaultExpectations def = new DefaultExpectations() {{
-			one(session).setAttribute("__magma_lastmain","/test/goToPage;5");
+			one(session).setAttribute("__magma_lastmain","/test/goToPage" + WebHandler.paramSeparator
+ "5");
 		}};
-		def.setupDefaults("/test/goToPage;5");
+		def.setupDefaults("/test/goToPage" + WebHandler.paramSeparator + "5");
 		Dispatch disp = def.start();
 		Object[] params = FakeHtmlProducer.getInstance().getParams();
 		assertNotNull(params);
@@ -214,7 +214,7 @@
 	@Test
 	public void parametrizedObjectMissing() throws Exception {
 		DefaultExpectations def = new DefaultExpectations() {{
-			one(session).setAttribute("__magma_lastmain","/test/userEntered;");
+			one(session).setAttribute("__magma_lastmain","/test/userEntered" + WebHandler.paramSeparator);
 			one(req).removeAttribute("user");
 		}};
 		def.setupDefaults("/test/userEntered");

Modified: labs/magma/trunk/maps-google/src/main/java/org/apache/magma/maps/google/AddMapLink.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maps-google/src/main/java/org/apache/magma/maps/google/AddMapLink.aj?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/maps-google/src/main/java/org/apache/magma/maps/google/AddMapLink.aj
(original)
+++ labs/magma/trunk/maps-google/src/main/java/org/apache/magma/maps/google/AddMapLink.aj
Wed Feb 18 08:13:33 2009
@@ -5,6 +5,7 @@
 
 import org.apache.magma.basics.LocalizableString;
 import org.apache.magma.website.beansview.SmartListProducer;
+import org.apache.magma.website.WebHandler;
 
 public aspect AddMapLink {
 
@@ -14,11 +15,15 @@
 		args(stream) && within(SmartListProducer) && this(prod) {
 		try {
 			if (prod instanceof MappedSmartListProducer) {
-				stream.write("<a href=\"useMap;false\" class=\"MagmaGoogleMapsToListLink\">".getBytes("UTF-8"));
+				stream.write("<a href=\"useMap".getBytes("UTF-8"));
+				stream.write(WebHandler.paramSeparator);
+				stream.write("false\" class=\"MagmaGoogleMapsToListLink\">".getBytes("UTF-8"));
 				stream.write(new LocalizableString("Back to normal list").toString().getBytes("UTF-8"));
 				stream.write("</a>".getBytes("UTF-8"));							
 			} else if (prod.mappable) {
-				stream.write("<a href=\"useMap;true\" class=\"MagmaGoogleMapsToMapLink\">".getBytes("UTF-8"));
+				stream.write("<a href=\"useMap".getBytes("UTF-8"));
+				stream.write(WebHandler.paramSeparator);
+				stream.write("true\" class=\"MagmaGoogleMapsToMapLink\">".getBytes("UTF-8"));
 				stream.write(new LocalizableString("Show on map").toString().getBytes("UTF-8"));
 				stream.write("</a>".getBytes("UTF-8"));							
 			}

Modified: labs/magma/trunk/maven-magma-plugin/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/pom.xml?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/pom.xml (original)
+++ labs/magma/trunk/maven-magma-plugin/pom.xml Wed Feb 18 08:13:33 2009
@@ -23,7 +23,7 @@
 	<groupId>org.apache.magma.tools</groupId>
 	<artifactId>maven-magma-plugin</artifactId>
 	<name>Magma Extension Mojo</name>
-	<version>0.0.3-rev04</version>
+	<version>0.0.3-rev05</version>
 	<description>
 		Provides mojos to compile and test a magma package.
 	</description>

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingClassloader.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingClassloader.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingClassloader.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingClassloader.java
Wed Feb 18 08:13:33 2009
@@ -27,7 +27,7 @@
 	@Override
 	protected Class<?> findClass(String name) throws ClassNotFoundException {
 		URL url = provider.findBytecode(name);
-		if (url == null) 
+		if (url == null)
             throw new ClassNotFoundException(name);
 			
         try {

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingProvider.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingProvider.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingProvider.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/classloading/TransformingProvider.java
Wed Feb 18 08:13:33 2009
@@ -41,11 +41,11 @@
 	}
 	
 	private URL weave(String name) throws ClassNotFoundException {
-		if (!shouldWeave(name)) {
-			return null;
-		}
 		URL res = fixedPart.findBytecode(name);
 		if (res == null) throw new ClassNotFoundException(name);
+		if (!shouldWeave(name)) {
+			return res;
+		}
 		InputStream stream = null;
 		try {
 			byte[] buff = ClassCache.rawRetrieve(res);        	

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/AjcLauncher.java
Wed Feb 18 08:13:33 2009
@@ -82,7 +82,7 @@
 		for (String inp : path) {
 			File inpf = new File(inp);
 			if (inpf.exists()) {
-				if (inpf.isDirectory()) {
+				if (!inpf.isDirectory()) {
 					return true;
 				} else {
 					String[] files = FileUtils.getFilesFromExtension(inp, new String[] { "java", "aj"});

Modified: labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java
(original)
+++ labs/magma/trunk/maven-magma-plugin/src/main/java/org/apache/magma/tools/maven/MagmaTestMojo.java
Wed Feb 18 08:13:33 2009
@@ -27,6 +27,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactUtils;
@@ -853,9 +854,22 @@
             String key = ArtifactUtils.versionlessKey( "org.apache.openjpa", "openjpa");
             Artifact art = (Artifact) projectArtifactMap.get(key);
             if (art != null) {
-                art = artifactFactory.createPluginArtifact("org.apache.magma.tools", "maven-magma-plugin",
VersionRange.createFromVersion("0.0.3-rev04"));            	
+                art = null;            	
                 try {
-                	artifactResolver.resolve(art, Collections.EMPTY_LIST, localRepository);
+                	/*
+                	Set artifacts = project.getPluginArtifacts();
+                	for (Iterator iter = artifacts.iterator(); iter.hasNext(); ) {
+						Artifact acart = (Artifact) iter.next();
+						if (acart.getGroupId().equals("org.apache.magma.tools") && acart.getArtifactId().equals("maven-magma-plugin"))
{
+							art = acart;
+							break;
+						}
+					}
+					*/
+                	//art = (Artifact) project.getPluginArtifactMap().get(ArtifactUtils.versionlessKey(
"org.apache.magma.tools", "maven-magma-plugin"));
+                	art = artifactFactory.createPluginArtifact("org.apache.magma.tools", "maven-magma-plugin",
VersionRange.createFromVersion("0.0.3-rev05"));
+                	artifactResolver.resolve(art, project.getPluginArtifactRepositories(), localRepository);
+                	if (art.getFile() == null) throw new ArtifactResolutionException("Cannot
find file", art);
 				} catch (ArtifactResolutionException e) {
 					e.printStackTrace();
 				} catch (ArtifactNotFoundException e) {

Modified: labs/magma/trunk/website-administration/src/main/java/org/apache/magma/website/admin/AdminAction.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-administration/src/main/java/org/apache/magma/website/admin/AdminAction.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/website-administration/src/main/java/org/apache/magma/website/admin/AdminAction.java
(original)
+++ labs/magma/trunk/website-administration/src/main/java/org/apache/magma/website/admin/AdminAction.java
Wed Feb 18 08:13:33 2009
@@ -6,6 +6,7 @@
 import org.apache.magma.beans.MagmaBeanSupport;
 import org.apache.magma.conversion.Converter;
 import org.apache.magma.conversion.Converters;
+import org.apache.magma.website.WebHandler;
 
 public class AdminAction implements Comparable<AdminAction> {
 
@@ -34,7 +35,7 @@
 		if (bean == null || !parametrized) return getUrl();
 		Converter conv = Converters.getConverterFor(bean.getClass());
 		if (conv == null) throw new MagmaException("Cannot find a converter for {0}", bean.getClass());
-		return getUrl() + ";" + conv.toString(bean); 
+		return getUrl() + WebHandler.paramSeparator + conv.toString(bean); 
 	}
 	
 	@Override

Modified: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java
(original)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java
Wed Feb 18 08:13:33 2009
@@ -13,6 +13,7 @@
 import org.apache.magma.view.tree.FieldNode;
 import org.apache.magma.view.tree.Node;
 import org.apache.magma.view.tree.ViewCustomizer;
+import org.apache.magma.website.WebHandler;
 
 public class SmartListProducer extends ShowList {
 
@@ -119,7 +120,7 @@
 		ret.append("</div>");
 		ret.append("<div class=\"PaginationNavigation\">");
 		if (start > 0) {
-			ret.append(" <a class=\"PaginationPrevious\" href=\"start;" + Math.max(0, start - len)
+ "\">");
+			ret.append(" <a class=\"PaginationPrevious\" href=\"start" + WebHandler.paramSeparator
+ Math.max(0, start - len) + "\">");
 			ret.append(new LocalizableString("Previous page"));
 			ret.append("</a>");
 		}
@@ -127,11 +128,11 @@
 		int po = Math.max(-3, currentpage * -1);
 		while (po < 7 && currentpage + po <= totalpage) {
 			if (po == 0) {
-				ret.append(" <b>");
+				ret.append(" <strong>");
 				ret.append(Integer.toString(currentpage + 1));
-				ret.append("</b> ");
+				ret.append("</strong> ");
 			} else {
-				ret.append(" <a href=\"start;" + Math.max(0, start + (len * po)) + "\">");
+				ret.append(" <a href=\"start" + WebHandler.paramSeparator + Math.max(0, start + (len
* po)) + "\">");
 				ret.append(Integer.toString(currentpage + po + 1));
 				ret.append("</a> ");
 			}
@@ -140,7 +141,7 @@
 		ret.append("</span>");
 		
 		if (start + len < count) {
-			ret.append(" <a class=\"PaginationNext\" href=\"start;" + Math.max(0, start + len)
+ "\">");
+			ret.append(" <a class=\"PaginationNext\" href=\"start" + WebHandler.paramSeparator
+ Math.max(0, start + len) + "\">");
 			ret.append(new LocalizableString("Next page"));
 			ret.append("</a>");
 		}
@@ -156,15 +157,15 @@
 		if (sortables != null && (sortables != null && sortables.contains(fldn.getId())))
{
 			boolean sorted = this.sorting != null && this.sorting.equals(fldn.getId()); 
 			tables.write("<th class=\"MagmaList-HeaderCell " + fldn.getId() + " Sortable" + (sorted
? "Sorted" : "") + "\">");
-			String link = "sort;";
+			String link = "sort" + WebHandler.paramSeparator;
 			if (sorted) {
 				if (desc) {
-					link += "false;";
+					link += "false" + WebHandler.paramSeparator;
 				} else {
-					link += "true;";
+					link += "true" + WebHandler.paramSeparator;
 				}
 			} else {
-				link += "false;";				
+				link += "false" + WebHandler.paramSeparator;				
 			}
 			link += fldn.getId();
 			tables.write("<a href=\"" + link + "\">");
@@ -180,6 +181,7 @@
 				tables.write(new LocalizableString("sort").toString());
 				tables.write("\"/>");
 			}
+			tables.write("</a>");
 			tables.write("</th>");					
 		} else {
 			super.createFieldNodeHeader(fldn, tables);

Modified: labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java?rev=745418&r1=745417&r2=745418&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java
(original)
+++ labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java
Wed Feb 18 08:13:33 2009
@@ -23,6 +23,7 @@
 import java.util.List;
 
 import org.junit.Test;
+import static org.apache.magma.website.beansview.AssertStringStructure.assertStructure;
 
 
 public class ShowListTest {
@@ -45,6 +46,7 @@
 		
 		String result = new String(baos.toByteArray());
 
+		assertStructure(result, "<table","<tr","<td", "Simone", "</td", "<td", "Gianni",
"</table");
 		System.out.println(result);
 		
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message