You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/20 20:54:23 UTC
svn commit: r817078 - in /commons/sandbox/runtime/trunk: ./
src/main/java/org/apache/commons/runtime/
src/main/java/org/apache/commons/runtime/platform/darwin/
src/main/java/org/apache/commons/runtime/platform/hpux/
src/main/java/org/apache/commons/run...
Author: mturk
Date: Sun Sep 20 18:54:22 2009
New Revision: 817078
URL: http://svn.apache.org/viewvc?rev=817078&view=rev
Log:
Add native .so jar packaging support
Added:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/DefaultProperties.properties (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/DefaultProperties.properties (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/linux/DefaultProperties.properties (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/DefaultProperties.properties (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/DefaultProperties.properties (with props)
commons/sandbox/runtime/trunk/src/task/
commons/sandbox/runtime/trunk/src/task/org/
commons/sandbox/runtime/trunk/src/task/org/apache/
commons/sandbox/runtime/trunk/src/task/org/apache/commons/
commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/
commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java (with props)
Modified:
commons/sandbox/runtime/trunk/build.xml
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OsType.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SystemId.java
commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java
Modified: commons/sandbox/runtime/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/build.xml?rev=817078&r1=817077&r2=817078&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/build.xml (original)
+++ commons/sandbox/runtime/trunk/build.xml Sun Sep 20 18:54:22 2009
@@ -69,6 +69,12 @@
<pathelement location="${commons-logging.jar}"/>
</path>
+ <!-- Ant tasks classpath -->
+ <path id="task.classpath">
+ <pathelement location="${build.dest}/java"/>
+ <pathelement location="${build.dest}/task"/>
+ </path>
+
<!-- Examples classpath -->
<path id="examples.classpath">
<pathelement location="${build.dest}/java"/>
@@ -186,9 +192,37 @@
</target>
<!-- =================================================================== -->
+ <!-- Compiles the task directory -->
+ <!-- =================================================================== -->
+ <target name="tasks" depends="compile">
+ <mkdir dir="${build.dest}/task"/>
+ <mkdir dir="${build.src}/task"/>
+ <copy todir="${build.src}/task" filtering="yes">
+ <fileset dir="${src.dir}/task">
+ <include name="**/*.java"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+ <javac srcdir="${build.src}/task"
+ destdir="${build.dest}/task"
+ debug="${compile.debug}"
+ source="${compile.source}"
+ target="${compile.target}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}">
+ <classpath refid="task.classpath"/>
+ </javac>
+ <taskdef name="systemid"
+ classname="org.apache.commons.runtime.SystemIdTask">
+ <classpath refid="task.classpath"/>
+ </taskdef>
+ </target>
+
+ <!-- =================================================================== -->
<!-- Compiles the examples directory -->
<!-- =================================================================== -->
- <target name="examples" depends="compile">
+ <target name="examples" depends="tasks">
<mkdir dir="${build.dest}"/>
<mkdir dir="${build.dest}/examples"/>
<mkdir dir="${build.src}"/>
@@ -233,14 +267,15 @@
<!-- ================================================================== -->
<!-- Make the library jar -->
<!-- ================================================================== -->
- <target name="jar" depends="compile"
+ <target name="jar" depends="tasks"
description="Generates the Jar file">
+ <systemid prefix="system" />
<jar
destfile="${build.dir}/${final.name}.jar"
- basedir="${build.dir}/bin/java"
- excludes="**/*.java">
+ basedir="${build.dest}/java"
+ excludes="**/*.${system.so}" >
<manifest>
- <section name="${runtime.attributes.base}/">
+ <section name="${runtime.attributes.base}">
<attribute name="Specification-Title" value="Apache Commons Runtime library"/>
<attribute name="Specification-Version" value="${implementation}"/>
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
@@ -249,30 +284,47 @@
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Version" value="${version} (build ${DSTAMP} ${TSTAMP})"/>
</section>
- <!-- Native libraries subsections
- TODO: Figure out some smarter way to generate them.
- Probably via some embedded Ant extension.
- -->
- <section name="${runtime.attributes.base}/.libs/linux/ia32">
- <attribute name="Library" value="${runtime.libname}.so"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Make the native library jar -->
+ <!-- ================================================================== -->
+ <target name="native-jar" depends="tasks"
+ description="Generates the Jar file">
+ <systemid prefix="system" />
+ <copy todir="${build.dest}/java/${runtime.attributes.base}/platform/${system.os}">
+ <fileset dir="${runtime.library.path}">
+ <include name="*.${system.so}"/>
+ </fileset>
+ </copy>
+ <jar
+ destfile="${build.dir}/${final.name}-${system.os}-${system.cpu}.jar"
+ basedir="${build.dest}/java" >
+ <manifest>
+ <section name="${runtime.attributes.base}">
+ <attribute name="Specification-Title" value="Apache Commons Runtime library"/>
+ <attribute name="Specification-Version" value="${implementation}"/>
+ <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
+ <attribute name="Implementation-Title" value="org.apache.commons.runtime"/>
+ <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
+ <attribute name="Implementation-Vendor-Id" value="org.apache"/>
+ <attribute name="Implementation-Version" value="${version} (build ${DSTAMP} ${TSTAMP})"/>
</section>
- <section name="${runtime.attributes.base}/.libs/linux/x86_64">
- <attribute name="Library" value="${runtime.libname}.so"/>
+ <section name="${runtime.attributes.base}/platform">
+ <attribute name="Operating-System" value="${runtime.libname}.${system.os}"/>
+ <attribute name="Machine" value="${runtime.libname}.${system.cpu}"/>
+ <attribute name="Library" value="${runtime.libname}.${system.so}"/>
</section>
</manifest>
- <!-- Include native libraries. (Naming will change)
- <metainf dir="${runtime.natives.path}/">
- <include name=".libs"/>
- <include name=".libs/**"/>
- </metainf>
- -->
</jar>
</target>
<!-- =================================================================== -->
<!-- Compiles the test directory -->
<!-- =================================================================== -->
- <target name="tests" depends="compile">
+ <target name="tests" depends="tasks">
<mkdir dir="${build.dest}/test"/>
<mkdir dir="${build.src}/test"/>
<copy todir="${build.src}/test" filtering="yes">
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OsType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OsType.java?rev=817078&r1=817077&r2=817078&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OsType.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OsType.java Sun Sep 20 18:54:22 2009
@@ -26,52 +26,57 @@
/**
* Operating system is Microsoft Windows family
* operating system..
- * <br/>Defined integer value is: {@code 0x1000}
+ * <br/>Defined integer value is: {@code 0x10000}
*/
- WINDOWS( 0x1000),
+ WINDOWS( 0x10000),
/**
* Operating system is Microsoft Windows 64.
- * <br/>Defined integer value is: {@code 0x1001}
+ * <br/>Defined integer value is: {@code 0x10010}
*/
- WIN64( 0x1001),
+ WIN64( 0x10010),
/**
* Operating system is Microsoft Windows 64 running 32-bit JVM.
- * <br/>Defined integer value is: {@code 0x1002}
+ * <br/>Defined integer value is: {@code 0x10020}
*/
- WOW64( 0x1002),
+ WOW64( 0x10020),
/**
* Operating system is unix family operating system.
- * <br/>Defined integer value is: {@code 0x2000}
+ * <br/>Defined integer value is: {@code 0x20000}
*/
- UNIX( 0x2000),
+ UNIX( 0x20000),
/**
* Operating system is Linux.
- * <br/>Defined integer value is: {@code 0x2001}
+ * <br/>Defined integer value is: {@code 0x20100}
*/
- LINUX( 0x2001),
+ LINUX( 0x20100),
/**
* Operating system is Sun Solaris.
- * <br/>Defined integer value is: {@code 0x2002}
+ * <br/>Defined integer value is: {@code 0x20200}
*/
- SOLARIS( 0x2002),
+ SOLARIS( 0x20200),
/**
* Operating system is Apple Mac OS X.
- * <br/>Defined integer value is: {@code 0x2004}
+ * <br/>Defined integer value is: {@code 0x20400}
*/
- DARWIN( 0x2004),
+ DARWIN( 0x20400),
/**
* Operating system is Hewlett Packard HP-UX.
- * <br/>Defined integer value is: {@code 0x2008}
+ * <br/>Defined integer value is: {@code 0x20800}
*/
- HPUX( 0x2008);
+ HPUX( 0x20800),
+ /**
+ * Operating system is IBM AIX.
+ * <br/>Defined integer value is: {@code 0x21000}
+ */
+ AIX( 0x21000);
private int value;
private OsType(int v)
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SystemId.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SystemId.java?rev=817078&r1=817077&r2=817078&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SystemId.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SystemId.java Sun Sep 20 18:54:22 2009
@@ -16,6 +16,7 @@
package org.apache.commons.runtime;
+import java.util.EnumSet;
import java.util.Properties;
/**
@@ -24,22 +25,6 @@
* <p>
* Used when extracting the native libraries from the .jar to find
* the correct path of dynamic shared library and its dependencies.
- * <pre>
- * Constructed path for native libraries:
- *
- * Example for Linux using 64-bit JVM on x86_64 cpu
- *
- * org/apache/commons/runtime/resources/200111.loader
- * extension = so
- * dependencies = libcrypto, libssl
- * libcrypto = libcrypto.so.0.9.8 libcrypto.so.8
- * libssl = libssl.so.0.9.8 libssl.so.8
- *
- * org/apache/commons/runtime/resources/200111.00.bin -> /tmp/.xyz/libacr.so
- * org/apache/commons/runtime/resources/200111.01.bin -> /tmp/.xyz/libcrypto.so
- * org/apache/commons/runtime/resources/200111.02.bin -> /tmp/.xyz/libssl.so
- *
- * </pre>
* </p>
*
* @see Os
@@ -48,12 +33,12 @@
public final class SystemId
{
- private Properties props;
+ private static Properties props;
+ private SystemId() {
+ // No instance
+ }
- /**
- * Default constructor
- */
- public SystemId() {
+ static {
props = System.getProperties();
}
@@ -62,7 +47,7 @@
* @return {@code String} representing the operating system
* this {@code JVM} is running on.
*/
- public String getSysname() {
+ public static String getSysname() {
String name = props.getProperty("os.name");
String platform = "unknown";
@@ -91,7 +76,7 @@
* @return {@code String} representing the processor
* this {@code JVM} is running on.
*/
- public String getProcessor()
+ public static String getProcessor()
{
String cpu;
String name = props.getProperty("os.name");
@@ -124,70 +109,109 @@
return cpu;
}
- /**
- * Platform Id string.
- * <p>
- * Platform Id string is used to name the native libraries inside
- * {@code META-LIB} jar directory. This resource is then dynamically
- * extracted to the {@code java.io.tmpdir} or system temporary
- * directory and then loaded.
- * </p>
- * <p>
- * <b>To be defined</b>
- * </p>
- * @return {@code String} representing the JVM platform Id.
- */
- public String getPlatformId()
+ private static int platformId()
{
String sys = getSysname();
String cpu = getProcessor();
- String pid;
+ int pid = 0;
if (sys.equals("windows")) {
if (cpu.equals("x86"))
- pid = "100000";
+ pid = 0x10000;
else if (cpu.equals("ia64"))
- pid = "100011";
+ pid = 0x10011;
else
- pid = "100010";
+ pid = 0x10010;
}
else if (sys.equals("linux")) {
if (cpu.equals("x86"))
- pid = "200100";
+ pid = 0x20100;
else if (cpu.equals("ia64"))
- pid = "200112";
+ pid = 0x20112;
else
- pid = "200111";
+ pid = 0x20111;
}
else if (sys.equals("solaris")) {
if (cpu.equals("x86"))
- pid = "200200";
+ pid = 0x20200;
else if (cpu.equals("sparc32"))
- pid = "200201";
+ pid = 0x20201;
else if (cpu.equals("sparc64"))
- pid = "200211";
+ pid = 0x20211;
else
- pid = "200210";
+ pid = 0x20210;
}
else if (sys.equals("darwin")) {
if (cpu.equals("x86"))
- pid = "200400";
+ pid = 0x20400;
+ else if (cpu.equals("x86_64"))
+ pid = 0x20410;
else
- pid = "200201";
+ pid = 0x20401;
}
else if (sys.equals("hpux")) {
if (cpu.equals("x86"))
- pid = "200800";
+ pid = 0x20800;
else if (cpu.equals("ia64"))
- pid = "200811";
+ pid = 0x20811;
else if (cpu.equals("parisc32"))
- pid = "200802";
+ pid = 0x20802;
+ else
+ pid = 0x20812;
+ }
+ return pid;
+ }
+
+ /**
+ * Platform Shared Object extension.
+ * @return {@code String} representing the System default shared object
+ * extension.
+ */
+ public static String getSoExtension()
+ {
+ String sys = getSysname();
+ String ext;
+
+ if (sys.equals("windows")) {
+ ext = "dll";
+ }
+ else if (sys.equals("darwin")) {
+ ext = "jnilib";
+ }
+ else if (sys.equals("hpux")) {
+ if (getProcessor().startsWith("parisc"))
+ ext = "sl";
else
- pid = "200812";
+ ext = "so";
}
else {
- pid = "000000";
+ ext = "so";
}
- return pid;
+ return ext;
+ }
+
+ /**
+ * Platform Id string.
+ * <p>
+ * Platform Id string is used to name the native libraries inside
+ * {@code META-LIB} jar directory. This resource is then dynamically
+ * extracted to the {@code java.io.tmpdir} or system temporary
+ * directory and then loaded.
+ * </p>
+ * <p>
+ * <b>To be defined</b>
+ * </p>
+ * @return {@code String} representing the JVM platform Id.
+ */
+ public static String getPlatformId()
+ {
+ String pid = Integer.toHexString(platformId());
+ return ("00000" + pid).substring(pid.length());
}
+
+ public static EnumSet<OsType> getOsType()
+ {
+ return OsType.valueOf(platformId());
+ }
+
}
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/DefaultProperties.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/DefaultProperties.properties?rev=817078&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/DefaultProperties.properties (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/DefaultProperties.properties Sun Sep 20 18:54:22 2009
@@ -0,0 +1,26 @@
+# -----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+# DefaultProperties.properties
+#
+# OS Apache Commons Runtime properties file.
+# Those properties override main DefaultProperties
+#
+# -----------------------------------------------------------------------------
+
+# Maximum number of opened OS descriptors
+os.open.max = 65536
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/darwin/DefaultProperties.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/DefaultProperties.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/DefaultProperties.properties?rev=817078&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/DefaultProperties.properties (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/DefaultProperties.properties Sun Sep 20 18:54:22 2009
@@ -0,0 +1,26 @@
+# -----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+# DefaultProperties.properties
+#
+# OS Apache Commons Runtime properties file.
+# Those properties override main DefaultProperties
+#
+# -----------------------------------------------------------------------------
+
+# Maximum number of opened OS descriptors
+os.open.max = 65536
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/hpux/DefaultProperties.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/linux/DefaultProperties.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/linux/DefaultProperties.properties?rev=817078&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/linux/DefaultProperties.properties (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/linux/DefaultProperties.properties Sun Sep 20 18:54:22 2009
@@ -0,0 +1,26 @@
+# -----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+# DefaultProperties.properties
+#
+# OS Apache Commons Runtime properties file.
+# Those properties override main DefaultProperties
+#
+# -----------------------------------------------------------------------------
+
+# Maximum number of opened OS descriptors
+os.open.max = 65536
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/linux/DefaultProperties.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/DefaultProperties.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/DefaultProperties.properties?rev=817078&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/DefaultProperties.properties (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/DefaultProperties.properties Sun Sep 20 18:54:22 2009
@@ -0,0 +1,26 @@
+# -----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+# DefaultProperties.properties
+#
+# OS Apache Commons Runtime properties file.
+# Those properties override main DefaultProperties
+#
+# -----------------------------------------------------------------------------
+
+# Maximum number of opened OS descriptors
+os.open.max = 65536
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/solaris/DefaultProperties.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/DefaultProperties.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/DefaultProperties.properties?rev=817078&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/DefaultProperties.properties (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/DefaultProperties.properties Sun Sep 20 18:54:22 2009
@@ -0,0 +1,26 @@
+# -----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+# DefaultProperties.properties
+#
+# OS Apache Commons Runtime properties file.
+# Those properties override main DefaultProperties
+#
+# -----------------------------------------------------------------------------
+
+# Maximum number of opened OS descriptors
+os.open.max = 65536
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/DefaultProperties.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h?rev=817078&r1=817077&r2=817078&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h Sun Sep 20 18:54:22 2009
@@ -160,14 +160,15 @@
#define RETURN_JCSTR(V) return ACR_NewJavaStringA(_E, (V))
#define RETURN_MBSTR(V) return ACR_NewMbStringA(_E, (V))
-#define ACR_OS_WINDOWS 0x1000
-#define ACR_OS_WIN64 0x1001
-#define ACR_OS_WOW64 0x1002
-#define ACR_OS_UNIX 0x2000
-#define ACR_OS_LINUX 0x2001
-#define ACR_OS_SOLARIS 0x2002
-#define ACR_OS_DARWIN 0x2004
-#define ACR_OS_HPUX 0x2008
+#define ACR_OS_WINDOWS 0x10000
+#define ACR_OS_WIN64 0x10010
+#define ACR_OS_WOW64 0x10020
+#define ACR_OS_UNIX 0x20000
+#define ACR_OS_LINUX 0x20100
+#define ACR_OS_SOLARIS 0x20200
+#define ACR_OS_DARWIN 0x20400
+#define ACR_OS_HPUX 0x20800
+#define ACR_OS_AIX 0x21000
#define ACR_CP_DEFAULT 0
#define ACR_CP_ISO8859_1 1
Added: commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java?rev=817078&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java (added)
+++ commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java Sun Sep 20 18:54:22 2009
@@ -0,0 +1,28 @@
+
+
+package org.apache.commons.runtime;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+
+public class SystemIdTask extends Task
+{
+ private String prefix;
+
+ public void setPrefix(String prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (prefix == null)
+ throw new BuildException("Missing system prefix");
+ getProject().setNewProperty(prefix + ".so", SystemId.getSoExtension());
+ getProject().setNewProperty(prefix + ".cpu", SystemId.getProcessor());
+ getProject().setNewProperty(prefix + ".os", SystemId.getSysname());
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/task/org/apache/commons/runtime/SystemIdTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java?rev=817078&r1=817077&r2=817078&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java Sun Sep 20 18:54:22 2009
@@ -17,6 +17,7 @@
package org.apache.commons.runtime;
import java.lang.System;
+import java.util.EnumSet;
import junit.framework.*;
/**
@@ -59,11 +60,12 @@
System.out.println("Data Model " + Os.getDataModel());
System.out.println("Hardware " + Os.getHardwarePlatform());
System.out.println();
- SystemId v = new SystemId();
System.out.println("System Id:");
- System.out.println("Name " + v.getSysname());
- System.out.println("Processor " + v.getProcessor());
- System.out.println("Id " + v.getPlatformId());
+ System.out.println("Name " + SystemId.getSysname());
+ System.out.println("Processor " + SystemId.getProcessor());
+ System.out.println("Id " + SystemId.getPlatformId());
+ System.out.println("Type " + SystemId.getOsType());
+ System.out.println("So " + "." + SystemId.getSoExtension());
System.out.println();
System.out.println("Library Version:");
System.out.println("Major " + Version.MAJOR);