summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-02 03:01:07 (EDT)
committerEike Stepper2007-07-02 03:01:07 (EDT)
commit354a64b680a1723978e92e209e1255142a4f7fc7 (patch)
tree10e78f094e22539cda1607cc24cc7985ca287de4
parent9bbb83d2cf450a8e6474abc3b15d1d3f82d566b5 (diff)
downloadcdo-354a64b680a1723978e92e209e1255142a4f7fc7.zip
cdo-354a64b680a1723978e92e209e1255142a4f7fc7.tar.gz
cdo-354a64b680a1723978e92e209e1255142a4f7fc7.tar.bz2
task 1: Develop 0.8.0
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ResourceHistory.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java115
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionInvalidationEvent.java31
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionViewsEvent.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionAdaptersEvent.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java106
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java111
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java37
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java7
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestBufferPool.java8
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/TransportContainer.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/BufferUtil.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportUtil.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java2
17 files changed, 353 insertions, 160 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ResourceHistory.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ResourceHistory.java
new file mode 100644
index 0000000..150774c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ResourceHistory.java
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui;
+
+import org.eclipse.emf.cdo.CDOView;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ResourceHistory
+{
+ public static final ResourceHistory INSTANCE = new ResourceHistory();
+
+ private static final Entry[] NO_ENTRIES = {};
+
+ private ResourceHistory()
+ {
+ }
+
+ public Entry[] getEntries(CDOView view)
+ {
+ return NO_ENTRIES;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Entry
+ {
+ private String resourcePath;
+
+ private Entry(String resourcePath)
+ {
+ this.resourcePath = resourcePath;
+ }
+
+ public String getResourcePath()
+ {
+ return resourcePath;
+ }
+
+ @Override
+ public String toString()
+ {
+ return resourcePath;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
index 97542e2..7d01c3e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
@@ -10,11 +10,12 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.views;
-import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.internal.ui.ResourceHistory;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
-import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
+import org.eclipse.net4j.IConnector;
import org.eclipse.net4j.ui.actions.LongRunningAction;
import org.eclipse.net4j.ui.views.ContainerItemProvider;
import org.eclipse.net4j.ui.views.IElementFilter;
@@ -25,12 +26,11 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.part.ISetSelectionTarget;
+
+import java.util.Date;
/**
* @author Eike Stepper
@@ -51,6 +51,39 @@ public class CDOItemProvider extends ContainerItemProvider
}
@Override
+ public Object[] getChildren(Object element)
+ {
+ if (element instanceof CDOView)
+ {
+ CDOView view = (CDOView)element;
+ return getResources(view);
+ }
+
+ return super.getChildren(element);
+ }
+
+ @Override
+ public String getText(Object obj)
+ {
+ if (obj instanceof CDOSession)
+ {
+ CDOSession session = (CDOSession)obj;
+ IConnector connector = session.getChannel().getConnector();
+ String repositoryName = session.getRepositoryName();
+ return connector.getURL() + "/" + repositoryName;
+ }
+
+ if (obj instanceof CDOView)
+ {
+ CDOView view = (CDOView)obj;
+ return view.isHistorical() ? new Date(view.getTimeStamp()).toString() : view.isReadOnly() ? "readOnly"
+ : "readWrite";
+ }
+
+ return super.getText(obj);
+ }
+
+ @Override
public Image getImage(Object obj)
{
if (obj instanceof CDOSession)
@@ -87,7 +120,7 @@ public class CDOItemProvider extends ContainerItemProvider
if (object instanceof CDOSession)
{
CDOSession session = (CDOSession)object;
- manager.add(new OpenEditorAction("Open Editor", "Open a CDO editor", session)
+ manager.add(new OpenViewAction("Open View", "Open a CDO view", session)
{
@Override
protected CDOView createView()
@@ -96,7 +129,7 @@ public class CDOItemProvider extends ContainerItemProvider
}
});
- manager.add(new OpenEditorAction("Open Read-Only Editor", "Open a read-only CDO editor", session)
+ manager.add(new OpenViewAction("Open Read-Only View", "Open a read-only CDO view", session)
{
@Override
protected CDOView createView()
@@ -105,7 +138,7 @@ public class CDOItemProvider extends ContainerItemProvider
}
});
- manager.add(new OpenEditorAction("Open Historical Editor", "Open a historical CDO editor", session)
+ manager.add(new OpenViewAction("Open Historical View", "Open a historical CDO view", session)
{
@Override
protected CDOView createView()
@@ -125,11 +158,11 @@ public class CDOItemProvider extends ContainerItemProvider
/**
* @author Eike Stepper
*/
- private abstract class OpenEditorAction extends LongRunningAction
+ private abstract class OpenViewAction extends LongRunningAction
{
private CDOSession session;
- public OpenEditorAction(String text, String toolTipText, CDOSession session)
+ public OpenViewAction(String text, String toolTipText, CDOSession session)
{
super(page, text, toolTipText, getOpenEditorImageDescriptor());
this.session = session;
@@ -143,38 +176,41 @@ public class CDOItemProvider extends ContainerItemProvider
@Override
protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
{
- final Exception[] exception = new Exception[1];
- final CDOView view = createView();
- final IWorkbenchPart part = page.getActivePart();
- getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- if (part instanceof ISetSelectionTarget)
- {
- ((ISetSelectionTarget)part).selectReveal(new StructuredSelection(view));
- }
-
- CDOEditor.open(page, view, "/res/test");
- }
- catch (Exception ex)
- {
- exception[0] = ex;
- }
- }
- });
-
- if (exception[0] != null)
- {
- throw exception[0];
- }
+ // final Exception[] exception = new Exception[1];
+ // final CDOView view =
+ createView();
+ // final IWorkbenchPart part = page.getActivePart();
+ // getDisplay().asyncExec(new Runnable()
+ // {
+ // public void run()
+ // {
+ // try
+ // {
+ // if (part instanceof ISetSelectionTarget)
+ // {
+ // ((ISetSelectionTarget)part).selectReveal(new
+ // StructuredSelection(view));
+ // }
+ //
+ // CDOEditor.open(page, view, "/res/test");
+ // }
+ // catch (Exception ex)
+ // {
+ // exception[0] = ex;
+ // }
+ // }
+ // });
+ //
+ // if (exception[0] != null)
+ // {
+ // throw exception[0];
+ // }
}
protected abstract CDOView createView();
}
+ @Override
protected Display getDisplay()
{
Display display = getViewer().getControl().getDisplay();
@@ -195,4 +231,9 @@ public class CDOItemProvider extends ContainerItemProvider
return display;
}
+
+ protected Object[] getResources(CDOView view)
+ {
+ return ResourceHistory.INSTANCE.getEntries(view);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionInvalidationEvent.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionInvalidationEvent.java
new file mode 100644
index 0000000..60ea173
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionInvalidationEvent.java
@@ -0,0 +1,31 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo;
+
+import org.eclipse.emf.cdo.protocol.CDOID;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOSessionInvalidationEvent extends IEvent
+{
+ public CDOSession getSession();
+
+ public CDOView getView();
+
+ public long getTimeStamp();
+
+ public Set<CDOID> getDirtyOIDs();
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionAdaptersEvent.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionViewsEvent.java
index fb37ca7..eef3d6e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionAdaptersEvent.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSessionViewsEvent.java
@@ -15,9 +15,9 @@ import org.eclipse.net4j.util.container.IContainerEvent;
/**
* @author Eike Stepper
*/
-public interface CDOSessionAdaptersEvent extends IContainerEvent<CDOView>
+public interface CDOSessionViewsEvent extends IContainerEvent<CDOView>
{
public CDOSession getSession();
- public CDOView getAdapter();
+ public CDOView getView();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
index 206f241..4b279ce 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
@@ -12,17 +12,15 @@ package org.eclipse.emf.cdo;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.protocol.CDOID;
-import org.eclipse.emf.cdo.protocol.event.CDOEventSource;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
-import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.ResourceSet;
/**
* @author Eike Stepper
*/
-public interface CDOView extends CDOEventSource, Adapter
+public interface CDOView
{
public static final long UNSPECIFIED_DATE = CDORevision.UNSPECIFIED_DATE;
@@ -48,6 +46,8 @@ public interface CDOView extends CDOEventSource, Adapter
*/
public CDOResource getResource(String path);
+ public CDORevision resolve(CDOID id);
+
/**
* @see CDOTransaction#commit()
*/
@@ -59,6 +59,4 @@ public interface CDOView extends CDOEventSource, Adapter
public void rollback();
public void close();
-
- public CDORevision resolve(CDOID id);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index ba91ad5..314feef 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -10,8 +10,9 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo;
+import org.eclipse.emf.cdo.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.CDOSessionAdaptersEvent;
+import org.eclipse.emf.cdo.CDOSessionViewsEvent;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.util.CDOUtil;
@@ -20,6 +21,7 @@ import org.eclipse.net4j.ConnectorException;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.IConnector;
import org.eclipse.net4j.internal.util.container.SingleDeltaContainerEvent;
+import org.eclipse.net4j.internal.util.event.Event;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.internal.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.net4j.util.container.IContainerDelta;
@@ -60,7 +62,7 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
private CDORevisionManagerImpl revisionManager;
- private Map<ResourceSet, CDOViewImpl> adapters = new HashMap();
+ private Map<ResourceSet, CDOViewImpl> views = new HashMap();
private IListener channelListener = new LifecycleEventAdapter()
{
@@ -159,9 +161,9 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
public CDOViewImpl[] getViews()
{
Collection<CDOViewImpl> values;
- synchronized (adapters)
+ synchronized (views)
{
- values = adapters.values();
+ values = views.values();
}
return values.toArray(new CDOViewImpl[values.size()]);
}
@@ -173,34 +175,36 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
public boolean isEmpty()
{
- return adapters.isEmpty();
+ return views.isEmpty();
}
- public void adapterDetached(CDOViewImpl adapter)
+ public void viewDetached(CDOViewImpl view)
{
- synchronized (adapters)
+ synchronized (views)
{
- adapters.remove(adapter.getResourceSet());
- fireEvent(new CDOSessionAdaptersEventImpl(this, adapter, IContainerDelta.Kind.REMOVED));
+ views.remove(view.getResourceSet());
+ fireEvent(new ViewsEvent(view, IContainerDelta.Kind.REMOVED));
}
}
- public void notifyInvalidation(long timeStamp, Set<CDOID> dirtyOIDs, CDOViewImpl excludedAdapter)
+ public void notifyInvalidation(long timeStamp, Set<CDOID> dirtyOIDs, CDOViewImpl excludedView)
{
CDOViewImpl[] values;
- synchronized (adapters)
+ synchronized (views)
{
- values = adapters.values().toArray(new CDOViewImpl[adapters.size()]);
+ values = views.values().toArray(new CDOViewImpl[views.size()]);
}
Set<CDOID> unmodifiableSet = Collections.unmodifiableSet(dirtyOIDs);
- for (CDOViewImpl adapter : values)
+ for (CDOViewImpl view : values)
{
- if (adapter != excludedAdapter)
+ if (view != excludedView)
{
- adapter.notifyInvalidation(timeStamp, unmodifiableSet);
+ view.notifyInvalidation(timeStamp, unmodifiableSet);
}
}
+
+ fireEvent(new InvalidationEvent(excludedView, timeStamp, unmodifiableSet));
}
@Override
@@ -245,38 +249,37 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
private void prepare(ResourceSet resourceSet)
{
- CDOView adapter = CDOUtil.getView(resourceSet);
- if (adapter != null)
+ CDOView view = CDOUtil.getView(resourceSet);
+ if (view != null)
{
- throw new IllegalStateException("CDO adapter already present: " + adapter);
+ throw new IllegalStateException("CDO view already present: " + view);
}
CDOUtil.addResourceFactory(resourceSet);
}
- private CDOViewImpl attach(ResourceSet resourceSet, CDOViewImpl adapter)
+ private CDOViewImpl attach(ResourceSet resourceSet, CDOViewImpl view)
{
- synchronized (adapters)
+ synchronized (views)
{
- resourceSet.eAdapters().add(adapter);
- adapters.put(resourceSet, adapter);
- fireEvent(new CDOSessionAdaptersEventImpl(this, adapter, IContainerDelta.Kind.ADDED));
+ resourceSet.eAdapters().add(view);
+ views.put(resourceSet, view);
+ fireEvent(new ViewsEvent(view, IContainerDelta.Kind.ADDED));
}
- return adapter;
+ return view;
}
/**
* @author Eike Stepper
*/
- private static class CDOSessionAdaptersEventImpl extends SingleDeltaContainerEvent<CDOView> implements
- CDOSessionAdaptersEvent
+ private final class ViewsEvent extends SingleDeltaContainerEvent<CDOView> implements CDOSessionViewsEvent
{
private static final long serialVersionUID = 1L;
- public CDOSessionAdaptersEventImpl(CDOSession session, CDOView adapter, Kind kind)
+ public ViewsEvent(CDOView view, Kind kind)
{
- super(session, adapter, kind);
+ super(CDOSessionImpl.this, view, kind);
}
public CDOSession getSession()
@@ -284,9 +287,54 @@ public class CDOSessionImpl extends Lifecycle implements CDOSession
return (CDOSession)getContainer();
}
- public CDOView getAdapter()
+ public CDOView getView()
{
return getDeltaElement();
}
}
+
+ private final class InvalidationEvent extends Event implements CDOSessionInvalidationEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private CDOViewImpl view;
+
+ private long timeStamp;
+
+ private Set<CDOID> dirtyOIDs;
+
+ public InvalidationEvent(CDOViewImpl view, long timeStamp, Set<CDOID> dirtyOIDs)
+ {
+ super(CDOSessionImpl.this);
+ this.view = view;
+ this.timeStamp = timeStamp;
+ this.dirtyOIDs = dirtyOIDs;
+ }
+
+ public CDOSession getSession()
+ {
+ return CDOSessionImpl.this;
+ }
+
+ public CDOViewImpl getView()
+ {
+ return view;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public Set<CDOID> getDirtyOIDs()
+ {
+ return dirtyOIDs;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "CDOSessionInvalidationEvent" + dirtyOIDs;
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index 476078f..8c72c92 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -34,7 +34,7 @@ public class CDOTransactionImpl
private long nextTemporaryID = INITIAL_TEMPORARY_ID;
- private CDOViewImpl adapter;
+ private CDOViewImpl view;
private Map<CDOID, CDOResourceImpl> newResources = new HashMap();
@@ -42,14 +42,14 @@ public class CDOTransactionImpl
private Map<CDOID, CDOObjectImpl> dirtyObjects = new HashMap();
- public CDOTransactionImpl(CDOViewImpl adapter)
+ public CDOTransactionImpl(CDOViewImpl view)
{
- this.adapter = adapter;
+ this.view = view;
}
- public CDOViewImpl getAdapter()
+ public CDOViewImpl getView()
{
- return adapter;
+ return view;
}
public Map<CDOID, CDOResourceImpl> getNewResources()
@@ -86,14 +86,14 @@ public class CDOTransactionImpl
try
{
- CDOSessionImpl session = adapter.getSession();
+ CDOSessionImpl session = view.getSession();
CommitTransactionRequest signal = new CommitTransactionRequest(session.getChannel(), this);
CommitTransactionResult result = signal.send();
postCommit(newResources, result);
postCommit(newObjects, result);
postCommit(dirtyObjects, result);
- session.notifyInvalidation(result.getTimeStamp(), dirtyObjects.keySet(), adapter);
+ session.notifyInvalidation(result.getTimeStamp(), dirtyObjects.keySet(), view);
newResources.clear();
newObjects.clear();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index c398deb..4adca16 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -10,17 +10,14 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo;
-import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
+import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
-import org.eclipse.emf.cdo.internal.protocol.event.CDOEventImpl;
-import org.eclipse.emf.cdo.internal.protocol.event.CDOEventSourceImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.protocol.CDOID;
-import org.eclipse.emf.cdo.protocol.event.CDOInvalidationEvent;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.revision.CDORevisionResolver;
import org.eclipse.emf.cdo.protocol.util.ImplementationError;
@@ -47,9 +44,9 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.Internal
+public class CDOViewImpl implements CDOView, Adapter.Internal
{
- private static final ContextTracer TRACER = new ContextTracer(CDO.DEBUG_ADAPTER, CDOViewImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(CDO.DEBUG_VIEW, CDOViewImpl.class);
private CDOSessionImpl session;
@@ -169,6 +166,7 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
resourceObject.setResource(resource);
resourceObject.setState(CDOState.PROXY);
+ resources.add(resource);
return resource;
}
catch (Exception ex)
@@ -261,8 +259,6 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
CDOStateMachine.INSTANCE.invalidate(object, timeStamp);
}
}
-
- fireObjectEvent(new CDOInvalidationEventImpl(timeStamp, dirtyOIDs));
}
public void commit()
@@ -279,14 +275,14 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
public void close()
{
- session.adapterDetached(this);
+ session.viewDetached(this);
}
@Override
public String toString()
{
- return MessageFormat.format("CDOView({0}, {1})", isHistorical() ? new Date(timeStamp) : (isReadOnly() ? "readOnly"
- : "readWrite"));
+ return MessageFormat.format("CDOView({0})", isHistorical() ? new Date(timeStamp) : isReadOnly() ? "readOnly"
+ : "readWrite");
}
public boolean isAdapterForType(Object type)
@@ -313,7 +309,7 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
if (resource instanceof CDOResourceImpl)
{
CDOResourceImpl cdoResource = (CDOResourceImpl)resource;
- CDOStateMachine.INSTANCE.attach(cdoResource, cdoResource, this);
+ notifyAdd(cdoResource);
}
}
}
@@ -326,7 +322,7 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
if (resource instanceof CDOResourceImpl)
{
CDOResourceImpl cdoResource = (CDOResourceImpl)resource;
- CDOStateMachine.INSTANCE.detach(cdoResource, cdoResource, this);
+ notifyRemove(cdoResource);
}
}
@@ -367,8 +363,7 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
{
if (msg.getNewValue() instanceof CDOResourceImpl)
{
- CDOResourceImpl cdoResource = (CDOResourceImpl)msg.getNewValue();
- CDOStateMachine.INSTANCE.attach(cdoResource, cdoResource, this);
+ notifyAdd((CDOResourceImpl)msg.getNewValue());
}
}
@@ -382,19 +377,22 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
{
if (!oldResources.contains(newResource))
{
- CDOResourceImpl cdoResource = (CDOResourceImpl)newResource;
- CDOStateMachine.INSTANCE.attach(cdoResource, cdoResource, this);
+ notifyAdd((CDOResourceImpl)newResource);
}
}
}
}
+ private void notifyAdd(CDOResourceImpl cdoResource)
+ {
+ CDOStateMachine.INSTANCE.attach(cdoResource, cdoResource, this);
+ }
+
private void notifyRemove(Notification msg)
{
if (msg.getOldValue() instanceof CDOResourceImpl)
{
- CDOResourceImpl cdoResource = (CDOResourceImpl)msg.getOldValue();
- CDOStateMachine.INSTANCE.detach(cdoResource, cdoResource, this);
+ notifyRemove((CDOResourceImpl)msg.getOldValue());
}
}
@@ -408,13 +406,17 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
{
if (!newResources.contains(oldResource))
{
- CDOResourceImpl cdoResource = (CDOResourceImpl)oldResource;
- CDOStateMachine.INSTANCE.detach(cdoResource, cdoResource, this);
+ notifyRemove((CDOResourceImpl)oldResource);
}
}
}
}
+ private void notifyRemove(CDOResourceImpl cdoResource)
+ {
+ CDOStateMachine.INSTANCE.detach(cdoResource, cdoResource, this);
+ }
+
private CDOObjectImpl createObjectFromView(CDOID id)
{
if (TRACER.isEnabled())
@@ -447,36 +449,39 @@ public class CDOViewImpl extends CDOEventSourceImpl implements CDOView, Adapter.
{
if (isReadOnly())
{
- throw new IllegalStateException("CDO adapter is read only");
- }
- }
-
- public static class CDOInvalidationEventImpl extends CDOEventImpl implements CDOInvalidationEvent
- {
- private long timeStamp;
-
- private Set<CDOID> dirtyOIDs;
-
- public CDOInvalidationEventImpl(long timeStamp, Set<CDOID> dirtyOIDs)
- {
- this.timeStamp = timeStamp;
- this.dirtyOIDs = dirtyOIDs;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public Set<CDOID> getDirtyOIDs()
- {
- return dirtyOIDs;
- }
-
- @Override
- public String toString()
- {
- return "CDOInvalidationEvent" + dirtyOIDs;
- }
- }
+ throw new IllegalStateException("CDO view is read only");
+ }
+ }
+
+ // public final class HistoryEntryImpl implements HistoryEntry, Comparable
+ // {
+ // private String resourcePath;
+ //
+ // private HistoryEntryImpl(String resourcePath)
+ // {
+ // this.resourcePath = resourcePath;
+ // }
+ //
+ // public CDOView getView()
+ // {
+ // return CDOViewImpl.this;
+ // }
+ //
+ // public String getResourcePath()
+ // {
+ // return resourcePath;
+ // }
+ //
+ // public int compareTo(Object o)
+ // {
+ // HistoryEntry that = (HistoryEntry)o;
+ // return resourcePath.compareTo(that.getResourcePath());
+ // }
+ //
+ // @Override
+ // public String toString()
+ // {
+ // return resourcePath;
+ // }
+ // }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java
index a2f2f9d..54e1af5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java
@@ -32,8 +32,6 @@ public final class CDO
public static final OMTracer DEBUG_SESSION = DEBUG.tracer("session"); //$NON-NLS-1$
- public static final OMTracer DEBUG_ADAPTER = DEBUG.tracer("adapter"); //$NON-NLS-1$
-
public static final OMTracer DEBUG_VIEW = DEBUG.tracer("view"); //$NON-NLS-1$
public static final OMTracer DEBUG_TRANSCTION = DEBUG.tracer("transaction"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
index f6d91a5..dcbfee7 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
@@ -54,7 +54,7 @@ public class CommitTransactionRequest extends CDOClientRequest<CommitTransaction
{
try
{
- CDOID id = (CDOID)CDOStore.convertToID(transaction.getAdapter(), object);
+ CDOID id = (CDOID)CDOStore.convertToID(transaction.getView(), object);
if (PROTOCOL.isEnabled())
{
PROTOCOL.format("Converted dangling reference: {0} --> {1}", object, id);
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
index 4142d6d..ab49417 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
@@ -14,6 +14,7 @@ import org.eclipse.net4j.ConnectorException;
import org.eclipse.net4j.IBuffer;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.IProtocol;
+import org.eclipse.net4j.jvm.IJVMConstants;
import org.eclipse.internal.net4j.Channel;
import org.eclipse.internal.net4j.Connector;
@@ -55,6 +56,27 @@ public abstract class JVMConnector extends Connector
this.peer = peer;
}
+ public String getURL()
+ {
+ return IJVMConstants.TYPE + "://" + name;
+ }
+
+ @Override
+ public void multiplexBuffer(IChannel localChannel)
+ {
+ short channelIndex = localChannel.getChannelIndex();
+ Channel peerChannel = peer.getChannel(channelIndex);
+ if (peerChannel == null)
+ {
+ throw new IllegalStateException("peerChannel == null"); //$NON-NLS-1$
+ }
+
+ Queue<IBuffer> localQueue = ((Channel)localChannel).getSendQueue();
+ IBuffer buffer = localQueue.poll();
+ buffer.flip();
+ peerChannel.handleBufferFromMultiplexer(buffer);
+ }
+
@Override
protected void registerChannelWithPeer(short channelIndex, IProtocol protocol) throws ConnectorException
{
@@ -78,21 +100,6 @@ public abstract class JVMConnector extends Connector
}
}
- public void multiplexBuffer(IChannel localChannel)
- {
- short channelIndex = localChannel.getChannelIndex();
- Channel peerChannel = peer.getChannel(channelIndex);
- if (peerChannel == null)
- {
- throw new IllegalStateException("peerChannel == null"); //$NON-NLS-1$
- }
-
- Queue<IBuffer> localQueue = ((Channel)localChannel).getSendQueue();
- IBuffer buffer = localQueue.poll();
- buffer.flip();
- peerChannel.handleBufferFromMultiplexer(buffer);
- }
-
@Override
protected void doBeforeActivate() throws Exception
{
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
index 363a6c5..7bfa7d4 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.IBuffer;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.IProtocol;
import org.eclipse.net4j.tcp.ITCPConnector;
+import org.eclipse.net4j.tcp.ITCPConstants;
import org.eclipse.net4j.tcp.ITCPSelector;
import org.eclipse.net4j.tcp.ITCPSelectorListener;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -99,11 +100,17 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
this.socketChannel = socketChannel;
}
+ public String getURL()
+ {
+ return ITCPConstants.TYPE + "://" + host + ":" + port;
+ }
+
/**
* Called by {@link Channel} each time a new buffer is available for
* multiplexing. This or another buffer can be dequeued from the outputQueue
* of the {@link Channel}.
*/
+ @Override
public void multiplexBuffer(IChannel channel)
{
checkSelectionKey();
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestBufferPool.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestBufferPool.java
index 6053539..ac26500 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestBufferPool.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestBufferPool.java
@@ -12,7 +12,7 @@ package org.eclipse.net4j.tests;
import org.eclipse.net4j.IBuffer;
import org.eclipse.net4j.IBufferPool;
-import org.eclipse.net4j.TransportUtil;
+import org.eclipse.net4j.BufferUtil;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.OMPlatform;
@@ -26,7 +26,7 @@ import java.util.Collection;
*/
public class TestBufferPool
{
- private static IBufferPool bufferPool = TransportUtil.createBufferPool();
+ private static IBufferPool bufferPool = BufferUtil.createBufferPool();
private static Collection memory = new ArrayList();
@@ -48,7 +48,7 @@ public class TestBufferPool
buffers[i] = null;
}
- while (TransportUtil.getPooledBuffers(bufferPool) > 0 && allocate())
+ while (BufferUtil.getPooledBuffers(bufferPool) > 0 && allocate())
{
Thread.sleep(200);
ReflectUtil.dump(bufferPool);
@@ -59,7 +59,7 @@ public class TestBufferPool
private static void msg()
{
- System.out.println("pooledBuffers = " + TransportUtil.getPooledBuffers(bufferPool));
+ System.out.println("pooledBuffers = " + BufferUtil.getPooledBuffers(bufferPool));
}
private static boolean allocate()
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java
index 13ddf9b..91902ae 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java
@@ -35,7 +35,7 @@ public abstract class ItemProvider<INPUT> extends StructuredContentProvider<INPU
{
}
- public Object[] getElements(Object parent)
+ public final Object[] getElements(Object parent)
{
return getChildren(parent);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/TransportContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/TransportContainer.java
index 204a62c..70958ba 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/TransportContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/TransportContainer.java
@@ -12,7 +12,7 @@ package org.eclipse.internal.net4j;
import org.eclipse.net4j.IBufferProvider;
import org.eclipse.net4j.ITransportContainer;
-import org.eclipse.net4j.TransportUtil;
+import org.eclipse.net4j.BufferUtil;
import org.eclipse.net4j.internal.util.concurrent.NamedExecutorService;
import org.eclipse.net4j.internal.util.container.ManagedContainer;
import org.eclipse.net4j.util.container.IElementProcessor;
@@ -74,7 +74,7 @@ public class TransportContainer extends ManagedContainer implements ITransportCo
protected IBufferProvider createBufferProvider()
{
- return TransportUtil.createBufferPool(getBufferCapacity());
+ return BufferUtil.createBufferPool(getBufferCapacity());
}
protected ExecutorService createExecutorService()
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/BufferUtil.java
index 50876c3..7cb670c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/TransportUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/BufferUtil.java
@@ -17,11 +17,11 @@ import org.eclipse.internal.net4j.BufferPool;
* @author Eike Stepper
* @since 0.8.0
*/
-public final class TransportUtil
+public final class BufferUtil
{
public static final short DEFAULT_BUFFER_CAPACITY = 4096;
- private TransportUtil()
+ private BufferUtil()
{
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java
index e70d950..d19c76e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/IConnector.java
@@ -60,6 +60,8 @@ import org.eclipse.internal.net4j.Connector;
*/
public interface IConnector extends IContainer<IChannel>
{
+ public String getURL();
+
/**
* Indicates which role this connector has played during the establishment of
* the physical connection.