Ejemplo n.º 1
0
        public SPServiceApplicationProxy CreateProxy(string name, SPServiceApplication serviceApplication, SPServiceProvisioningContext provisioningContext)
        {
            if (serviceApplication.GetType() != typeof(BaristaServiceApplication))
            {
                throw new NotSupportedException();
            }

            if (serviceApplication == null)
            {
                throw new ArgumentNullException("serviceApplication");
            }

            // verify the service proxy exists
            var serviceProxy = (BaristaServiceProxy)Farm.GetObject(name, Farm.Id, typeof(BaristaServiceProxy));

            if (serviceProxy == null)
            {
                throw new InvalidOperationException("BaristaServiceProxy does not exist in the farm.");
            }

            // if the app proxy doesn't exist, create it
            var applicationProxy = serviceProxy.ApplicationProxies.GetValue <BaristaServiceApplicationProxy>(name);

            if (applicationProxy == null)
            {
                var serviceAppAddress = ((BaristaServiceApplication)serviceApplication).Uri;
                applicationProxy = new BaristaServiceApplicationProxy(name, serviceProxy, serviceAppAddress);
            }

            return(applicationProxy);
        }
Ejemplo n.º 2
0
 public void Exec(BrewRequest request)
 {
     BaristaServiceApplicationProxy.Invoke(
         m_serviceContext,
         proxy => proxy.Exec(request)
         );
 }
Ejemplo n.º 3
0
        public BrewResponse Eval(BrewRequest request)
        {
            BrewResponse result = null;

            BaristaServiceApplicationProxy.Invoke(
                m_serviceContext,
                proxy => result = proxy.Eval(request)
                );
            return(result);
        }
Ejemplo n.º 4
0
        public string AddPackage(byte[] bundlePackage)
        {
            string result = string.Empty;

            BaristaServiceApplicationProxy.Invoke(
                m_serviceContext,
                proxy => result = proxy.AddPackage(bundlePackage)
                );

            return(result);
        }
Ejemplo n.º 5
0
        public string ListPackages()
        {
            string result = string.Empty;

            BaristaServiceApplicationProxy.Invoke(
                m_serviceContext,
                proxy => result = proxy.ListPackages()
                );

            return(result);
        }