diff options
author | slewis | 2009-03-20 04:36:32 +0000 |
---|---|---|
committer | slewis | 2009-03-20 04:36:32 +0000 |
commit | ed29791f9750f8fef29ef6d700c44383c2fe80fb (patch) | |
tree | 0b4e44d441ff8e135f17426caa31c829df67a4f0 /doc | |
parent | 3098e69ec38c9466cc2de2453455be7156de4f8f (diff) | |
download | org.eclipse.ecf-ed29791f9750f8fef29ef6d700c44383c2fe80fb.tar.gz org.eclipse.ecf-ed29791f9750f8fef29ef6d700c44383c2fe80fb.tar.xz org.eclipse.ecf-ed29791f9750f8fef29ef6d700c44383c2fe80fb.zip |
Initial checkin of org.eclipse.ecf.tutorial.distribution.common bundle
Diffstat (limited to 'doc')
14 files changed, 449 insertions, 0 deletions
diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.classpath b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.project b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.project new file mode 100644 index 000000000..fec50e277 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.tutorial.distribution.common</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.settings/org.eclipse.jdt.core.prefs b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..32972a074 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Mar 19 19:49:20 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.settings/org.eclipse.pde.core.prefs b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..a3e341ad2 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Thu Mar 19 19:49:20 PDT 2009 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/META-INF/MANIFEST.MF b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/META-INF/MANIFEST.MF new file mode 100644 index 000000000..ccc681050 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ECF EclipseCon 2009 Tutorial Common +Bundle-SymbolicName: org.eclipse.ecf.tutorial.distribution.common +Bundle-Version: 1.0.0 +Bundle-Vendor: Eclipse.org +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.osgi.service.environment, + org.osgi.framework, + org.osgi.util.tracker +Export-Package: org.eclipse.ecf.tutorial.distribution.common.complextypes, + org.eclipse.ecf.tutorial.distribution.common.environmentinfo, + org.eclipse.ecf.tutorial.distribution.common.hello, + org.eclipse.ecf.tutorial.internal.distribution.common;x-internal:=true diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/build.properties b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/build.properties new file mode 100644 index 000000000..34d2e4d2d --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/ComplexTypesImpl.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/ComplexTypesImpl.java new file mode 100644 index 000000000..125f158a2 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/ComplexTypesImpl.java @@ -0,0 +1,24 @@ +/******************************************************************************* +* Copyright (c) 2009 EclipseSource 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: +* EclipseSource - initial API and implementation +******************************************************************************/ +package org.eclipse.ecf.tutorial.distribution.common.complextypes; + +public class ComplexTypesImpl implements IComplexTypes { + + private MyComplexData data = new MyComplexData("host1","host2"); + + public MyComplexData get() { + return data; + } + + public void set(MyComplexData complex) { + data = complex; + } + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/IComplexTypes.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/IComplexTypes.java new file mode 100644 index 000000000..88cce17b7 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/IComplexTypes.java @@ -0,0 +1,19 @@ +/******************************************************************************* +* Copyright (c) 2009 EclipseSource 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: +* EclipseSource - initial API and implementation +******************************************************************************/ +package org.eclipse.ecf.tutorial.distribution.common.complextypes; + +public interface IComplexTypes { + + public void set(MyComplexData complex); + + public MyComplexData get(); + + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/MyComplexData.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/MyComplexData.java new file mode 100644 index 000000000..fa6576470 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/complextypes/MyComplexData.java @@ -0,0 +1,38 @@ +/******************************************************************************* +* Copyright (c) 2009 EclipseSource 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: +* EclipseSource - initial API and implementation +******************************************************************************/ +package org.eclipse.ecf.tutorial.distribution.common.complextypes; + +import java.io.Serializable; + +public class MyComplexData implements Serializable { + + private static final long serialVersionUID = -7599059139426924939L; + + private String str1; + private String str2; + + public MyComplexData(String str1, String str2) { + this.str1 = str1; + this.str2 = str2; + } + + public String getStr1() { + return str1; + } + + public String getStr2() { + return str2; + } + + public String toString() { + return "MyComplexData [str1=" + str1 + ", str2=" + str2 + "]"; + } + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/environmentinfo/IRemoteEnvironmentInfo.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/environmentinfo/IRemoteEnvironmentInfo.java new file mode 100644 index 000000000..0fc89ad6d --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/environmentinfo/IRemoteEnvironmentInfo.java @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright (c) 2008 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.tutorial.distribution.common.environmentinfo; + +/** + * + */ +public interface IRemoteEnvironmentInfo { + + /** + * Returns all command line arguments specified when the running framework was started. + * + * @return the array of command line arguments. + */ + public String[] getCommandLineArgs(); + + /** + * Returns the arguments consumed by the framework implementation itself. Which + * arguments are consumed is implementation specific. + * + * @return the array of command line arguments consumed by the framework. + */ + public String[] getFrameworkArgs(); + + /** + * Returns the arguments not consumed by the framework implementation itself. Which + * arguments are consumed is implementation specific. + * + * @return the array of command line arguments not consumed by the framework. + */ + public String[] getNonFrameworkArgs(); + + /** + * Returns the string name of the current system architecture. + * The value is a user-defined string if the architecture is + * specified on the command line, otherwise it is the value + * returned by <code>java.lang.System.getProperty("os.arch")</code>. + * + * @return the string name of the current system architecture + */ + public String getOSArch(); + + /** + * Returns the string name of the current locale for use in finding files + * whose path starts with <code>$nl$</code>. + * + * @return the string name of the current locale + */ + public String getNL(); + + /** + * Returns the string name of the current operating system for use in finding + * files whose path starts with <code>$os$</code>. Return "unknown" + * if the operating system cannot be determined. + * <p> + * The value may indicate one of the operating systems known to the platform + * (as specified in <code>org.eclipse.core.runtime.Platform#knownOSValues</code>) + * or a user-defined string if the operating system name is specified on the command line. + * </p> + * + * @return the string name of the current operating system + */ + public String getOS(); + + /** + * Returns the string name of the current window system for use in finding files + * whose path starts with <code>$ws$</code>. Return <code>null</code> + * if the window system cannot be determined. + * + * @return the string name of the current window system or <code>null</code> + */ + public String getWS(); + + /** + * Returns <code>true</code> if the framework is in debug mode and + * <code>false</code> otherwise. + * + * @return whether or not the framework is in debug mode + */ + public Boolean inDebugMode(); + + /** + * Returns <code>true</code> if the framework is in development mode + * and <code>false</code> otherwise. + * + * @return whether or not the framework is in development mode + */ + public Boolean inDevelopmentMode(); + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/environmentinfo/RemoteEnvironmentInfoImpl.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/environmentinfo/RemoteEnvironmentInfoImpl.java new file mode 100644 index 000000000..1c4af9089 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/environmentinfo/RemoteEnvironmentInfoImpl.java @@ -0,0 +1,107 @@ +/**************************************************************************** + * Copyright (c) 2008 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.tutorial.distribution.common.environmentinfo; + +import org.eclipse.ecf.tutorial.internal.distribution.common.Activator; +import org.eclipse.osgi.service.environment.EnvironmentInfo; + +/** + * + */ +public class RemoteEnvironmentInfoImpl implements IRemoteEnvironmentInfo { + + private EnvironmentInfo getEnvironmentInfo() { + return Activator.getDefault().getEnvironmentInfo(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getCommandLineArgs() + */ + public String[] getCommandLineArgs() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getCommandLineArgs()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getCommandLineArgs(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getFrameworkArgs() + */ + public String[] getFrameworkArgs() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getFrameworkArgs()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getFrameworkArgs(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getNL() + */ + public String getNL() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getNL()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getNL(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getNonFrameworkArgs() + */ + public String[] getNonFrameworkArgs() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getNonFrameworkArgs()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getNonFrameworkArgs(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getOS() + */ + public String getOS() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getOS()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getOS(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getOSArch() + */ + public String getOSArch() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getOSArch()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getOSArch(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getWS() + */ + public String getWS() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("getWS()"); //$NON-NLS-1$ + return (ei == null) ? null : ei.getWS(); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#inDebugMode() + */ + public Boolean inDebugMode() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("inDebugMode()"); //$NON-NLS-1$ + return (ei == null) ? null : new Boolean(ei.inDebugMode()); + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#inDevelopmentMode() + */ + public Boolean inDevelopmentMode() { + final EnvironmentInfo ei = getEnvironmentInfo(); + System.out.println("inDevelopmentMode()"); //$NON-NLS-1$ + return (ei == null) ? null : new Boolean(ei.inDevelopmentMode()); + } + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/hello/HelloImpl.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/hello/HelloImpl.java new file mode 100644 index 000000000..a959c134e --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/hello/HelloImpl.java @@ -0,0 +1,24 @@ +/******************************************************************************* +* Copyright (c) 2009 EclipseSource 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: +* EclipseSource - initial API and implementation +******************************************************************************/ +package org.eclipse.ecf.tutorial.distribution.common.hello; + +public class HelloImpl implements IHello { + + public void hello() { + System.out.println("Somebody just called hello."); + } + + public String helloThere(String from) { + String response = from + " just called helloThere"; + System.out.println(response); + return response; + } + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/hello/IHello.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/hello/IHello.java new file mode 100644 index 000000000..9899cdd33 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/distribution/common/hello/IHello.java @@ -0,0 +1,18 @@ +/******************************************************************************* +* Copyright (c) 2009 EclipseSource 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: +* EclipseSource - initial API and implementation +******************************************************************************/ +package org.eclipse.ecf.tutorial.distribution.common.hello; + +public interface IHello { + + public void hello(); + + public String helloThere(String from); + +} diff --git a/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/internal/distribution/common/Activator.java b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/internal/distribution/common/Activator.java new file mode 100644 index 000000000..d21d64473 --- /dev/null +++ b/doc/tutorials/EclipseCON 2009/bundles/org.eclipse.ecf.tutorial.distribution.common/src/org/eclipse/ecf/tutorial/internal/distribution/common/Activator.java @@ -0,0 +1,49 @@ +/******************************************************************************* +* Copyright (c) 2009 EclipseSource 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: +* EclipseSource - initial API and implementation +******************************************************************************/ +package org.eclipse.ecf.tutorial.internal.distribution.common; + +import org.eclipse.osgi.service.environment.EnvironmentInfo; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; + +public class Activator implements BundleActivator { + + private static Activator activator; + + private BundleContext context; + + private ServiceTracker environmentInfoServiceTracker; + + public static Activator getDefault() { + return activator; + } + + public void start(BundleContext context) throws Exception { + activator = this; + this.context = context; + } + + public void stop(BundleContext context) throws Exception { + if (environmentInfoServiceTracker != null) { + environmentInfoServiceTracker.close(); + environmentInfoServiceTracker = null; + } + this.context = null; + } + + public EnvironmentInfo getEnvironmentInfo() { + if (environmentInfoServiceTracker == null) { + environmentInfoServiceTracker = new ServiceTracker(context,EnvironmentInfo.class.getName(),null); + environmentInfoServiceTracker.open(); + } + return (EnvironmentInfo) environmentInfoServiceTracker.getService(); + } +} |