Bump date.
[SquirrelJME.git] / modules / meep-swm / src / main / java / javax / microedition / swm / SuiteInstaller.java
blob3edebaa3e3449c0a9ca99ee0550052a347a4a1f9
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package javax.microedition.swm;
12 import cc.squirreljme.runtime.cldc.annotation.Api;
13 import cc.squirreljme.runtime.cldc.debug.Debugging;
14 import cc.squirreljme.runtime.swm.JarStreamSupplier;
15 import java.util.Set;
16 import net.multiphasicapps.collections.IdentityLinkedHashSet;
18 /**
19 * This class is created when a suite is to be installed.
21 * @since 2016/06/24
23 @Api
24 public final class SuiteInstaller
26 /** The supplier for the JAR data. */
27 final JarStreamSupplier _supplier;
29 /** Listeners for suites. */
30 final Set<SuiteInstallListener> _listeners =
31 new IdentityLinkedHashSet<>();
33 /**
34 * Internal use only.
36 * @param __sup The supplier for JAR files.
37 * @throws NullPointerException On null arguments.
38 * @since 2016/06/24
40 SuiteInstaller(JarStreamSupplier __sup)
41 throws NullPointerException
43 if (__sup == null)
44 throw new NullPointerException("NARG");
46 this._supplier = __sup;
49 /**
50 * Adds a suite installation listener which can be given status updates
51 * when a suite's installation status has changed.
53 * @param __sl The listener to add.
54 * @since 2016/06/24
56 @Api
57 public final void addInstallationListener(SuiteInstallListener __sl)
59 // Ignore
60 if (__sl == null)
61 return;
63 this._listeners.add(__sl);
66 /**
67 * Cancels the current installation.
69 * @since 2016/06/24
71 @Api
72 public final void cancel()
74 throw Debugging.todo();
77 /**
78 * Removes the given installation listener so that it no longer is notified
79 * of installation updates.
81 * @param __sl The listener to remove.
82 * @since 2016/06/24
84 @Api
85 public final void removeInstallationListener(SuiteInstallListener __sl)
87 // Ignore
88 if (__sl == null)
89 return;
91 this._listeners.remove(__sl);
94 /**
95 * Starts installation of the given suite.
97 * If this is called twice then the next installation attempt is
98 * enqueued regardless if the previous installation has succeeded or
99 * failed.
101 * If there is not enough permission to install the given suite then
102 * {@link InstallErrorCodes#UNAUTHORIZED_INSTALL} is set.
104 * @return The tracker for the given suite.
105 * @since 2016/06/24
107 @Api
108 public final SuiteManagementTracker start()
110 return new __SuiteTracker__(this);