/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Process and manage "-link" and "-linkoffline" to external packages. The
* options "-link" and "-linkoffline" both depend on the fact that Javadoc now
* generates "package-list"(lists all the packages which are getting
* documented) file in the current or the destination directory, while
* generating the documentation.
*
* This code is not part of an API.
* It is implementation that is subject to change.
* Do not use it as an API
*
* @author Atul M Dambalkar
* @author Robert Field
*/
public class Extern {
/**
* Map package names onto Extern Item objects.
* Lazily initialized.
*/
/**
* The global configuration information for this run.
*/
/**
* True if we are using -linkoffline and false if -link is used instead.
*/
private boolean linkoffline = false;
/**
* Stores the info for one external doc set
*/
private class Item {
/**
* Package name, found in the "package-list" file in the {@link path}.
*/
/**
* The URL or the directory path at which the package documentation will be
* avaliable.
*/
/**
* If given path is directory path then true else if it is a URL then false.
*/
final boolean relative;
/**
* Constructor to build a Extern Item object and map it with the package name.
* If the same package name is found in the map, then the first mapped
* Item object or offline location will be retained.
*
* @param packagename Package name found in the "package-list" file.
* @param path URL or Directory path from where the "package-list"
* file is picked.
* @param relative True if path is URL, false if directory path.
*/
this.packageName = packageName;
if (packageToItemMap == null) {
}
}
}
/**
* String representation of "this" with packagename and the path.
*/
}
}
this.configuration = configuration;
}
/**
* Determine if a doc item is externally documented.
*
* @param doc A ProgramElementDoc.
*/
if (packageToItemMap == null) {
return false;
}
}
/**
* Convert a link to be an external link if appropriate.
*
* @param pkgName The package name.
* @param relativepath The relative path.
* @param link The link to convert.
* @return if external return converted link else return null
*/
return relativepath + externlink;
} else {
return externlink;
}
}
return null;
}
/**
* Build the extern package list from given URL or the directory path.
* Flag error if the "-link" or "-linkoffline" option is already used.
*
* @param url URL or Directory path.
* @param pkglisturl This can be another URL for "package-list" or ordinary
* file.
* @param reporter The <code>DocErrorReporter</code> used to report errors.
* @param linkoffline True if -linkoffline isused and false if -link is used.
*/
this.linkoffline = linkoffline;
return false;
} else {
return true;
}
}
/**
* Get the Extern Item object associated with this package name.
*
* @param pkgname Package name.
*/
if (packageToItemMap == null) {
return null;
}
}
/**
* Adjusts the end file separator if it is missing from the URL or the
* directory path and depending upon the URL or file path, fetch or
* read the "package-list" file.
*
* @param urlOrDirPath URL or the directory path.
* @param pkgListUrlOrDirPath URL or directory path for the "package-list" file or the "package-list"
* file itself.
*/
return isUrl(pkgListUrlOrDirPath) ?
}
/**
* If the URL or Directory path is missing end file separator, add that.
*/
}
return url;
}
/**
* Fetch the URL and read the "package-list" file.
*
* @param urlpath Path to the packages.
* @param pkglisturlpath URL or the path to the "package-list" file.
*/
try {
} catch (MalformedURLException exc) {
} catch (IOException exc) {
}
return null;
}
/**
* Read the "package-list" file which is available locally.
*
* @param path URL or directory path to the packages.
* @param pkgListPath Path to the local "package-list" file.
*/
}
try {
} else {
}
} catch (FileNotFoundException exc) {
} catch (IOException exc) {
}
return null;
}
/**
* Read the file "package-list" and for each package name found, create
* Extern object and associate it with the package name in the map.
*
* @param input InputStream from the "package-list" file.
* @param path URL or the directory path to the packages.
* @param relative Is path relative?
*/
boolean relative)
throws IOException {
try {
int c;
char ch = (char)c;
}
} else {
}
}
} finally {
}
}
try {
new URL(urlCandidate);
//No exception was thrown, so this must really be a URL.
return true;
} catch (MalformedURLException e) {
//Since exception is thrown, this must be a directory path.
return false;
}
}
}