예제 #1
0
  public void addFunction(final Function function) {
    if (this.functions == Collections.EMPTY_MAP) {
      this.functions = new HashMap<String, Function>(1);
    }

    this.functions.put(function.getName(), function);
    dialectRuntimeRegistry.getDialectData(function.getDialect()).setDirty(true);
  }
예제 #2
0
  public KnowledgePackageImpl deepCloneIfAlreadyInUse(ClassLoader classLoader) {
    if (inUse.compareAndSet(false, true)) {
      return this;
    }

    if (classLoader instanceof ProjectClassLoader) {
      ClassLoader originalClassLoader =
          ((JavaDialectRuntimeData) dialectRuntimeRegistry.getDialectData("java"))
              .getRootClassLoader();
      if (originalClassLoader instanceof ProjectClassLoader) {
        ((ProjectClassLoader) classLoader).initFrom((ProjectClassLoader) originalClassLoader);
      }
    }

    return ClassUtils.deepClone(this, classLoader);
  }
예제 #3
0
  public void merge(
      DialectRuntimeRegistry newDatas, ClassLoader rootClassLoader, boolean excludeClasses) {
    for (Entry<String, DialectRuntimeData> entry : newDatas.dialects.entrySet()) {
      DialectRuntimeData data = this.dialects.get(entry.getKey());
      if (data == null) {
        DialectRuntimeData dialectData =
            entry.getValue().clone(this, rootClassLoader, excludeClasses);
        // dialectData.setDialectRuntimeRegistry( this );
        this.dialects.put(entry.getKey(), dialectData);
      } else {
        data.merge(this, entry.getValue(), excludeClasses);
      }
    }

    getLineMappings().putAll(newDatas.getLineMappings());
  }