diff options
author | hq <hq@FreeBSD.org> | 2004-12-18 10:11:35 +0800 |
---|---|---|
committer | hq <hq@FreeBSD.org> | 2004-12-18 10:11:35 +0800 |
commit | 2ee7fff2fac68c3c94711065151b55a2d25d70d3 (patch) | |
tree | c547c409900514bd9405871592be65848811fd0a /java | |
parent | 7b41f9f4b5c67a2912664f1afd69eb2d106be88c (diff) | |
download | freebsd-ports-gnome-2ee7fff2fac68c3c94711065151b55a2d25d70d3.tar.gz freebsd-ports-gnome-2ee7fff2fac68c3c94711065151b55a2d25d70d3.tar.zst freebsd-ports-gnome-2ee7fff2fac68c3c94711065151b55a2d25d70d3.zip |
- rcNGify startup
- Fix table creation for autoincrement feature in Postgresql
PR: 75032
Submitted by: maintainer
Diffstat (limited to 'java')
-rw-r--r-- | java/jboss4/Makefile | 9 | ||||
-rw-r--r-- | java/jboss4/files/daemonctl.c | 103 | ||||
-rw-r--r-- | java/jboss4/files/patch-serial-autoinc | 86 | ||||
-rw-r--r-- | java/jboss4/files/startup.sh | 63 | ||||
-rw-r--r-- | java/jboss5/Makefile | 9 | ||||
-rw-r--r-- | java/jboss5/files/daemonctl.c | 103 | ||||
-rw-r--r-- | java/jboss5/files/patch-serial-autoinc | 86 | ||||
-rw-r--r-- | java/jboss5/files/startup.sh | 63 |
8 files changed, 384 insertions, 138 deletions
diff --git a/java/jboss4/Makefile b/java/jboss4/Makefile index ffd73a00a549..b41a519d58f9 100644 --- a/java/jboss4/Makefile +++ b/java/jboss4/Makefile @@ -7,6 +7,7 @@ PORTNAME= ${APP_TITLE:L} PORTVERSION= 4.0.0 +PORTREVISION= 1 CATEGORIES= java MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} @@ -22,17 +23,18 @@ USE_JAVA= yes JAVA_VERSION= 1.4+ USE_REINPLACE= YES +USE_RC_SUBR= YES USE_BZIP2= YES .if !defined(NOPORTDOCS) PORTDOCS= * .endif -APP_HOME?= ${PREFIX}/${PKGBASE}${PORTVERSION:R} +APP_HOME?= ${PREFIX}/${APP_SHORTNAME} DOCSDIR= ${PREFIX}/share/doc/${PKGBASE}${PORTVERSION:R} LOG_DIR= ${APP_HOME}/log APP_TITLE= JBoss -APP_SHORTNAME= ${PORTNAME}${PORTVERSION:R:R} +APP_SHORTNAME= ${UNIQUENAME} CONTROL_SCRIPT_NAME= ${APP_SHORTNAME}ctl CONTROL_SCRIPT= ${PREFIX}/bin/${CONTROL_SCRIPT_NAME} CONTROL_SCRIPT_MANPAGE_TITLE= ${CONTROL_SCRIPT_NAME:U} @@ -66,6 +68,7 @@ PLIST_FILES= ${CONTROL_SCRIPT:S,^${PREFIX}/,,} \ do-configure: @(cd ${DAEMONCTL_DIR} && ${CP} ${DAEMONCTL_FILES} ${WRKDIR}) @(cd ${WRKDIR} && ${REINPLACE_CMD} \ + -e "s|%%RC_SUBR%%|${RC_SUBR}|g;" \ -e "s|%%APP_HOME%%|${APP_HOME}|g;" \ -e "s|%%APP_SHORTNAME%%|${APP_SHORTNAME}|g;" \ -e "s|%%APP_TITLE%%|${APP_TITLE}|g;" \ @@ -73,8 +76,8 @@ do-configure: -e "s|%%CONTROL_SCRIPT_MANPAGE_TITLE%%|${CONTROL_SCRIPT_MANPAGE_TITLE}|g;" \ -e "s|%%CONTROL_SCRIPT_NAME%%|${CONTROL_SCRIPT_NAME}|g;" \ -e "s|%%GROUP%%|${GROUP}|g;" \ + -e "s|%%JAVA%%|${JAVA}|g;" \ -e "s|%%JAVA_CP%%|${JAVA_CP}|g;" \ - -e "s|%%JAVA_CMD%%|bin/java|g;" \ -e "s|%%JAVA_HOME%%|${JAVA_HOME}|g;" \ -e "s|%%JAVA_MAIN%%|${JAVA_MAIN}|g;" \ -e "s|%%JAVA_OPTS%%|${JAVA_OPTS}|g;" \ diff --git a/java/jboss4/files/daemonctl.c b/java/jboss4/files/daemonctl.c index 383a75fcf69f..619232b272bf 100644 --- a/java/jboss4/files/daemonctl.c +++ b/java/jboss4/files/daemonctl.c @@ -7,7 +7,7 @@ * Original by Ernst de Haan <znerd@freebsd.org> * www/jakarta-tomcat4/files/daemonctl.c * - * $FreeBSD: /tmp/pcvs/ports/java/jboss4/files/Attic/daemonctl.c,v 1.1 2004-06-21 16:42:59 vanilla Exp $ + * $FreeBSD: /tmp/pcvs/ports/java/jboss4/files/Attic/daemonctl.c,v 1.2 2004-12-18 02:11:35 hq Exp $ */ #include <assert.h> @@ -24,6 +24,9 @@ #include <sys/types.h> #include <sys/uio.h> +#define TRUE 1 +#define FALSE 0 + /* The maximum size of the PID file, in bytes */ #define MAX_FILE_SIZE 32 @@ -59,6 +62,12 @@ static void writePID (int file, int pid); static void start (int optcount, char * opts []); static void stop (void); static void restart (int optcount, char * opts []); +static void logOutput (char *); + +/* + Globals + */ +static int isQuiet = FALSE; /** * Main function. This function is called when this program is executed. @@ -97,7 +106,9 @@ main ( jopt = 0; for (i = 1; i < argc; i++) { - if (*argv [i] == '-') + if (strcmp (argv [i], "-q") == 0) + isQuiet = TRUE; + else if (*argv [i] == '-') jopt++; } if (jopt == 0) @@ -108,7 +119,7 @@ main ( jargs = malloc (sizeof (char *) * jopt); for (i = 0; i < argc; i++) { - if (*argv [i] == '-') + if (strcmp (argv [i], "-q") && *argv [i] == '-') jargs [j++] = argv [i]; } } @@ -163,7 +174,7 @@ openPIDFile (void) /* Attempt to open the PID file */ file = open ("%%PID_FILE%%", O_RDWR); if (file < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%PID_FILE%% for reading and writing: "); perror (NULL); exit (ERR_PID_FILE_NOT_FOUND); @@ -198,7 +209,7 @@ readPID ( buffer = (char *) malloc ((MAX_FILE_SIZE + 1) * sizeof (char)); count = read (file, buffer, MAX_FILE_SIZE + 1); if (count > MAX_FILE_SIZE) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: The file %%PID_FILE%% contains more than %d bytes.\n", MAX_FILE_SIZE); exit (ERR_PID_FILE_TOO_LARGE); } @@ -215,12 +226,12 @@ readPID ( /* XXX: Ignore a newline at the end of the file */ hadNewline = 1; } else { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: The file %%PID_FILE%% contains an illegal character (%d) at position %d.\n", c, i); exit (ERR_PID_FILE_CONTAINS_ILLEGAL_CHAR); } } - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); if (count == 0 || (count == 1 && hadNewline == 1)) { return -1; @@ -253,13 +264,13 @@ writePID ( assert (file > 0); assert (pid > 0); - printf (">> Writing PID file..."); + logOutput (">> Writing PID file..."); lseek (file, (off_t) 0, SEEK_SET); ftruncate (file, (off_t) 0); nbytes = asprintf (&buffer, "%d\n", pid); write (file, buffer, nbytes); - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); } @@ -314,10 +325,11 @@ killProcess ( /* Check preconditions */ assert (pid > 0); - printf (">> Terminating process %d...", pid); + if (!isQuiet) + printf (">> Terminating process %d...", pid); result = kill (pid, SIGTERM); if (result < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to kill process %d: ", pid); perror (NULL); exit (ERR_KILL_FAILED); @@ -327,8 +339,8 @@ killProcess ( result = existsProcess (pid); for (waited=0; result == 1 && waited < timeout; waited += interval) { - printf ("."); - fflush (NULL); + logOutput ("."); + fflush (stdout); sleep (interval); result = existsProcess (pid); } @@ -341,10 +353,10 @@ killProcess ( result = kill (pid, SIGKILL); if (result == 0) { forced = 1; - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Process %d did not terminate within %%STOP_TIMEOUT%% sec. Killed.\n", pid); } else if (result != ESRCH) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to kill process %d: ", pid); perror (NULL); exit (ERR_KILL_FAILED); @@ -352,7 +364,7 @@ killProcess ( } if (forced == 0) { - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); } } @@ -372,17 +384,17 @@ start ( struct stat sb; /* Open and read the PID file */ - printf (">> Reading PID file (%%PID_FILE%%)..."); + logOutput (">> Reading PID file (%%PID_FILE%%)..."); file = openPIDFile (); pid = readPID (file); - printf (">> Starting %%APP_TITLE%% %%PORTVERSION%%..."); + logOutput (">> Starting %%APP_TITLE%% %%PORTVERSION%%..."); if (pid != -1) { /* Check if the process actually exists */ result = existsProcess (pid); if (result == 1) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: %%APP_TITLE%% %%PORTVERSION%% is already running, PID is %d.\n", pid); exit (ERR_ALREADY_RUNNING); } @@ -391,34 +403,34 @@ start ( /* Check if the JDK home directory is actually a directory */ result = stat ("%%JAVA_HOME%%", &sb); if (result != 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%: "); perror (NULL); exit (ERR_STAT_JAVA_HOME); } if (!S_ISDIR (sb.st_mode)) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java home directory %%JAVA_HOME%% is not a directory.\n"); exit (ERR_JAVA_HOME_NOT_DIR); } /* Check if the Java command is actually an executable regular file */ - result = stat ("%%JAVA_HOME%%/%%JAVA_CMD%%", &sb); + result = stat ("%%JAVA%%", &sb); if (result != 0) { - printf (" [ FAILED ]\n"); - fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%/%%JAVA_CMD%%: "); + logOutput (" [ FAILED ]\n"); + fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA%%: "); perror (NULL); exit (ERR_STAT_JAVA_CMD); } if (!S_ISREG (sb.st_mode)) { - printf (" [ FAILED ]\n"); - fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not a regular file.\n"); + logOutput (" [ FAILED ]\n"); + fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA%% is not a regular file.\n"); exit (ERR_JAVA_CMD_NOT_FILE); } - result = access ("%%JAVA_HOME%%/%%JAVA_CMD%%", X_OK); + result = access ("%%JAVA%%", X_OK); if (result != 0) { - printf (" [ FAILED ]\n"); - fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not executable: "); + logOutput (" [ FAILED ]\n"); + fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA%% is not executable: "); perror (NULL); exit (ERR_JAVA_CMD_NOT_EXECUTABLE); } @@ -426,7 +438,7 @@ start ( /* Change directory */ result = chdir ("%%APP_HOME%%"); if (result < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to access directory %%APP_HOME%%: "); perror (NULL); exit (ERR_CHDIR_TO_APP_HOME); @@ -435,7 +447,7 @@ start ( /* See if the JAR file exists */ result = access ("%%APP_HOME%%/%%JAR_FILE%%", R_OK); if (result < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to access JAR file %%APP_HOME%%/%%JAR_FILE%%: "); perror (NULL); exit (ERR_ACCESS_JAR_FILE); @@ -444,7 +456,7 @@ start ( /* Open the stdout log file */ stdoutLogFile = open ("%%STDOUT_LOG%%", O_WRONLY); if (stdoutLogFile < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%STDOUT_LOG%% for writing: "); perror (NULL); exit (ERR_STDOUT_LOGFILE_OPEN); @@ -454,7 +466,7 @@ start ( /* Open the stderr log file */ stderrLogFile = open ("%%STDERR_LOG%%", O_WRONLY); if (stderrLogFile < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%STDERR_LOG%% for writing: "); perror (NULL); exit (ERR_STDERR_LOGFILE_OPEN); @@ -464,7 +476,7 @@ start ( /* Split this process in two */ pid = fork (); if (pid == -1) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to fork: "); perror (NULL); exit (ERR_FORK_FAILED); @@ -489,7 +501,7 @@ start ( */ argv = malloc (sizeof (char *) * (optcount + 5)); argc = 0; - argv [argc++] = "%%JAVA_HOME%%/%%JAVA_CMD%%"; + argv [argc++] = "%%JAVA%%"; for (i = 0; i < optcount; i++) argv [argc++] = opts [i]; argv [argc++] = "-cp"; @@ -503,7 +515,7 @@ start ( perror (NULL); } else { - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); writePID (file, pid); } } @@ -519,11 +531,11 @@ stop (void) int pid; /* Open and read the PID file */ - printf (">> Reading PID file (%%PID_FILE%%)..."); + logOutput (">> Reading PID file (%%PID_FILE%%)..."); file = openPIDFile (); pid = readPID (file); - printf (">> Checking if %%APP_TITLE%% %%PORTVERSION%% is running..."); + logOutput (">> Checking if %%APP_TITLE%% %%PORTVERSION%% is running..."); /* If there is a PID, see if the process still exists */ if (pid != -1) { @@ -536,11 +548,11 @@ stop (void) /* If there is no running process, produce an error */ if (pid == -1) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: %%APP_TITLE%% %%PORTVERSION%% is currently not running.\n"); exit (ERR_NOT_RUNNING); } - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); /* Terminate the process */ killProcess (pid); @@ -561,3 +573,14 @@ restart ( stop (); start (optcount, opts); } + +/** + Output log to stdout. + */ +static void +logOutput ( + char * string) +{ + if (!isQuiet) + printf (string); +} diff --git a/java/jboss4/files/patch-serial-autoinc b/java/jboss4/files/patch-serial-autoinc new file mode 100644 index 000000000000..52775eb92c39 --- /dev/null +++ b/java/jboss4/files/patch-serial-autoinc @@ -0,0 +1,86 @@ +$FreeBSD$ + +This patch allows JBoss to correctly create tables when +using the auto-increment feature with Postgresql. + +diff -r -u ./server/src/etc/conf/default/standardjbosscmp-jdbc.xml /tmp/jboss-4.0.0-src/server/src/etc/conf/default/standardjbosscmp-jdbc.xml +--- ./server/src/etc/conf/default/standardjbosscmp-jdbc.xml Thu Sep 16 03:48:58 2004 ++++ /tmp/jboss-4.0.0-src/server/src/etc/conf/default/standardjbosscmp-jdbc.xml Sun Dec 5 22:21:18 2004 +@@ -1169,7 +1169,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 WHERE ?3 ORDER BY ?4 FOR UPDATE</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1</auto-increment-template> ++ <auto-increment-template>?1 serial</auto-increment-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> + <alias-max-length>32</alias-max-length> +@@ -1296,7 +1296,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 WHERE ?3 ORDER BY ?4 FOR UPDATE</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1</auto-increment-template> ++ <auto-increment-template>?1 serial</auto-increment-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> + <alias-max-length>32</alias-max-length> +@@ -1423,7 +1423,7 @@ + <row-locking-template/> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 IDENTITY</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 IDENTITY</auto-increment-template> + <add-column-template>ALTER TABLE ?1 ADD COLUMN ?2 ?3</add-column-template> + <drop-column-template>ALTER TABLE ?1 DROP COLUMN ?2</drop-column-template> + <alias-header-prefix>t</alias-header-prefix> +@@ -1717,7 +1717,7 @@ + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> + --> + <fk-constraint-template>ALTER TABLE ?1 ADD INDEX (?3), ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 auto_increment</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 auto_increment</auto-increment-template> + <alter-column-template>ALTER TABLE ?1 MODIFY ?2 ?3</alter-column-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> +@@ -1857,7 +1857,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 with (updlock) WHERE ?3 ORDER BY ?4</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 IDENTITY</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 IDENTITY</auto-increment-template> + <alter-column-template>ALTER TABLE ?1 ALTER COLUMN ?2 ?3</alter-column-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> +@@ -1989,7 +1989,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 with (xlock) WHERE ?3 ORDER BY ?4</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 IDENTITY</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 IDENTITY</auto-increment-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> + <alias-max-length>32</alias-max-length> +diff -r -u ./server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java /tmp/jboss-4.0.0-src/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java +--- ./server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java Tue Sep 14 09:23:02 2004 ++++ /tmp/jboss-4.0.0-src/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java Sun Dec 5 22:04:56 2004 +@@ -916,14 +916,18 @@ + // apply auto-increment template + if(type.getAutoIncrement()[0]) + { +- String columnClause = SQLUtil.getCreateTableColumnsClause(type); + JDBCFunctionMappingMetaData autoIncrement = + manager.getMetaData().getTypeMapping().getAutoIncrementTemplate(); + if(autoIncrement == null) + { + throw new IllegalStateException("auto-increment template not found"); + } +- String[] args = new String[]{columnClause}; ++ String[] args = new String[] ++ { ++ type.getColumnNames () [0], ++ type.getSQLTypes () [0], ++ type.getNotNull () [0] ? " not null " : "" ++ }; + autoIncrement.getFunctionSql(args, sqlBuffer); + } + else diff --git a/java/jboss4/files/startup.sh b/java/jboss4/files/startup.sh index c94e514690c5..c6690cafd0a6 100644 --- a/java/jboss4/files/startup.sh +++ b/java/jboss4/files/startup.sh @@ -4,32 +4,43 @@ # # %%APP_TITLE%% startup script. # -# $FreeBSD: /tmp/pcvs/ports/java/jboss4/files/Attic/startup.sh,v 1.1 2004-06-21 16:42:59 vanilla Exp $ +# $FreeBSD: /tmp/pcvs/ports/java/jboss4/files/Attic/startup.sh,v 1.2 2004-12-18 02:11:35 hq Exp $ # +# PROVIDE: %%APP_SHORTNAME%% +# REQUIRE: NETWORKING SERVERS -# Set some variables -MYSELF=`basename $0` -JAVA_OPTS="%%JAVA_OPTS%%" - -case "$1" in - start) - echo -n ' ' - truncate -s 0 %%PID_FILE%% - chown %%USER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% ${JAVA_OPTS} start" >/dev/null && echo -n '%%APP_SHORTNAME%%' - ;; - stop) - echo -n ' ' - chown %%USER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% stop" >/dev/null 2>&1 ; echo -n '%%APP_SHORTNAME%%' - ;; - *) - echo "" - echo "Usage: ${MYSELF} { start | stop }" - echo "" - exit 64 - ;; -esac +# Add the following lines to /etc/rc.conf to enable %%APP_SHORTNAME%%: +# %%APP_SHORTNAME%%_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable %%APP_SHORTNAME%% +# %%APP_SHORTNAME%%_flags (str): Set to "-server" by default. +# Extra JVM flags. +# +. %%RC_SUBR%% + +name="%%APP_SHORTNAME%%" +rcvar=`set_rcvar` + +start_cmd="%%APP_SHORTNAME%%_start" +restart_cmd="%%APP_SHORTNAME%%_restart" +pidfile="%%PID_FILE%%" +procname="%%JAVA%%" + +[ -z "$%%APP_SHORTNAME%%_enable" ] && %%APP_SHORTNAME%%_enable="NO" +[ -z "$%%APP_SHORTNAME%%_flags" ] && %%APP_SHORTNAME%%_flags="-server" + +%%APP_SHORTNAME%%_start () +{ + checkyesno %%APP_SHORTNAME%%_enable && + %%CONTROL_SCRIPT%% -q ${%%APP_SHORTNAME%%_flags} start && + echo -n " %%APP_SHORTNAME%%" +} + +%%APP_SHORTNAME%%_restart () +{ + checkyesno %%APP_SHORTNAME%%_enable && + %%CONTROL_SCRIPT%% -q ${%%APP_SHORTNAME%%_flags} restart +} + +load_rc_config $name +run_rc_command "$1" diff --git a/java/jboss5/Makefile b/java/jboss5/Makefile index ffd73a00a549..b41a519d58f9 100644 --- a/java/jboss5/Makefile +++ b/java/jboss5/Makefile @@ -7,6 +7,7 @@ PORTNAME= ${APP_TITLE:L} PORTVERSION= 4.0.0 +PORTREVISION= 1 CATEGORIES= java MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} @@ -22,17 +23,18 @@ USE_JAVA= yes JAVA_VERSION= 1.4+ USE_REINPLACE= YES +USE_RC_SUBR= YES USE_BZIP2= YES .if !defined(NOPORTDOCS) PORTDOCS= * .endif -APP_HOME?= ${PREFIX}/${PKGBASE}${PORTVERSION:R} +APP_HOME?= ${PREFIX}/${APP_SHORTNAME} DOCSDIR= ${PREFIX}/share/doc/${PKGBASE}${PORTVERSION:R} LOG_DIR= ${APP_HOME}/log APP_TITLE= JBoss -APP_SHORTNAME= ${PORTNAME}${PORTVERSION:R:R} +APP_SHORTNAME= ${UNIQUENAME} CONTROL_SCRIPT_NAME= ${APP_SHORTNAME}ctl CONTROL_SCRIPT= ${PREFIX}/bin/${CONTROL_SCRIPT_NAME} CONTROL_SCRIPT_MANPAGE_TITLE= ${CONTROL_SCRIPT_NAME:U} @@ -66,6 +68,7 @@ PLIST_FILES= ${CONTROL_SCRIPT:S,^${PREFIX}/,,} \ do-configure: @(cd ${DAEMONCTL_DIR} && ${CP} ${DAEMONCTL_FILES} ${WRKDIR}) @(cd ${WRKDIR} && ${REINPLACE_CMD} \ + -e "s|%%RC_SUBR%%|${RC_SUBR}|g;" \ -e "s|%%APP_HOME%%|${APP_HOME}|g;" \ -e "s|%%APP_SHORTNAME%%|${APP_SHORTNAME}|g;" \ -e "s|%%APP_TITLE%%|${APP_TITLE}|g;" \ @@ -73,8 +76,8 @@ do-configure: -e "s|%%CONTROL_SCRIPT_MANPAGE_TITLE%%|${CONTROL_SCRIPT_MANPAGE_TITLE}|g;" \ -e "s|%%CONTROL_SCRIPT_NAME%%|${CONTROL_SCRIPT_NAME}|g;" \ -e "s|%%GROUP%%|${GROUP}|g;" \ + -e "s|%%JAVA%%|${JAVA}|g;" \ -e "s|%%JAVA_CP%%|${JAVA_CP}|g;" \ - -e "s|%%JAVA_CMD%%|bin/java|g;" \ -e "s|%%JAVA_HOME%%|${JAVA_HOME}|g;" \ -e "s|%%JAVA_MAIN%%|${JAVA_MAIN}|g;" \ -e "s|%%JAVA_OPTS%%|${JAVA_OPTS}|g;" \ diff --git a/java/jboss5/files/daemonctl.c b/java/jboss5/files/daemonctl.c index c05ce4c78879..8df4f6b05833 100644 --- a/java/jboss5/files/daemonctl.c +++ b/java/jboss5/files/daemonctl.c @@ -7,7 +7,7 @@ * Original by Ernst de Haan <znerd@freebsd.org> * www/jakarta-tomcat4/files/daemonctl.c * - * $FreeBSD: /tmp/pcvs/ports/java/jboss5/files/Attic/daemonctl.c,v 1.1 2004-06-21 16:42:59 vanilla Exp $ + * $FreeBSD: /tmp/pcvs/ports/java/jboss5/files/Attic/daemonctl.c,v 1.2 2004-12-18 02:11:35 hq Exp $ */ #include <assert.h> @@ -24,6 +24,9 @@ #include <sys/types.h> #include <sys/uio.h> +#define TRUE 1 +#define FALSE 0 + /* The maximum size of the PID file, in bytes */ #define MAX_FILE_SIZE 32 @@ -59,6 +62,12 @@ static void writePID (int file, int pid); static void start (int optcount, char * opts []); static void stop (void); static void restart (int optcount, char * opts []); +static void logOutput (char *); + +/* + Globals + */ +static int isQuiet = FALSE; /** * Main function. This function is called when this program is executed. @@ -97,7 +106,9 @@ main ( jopt = 0; for (i = 1; i < argc; i++) { - if (*argv [i] == '-') + if (strcmp (argv [i], "-q") == 0) + isQuiet = TRUE; + else if (*argv [i] == '-') jopt++; } if (jopt == 0) @@ -108,7 +119,7 @@ main ( jargs = malloc (sizeof (char *) * jopt); for (i = 0; i < argc; i++) { - if (*argv [i] == '-') + if (strcmp (argv [i], "-q") && *argv [i] == '-') jargs [j++] = argv [i]; } } @@ -163,7 +174,7 @@ openPIDFile (void) /* Attempt to open the PID file */ file = open ("%%PID_FILE%%", O_RDWR); if (file < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%PID_FILE%% for reading and writing: "); perror (NULL); exit (ERR_PID_FILE_NOT_FOUND); @@ -198,7 +209,7 @@ readPID ( buffer = (char *) malloc ((MAX_FILE_SIZE + 1) * sizeof (char)); count = read (file, buffer, MAX_FILE_SIZE + 1); if (count > MAX_FILE_SIZE) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: The file %%PID_FILE%% contains more than %d bytes.\n", MAX_FILE_SIZE); exit (ERR_PID_FILE_TOO_LARGE); } @@ -215,12 +226,12 @@ readPID ( /* XXX: Ignore a newline at the end of the file */ hadNewline = 1; } else { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: The file %%PID_FILE%% contains an illegal character (%d) at position %d.\n", c, i); exit (ERR_PID_FILE_CONTAINS_ILLEGAL_CHAR); } } - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); if (count == 0 || (count == 1 && hadNewline == 1)) { return -1; @@ -253,13 +264,13 @@ writePID ( assert (file > 0); assert (pid > 0); - printf (">> Writing PID file..."); + logOutput (">> Writing PID file..."); lseek (file, (off_t) 0, SEEK_SET); ftruncate (file, (off_t) 0); nbytes = asprintf (&buffer, "%d\n", pid); write (file, buffer, nbytes); - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); } @@ -314,10 +325,11 @@ killProcess ( /* Check preconditions */ assert (pid > 0); - printf (">> Terminating process %d...", pid); + if (!isQuiet) + printf (">> Terminating process %d...", pid); result = kill (pid, SIGTERM); if (result < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to kill process %d: ", pid); perror (NULL); exit (ERR_KILL_FAILED); @@ -327,8 +339,8 @@ killProcess ( result = existsProcess (pid); for (waited=0; result == 1 && waited < timeout; waited += interval) { - printf ("."); - fflush (NULL); + logOutput ("."); + fflush (stdout); sleep (interval); result = existsProcess (pid); } @@ -341,10 +353,10 @@ killProcess ( result = kill (pid, SIGKILL); if (result == 0) { forced = 1; - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Process %d did not terminate within %%STOP_TIMEOUT%% sec. Killed.\n", pid); } else if (result != ESRCH) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to kill process %d: ", pid); perror (NULL); exit (ERR_KILL_FAILED); @@ -352,7 +364,7 @@ killProcess ( } if (forced == 0) { - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); } } @@ -372,17 +384,17 @@ start ( struct stat sb; /* Open and read the PID file */ - printf (">> Reading PID file (%%PID_FILE%%)..."); + logOutput (">> Reading PID file (%%PID_FILE%%)..."); file = openPIDFile (); pid = readPID (file); - printf (">> Starting %%APP_TITLE%% %%PORTVERSION%%..."); + logOutput (">> Starting %%APP_TITLE%% %%PORTVERSION%%..."); if (pid != -1) { /* Check if the process actually exists */ result = existsProcess (pid); if (result == 1) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: %%APP_TITLE%% %%PORTVERSION%% is already running, PID is %d.\n", pid); exit (ERR_ALREADY_RUNNING); } @@ -391,34 +403,34 @@ start ( /* Check if the JDK home directory is actually a directory */ result = stat ("%%JAVA_HOME%%", &sb); if (result != 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%: "); perror (NULL); exit (ERR_STAT_JAVA_HOME); } if (!S_ISDIR (sb.st_mode)) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java home directory %%JAVA_HOME%% is not a directory.\n"); exit (ERR_JAVA_HOME_NOT_DIR); } /* Check if the Java command is actually an executable regular file */ - result = stat ("%%JAVA_HOME%%/%%JAVA_CMD%%", &sb); + result = stat ("%%JAVA%%", &sb); if (result != 0) { - printf (" [ FAILED ]\n"); - fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%/%%JAVA_CMD%%: "); + logOutput (" [ FAILED ]\n"); + fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA%%: "); perror (NULL); exit (ERR_STAT_JAVA_CMD); } if (!S_ISREG (sb.st_mode)) { - printf (" [ FAILED ]\n"); - fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not a regular file.\n"); + logOutput (" [ FAILED ]\n"); + fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA%% is not a regular file.\n"); exit (ERR_JAVA_CMD_NOT_FILE); } - result = access ("%%JAVA_HOME%%/%%JAVA_CMD%%", X_OK); + result = access ("%%JAVA%%", X_OK); if (result != 0) { - printf (" [ FAILED ]\n"); - fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not executable: "); + logOutput (" [ FAILED ]\n"); + fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA%% is not executable: "); perror (NULL); exit (ERR_JAVA_CMD_NOT_EXECUTABLE); } @@ -426,7 +438,7 @@ start ( /* Change directory */ result = chdir ("%%APP_HOME%%"); if (result < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to access directory %%APP_HOME%%: "); perror (NULL); exit (ERR_CHDIR_TO_APP_HOME); @@ -435,7 +447,7 @@ start ( /* See if the JAR file exists */ result = access ("%%APP_HOME%%/%%JAR_FILE%%", R_OK); if (result < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to access JAR file %%APP_HOME%%/%%JAR_FILE%%: "); perror (NULL); exit (ERR_ACCESS_JAR_FILE); @@ -444,7 +456,7 @@ start ( /* Open the stdout log file */ stdoutLogFile = open ("%%STDOUT_LOG%%", O_WRONLY); if (stdoutLogFile < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%STDOUT_LOG%% for writing: "); perror (NULL); exit (ERR_STDOUT_LOGFILE_OPEN); @@ -454,7 +466,7 @@ start ( /* Open the stderr log file */ stderrLogFile = open ("%%STDERR_LOG%%", O_WRONLY); if (stderrLogFile < 0) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open %%STDERR_LOG%% for writing: "); perror (NULL); exit (ERR_STDERR_LOGFILE_OPEN); @@ -464,7 +476,7 @@ start ( /* Split this process in two */ pid = fork (); if (pid == -1) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to fork: "); perror (NULL); exit (ERR_FORK_FAILED); @@ -489,7 +501,7 @@ start ( */ argv = malloc (sizeof (char *) * (optcount + 5)); argc = 0; - argv [argc++] = "%%JAVA_HOME%%/%%JAVA_CMD%%"; + argv [argc++] = "%%JAVA%%"; for (i = 0; i < optcount; i++) argv [argc++] = opts [i]; argv [argc++] = "-cp"; @@ -503,7 +515,7 @@ start ( perror (NULL); } else { - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); writePID (file, pid); } } @@ -519,11 +531,11 @@ stop (void) int pid; /* Open and read the PID file */ - printf (">> Reading PID file (%%PID_FILE%%)..."); + logOutput (">> Reading PID file (%%PID_FILE%%)..."); file = openPIDFile (); pid = readPID (file); - printf (">> Checking if %%APP_TITLE%% %%PORTVERSION%% is running..."); + logOutput (">> Checking if %%APP_TITLE%% %%PORTVERSION%% is running..."); /* If there is a PID, see if the process still exists */ if (pid != -1) { @@ -536,11 +548,11 @@ stop (void) /* If there is no running process, produce an error */ if (pid == -1) { - printf (" [ FAILED ]\n"); + logOutput (" [ FAILED ]\n"); fprintf (stderr, "%%CONTROL_SCRIPT_NAME%%: %%APP_TITLE%% %%PORTVERSION%% is currently not running.\n"); exit (ERR_NOT_RUNNING); } - printf (" [ DONE ]\n"); + logOutput (" [ DONE ]\n"); /* Terminate the process */ killProcess (pid); @@ -561,3 +573,14 @@ restart ( stop (); start (optcount, opts); } + +/** + Output log to stdout. + */ +static void +logOutput ( + char * string) +{ + if (!isQuiet) + printf (string); +} diff --git a/java/jboss5/files/patch-serial-autoinc b/java/jboss5/files/patch-serial-autoinc new file mode 100644 index 000000000000..52775eb92c39 --- /dev/null +++ b/java/jboss5/files/patch-serial-autoinc @@ -0,0 +1,86 @@ +$FreeBSD$ + +This patch allows JBoss to correctly create tables when +using the auto-increment feature with Postgresql. + +diff -r -u ./server/src/etc/conf/default/standardjbosscmp-jdbc.xml /tmp/jboss-4.0.0-src/server/src/etc/conf/default/standardjbosscmp-jdbc.xml +--- ./server/src/etc/conf/default/standardjbosscmp-jdbc.xml Thu Sep 16 03:48:58 2004 ++++ /tmp/jboss-4.0.0-src/server/src/etc/conf/default/standardjbosscmp-jdbc.xml Sun Dec 5 22:21:18 2004 +@@ -1169,7 +1169,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 WHERE ?3 ORDER BY ?4 FOR UPDATE</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1</auto-increment-template> ++ <auto-increment-template>?1 serial</auto-increment-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> + <alias-max-length>32</alias-max-length> +@@ -1296,7 +1296,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 WHERE ?3 ORDER BY ?4 FOR UPDATE</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1</auto-increment-template> ++ <auto-increment-template>?1 serial</auto-increment-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> + <alias-max-length>32</alias-max-length> +@@ -1423,7 +1423,7 @@ + <row-locking-template/> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 IDENTITY</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 IDENTITY</auto-increment-template> + <add-column-template>ALTER TABLE ?1 ADD COLUMN ?2 ?3</add-column-template> + <drop-column-template>ALTER TABLE ?1 DROP COLUMN ?2</drop-column-template> + <alias-header-prefix>t</alias-header-prefix> +@@ -1717,7 +1717,7 @@ + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> + --> + <fk-constraint-template>ALTER TABLE ?1 ADD INDEX (?3), ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 auto_increment</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 auto_increment</auto-increment-template> + <alter-column-template>ALTER TABLE ?1 MODIFY ?2 ?3</alter-column-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> +@@ -1857,7 +1857,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 with (updlock) WHERE ?3 ORDER BY ?4</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 IDENTITY</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 IDENTITY</auto-increment-template> + <alter-column-template>ALTER TABLE ?1 ALTER COLUMN ?2 ?3</alter-column-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> +@@ -1989,7 +1989,7 @@ + <row-locking-template>SELECT ?1 FROM ?2 with (xlock) WHERE ?3 ORDER BY ?4</row-locking-template> + <pk-constraint-template>CONSTRAINT ?1 PRIMARY KEY (?2)</pk-constraint-template> + <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5)</fk-constraint-template> +- <auto-increment-template>?1 IDENTITY</auto-increment-template> ++ <auto-increment-template>?1 ?2 ?3 IDENTITY</auto-increment-template> + <alias-header-prefix>t</alias-header-prefix> + <alias-header-suffix>_</alias-header-suffix> + <alias-max-length>32</alias-max-length> +diff -r -u ./server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java /tmp/jboss-4.0.0-src/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java +--- ./server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java Tue Sep 14 09:23:02 2004 ++++ /tmp/jboss-4.0.0-src/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java Sun Dec 5 22:04:56 2004 +@@ -916,14 +916,18 @@ + // apply auto-increment template + if(type.getAutoIncrement()[0]) + { +- String columnClause = SQLUtil.getCreateTableColumnsClause(type); + JDBCFunctionMappingMetaData autoIncrement = + manager.getMetaData().getTypeMapping().getAutoIncrementTemplate(); + if(autoIncrement == null) + { + throw new IllegalStateException("auto-increment template not found"); + } +- String[] args = new String[]{columnClause}; ++ String[] args = new String[] ++ { ++ type.getColumnNames () [0], ++ type.getSQLTypes () [0], ++ type.getNotNull () [0] ? " not null " : "" ++ }; + autoIncrement.getFunctionSql(args, sqlBuffer); + } + else diff --git a/java/jboss5/files/startup.sh b/java/jboss5/files/startup.sh index f4033e969eba..b4c87c7ff76f 100644 --- a/java/jboss5/files/startup.sh +++ b/java/jboss5/files/startup.sh @@ -4,32 +4,43 @@ # # %%APP_TITLE%% startup script. # -# $FreeBSD: /tmp/pcvs/ports/java/jboss5/files/Attic/startup.sh,v 1.1 2004-06-21 16:42:59 vanilla Exp $ +# $FreeBSD: /tmp/pcvs/ports/java/jboss5/files/Attic/startup.sh,v 1.2 2004-12-18 02:11:35 hq Exp $ # +# PROVIDE: %%APP_SHORTNAME%% +# REQUIRE: NETWORKING SERVERS -# Set some variables -MYSELF=`basename $0` -JAVA_OPTS="%%JAVA_OPTS%%" - -case "$1" in - start) - echo -n ' ' - truncate -s 0 %%PID_FILE%% - chown %%USER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% ${JAVA_OPTS} start" >/dev/null && echo -n '%%APP_SHORTNAME%%' - ;; - stop) - echo -n ' ' - chown %%USER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - su -f -m %%USER%% -c "exec %%CONTROL_SCRIPT%% stop" >/dev/null 2>&1 ; echo -n '%%APP_SHORTNAME%%' - ;; - *) - echo "" - echo "Usage: ${MYSELF} { start | stop }" - echo "" - exit 64 - ;; -esac +# Add the following lines to /etc/rc.conf to enable %%APP_SHORTNAME%%: +# %%APP_SHORTNAME%%_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable %%APP_SHORTNAME%% +# %%APP_SHORTNAME%%_flags (str): Set to "-server" by default. +# Extra JVM flags. +# +. %%RC_SUBR%% + +name="%%APP_SHORTNAME%%" +rcvar=`set_rcvar` + +start_cmd="%%APP_SHORTNAME%%_start" +restart_cmd="%%APP_SHORTNAME%%_restart" +pidfile="%%PID_FILE%%" +procname="%%JAVA%%" + +[ -z "$%%APP_SHORTNAME%%_enable" ] && %%APP_SHORTNAME%%_enable="NO" +[ -z "$%%APP_SHORTNAME%%_flags" ] && %%APP_SHORTNAME%%_flags="-server" + +%%APP_SHORTNAME%%_start () +{ + checkyesno %%APP_SHORTNAME%%_enable && + %%CONTROL_SCRIPT%% -q ${%%APP_SHORTNAME%%_flags} start && + echo -n " %%APP_SHORTNAME%%" +} + +%%APP_SHORTNAME%%_restart () +{ + checkyesno %%APP_SHORTNAME%%_enable && + %%CONTROL_SCRIPT%% -q ${%%APP_SHORTNAME%%_flags} restart +} + +load_rc_config $name +run_rc_command "$1" |