Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-03-12 02:53:26 -0400
committerslewis2007-03-12 02:53:26 -0400
commit66221fd74e444ca2bd42f402bb7481fa45f98bd6 (patch)
tree517b6ee1e708f31ad6fbd388cf034e085c6caeeb /server-side/bundles
parentb02e8ba9d5bec406776b685ddc9dc66017aad21b (diff)
downloadorg.eclipse.ecf-66221fd74e444ca2bd42f402bb7481fa45f98bd6.tar.gz
org.eclipse.ecf-66221fd74e444ca2bd42f402bb7481fa45f98bd6.tar.xz
org.eclipse.ecf-66221fd74e444ca2bd42f402bb7481fa45f98bd6.zip
Initial checkin of org.eclipse.ecf.server.generic plugin
Diffstat (limited to 'server-side/bundles')
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/.classpath7
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/.project28
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/.settings/org.eclipse.jdt.core.prefs53
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/META-INF/MANIFEST.MF12
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/about.html28
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/build.properties4
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/plugin.properties13
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/server.xml5
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Activator.java71
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Messages.java34
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/messages.properties4
-rw-r--r--server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/ServerStarter.java112
12 files changed, 371 insertions, 0 deletions
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/.classpath b/server-side/bundles/org.eclipse.ecf.server.generic/.classpath
new file mode 100644
index 000000000..751c8f2e5
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/.project b/server-side/bundles/org.eclipse.ecf.server.generic/.project
new file mode 100644
index 000000000..745c9e2fb
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.server.generic</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/.settings/org.eclipse.jdt.core.prefs b/server-side/bundles/org.eclipse.ecf.server.generic/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..6b5313266
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,53 @@
+#Mon Mar 12 00:05:24 PDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/META-INF/MANIFEST.MF b/server-side/bundles/org.eclipse.ecf.server.generic/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..d8be8c19d
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %plugin.name
+Bundle-SymbolicName: org.eclipse.ecf.server.generic
+Bundle-Version: 1.0.0.v20070215
+Bundle-Activator: org.eclipse.ecf.internal.server.generic.Activator
+Bundle-Vendor: %plugin.provider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ecf,
+ org.eclipse.ecf.sharedobject,
+ org.eclipse.ecf.provider
+Eclipse-LazyStart: true
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/about.html b/server-side/bundles/org.eclipse.ecf.server.generic/about.html
new file mode 100644
index 000000000..5d03fd4c9
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/build.properties b/server-side/bundles/org.eclipse.ecf.server.generic/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/plugin.properties b/server-side/bundles/org.eclipse.ecf.server.generic/plugin.properties
new file mode 100644
index 000000000..aed8aaefe
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/plugin.properties
@@ -0,0 +1,13 @@
+/****************************************************************************
+* 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
+*****************************************************************************/
+plugin.name=ECF Generic Server Plug-in
+plugin.provider=Eclipse.org
+
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/server.xml b/server-side/bundles/org.eclipse.ecf.server.generic/server.xml
new file mode 100644
index 000000000..d39048dd5
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/server.xml
@@ -0,0 +1,5 @@
+<server>
+ <connector protocol="ecftcp" hostname="localhost" port="3282" timeout="30000">
+ <group name="server"/>
+ </connector>
+</server> \ No newline at end of file
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Activator.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Activator.java
new file mode 100644
index 000000000..88b60ef41
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Activator.java
@@ -0,0 +1,71 @@
+package org.eclipse.ecf.internal.server.generic;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.server.generic.ServerStarter;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.ecf.server.generic"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ private ServerStarter servers;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ servers = new ServerStarter(context.getBundle().getEntry(Messages.Activator_SERVER_XML).openStream());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ if (servers != null) {
+ servers.destroyServers();
+ servers = null;
+ }
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static void log(String message) {
+ getDefault().getLog().log(
+ new Status(IStatus.INFO, getDefault().getBundle().getSymbolicName(), IStatus.INFO, message, null));
+ }
+ public static void log(String message, Throwable e) {
+ getDefault().getLog().log(
+ new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), IStatus.ERROR,
+ message, e));
+ }
+
+
+}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Messages.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Messages.java
new file mode 100644
index 000000000..77af889fd
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/Messages.java
@@ -0,0 +1,34 @@
+/****************************************************************************
+ * 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.server.generic;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.ecf.internal.server.generic.messages"; //$NON-NLS-1$
+ public static String Activator_SERVER_XML;
+
+ public static String ServerStarter_EXCEPTION_CREATING_SERVER;
+ public static String ServerStarter_EXCEPTION_DISPOSING_SERVER;
+ public static String ServerStarter_STARTING_SERVER;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/messages.properties b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/messages.properties
new file mode 100644
index 000000000..97ea8acd1
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/internal/server/generic/messages.properties
@@ -0,0 +1,4 @@
+Activator_SERVER_XML=server.xml
+ServerStarter_EXCEPTION_CREATING_SERVER=Exception creating servers
+ServerStarter_EXCEPTION_DISPOSING_SERVER=Exception disposing server
+ServerStarter_STARTING_SERVER=Starting Server with id={0}
diff --git a/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/ServerStarter.java b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/ServerStarter.java
new file mode 100644
index 000000000..d5fd74eab
--- /dev/null
+++ b/server-side/bundles/org.eclipse.ecf.server.generic/src/org/eclipse/ecf/server/generic/ServerStarter.java
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * 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.server.generic;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.internal.server.generic.Activator;
+import org.eclipse.ecf.internal.server.generic.Messages;
+import org.eclipse.ecf.provider.app.Connector;
+import org.eclipse.ecf.provider.app.NamedGroup;
+import org.eclipse.ecf.provider.app.ServerConfigParser;
+import org.eclipse.ecf.provider.generic.SOContainerConfig;
+import org.eclipse.ecf.provider.generic.TCPServerSOContainer;
+import org.eclipse.ecf.provider.generic.TCPServerSOContainerGroup;
+import org.eclipse.osgi.util.NLS;
+
+public class ServerStarter {
+
+ static TCPServerSOContainerGroup serverGroups[] = null;
+
+ static List servers = new ArrayList();
+
+ public ServerStarter(InputStream ins) {
+ try {
+ createServers(ins);
+ } catch (Exception e) {
+ Activator.log(Messages.ServerStarter_EXCEPTION_CREATING_SERVER,e); //$NON-NLS-1$
+ }
+ }
+
+ protected boolean isActive() {
+ return (servers.size() > 0);
+ }
+
+ public synchronized void destroyServers() {
+ for (Iterator i = servers.iterator(); i.hasNext();) {
+ TCPServerSOContainer server = (TCPServerSOContainer) i.next();
+ if (server != null) {
+ try {
+ server.dispose();
+ } catch (Exception e) {
+ Activator.log(Messages.ServerStarter_EXCEPTION_DISPOSING_SERVER,e); //$NON-NLS-1$
+ }
+ }
+ }
+ servers.clear();
+ if (serverGroups != null) {
+ for (int i = 0; i < serverGroups.length; i++) {
+ serverGroups[i].takeOffTheAir();
+ }
+ serverGroups = null;
+ }
+ }
+
+ protected synchronized void createServers(InputStream ins) throws Exception {
+ ServerConfigParser scp = new ServerConfigParser();
+ List connectors = scp.load(ins);
+ if (connectors != null) {
+ serverGroups = new TCPServerSOContainerGroup[connectors.size()];
+ int j = 0;
+ for (Iterator i = connectors.iterator(); i.hasNext();) {
+ Connector connect = (Connector) i.next();
+ serverGroups[j] = createServerGroup(connect.getHostname(),
+ connect.getPort());
+ List groups = connect.getGroups();
+ for (Iterator g = groups.iterator(); g.hasNext();) {
+ NamedGroup group = (NamedGroup) g.next();
+ TCPServerSOContainer cont = createServerContainer(group
+ .getIDForGroup(), serverGroups[j], group.getName(),
+ connect.getTimeout());
+ servers.add(cont);
+ log(NLS.bind(Messages.ServerStarter_STARTING_SERVER,cont.getID().getName())); //$NON-NLS-1$
+ }
+ serverGroups[j].putOnTheAir();
+ j++;
+ }
+ }
+ }
+
+ protected void log(String output) {
+ Activator.log(output);
+ }
+
+ protected TCPServerSOContainerGroup createServerGroup(String name, int port) {
+ TCPServerSOContainerGroup group = new TCPServerSOContainerGroup(name,
+ port);
+ return group;
+ }
+
+ protected TCPServerSOContainer createServerContainer(String id,
+ TCPServerSOContainerGroup group, String path, int keepAlive)
+ throws IDCreateException {
+ ID newServerID = IDFactory.getDefault().createStringID(id);
+ return new TCPServerSOContainer(new SOContainerConfig(newServerID),
+ group, path, keepAlive);
+ }
+}

Back to the top