public void Init(IServerObjectHelper pSOH)
        {
            try
            {
                _soHelper      = pSOH;
                _serverLog     = new ServerLogger();
                _restSOIHelper = new RestSOIHelper(pSOH);

                try
                {
                    IPropertySet configProps = ServerUtilities.QueryConfigurationProperties(pSOH.ServerObject.ConfigurationName, pSOH.ServerObject.TypeName);
                    _outputDirectory = configProps.GetProperty("outputDir") as string;
                }
                catch (Exception ignore)
                {
                    _outputDirectory = string.Empty;
                }

                _outputDirectory = _outputDirectory.Trim();
                if (string.IsNullOrEmpty(_outputDirectory))
                {
                    _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".init()", 500, "OutputDirectory is empty or missing. Reset to default.");
                    _outputDirectory = "C:\\arcgisserver\\directories\\arcgisoutput";
                }

                _serverLog.LogMessage(ServerLogger.msgType.infoDetailed, _soiName + ".init()", 500, "OutputDirectory is " + _outputDirectory);
                _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
            }
            catch (Exception e)
            {
                _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".HandleRESTRequest()", 500, "Exception " + e.GetType().Name + " " + e.Message + " " + e.StackTrace);
                throw;
            }
        }
        public void Init(IServerObjectHelper pSOH)
        {
            _soHelper      = pSOH;
            _serverLog     = new ServerLogger();
            _restSOIHelper = new RestSOIHelper(pSOH);

            _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
        }
        public void Init(IServerObjectHelper pSOH)
        {
            _soHelper = pSOH;
            _serverLog = new ServerLogger();
            _restSOIHelper = new RestSOIHelper(pSOH);

            _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
        }
        public void Init(IServerObjectHelper pSOH)
        {
            System.Diagnostics.Debugger.Launch();

            _soHelper       = pSOH;
            _serverLog      = new ServerLogger();
            _restServiceSOI = new RestSOIHelper(pSOH);
            ReadConfigFile(pSOH);
            InitFiltering();
            _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
        }
        public void Init(IServerObjectHelper pSOH)
        {
            // Uncomment this line to turn on the debugger
            //System.Diagnostics.Debugger.Launch();

            _soHelper      = pSOH;
            _serverLog     = new ServerLogger();
            _restSOIHelper = new RestSOIHelper(pSOH);
            _soiUtil       = new SOIUtil();

            _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
        }
        public void Init(IServerObjectHelper pSOH)
        {
            try
            {
                _soHelper  = pSOH;
                _serverLog = new ServerLogger();

                _restSOIHelper = new RestSOIHelper(pSOH);

                try
                {
                    //interop problem?
                    var se4      = _restSOIHelper.ServerEnvironment as IServerEnvironmentEx;
                    var dirInfos = se4.GetServerDirectoryInfos();
                    dirInfos.Reset();
                    object dirInfo = dirInfos.Next();
                    while (dirInfo != null)
                    {
                        var dinfo2 = dirInfo as IServerDirectoryInfo2;
                        if (null != dinfo2 && dinfo2.Type == esriServerDirectoryType.esriSDTypeOutput)
                        {
                            _outputDirectory = dinfo2.Path;
                            break;
                        }
                        dirInfo = dirInfos.Next();
                    }
                }
                catch (Exception ignore)
                {
                    _outputDirectory = string.Empty;
                }

                _outputDirectory = _outputDirectory.Trim();
                if (string.IsNullOrEmpty(_outputDirectory))
                {
                    _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".init()", 500, "OutputDirectory is empty or missing. Reset to default.");
                    _outputDirectory = "C:\\arcgisserver\\directories\\arcgisoutput";
                }

                _serverLog.LogMessage(ServerLogger.msgType.infoDetailed, _soiName + ".init()", 500, "OutputDirectory is " + _outputDirectory);
                _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
            }
            catch (Exception e)
            {
                _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".HandleRESTRequest()", 500, "Exception " + e.GetType().Name + " " + e.Message + " " + e.StackTrace);
                throw;
            }
        }
        public void Init ( IServerObjectHelper pSOH )
        {
            try
            {
                _soHelper = pSOH;
                _serverLog = new ServerLogger();

                _restSOIHelper = new RestSOIHelper(pSOH);

                try
                {
                    //interop problem?
                    var se4 = _restSOIHelper.ServerEnvironment as IServerEnvironmentEx;
                    var dirInfos = se4.GetServerDirectoryInfos();
                    dirInfos.Reset();
                    object dirInfo = dirInfos.Next();
                    while (dirInfo != null)
                    {
                        var dinfo2 = dirInfo as IServerDirectoryInfo2;
                        if (null != dinfo2 && dinfo2.Type == esriServerDirectoryType.esriSDTypeOutput)
                        {
                            _outputDirectory = dinfo2.Path;
                            break;
                        }
                        dirInfo = dirInfos.Next();
                    }
                }
                catch (Exception ignore)
                {
                    _outputDirectory = string.Empty;
                }

                _outputDirectory = _outputDirectory.Trim();
                if (string.IsNullOrEmpty(_outputDirectory))
                {
                    _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".init()", 500, "OutputDirectory is empty or missing. Reset to default.");
                    _outputDirectory = "C:\\arcgisserver\\directories\\arcgisoutput";
                }

                _serverLog.LogMessage(ServerLogger.msgType.infoDetailed, _soiName + ".init()", 500, "OutputDirectory is " + _outputDirectory);
                _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
            }
            catch (Exception e)
            {
                _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".HandleRESTRequest()", 500, "Exception " + e.GetType().Name + " " + e.Message + " " + e.StackTrace);
                throw;
            }
        }
Example #8
0
 public void Init(IServerObjectHelper pSOH)
 {
     _soHelper      = pSOH;
     _restSOIHelper = new RestSOIHelper(pSOH);
 }
        private RestHandlerOpCode GetHandlerOpCode(string resourceName, string operationName, bool isAskingForReturnUpdates = false)
        {
            if (isAskingForReturnUpdates)
            {
                return(CustomRESTHandlerOpCode.RootReturnUpdates);
            }


            RestHandlerOpCode opCode = RestSOIHelper.GetHandlerOpCode(resourceName, operationName);

            if (opCode != RestHandlerOpCode.DefaultNoOp)
            {
                return(opCode);
            }

            // The code below deals with the custom REST operation codes. This is required to enable REST request filtering for custom SOEs.
            // In this example the switch statement simply duplicates RestSOIHelper.GetHandlerOpCode() call.

            // If you don't plan to support filtering for any custom SOEs, remove code below until the end of the method.
            // If you want to support filtering for custom SOEs, modify the code below to match your needs.

            var    resName        = resourceName.TrimStart('/'); //remove leading '/' to prevent empty string at index 0
            var    resourceTokens = (resName ?? "").ToLower().Split('/');
            string opName         = (operationName ?? "").ToLower();

            switch (resourceTokens[0])
            {
            case "":
                switch (opName)
                {
                case "":
                    return(RestHandlerOpCode.Root);

                case "export":
                    return(RestHandlerOpCode.RootExport);

                case "find":
                    return(RestHandlerOpCode.RootFind);

                case "identify":
                    return(RestHandlerOpCode.RootIdentify);

                case "generatekml":
                    return(RestHandlerOpCode.RootGenerateKml);

                default:
                    return(RestHandlerOpCode.DefaultNoOp);
                }

            case "layers":
            {
                var tokenCount = resourceTokens.GetLength(0);
                if (1 == tokenCount)
                {
                    return(RestHandlerOpCode.RootLayers);
                }
                if (2 == tokenCount)
                {
                    switch (opName)
                    {
                    case "":
                        return(RestHandlerOpCode.LayerRoot);

                    case "query":
                        return(RestHandlerOpCode.LayerQuery);

                    case "queryRelatedRecords":
                        return(RestHandlerOpCode.LayerQueryRelatedRecords);

                    default:
                        return(RestHandlerOpCode.DefaultNoOp);
                    }
                }
            }
            break;

            case "legend":
                return(RestHandlerOpCode.RootLegend);

            case "dynamiclayer":
                switch (opName)
                {
                case "query":
                    return(RestHandlerOpCode.DefaultNoOp); //MyRESTHandlerOpCode.DynamicLayerQuery;

                default:
                    return(RestHandlerOpCode.DefaultNoOp);
                }

            default:
                return(RestHandlerOpCode.DefaultNoOp);
            }
            return(RestHandlerOpCode.DefaultNoOp);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pSOH"></param>
        public void Init ( IServerObjectHelper pSOH )
        {
            try
            {
                _soHelper = pSOH;
                _serverLog = new ServerLogger();
                _serverObject = pSOH.ServerObject;

                _restServiceSOI = new RestSOIHelper(_soHelper);
                _SoapSOIHelper = new SoapSOIHelper(_soHelper, _wsdlFilePath);

                if (File.Exists(_permissionFilePath))
                {
                    //TODO REMOVE
                    _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Reading permissions from " + _permissionFilePath);

                    _servicePermissionMap = ReadPermissionFile(_permissionFilePath);

                    //TODO REMOVE
                    _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Total permission entries: " + _servicePermissionMap.Count());
                }
                else
                {
                    _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".init()", 500, "Permission file does not exist at " + _permissionFilePath);
                }

                InitFiltering();

                _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
            }
            catch (Exception e)
            {
                _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".init()", 500, "Exception: " + e.Message + " in " + e.StackTrace);
            }
        }