/// <summary>
 /// Instantiates a <see cref="FimsAwsWorkerService"/>
 /// </summary>
 /// <param name="scope"></param>
 /// <param name="logger"></param>
 /// <param name="worker"></param>
 /// <param name="resourceSerializer"></param>
 public FimsAwsWorkerService(IDisposable scope, ILogger logger, IWorker worker, IResourceSerializer resourceSerializer)
 {
     Scope = scope;
     Logger = logger;
     Worker = worker;
     ResourceSerializer = resourceSerializer;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Instantiates a <see cref="DefaultRequestHandler"/>
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="resourceDescriptorHelper"></param>
 /// <param name="resourceHandlerRegistry"></param>
 /// <param name="resourceSerializer"></param>
 public DefaultRequestHandler(ILogger logger,
                              IResourceDescriptorHelper resourceDescriptorHelper,
                              IResourceHandlerRegistry resourceHandlerRegistry,
                              IResourceSerializer resourceSerializer)
 {
     Logger = logger;
     ResourceDescriptorHelper = resourceDescriptorHelper;
     ResourceHandlerRegistry  = resourceHandlerRegistry;
     ResourceSerializer       = resourceSerializer;
 }
        /// <summary>
        /// Instantiates a <see cref="LambdaWorkerFunctionInvoker"/>
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="resourceSerializer"></param>
        /// <param name="options"></param>
        public LambdaWorkerFunctionInvoker(ILogger logger, IResourceSerializer resourceSerializer, IOptions <LambdaOptions> options)
        {
            Logger             = logger;
            ResourceSerializer = resourceSerializer;

            // create client using credentials, if provided
            var region = options.Value?.RegionEndpoint;
            var creds  = options.Value?.Credentials;

            Lambda = creds != null ? new AmazonLambdaClient(creds, region) : new AmazonLambdaClient();
        }
Exemplo n.º 4
0
        private int AddLinkedResources(TreeNode treeNode, IResource selectedResource, int linkID, LinkNode linkNode)
        {
            bool          directed  = _resourceStore.PropTypes [linkID].HasFlag(PropTypeFlags.DirectedLink);
            IResourceList resources = null;

            if (directed)
            {
                if (linkID < 0)
                {
                    resources = selectedResource.GetLinksTo(null, -linkID);
                }
                else
                {
                    resources = selectedResource.GetLinksFrom(null, linkID);
                }
            }
            else
            {
                resources = selectedResource.GetLinksOfType(null, linkID);
            }

            int count = 0;

            foreach (IResource resource in resources)
            {
                if (IsSerializerExists(resource))
                {
                    int iconIndex = GetIcon(resource);
                    Tracer._Trace(resource.DisplayName);
                    TreeNode            treeSubNode  = new TreeNode(GetTypeDisplayName(resource.Type) + ": " + resource.DisplayName, iconIndex, iconIndex);
                    ResourceNode        resourceNode = linkNode.AddResource(resource);
                    IPropertyCollection properties   = resourceNode.Resource.Properties;
                    foreach (IResourceProperty property in properties)
                    {
                        if (property.DataType != PropDataType.Link)
                        {
                            IResourceSerializer serializer = Core.PluginLoader.GetResourceSerializer(resourceNode.Resource.Type);
                            SerializationMode   serMode    = GetSerializationMode(serializer, resourceNode.Resource, property);
                            if (serMode == SerializationMode.NoSerialize)
                            {
                                continue;
                            }
                            resourceNode.AddProperty(property);
                        }
                    }

                    treeSubNode.Tag = new SerializableTag(resourceNode, SerializableTag.Type.LinkedResource);
                    treeNode.Nodes.Add(treeSubNode);
                    _resourceTreeView.SetNodeCheckState(treeSubNode, NodeCheckState.Checked);
                    count++;
                }
            }
            return(count);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Instantiates a <see cref="MediaInfoWorker"/>
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="dataHandler"></param>
 /// <param name="accessibleLocationProvider"></param>
 /// <param name="processRunner"></param>
 /// <param name="mediaInfoOutputConverter"></param>
 /// <param name="fileStorage"></param>
 /// <param name="resourceSerializer"></param>
 /// <param name="processLocator"></param>
 public MediaInfoWorker(ILogger logger,
                        IResourceDataHandler dataHandler,
                        IMediaInfoAccessibleLocationProvider accessibleLocationProvider,
                        IProcessRunner processRunner,
                        IMediaInfoOutputConverter mediaInfoOutputConverter,
                        IFileStorage fileStorage,
                        IResourceSerializer resourceSerializer,
                        IMediaInfoProcessLocator processLocator)
     : base(dataHandler)
 {
     Logger = logger;
     AccessibleLocationProvider = accessibleLocationProvider;
     ProcessRunner            = processRunner;
     MediaInfoOutputConverter = mediaInfoOutputConverter;
     FileStorage        = fileStorage;
     ResourceSerializer = resourceSerializer;
     ProcessLocator     = processLocator;
 }
Exemplo n.º 6
0
        public void GenerateXML(XmlDocument document, XmlNode parent)
        {
            if (!AcceptSending)
            {
                return;
            }
            XmlNode resNode = document.CreateElement("Resource");

            LoadProperies(document, resNode);
            LoadLinks(document, resNode);

            IResourceSerializer serializer = ICore.Instance.PluginLoader.GetResourceSerializer(_resource.Type);

            if (serializer != null)
            {
                serializer.AfterSerialize(_parentResource, _resource, resNode);
            }

            parent.AppendChild(resNode);
        }
Exemplo n.º 7
0
        private void AddProperties(TreeNode treeNode, ResourceNode resourceNode)
        {
            IResourceSerializer serializer = Core.PluginLoader.GetResourceSerializer(resourceNode.Resource.Type);

            if (serializer == null)
            {
                return;
            }

            IPropertyCollection properties = resourceNode.Resource.Properties;

            foreach (IResourceProperty property in properties)
            {
                SerializationMode serMode = GetSerializationMode(serializer, resourceNode.Resource, property);
                if (serMode == SerializationMode.NoSerialize)
                {
                    continue;
                }

                if (property.DataType == PropDataType.Link)
                {
                    if (serMode == SerializationMode.Serialize || serMode == SerializationMode.AskSerialize)
                    {
                        AddLink(resourceNode, property, treeNode);
                    }
                }
                else
                {
                    if (serMode == SerializationMode.AskSerialize)
                    {
                        AddProperty(resourceNode, property, treeNode);
                    }
                    else
                    {
                        resourceNode.AddProperty(property);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public void AcceptReceiving()
        {
            if (!_valid)
            {
                return;
            }
            IResourceSerializer serializer      = Core.PluginLoader.GetResourceSerializer(_resource.Type);
            IResource           matchedResource = null;

            if (serializer != null)
            {
                IResource parentResource = _resource;
                if (_linkUnpack != null)
                {
                    parentResource = _linkUnpack.ParentResource;
                }
                matchedResource = serializer.AfterDeserialize(parentResource, _resource, _xmlNode);
            }

            if (matchedResource == null || matchedResource.Id == _resource.Id)
            {
                _resource.EndUpdate();
            }
            if (matchedResource != null)
            {
                _resource = matchedResource;
            }
            if (_linkUnpack != null)
            {
                //  In the case of directed link, this is the proper linkage,
                //  in the case of indirected one the actual order is insignificant
                _resource.AddLink(_linkUnpack.InternalName, _linkUnpack.ParentResource);
            }
            Core.WorkspaceManager.AddToActiveWorkspace(_resource);
            if (Core.TextIndexManager != null && Core.ResourceStore.ResourceTypes[_resource.Type].Flags != ResourceTypeFlags.NoIndex)
            {
                Core.TextIndexManager.QueryIndexing(_resource.Id);
            }
        }
Exemplo n.º 9
0
        private SerializationMode GetSerializationMode(IResourceSerializer serializer, IResource resource, IResourceProperty property)
        {
            SerializationMode serMode = serializer.GetSerializationMode(resource, property.Name);

            if (serMode == SerializationMode.Default)
            {
                IPropType propType = Core.ResourceStore.PropTypes [property.Name];
                if (propType.HasFlag(PropTypeFlags.AskSerialize))
                {
                    return(SerializationMode.AskSerialize);
                }
                if (propType.HasFlag(PropTypeFlags.NoSerialize))
                {
                    return(SerializationMode.NoSerialize);
                }
                if (property.DataType == PropDataType.Link && propType.HasFlag(PropTypeFlags.Internal))
                {
                    return(SerializationMode.NoSerialize);
                }
                return(SerializationMode.Serialize);
            }
            return(serMode);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Instantiates an <see cref="AzureFunctionWorkerInvoker"/>
 /// </summary>
 /// <param name="resourceSerializer"></param>
 public AzureFunctionWorkerInvoker(IResourceSerializer resourceSerializer)
 {
     ResourceSerializer = resourceSerializer;
 }
 public void SetUp()
 {
     serializer = new AtomPlusXmlSerializer();
 }
Exemplo n.º 12
0
 /// <summary>
 /// Instantiates a <see cref="HttpResourceDataHandler"/>
 /// </summary>
 /// <param name="environment"></param>
 /// <param name="resourceSerializer"></param>
 public HttpResourceDataHandler(IEnvironment environment, IResourceSerializer resourceSerializer)
 {
     Environment        = environment;
     ResourceSerializer = resourceSerializer;
 }
Exemplo n.º 13
0
 public void SetUp()
 {
     serializer = new JsonSerializer();
 }
 public RestfulieMarshaller(IRelationsFactory relationsFactory, IResourceSerializer serializer, IHypermediaInjector hypermedia)
 {
     this.relationsFactory = relationsFactory;
     this.serializer = serializer;
     this.hypermedia = hypermedia;
 }
Exemplo n.º 15
0
 public void SetUp()
 {
     serializer = new XmlSerializer();
 }
Exemplo n.º 16
0
 /// <summary>
 /// Deserializes a response body to a single resource
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="serializer"></param>
 /// <param name="response"></param>
 /// <returns></returns>
 public static async Task <T> DeserializeResponseBodyToResource <T>(this IResourceSerializer serializer, HttpResponseMessage response)
     where T : Resource, new()
 {
     return(await serializer.Deserialize <T>(await response.Content.ReadAsStringAsync()));
 }
Exemplo n.º 17
0
 public RestfulieMarshaller(IRelationsFactory relationsFactory, IResourceSerializer serializer, IHypermediaInjector hypermedia)
 {
     this.relationsFactory = relationsFactory;
     this.serializer       = serializer;
     this.hypermedia       = hypermedia;
 }
Exemplo n.º 18
0
 public JsonApiOutputFormatter(IResourceSerializer serializer = null)
 {
     _serializer = serializer ?? new ResourceSerializer();
 }
Exemplo n.º 19
0
 /// <summary>
 /// Instantiates an <see cref="AzureFunctionWorkerInvoker"/>
 /// </summary>
 /// <param name="resourceSerializer"></param>
 /// <param name="environment"></param>
 public AzureFunctionWorkerInvoker(IResourceSerializer resourceSerializer, IEnvironment environment)
 {
     ResourceSerializer = resourceSerializer;
     Environment        = environment;
 }
 public void SetUp()
 {
     serializer = new JsonSerializer();   
 }
 public void SetUp()
 {
     serializer = new AtomPlusXmlSerializer();
 }
Exemplo n.º 22
0
 public Driver(IResourceSerializer serializer, IHypermediaInjector injector, IResourceDeserializer deserializer)
 {
     Serializer = serializer;
     HypermediaInjector = injector;
     Deserializer = deserializer;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Instantiates a <see cref="FimsAzureWorker"/>
 /// </summary>
 /// <param name="worker"></param>
 /// <param name="resourceSerializer"></param>
 public FimsAzureWorker(IWorker worker, IResourceSerializer resourceSerializer)
 {
     Worker             = worker;
     ResourceSerializer = resourceSerializer;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Deserializes a response body to a single resource
 /// </summary>
 /// <param name="serializer"></param>
 /// <param name="type"></param>
 /// <param name="response"></param>
 /// <returns></returns>
 public static async Task <Resource> DeserializeResponseBodyToResource(this IResourceSerializer serializer, Type type, HttpResponseMessage response)
 {
     return(await serializer.Deserialize(await response.Content.ReadAsStringAsync()));
 }
Exemplo n.º 25
0
 public Driver(IResourceSerializer serializer, IHypermediaInjector injector, IResourceDeserializer deserializer)
 {
     Serializer         = serializer;
     HypermediaInjector = injector;
     Deserializer       = deserializer;
 }
Exemplo n.º 26
0
 /// <summary>
 /// Deserializes a response body to a collection of resources
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="serializer"></param>
 /// <param name="response"></param>
 /// <returns></returns>
 public static async Task <IEnumerable <T> > DeserializeResponseBodyToResourceCollection <T>(this IResourceSerializer serializer, HttpResponseMessage response)
     where T : Resource, new()
 {
     return(await Task.WhenAll(JArray.Parse(await response.Content.ReadAsStringAsync()).Select(t => serializer.Deserialize <T>(t.ToString()))));
 }
Exemplo n.º 27
0
Arquivo: Plugins.cs Projeto: mo5h/omeo
 public void RegisterResourceSerializer(string resType, IResourceSerializer serializer)
 {
     _resourceSerializers[resType] = serializer;
 }
 public JsonApiOutputFormatter(IResourceSerializer serializer = null)
 {
     _serializer = serializer ?? new ResourceSerializer();
 }
Exemplo n.º 29
0
 /// <summary>
 /// Instantiates a <see cref="McmaAzureWorker"/>
 /// </summary>
 /// <param name="worker"></param>
 /// <param name="resourceSerializer"></param>
 /// <param name="environment"></param>
 public McmaAzureWorker(IWorker worker, IResourceSerializer resourceSerializer, IEnvironment environment)
 {
     Worker             = worker;
     ResourceSerializer = resourceSerializer;
     Environment        = environment;
 }
Exemplo n.º 30
0
 public void SetUp()
 {
     serializer = new XmlSerializer();   
 }
Exemplo n.º 31
0
 public void AddSerializer(string fileExtension, IResourceSerializer serializer)
 {
     serializers[fileExtension] = serializer;
 }