[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.technology.ecf] Re: some small patch ...

Hi Stephan,

Stephan Zehrer wrote:
Hi,

i tried this WE ECF and it looks not so bad :)
I will try it during next week in my company in a development environment.


I did some (diry) hacks on my (anonymous) checked out code, maybe somebody is interested.

Yes, indeed...thanks for your efforts and reports! Keep them coming if you can!




build.xml (from ecf.provider)
I add the environment variable ECLIPSE_HOME and "fixed" some paths, the HEAD version work only if the workspace is in the eclipse folder (see bug 85090)

Yes thanks. Will apply this fix this evening (Sunday).

Additionaly i add a manifest and the classes from org.eclipse.ecf package to the provider.jar (that is the diry part), but with this changes it is possible to run the server with a simple statment:

java -jar provider.jar

Thanks. We'll add this so that servers can be more easily launched with the -jar command.



Oh no two small changes was required too.

The Trace.java classes in the packages
org.eclipse.efc.core.intenrnal.core &
org.eclipse.efc.provider

I disabeld the platform dependencies.

These calls to Platform.are specifically in there so that the trace code can run via the Eclipse tracing mechanism. I wanted to have this Trace class be usable by either the Eclipse tracing mechanism or as a normal application (i.e. without the Eclipse runtime at all).


So I don't want to remove the Platform import as you did...but I see that I did put an error in the Trace code that tries to load the Platform class without another ClassNotFoundException catch later in the code. I will fix this an check it in this evening as well.

Again THANKS.

Scott



bye

Stephan Zehrer


------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<project name="org.eclipse.ecf.provider" default="build.jars" basedir=".">

	<property name="bootclasspath" value=""/>
	<property name="basews" value="${ws}"/>
	<property name="baseos" value="${os}"/>
	<property name="basearch" value="${arch}"/>
	<property name="basenl" value="${nl}"/>
	<property name="javacFailOnError" value="false"/>
	<property name="javacDebugInfo" value="on"/>
	<property name="javacVerbose" value="true"/>
	<property name="javacSource" value="1.3"/>
	<property name="javacTarget" value="1.2"/>
	<property name="compilerArg" value=""/>
	<property environment="env"/>

	<target name="init" depends="properties">
		<condition property="pluginTemp" value="${buildTempFolder}/plugins">
			<isset property="buildTempFolder"/>
		</condition>
		<property name="pluginTemp" value="${basedir}"/>
		<condition property="build.result.folder" value="${pluginTemp}/org.eclipse.ecf.provider">
			<isset property="buildTempFolder"/>
		</condition>
		<property name="build.result.folder" value="${basedir}"/>
		<property name="temp.folder" value="${basedir}/temp.folder"/>
		<property name="plugin.destination" value="${basedir}"/>
		<property name="eclipse.home" value="${env.ECLIPSE_HOME}"/>
	</target>

	<target name="properties" if="eclipse.running">
		<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
	</target>

	<target name="build.update.jar" depends="init" description="Build the plug-in: org.eclipse.ecf.provider for an update site.">
		<delete dir="${temp.folder}"/>
		<mkdir dir="${temp.folder}"/>
		<antcall target="build.jars"/>
		<antcall target="gather.bin.parts">
			<param name="destination.temp.folder" value="${temp.folder}/"/>
		</antcall>
		<zip zipfile="${plugin.destination}/org.eclipse.ecf.provider_1.0.0.jar" basedir="${temp.folder}/org.eclipse.ecf.provider_1.0.0" filesonly="false" whenempty="skip" update="false"/>
		<delete dir="${temp.folder}"/>
	</target>

	<target name="provider.jar" depends="init" unless="provider.jar" description="Create jar: provider.jar.">
		<delete dir="${temp.folder}/provider.jar.bin"/>
		<mkdir dir="${temp.folder}/provider.jar.bin"/>
		<!-- compile the source code -->
		<javac destdir="${temp.folder}/provider.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}"		>
			<compilerarg line="${compilerArg}"/>
			<classpath>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.core.runtime_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.core.runtime_3.1.0/runtime.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.core.runtime_3.1.0/runtime.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.osgi_3.1.0/osgi.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.osgi_3.1.0/core.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.osgi_3.1.0/resolver.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.osgi_3.1.0/defaultAdaptor.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.osgi_3.1.0/eclipseAdaptor.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipse3.1m4/eclipse/plugins/org.eclipse.osgi_3.1.0/console.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/core.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/console.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/osgi.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/resolver.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/defaultAdaptor.jar"/>
				<pathelement path="${eclipse.home}/plugins/org.eclipse.osgi_3.1.0/eclipseAdaptor.jar"/>
				<pathelement path="../org.eclipse.ecf/bin"/>
				<pathelement path="../org.eclipse.ecf/ecf.jar"/>
				<pathelement path="@dot"/>
			</classpath>
			<src path="src/"			/>
			</javac>
		<!-- Copy necessary resources -->
		<copy todir="${temp.folder}/provider.jar.bin" failonerror="true">
			<fileset dir="src/" excludes="**/*.java, **/package.htm*"			/>
		</copy>
		<mkdir dir="${build.result.folder}"/>
		<jar jarfile="${build.result.folder}/provider.jar">
			<fileset dir="${temp.folder}/provider.jar.bin"/>
			<fileset dir="../org.eclipse.ecf/bin"/>
		    <manifest>
		      <attribute name="Main-Class" value="org.eclipse.ecf.provider.app.ServerApplication"/>
		    </manifest>
		</jar>
		<delete dir="${temp.folder}/provider.jar.bin"/>
	</target>

	<target name="providersrc.zip" depends="init" unless="providersrc.zip">
		<mkdir dir="${build.result.folder}"/>
		<zip zipfile="${build.result.folder}/providersrc.zip" filesonly="false" whenempty="skip" update="false">
			<fileset dir="src/" includes="**/*.java"			/>
		</zip>
	</target>

	<target name="build.jars" depends="init" description="Build all the jars for the plug-in: org.eclipse.ecf.provider.">
		<available property="provider.jar" file="${build.result.folder}/provider.jar"/>
		<antcall target="provider.jar"/>
	</target>

	<target name="build.sources" depends="init">
		<available property="providersrc.zip" file="${build.result.folder}/providersrc.zip"/>
		<antcall target="providersrc.zip"/>
	</target>

	<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0"/>
		<copy todir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0" failonerror="true">
			<fileset dir="${build.result.folder}" includes="provider.jar"			/>
		</copy>
		<copy todir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0" failonerror="true">
			<fileset dir="${basedir}" includes="plugin.xml,provider.jar,META-INF/"			/>
		</copy>
	</target>

	<target name="build.zips" depends="init">
	</target>

	<target name="gather.sources" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0"/>
		<copy file="${build.result.folder}/providersrc.zip" todir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0" failonerror="false"/>
		<copy todir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0" failonerror="false">
			<fileset dir="${basedir}" includes="src/,plugin.xml,provider.jar,META-INF/"			/>
		</copy>
	</target>

	<target name="gather.logs" depends="init" if="destination.temp.folder">
		<mkdir dir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0"/>
		<copy file="${temp.folder}/provider.jar.bin.log" todir="${destination.temp.folder}/org.eclipse.ecf.provider_1.0.0" failonerror="false"/>
	</target>

	<target name="clean" depends="init" description="Clean the plug-in: org.eclipse.ecf.provider of all the zips, jars and logs created.">
		<delete file="${build.result.folder}/provider.jar"/>
		<delete file="${build.result.folder}/providersrc.zip"/>
		<delete file="${plugin.destination}/org.eclipse.ecf.provider_1.0.0.jar"/>
		<delete file="${plugin.destination}/org.eclipse.ecf.provider_1.0.0.zip"/>
		<delete dir="${temp.folder}"/>
	</target>

	<target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
		<eclipse.convertPath fileSystemPath="C:/eclipse3.1m4/eclipse/workspace/org.eclipse.ecf.provider" property="resourcePath"/>
		<eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
	</target>

	<target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: org.eclipse.ecf.provider.">
		<delete dir="${temp.folder}"/>
		<mkdir dir="${temp.folder}"/>
		<antcall target="build.jars"/>
		<antcall target="build.sources"/>
		<antcall target="gather.bin.parts">
			<param name="destination.temp.folder" value="${temp.folder}/"/>
		</antcall>
		<antcall target="gather.sources">
			<param name="destination.temp.folder" value="${temp.folder}/"/>
		</antcall>
		<delete>
			<fileset dir="${temp.folder}" includes="**/*.bin.log"			/>
		</delete>
		<zip zipfile="${plugin.destination}/org.eclipse.ecf.provider_1.0.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
		<delete dir="${temp.folder}"/>
	</target>

</project>


------------------------------------------------------------------------

/****************************************************************************
* Copyright (c) 2004 Composent, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*    Composent, Inc. - initial API and implementation
*****************************************************************************/

package org.eclipse.ecf.provider;

import java.text.SimpleDateFormat;
import java.util.Date;
//import org.eclipse.core.runtime.Platform;

public class Trace {
public static final String tracePrefix = "(trace)";
public static boolean ON = false;
protected static boolean isEclipse = false;
protected static String pluginName = "";
protected static String debugPrefix = "/debug/";
static {
try {
//ON = Platform.inDebugMode();
String val = System.getProperty(ProviderPlugin.PROVIDERPLUGIN_ID+".Trace");
if (val != null) {
setTrace(true);
isEclipse = false;
// No eclipse Platform available
System.out.println("WARNING: Eclipse platform not being use for trace...overridden by system property org.eclipse.ecf.provider.Trace"); } else {
isEclipse = true;
pluginName = ProviderPlugin.PROVIDERPLUGIN_ID;
}
} catch (Exception e) {
try {
String val = System.getProperty(ProviderPlugin.PROVIDERPLUGIN_ID+".Trace");
if (val != null) {
setTrace(true);
isEclipse = false;
// No eclipse Platform available
System.out.println("WARNING: Eclipse platform not available for trace...using system.out for org.eclipse.ecf.provider"); } else {
System.out.println(Trace.class.getName()+": OFF");
}
} catch (Exception except) {
}
}
}


    public static void setTrace(boolean on) {
        ON = on;
    }

    public static Trace create(String key) {
        if (isEclipse) {
            String res = ""; //Platform
                    //.getDebugOption(pluginName + debugPrefix + key);
            if (res != null) {
                Boolean on = new Boolean(res);
                if (on.booleanValue())
                    return new Trace(pluginName + "(" + key + ")");
                else
                    return null;
            } else {
                return null;
            }
        } else
            return new Trace(key);
    }

    String name;

    public void dumpStack(Throwable e, String msg) {
        msg(msg);
        e.printStackTrace(System.err);
    }

    public void msg(String msg) {
        StringBuffer sb = new StringBuffer(name);
        sb.append(getTimeString()).append(msg);
        System.out.println(sb.toString());
    }

    protected static String getTimeString() {
        Date d = new Date();
        SimpleDateFormat df = new SimpleDateFormat("[MM/dd/yy;HH:mm:ss:SSS]");
        return df.format(d);
    }

    protected Trace(String str) {
        name = tracePrefix+str;
    }

}


------------------------------------------------------------------------

/****************************************************************************
* Copyright (c) 2004 Composent, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*    Composent, Inc. - initial API and implementation
*****************************************************************************/

package org.eclipse.ecf.internal.core;

import java.text.SimpleDateFormat;
import java.util.Date;
//import org.eclipse.core.runtime.Platform;

public class Trace {
public static final String tracePrefix = "(trace)";
public static boolean ON = false;
protected static boolean isEclipse = false;
protected static String pluginName = "";
protected static String debugPrefix = "/debug/";
static {
try {
//ON = Platform.inDebugMode();
String val = System.getProperty(ECFPlugin.PLUGIN_ID+".Trace");
if (val != null) {
setTrace(true);
isEclipse = false;
// No eclipse Platform available
System.out.println("WARNING: Eclipse platform not available for trace...overridden by system property org.eclipse.ecf.Trace");
} else {
isEclipse = true;
pluginName = ECFPlugin.PLUGIN_ID;
}
} catch (Exception e) {
try {
String val = System.getProperty(ECFPlugin.PLUGIN_ID+".Trace");
if (val != null) {
setTrace(true);
isEclipse = false;
// No eclipse Platform available
System.out.println("WARNING: Eclipse platform not available for trace...using system.out for org.eclipse.ecf");
} else {
System.out.println(Trace.class.getName()+": OFF");
}
} catch (Exception except) {
}
}
}
public static void setTrace(boolean on) {
ON = on;
}


    public static Trace create(String key) {
        if (isEclipse) {
            String res = ""; //Platform
                    //.getDebugOption(pluginName + debugPrefix + key);
            if (res != null) {
                Boolean on = new Boolean(res);
                if (on.booleanValue())
                    return new Trace(pluginName + "(" + key + ")");
                else
                    return null;
            } else {
                return null;
            }
        } else
            return new Trace(key);
    }

    String name;

    public void dumpStack(Throwable e, String msg) {
        msg(msg);
        e.printStackTrace(System.err);
    }

    public void msg(String msg) {
        StringBuffer sb = new StringBuffer(name);
        sb.append(getTimeString()).append(msg);
        System.out.println(sb.toString());
    }

    protected static String getTimeString() {
        Date d = new Date();
        SimpleDateFormat df = new SimpleDateFormat("[MM/dd/yy;HH:mm:ss:SSS]");
        return df.format(d);
    }

    protected Trace(String str) {
        name = tracePrefix+str;
    }
    public static String convertStringAToString(String [] strings) {
        if (strings==null) return "";
        StringBuffer sb = new StringBuffer();
        for(int i=0; i < strings.length; i++) {
            if (strings[i]==null) sb.append("(null)");
            else sb.append(strings[i]);
            if (i != (strings.length-1)) sb.append(";");
        }
        return sb.toString();
    }
    public static String convertObjectAToString(Object [] objs) {
        if (objs==null) return "";
        StringBuffer sb = new StringBuffer();
        for(int i=0; i < objs.length; i++) {
            if (objs[i]==null) sb.append("(null)");
            else sb.append(objs[i].toString());
            if (i != (objs.length-1)) sb.append(";");
        }
        return sb.toString();
    }

    public static void setThreadDebugGroup(Object obj) {
        // Do nothing
    }
}