Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-19 08:22:04 +0000
committerEike Stepper2012-07-19 08:22:04 +0000
commit1460904fd3c193ffaf809913b2983a400fce9d94 (patch)
tree72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.emf.cdo.dawn.util
parent5f360965ae87478e0681899bf310a210cafc2c44 (diff)
downloadcdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.util')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/.settings/org.eclipse.core.resources.prefs6
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt14
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/plugin.properties22
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/internal/util/bundle/OM.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java432
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/exceptions/DawnInvalidIdException.java60
6 files changed, 312 insertions, 312 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.cdo.dawn.util/.settings/org.eclipse.core.resources.prefs
index 11545c3612..b4de20b808 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 04 12:54:22 CEST 2011
-eclipse.preferences.version=1
-encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
+#Mon Jul 04 12:54:22 CEST 2011
+eclipse.preferences.version=1
+encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt b/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt
index 9cbb3ba084..cea141de92 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt
@@ -1,8 +1,8 @@
-Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
Martin Fluegge - initial API and implementation \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/plugin.properties b/plugins/org.eclipse.emf.cdo.dawn.util/plugin.properties
index 4eb4d3031b..0e1d0094e0 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/plugin.properties
@@ -1,11 +1,11 @@
-# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
-# Martin Fluegge - initial API and implementation
-
-pluginName = CDO Dawn Utilities
-providerName = Eclipse Modeling Project
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+# Martin Fluegge - initial API and implementation
+
+pluginName = CDO Dawn Utilities
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/internal/util/bundle/OM.java b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/internal/util/bundle/OM.java
index 3b653f2c7c..e0879ffea2 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/internal/util/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/internal/util/bundle/OM.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.internal.util.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.emf.cdo.dawn.util"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_OBJECT = DEBUG.tracer("object"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Martin Fluegge
- * @since 1.0
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.internal.util.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.dawn.util"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_OBJECT = DEBUG.tracer("object"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java
index a10c15ec35..573fa93590 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/connection/CDOConnectionUtil.java
@@ -1,216 +1,216 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.util.connection;
-
-import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM;
-import org.eclipse.emf.cdo.dawn.util.exceptions.DawnInvalidIdException;
-import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.view.CDOAdapterPolicy;
-import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.emf.cdo.view.CDOViewSet;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.tcp.TCPUtil;
-import org.eclipse.net4j.util.container.IPluginContainer;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.spi.cdo.InternalCDOView;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Martin Fluegge
- */
-public class CDOConnectionUtil
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOConnectionUtil.class);
-
- public static CDOConnectionUtil instance = new CDOConnectionUtil();
-
- private CDOSession currentSession;
-
- private String repositoryName;
-
- private String protocol;
-
- private String host;
-
- private Map<String, CDOTransaction> transactions;
-
- private IConnector connector;
-
- static
- {
- if (!OMPlatform.INSTANCE.isOSGiRunning())
- {
- Net4jUtil.prepareContainer(IPluginContainer.INSTANCE);
- TCPUtil.prepareContainer(IPluginContainer.INSTANCE);
- CDONet4jUtil.prepareContainer(IPluginContainer.INSTANCE);
- }
- }
-
- public CDOConnectionUtil()
- {
- }
-
- public void init(String repositoryName, String protocol, String host)
- {
- this.repositoryName = repositoryName;
- this.protocol = protocol;
- this.host = host;
- setConnector(Net4jUtil.getConnector(IPluginContainer.INSTANCE, protocol, host));
- }
-
- public void registerPackages(List<EPackage> packages)
- {
- if (packages == null)
- {
- return;
- }
-
- for (EPackage pack : packages)
- {
- pack.eClass();
- }
- }
-
- /**
- * opens the session if it is not opened.
- */
- public CDOSession openSession()
- {
- if (!CDOUtil.isLegacyModeDefault())
- {
- CDOUtil.setLegacyModeDefault(true);
- }
-
- currentSession = (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions", "cdo", protocol
- + "://" + host + "?repositoryName=" + repositoryName);
-
- return currentSession;
- }
-
- public void closeCurrentSession()
- {
- getCurrentSession().close();
- }
-
- /**
- * opens a transaction on the given resourceSet
- */
- public CDOTransaction openCurrentTransaction(ResourceSet resourceSet, String id)
- {
- if (id == null)
- {
- throw new DawnInvalidIdException("The identifier '" + id + "' is invalid for openeing a transaction");
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Opening transaction for {0} on {1}", id, resourceSet); //$NON-NLS-1$
- }
-
- id = convert(id);
- CDOTransaction transaction = getCurrentSession().openTransaction(resourceSet);
- getTransactions().put(id, transaction);
- return transaction;
- }
-
- public void setChangeSubscribtionPolicyForCurrentTransaction(CDOAdapterPolicy policy, String id)
- {
- id = convert(id);
- getTransactions().get(id).options().addChangeSubscriptionPolicy(policy);
- }
-
- public CDOTransaction getCurrentTransaction(String id)
- {
- id = convert(id);
- return getTransactions().get(id);
- }
-
- // TODO find a better way to solve this problem
- private String convert(String id)
- {
- return id.replace("dawn", "cdo");
- }
-
- public CDOSession getCurrentSession()
- {
- if (currentSession == null)
- {
- currentSession = openSession();
- }
-
- return currentSession;
- }
-
- public Map<String, CDOTransaction> getTransactions()
- {
- if (transactions == null)
- {
- transactions = new HashMap<String, CDOTransaction>();
- }
-
- return transactions;
- }
-
- public CDOView openView(CDOSession session)
- {
- return session.openView();
- }
-
- public CDOTransaction openTransaction(CDOSession session)
- {
- return session.openTransaction();
- }
-
- @Deprecated
- public static void closeSession(CDOSession session)
- {
- session.close();
- }
-
- public CDOTransaction getOrOpenCurrentTransaction(String id, ResourceSet resourceSet, String repositoryName)
- {
- CDOTransaction transaction = getCurrentTransaction(id);
- CDOViewSet viewSet = CDOUtil.getViewSet(resourceSet);
- if (viewSet != null)
- {
- return ((InternalCDOView)viewSet.resolveView(repositoryName)).toTransaction();
- }
-
- if (transaction == null)
- {
- transaction = openCurrentTransaction(resourceSet, id);
- }
-
- return transaction;
- }
-
- public void setConnector(IConnector connector)
- {
- this.connector = connector;
- }
-
- public IConnector getConnector()
- {
- return connector;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.util.connection;
+
+import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM;
+import org.eclipse.emf.cdo.dawn.util.exceptions.DawnInvalidIdException;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOAdapterPolicy;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.view.CDOViewSet;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.IPluginContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.spi.cdo.InternalCDOView;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Martin Fluegge
+ */
+public class CDOConnectionUtil
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOConnectionUtil.class);
+
+ public static CDOConnectionUtil instance = new CDOConnectionUtil();
+
+ private CDOSession currentSession;
+
+ private String repositoryName;
+
+ private String protocol;
+
+ private String host;
+
+ private Map<String, CDOTransaction> transactions;
+
+ private IConnector connector;
+
+ static
+ {
+ if (!OMPlatform.INSTANCE.isOSGiRunning())
+ {
+ Net4jUtil.prepareContainer(IPluginContainer.INSTANCE);
+ TCPUtil.prepareContainer(IPluginContainer.INSTANCE);
+ CDONet4jUtil.prepareContainer(IPluginContainer.INSTANCE);
+ }
+ }
+
+ public CDOConnectionUtil()
+ {
+ }
+
+ public void init(String repositoryName, String protocol, String host)
+ {
+ this.repositoryName = repositoryName;
+ this.protocol = protocol;
+ this.host = host;
+ setConnector(Net4jUtil.getConnector(IPluginContainer.INSTANCE, protocol, host));
+ }
+
+ public void registerPackages(List<EPackage> packages)
+ {
+ if (packages == null)
+ {
+ return;
+ }
+
+ for (EPackage pack : packages)
+ {
+ pack.eClass();
+ }
+ }
+
+ /**
+ * opens the session if it is not opened.
+ */
+ public CDOSession openSession()
+ {
+ if (!CDOUtil.isLegacyModeDefault())
+ {
+ CDOUtil.setLegacyModeDefault(true);
+ }
+
+ currentSession = (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions", "cdo", protocol
+ + "://" + host + "?repositoryName=" + repositoryName);
+
+ return currentSession;
+ }
+
+ public void closeCurrentSession()
+ {
+ getCurrentSession().close();
+ }
+
+ /**
+ * opens a transaction on the given resourceSet
+ */
+ public CDOTransaction openCurrentTransaction(ResourceSet resourceSet, String id)
+ {
+ if (id == null)
+ {
+ throw new DawnInvalidIdException("The identifier '" + id + "' is invalid for openeing a transaction");
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Opening transaction for {0} on {1}", id, resourceSet); //$NON-NLS-1$
+ }
+
+ id = convert(id);
+ CDOTransaction transaction = getCurrentSession().openTransaction(resourceSet);
+ getTransactions().put(id, transaction);
+ return transaction;
+ }
+
+ public void setChangeSubscribtionPolicyForCurrentTransaction(CDOAdapterPolicy policy, String id)
+ {
+ id = convert(id);
+ getTransactions().get(id).options().addChangeSubscriptionPolicy(policy);
+ }
+
+ public CDOTransaction getCurrentTransaction(String id)
+ {
+ id = convert(id);
+ return getTransactions().get(id);
+ }
+
+ // TODO find a better way to solve this problem
+ private String convert(String id)
+ {
+ return id.replace("dawn", "cdo");
+ }
+
+ public CDOSession getCurrentSession()
+ {
+ if (currentSession == null)
+ {
+ currentSession = openSession();
+ }
+
+ return currentSession;
+ }
+
+ public Map<String, CDOTransaction> getTransactions()
+ {
+ if (transactions == null)
+ {
+ transactions = new HashMap<String, CDOTransaction>();
+ }
+
+ return transactions;
+ }
+
+ public CDOView openView(CDOSession session)
+ {
+ return session.openView();
+ }
+
+ public CDOTransaction openTransaction(CDOSession session)
+ {
+ return session.openTransaction();
+ }
+
+ @Deprecated
+ public static void closeSession(CDOSession session)
+ {
+ session.close();
+ }
+
+ public CDOTransaction getOrOpenCurrentTransaction(String id, ResourceSet resourceSet, String repositoryName)
+ {
+ CDOTransaction transaction = getCurrentTransaction(id);
+ CDOViewSet viewSet = CDOUtil.getViewSet(resourceSet);
+ if (viewSet != null)
+ {
+ return ((InternalCDOView)viewSet.resolveView(repositoryName)).toTransaction();
+ }
+
+ if (transaction == null)
+ {
+ transaction = openCurrentTransaction(resourceSet, id);
+ }
+
+ return transaction;
+ }
+
+ public void setConnector(IConnector connector)
+ {
+ this.connector = connector;
+ }
+
+ public IConnector getConnector()
+ {
+ return connector;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/exceptions/DawnInvalidIdException.java b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/exceptions/DawnInvalidIdException.java
index aab69ca8ce..8557eef75b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/exceptions/DawnInvalidIdException.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/exceptions/DawnInvalidIdException.java
@@ -1,30 +1,30 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.util.exceptions;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnInvalidIdException extends RuntimeException
-{
-
- private static final long serialVersionUID = 1L;
-
- public DawnInvalidIdException()
- {
- super();
- }
-
- public DawnInvalidIdException(String s)
- {
- super(s);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.util.exceptions;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnInvalidIdException extends RuntimeException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public DawnInvalidIdException()
+ {
+ super();
+ }
+
+ public DawnInvalidIdException(String s)
+ {
+ super(s);
+ }
+}

Back to the top