@Override /* Var */ public String resolve(VarResolverSession session, String key) { return manifestFile == null ? "" : manifestFile.getString(key); } }
@Override /* Object */ public String toString() { StringBuilder sb = new StringBuilder(); for (Map.Entry<String,Object> e : entrySet()) sb.append(e.getKey()).append(": ").append(e.getValue()); return sb.toString(); } }
/** * Create an instance of this class from a {@link Manifest} object. * * @param f The manifest to read from. */ public ManifestFile(Manifest f) { load(f); }
mf = new ManifestFile(m); if (args.hasArg(0)) cfPath = args.getArg(0); else if (mf.containsKey("Main-Config")) cfPath = mf.getString("Main-Config"); else { String cmd = System.getProperty("sun.java.command", "not_found").split("\\s+")[0];
private List<String> getCandidateConfigNames() { Args args = getArgs(); if (getArgs().hasArg("configFile")) return Collections.singletonList(args.getArg("configFile")); ManifestFile manifest = getManifest(); if (manifest.containsKey("Main-Config")) return Collections.singletonList(manifest.getString("Main-Config")); return Config.getCandidateSystemDefaultConfigNames(); }
/** * Same as {@link #setManifest(Manifest)} except finds and loads the manifest file of the jar file that the * specified class is contained within. * * @param c The class whose jar file contains the manifest to use for this microservice. * @return This object (for method chaining). * @throws IOException If a problem occurred while trying to read the manifest file. */ public Microservice setManifest(Class<?> c) throws IOException { return setManifest(new ManifestFile(c)); }
private void load(Manifest mf) { for (Map.Entry<Object,Object> e : mf.getMainAttributes().entrySet()) put(e.getKey().toString(), e.getValue().toString()); }
/** * Same as {@link #setManifest(Manifest)} except specified through a {@link File} object. * * @param f The manifest file of this microservice. * @return This object (for method chaining). * @throws IOException If a problem occurred while trying to read the manifest file. */ public Microservice setManifest(File f) throws IOException { return setManifest(new ManifestFile(f)); }
private void load(Manifest mf) { for (Map.Entry<Object,Object> e : mf.getMainAttributes().entrySet()) put(e.getKey().toString(), e.getValue().toString()); }
/** * Create an instance of this class from a {@link Manifest} object. * * @param f The manifest to read from. */ public ManifestFile(Manifest f) { load(f); }
@Override /* Var */ public String resolve(VarResolverSession session, String key) { return manifestFile == null ? "" : manifestFile.getString(key); } }
/** * Shortcut for calling <code>setManifest(<jk>new</jk> ManifestFile(mf))</code>. * * @param mf The manifest file of this microservice. * @return This object (for method chaining). */ public Microservice setManifest(Manifest mf) { return setManifest(new ManifestFile(mf)); }
@Override /* Object */ public String toString() { StringBuilder sb = new StringBuilder(); for (Map.Entry<String,Object> e : entrySet()) sb.append(e.getKey()).append(": ").append(e.getValue()); return sb.toString(); } }
private void load(Manifest mf) { for (Map.Entry<Object,Object> e : mf.getMainAttributes().entrySet()) put(e.getKey().toString(), e.getValue().toString()); }
/** * Create an instance of this class from a {@link Manifest} object. * * @param f The manifest to read from. */ public ManifestFile(Manifest f) { load(f); }
@Override /* Var */ public String resolve(VarResolverSession session, String key) { return manifestFile == null ? "" : manifestFile.getString(key); } }
/** * Convenience method for specifying the manifest contents directly. * * @param contents The lines in the manifest file. * @return This object (for method chaining). * @throws IOException */ public Microservice setManifestContents(String...contents) throws IOException { String s = StringUtils.join(contents, "\n") + "\n"; return setManifest(new ManifestFile(new Manifest(new ByteArrayInputStream(s.getBytes("UTF-8"))))); }
@Override /* Object */ public String toString() { StringBuilder sb = new StringBuilder(); for (Map.Entry<String,Object> e : entrySet()) sb.append(e.getKey()).append(": ").append(e.getValue()); return sb.toString(); } }
/** * Create an instance of this class loaded from the contents of an input stream. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param is The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(InputStream is) throws IOException { load(new Manifest(is)); }
this.manifest = (ManifestFile)value; else if (value instanceof Manifest) this.manifest = new ManifestFile((Manifest)value); else if (value instanceof Reader) this.manifest = new ManifestFile((Reader)value); else if (value instanceof InputStream) this.manifest = new ManifestFile((InputStream)value); else if (value instanceof File) this.manifest = new ManifestFile((File)value); else if (value instanceof String) this.manifest = new ManifestFile(new File((String)value)); else if (value instanceof Class) this.manifest = new ManifestFile((Class<?>)value); else throw new RuntimeException("Invalid type passed to MicroserviceBuilder.manifest(Object). Type=["+value.getClass().getName()+"]");