Debian Codegraph @

maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/difflog.txt

raw
1 --- //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/IThing.java 2005/11/14 14:35:48
2 +++ //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/IThing.java 2005/11/22 07:28:55
3 @@ -1,10 +1,7 @@
4 package com.webify.framework.model;
5
6 -import com.webify.framework.model.metadata.ClassInfo;
7 import com.webify.framework.model.metadata.InterfaceInfo;
8 -
9 -import java.net.URI;
10 -import java.util.Set;
11 +import com.webify.wsf.modelstore.IPersisted;
12
13 /**
14 * Base interface for all model types in WSF. Corresponds to owl:Thing.
15 @@ -15,52 +12,14 @@
16 * @version $Id$
17 * @since 2.0.0
18 */
19 -public interface IThing {
20 +public interface IThing extends IPersisted {
21
22 /**
23 * @deprecated Should not rely on, or hardcode 3.4 base namespace in code.
24 */
25 String NS_BASE_CATALOG = "http://www.webifysolutions.com/2005/06/base-catalog#";
26 -
27 - /**
28 - * @param name the property <em>URI</em> in string form.
29 - * @deprecated use {@link #getProperty(URI)} instead.
30 - */
31 - Object getProperty(String name);
32 -
33 - Object getProperty(URI name);
34 -
35 - /**
36 - * @param name the property <em>URI</em> in string form.
37 - * @deprecated use {@link #setProperty(URI, Object)} instead.
38 - */
39 - void setProperty(String name, Object value);
40 -
41 - void setProperty(URI name, Object value);
42 -
43 - /**
44 - * @param name the property <em>URI</em> in string form.
45 - * @deprecated use {@link #removeProperty(URI, Object)} instead.
46 - */
47 - void removeProperty(String name, Object value);
48 -
49 - void removeProperty(URI name, Object value);
50 -
51 - /**
52 - * @param name the property <em>URI</em> in string form.
53 - * @return true if <code>value</code> is associated with the specified property
54 - * @deprecated use {@link #hasProperty(URI, Object)} instead.
55 - */
56 - boolean hasProperty(String name, Object value);
57
58 - boolean hasProperty(URI name, Object value);
59 -
60 /**
61 - * @return a (non-null, possibly empty) set of URIs corresponding to property names.
62 - */
63 - Set propertyNameSet();
64 -
65 - /**
66 * @OntProperty (uri="http://www.w3.org/2000/01/rdf-schema#comment")
67 */
68 String getComment();
69 @@ -91,27 +50,6 @@
70 void setVersionInfo(String versionInfo);
71
72 /**
73 - * @return the <em>local</em> name within {@link #getURI()}'s namespace.
74 - */
75 - String getId();
76 -
77 - /**
78 - * @return the full URI for this thing, which is unique within a model.
79 - */
80 - URI getURI();
81 -
82 - /**
83 - * @return the declared type of the instance
84 - */
85 - URI getDeclaredType();
86 -
87 - /**
88 - * @return a <em>locked</em> {@link ClassInfo} instance
89 - * representing this thing's interface/declared type.
90 - */
91 - ClassInfo getClassInfo();
92 -
93 - /**
94 * @return a <em>locked</em> {@link InterfaceInfo} instance
95 * representing this thing's interface/declared type.
96 */
97 --- //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/ModelFactory.java 2005/11/21 08:58:32
98 +++ //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/ModelFactory.java 2005/11/21 10:29:33
99 @@ -3,8 +3,8 @@
100 import com.webify.framework.model.changes.ModelChanges;
101 import com.webify.framework.model.metadata.MetadataRegistry;
102 import com.webify.framework.support.trackingmap.MultiValueMap;
103 +import com.webify.framework.triples.TripleStore;
104 import com.webify.framework.triples.VersionInfo;
105 -import com.webify.framework.triples.TripleStore;
106
107 import java.net.URI;
108 import java.util.List;
109 @@ -114,12 +114,6 @@
110
111 MultiValueMap getAllProperties(final long version, final URI subject);
112
113 - /**
114 - * Attaches disconnected instances and {@link java.util.Collection}s
115 - * of {@link IThing}s. Other types of objects are ignored.
116 - */
117 - void attachDisconnected(Object disconnected);
118 -
119 long getCurrentVersion();
120
121 VersionInfo getCurrentVersionInfo();
122 --- //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/dbstore/HibernateModelFactory.java 2005/11/21 08:58:32
123 +++ //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/dbstore/HibernateModelFactory.java 2005/11/22 07:34:00
124 @@ -6,7 +6,6 @@
125 import com.webify.framework.model.ModelQuery;
126 import com.webify.framework.model.NotFoundException;
127 import com.webify.framework.model.proxy.ProxyHandlerContext;
128 -import com.webify.framework.support.collections.IdentitySet;
129 import com.webify.framework.support.trackingmap.TrackingMap;
130 import com.webify.framework.triples.changes.TripleChanges;
131 import com.webify.wsf.modelstore.impl.ModelAccessImpl;
132 @@ -168,56 +167,6 @@
133 return version;
134 }
135
136 - /**
137 - * @return non-null possibly empty collection
138 - */
139 - private Collection getOtherThingsInCloud(final IThing thing) {
140 - final HibernateInvocationHandler handler = HibernateInvocationHandler.handlerForThing(thing);
141 - final Collection others = handler.getThingsInCloud();
142 - others.remove(thing);
143 - return others;
144 - }
145 -
146 - /**
147 - * @param disconnected
148 - * can be an {@link IThing}, a {@link Collection}or regular
149 - * {@link Object}
150 - */
151 - public void attachDisconnected(Object disconnected) {
152 - HashSet things = new HashSet();
153 - findAllThingsInClouds(disconnected, new IdentitySet(), things);
154 - if (GENERAL_LOG.isDebugEnabled()) {
155 - GENERAL_LOG.debug("Reattaching: " + things);
156 - }
157 - for (Iterator i = things.iterator(); i.hasNext();) {
158 - final IThing thing = (IThing) i.next();
159 - HibernateInvocationHandler handler = HibernateInvocationHandler.handlerForThing(thing);
160 - handler.reattach(this);
161 - }
162 - }
163 -
164 - private void findAllThingsInClouds(final Object disconnected,
165 - final Set visited,
166 - final Set target) {
167 - if (!visited.add(disconnected)) {
168 - // already seen this object
169 - return;
170 - }
171 -
172 - if (disconnected instanceof Collection) {
173 - final Collection collection = (Collection) disconnected;
174 - for (Iterator i = collection.iterator(); i.hasNext();) {
175 - findAllThingsInClouds(i.next(), visited, target);
176 - }
177 - }
178 - else if (disconnected instanceof IThing) {
179 - final IThing thing = (IThing) disconnected;
180 - // no need to recurse into each because they all have the same cloud
181 - target.add(thing);
182 - target.addAll(getOtherThingsInCloud(thing));
183 - }
184 - }
185 -
186 long getWorkingVersion() {
187 // TODO implement getWorkingVersion properly.
188 return ModelFactory.CURRENT_VERSION;
189 @@ -250,7 +199,7 @@
190 final HibernateProxyBuilder builder = new HibernateProxyBuilder();
191 builder.setContext(this);
192 if (typeUri == null) {
193 - final TypeComputation tc = new TypeComputation(this, iface, properties);
194 + final TypeComputation tc = new TypeComputation(this.getMetadataRegistry(), iface, properties);
195 builder.setInterface(tc.deriveInterface());
196 builder.setTypeUri(tc.deriveType());
197 }
198 --- //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/dbstore/TypeComputation.java 2005/11/21 08:58:32
199 +++ //depot/modules/cordoba/storage/modelstore/src/main/java/com/webify/framework/model/dbstore/TypeComputation.java 2005/11/22 07:34:00
200 @@ -4,7 +4,7 @@
201 import com.webify.framework.model.IThing;
202 import com.webify.framework.model.PredicateConstants;
203 import com.webify.framework.model.metadata.ClassInfo;
204 -import com.webify.framework.model.proxy.ProxyHandlerContext;
205 +import com.webify.framework.model.metadata.MetadataRegistry;
206 import com.webify.framework.support.trackingmap.TrackingMap;
207 import org.apache.commons.logging.Log;
208 import org.apache.commons.logging.LogFactory;
209 @@ -21,7 +21,7 @@
210 * @author dranatunga
211 * @version $Id$
212 */
213 -class TypeComputation {
214 +public class TypeComputation {
215
216 private static final int NONE = 0;
217
218 @@ -44,28 +44,28 @@
219
220 private int _ifaceState = NONE;
221 private int _typeState = NONE;
222 - private final ProxyHandlerContext _context;
223 + private final MetadataRegistry _registry;
224 private final Class _ifaceIn;
225 private Class _bestIface;
226 private URI _bestType;
227 private final TrackingMap _knowledge;
228
229 - TypeComputation(ProxyHandlerContext context, Class ifaceIn, TrackingMap knowledge) {
230 + public TypeComputation(MetadataRegistry registry, Class ifaceIn, TrackingMap knowledge) {
231 // TODO an instance can have more than one type, we need to account for this in our API
232 - _context = context;
233 + _registry = registry;
234 _ifaceIn = ifaceIn;
235 _knowledge = knowledge;
236 _bestIface = ifaceIn;
237 }
238
239 - Class deriveInterface() {
240 + public Class deriveInterface() {
241 determineUsingInstanceAssociation();
242 // TODO determineUsingClassAssocation
243 determineUsingTypeNameGuessing();
244 return _bestIface;
245 }
246
247 - URI deriveType() {
248 + public URI deriveType() {
249 determineUsingInstanceType();
250 determineUsingMetadataInfo();
251 return _bestType;
252 @@ -141,7 +141,7 @@
253 ClassInfo mostSpecificType = null;
254 for (Iterator i = _knowledge.getAll(PredicateConstants.TYPE_OF).iterator(); i.hasNext();) {
255 URI oneDeclaredType = (URI) i.next();
256 - ClassInfo oneDeclaredInfo = _context.getMetadataRegistry().getClassInfo(oneDeclaredType);
257 + ClassInfo oneDeclaredInfo = _registry.getClassInfo(oneDeclaredType);
258 if ((mostSpecificType == null) || oneDeclaredInfo.getSuperClasses().contains(mostSpecificType)) {
259 mostSpecificType = oneDeclaredInfo;
260 }
261 @@ -163,7 +163,7 @@
262 if (_typeState >= FOUND_FROM_ANNOTATION) {
263 return;
264 }
265 - final ClassInfo classInfo = _context.getMetadataRegistry().getInterfaceInfo(_ifaceIn).getTypeInfo();
266 + final ClassInfo classInfo = _registry.getInterfaceInfo(_ifaceIn).getTypeInfo();
267 if ((classInfo == null) || (classInfo.getTypeUri() == null)) {
268 return;
269 }
270 --- //depot/modules/cordoba/storage/modelstore/src/test/java/com/webify/framework/model/kowari/KowariModelFactoryTest.java 2005/11/14 14:53:49
271 +++ //depot/modules/cordoba/storage/modelstore/src/test/java/com/webify/framework/model/kowari/KowariModelFactoryTest.java 2005/11/21 10:29:33
272 @@ -1,23 +1,22 @@
273 package com.webify.framework.model.kowari;
274
275 +import java.net.URI;
276 import java.util.Date;
277 import java.util.HashSet;
278 import java.util.Iterator;
279 import java.util.List;
280 import java.util.Set;
281 -import java.net.URI;
282
283 import com.webify.framework.model.IThing;
284 import com.webify.framework.model.ModelFactory;
285 import com.webify.framework.model.ModelQuery;
286 import com.webify.framework.model.metadata.InterfaceInfo;
287 import com.webify.framework.model.metadata.PropertyInfo;
288 +import com.webify.framework.support.uri.URIs;
289 import com.webify.framework.support.uuid.UUID;
290 -import com.webify.framework.support.uri.URIs;
291 +import com.webify.framework.test.ConfiguredCoreTest;
292 +import com.webify.framework.test.ModelExistsCondition;
293 import com.webify.framework.test.PreTestCondition;
294 -import com.webify.framework.test.ModelExistsCondition;
295 -import com.webify.framework.test.ConfiguredCoreTest;
296 -
297 import junit.framework.TestSuite;
298
299 /**
300 @@ -52,7 +51,6 @@
301 ts.addTest(new KowariModelFactoryTest("testModifyKnownSubject"));
302 ts.addTest(new KowariModelFactoryTest("testListExisting"));
303 ts.addTest(new KowariModelFactoryTest("testListLiterals"));
304 - ts.addTest(new KowariModelFactoryTest("testSerializeThing"));
305 ts.addTest(new KowariModelFactoryTest("testMetadataAccessFromThing"));
306 return ts;
307 }
308 @@ -112,15 +110,6 @@
309 }
310
311
312 - public void testSerializeThing() {
313 - final IThing original = getModelFactory().load(IThing.class, EXISTING_THING);
314 - final byte[] serialized = serialize(original);
315 - final Object reloaded = deserialize(serialized);
316 - assertEquals(original, reloaded);
317 - // TODO lookup something off reloaded that would require it to be connected.
318 - getModelFactory().attachDisconnected(reloaded);
319 - }
320 -
321 public void testMetadataAccessFromThing() {
322 final IThing created = getModelFactory().create(SampleCar.class, new UUID().toString());
323 final InterfaceInfo info = created.getInterfaceInfo();