Package org.apache.uima.cas.impl

Examples of org.apache.uima.cas.impl.FSClassRegistry


   
  }
 
  public void instantiateJCas_Types(ClassLoader cl) {
    Map loadedJCasTypes = null;
    FSClassRegistry fscr = casImpl.getFSClassRegistry();
    boolean alreadyLoaded;
    synchronized (JCasImpl.class) {
      Map classLoaderToLoadedJCasTypes = (Map) typeSystemToLoadedJCasTypesByClassLoader.get(casImpl
              .getTypeSystemImpl());
      if (null != classLoaderToLoadedJCasTypes) {
        loadedJCasTypes = (Map) classLoaderToLoadedJCasTypes.get(cl);
      }
      alreadyLoaded = (null != loadedJCasTypes);
      if (!alreadyLoaded) {
        loadedJCasTypes = loadJCasClasses(cl);
      }
    }
    expandTypeArrayIfNeeded();
    FSGenerator [] newFSGeneratorSet = alreadyLoaded ? null : fscr.getNewFSGeneratorSet();
    for (Iterator it = loadedJCasTypes.entrySet().iterator();
         it.hasNext();) {
      makeInstanceOf_Type((LoadedJCasType) ((Map.Entry)it.next()).getValue(), alreadyLoaded, newFSGeneratorSet);
    }
    if ( ! alreadyLoaded) {
      copyDownSuperGenerators(loadedJCasTypes, newFSGeneratorSet);
      if (casImpl.usingBaseClassLoader()) {
        fscr.setBaseGenerators(newFSGeneratorSet);
      }
      fscr.saveGeneratorsForClassLoader(cl, newFSGeneratorSet);   
    }
    if (alreadyLoaded) {
      fscr.swapInGeneratorsForClassLoader(cl, casImpl);
    } else {
      casImpl.setLocalFsGenerators(newFSGeneratorSet);
    }
  }
View Full Code Here


    }
  }

  public void instantiateJCas_Types(ClassLoader cl) {
    Map<String, LoadedJCasType> loadedJCasTypes = null;
    FSClassRegistry fscr = casImpl.getFSClassRegistry();
    boolean alreadyLoaded;  // means the "classes" have been loaded, but doesn't mean
                            // the _Type instances of those classes have been created.
    boolean anyNewInstances = false// true if any new instances of _Type are generated
    FSGenerator[] newFSGeneratorSet;
    synchronized (JCasImpl.class) {
      Map<ClassLoader, Map<String, LoadedJCasType>> classLoaderToLoadedJCasTypes = typeSystemToLoadedJCasTypesByClassLoader.get(casImpl
          .getTypeSystemImpl());
      if (null != classLoaderToLoadedJCasTypes) {
        loadedJCasTypes = classLoaderToLoadedJCasTypes.get(cl);
      }
      alreadyLoaded = (null != loadedJCasTypes);
      if (!alreadyLoaded) {
        loadedJCasTypes = loadJCasClasses(cl);
      }

      expandTypeArrayIfNeeded();
      // if already loaded, can skip making new generators -
      //   in this case newFSGeneratorSet is never referenced
      //   Set it to null for "safety"
      newFSGeneratorSet = alreadyLoaded ? null : fscr.getNewFSGeneratorSet();
      for (Iterator<Map.Entry<String, LoadedJCasType>> it = loadedJCasTypes.entrySet().iterator(); it.hasNext();) {
       
        // Explanation for this logic:
        //   Instances of _Types are kept per class loader, per Cas (e.g., in the cas pool)
        //   When switching class loaders (e.g. a pear in the pipeline), some of the
        //     _Type instances (e.g. the built-ins) might be already instantiated, but others are not
        //  
        boolean madeNewInstance = makeInstanceOf_Type(it.next().getValue(), alreadyLoaded,
            newFSGeneratorSet);
        anyNewInstances = madeNewInstance || anyNewInstances;
      }
     
      // speed up - skip rest if nothing to do
      if (!anyNewInstances) {
        return;
      }
      if (!alreadyLoaded) {
        copyDownSuperGenerators(loadedJCasTypes, newFSGeneratorSet);
        if (casImpl.usingBaseClassLoader()) {
          fscr.setBaseGenerators(newFSGeneratorSet); // should be under sync lock
        }
        fscr.saveGeneratorsForClassLoader(cl, newFSGeneratorSet);
      }
    }
    if (alreadyLoaded) {
      fscr.swapInGeneratorsForClassLoader(cl, casImpl);
    } else {
      casImpl.setLocalFsGenerators(newFSGeneratorSet);
    }
  }
View Full Code Here

    }
  }

  public void instantiateJCas_Types(ClassLoader cl) {
    Map<String, LoadedJCasType> loadedJCasTypes = null;
    FSClassRegistry fscr = casImpl.getFSClassRegistry();
    boolean alreadyLoaded;  // means the "classes" have been loaded, but doesn't mean
                            // the _Type instances of those classes have been created.
    boolean anyNewInstances = false// true if any new instances of _Type are generated
    FSGenerator[] newFSGeneratorSet;
    synchronized (JCasImpl.class) {
      Map<ClassLoader, Map<String, LoadedJCasType>> classLoaderToLoadedJCasTypes = typeSystemToLoadedJCasTypesByClassLoader.get(casImpl
          .getTypeSystemImpl());
      if (null != classLoaderToLoadedJCasTypes) {
        loadedJCasTypes = classLoaderToLoadedJCasTypes.get(cl);
      }
      alreadyLoaded = (null != loadedJCasTypes);
      if (!alreadyLoaded) {
        loadedJCasTypes = loadJCasClasses(cl);
      }

      expandTypeArrayIfNeeded();
      // if already loaded, can skip making new generators -
      //   in this case newFSGeneratorSet is never referenced
      //   Set it to null for "safety"
      newFSGeneratorSet = alreadyLoaded ? null : fscr.getNewFSGeneratorSet();
      for (Iterator<Map.Entry<String, LoadedJCasType>> it = loadedJCasTypes.entrySet().iterator(); it.hasNext();) {
       
        // Explanation for this logic:
        //   Instances of _Types are kept per class loader, per Cas (e.g., in the cas pool)
        //   When switching class loaders (e.g. a pear in the pipeline), some of the
        //     _Type instances (e.g. the built-ins) might be already instantiated, but others are not
        //  
        boolean madeNewInstance = makeInstanceOf_Type(it.next().getValue(), alreadyLoaded,
            newFSGeneratorSet);
        anyNewInstances = madeNewInstance || anyNewInstances;
      }
     
      // speed up - skip rest if nothing to do
      if (!anyNewInstances) {
        return;
      }
      if (!alreadyLoaded) {
        copyDownSuperGenerators(loadedJCasTypes, newFSGeneratorSet);
        if (casImpl.usingBaseClassLoader()) {
          fscr.setBaseGenerators(newFSGeneratorSet); // should be under sync lock
        }
        fscr.saveGeneratorsForClassLoader(cl, newFSGeneratorSet);
      }
    }
    if (alreadyLoaded) {
      fscr.swapInGeneratorsForClassLoader(cl, casImpl);
    } else {
      casImpl.setLocalFsGenerators(newFSGeneratorSet);
    }
  }
View Full Code Here

    }
  }

  public void instantiateJCas_Types(ClassLoader cl) {
    Map<String, LoadedJCasType> loadedJCasTypes = null;
    FSClassRegistry fscr = casImpl.getFSClassRegistry();
    boolean alreadyLoaded;  // means the "classes" have been loaded, but doesn't mean
                            // the _Type instances of those classes have been created.
    boolean anyNewInstances = false// true if any new instances of _Type are generated
    FSGenerator[] newFSGeneratorSet;
    synchronized (JCasImpl.class) {
      Map<ClassLoader, Map<String, LoadedJCasType>> classLoaderToLoadedJCasTypes = typeSystemToLoadedJCasTypesByClassLoader.get(casImpl
          .getTypeSystemImpl());
      if (null != classLoaderToLoadedJCasTypes) {
        loadedJCasTypes = classLoaderToLoadedJCasTypes.get(cl);
      }
      alreadyLoaded = (null != loadedJCasTypes);
      if (!alreadyLoaded) {
        loadedJCasTypes = loadJCasClasses(cl);
      }

      expandTypeArrayIfNeeded();
      // if already loaded, can skip making new generators -
      //   in this case newFSGeneratorSet is never referenced
      //   Set it to null for "safety"
      newFSGeneratorSet = alreadyLoaded ? null : fscr.getNewFSGeneratorSet();
      for (Iterator<Map.Entry<String, LoadedJCasType>> it = loadedJCasTypes.entrySet().iterator(); it.hasNext();) {
       
        // Explanation for this logic:
        //   Instances of _Types are kept per class loader, per Cas (e.g., in the cas pool)
        //   When switching class loaders (e.g. a pear in the pipeline), some of the
        //     _Type instances (e.g. the built-ins) might be already instantiated, but others are not
        //  
        boolean madeNewInstance = makeInstanceOf_Type(it.next().getValue(), alreadyLoaded,
            newFSGeneratorSet);
        anyNewInstances = madeNewInstance || anyNewInstances;
      }
     
      // speed up - skip rest if nothing to do
      if (!anyNewInstances) {
        return;
      }
      if (!alreadyLoaded) {
        copyDownSuperGenerators(loadedJCasTypes, newFSGeneratorSet);
        if (casImpl.usingBaseClassLoader()) {
          fscr.setBaseGenerators(newFSGeneratorSet); // should be under sync lock
        }
        fscr.saveGeneratorsForClassLoader(cl, newFSGeneratorSet);
      }
    }
    if (alreadyLoaded) {
      fscr.swapInGeneratorsForClassLoader(cl, casImpl);
    } else {
      casImpl.setLocalFsGenerators(newFSGeneratorSet);
    }
  }
View Full Code Here

   
  }
 
  public void instantiateJCas_Types(ClassLoader cl) {
    Map loadedJCasTypes = null;
    FSClassRegistry fscr = casImpl.getFSClassRegistry();
    boolean alreadyLoaded;
    FSGenerator[] newFSGeneratorSet;
    synchronized (JCasImpl.class) {
      Map classLoaderToLoadedJCasTypes = (Map) typeSystemToLoadedJCasTypesByClassLoader.get(casImpl
          .getTypeSystemImpl());
      if (null != classLoaderToLoadedJCasTypes) {
        loadedJCasTypes = (Map) classLoaderToLoadedJCasTypes.get(cl);
      }
      alreadyLoaded = (null != loadedJCasTypes);
      if (!alreadyLoaded) {
        loadedJCasTypes = loadJCasClasses(cl);
      }

      expandTypeArrayIfNeeded();
      newFSGeneratorSet = alreadyLoaded ? null : fscr.getNewFSGeneratorSet();
      for (Iterator it = loadedJCasTypes.entrySet().iterator(); it.hasNext();) {
        makeInstanceOf_Type((LoadedJCasType) ((Map.Entry) it.next()).getValue(), alreadyLoaded,
            newFSGeneratorSet);
      }
      if (!alreadyLoaded) {
        copyDownSuperGenerators(loadedJCasTypes, newFSGeneratorSet);
        if (casImpl.usingBaseClassLoader()) {
          fscr.setBaseGenerators(newFSGeneratorSet)// should be under sync lock
        }
        fscr.saveGeneratorsForClassLoader(cl, newFSGeneratorSet);
      }
    }
    if (alreadyLoaded) {
      fscr.swapInGeneratorsForClassLoader(cl, casImpl);
    } else {
      casImpl.setLocalFsGenerators(newFSGeneratorSet);
    }
  }
View Full Code Here

   
  }
 
  public void instantiateJCas_Types(ClassLoader cl) {
    Map loadedJCasTypes = null;
    FSClassRegistry fscr = casImpl.getFSClassRegistry();
    boolean alreadyLoaded;
    FSGenerator[] newFSGeneratorSet;
    synchronized (JCasImpl.class) {
      Map classLoaderToLoadedJCasTypes = (Map) typeSystemToLoadedJCasTypesByClassLoader.get(casImpl
          .getTypeSystemImpl());
      if (null != classLoaderToLoadedJCasTypes) {
        loadedJCasTypes = (Map) classLoaderToLoadedJCasTypes.get(cl);
      }
      alreadyLoaded = (null != loadedJCasTypes);
      if (!alreadyLoaded) {
        loadedJCasTypes = loadJCasClasses(cl);
      }

      expandTypeArrayIfNeeded();
      newFSGeneratorSet = alreadyLoaded ? null : fscr.getNewFSGeneratorSet();
      for (Iterator it = loadedJCasTypes.entrySet().iterator(); it.hasNext();) {
        makeInstanceOf_Type((LoadedJCasType) ((Map.Entry) it.next()).getValue(), alreadyLoaded,
            newFSGeneratorSet);
      }
      if (!alreadyLoaded) {
        copyDownSuperGenerators(loadedJCasTypes, newFSGeneratorSet);
        if (casImpl.usingBaseClassLoader()) {
          fscr.setBaseGenerators(newFSGeneratorSet)// should be under sync lock
        }
        fscr.saveGeneratorsForClassLoader(cl, newFSGeneratorSet);
      }
    }
    if (alreadyLoaded) {
      fscr.swapInGeneratorsForClassLoader(cl, casImpl);
    } else {
      casImpl.setLocalFsGenerators(newFSGeneratorSet);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.impl.FSClassRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.