1 7 package com.inversoft.verge.mvc.model.repository; 8 9 10 import java.util.Map ; 11 12 import javax.servlet.http.HttpServletRequest ; 13 14 import com.inversoft.beans.BeanException; 15 import com.inversoft.verge.mvc.MVCConstants; 16 import com.inversoft.verge.mvc.MVCException; 17 import com.inversoft.verge.mvc.MVCRegistry; 18 import com.inversoft.verge.mvc.model.AbstractMetaData; 19 import com.inversoft.verge.mvc.model.ModelHandler; 20 import com.inversoft.verge.repository.RepositoryBean; 21 import com.inversoft.verge.repository.RepositoryBeanProperty; 22 23 24 33 public class RepositoryMetaData extends AbstractMetaData { 34 35 private RepositoryBean repositoryBean; 36 private RepositoryBeanProperty repositoryBeanProperty; 37 38 39 42 public RepositoryMetaData(String id, String property) { 43 super(id, property); 44 } 45 46 49 public RepositoryMetaData(String definition) throws MVCException { 50 super(definition); 51 } 52 53 54 59 public void setID(String id) { 60 this.id = id; 61 } 62 63 68 public void setProperty(String property) { 69 this.property = property; 70 } 71 72 77 public Map getExtraParams() { 78 return null; 79 } 80 81 86 public RepositoryBean createRepositoryBean(HttpServletRequest request) 87 throws MVCException { 88 89 if (repositoryBean != null) { 90 return repositoryBean; 91 } 92 93 try { 94 repositoryBean = new RepositoryBean(id, request); 95 return repositoryBean; 96 } catch (BeanException be) { 97 throw new MVCException(be); 98 } 99 } 100 101 106 public RepositoryBeanProperty createRepositoryBeanProperty( 107 HttpServletRequest request) 108 throws MVCException { 109 110 if (repositoryBeanProperty != null) { 111 return repositoryBeanProperty; 112 } 113 114 try { 115 repositoryBeanProperty = new RepositoryBeanProperty(id, property, 116 request); 117 return repositoryBeanProperty; 118 } catch (BeanException be) { 119 throw new MVCException(be); 120 } 121 } 122 123 130 public ModelHandler getModelHandler() { 131 return MVCRegistry.lookupModelHandler(MVCConstants.REPOSITORY_NAME); 132 } 133 134 139 public String getModelSystem() { 140 return MVCConstants.REPOSITORY_NAME; 141 } 142 } | Popular Tags |