missing java doc comments or could not find the source file.
Inheritance: Simpl.Serialization.ElementState
Example #1
0
        ///<summary>
        ///handle semantic actions other than FOR and IF.
        ///</summary>
        public void HandleGeneralOperation(SemanticOperation operation)
        {
            // get the object on which the action has to be taken
            String objectName = operation.ObjectStr;

            if (objectName == null)
            {
                objectName = SemanticOperationKeyWords.Metadata;
            }
            Object obj = semanticOperationVariableMap.Get(objectName);

            try
            {
                Object returnValue = null;
                returnValue = operation.Perform(obj);
                if (requestWaiting)
                {
                    return;
                }
                if (operation.Name != null && returnValue != null)
                {
                    semanticOperationVariableMap.Put(operation.Name, returnValue);
                }
            }
            catch (Exception e)
            {
                if (e is SemanticOperationExecutionException)
                {
                    throw e;
                }
                throw new SemanticOperationExecutionException(e, operation, semanticOperationVariableMap);
            }
        }
 public void HandleError(SemanticOperation action, String errorCode,
     Type objectClass, String objectName)
 {
     // Print Error For NULL Method
     if(NullMethodError.Equals(errorCode))
     {
         Debug.WriteLine("");
     }
 }
Example #3
0
 public void HandleError(SemanticOperation action, String errorCode,
                         Type objectClass, String objectName)
 {
     // Print Error For NULL Method
     if (NullMethodError.Equals(errorCode))
     {
         Debug.WriteLine("");
     }
 }
 public SemanticOperationExecutionException(SemanticOperation operation, String message)
     : this(operation)
 {
     Debug.WriteLine(message);
     SemanticOperationHandler semanticOperationHandler = operation.SemanticOperationHandler;
     if (semanticOperationHandler != null)
     {
         StackTrace(semanticOperationHandler.SemanticOperationVariableMap);
     }
 }
Example #5
0
        public void SetOperationState <T>(SemanticOperation action, String name, T value)
        {
            if (!operationStates.ContainsKey(action))
            {
                operationStates.Add(action, new Dictionary <string, object>());
            }
            Dictionary <String, Object> states = operationStates[action];

            if (states.ContainsKey(name))
            {
                states.Remove(name);
            }
            states.Add(name, value);
        }
Example #6
0
 public T GetOperationState <T>(SemanticOperation operation, String name, T defaultValue)
 {
     if (operationStates.ContainsKey(operation))
     {
         Dictionary <String, Object> states = operationStates[operation];
         Object state;
         states.TryGetValue(name, out state);
         if (state != null)
         {
             return((T)state);
         }
     }
     return(defaultValue);
 }
Example #7
0
        public SemanticOperationHandler GetSemanticOperationHandler()
        {
            SemanticOperationHandler result = this.semanticOperationHandler;

            if (result == null)
            {
                ElementState parentES = Parent;
                if (parentES != null && parentES is SemanticOperation)
                {
                    SemanticOperation parent = (SemanticOperation)parentES;
                    result = parent.GetSemanticOperationHandler();
                    this.semanticOperationHandler = result;
                }
            }
            return(result);
        }
        public SemanticOperationExecutionException(Exception e, SemanticOperation operation,
            Scope<Object> semanticActionReturnValueMap)
            : this(operation)
        {
            StringBuilder buffy = new StringBuilder(); //edit StringBuilderUtils.acquire();
            buffy.Append("Action Object:: ").Append(operation.ObjectStr)
                    .Append("  :: is NULL or DOES NOT EXIST\n");
            buffy.Append("Action ReturnValue:: ").Append(operation.Name)
                    .Append(" ::  is NULL or DOES NOT EXIST FOR SPECIFIED OBJECT");

            String errorMessage = buffy.ToString();
            //StringBuilderUtils.release(buffy);
            Debug.WriteLine(errorMessage);
            StackTrace(semanticActionReturnValueMap);
            //System.out.println("######## POSSIBLE CAUSE:");
            //e.printStackTrace();
            Debug.WriteLine("############################################################################################");
        }
Example #9
0
        ///<summary>
        /// This function checks for the pre-condition flag values for this action and returns the "anded"
        /// result.
        ///
        /// @param action
        /// @return true if conditions are satisfied; false otherwise.
        ///</summary>
        public bool CheckConditionsIfAny(SemanticOperation operation)
        {
            List <Condition> conditions = operation.Checks;

            if (conditions != null)
            {
                // loop over all the flags to be checked
                foreach (Condition condition in conditions)
                {
                    bool flag = condition.Evaluate(this);
                    if (!flag)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #10
0
        public void TakeSemanticOperations(MetaMetadata metaMetadata, Metadata metadata, List <SemanticOperation> semanticActions)
        {
            if (semanticActions == null)
            {
                Debug.WriteLine("warning: no semantic actions exist");
                return;
            }

            if (requestWaiting)
            {
                requestWaiting = false;
            }
            else
            {
                this.metaMetadata = metaMetadata;
                this.metadata     = metadata;

                //FIXME -- should not have SemanticOperationsKeyWords && SemanticOperationsNamedArguments as separate sets !!!
                semanticOperationVariableMap.Put(DocumentType, documentParser);
                semanticOperationVariableMap.Put(SemanticOperationKeyWords.Metadata, metadata);
//edit			    semanticOperationVariableMap.Add(TRUE_PURL, documentParser.getTruePURL());

                PreSemanticOperationsHook(metadata);
            }
            for (int i = 0; i < semanticActions.Count; i++)
            {
                SemanticOperation action = semanticActions[i];
                HandleSemanticOperation(action, documentParser, semanticsScope);
                if (requestWaiting)
                {
                    return;
                }
            }
            PostSemanticOperationsHook(metadata);

            Recycle();
        }
 public SemanticOperationExecutionException(SemanticOperation action)
 {
     Debug.WriteLine("\n########################### ERROR " + action.GetOperationName()
             + " FAILED ###########################");
     //Console.WriteLine(ERROR_STRING);
 }
 /**
  * Handles the semantic action
  * @param action
  */
 public void HandleError(SemanticOperation action)
 {
     action.HandleError();
 }
Example #13
0
 /**
  * Handles the semantic action
  * @param action
  */
 public void HandleError(SemanticOperation action)
 {
     action.HandleError();
 }
Example #14
0
        /**
         * main entry to handle semantic operations. FOR loops and IFs are handled directly (they have built-
         * in semantics and are not overridable). otherwise it will can the perform() method on the operation
         * object.
         *
         * @param action
         * @param parser
         * @param infoCollector
         */
        public void HandleSemanticOperation(SemanticOperation operation, DocumentParser parser, SemanticsGlobalScope infoCollector)
        {
            int state = GetOperationState(operation, "state", SemanticOperation.INIT);

            if (state == SemanticOperation.FIN || requestWaiting)
            {
                return;
            }
            //		debug("["+parser+"] semantic operation: " + action.getActionName() + ", SA class: " + action.getClassSimpleName() + "\n");

            operation.SemanticOperationHandler = this;

            // here state must be INTER or INIT

            // if state == INIT, we check pre-conditions
            // if state == INTER, because this must have been started, we skip checking pre-conditions
            if (state == SemanticOperation.INIT)
            {
                if (!CheckConditionsIfAny(operation))
                {
                    if (!(operation is IfSemanticOperation))
                    {
                        Debug.WriteLine("Semantic operation {0} not taken since (some) pre-requisite conditions are not met", operation);
                    }
                    return;
                }
            }
            else
            {
                Debug.WriteLine("re-entering operations with pre-conditions; checking pre-conditions skipped: " + operation.GetOperationName());
            }

            operation.SessionScope             = infoCollector;
            operation.SemanticOperationHandler = this;
            operation.DocumentParser           = parser;

            String operationName = operation.GetOperationName();

            try
            {
                if (SemanticOperationStandardMethods.ForEach.Equals(operationName))
                {
                    HandleForLoop((ForEachSemanticOperation)operation, parser, infoCollector);
                }
                else if (SemanticOperationStandardMethods.If.Equals(operationName))
                {
                    HandleIf((IfSemanticOperation)operation, parser, infoCollector);
                }
                else
                {
                    HandleGeneralOperation(operation);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("The action " + operationName
                                + " could not be executed. Please see the stack trace for errors.");
            }
            finally
            {
                if (!requestWaiting)
                {
                    SetOperationState(operation, "state", SemanticOperation.FIN);
                }
            }
        }