Access configuration store from SOE

1025
5
10-19-2012 01:49 PM
RichardWatson
Frequent Contributor
I have a custom SOE which needs to access custom site properties, i.e. properties which are site wide and not specific to the particular instance of the SOE/map service.

I was thinking that it might be nice to simply add these to the site wide configuration store.  Maybe I could create a new subdirectory which might hold custom site information.

I also know that I can get the location of the configuration store via REST.  The problem is that I am running in the context of the SOE and, to the best of my knowledge, it does not know this.  Just wondering if anyone has any thoughts with regards to how to find out the location of the configuration store from an SOE.  ArcGIS Server clearly knows this information.

I am also interested if anyone has thoughts with regards to how best to handle this problem.  The thing that I was trying to avoid is having users configure information on every machine in the site.  I am thinking about how to make this easily for cloud deployment.
Tags (2)
0 Kudos
5 Replies
RichardWatson
Frequent Contributor
I think that I figured out a good way to handle this.  I'll explain my approach in case someone else has a similar problem.

A .soe file is really just a renamed zip file.  It can be created in Visual Studio 2010 by using the ESRI SOE template which adds custom msbuild steps (which BTW do not work in Visual Studio 2012).  After adding a Config.xml file, these steps zip up the contents of the output directory and name the resulting file ProjectName.soe.

So, what you can do is to simply add an XML file to the Visual Studio project such that it is copied to the output directory.  When you deploy the SOE you can load the contents of the XML file (it will be in the same directory as the executing assembly of the SOE) in your code in order to read site configuration options.
0 Kudos
nicogis
MVP Frequent Contributor
this info you can get from IDiscoveryServerConfigStore http://resources.arcgis.com/en/help/arcobjects-cpp/componenthelp/0010/001000000150000000.htm

for your properties why don't you use simple properties ?


[ServerObjectExtension("MapServer",
        AllCapabilities = "",
        DefaultCapabilities = "",
        Description = "Test",
        DisplayName = "TestSOE",
        Properties = "FilePathStoreConfig=...;PropertyB=Cities",
        SupportsREST = true,
        SupportsSOAP = false)]
0 Kudos
RichardWatson
Frequent Contributor
for your properties why don't you use simple properties ?


My thought was that SOE properties are specified per map service instance. 

What I also want is properties which apply to all instances of a map service. 

In my particular case, I have a licensing scheme which requires that my SOE communicate with an external licensing server.  If I use simple properties then the user would have to provide this information for every map service they create with my extension.  What I want is a technique whereby this information can be configured once, i.e. at a site level.

Does that make sense?
0 Kudos
nicogis
MVP Frequent Contributor
you can for example get url admin rest

            Guid guid = Marshal.GenerateGuidForType(typeof(IServerEnvironment));
            UID uid = new UIDClass();
            uid.Value = guid.ToString("B");
            IEnvironmentManager environmentManager = new EnvironmentManager() as IEnvironmentManager;

            IServerEnvironment2 serverEnvironment = environmentManager.GetEnvironment(uid) as IServerEnvironment2;
            IPropertySet b = serverEnvironment.Properties;
            object[] name = new object[1];
            object[] values = new object[1];
            b.GetAllProperties(out name[0], out values[0]);
            object[] nameList = (object[])name[0];
            object[] valueList = (object[])values[0];


0 Kudos
RichardWatson
Frequent Contributor
Thanks for the information Domenico.  I appreciate it.

Richard
0 Kudos