blob: ee887657fc47605817fa28214cd603bbe515841d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/***************************************************************************
* Copyright (c) 2004 - 2008 Martin Taal
* 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 Taal - copied from CDORevisionPropertyHandler and adapted
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.server.internal.hibernate.bundle.OM;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
/**
* @author Martin Taal
*/
public abstract class CDOPropertyHandler
{
private CDORevisionTuplizer tuplizer;
private CDOFeature cdoFeature;
private boolean virtualProperty = false;
private final ContextTracer tracer = new ContextTracer(OM.DEBUG, this.getClass());
public CDOPropertyHandler(CDORevisionTuplizer tuplizer, String propertyName)
{
this.tuplizer = tuplizer;
cdoFeature = tuplizer.getCDOClass().lookupFeature(propertyName);
getTracer().trace(
"Created " + this.getClass().getName() + " for cdoClass/feature: " + tuplizer.getCDOClass().getName() + "."
+ propertyName);
if (cdoFeature == null)
{
if (isVirtualPropertyAllowed())
{
virtualProperty = true;
getTracer().trace("This is a virtualproperty");
}
else
{
throw new IllegalStateException("Feature not found: " + propertyName);
}
}
}
protected ContextTracer getTracer()
{
return tracer;
}
public CDORevisionTuplizer getTuplizer()
{
return tuplizer;
}
public CDOFeature getCDOFeature()
{
return cdoFeature;
}
protected boolean isVirtualPropertyAllowed()
{
return false;
}
/**
* @return the virtualProperty
*/
public boolean isVirtualProperty()
{
return virtualProperty;
}
}
|