1 23 24 package org.objectweb.fractal.gui.repository.lib; 25 26 import java.util.Map ; 27 28 import org.objectweb.fractal.adl.ADLException; 29 import org.objectweb.fractal.adl.Definition; 30 import org.objectweb.fractal.adl.Loader; 31 import org.objectweb.fractal.api.control.BindingController; 32 33 import org.objectweb.fractal.gui.repository.api.Storage; 34 35 38 39 public class StorageLoader implements Loader, BindingController { 40 41 public final static String STORAGE_BINDING = "storage"; 42 43 46 47 Storage storage; 48 49 53 public String [] listFc () { 54 return new String [] { STORAGE_BINDING }; 55 } 56 57 public Object lookupFc (final String clientItfName) { 58 if (STORAGE_BINDING.equals(clientItfName)) { 59 return storage; 60 } 61 return null; 62 } 63 64 public void bindFc ( 65 final String clientItfName, 66 final Object serverItf) 67 { 68 if (STORAGE_BINDING.equals(clientItfName)) { 69 storage = (Storage)serverItf; 70 } 71 } 72 73 public void unbindFc (final String clientItfName) { 74 if (STORAGE_BINDING.equals(clientItfName)) { 75 storage = null; 76 } 77 } 78 79 83 public Definition load (final String name, final Map context) 84 throws ADLException 85 { 86 try { 87 return (Definition)storage.load(name); 88 } catch (Exception e) { 89 throw new ADLException("Cannot load '" + name + "'", null, e); 90 } 91 } 92 } 93 | Popular Tags |