1 package org.weda.tapestry.binding;
2
3 import org.apache.hivemind.Location;
4 import org.apache.tapestry.BindingException;
5 import org.apache.tapestry.binding.AbstractBinding;
6 import org.apache.tapestry.coerce.ValueConverter;
7 import org.weda.store.ObjectSourceRegistry;
8
9 /**
10 *
11 * @author tim
12 */
13 public class ObjectSourceBinding extends AbstractBinding {
14 private ObjectSourceRegistry objectSourceRegistry;
15 private String objectSourceName;
16
17 public ObjectSourceBinding(
18 String description, ValueConverter valueConverter
19 , Location location
20 , ObjectSourceRegistry objectSourceRegistry
21 , String objectSourceName)
22 {
23 super(description, valueConverter, location);
24 this.objectSourceRegistry = objectSourceRegistry;
25 this.objectSourceName = objectSourceName;
26 }
27
28 public Object getObject() {
29 try{
30 return objectSourceRegistry.getObjectSource(objectSourceName);
31 }catch(Exception e){
32 throw new BindingException(e.getMessage(), this, e);
33 }
34 }
35
36 public boolean isInvariant() {
37 return false;
38 }
39
40 }