changeset 272:eb27e765affb

rename Io.protocols to Io.schemes and "class:" to "java:" git-svn-id: https://luan-java.googlecode.com/svn/trunk@273 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 31 Oct 2014 04:50:24 +0000
parents 82a3ebcfbafa
children 073044e3ac03
files core/src/luan/modules/IoLuan.java core/src/luan/modules/Time.luan dist/jars/luan-core-trunk.jar dist/jars/luan-logging-trunk.jar dist/jars/luan-lucene-trunk.jar dist/jars/luan-mail-trunk.jar dist/jars/luan-web-trunk.jar logging/src/luan/modules/logging/Logging.luan lucene/src/luan/modules/lucene/Lucene.luan mail/src/luan/modules/mail/Mail.luan web/src/luan/modules/web/Http.luan web/src/luan/modules/web/Web_server.luan web/src/luan/modules/web/test.luan
diffstat 13 files changed, 50 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/modules/IoLuan.java	Fri Oct 31 04:27:50 2014 +0000
+++ b/core/src/luan/modules/IoLuan.java	Fri Oct 31 04:50:24 2014 +0000
@@ -40,7 +40,7 @@
 			LuanTable module = Luan.newTable();
 			try {
 				add( module, "read_console_line", String.class );
-				module.put( "protocols", newProtocols() );
+				module.put( "schemes", newSchemes() );
 				add( module, "Uri", LuanState.class, String.class, Boolean.class );
 				module.put( "stdin", stdin.table() );
 				add( module, "socket_server", Integer.TYPE );
@@ -498,7 +498,7 @@
 		return url("https:"+path,loading);
 	}
 
-	public static LuanTable _class(LuanState luan,String path,Boolean loading) throws LuanException {
+	public static LuanTable java(LuanState luan,String path,Boolean loading) throws LuanException {
 		if( !Boolean.TRUE.equals(loading) )
 			return null;
 		final LuanFunction fn = JavaLuan.javaLoader(luan,path);
@@ -523,45 +523,43 @@
 		return (LuanTable)io.get("stdin");
 	}
 
-	private static LuanTable newProtocols() {
-		LuanTable protocols = Luan.newTable();
+	private static LuanTable newSchemes() {
+		LuanTable schemes = Luan.newTable();
 		try {
-			add( protocols, "file", LuanState.class, String.class, Boolean.class );
-			add( protocols, "classpath", LuanState.class, String.class, Boolean.class );
-			add( protocols, "socket", LuanState.class, String.class );
-			add( protocols, "http", String.class, Boolean.class );
-			add( protocols, "https", String.class, Boolean.class );
-			protocols.put( "class", new LuanJavaFunction(
-				IoLuan.class.getMethod( "_class", LuanState.class, String.class, Boolean.class ), null
-			) );
-			add( protocols, "luan", LuanState.class, String.class, Boolean.class );
-			add( protocols, "stdin", LuanState.class );
+			add( schemes, "file", LuanState.class, String.class, Boolean.class );
+			add( schemes, "classpath", LuanState.class, String.class, Boolean.class );
+			add( schemes, "socket", LuanState.class, String.class );
+			add( schemes, "http", String.class, Boolean.class );
+			add( schemes, "https", String.class, Boolean.class );
+			add( schemes, "java", LuanState.class, String.class, Boolean.class );
+			add( schemes, "luan", LuanState.class, String.class, Boolean.class );
+			add( schemes, "stdin", LuanState.class );
 		} catch(NoSuchMethodException e) {
 			throw new RuntimeException(e);
 		}
-		return protocols;
+		return schemes;
 	}
 
-	private static LuanTable protocols(LuanState luan) {
+	private static LuanTable schemes(LuanState luan) {
 		LuanTable t = (LuanTable)PackageLuan.loaded(luan).get("luan:Io");
 		if( t == null )
-			return newProtocols();
-		t = (LuanTable)t.get("protocols");
+			return newSchemes();
+		t = (LuanTable)t.get("schemes");
 		if( t == null )
-			return newProtocols();
+			return newSchemes();
 		return t;
 	}
 
 	public static LuanTable Uri(LuanState luan,String name,Boolean loading) throws LuanException {
 		int i = name.indexOf(':');
 		if( i == -1 )
-			throw luan.exception( "invalid Io name '"+name+"', missing protocol" );
-		String protocol = name.substring(0,i);
+			throw luan.exception( "invalid Io name '"+name+"', missing scheme" );
+		String scheme = name.substring(0,i);
 		String location = name.substring(i+1);
-		LuanTable protocols = protocols(luan);
-		LuanFunction opener = (LuanFunction)protocols.get(protocol);
+		LuanTable schemes = schemes(luan);
+		LuanFunction opener = (LuanFunction)schemes.get(scheme);
 		if( opener == null )
-			throw luan.exception( "invalid protocol '"+protocol+"' in '"+name+"'" );
+			throw luan.exception( "invalid scheme '"+scheme+"' in '"+name+"'" );
 		return (LuanTable)Luan.first(luan.call(opener,"<open \""+name+"\">",new Object[]{location,loading}));
 	}
 
--- a/core/src/luan/modules/Time.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/core/src/luan/modules/Time.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -3,10 +3,10 @@
 import "luan:String"
 import "luan:Table"
 import "luan:Java"
-import "class:java.lang.System"
-import "class:java.util.Calendar"
-import "class:java.util.Date"
-import "class:java.text.SimpleDateFormat"
+import "java:java.lang.System"
+import "java:java.util.Calendar"
+import "java:java.util.Date"
+import "java:java.text.SimpleDateFormat"
 
 
 function now()
Binary file dist/jars/luan-core-trunk.jar has changed
Binary file dist/jars/luan-logging-trunk.jar has changed
Binary file dist/jars/luan-lucene-trunk.jar has changed
Binary file dist/jars/luan-mail-trunk.jar has changed
Binary file dist/jars/luan-web-trunk.jar has changed
--- a/logging/src/luan/modules/logging/Logging.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/logging/src/luan/modules/logging/Logging.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -1,10 +1,10 @@
 import "luan:Java"
-import "class:org.apache.log4j.Logger"
-import "class:org.apache.log4j.EnhancedPatternLayout"
-import "class:org.apache.log4j.ConsoleAppender"
-import "class:org.apache.log4j.Level"
-import "class:org.apache.log4j.RollingFileAppender"
-import "class:luan.modules.logging.LuanLogger"
+import "java:org.apache.log4j.Logger"
+import "java:org.apache.log4j.EnhancedPatternLayout"
+import "java:org.apache.log4j.ConsoleAppender"
+import "java:org.apache.log4j.Level"
+import "java:org.apache.log4j.RollingFileAppender"
+import "java:luan.modules.logging.LuanLogger"
 
 
 layout = "%d %-5p %c - %m%n"
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -1,5 +1,5 @@
 import "luan:Java"
-import "class:luan.modules.lucene.LuceneIndex"
+import "java:luan.modules.lucene.LuceneIndex"
 
 
 function Index(indexDir)
--- a/mail/src/luan/modules/mail/Mail.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/mail/src/luan/modules/mail/Mail.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -1,6 +1,6 @@
 import "luan:Java"
-import "class:java.lang.System"
-import "class:luan.modules.mail.SmtpCon"
+import "java:java.lang.System"
+import "java:luan.modules.mail.SmtpCon"
 
 
 System.setProperty( "mail.mime.charset", "UTF-8" )
--- a/web/src/luan/modules/web/Http.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/web/src/luan/modules/web/Http.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -1,6 +1,6 @@
 import "luan:Java"
 import "luan:Table"
-import "class:luan.modules.web.LuanHandler"
+import "java:luan.modules.web.LuanHandler"
 
 function new_luan_handler()
 	return LuanHandler.new()
--- a/web/src/luan/modules/web/Web_server.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/web/src/luan/modules/web/Web_server.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -4,18 +4,18 @@
 import "luan:Package"
 import "luan:web/Http"
 
-import "class:org.eclipse.jetty.server.Server"
-import "class:org.eclipse.jetty.server.NCSARequestLog"
-import "class:org.eclipse.jetty.server.handler.DefaultHandler"
-import "class:org.eclipse.jetty.server.handler.HandlerList"
-import "class:org.eclipse.jetty.server.handler.HandlerCollection"
-import "class:org.eclipse.jetty.server.handler.ResourceHandler"
-import "class:org.eclipse.jetty.server.handler.RequestLogHandler"
-import "class:org.eclipse.jetty.server.handler.ContextHandler"
-import "class:org.eclipse.jetty.server.handler.GzipHandler"
-import "class:org.eclipse.jetty.server.handler.HandlerWrapper"
-import "class:org.eclipse.jetty.server.session.SessionHandler"
-import "class:luan.modules.web.AuthenticationHandler"
+import "java:org.eclipse.jetty.server.Server"
+import "java:org.eclipse.jetty.server.NCSARequestLog"
+import "java:org.eclipse.jetty.server.handler.DefaultHandler"
+import "java:org.eclipse.jetty.server.handler.HandlerList"
+import "java:org.eclipse.jetty.server.handler.HandlerCollection"
+import "java:org.eclipse.jetty.server.handler.ResourceHandler"
+import "java:org.eclipse.jetty.server.handler.RequestLogHandler"
+import "java:org.eclipse.jetty.server.handler.ContextHandler"
+import "java:org.eclipse.jetty.server.handler.GzipHandler"
+import "java:org.eclipse.jetty.server.handler.HandlerWrapper"
+import "java:org.eclipse.jetty.server.session.SessionHandler"
+import "java:luan.modules.web.AuthenticationHandler"
 
 
 port = 8080
@@ -73,7 +73,7 @@
 function serve(dir)
 	dir = dir.gsub("/$","")  -- remove trailing '/' if any
 	Http.dir = dir
-	function Io.protocols.site(path,loading)
+	function Io.schemes.site(path,loading)
 		return Io.Uri( dir..path, loading )
 	end
 	authentication_handler.setPassword(private_password)
--- a/web/src/luan/modules/web/test.luan	Fri Oct 31 04:27:50 2014 +0000
+++ b/web/src/luan/modules/web/test.luan	Fri Oct 31 04:50:24 2014 +0000
@@ -6,7 +6,7 @@
 	Io.print_to(Io.stderr,...)
 end
 
-function Io.protocols.site(path,loading)
+function Io.schemes.site(path,loading)
 	return Io.Uri( "luan:web"..path, loading )
 end