Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-05-15 20:17:22 +0000
committerEike Stepper2010-05-15 20:17:22 +0000
commit7757b0878aad75047122d4c23a59215babdf3b6d (patch)
treee02c37b9e87691905b712c821c5ae83f8a36e1e9 /plugins/org.eclipse.emf.cdo.examples.server
parentf596d3ba55a7a06184f9c70e2a699ab5b7befe28 (diff)
downloadcdo-7757b0878aad75047122d4c23a59215babdf3b6d.tar.gz
cdo-7757b0878aad75047122d4c23a59215babdf3b6d.tar.xz
cdo-7757b0878aad75047122d4c23a59215babdf3b6d.zip
vserver
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.examples.server')
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoServer.java8
2 files changed, 37 insertions, 31 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java
index 71e920f666..aec55e25e4 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java
+++ b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoConfiguration.java
@@ -67,29 +67,9 @@ public class DemoConfiguration extends Lifecycle
private transient long lastAccess = System.currentTimeMillis();
- public DemoConfiguration()
+ DemoConfiguration(Mode mode, String[] userIDs)
{
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public void setMode(Mode mode)
- {
- checkInactive();
this.mode = mode;
- }
-
- public String[] getUserIDs()
- {
- return userIDs;
- }
-
- public void setUserIDs(String[] userIDs)
- {
- checkInactive();
if (userIDs != null)
{
if (userIDs.length != 0)
@@ -104,6 +84,16 @@ public class DemoConfiguration extends Lifecycle
this.userIDs = userIDs;
}
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public String[] getUserIDs()
+ {
+ return userIDs;
+ }
+
public String getName()
{
return name;
@@ -182,15 +172,7 @@ public class DemoConfiguration extends Lifecycle
protected String createRandomName()
{
- Random random = new Random(System.currentTimeMillis());
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < NAME_LENGTH; i++)
- {
- int pos = random.nextInt(NAME_ALPHABET.length());
- builder.append(NAME_ALPHABET.charAt(pos));
- }
-
- return builder.toString();
+ return createRandomString(NAME_LENGTH, NAME_ALPHABET);
}
protected IDBStore createStore()
@@ -266,6 +248,24 @@ public class DemoConfiguration extends Lifecycle
return userManager;
}
+ public static String createRandomString(int length, String alphabet)
+ {
+ Random random = new Random(System.currentTimeMillis());
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < length; i++)
+ {
+ int pos = random.nextInt(alphabet.length());
+ builder.append(alphabet.charAt(pos));
+ }
+
+ return builder.toString();
+ }
+
+ public static String createRandomString(int length)
+ {
+ return createRandomString(length, NAME_ALPHABET);
+ }
+
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoServer.java b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoServer.java
index 8a5669613d..d3cee2c36d 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoServer.java
+++ b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/DemoServer.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.examples.server;
import org.eclipse.emf.cdo.examples.internal.server.OM;
+import org.eclipse.emf.cdo.examples.server.DemoConfiguration.Mode;
import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.tcp.TCPUtil;
@@ -68,12 +69,17 @@ public class DemoServer extends Lifecycle
}
}
- public void addConfig(DemoConfiguration config)
+ public DemoConfiguration addConfig(Mode mode)
{
+ DemoConfiguration config = new DemoConfiguration(mode, null);
+ config.activate();
+
synchronized (configs)
{
configs.put(config.getName(), config);
}
+
+ return config;
}
@Override

Back to the top