1 26 27 package org.objectweb.corba.generator.cif_idl.lib; 28 29 import org.objectweb.openccm.ast.api.Declaration; 31 import org.objectweb.openccm.ast.api.HomeExecutorDecl; 32 import org.objectweb.openccm.ast.api.ModuleDecl; 33 import org.objectweb.openccm.ast.api.InterfaceDecl; 34 import org.objectweb.openccm.ast.api.InterfaceList; 35 import org.objectweb.openccm.ast.api.NativeDecl; 36 import org.objectweb.openccm.ast.api.OperationDecl; 37 import org.objectweb.openccm.ast.utils.api.CompositionInfo; 38 import org.objectweb.corba.generator.cif_idl.api.ExecutorMapping; 39 40 41 48 49 public class HomeExecutorMapping 50 implements org.objectweb.corba.generator.cif_idl.api.HomeExecutorMapping 51 { 52 58 59 private HomeExecutorDecl home_exec_; 60 61 62 private InterfaceDecl cif_mapping_; 63 64 70 75 public HomeExecutorMapping(HomeExecutorDecl home_exec) 76 { 77 home_exec_ = home_exec; 79 cif_mapping_ = null; 80 } 81 82 88 94 100 public void 101 declareCIF(ModuleDecl module, 102 CompositionInfo comp) 103 { 104 InterfaceDecl itf = null; 105 Declaration[] decls = null; 106 InterfaceList list = null; 107 NativeDecl ast = null, 108 ash = null; 109 ExecutorMapping exec_mapping = null; 110 111 112 itf = module.declareLocalInterface( "CIF_" + home_exec_.getName() ); 113 list = itf.getInheritedInterfaceList(); 115 list.add( home_exec_.getHomeType().getLocalMapping() ); 117 itf.create(); 118 cif_mapping_ = itf; 119 120 121 if (home_exec_.getAbstractStorageHomeBinding() != null) 122 { 123 OperationDecl op = null; 124 125 ash = home_exec_.getAbstractStorageHomeBinding().getMapping(); 126 ast = home_exec_.getAbstractStorageHomeBinding().getAbstractStorageType().getMapping(); 127 128 op = itf.startOperation("get_state"); 129 op.setType(ash); 130 op.create(); 131 } 132 133 134 if (home_exec_.getHomePersistence() != null) 135 { 136 NativeDecl home_ast = null, 137 home_ash = null; 138 OperationDecl op = null; 139 140 home_ash = home_exec_.getHomePersistence().getMapping(); 141 home_ast = home_exec_.getHomePersistence().getAbstractStorageType().getMapping(); 142 143 op = itf.startOperation("get_home_executor_state"); 144 op.setType(home_ast); 145 op.create(); 146 } 148 149 151 exec_mapping = new org.objectweb.corba.generator.cif_idl.lib.ExecutorMapping( comp.getComponentExecutor() ); 153 exec_mapping.declareCIF(comp, module, ast); 154 } 155 156 159 public InterfaceDecl 160 getCIFMapping() 161 { 162 return cif_mapping_; 163 } 164 165 171 } 172 | Popular Tags |