Skip to content
This repository was archived by the owner on Jul 11, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ look at the base revision or go to http://sourceforge.net/projects/mc4j/
You can build the bits via `ant jars` and then
deploy the artifacts to a local maven repo via `ant install`.

You can deploy to a remote repository using
`ant maven-deploy -Durl=https://.../ -DrepositoryId=...`

== maven version

This fork uses the original packages from mc4j, but adds a `-rhq` designator
Expand All @@ -23,4 +26,4 @@ to the jars like this:
<artifactId>org-mc4j-ems</artifactId>
<version>1.3.6-rhq</version>
</dependency>
----
----
69 changes: 25 additions & 44 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<property name="module.jar" value="org-mc4j-ems.jar"/>

<property name="release.version" value="1.3.6-rhq"/>
<property name="release.version" value="1.3.7-rhq"/>


<target name="init" description="Initializes the MC4J-EMS build system.">
Expand Down Expand Up @@ -101,21 +101,14 @@
<target name="compile" depends="init" description="Compiles the MC4J-EMS codebase.">
<mkdir dir="classes"/>
<mkdir dir="classes/main"/>
<mkdir dir="classes/impl"/>
<mkdir dir="classes/test"/>
<javac srcdir="src/ems" destdir="classes/main" debug="true" source="${compile.source}"
target="${compile.target}">
<classpath>
<path refid="classpath.compile"/>
</classpath>
<exclude name="**/DeepClassLoaderOrig*"/>
</javac>
<javac srcdir="src/ems-impl" destdir="classes/impl" debug="true" source="${compile.source}"
target="${compile.target}">
<classpath>
<path refid="classpath.compile"/>
<pathelement location="classes/main"/>
</classpath>
<exclude name="**/DeepClassLoaderOrig*"/>
</javac>
<javac srcdir="src/test" destdir="classes/test" debug="true" source="${compile.source}" target="1.5">
<classpath>
Expand All @@ -129,7 +122,6 @@

<target name="javadoc" depends="init" description="Generated Javadocs for MC4J-EMS classes.">
<mkdir dir="javadocs/api"/>
<mkdir dir="javadocs/impl"/>
<javadoc packagenames="org.mc4j.ems.*"
excludepackagenames="org.mc4j.ems.connection.support.classloader.*"
sourcepath="src/ems"
Expand All @@ -139,14 +131,6 @@
use="true"
windowtitle="EMS API">
</javadoc>
<javadoc packagenames="org.mc4j.ems.*"
sourcepath="src/ems-impl"
destdir="javadocs/impl"
author="true"
version="true"
use="true"
windowtitle="EMS Impl">
</javadoc>
</target>


Expand All @@ -159,22 +143,8 @@
</fileset>
</delete>

<jar jarfile="classes/main/org-mc4j-ems-impl.jar" update="true" compress="false">
<fileset dir="classes/impl" includes="org/mc4j/ems/impl/**"/>
<manifest>
<attribute name="Implementation-Title" value="MC4J-EMS"/>
<attribute name="Specification-Version" value="${release.version}"/>
<attribute name="Implementation-Version" value="${release.version}"/>
<attribute name="Implementation-URL" value="http://mc4j.org/"/>
</manifest>
</jar>
<copy file="classes/main/org-mc4j-ems-impl.jar"
tofile="dist/org-mc4j-ems-impl-${release.version}.jar"/>

<jar jarfile="dist/org-mc4j-ems-${release.version}.jar" update="true" compress="false">
<jar jarfile="dist/org-mc4j-ems-${release.version}.jar" update="true" compress="true">
<fileset dir="classes/main"/>
<fileset dir="${basedir}" includes="lib/*.jar"/>
<fileset dir="${basedir}" includes="lib/jsr160-includes/*.jar"/>

<manifest>
<attribute name="Implementation-Title" value="MC4J-EMS"/>
Expand All @@ -189,24 +159,42 @@

<!-- sources jars -->
<jar jarfile="dist/org-mc4j-ems-${release.version}-sources.jar" basedir="src/ems"/>
<jar jarfile="dist/org-mc4j-ems-impl-${release.version}-sources.jar" basedir="src/ems-impl"/>

<!-- javadoc jars -->
<jar jarfile="dist/org-mc4j-ems-${release.version}-javadoc.jar" basedir="javadocs/api"/>
<jar jarfile="dist/org-mc4j-ems-impl-${release.version}-javadoc.jar" basedir="javadocs/impl"/>

</target>


<target name="dist" depends="jars" description="Build the EMS distribution"/>

<target name="maven-deploy-file">
<fail message="Set -Durl to your repository URL" unless="url"/>
<fail message="Set -DrepositoryId to your repository ID" unless="repositoryId"/>
<exec executable="mvn">
<arg value="deploy:deploy-file"/>
<arg value="-DrepositoryId=${repositoryId}"/>
<arg value="-DgroupId=em"/>
<arg value="-Dfile=${file}"/>
<arg value="-DgeneratePom=true"/>
<arg value="-Durl=${url}"/>
<arg value="-DgroupId=mc4j"/>
<arg value="-Dversion=${release.version}"/>
<arg value="-DartifactId=${artifactId}"/>
</exec>
</target>

<target name="maven-deploy" description="Deploys the EMS JAR Files to a Remote Maven Repo">
<antcall target="maven-deploy-file">
<param name="artifactId" value="org-mc4j-ems"/>
<param name="file" value="dist/org-mc4j-ems-${release.version}.jar"/>
</antcall>
</target>

<target name="install" depends="jars" description="Deploys the EMS JAR Files to the Local Maven Repo">
<property name="maven.repo.local" location="${user.home}/.m2/repository"/>
<property name="ems.artifact.dir" location="${maven.repo.local}/mc4j/org-mc4j-ems/${release.version}"/>
<mkdir dir="${ems.artifact.dir}"/>
<property name="ems-impl.artifact.dir" location="${maven.repo.local}/mc4j/org-mc4j-ems-impl/${release.version}"/>
<mkdir dir="${ems-impl.artifact.dir}"/>

<copy todir="${ems.artifact.dir}">
<fileset dir="dist">
Expand All @@ -216,13 +204,6 @@
</fileset>
</copy>

<copy todir="${ems-impl.artifact.dir}">
<fileset dir="dist">
<include name="org-mc4j-ems-impl-${release.version}.jar"/>
<include name="org-mc4j-ems-impl-${release.version}-sources.jar"/>
<include name="org-mc4j-ems-impl-${release.version}-javadoc.jar"/>
</fileset>
</copy>
</target>


Expand Down
Binary file removed lib/jsr160-includes/mx4j-remote.jar
Binary file not shown.
Binary file removed lib/jsr160-includes/mx4j.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,7 @@ public ClassLoader buildClassLoader(ConnectionSettings settings) {

Boolean useContextClassLoader = Boolean.valueOf(settings.getAdvancedProperties().getProperty(ConnectionFactory.USE_CONTEXT_CLASSLOADER, "false"));
if (useContextClassLoader.booleanValue()) {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
URL implURL = storeImplToTemp("org-mc4j-ems-impl.jar", tempDir);
ClassLoader loader = new URLClassLoader(new URL[] {implURL}, contextClassLoader);
return loader;
return Thread.currentThread().getContextClassLoader();
}

List<URL> entries = new ArrayList<URL>();
Expand All @@ -221,13 +218,6 @@ public ClassLoader buildClassLoader(ConnectionSettings settings) {
}
}

// Now load in the implementation jar
// URL implURL = new URL(null, "deepjar://org-mc4j-ems-impl.jar", new Handler());
URL implURL = storeImplToTemp("org-mc4j-ems-impl.jar", tempDir);

entries.add(implURL);


if (settings.getConnectionType() instanceof LocalVMTypeDescriptor) {
// Need tools.jar if its not already loaded
try {
Expand All @@ -251,13 +241,8 @@ public ClassLoader buildClassLoader(ConnectionSettings settings) {
}
}


// Add internal support jars for JSR160 on < jdk5
if ((settings.getConnectionType() instanceof JSR160ConnectionTypeDescriptor) &&
settings.getConnectionType().getConnectionClasspathEntries() == null &&
Double.parseDouble(System.getProperty("java.version").substring(0, 3)) < 1.5) {
entries.add(storeImplToTemp("lib/jsr160-includes/mx4j.jar", tempDir));
entries.add(storeImplToTemp("lib/jsr160-includes/mx4j-remote.jar", tempDir));
if (entries.isEmpty()) {
return ClassLoaderFactory.class.getClassLoader();
}

// TODO: Check if file exists, log warning if not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void doConnect() {
// Create an RMI connector client
JMXServiceURL url = new JMXServiceURL(this.connectionSettings.getServerUrl());

Hashtable env = new Hashtable();
Hashtable<String, Object> env = new Hashtable<String, Object>();

if ((connectionSettings.getInitialContextName() != null) &&
(connectionSettings.getInitialContextName().trim().length() > 0)) {
Expand Down Expand Up @@ -120,8 +120,7 @@ protected void doConnect() {
Set<Map.Entry<Object,Object>> entries = connectionSettings.getAdvancedProperties().entrySet();
for (Map.Entry entry : entries) {
String key = (String) entry.getKey();
String value = (String) entry.getValue();

Object value = entry.getValue();
env.put(key, value);
}
}
Expand Down