/* ========================================================================
* Copyright (c) 2005-2016 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
using System.Runtime.Serialization;
using System.Reflection;
using System.Threading;
#pragma warning disable 0618
namespace Opc.Ua.Server
{
#if LEGACY_CORENODEMANAGER
///
/// The state of a state machine.
///
[Obsolete("The MethodSource class is obsolete and is not supported. See Opc.Ua.MethodState for a replacement.")]
public class MethodSource : BaseInstanceSource, ICallable, IMethod
{
#region Constructors
///
/// Initializes the object with default values.
///
public MethodSource(IServerInternal server, NodeSource parent) : base(server, parent)
{
m_arguments = new MethodArguments();
m_callbacks = new Dictionary();
m_executable = m_userExecutable = true;
}
///
/// Creates a new instance of the node.
///
public static MethodSource Construct(
IServerInternal server,
NodeSource parent,
NodeId referenceTypeId,
NodeId nodeId,
QualifiedName browseName,
uint numericId)
{
MethodSource instance = new MethodSource(server, parent);
instance.Initialize(referenceTypeId, nodeId, browseName, numericId, null);
return instance;
}
///
/// Initializes the object with default values.
///
public MethodSource(IServerInternal server, MethodArguments arguments) : base(server, null)
{
if (arguments == null) throw new ArgumentNullException("arguments");
m_arguments = arguments;
m_callbacks = new Dictionary();
m_executable = m_userExecutable = true;
}
#endregion
#region ICloneable Members
///
public override NodeSource Clone(NodeSource parent)
{
lock (DataLock)
{
MethodSource clone = new MethodSource(Server, parent);
clone.Initialize(this);
return clone;
}
}
#endregion
#region INode Members
///
public override NodeClass NodeClass
{
get
{
return NodeClass.Method;
}
}
#endregion
#region ILocalNode Members
///
public override bool SupportsAttribute(uint attributeId)
{
lock (DataLock)
{
switch (attributeId)
{
case Attributes.Executable:
case Attributes.UserExecutable:
{
return true;
}
default:
{
return base.SupportsAttribute(attributeId);
}
}
}
}
#endregion
#region IMethod Members
///
public bool Executable
{
get
{
lock (DataLock)
{
return m_executable;
}
}
set
{
lock (DataLock)
{
m_executable = value;
}
}
}
///
public bool UserExecutable
{
get
{
lock (DataLock)
{
return m_userExecutable;
}
}
set
{
lock (DataLock)
{
m_userExecutable = value;
}
}
}
#endregion
#region ICallable Members
///
public virtual ServiceResult Call(
OperationContext context,
NodeId methodId,
object methodHandle,
NodeId objectId,
IList