001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.module.framework;
016    
017    import com.liferay.portal.util.PropsValues;
018    
019    import java.io.File;
020    
021    import java.net.URL;
022    
023    /**
024     * @author Raymond Aug??
025     */
026    public class RuntimeClasspathResolver implements ClasspathResolver {
027    
028            @Override
029            public URL[] getClasspathURLs() throws Exception {
030                    File coreDir = new File(PropsValues.MODULE_FRAMEWORK_BASE_DIR, "core");
031    
032                    File[] files = coreDir.listFiles();
033    
034                    if (files == null) {
035                            throw new IllegalStateException(
036                                    "Missing " + coreDir.getCanonicalPath());
037                    }
038    
039                    URL[] urls = new URL[files.length];
040    
041                    for (int i = 0; i < urls.length; i++) {
042                            urls[i] = new URL("file", null, files[i].getAbsolutePath());
043                    }
044    
045                    return urls;
046            }
047    
048    }