summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-23 14:42:29 (EDT)
committerEike Stepper2007-07-23 14:42:29 (EDT)
commit1dc74681bfd44218644efb7a66efc802bf5f93c5 (patch)
tree40d39f373f23142f4cd21714ecb4d3e51356af99
parent749a82103120f0749a3801bfc454bcf954f54ec7 (diff)
downloadcdo-1dc74681bfd44218644efb7a66efc802bf5f93c5.zip
cdo-1dc74681bfd44218644efb7a66efc802bf5f93c5.tar.gz
cdo-1dc74681bfd44218644efb7a66efc802bf5f93c5.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java128
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java5
9 files changed, 151 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java
index 1035a09..93c27e2 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java
@@ -127,7 +127,7 @@ public class OpenSessionIndication extends IndicationWithResponse
{
if (PROTOCOL.isEnabled())
{
- PROTOCOL.format("Writing package URI: {0}, dynamic={1}, metaIDRange={2}", p.getPackageURI(), p
+ PROTOCOL.format("Writing package info: uri={0}, dynamic={1}, metaIDRange={2}", p.getPackageURI(), p
.getMetaIDRange());
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
index 5ef0e04..48d23a6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
@@ -207,6 +207,11 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
transferTargetToRevision();
}
+ public void cdoInternalResolveRevision()
+ {
+ transferRevisionToTarget();
+ }
+
public InternalEObject cdoInternalInstance()
{
return getTarget();
@@ -233,15 +238,12 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
{
InternalEObject target = getTarget();
CDOViewImpl view = cdoView();
-
CDOClassImpl cdoClass = revision.getCDOClass();
-
CDOFeatureImpl[] features = cdoClass.getAllFeatures();
for (int i = 0; i < features.length; i++)
{
CDOFeatureImpl feature = features[i];
-
- Object targetValue = getTargetValue(target, feature, view);
+ Object targetValue = getTargetValue(target, feature);
if (feature.isMany())
{
List revisionList = revision.getList(feature); // TODO lazy?
@@ -284,7 +286,45 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
}
}
- private static Object getTargetValue(InternalEObject target, CDOFeatureImpl feature, CDOViewImpl view)
+ private void transferRevisionToTarget()
+ {
+ InternalEObject target = getTarget();
+ CDOViewImpl view = cdoView();
+ CDOClassImpl cdoClass = revision.getCDOClass();
+ CDOFeatureImpl[] features = cdoClass.getAllFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ CDOFeatureImpl feature = features[i];
+ Object value = revision.getValue(feature);
+ if (feature.isMany())
+ {
+ InternalEList targetList = (InternalEList)getTargetValue(target, feature);
+ targetList.clear(); // XXX Notifications?
+
+ List revisionList = (List)value;
+ for (Object revisionElement : revisionList)
+ {
+ if (feature.isReference())
+ {
+ revisionElement = view.convertIDToObject(revisionElement);
+ }
+
+ targetList.basicAdd(revisionElement, null);
+ }
+ }
+ else
+ {
+ if (feature.isReference())
+ {
+ value = view.convertIDToObject(value);
+ }
+
+ setTargetValue(getTarget(), feature, value);
+ }
+ }
+ }
+
+ private Object getTargetValue(InternalEObject target, CDOFeatureImpl feature)
{
Class<?> targetClass = target.getClass();
String featureName = feature.getName();
@@ -335,6 +375,67 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
return getFiedValue(target, field);
}
+ private void setTargetValue(InternalEObject target, CDOFeatureImpl feature, Object value)
+ {
+ Class<?> targetClass = target.getClass();
+ String featureName = feature.getName();
+ String fieldName = featureName;// XXX safeName()
+ Field field = getField(targetClass, fieldName);
+ if (field == null && feature.getType() == CDOType.BOOLEAN)
+ {
+ if (targetClass.isAssignableFrom(EAttributeImpl.class) || targetClass.isAssignableFrom(EClassImpl.class)
+ || targetClass.isAssignableFrom(EDataTypeImpl.class) || targetClass.isAssignableFrom(EReferenceImpl.class)
+ || targetClass.isAssignableFrom(EStructuralFeatureImpl.class)
+ || targetClass.isAssignableFrom(ETypedElementImpl.class))
+ {
+ // *******************************************
+ // ID_EFLAG = 1 << 15;
+ // *******************************************
+ // ABSTRACT_EFLAG = 1 << 8;
+ // INTERFACE_EFLAG = 1 << 9;
+ // *******************************************
+ // SERIALIZABLE_EFLAG = 1 << 8;
+ // *******************************************
+ // CONTAINMENT_EFLAG = 1 << 15;
+ // RESOLVE_PROXIES_EFLAG = 1 << 16;
+ // *******************************************
+ // CHANGEABLE_EFLAG = 1 << 10;
+ // VOLATILE_EFLAG = 1 << 11;
+ // TRANSIENT_EFLAG = 1 << 12;
+ // UNSETTABLE_EFLAG = 1 << 13;
+ // DERIVED_EFLAG = 1 << 14;
+ // *******************************************
+ // ORDERED_EFLAG = 1 << 8;
+ // UNIQUE_EFLAG = 1 << 9;
+ // *******************************************
+
+ String flagName = GenUtil.getUpperFeatureName(featureName) + "_EFLAG";
+ int flagsMask = getEFlagMask(targetClass, flagName);
+
+ field = getField(targetClass, "eFlags");
+ int flags = (Integer)getFiedValue(target, field);
+ boolean on = (Boolean)value;
+ if (on)
+ {
+ flags |= flagsMask; // Add EFlag
+ }
+ else
+ {
+ flags &= ~flagsMask; // Remove EFlag
+ }
+
+ setFiedValue(target, field, flags);
+ }
+ }
+
+ if (field == null)
+ {
+ throw new ImplementationError("Field not found: " + fieldName);
+ }
+
+ setFiedValue(target, field, value);
+ }
+
private static Object getFiedValue(InternalEObject target, Field field)
{
if (!field.isAccessible())
@@ -352,6 +453,23 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
}
}
+ private static void setFiedValue(InternalEObject target, Field field, Object value)
+ {
+ if (!field.isAccessible())
+ {
+ field.setAccessible(true);
+ }
+
+ try
+ {
+ field.set(target, value);
+ }
+ catch (IllegalAccessException ex)
+ {
+ throw new ImplementationError(ex);
+ }
+ }
+
private static int getEFlagMask(Class<?> targetClass, String flagName)
{
Field field = getField(targetClass, flagName);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaImpl.java
index 4bf814c..6944de1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaImpl.java
@@ -124,6 +124,11 @@ public class CDOMetaImpl implements InternalCDOObject
throw new UnsupportedOperationException();
}
+ public void cdoInternalResolveRevision()
+ {
+ throw new UnsupportedOperationException();
+ }
+
public InternalEObject cdoInternalInstance()
{
return metaInstance;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index e54361e..0b3c55b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -197,6 +197,11 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
}
+ public void cdoInternalResolveRevision()
+ {
+ // Do nothing
+ }
+
public InternalEObject cdoInternalInstance()
{
return this;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
index 46575a1..14b2070 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
@@ -40,8 +40,7 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
{
try
{
- LoadObjectRequest signal = new LoadObjectRequest(session.getChannel(), id);
- return signal.send();
+ return new LoadObjectRequest(session.getChannel(), id).send();
}
catch (RuntimeException ex)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index a964eb3..d102ffd 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult;
import org.eclipse.emf.internal.cdo.protocol.ResourceIDRequest;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
+import java.text.MessageFormat;
import java.util.Iterator;
import java.util.Map;
@@ -171,6 +172,12 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
public CDOResource resource;
public CDOViewImpl view;
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("ResourceAndView({0}, {1})", resource, view);
+ }
}
/**
@@ -325,6 +332,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
CDORevisionImpl revision = view.lookupRevision(id);
object.cdoInternalSetRevision(revision);
object.cdoInternalSetState(CDOState.CLEAN);
+ object.cdoInternalResolveRevision();
if (forWrite)
{
@@ -349,7 +357,6 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
// Prepare object
object.cdoInternalSetID(id);
- // object.setRevision(revision);
object.cdoInternalSetResource(data.resource);
object.cdoInternalSetView(data.view);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java
index 2643279..f1f77ef 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java
@@ -37,6 +37,8 @@ public interface InternalCDOObject extends CDOObject, InternalEObject
public void cdoInternalFinalizeRevision();
+ public void cdoInternalResolveRevision();
+
public InternalEObject cdoInternalInstance();
public EStructuralFeature cdoInternalDynamicFeature(int dynamicFeatureID);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
index 5422cae..7cc10f7 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
@@ -99,7 +99,7 @@ public class OpenSessionRequest extends RequestWithConfirmation<OpenSessionResul
CDOIDRange metaIDRange = CDOIDRangeImpl.read(in);
if (PROTOCOL.isEnabled())
{
- PROTOCOL.format("Read package URI: {0}, dynamic={1}, metaIDRange={2}", packageURI, dynamic, metaIDRange);
+ PROTOCOL.format("Read package info: uri={0}, dynamic={1}, metaIDRange={2}", packageURI, dynamic, metaIDRange);
}
result.addPackageInfo(packageURI, dynamic, metaIDRange);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
index 42073ba..49ec142 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
@@ -249,6 +249,11 @@ public abstract class Connector extends Lifecycle implements IConnector
return false;
}
+ if (connectorState == ConnectorState.CONNECTED)
+ {
+ return true;
+ }
+
try
{
if (TRACER.isEnabled())