Handle interaction with plugins ;)
상속: IPluginBroker
        // POST: Service/PluginSources/ValidateAssemblyImageFormat
        public string ValidateAssemblyImageFormat(string args, Guid workspaceId, Guid dataListId)
        {
            // ReSharper disable RedundantAssignment
            var toJson = @"{""validationresult"":""failure""}";
            // ReSharper restore RedundantAssignment

            var broker = new PluginBroker();

            string errorMsg;

            if(broker.ValidatePlugin(args, out errorMsg))
            {
                toJson = @"{""validationresult"":""success""}";
            }
            else
            {
                toJson = @"{""validationresult"":""" + errorMsg + @"""}";
            }

            return toJson;
        }
예제 #2
0
 // POST: Service/PluginServices/Methods
 public ServiceMethodList Methods(string args, Guid workspaceId, Guid dataListId)
 {
     var result = new ServiceMethodList();
     try
     {
         // BUG 9500 - 2013.05.31 - TWR : changed to use PluginService as args 
         var service = JsonConvert.DeserializeObject<PluginService>(args);
         var pluginSourceFromCatalog = _resourceCatalog.GetResource<PluginSource>(workspaceId, service.Source.ResourceID);
         if (pluginSourceFromCatalog == null)
         {
             try
             {
                 var xmlStr = Resources.ReadXml(workspaceId, ResourceType.PluginSource, service.Source.ResourceID.ToString());
                 if (!string.IsNullOrEmpty(xmlStr))
                 {
                     var xml = XElement.Parse(xmlStr);
                     pluginSourceFromCatalog = new PluginSource(xml);
                 }
             }
             catch(Exception)
             {
                 //ignore this
             }
         }
         if (pluginSourceFromCatalog != null)
         {
             service.Source = pluginSourceFromCatalog;
         }
         var broker = new PluginBroker();
         var pluginSource = (PluginSource)service.Source;
         if(pluginSource != null)
         {
             result = broker.GetMethods(pluginSource.AssemblyLocation, pluginSource.AssemblyName, service.Namespace);
         }
         return result;
     }
     catch(Exception ex)
     {
         RaiseError(ex);
     }
     return result;
 }
예제 #3
0
 public virtual RecordsetList FetchRecordset(PluginService pluginService, bool addFields)
 {
     if(pluginService == null)
     {
         throw new ArgumentNullException("pluginService");
     }
     var broker = new PluginBroker();
     var outputDescription = broker.TestPlugin(pluginService);
     return outputDescription.ToRecordsetList(pluginService.Recordsets, GlobalConstants.PrimitiveReturnValueTag);
 }
예제 #4
0
 // POST: Service/PluginServices/Namespaces
 public virtual NamespaceList Namespaces(string args, Guid workspaceId, Guid dataListId)
 {
     var result = new NamespaceList();
     try
     {
         var pluginSource = JsonConvert.DeserializeObject<PluginSource>(args);
         if(pluginSource != null)
         {
             var broker = new PluginBroker();
             return broker.GetNamespaces(pluginSource);
         }
     }
     catch(Exception ex)
     {
         RaiseError(ex);
     }
     return result;
 }