/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
public static final Datatype RESOURCE_TYPE;
- //SerialisationSupport support;
-
/**
- * Create resource binding. If session is not provided, this binding cannot instantiate resources.
+ * Create resource binding.
*
* @param session or null
*/
- public ResourceBinding(Session session) {
+ public ResourceBinding() {
super(Datatypes.LONG);
-// if (session != null) {
-// support = session.peekService(SerialisationSupport.class);
-// }
- }
-
- public ResourceBinding(SerialisationSupport serializationSupport) {
- super(Datatypes.LONG);
-// this.support = serializationSupport;
}
/**
* if not able to return a current {@link SerialisationSupport}
*/
private SerialisationSupport getCurrentSupport() throws BindingException {
- // FIXME: this is wrong but should be optimized if possible.
-// if (support != null)
-// return support;
-
Session s = SimanticsInternal.peekSession();
if ( s == null ) {
throw new BindingException("Cannot instantiate Resource without an alive database Session.");
public Long getValue(Object o) throws BindingException {
SerialisationSupport support = getCurrentSupport();
// NOTE: r.getResourceId() is unsafe for this purpose, it will just return 0 if it fails, thus corrupting anything serialized with this method
-// Resource r = (Resource) o;
-// return r.getResourceId();
try {
return support.getRandomAccessId((Resource)o);
} catch (DatabaseException e) {
public long getValue_(Object o) throws BindingException {
SerialisationSupport support = getCurrentSupport();
// NOTE: r.getResourceId() is unsafe for this purpose, it will just return 0 if it fails, thus corrupting anything serialized with this method
-// Resource r = (Resource) o;
-// return r.getResourceId();
try {
return support.getRandomAccessId((Resource)o);
} catch (DatabaseException e) {