/*
 * Copyright (c) The Open Services Gateway Initiative (2004).
 * All Rights Reserved.
 *
 * Implementation of certain elements of the Open Services Gateway Initiative
 * (OSGI) Specification may be subject to third party intellectual property
 * rights, including without limitation, patent rights (such a third party may
 * or may not be a member of OSGi). OSGi is not responsible and shall not be
 * held responsible in any manner for identifying or failing to identify any or
 * all such third party intellectual property rights.
 *
 * This document and the information contained herein are provided on an "AS
 * IS" basis and OSGI DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL
 * NOT INFRINGE ANY RIGHTS AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
 * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL OSGI BE LIABLE FOR ANY
 * LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF
 * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTIAL,
 * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH THIS
 * DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH LOSS OR DAMAGE.
 *
 * All Company, brand and product names may be trademarks that are the sole
 * property of their respective owners. All rights reserved.
 */
package org.osgi.util.mobile;

import java.util.Dictionary;
import org.osgi.framework.Bundle;
import org.osgi.service.condpermadmin.Condition;

/**
 * Class representing a user prompt condition. Instances of this class hold two
 * values: a prompt string that is to be displayed to the user and the
 * permission level string according to MIDP2.0 (oneshot, session, blanket).
 *  
 */
public class UserPromptCondition implements Condition {
	/**
	 * Creates an UserPrompt object with the given prompt string and permission
	 * level. The user should be given choice as to what level of permission is
	 * given. Thus, the lifetime of the permission is controlled by the user.
	 *
	 * @param bundle the bundle to ask about
	 * @param levels the possible permission levels. This is a comma-separated list that can contain
	 * 		following strings: ONESHOT SESSION BLANKET.
	 * @param defaultLevel the default permission level. If it is an empty string, then there is
	 * 		no default.
	 * @param catalogName the message catalog base name
	 * @param key the key that identifies the prompt string in the message catalog
	 */
	public UserPromptCondition(Bundle bundle,
					String levels,
					String defaultLevel, 
					String catalogName, 
					String key) 
	{
	}

	/**
	 * Checks whether the condition is evaluated. Depending on the permission
	 * level, the function returns the following values.
	 * <ul>
	 * <li>ONESHOT - isSatisfied always returns false. The condition
	 * reevaluated each time it is checked.
	 * <li>SESSION - isSatisfied returns false until isEvaluated() returns true
	 * (the user accepts the prompt for this execution of the bundle). Then
	 * isSatisfied() returns true until the bundle is stopped.
	 * <li>BLANKET - isSatisfied returns false until isEvaluated() returns true
	 * (the user accepts the prompt for the lifetime of the bundle). Then
	 * isSatisfied() returns true until the bundle is uninstalled.
	 * </ul>
	 * 
	 * @return true if the condition is satisfied.
	 */
	public boolean isEvaluated() {
		return false;
	}

	/**
	 * Checks whether the condition may change in the future.
	 * 
	 * @return
	 * <ul>
	 * <li>false, if it is already evaluated and is a BLANKET condition
	 * <li>true otherwise
	 * </ul>
	 */
	public boolean isMutable() {
		return false;
	}

	/**
	 * Checks whether the condition is satisfied. Displays the prompt string to
	 * the user and returns true if the user presses "accept". Depending on the
	 * amount of levels the condition is assigned to, the prompt may have
	 * multiple "accept" buttons and one of them can be selected by default (see
	 * deflevel parameter at UserPrompt constructor). It must be always possible
	 * to deny the permission (e.g. by a separate "deny" button).
	 * 
	 * @return true if the user accepts the prompt (or accepts any prompt in
	 *         case there are multiple permission levels).
	 */
	public boolean isSatisfied() {
		return false;
	}

	/**
	 * Checks an array of UserPrompt conditions
	 * 
	 * @param conds the array containing the UserPrompt conditions to evaluate
	 * @param context storage area for one-shot evaluation
	 * @return true, if all conditions are satisfied
	 */
	public boolean isSatisfied(Condition[] conds, Dictionary context) {
		return false;
	}
}

@@ -2444,76 +2444,265 @@
 ram 
-key the key that identifies the prompt string in the message catalog
+message textual description of the condition, to be displayed to the user. If%0A%09 * %09%09it starts with a '%25' sign, then the message is looked up from the catalog specified%0A%09 * %09%09by the catalogName parameter. The key is the rest of the string after the '%25' sign.
 %0A%09 *
@@ -2831,19 +2831,23 @@
 %09String 
-key
+message
 ) %0A%09%7B%0A%09%7D

use "%" notation