/*  Copyright (c) 2000 by Oracle Corporation. All Rights Reserved. */

package oracle.portal.provider.v2;

/**
 * Represents registration information sent from the portal to the provider.
 */
public class ProviderRegistrationInfo 
{
    private ProviderSubscription mProviderSubscription;
    private String mEncryptionKey;

    /**
     * Default constructor
     */
    public ProviderRegistrationInfo() 
    {
    }

    /**
     *  Create a new subscriber instance using the passed ID and key.
     *  @param subscriberId identifier representing this portal or 
     *  subscription.<p>
     *  Subscriptions are specified at the provider instance level
     *  @param key encryption key the portal should use to encrypt all 
     *  subsequent requests to this provider instance
     */
    public ProviderRegistrationInfo(String subscriptionId, String key) 
    {
        mProviderSubscription = new ProviderSubscription(subscriptionId);
        mEncryptionKey = key;
    }

    /**
     *  Create a new subscriber instance using a ProviderSubscription and key.
     *  @param subscription identifier representing a specific subscription. 
     *  Subscriptions are specified at the provider instance level
     *  @param key encryption key the portal should use to encrypt all 
     *  subsequent requests to this provider instance
     */
    public ProviderRegistrationInfo(ProviderSubscription subscription, 
                                    String key) 
    {
        mProviderSubscription = subscription;
        mEncryptionKey = key;
    }

    /**
     *  Gets the subscription information associated with this registration 
     *  information
     *  @return the subscription information
     */
    public ProviderSubscription getSubscription()
    {
        return mProviderSubscription;
    }

    /**
     *  Convenience method to get the subscription Id
     *  @return equivalent to getSubscription().getId();
     */
    public String getSubscriptionKey()
    {
        if (mProviderSubscription != null)
            return mProviderSubscription.getSubscriptionKey();

        return null;
    }

    /**
     *  Sets the subscriber Id.  Used if object created via null constructor.
     *  @param subscriberId the subscriberId
     */
    public void setSubscription(ProviderSubscription subscription) 
    {
        mProviderSubscription = subscription;
    }

    /**
     *  Gets the encryption key
     *  @return the key
     */
    public String getEncryptionKey() 
    {
        return mEncryptionKey;
    }

    /**
     *  Sets the encryption key.  Used if object created via null constructor.
     *  @param key the key
     */
    public void setEncryptionKey(String key) 
    {
        mEncryptionKey = key;
    }


}







