src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
/**
     * Creates an account for the given user and password.
     *
     * @param providerFactory the ProtocolProviderFactory which will create
     * the account
     * @param userName the user identifier
     * @param passwd the password
     * @return the <tt>ProtocolProviderService</tt> for the new account.
     * @throws OperationFailedException if the operation didn't succeed
     */
Creates an account for the given user and password.
@param providerFactory the ProtocolProviderFactory which will create
the account
@param userName the user identifier
@param passwd the password
@return the ProtocolProviderService for the new account.
@throws OperationFailedException if the operation didn't succeed
Creates an account for the given user and password . @param providerFactory the ProtocolProviderFactory which will create the account @param userName the user identifier @param passwd the password @return the ProtocolProviderService for the new account . @throws OperationFailedException if the operation didn ' t succeed
protected ProtocolProviderService installAccount(
        ProtocolProviderFactory providerFactory,
        String userName,
        String passwd)
        throws OperationFailedException
    {
        if(logger.isTraceEnabled())
        {
            logger.trace("Preparing to install account for user " + userName);
        }
        Hashtable<String, String> accountProperties
            = new Hashtable<String, String>();
        String protocolIconPath = getProtocolIconPath();
        String accountIconPath = getAccountIconPath();
        registration.storeProperties(
                userName, passwd,
                protocolIconPath, accountIconPath,
                accountProperties);
        accountProperties.put(ProtocolProviderFactory.IS_PREFERRED_PROTOCOL,
                              Boolean.toString(isPreferredProtocol()));
        accountProperties.put(ProtocolProviderFactory.PROTOCOL, getProtocol());
        if (isModification())
        {
            providerFactory.modifyAccount(  protocolProvider,
                accountProperties);
            setModification(false);
            return protocolProvider;
        }
        try
        {
            if(logger.isTraceEnabled())
            {
                logger.trace("Will install account for user " + userName
                             + " with the following properties."
                             + accountProperties);
            }
            AccountID accountID = providerFactory.installAccount(
                userName,
                accountProperties);
            ServiceReference serRef = providerFactory
                .getProviderForAccount(accountID);
            protocolProvider = (ProtocolProviderService)
                JabberAccRegWizzActivator.bundleContext
                .getService(serRef);
        }
        catch (IllegalArgumentException exc)
        {
            logger.warn(exc.getMessage());
            throw new OperationFailedException(
                "Username, password or server is null.",
                OperationFailedException.ILLEGAL_ARGUMENT);
        }
        catch (IllegalStateException exc)
        {
            logger.warn(exc.getMessage());
            throw new OperationFailedException(
                "Account already exists.",
                OperationFailedException.IDENTIFICATION_CONFLICT);
        }
        catch (Throwable exc)
        {
            logger.warn(exc.getMessage());
            throw new OperationFailedException(
                "Failed to add account.",
                OperationFailedException.GENERAL_ERROR);
        }
        return protocolProvider;
    }
protected ProtocolProviderService installAccount ( ProtocolProviderFactory providerFactory , String userName , String passwd ) throws OperationFailedException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Preparing to install account for user " + userName ) ; } Hashtable < String , String > accountProperties = new Hashtable < String , String > ( ) ; String protocolIconPath = getProtocolIconPath ( ) ; String accountIconPath = getAccountIconPath ( ) ; registration . storeProperties ( userName , passwd , protocolIconPath , accountIconPath , accountProperties ) ; accountProperties . put ( ProtocolProviderFactory . IS_PREFERRED_PROTOCOL , Boolean . toString ( isPreferredProtocol ( ) ) ) ; accountProperties . put ( ProtocolProviderFactory . PROTOCOL , getProtocol ( ) ) ; if ( isModification ( ) ) { providerFactory . modifyAccount ( protocolProvider , accountProperties ) ; setModification ( false ) ; return protocolProvider ; } try { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Will install account for user " + userName + " with the following properties." + accountProperties ) ; } AccountID accountID = providerFactory . installAccount ( userName , accountProperties ) ; ServiceReference serRef = providerFactory . getProviderForAccount ( accountID ) ; protocolProvider = ( ProtocolProviderService ) JabberAccRegWizzActivator . bundleContext . getService ( serRef ) ; } catch ( IllegalArgumentException exc ) { logger . warn ( exc . getMessage ( ) ) ; throw new OperationFailedException ( "Username, password or server is null." , OperationFailedException . ILLEGAL_ARGUMENT ) ; } catch ( IllegalStateException exc ) { logger . warn ( exc . getMessage ( ) ) ; throw new OperationFailedException ( "Account already exists." , OperationFailedException . IDENTIFICATION_CONFLICT ) ; } catch ( Throwable exc ) { logger . warn ( exc . getMessage ( ) ) ; throw new OperationFailedException ( "Failed to add account." , OperationFailedException . GENERAL_ERROR ) ; } return protocolProvider ; }
Creates an account for the given user and password.
Creates an account for the given user and password .