Loads a full repository definition from an XML file.

@param repo
The repository that must be loaded
@param cl
The classloader to be used to instantiate the plugin classes
@param in
The stream to the XML file

@throws PluginConfigurationException
-
19548
public static void loadFromXmlPluginPackageDefinitions(final IPluginRepository repo, final ClassLoader cl, final InputStream in)
            throws PluginConfigurationException {
        for (PluginDefinition pd : loadFromXmlPluginPackageDefinitions(cl, in)) {
            repo.addPluginDefinition(pd);
        }
    }
1031241
@Override
	public void initialize() throws RepositoryException{
		initialized = true;
		try {

			queryEngine = configuration.loadQueryEngine();
			queryEngine.connect();
		}
		catch (Exception e){
			throw new RepositoryException(e);
		}
	}
1232032
public PluginRegistry load() throws PluginException {

        List<Path> pluginFiles = getPluginsProvider().provide(getPluginsDirectory());

        PluginRegistry pluginRegistry = new PluginRegistryContainer();

        // Loading information about all plugins first
        for (Path pluginFile : pluginFiles) {
            PluginMetadata pluginMetadata = getManifestReader().read(pluginFile);
            pluginRegistry.addPlugin(pluginMetadata);
        }

        // Iterating over the entire plugin set, checking for dependency resolution problems and loading classes
        for (String pluginName : pluginRegistry.getPluginNames()) {
            Optional<PluginMetadata> pluginMetadata = pluginRegistry.getPlugin(pluginName);
            if (pluginMetadata.isPresent()) {
                getDependencyChecker().check(pluginRegistry, pluginMetadata.get());

                ScanResult scanResult = getClassesScanner().scan(
                        pluginMetadata.get().getPath(),
                        getExtensionPoints()
                );
                for (Class extensionPoint : scanResult.getContents().getExtensionPoints()) {
                    pluginRegistry.addImplementations(
                            pluginMetadata.get(),
                            extensionPoint,
                            scanResult.getContents().getImplementations(extensionPoint)
                    );
                }
                pluginRegistry.addClassLoader(pluginMetadata.get(), scanResult.getClassLoader());

                List<Path> resources = getResourcesScanner().scan(pluginMetadata.get().getPath());
                pluginRegistry.addResources(pluginMetadata.get(), resources);
            }
        }
        return pluginRegistry;
    }
873638
private Class<?> loadClass(final String classname) throws PluginException {
        if (null == classname) {
            throw new IllegalArgumentException("A null java class name was specified.");
        }
        if (null != classCache.get(classname)) {
            return classCache.get(classname);
        }
        CachedJar cachedJar1 = getCachedJar();

        debug("loadClass! " + classname + ": " + cachedJar1.getCachedJar());
        final Class<?> cls;
        final URLClassLoader urlClassLoader = cachedJar1.getClassLoader();
        try {
            cls = Class.forName(classname, true, urlClassLoader);
            classCache.put(classname, cls);
        } catch (ClassNotFoundException e) {
            throw new PluginException("Class not found: " + classname, e);
        } catch (Throwable t) {
            throw new PluginException("Error loading class: " + classname, t);
        }
        return cls;
    }
47719
public KryoInstantiator setClassLoader(final ClassLoader cl) {
    return new KryoInstantiator() {
      public Kryo newKryo() {
        Kryo k = KryoInstantiator.this.newKryo();
        k.setClassLoader(cl);
        return k;
      }
    };
  }
446829
@Override
  protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
    Class<?> clazz = findLoadedClass(name);
    if (clazz == null) {
      if (inExceptedPackage(name)) {
        clazz = super.loadClass(name, false);
      } else {
        try {
          clazz = findClass(name);          
        } catch (ClassNotFoundException e) {
          clazz = super.loadClass(name, false);
          if (!clazz.isAnnotation()) { // Annotations are always safe to load
            logger.log(Type.WARN, String.format(
                "Class %s is used in Gin, but not available in GWT client code.", name));
          }
        }
      }
    }

    if (resolve) {
      resolveClass(clazz);
    }

    return clazz;
  }
293172
private Properties loadConfig() throws IOException {
		String configUrl = String.format("%s/%s/%s", defaultRepositoryUrl, DIST_DIR, RESOLVE_CONFIG_FILE);
		log.info("Looking for repository-config at {}", configUrl);

		CloseableHttpClient client = HttpClients.createDefault();

		HttpGet httpget = new HttpGet(configUrl);
		CloseableHttpResponse contentResponse;
		try {
			contentResponse = client.execute(httpget);
		} catch (ConnectTimeoutException e) {
			throw new ConnectException(e.getMessage());
		}

		int statusCode = contentResponse.getStatusLine().getStatusCode();
		log.debug("HttpGet at {}, Status is {}", configUrl, statusCode);
		if (statusCode == HttpStatus.SC_NOT_FOUND) {
			log.info("No repository-config found at {}", configUrl);

			return null;
		} else if (statusCode != HttpStatus.SC_OK) {
			String msg = "Error loading " + configUrl + ":\n";
			msg += contentResponse.getStatusLine().toString();

			throw new RuntimeException(msg);
		}

		HttpEntity entity = contentResponse.getEntity();
		BufferedInputStream inputStream = new BufferedInputStream(entity.getContent());

		Properties properties = new Properties();
		properties.load(inputStream);

		contentResponse.close();
		client.close();

		return properties;
	}
1074643
@SuppressWarnings("unchecked")
    public synchronized <T> T load(final PluggableService<T> service, final String providerName)
            throws ProviderLoaderException {
        final ProviderIdent ident = new ProviderIdent(service.getName(), providerName);
        debug("loadInstance for " + ident + ": " + pluginJar);

        if (null == pluginProviderDefs.get(ident)) {
            final String[] strings = getClassnames();
            for (final String classname : strings) {
                final Class<?> cls;
                try {
                    cls = loadClass(classname);
                    if (matchesProviderDeclaration(ident, cls)) {
                        pluginProviderDefs.put(ident, cls);
                    }
                } catch (PluginException e) {
                    log.error("Failed to load class from " + pluginJar + ": classname: " + classname + ": "
                            + e.getMessage());
                }
            }
        }
        final Class<T> cls = pluginProviderDefs.get(ident);
        if (null != cls) {
            try {
                return createProviderForClass(service, cls);
            } catch (PluginException e) {
                throw new ProviderLoaderException(e, service.getName(), providerName);
            }
        }
        return null;
    }
798928
public static AnnotationMappingInfo load(final InputStream in) throws XmlOperateException {
        ArgUtils.notNull(in, "in");
        
        final AnnotationMappingInfo xmlInfo;
        
        try {
            xmlInfo = JAXB.unmarshal(in, AnnotationMappingInfo.class);
        } catch (DataBindingException e) {
            throw new XmlOperateException("fail load xml with JAXB.", e);
        }
        
        return xmlInfo;
    }
543955
private ItemData initACL(NodeData parent, NodeData node) throws RepositoryException
   {
      return initACL(parent, node, null);
   }
902282
public void add(Repository repository, Object plugin) {
    if (plugin instanceof Function) {
      repository.put(((Function) plugin).getName().toLowerCase(), plugin);
    } else {
      log.debug("FunctionLoader: " + plugin.getClass() + " not of Type " + getLoadClass());
    }
  }
311595
public static Object loadXMLInfo(String filename, String clinvarVersion) throws JAXBException, IOException {
        Object obj = null;
        JAXBContext jaxbContext = JAXBContext.newInstance(clinvarVersion);
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        // Reading GZip input stream
        InputStream inputStream;
        if (filename.endsWith(".gz")) {
            inputStream = new GZIPInputStream(new FileInputStream(new File(filename)));
        }else {
            inputStream = Files.newInputStream(Paths.get(filename));
        }
        obj = unmarshaller.unmarshal(inputStream);
        return obj;
    }
1200650
@Override
    @Deprecated
    protected void initializeInternal() throws RepositoryException {
        this.databaseClient = DatabaseClientFactory.newClient(host,port,user,password,DatabaseClientFactory.Authentication.valueOf(auth));
        this.client = new MarkLogicClient(databaseClient);
    }
485265
public void initializeCms(CmsObject cms) {

        List<String> toRemove = new ArrayList<String>();
        // Repositories which can't be fully initialized need to be removed.
        for (I_CmsRepository repository : m_repositoryMap.values()) {
            String repoName = repository.getName();
            try {
                repository.initializeCms(cms);
            } catch (CmsException e) {
                LOG.warn("Could not fully initialize repository " + repoName, e);
                toRemove.add(repoName);
            }
        }
        for (String removeRepo : toRemove) {
            m_repositoryMap.remove(removeRepo);
        }
        m_hasJlan = !getRepositories(CmsJlanRepository.class).isEmpty();
        if (!CmsShell.isJlanDisabled() && m_hasJlan) {
            CmsJlanUsers.setAdminCms(cms);
            m_jlanThreadManager = new CmsJlanThreadManager();
            m_jlanThreadManager.start();
        }

    }
953625
protected function loadRepoClass($loader, ContainerBuilder $container, array $config)
    {

        if (isset($config['repository']['repo']['class'])) {
            $container->setParameter('snide_travinizer.model.repo.class', $config['repository']['repo']['class']);
        }
    }
260932
public function loadFrom(Repository $config, $configPath)
    {
        foreach ($this->filesIn($configPath) as $group => $configFile) {
            $config->set($group, require $configFile);
        }
    }
369387
@SuppressWarnings("rawtypes")
    private static PluginDefinition parsePluginDefinition(final ClassLoader cl, final Element plugin) throws PluginConfigurationException {

        // Check if the plugin definition is inside its own file
        if (getAttributeValue(plugin, "definedIn", false) != null) {
            StreamManager sm = new StreamManager();

            String sFileName = getAttributeValue(plugin, "definedIn", false);

            try {
                InputStream in = sm.handle(cl.getResourceAsStream(sFileName));

                return parseXmlPluginDefinition(cl, in);
            } finally {
                sm.closeAll();
            }
        }

        String pluginClass = getAttributeValue(plugin, "class", true);

        Class clazz;
        try {
            clazz = LoadedClassCache.getClass(cl, pluginClass);

            if (!IPluginInterface.class.isAssignableFrom(clazz)) {
                throw new PluginConfigurationException("Specified class '" + clazz.getName() + "' in the plugin.xml file does not implement "
                        + "the IPluginInterface interface");
            }

            if (isAnnotated(clazz)) {
                return loadFromPluginAnnotation(clazz);
            }

        } catch (ClassNotFoundException e) {
            throw new PluginConfigurationException(e.getMessage(), e);
        }

        // The class is not annotated not has an external definition file...
        // Loading from current xml file...

        String sDescription = getAttributeValue(plugin, "description", false);

        @SuppressWarnings("unchecked")
        PluginDefinition pluginDef = new PluginDefinition(getAttributeValue(plugin, "name", true), sDescription, clazz);

        parseCommandLine(pluginDef, plugin);
        return pluginDef;
    }