Examples of TransactionProvider


Examples of com.esri.gpt.server.csw.provider.TransactionProvider

      // Transaction
    } else if (operationName.equals("Transaction")) {
      if (!svcProps.getAllowTransactions()) {
        throw new OwsException("transactions are not allowed at this end-point.");
      }
      TransactionProvider tp = new TransactionProvider();
      opProvider = tp;
     
      values = new SupportedValues("1.0.0,1.1.0",",");
      parameters.add(new SupportedParameter(CswConstants.Parameter_ConstraintVersion,values));
    }
View Full Code Here

Examples of oracle.olapi.transaction.TransactionProvider

   * An example must call this method before creating a Cursor for a Source.
   */
  public void prepareAndCommit()
  throws NotCommittableException, TransactionInactiveException
  {
    TransactionProvider tp = getTransactionProvider();
    tp.prepareCurrentTransaction();
    tp.commitCurrentTransaction();
  }
View Full Code Here

Examples of oracle.olapi.transaction.TransactionProvider

   * An example must call this method before creating a Cursor for a Source.
   */
  protected void prepareAndCommit()
  throws NotCommittableException, TransactionInactiveException
  {
    TransactionProvider tp = getTransactionProvider();
    tp.prepareCurrentTransaction();
    tp.commitCurrentTransaction();
  }
View Full Code Here

Examples of oracle.olapi.transaction.TransactionProvider

   * TopBottomTemplate, and displays the values of that Cursor.
   */
  public void run() throws Exception
  {
    ExpressDataProvider dp = getExpressDataProvider();
    TransactionProvider tp = getTransactionProvider();
       
    // Get the MdmMeasure for the measure.
    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");
    MdmMeasure mdmSales = getMdmMeasure("SALES_AW");
       
View Full Code Here

Examples of oracle.olapi.transaction.TransactionProvider

  }

  protected void run() throws Exception
  {
    DataProvider dp = getContext().getDataProvider();
    TransactionProvider tp = getContext().getTransactionProvider();

    // Create a SingleSelectionTemplate.
    // Get the MdmMeasure for the measure.
    MdmMeasure mdmUnits = getMdmMeasure("UNITS_AW");

    // Get the Source for the measure.
    Source units = mdmUnits.getSource();

    // Get the MdmPrimaryDimension objects for the dimensions of the measure.
    MdmPrimaryDimension mdmCustDim = getMdmPrimaryDimension("CUSTOMER_AW");
    MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
    MdmPrimaryDimension mdmChanDim = getMdmPrimaryDimension("CHANNEL_AW");
    MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");

    // Get the default hierarchy of the Product dimension.
    MdmHierarchy mdmProdHier = mdmProdDim.getDefaultHierarchy();

    // Get the StringSource for the hierarchy.
    StringSource prodHier = (StringSource) mdmProdHier.getSource();

    // Create a SingleSelectionTemplate to produce a Source that
    // represents the measure values specified by single members of each of
    // the dimensions of the measure other than the base dimension.
    SingleSelectionTemplate singleSelections =
                                     new SingleSelectionTemplate(units, dp);

    // Create MdmDimensionMemberInfo objects for single members of the
    // other dimensions of the measure.
    MdmDimensionMemberInfo timeMemInfo =
                new MdmDimensionMemberInfo(mdmTimeDim,
                                           "CALENDAR_YEAR_AW::YEAR_AW::4");
    MdmDimensionMemberInfo custMemInfo =
                new MdmDimensionMemberInfo(mdmCustDim,
                                           "SHIPMENTS_AW::REGION_AW::8");
    MdmDimensionMemberInfo chanMemInfo =
             new MdmDimensionMemberInfo(mdmChanDim,
                                        "CHANNEL_PRIMARY_AW::CHANNEL_AW::2");

    // Add the dimension member information objects to the
    // SingleSelectionTemplate.
    singleSelections.addDimMemberInfo(custMemInfo);
    singleSelections.addDimMemberInfo(chanMemInfo);
    singleSelections.addDimMemberInfo(timeMemInfo);

    println("Rolling Back a Transaction");

    // ***** Beginning of the Rolling Back a Transaction example *****
    // The current Transaction is a read Transaction, t1.
    // Create a TopBottomTemplate using a hierarchy of the Product dimension
    // as the base and dp as the DataProvider.
    TopBottomTemplate topNBottom = new TopBottomTemplate(prodHier, dp);

    // Changing the state of a Template requires a write Transaction, so a
    // write child Transaction, t2, is automatically started.
    topNBottom.setTopBottomType(TopBottomTemplate.TOP_BOTTOM_TYPE_TOP);
    topNBottom.setN(10);
    topNBottom.setCriterion(singleSelections.getSource());

    // Prepare and commit the Transaction t2.
    try
    {
      tp.prepareCurrentTransaction();
    }
    catch(NotCommittableException e)
    {
      println("Cannot commit the Transaction. " + e);
    }
    tp.commitCurrentTransaction();           //t2 disappears

    // The current Transaction is now t1.
    // Get the dynamic Source produced by the TopBottomTemplate.
    Source result = topNBottom.getSource();

    // Create a Cursor and display the results.
    println("\nThe current state of the TopBottomTemplate " +
            "\nproduces the following values:\n");
    getContext().displayTopBottomResult(result);

    // Start a child Transaction, t3. It is a read Transaction.
    tp.beginSubtransaction()// t3 is the current Transaction.

    // Change the state of topNBottom. Changing the state requires a
    // write Transaction so Transaction t4 starts automatically,
    topNBottom.setTopBottomType(TopBottomTemplate.TOP_BOTTOM_TYPE_BOTTOM);
    topNBottom.setN(15);

    // Prepare and commit the Transaction.
    // The following method of the superclass ContextExample calls the
    // prepareCurrentTransaction and commitCurrentTransaction methods of
    // the current Transaction.
    prepareAndCommit();        // t4 disappears

    // Create a Cursor and display the results; t3 is the current Transaction.
    println("\nIn the child Transaction, the state of the " +
            "\nTopBottomTemplate produces the following values:\n");
    getContext().displayTopBottomResult(result);

    // The displayTopBottomResult method closes the CursorManager for the
    // Cursor created in t3.

    // Undo t3, which discards the state of topNBottom that was set in t4.
    tp.rollbackCurrentTransaction(); // t3 disappears

    // Transaction t1 is now the current Transaction and the state of
    // topNBottom is the one defined in t2.

    // To show the current state of the TopNBottom template Source,
    // prepare and commit the Transaction, create a Cursor, and display
    // its values.
    prepareAndCommit();

    println("\nAfter rolling back the child Transaction, the state of"
            + "\nthe TopBottomTemplate produces the following values:\n");
    getContext().displayTopBottomResult(result);

    // ***** End of the Rolling Back a Transaction example *****


    println("\nUsing Child Transaction Objects");

    // ***** Beginning of the Using Child Transaction Objects example *****

    // The parent Transaction is the current Transaction at this point.
    // Save the parent read Transaction as parentT1.
    Transaction parentT1 = getCurrentTransaction();

    // Get the dynamic Source produced by the TopBottomTemplate.
    // The next line from this example is commented out because the
    // result object was created by the previous example.
    //Source result = topNBottom.getSource();

    // Create a Cursor and display the results.
    println("\nThe current state of the TopBottomTemplate" +
            "\nproduces following values:\n");
    getContext().displayTopBottomResult(result);

    // Begin a child Transaction of parentT1.
    tp.beginSubtransaction()// This is a read Transaction.

    // Save the child read Transaction as childT2.
    Transaction childT2 = tp.getCurrentTransaction();

    // Change the state of the TopBottomTemplate. This starts a
    // write Transaction, a child of the read Transaction childT2.
    topNBottom.setN(12);
    topNBottom.setTopBottomType(TopBottomTemplate.TOP_BOTTOM_TYPE_BOTTOM);

    // Save the child write Transaction as writeT3.
    Transaction writeT3 = tp.getCurrentTransaction();

    // Prepare and commit the write Transaction writeT3.
    prepareAndCommit();

    // The commit moves the changes made in writeT3 into its parent,
    // the read Transaction childT2. The writeT3 Transaction
    // disappears. The current Transaction is now childT2
    // again but the state of the TopBottomTemplate has changed.

    // Create a Cursor and display the results of the changes to the
    // TopBottomTemplate that are visible in childT2.
    try
    {
      println("\nIn the child Transaction, the state of the " +
              "\nTopBottomTemplate produces the following values:\n");
      getContext().displayTopBottomResult(result);
    }
    catch(Exception e)
    {
      println("Cannot display the results of the query. " + e);
    }

    // Begin a grandchild Transaction of the initial parent.
    tp.beginSubtransaction()// This is a read Transaction.

    // Save the grandchild read Transaction as grandchildT4.
    Transaction grandchildT4 = tp.getCurrentTransaction();

    // Change the state of the TopBottomTemplate. This starts another
    // write Transaction, a child of grandchildT4.
    topNBottom.setTopBottomType(TopBottomTemplate.TOP_BOTTOM_TYPE_TOP);

    // Save the write Transaction as writeT5.
    Transaction writeT5 = tp.getCurrentTransaction();

    // Prepare and commit writeT5.
    prepareAndCommit();

    // Transaction grandchildT4 is now the current Transaction and the
View Full Code Here

Examples of org.jboss.arquillian.transaction.spi.provider.TransactionProvider

     *
     * @param beforeTest the test event
     */
    public void startTransactionBeforeTest(@Observes(precedence = 10) Before beforeTest) {

        TransactionProvider transactionProvider;

        if (isTransactionEnabled(beforeTest)) {

            TransactionMode transactionMode = getTransactionMode(beforeTest);

            if (transactionMode != TransactionMode.DISABLED) {
                transactionProvider = getTransactionProvider();

                // creates the transaction context
                TransactionContext transactionContext = transactionContextInstance.get();
                transactionContext.activate();

                lifecycleEvent.fire(new BeforeTransactionStarted());

                transactionProvider.beginTransaction(new TransactionalTestImpl(getTransactionManager(beforeTest)));

                lifecycleEvent.fire(new AfterTransactionStarted());
            }
        }
    }
View Full Code Here

Examples of org.jboss.arquillian.transaction.spi.provider.TransactionProvider

     *
     * @param afterTest the test event
     */
    public void endTransactionAfterTest(@Observes(precedence = 50) After afterTest) {

        TransactionProvider transactionProvider;

        if (isTransactionEnabled(afterTest)) {

            // retrieves the transaction mode, declared for the test method
            TransactionMode transactionMode = getTransactionMode(afterTest);

            if (transactionMode != TransactionMode.DISABLED) {
                try {
                    lifecycleEvent.fire(new BeforeTransactionEnded());

                    transactionProvider = getTransactionProvider();

                    TransactionalTest transactionalTest =
                            new TransactionalTestImpl(getTransactionManager(afterTest));

                    if (transactionMode == TransactionMode.ROLLBACK || isTestRequiresRollback()) {
                        // rollbacks the transaction
                        transactionProvider.rollbackTransaction(transactionalTest);
                    } else {
                        // commits the transaction
                        transactionProvider.commitTransaction(transactionalTest);
                    }

                } finally {
                    lifecycleEvent.fire(new AfterTransactionEnded());

View Full Code Here

Examples of org.jboss.arquillian.transaction.spi.provider.TransactionProvider

    private TransactionProvider getTransactionProvider() {

        try {
            ServiceLoader serviceLoader = serviceLoaderInstance.get();

            TransactionProvider transactionProvider = serviceLoader.onlyOne(TransactionProvider.class);

            if (transactionProvider == null) {
                throw new TransactionProviderNotFoundException(
                        "Transaction provider for given test case has not been found.");
            }
View Full Code Here

Examples of org.jboss.arquillian.transaction.spi.provider.TransactionProvider

      {
         try
         {
            lifecycleEvent.fire(new BeforeTransactionEnded());

            final TransactionProvider transactionProvider = getTransactionProvider();
            final TransactionalTest transactionalTest = new TransactionalTestImpl(getTransactionManager(afterTest));

            if (rollbackRequired(afterTest))
            {
               transactionProvider.rollbackTransaction(transactionalTest);
            }
            else
            {
               transactionProvider.commitTransaction(transactionalTest);
            }
         }
         finally
         {
            lifecycleEvent.fire(new AfterTransactionEnded());
View Full Code Here

Examples of org.jboss.arquillian.transaction.spi.provider.TransactionProvider

    */
   private TransactionProvider getTransactionProvider()
   {
      try
      {
         final TransactionProvider transactionProvider = serviceLoaderInstance.get().onlyOne(TransactionProvider.class);
         if (transactionProvider == null)
         {
            throw new TransactionProviderNotFoundException("Transaction provider for given test case has not been found.");
         }
         return transactionProvider;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.