List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:December 5 2007 7:15am
Subject:Rev 327: Added rules to build javadocs. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 327
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Tue 2007-12-04 23:15:13 -0800
message:
  Added rules to build javadocs. 
  Removed ndbj.util - unusued.
removed:
  java/com/mysql/cluster/ndbj/util/ util-20070517181935-98huwjarzuh25b30-31
  java/com/mysql/cluster/ndbj/util/NdbConfigurator.java
ndbconfigurator.java-20070517181935-98huwjarzuh25b30-63
modified:
  acinclude.m4                   acinclude.m4-20070228020914-u2pk759xg7thauwf-8
  java/.classpath                classpath-20071116042946-npnq9g3hwm24x1ga-1
  java/Makefile.am               makefile.am-20070415032352-9dpe6aurqcnuwcrd-1
  m4/java.m4                     java.m4-20071024032738-xuzaza2fu10nw2lr-1
=== removed directory 'java/com/mysql/cluster/ndbj/util'
=== removed file 'java/com/mysql/cluster/ndbj/util/NdbConfigurator.java'
--- a/java/com/mysql/cluster/ndbj/util/NdbConfigurator.java	2007-09-14 07:54:14 +0000
+++ b/java/com/mysql/cluster/ndbj/util/NdbConfigurator.java	1970-01-01 00:00:00 +0000
@@ -1,225 +0,0 @@
-package com.mysql.cluster.ndbj.util;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.net.Authenticator;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.PasswordAuthentication;
-import java.net.URL;
-import java.util.Properties;
-
-import com.mysql.cluster.ndbj.NdbApiException;
-
-/**
- * 
- * The NdbConfigurator is a utility class that can be used
- * to help configure a cluster using a properties file.
- * <br>Usage:
- * <code>
- * <br>NdbConfigurator.loadParamsFromConfigFile("ndbj.props");
- * <br>...
- * <br>NdbClusterConnectionRef conn =
NdbFactoryRef.createNdbClusterConnection(NdbConfigurator.CONNECSTRING);
- * <br>NdbRef ndb= con.createNdb(NdbConfigurator.DB_NAME); 
- * <br>
- * <br>NdbConfigurator.createTable("......");
- * @author jdowling
- */
-public class NdbConfigurator
-{
-	static String CONFIG_FILENAME="";
-	static String CONNECTSTRING="";
-	static String LIB_PATH = "";
-	static String DB_NAME="";
-	static String MODE="development";
-
-	/**
-	 * HTTP Proxy Settings
-	 */
-    protected static String proxyHost 		= null;
-    protected static int 	port        	= 8080;
-	protected static String proxyUsername	= null;
-	protected static String proxyPassword	= null;
-
-
-
-	static void loadParamsFromConfigFile(String configFileName)
-	throws NdbApiException
-	{
-		CONFIG_FILENAME=configFileName;
-		File f =null;
-		try {
-			InputStream in=null;
-			f = new File(CONFIG_FILENAME);
-			if (f.exists()){
-				if (f.canRead()){
-					in = new FileInputStream(f);
-					}
-				else {
-					System.err.println("Could not open " + CONFIG_FILENAME);
-					System.exit(-1);
-					}
-				}
-			else {
-				System.err.println("Could not find " + CONFIG_FILENAME);
-				System.exit(-1);
-				}
-		    loadProperties(in);
-		}
-		catch (java.io.FileNotFoundException e) {
-			System.err.println(e.getMessage());
-		}
-		catch (NdbApiException e) {
-			System.out.print(e.getStackTrace());
-			System.err.println(e.getMessage());
-		}
-	}
-
-
-	/**
-	 * Loads parameters from a local file ("config/crl.props")
-	 * Can be overriden - e.g., getting the parameters from a central server
-	 * @throws CRLParamsException
-	 */
-	void loadParamsFromURL(String url) throws NdbApiException {
-		try {
-			URL server = new URL(url);
-
-			if (proxyUsername != null && proxyPassword != null) {
-				Authenticator.setDefault(new SimpleAuthenticator(
-						proxyUsername,proxyPassword));
-//				if (proxy != null) {
-//					dnsWorkAround();
-//				}
-			}
-
-			Properties systemProperties = System.getProperties();
-			if (proxyHost != null) {
-				systemProperties.setProperty("http.proxyHost",proxyHost);
-				systemProperties.setProperty("http.proxyPort",Integer.toString(port));
-			}
-			HttpURLConnection connection = (
-				    HttpURLConnection)server.openConnection();
-			connection.connect();
-
-			InputStream in = connection.getInputStream();
-			// set up new properties object from file "myProperties.txt"
-
-			BufferedInputStream bufIn= new BufferedInputStream(in);
-
-		    Properties p = new Properties(System.getProperties());
-		    p.load(bufIn);
-
-	        System.setProperties(p);
-	        System.getProperties().list(System.out);
-
-		}
-		catch (MalformedURLException e) {
-			throw new NdbApiException(e.toString());
-		}
-		catch (IOException e) {
-			throw new NdbApiException(e.toString());
-		}
-		catch (NullPointerException e) {
-			throw new NdbApiException(e.toString());
-		}
-		catch (IllegalArgumentException e) {
-			throw new NdbApiException(e.toString());
-		}
-		catch (SecurityException e) {
-			throw new NdbApiException(e.toString());
-		}
-	}
-
-	static void setHttpProxy(String hostname, int portNumber, String username, String
password) {
-		proxyHost=hostname;
-		port=portNumber;
-		proxyUsername=username;
-		proxyPassword=password;
-	}
-
-	static void loadProperties(InputStream in)
-	throws NdbApiException {
-
-		boolean libPathSet=true;
-		Properties p = new Properties(System.getProperties());
-
-		try {
-			p.load(in);
-
-			// set the system properties
-	        System.setProperties(p);
-
-			NdbConfigurator.CONNECTSTRING= System.getProperty("ndbj.connectstring");
-			if (NdbConfigurator.CONNECTSTRING == null) {
-				System.out.println("ndbj.connectstring not defined in configuration file: + " +
CONFIG_FILENAME);
-			}
-
-			NdbConfigurator.DB_NAME= System.getProperty("ndbj.testDatabase");
-			if (NdbConfigurator.DB_NAME == null) {
-				System.out.println("ndbj.testDatabase was empty. Setting it to 'test' db.");
-			}
-
-			NdbConfigurator.LIB_PATH= System.getProperty("ndbj.libpath");
-			if (NdbConfigurator.LIB_PATH == null) {
-				libPathSet=false;
-			}
-		}
-		catch (java.io.IOException e) {
-			throw new NdbApiException(e.getMessage());
-			}
-		catch (NullPointerException e) {
-			throw new NdbApiException(e.getMessage());
-			}
-		catch (IllegalArgumentException e) {
-			throw new NdbApiException(e.getMessage());
-		}
-		catch (SecurityException e) {
-			throw new NdbApiException(e.getMessage());
-		}
-
-		if (libPathSet == true) {
-			Class clazz = ClassLoader.class;
-		    Field field;
-		    boolean accessible;
-		    try {
-			    field = clazz.getDeclaredField("sys_paths");
-			    accessible = field.isAccessible();
-			    if (!accessible) {
-			    	field.setAccessible(true);
-			    }
-			    field.set(clazz, null);
-			    System.setProperty("java.library.path", LIB_PATH);
-		    }
-		    catch (NoSuchFieldException e) {
-		        throw new NdbApiException(e.getMessage());
-		    }
-		    catch (IllegalAccessException e) {
-		    	throw new NdbApiException(e.getMessage());
-		    }
-		}
-	}
-	private class SimpleAuthenticator
-	   extends Authenticator
-	{
-	   private String username,
-	                  password;
-
-	   public SimpleAuthenticator(String username,String password)
-	   {
-	      this.username = username;
-	      this.password = password;
-	   }
-
-	   protected PasswordAuthentication getPasswordAuthentication()
-	   {
-	      return new PasswordAuthentication(
-	             username,password.toCharArray());
-	   }
-
-	}
-}

=== modified file 'acinclude.m4'
--- a/acinclude.m4	2007-11-27 10:49:07 +0000
+++ b/acinclude.m4	2007-12-05 07:15:13 +0000
@@ -104,6 +104,8 @@
     AS_IF([test "x$JAVAC" = "x"],AC_MSG_ERROR([Couldn't find javac.]))
     AC_PROG_JAR()
     AS_IF([test "x$JAR" = "x"],AC_MSG_ERROR([Couldn't find jar.]))
+    AC_PROG_JAVADOC()
+    AS_IF([test "x$JAVADOC" = "x"],AC_MSG_ERROR([Couldn't find javadoc.]))
     AC_CHECK_PROGS(ANT,ant)
     AS_IF([test "x$ANT" = "x"],AC_MSG_ERROR([Couldn't find ant.]))
     AC_CHECK_JUNIT()

=== modified file 'java/.classpath'
--- a/java/.classpath	2007-11-24 04:14:32 +0000
+++ b/java/.classpath	2007-12-05 07:15:13 +0000
@@ -5,8 +5,8 @@
 			<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"
value="ndbj-devel/.libs"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="lib" path="lib/mysql-connector-java-5.0.4-bin.jar"/>
 	<classpathentry kind="lib" path="/usr/share/java/junit.jar"/>
 	<classpathentry kind="lib" path="/usr/lib/jvm/java-6-sun/jre/lib/rt.jar"/>
+	<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.5-bin.jar"/>
 	<classpathentry kind="output" path=""/>
 </classpath>

=== modified file 'java/Makefile.am'
--- a/java/Makefile.am	2007-12-05 06:37:22 +0000
+++ b/java/Makefile.am	2007-12-05 07:15:13 +0000
@@ -1,5 +1,6 @@
 package_namespace=com/mysql/cluster
 builddir=.
+classpath=$(srcdir):$(builddir):$(builddir)/lib/mysql-connector-java-5.1.5-bin.jar:$(builddir)/lib/junit.jar
 package_builddir=$(builddir)/$(package_namespace)
 package_srcdir=$(srcdir)/$(package_namespace)
 ndbapi_examples_dir=$(package_namespace)/ndbapi/examples
@@ -126,7 +127,6 @@
 	${package_srcdir}/ndbj/examples/TestBaseCallback.java \
 	${package_srcdir}/ndbj/examples/TestEvent.java \
 	${package_srcdir}/ndbj/examples/UpdateUsingPrimaryKey.java \
-	${package_srcdir}/ndbj/util/NdbConfigurator.java \
 	${srcdir}/testsuite/BaseNdbjTestCase.java \
 	${srcdir}/testsuite/BaseTestCase.java \
 	${srcdir}/testsuite/TestCallback.java \
@@ -211,7 +211,6 @@
 	${package_builddir}/ndbj/examples/TestBaseCallback.class \
 	${package_builddir}/ndbj/examples/TestEvent.class \
 	${package_builddir}/ndbj/examples/UpdateUsingPrimaryKey.class \
-	${package_builddir}/ndbj/util/NdbConfigurator.class \
 	${builddir}/testsuite/BaseNdbjTestCase.class \
 	${builddir}/testsuite/BaseTestCase.class \
 	${builddir}/testsuite/TestCallback.class \
@@ -309,7 +308,7 @@
 all-local: ndbj.jar  mgmj.jar
 
 clean-local:
-	@rm -f swig-stamp
+	@rm -rf swig-stamp javadoc junit html
 
 SUFFIXES = .cxx .i
 
@@ -335,22 +334,27 @@
 # $(NDBAPI_JAVA_CLASSES) $(MGMAPI_JAVA_CLASSES)
 mgmj.jar: libmgmj.la $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
 	@echo "Building MGM/J java files"
-	@$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.1.5-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir)  $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
+	@$(JAVAC) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d $(builddir) 
$(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
 	@echo "Building mgmj.jar"
 	@$(JAR) cf $@ $(MGMAPI_JAVA_CLASSES) ${package_builddir}/ndbj/*\$$*class
 
 ndbj.jar: libndbj.la $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J)
 	@echo "Building NDB/J java files"
-	@$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.1.5-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir)  $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J) 
+	@$(JAVAC) -classpath $(classpath) -sourcepath $(srcdir):$(builddir) -d $(builddir) 
$(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J) 
 	@echo "Building ndbj.jar"
 	@$(JAR) cf $@ ${NDBAPI_JAVA_CLASSES} ${package_builddir}/ndbj/*\$$*class
 
 check-local: all-am
-	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath
$(builddir):$(builddir)/lib/mysql-connector-java-5.1.5-bin.jar:$(builddir)/lib/junit.jar 
junit.textui.TestRunner testsuite.ndbj.AllTests
-	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath
$(builddir):$(builddir)/lib/mysql-connector-java-5.1.5-bin.jar:$(builddir)/lib/junit.jar 
junit.textui.TestRunner testsuite.mgmj.AllTests
+	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath $(classpath) 
junit.textui.TestRunner testsuite.ndbj.AllTests
+	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath $(classpath)
junit.textui.TestRunner testsuite.mgmj.AllTests
 
 install-exec-local: ndbj.jar mgmj.jar
 	mkdir -p $(DESTDIR)$(datadir)/java
 	cp ndbj.jar $(DESTDIR)$(datadir)/java/ndbj-$(PACKAGE_VERSION).jar
 	cp mgmj.jar $(DESTDIR)$(datadir)/java/mgmj-$(PACKAGE_VERSION).jar
 	( cd $(DESTDIR)$(datadir)/java ; ln -s ndbj-$(PACKAGE_VERSION).jar ndbj.jar ; ln -sf
mgmj-$(PACKAGE_VERSION).jar mgmj.jar ) 
+
+javadoc: ndbj.jar
+	@echo "Building javadocs"
+	$(JAVADOC) -use -windowtitle "NDB/Connectors - Java" -classpath $(classpath) -sourcepath
$(srcdir):$(builddir) -d $(builddir)/html com.mysql.cluster.mgmj com.mysql.cluster.ndbj
+

=== modified file 'm4/java.m4'
--- a/m4/java.m4	2007-10-24 03:27:43 +0000
+++ b/m4/java.m4	2007-12-05 07:15:13 +0000
@@ -194,6 +194,14 @@
 AC_PROVIDE([$0])dnl
 ])
 
+AC_DEFUN([AC_PROG_JAVADOC], [
+  AC_REQUIRE([AC_EXEEXT])
+  AC_REQUIRE([AC_CHECK_JAVA_VENDOR])
+
+  AC_PATH_PROG([JAVADOC],[javadoc$EXEEXT],[no],[$JAVA_BIN])
+AC_PROVIDE([$0])dnl
+])
+
 
 AC_DEFUN([AC_CHECK_JNI_COMPILE], [
   AC_REQUIRE([AC_CHECK_JAVA_LDFLAGS])

Thread
Rev 327: Added rules to build javadocs. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor5 Dec