MCPcopy Create free account
hub / github.com/apache/pig / registerJar

Method registerJar

src/org/apache/pig/PigServer.java:610–647  ·  view source on GitHub ↗

Registers a jar file. Name of the jar file can be an absolute or relative path. If multiple resources are found with the specified name, the first one is registered as returned by getSystemResources. A warning is issued to inform the user. @param name of the jar file to register @throws IOExceptio

(String name)

Source from the content-addressed store, hash-verified

608 * @throws IOException
609 */
610 public void registerJar(String name) throws IOException {
611 // Check if this operation is permitted
612 filter.validate(PigCommandFilter.Command.REGISTER);
613
614 if (pigContext.hasJar(name)) {
615 log.debug("Ignoring duplicate registration for jar " + name);
616 return;
617 }
618
619 // first try to locate jar via system resources
620 // if this fails, try by using "name" as File (this preserves
621 // compatibility with case when user passes absolute path or path
622 // relative to current working directory.)
623 if (name != null) {
624 if (name.isEmpty()) {
625 log.warn("Empty string specified for jar path");
626 return;
627 }
628
629 URL resource = locateJarFromResources(name);
630
631 if (resource == null) {
632 FetchFileRet[] files = FileLocalizer.fetchFiles(pigContext.getProperties(), name);
633 for (FetchFileRet file : files) {
634 File f = file.file;
635 if (!f.canRead()) {
636 int errCode = 4002;
637 String msg = "Can't read jar file: " + name;
638 throw new FrontendException(msg, errCode, PigException.USER_ENVIRONMENT);
639 }
640
641 pigContext.addJar(f.toURI().toURL(), name);
642 }
643 } else {
644 pigContext.addJar(resource, name);
645 }
646 }
647 }
648
649 /**
650 * Universal Scripting Language Support, see PIG-928

Calls 10

fetchFilesMethod · 0.95
hasJarMethod · 0.80
debugMethod · 0.80
addJarMethod · 0.80
toURIMethod · 0.80
validateMethod · 0.65
warnMethod · 0.65
isEmptyMethod · 0.45
getPropertiesMethod · 0.45