<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=User_talk%3APaint_Ninja%2FInstaller</id>
	<title>User talk:Paint Ninja/Installer - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=User_talk%3APaint_Ninja%2FInstaller"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=User_talk:Paint_Ninja/Installer&amp;action=history"/>
	<updated>2026-06-04T23:31:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=User_talk:Paint_Ninja/Installer&amp;diff=2595&amp;oldid=prev</id>
		<title>Paint Ninja: Created page with &quot;see &lt;code&gt;Actions.java&lt;/code&gt;, &lt;code&gt;Action.java&lt;/code&gt;, &lt;code&gt;ClientInstall/ServerInstall/ExtractAction.java&lt;/code&gt;  example with &lt;code&gt;ExtractAction&lt;/code&gt;: &lt;code&gt;final Acti...&quot;</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=User_talk:Paint_Ninja/Installer&amp;diff=2595&amp;oldid=prev"/>
		<updated>2021-05-13T00:30:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;see &amp;lt;code&amp;gt;Actions.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Action.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ClientInstall/ServerInstall/ExtractAction.java&amp;lt;/code&amp;gt;  example with &amp;lt;code&amp;gt;ExtractAction&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;final Acti...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;see &amp;lt;code&amp;gt;Actions.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Action.java&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ClientInstall/ServerInstall/ExtractAction.java&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
example with &amp;lt;code&amp;gt;ExtractAction&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;final Actions action = Actions.EXTRACT;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;action.getAction(installProfile, monitor)&amp;lt;/code&amp;gt; will refer to the &amp;lt;code&amp;gt;BiFunction&amp;lt;Install, ProgressCallback, Action&amp;gt;&amp;lt;/code&amp;gt; action&lt;br /&gt;
inside the &amp;lt;code&amp;gt;Actions.java&amp;lt;/code&amp;gt; enum which &amp;lt;code&amp;gt;Actions.EXTRACT&amp;lt;/code&amp;gt; specifically populates as a new instance of&lt;br /&gt;
&amp;lt;code&amp;gt;ExtractAction.java&amp;lt;/code&amp;gt; as the &amp;lt;code&amp;gt;BiFunction&amp;lt;/code&amp;gt; (a &amp;lt;code&amp;gt;BiFunction&amp;lt;/code&amp;gt; being an &amp;lt;code&amp;gt;Object&amp;lt;/code&amp;gt; that takes two inputs, can do some work and has one output).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Install installProfile&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ProgressCallback monitor&amp;lt;/code&amp;gt; arguments are then applied to the &amp;lt;code&amp;gt;BiFunction&amp;lt;/code&amp;gt;,&lt;br /&gt;
which causes &amp;lt;code&amp;gt;ExtractAction&amp;lt;/code&amp;gt;'s constructor to be called with those arguments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ExtractAction&amp;lt;/code&amp;gt;'s constructor calls its parent constructor (Action.java) with &amp;lt;code&amp;gt;super(profile, monitor, true)&amp;lt;/code&amp;gt;.&lt;br /&gt;
true being &amp;lt;code&amp;gt;isClient&amp;lt;/code&amp;gt; here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Action.java&amp;lt;/code&amp;gt;'s constructor populates some variables and instantiates &amp;lt;code&amp;gt;PostProcessors.java&amp;lt;/code&amp;gt;, which calls&lt;br /&gt;
the &amp;lt;code&amp;gt;installProfile&amp;lt;/code&amp;gt;'s &amp;lt;code&amp;gt;getProcessors(&amp;quot;client&amp;quot;)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;getData(true)&amp;lt;/code&amp;gt; methods and stores their results in a&lt;br /&gt;
&amp;lt;code&amp;gt;List&amp;lt;Processor&amp;gt;&amp;lt;/code&amp;gt; and a &amp;lt;code&amp;gt;Map&amp;lt;String, String&amp;gt;&amp;lt;/code&amp;gt;, respectively. &amp;lt;code&amp;gt;Install#getProcessors()&amp;lt;/code&amp;gt; will return an empty list&lt;br /&gt;
and &amp;lt;code&amp;gt;Install#getData()&amp;lt;/code&amp;gt; will return a new, empty &amp;lt;code&amp;gt;HashMap&amp;lt;/code&amp;gt;, this is just to set things up for when the action&lt;br /&gt;
is ran.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;action.getAction(installProfile, monitor).run(target, a -&amp;gt; true)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;ExtractAction.java&amp;lt;/code&amp;gt; overrides the &amp;lt;code&amp;gt;run(File, Predicate&amp;lt;String&amp;gt;)&amp;lt;/code&amp;gt; method. In this case, the args from the&lt;br /&gt;
run method invocation above provide the target directory to extract to and what's basically an unused&lt;br /&gt;
truthy boolean value.&lt;br /&gt;
&lt;br /&gt;
This run method returns true if successful and false otherwise. It gets the &amp;lt;code&amp;gt;path&amp;lt;/code&amp;gt; variable from the parsed&lt;br /&gt;
&amp;lt;code&amp;gt;installProfile&amp;lt;/code&amp;gt;, which is the Maven artifact path for the 'main' jar and is an instance of &amp;lt;code&amp;gt;Artifact.java&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Artifact.java&amp;lt;/code&amp;gt; uses an &amp;lt;code&amp;gt;Adapter&amp;lt;/code&amp;gt; subclass that implements a JSON deserializer and serializer that gets the&lt;br /&gt;
JSON primitive String and calls the Artifact#from(String) to split the maven descriptor into its parts and&lt;br /&gt;
build a path to it inside the Installer jar.&lt;br /&gt;
&lt;br /&gt;
It then calls DownloadUtils#extractFile(Artifact, File, String) with the Maven artifact path to extract from,&lt;br /&gt;
the target path to put it in when extracted and a &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; (meaning don't verify its checksum after extracting it).&lt;br /&gt;
&lt;br /&gt;
Extracting the &amp;lt;code&amp;gt;Artifact&amp;lt;/code&amp;gt; is easier than it sounds, it just grabs a file embedded within the jar under the&lt;br /&gt;
maven folder (similar to how the install_profile.json is obtained) and copies it to the target path,&lt;br /&gt;
overwriting any existing files there and creating directories to put them in when necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;if (action.getAction(installProfile, monitor).run(target, a -&amp;gt; true)) {&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paint Ninja</name></author>
	</entry>
</feed>