public ObjectName createProfile(java.lang.String profileTableName, java.lang.String profileName) throws java.lang.NullPointerException, UnrecognizedProfileTableNameException,
			InvalidArgumentException, ProfileAlreadyExistsException, ManagementException {

		if (logger.isDebugEnabled()) {
			logger.debug("createProfile( profileTable = "+profileTableName+" , profile = "+profileName+" )");
		}

		try {
			ProfileTableImpl.validateProfileName(profileName);
			ProfileTableImpl.validateProfileTableName(profileTableName);
		}
		catch (IllegalArgumentException e) {
			throw new InvalidArgumentException(e.getMessage());
		}
		
		Transaction transaction = null;
		boolean rollback = true;
		try {
			// begin tx
			sleeTransactionManagement.begin();
			transaction = sleeTransactionManagement.getTransaction();
			// This checks if profile table exists - throws SLEEException in
			// case of system level and UnrecognizedProfileTableNameException in
			// case of no such table
			final ProfileTableImpl profileTable = this.sleeProfileManagement.getProfileTable(profileTableName);
			// create profile
			profileTable.createProfile(profileName);
			if (sleeTransactionManagement.getRollbackOnly()) {
				throw new ManagementException("Transaction used in profile creation rolled back");
			}
			else {
				// create mbean and registers it
				final AbstractProfileMBeanImpl profileMBean = createAndRegisterProfileMBean(profileName,profileTable);
				// keep track of the mbean existence
				profileTable.addUncommittedProfileMBean(profileMBean);
				TransactionalAction action = new TransactionalAction() {
					public void execute() {
						profileTable.removeUncommittedProfileMBean(profileMBean);						
					}
				};
				final TransactionContext txContext = sleeTransactionManagement.getTransactionContext();
				txContext.getAfterCommitActions().add(action);
				txContext.getAfterRollbackActions().add(action);
				// indicate profile creation
				profileMBean.createProfile();
				rollback = false;
				if (logger.isDebugEnabled()) {
					logger.debug("createProfile( profileTable = "+profileTableName+" , profile = "+profileName+" ) result is "+profileMBean.getObjectName());
				}
				return profileMBean.getObjectName();
			}								
		} catch (TransactionRequiredLocalException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (SLEEException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (CreateException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (NotSupportedException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (SystemException e) {
			throw new ManagementException(e.getMessage(),e);
		} finally {
			if(rollback) {
				try {
					if (sleeTransactionManagement.getTransaction() == null) {
						// the tx was suspended, resume it
						sleeTransactionManagement.resume(transaction);
					}
					sleeTransactionManagement.rollback();
				}
				catch (Throwable e) {
					logger.error(e.getMessage(),e);
				}				
			}
		}
	}
public ObjectName createProfile(java.lang.String profileTableName, java.lang.String profileName) throws java.lang.NullPointerException, UnrecognizedProfileTableNameException,
			InvalidArgumentException, ProfileAlreadyExistsException, ManagementException {

		if (logger.isDebugEnabled()) {
			logger.debug("createProfile( profileTable = "+profileTableName+" , profile = "+profileName+" )");
		}

		try {
			ProfileTableImpl.validateProfileName(profileName);
			ProfileTableImpl.validateProfileTableName(profileTableName);
		}
		catch (IllegalArgumentException e) {
			throw new InvalidArgumentException(e.getMessage());
		}
		
		Transaction transaction = null;
		boolean rollback = true;
		try {
			
			sleeTransactionManagement.begin();
			transaction = sleeTransactionManagement.getTransaction();
			
			
			
			final ProfileTableImpl profileTable = this.sleeProfileManagement.getProfileTable(profileTableName);
			
			profileTable.createProfile(profileName);
			if (sleeTransactionManagement.getRollbackOnly()) {
				throw new ManagementException("Transaction used in profile creation rolled back");
			}
			else {
				
				final AbstractProfileMBeanImpl profileMBean = createAndRegisterProfileMBean(profileName,profileTable);
				
				profileTable.addUncommittedProfileMBean(profileMBean);
				TransactionalAction action = new TransactionalAction() {
					public void execute() {
						profileTable.removeUncommittedProfileMBean(profileMBean);						
					}
				};
				final TransactionContext txContext = sleeTransactionManagement.getTransactionContext();
				txContext.getAfterCommitActions().add(action);
				txContext.getAfterRollbackActions().add(action);
				
				profileMBean.createProfile();
				rollback = false;
				if (logger.isDebugEnabled()) {
					logger.debug("createProfile( profileTable = "+profileTableName+" , profile = "+profileName+" ) result is "+profileMBean.getObjectName());
				}
				return profileMBean.getObjectName();
			}								
		} catch (TransactionRequiredLocalException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (SLEEException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (CreateException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (NotSupportedException e) {
			throw new ManagementException(e.getMessage(),e);
		} catch (SystemException e) {
			throw new ManagementException(e.getMessage(),e);
		} finally {
			if(rollback) {
				try {
					if (sleeTransactionManagement.getTransaction() == null) {
						
						sleeTransactionManagement.resume(transaction);
					}
					sleeTransactionManagement.rollback();
				}
				catch (Throwable e) {
					logger.error(e.getMessage(),e);
				}				
			}
		}
	}
public ObjectName createProfile ( java . lang . String profileTableName , java . lang . String profileName ) throws java . lang . NullPointerException , UnrecognizedProfileTableNameException , InvalidArgumentException , ProfileAlreadyExistsException , ManagementException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "createProfile( profileTable = " + profileTableName + " , profile = " + profileName + " )" ) ; } try { ProfileTableImpl . validateProfileName ( profileName ) ; ProfileTableImpl . validateProfileTableName ( profileTableName ) ; } catch ( IllegalArgumentException e ) { throw new InvalidArgumentException ( e . getMessage ( ) ) ; } Transaction transaction = null ; boolean rollback = true ; try { // begin tx
 sleeTransactionManagement . begin ( ) ; transaction = sleeTransactionManagement . getTransaction ( ) ; // This checks if profile table exists - throws SLEEException in
 // case of system level and UnrecognizedProfileTableNameException in
 // case of no such table
 final ProfileTableImpl profileTable = this . sleeProfileManagement . getProfileTable ( profileTableName ) ; // create profile
 profileTable . createProfile ( profileName ) ; if ( sleeTransactionManagement . getRollbackOnly ( ) ) { throw new ManagementException ( "Transaction used in profile creation rolled back" ) ; } else { // create mbean and registers it
 final AbstractProfileMBeanImpl profileMBean = createAndRegisterProfileMBean ( profileName , profileTable ) ; // keep track of the mbean existence
 profileTable . addUncommittedProfileMBean ( profileMBean ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { profileTable . removeUncommittedProfileMBean ( profileMBean ) ; } } ; final TransactionContext txContext = sleeTransactionManagement . getTransactionContext ( ) ; txContext . getAfterCommitActions ( ) . add ( action ) ; txContext . getAfterRollbackActions ( ) . add ( action ) ; // indicate profile creation
 profileMBean . createProfile ( ) ; rollback = false ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "createProfile( profileTable = " + profileTableName + " , profile = " + profileName + " ) result is " + profileMBean . getObjectName ( ) ) ; } return profileMBean . getObjectName ( ) ; } } catch ( TransactionRequiredLocalException e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } catch ( SLEEException e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } catch ( CreateException e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } catch ( NotSupportedException e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } catch ( SystemException e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } finally { if ( rollback ) { try { if ( sleeTransactionManagement . getTransaction ( ) == null ) { // the tx was suspended, resume it
 sleeTransactionManagement . resume ( transaction ) ; } sleeTransactionManagement . rollback ( ) ; } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } }
/*
(non-Javadoc)
@see javax.slee.management.ProfileProvisioningMBean#createProfile(java.lang.String, java.lang.String)
/ * ( non - Javadoc )