FileDocCategorySizeDatePackage
AppBundleProxy.javaAPI DocphoneME MR2 API (J2ME)4534Wed May 02 18:00:44 BST 2007com.sun.midp.content

AppBundleProxy

public class AppBundleProxy extends AppProxy
AppProxy interface to a not-yet installed application bundle. Used by the RegistryImpl to parse and extract content handler registrations.

Fields Summary
private com.sun.midp.installer.Installer
installer
The installer with access to the archive.
private com.sun.midp.installer.InstallState
state
The InstallState.
private final String
authority
The authority for this bundle.
Constructors Summary
AppBundleProxy(com.sun.midp.installer.Installer installer, com.sun.midp.installer.InstallState state, com.sun.midp.midlet.MIDletSuite msuite, String authority)
Construct an AppBundleProxy to draft from a yet to be installed package.

param
installer the installer
param
msuite the MIDletSuite being constructed by the installer
param
state the installer state
param
authority for the installer
exception
ClassNotFoundException if the classname is not present
exception
IllegalArgumentException if classname is not a valid application

	super(msuite, null, null);
	this.installer = installer;
	this.state = state;
	this.authority = authority;
    
Methods Summary
AppProxyforClass(java.lang.String classname)
Gets the AppProxy for an application class in the current bundle.

param
classname the name of the application class
return
the AppProxy for classname; null if not a valid application (MIDlet)
exception
ClassNotFoundException if the classname is not present
exception
IllegalArgumentException if classname is not a valid application


        AppProxy curr = null;
	synchronized (mutex) {
	    // Check if class already has a AppProxy
            curr = (AppBundleProxy)appmap.get(classname);
            if (curr == null) {
		// Create a new instance and check if it is a valid app
		curr = new AppBundleProxy(installer, state,
					     msuite, authority);
		curr.classname = classname;
		curr.appmap = appmap;
		// Throws ClassNotFoundException or IllegalArgumentException
		curr.verifyApplication(classname);
		curr.initAppInfo();
		appmap.put(classname, curr);
		if (LOG_INFO) {
		    logInfo("AppProxy created: " + this);
		}
	    }
	}
	return curr;
    
java.lang.StringgetAuthority()
Gets the Trusted authority that authenticated this application.

For MIDP, this is the CA of the signer.

return
the authority.

	return authority;
    
protected voidverifyApplication(java.lang.String classname)
Verify that the classname is a valid application. Overridden to just check if the appropriate file is in the jar.

param
classname the application class
exception
ClassNotFoundException is thrown if the class cannot be found
exception
IllegalArgumentException if the classname is null or empty

	try {
	    installer.verifyMIDlet(classname);
	} catch (InvalidJadException ije) {
	    if (ije.getReason() == InvalidJadException.INVALID_VALUE) {
		throw new IllegalArgumentException();
	    } else {
		throw new ClassNotFoundException(classname);
	    }
	}