Examples of Undoable


Examples of net.sf.rej.gui.Undoable

      ClassInfo ci = (ClassInfo)cpi;
      JavaType jt = new JavaType(ci.getName());
      String newClassName = this.advisor.newClassNameFor(jt.getType());
      if(newClassName != null) {
        this.oldClassNames.put(newClassName, jt.getType());
        Undoable u = new ModifyClassInfoAction(ic.getCf().getPool(), ci, newClassName + jt.getDimensions());
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());
        }
      }
    } if(cpi.getType() == ConstantPoolInfo.NAME_AND_TYPE) {
      NameAndTypeInfo nati = (NameAndTypeInfo)cpi;
      Descriptor desc = nati.getDescriptor();
      JavaType ret = desc.getReturn();
      boolean match = false;
      String newClassName = this.advisor.newClassNameFor(ret.getType());
      if (newClassName != null) {
        this.oldClassNames.put(newClassName, ret.getType());
        match = true;
        desc.setReturn(new JavaType(newClassName, ret.getDimensionCount()));
      }
     
      List params = desc.getParamList();
      List<JavaType> newParams = new ArrayList<JavaType>();
      for (int i=0; i < params.size(); i++) {
        JavaType param = (JavaType)params.get(i);
        newClassName = this.advisor.newClassNameFor(param.getType());
        if (newClassName != null) {
          this.oldClassNames.put(newClassName, param.getType());
          match = true;
          newParams.add(new JavaType(newClassName, param.getDimensionCount()));
        } else {
          newParams.add(param);
        }
      }
     
      if (match) {
        desc.setParamList(newParams);
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, desc);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());
        }
      }
    } if(cpi.getType() == ConstantPoolInfo.FIELD_REF) {
      RefInfo ri = (RefInfo)cpi;
      String className = ri.getClassName();
      String newFieldName = this.advisor.newFieldNameFor(className, ri.getTargetName(), ri.getDescriptor());
      if (newFieldName != null) {
        NameAndTypeInfo nati = ri.getNameAndTypeInfo();
       
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, newFieldName);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());         
        }
      }
    } else if(cpi.getType() == ConstantPoolInfo.METHOD_REF || cpi.getType() == ConstantPoolInfo.INTERFACE_METHOD_REF) {
      RefInfo ri = (RefInfo)cpi;
      String className = ri.getClassName();
      String newMethodName = this.advisor.newMethodNameFor(className, ri.getTargetName(), ri.getDescriptor());
      if (newMethodName != null) {
        NameAndTypeInfo nati = ri.getNameAndTypeInfo();
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, newMethodName);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());         
        }
      }
    }
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

    int clrskipped    = 0;
    int logrecordseen = 0;

    StreamLogScan scanLog;
    Compensation  compensation = null;
    Undoable      lop          = null;

    // stream to read the log record - initial size 4096, scanLog needs
    // to resize if the log record is larget than that.
    ArrayInputStream    rawInput   = null;

    try
    {
      if (undoStartAt == null
            {
                // don't know where to start, rollback from end of log

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStopAt);
            }
      else
      {
        if (undoStartAt.lessThan(undoStopAt))
                {
                    // nothing to undo!
          return;
                }

        long undoStartInstant =
                    ((LogCounter) undoStartAt).getValueAsLong();

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStartInstant, undoStopAt);
      }

      if (SanityManager.DEBUG)
        SanityManager.ASSERT(
                    scanLog != null, "cannot open log for undo");

      rawInput   = new ArrayInputStream(new byte[4096]);

      LogRecord record;

      while ((record =
                    scanLog.getNextRecord(rawInput, undoId, 0))
                        != null)
      {
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(
                        record.getTransactionId().equals(undoId),
                        "getNextRecord return unqualified log record for undo");
        }

        logrecordseen++;

        if (record.isCLR())
        {
          clrskipped++;

                    // the loggable is still in the input stream, get rid of it
          record.skipLoggable();

          // read the undoInstant
          long undoInstant = rawInput.readLong();

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Skipping over CLRs, reset scan to " +
                                LogCounter.toDebugString(undoInstant));
                        }
                    }


          scanLog.resetPosition(new LogCounter(undoInstant));

          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it

          continue;
        }

        lop = record.getUndoable();

        if (lop != null)
        {
          int optionalDataLength = rawInput.readInt();
          int savePosition = rawInput.getPosition();
          rawInput.setLimit(savePosition, optionalDataLength);
 
          compensation = lop.generateUndo(t, rawInput);

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

                        // has no optional data and has no use for them anymore
            logIn.clearLimit();
            LogRecord undoRecord =
              undoScan.getNextRecord(logIn, null, 0);

            Undoable undoOp = undoRecord.getUndoable();

            if (SanityManager.DEBUG)
            {
              SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

    int clrskipped    = 0;
    int logrecordseen = 0;

    StreamLogScan scanLog;
    Compensation  compensation = null;
    Undoable      lop          = null;

    // stream to read the log record - initial size 4096, scanLog needs
    // to resize if the log record is larget than that.
    ArrayInputStream    rawInput   = null;

    try
    {
      if (undoStartAt == null
            {
                // don't know where to start, rollback from end of log

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStopAt);
            }
      else
      {
        if (undoStartAt.lessThan(undoStopAt))
                {
                    // nothing to undo!
          return;
                }

        long undoStartInstant =
                    ((LogCounter) undoStartAt).getValueAsLong();

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStartInstant, undoStopAt);
      }

      if (SanityManager.DEBUG)
        SanityManager.ASSERT(
                    scanLog != null, "cannot open log for undo");

      rawInput   = new ArrayInputStream(new byte[4096]);

      LogRecord record;

      while ((record =
                    scanLog.getNextRecord(rawInput, undoId, 0))
                        != null)
      {
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(
                        record.getTransactionId().equals(undoId),
                        "getNextRecord return unqualified log record for undo");
        }

        logrecordseen++;

        if (record.isCLR())
        {
          clrskipped++;

                    // the loggable is still in the input stream, get rid of it
          record.skipLoggable();

          // read the undoInstant
          long undoInstant = rawInput.readLong();

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Skipping over CLRs, reset scan to " +
                                LogCounter.toDebugString(undoInstant));
                        }
                    }


          scanLog.resetPosition(new LogCounter(undoInstant));

          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it

          continue;
        }

        lop = record.getUndoable();

        if (lop != null)
        {
          int optionalDataLength = rawInput.readInt();
          int savePosition = rawInput.getPosition();
          rawInput.setLimit(optionalDataLength);
 
          compensation = lop.generateUndo(t, rawInput);

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

                        // has no optional data and has no use for them anymore
            logIn.clearLimit();
            LogRecord undoRecord =
              undoScan.getNextRecord(logIn, null, 0);

            Undoable undoOp = undoRecord.getUndoable();

            if (SanityManager.DEBUG)
            {
              SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

    int clrskipped    = 0;
    int logrecordseen = 0;

    StreamLogScan scanLog;
    Compensation  compensation = null;
    Undoable      lop          = null;

    // stream to read the log record - initial size 4096, scanLog needs
    // to resize if the log record is larget than that.
    ArrayInputStream    rawInput   = null;

    try
    {
      if (undoStartAt == null
            {
                // don't know where to start, rollback from end of log

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStopAt);
            }
      else
      {
        if (undoStartAt.lessThan(undoStopAt))
                {
                    // nothing to undo!
          return;
                }

        long undoStartInstant =
                    ((LogCounter) undoStartAt).getValueAsLong();

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStartInstant, undoStopAt);
      }

      if (SanityManager.DEBUG)
        SanityManager.ASSERT(
                    scanLog != null, "cannot open log for undo");

      rawInput   = new ArrayInputStream(new byte[4096]);

      LogRecord record;

      while ((record =
                    scanLog.getNextRecord(rawInput, undoId, 0))
                        != null)
      {
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(
                        record.getTransactionId().equals(undoId),
                        "getNextRecord return unqualified log record for undo");
        }

        logrecordseen++;

        if (record.isCLR())
        {
          clrskipped++;

                    // the loggable is still in the input stream, get rid of it
          record.skipLoggable();

          // read the undoInstant
          long undoInstant = rawInput.readLong();

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Skipping over CLRs, reset scan to " +
                                LogCounter.toDebugString(undoInstant));
                        }
                    }


          scanLog.resetPosition(new LogCounter(undoInstant));

          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it

          continue;
        }

        lop = record.getUndoable();

        if (lop != null)
        {
          int optionalDataLength = rawInput.readInt();
          int savePosition = rawInput.getPosition();
          rawInput.setLimit(optionalDataLength);
 
          compensation = lop.generateUndo(t, rawInput);

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

                        // has no optional data and has no use for them anymore
            logIn.clearLimit();
            LogRecord undoRecord =
              undoScan.getNextRecord(logIn, null, 0);

            Undoable undoOp = undoRecord.getUndoable();

            if (SanityManager.DEBUG)
            {
              SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

    int clrskipped    = 0;
    int logrecordseen = 0;

    StreamLogScan scanLog;
    Compensation  compensation = null;
    Undoable      lop          = null;

    // stream to read the log record - initial size 4096, scanLog needs
    // to resize if the log record is larget than that.
    ArrayInputStream    rawInput   = null;

    try
    {
      if (undoStartAt == null
            {
                // don't know where to start, rollback from end of log

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStopAt);
            }
      else
      {
        if (undoStartAt.lessThan(undoStopAt))
                {
                    // nothing to undo!
          return;
                }

        long undoStartInstant =
                    ((LogCounter) undoStartAt).getValueAsLong();

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStartInstant, undoStopAt);
      }

      if (SanityManager.DEBUG)
        SanityManager.ASSERT(
                    scanLog != null, "cannot open log for undo");

      rawInput   = new ArrayInputStream(new byte[4096]);

      LogRecord record;

      while ((record =
                    scanLog.getNextRecord(rawInput, undoId, 0))
                        != null)
      {
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(
                        record.getTransactionId().equals(undoId),
                        "getNextRecord return unqualified log record for undo");
        }

        logrecordseen++;

        if (record.isCLR())
        {
          clrskipped++;

                    // the loggable is still in the input stream, get rid of it
          record.skipLoggable();

          // read the undoInstant
          long undoInstant = rawInput.readLong();

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Skipping over CLRs, reset scan to " +
                                LogCounter.toDebugString(undoInstant));
                        }
                    }


          scanLog.resetPosition(new LogCounter(undoInstant));

          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it

          continue;
        }

        lop = record.getUndoable();

        if (lop != null)
        {
          int optionalDataLength = rawInput.readInt();
          int savePosition = rawInput.getPosition();
          rawInput.setLimit(savePosition, optionalDataLength);
 
          compensation = lop.generateUndo(t, rawInput);

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

                        // has no optional data and has no use for them anymore
            logIn.clearLimit();
            LogRecord undoRecord =
              undoScan.getNextRecord(logIn, null, 0);

            Undoable undoOp = undoRecord.getUndoable();

            if (SanityManager.DEBUG)
            {
              SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.Undoable

    int clrskipped    = 0;
    int logrecordseen = 0;

    StreamLogScan scanLog;
    Compensation  compensation = null;
    Undoable      lop          = null;

    // stream to read the log record - initial size 4096, scanLog needs
    // to resize if the log record is larget than that.
    ArrayInputStream    rawInput   = null;

    try
    {
      if (undoStartAt == null
            {
                // don't know where to start, rollback from end of log

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStopAt);
            }
      else
      {
        if (undoStartAt.lessThan(undoStopAt))
                {
                    // nothing to undo!
          return;
                }

        long undoStartInstant =
                    ((LogCounter) undoStartAt).getValueAsLong();

        scanLog = (StreamLogScan)
          logFactory.openBackwardsScan(undoStartInstant, undoStopAt);
      }

      if (SanityManager.DEBUG)
        SanityManager.ASSERT(
                    scanLog != null, "cannot open log for undo");

      rawInput   = new ArrayInputStream(new byte[4096]);

      LogRecord record;

      while ((record =
                    scanLog.getNextRecord(rawInput, undoId, 0))
                        != null)
      {
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(
                        record.getTransactionId().equals(undoId),
                        "getNextRecord return unqualified log record for undo");
        }

        logrecordseen++;

        if (record.isCLR())
        {
          clrskipped++;

                    // the loggable is still in the input stream, get rid of it
          record.skipLoggable();

          // read the undoInstant
          long undoInstant = rawInput.readLong();

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Skipping over CLRs, reset scan to " +
                                LogCounter.toDebugString(undoInstant));
                        }
                    }


          scanLog.resetPosition(new LogCounter(undoInstant));

          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it

          continue;
        }

        lop = record.getUndoable();

        if (lop != null)
        {
          int optionalDataLength = rawInput.readInt();
          int savePosition = rawInput.getPosition();
          rawInput.setLimit(savePosition, optionalDataLength);
 
          compensation = lop.generateUndo(t, rawInput);

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
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.