import org.simantics.db.ReadGraph;
import org.simantics.db.exception.DatabaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ProxyVariables {
-
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ProxyVariables.class);
+
+ public static Variable tryToOwn(ReadGraph graph, Variable parent, Variable variable) {
+ if (variable instanceof ProxyVariableSupport) {
+ ProxyVariableSupport pvs = (ProxyVariableSupport) variable;
+ return pvs.attachTo(graph, parent);
+ }
+ return null;
+ }
+
+ public static Variable tryToOwnRenamed(ReadGraph graph, Variable parent, Variable variable, String name) {
+ if (variable instanceof ProxyVariableSupport) {
+ ProxyVariableSupport pvs = (ProxyVariableSupport) variable;
+ return pvs.attachToRenamed(graph, parent, name);
+ }
+ return null;
+ }
+
public static Variable inputVariable(ReadGraph graph, Variable context) throws DatabaseException {
Variable session = graph.syncRequest(new ProxySessionRequest(context));
if(session == null) return null;
return input;
}
} catch (Throwable t) {
- t.printStackTrace();
+ LOGGER.error("proxySessionVariable failed", t);
return null;
}
}
} catch (Throwable t) {
- t.printStackTrace();
+ LOGGER.error("proxyVariableBase failed", t);
return null;
}
}
} catch (Throwable t) {
- t.printStackTrace();
+ LOGGER.error("proxyVariableRoot failed", t);
return null;
}
return proxyVariableRoot(graph, variable) != null;
}
-
}