예제 #1
0
 /**
  * 根据名称和版本得到服务
  *
  * @param name
  * @param version
  * @return
  */
 protected <T extends Pluggable> T getInstance(
     Class<T> clazz, String type, String name, String version, String xpId) {
   try {
     T t = (T) instances.get(type + "-" + name + "-" + version + "-" + xpId);
     if (t == null) {
       TypePluginFactory factory = getFactory(type);
       t = factory.getSingleInstances(clazz, name, version, xpId);
       instances.put(type + "-" + name + "-" + version + "-" + xpId, t);
     }
     return t;
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
예제 #2
0
 /**
  * 得到当前的插件工程类
  *
  * @return
  * @throws IOException
  */
 protected TypePluginFactory getFactory(String type) throws IOException {
   return TypePluginFactory.getFactory(CoreConfigUtils.create(), type);
 }