Java Class Loader isBizServicesLocatorXmlLoaded(File f, ClassLoader classLoader)

Here you can find the source of isBizServicesLocatorXmlLoaded(File f, ClassLoader classLoader)

Description

is Biz Services Locator Xml Loaded

License

Open Source License

Declaration

public static boolean isBizServicesLocatorXmlLoaded(File f, ClassLoader classLoader) 

Method Source Code


//package com.java2s;
/*//from   w w  w . j a  v  a2s .  c  o  m
 * Copyright 2011-2016 ZXC.com All right reserved. This software is the confidential and proprietary information of
 * ZXC.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into with ZXC.com.
 */

import java.io.File;

import java.io.FilenameFilter;

import java.net.URL;
import java.util.ArrayList;

import java.util.List;

public class Main {
    public static boolean isBizServicesLocatorXmlLoaded(File f, ClassLoader classLoader) {
        if ((f == null) || (!f.exists())) {
            return false;
        }
        File biz = new File(f.getAbsolutePath() + "/biz");
        if (!biz.exists()) {
            System.err.println("Path not exists:" + biz);
        }
        final List<String> filenames = new ArrayList<String>();
        biz.listFiles(new FilenameFilter() {

            public boolean accept(File dir, String name) {
                if (name.endsWith("_services_locator.xml")) {
                    filenames.add(name);
                }
                return false;
            }
        });

        if (filenames.size() == 0) {
            return false;
        }

        URL url = classLoader.getResource("biz/" + filenames.get(0));

        return (url != null);
    }
}

Related

  1. getParentClassLoader()
  2. getProjectClassLoader(IJavaProject javaProject)
  3. getProjectClassLoader(IJavaProject javaProject, ClassLoader parentClassLoader)
  4. getStreamForPath(ClassLoader loader, String path)
  5. getToolsClassLoader()
  6. load(Class serviceClass, ClassLoader loader)
  7. load(String className)
  8. load(String path, String className)
  9. loadAllAutoConfigFiles(ClassLoader classloader)