Plugin Prefs on Server

8 messages Options
Embed this post
Permalink
Jake Traynham

Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Hello all,

   For those of you who have working server plug-ins, do any of you
store preferences on the server?  I'm in the process of (finally) making
my plug-ins work correctly on the server side and I'm trying to figure
out the best place to store some preferences.  I have existing code that
stores prefs in the same place as the actual plug-in file, but I'm not
sure that's the best place to store prefs on the server.  One reason is
that plug-ins for the server process and plug-ins for the WPE process
are in two different locations, meaning that there would be two
different prefs files for the two processes.  While this may be
desirable in some situations, other situations (like storing
registration information) would not be.

   So, I'm trying to figure out if there's a more central place to store
them and was wondering if anyone else had pondered this.  On OS X, the
fmserver user owns the whole /Library/FileMaker Server folder structure,
so I could obviously make a folder and put the prefs anywhere in there,
but I don't want to "litter" a customers folder structure with stuff.  I
was contemplating making a folder in the "Data" folder called "Prefs" or
"Preferences".  Does anyone know if that would cause problems or if
somewhere else would make more sense?

   This obviously isn't sanctioned by FMI, but it seems like us plug-in
developers could adopt a pattern and run with it.  If we decided
together on something like this, then it would seem to make all of our
respective customers happy with it.

Thanks for listening and any thoughts you have,
Jake

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/
Jesse Barnum-2

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Hi Jake - we don't store any preferences on the server at all, but if  
I did, I would put them where the OS would put them: /Library/
FileMaker Server/Library/Preferences. I'm not sure off-hand what the  
corresponding Windows path would be.

One downside of this approach is that the folder is not guest-
readable, so the users would not be able to see the contents of this  
folder, but that's not necessarily a problem if you don't want the  
users mucking around with your preference files.

--Jesse Barnum, President, 360Works
http://www.360works.com 770-234-9293
FBA Platinum, FileMaker 8 Certified
== SuperContainer: A Better Container Field ==

On Jun 20, 2008, at 10:46 AM, Jake Traynham wrote:

> Hello all,
>
>    For those of you who have working server plug-ins, do any of you
> store preferences on the server?  I'm in the process of (finally)  
> making
> my plug-ins work correctly on the server side and I'm trying to figure
> out the best place to store some preferences.  I have existing code  
> that
> stores prefs in the same place as the actual plug-in file, but I'm not
> sure that's the best place to store prefs on the server.  One  
> reason is
> that plug-ins for the server process and plug-ins for the WPE process
> are in two different locations, meaning that there would be two
> different prefs files for the two processes.  While this may be
> desirable in some situations, other situations (like storing
> registration information) would not be.
>
>    So, I'm trying to figure out if there's a more central place to  
> store
> them and was wondering if anyone else had pondered this.  On OS X, the
> fmserver user owns the whole /Library/FileMaker Server folder  
> structure,
> so I could obviously make a folder and put the prefs anywhere in  
> there,
> but I don't want to "litter" a customers folder structure with  
> stuff.  I
> was contemplating making a folder in the "Data" folder called  
> "Prefs" or
> "Preferences".  Does anyone know if that would cause problems or if
> somewhere else would make more sense?
>
>    This obviously isn't sanctioned by FMI, but it seems like us  
> plug-in
> developers could adopt a pattern and run with it.  If we decided
> together on something like this, then it would seem to make all of our
> respective customers happy with it.
>
> Thanks for listening and any thoughts you have,
> Jake
>
> --
> Jake Traynham
> Owner, CNS Plug-ins
> http://www.cnsplug-ins.com/
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

Jake Traynham

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Hi Jesse,

Jesse Barnum wrote:
>
>
> Hi Jake - we don't store any preferences on the server at all, but if
> I did, I would put them where the OS would put them: /Library/
> FileMaker Server/Library/Preferences. I'm not sure off-hand what the
> corresponding Windows path would be.

   I saw that path, but wasn't sure if my code had created it by
accident or if it was valid for the system.

>
> One downside of this approach is that the folder is not guest-
> readable, so the users would not be able to see the contents of this
> folder, but that's not necessarily a problem if you don't want the
> users mucking around with your preference files.

   And therein lies the problem.  I'm planning on creating a stand-alone
configuration app that a user can use to configure the plug-in on the
server side (since there's no way to do it from the server admin).  So,
either I would have to put the preferences somewhere where a normal user
could get to it, or I would have to figure out how to use the system's
user/pass dialog to get access to it (if that would even work..).

   I haven't tested on windows yet, so I'm not sure where it's going to
try to put anything when I ask the system for the user's pref folder,
but it seems like it'd be off in some application data folder somewhere.
  So, for the sake of trying to be nice cross-platform (something I'm
always striving for), I don't think I want to put it in
/Library/FileMaker Server/Library/Preferences.  I'd rather have a
location that's basically the same on both platforms.

   You've probably dealt with server more than I have, and probably
dealt with customers trying to set up server more than I have ... can
you think of any reason why putting a "Preferences" folder in the "Data"
folder would cause problems?

Thanks,
Jake

>
> --Jesse Barnum, President, 360Works
> http://www.360works.com <http://www.360works.com> 770-234-9293
> FBA Platinum, FileMaker 8 Certified
> == SuperContainer: A Better Container Field ==
>
> On Jun 20, 2008, at 10:46 AM, Jake Traynham wrote:
>
>  > Hello all,
>  >
>  > For those of you who have working server plug-ins, do any of you
>  > store preferences on the server? I'm in the process of (finally)
>  > making
>  > my plug-ins work correctly on the server side and I'm trying to figure
>  > out the best place to store some preferences. I have existing code
>  > that
>  > stores prefs in the same place as the actual plug-in file, but I'm not
>  > sure that's the best place to store prefs on the server. One
>  > reason is
>  > that plug-ins for the server process and plug-ins for the WPE process
>  > are in two different locations, meaning that there would be two
>  > different prefs files for the two processes. While this may be
>  > desirable in some situations, other situations (like storing
>  > registration information) would not be.
>  >
>  > So, I'm trying to figure out if there's a more central place to
>  > store
>  > them and was wondering if anyone else had pondered this. On OS X, the
>  > fmserver user owns the whole /Library/FileMaker Server folder
>  > structure,
>  > so I could obviously make a folder and put the prefs anywhere in
>  > there,
>  > but I don't want to "litter" a customers folder structure with
>  > stuff. I
>  > was contemplating making a folder in the "Data" folder called
>  > "Prefs" or
>  > "Preferences". Does anyone know if that would cause problems or if
>  > somewhere else would make more sense?
>  >
>  > This obviously isn't sanctioned by FMI, but it seems like us
>  > plug-in
>  > developers could adopt a pattern and run with it. If we decided
>  > together on something like this, then it would seem to make all of our
>  > respective customers happy with it.
>  >
>  > Thanks for listening and any thoughts you have,
>  > Jake
>  >

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/
Jesse Barnum-2

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
No, I don't think that will cause any problems at all that I know of.  
We already create a 360PluginLog subfolder in the Logs directory, and  
that's worked fine so far.

--Jesse Barnum, President, 360Works
http://www.360works.com 770-234-9293
FBA Platinum, FileMaker 8 Certified
== SuperContainer: A Better Container Field ==

On Jun 20, 2008, at 12:36 PM, Jake Traynham wrote:

>    You've probably dealt with server more than I have, and probably
> dealt with customers trying to set up server more than I have ... can
> you think of any reason why putting a "Preferences" folder in the  
> "Data"
> folder would cause problems?

Jake Traynham

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Jesse,

   Cool .. Thanks for the info.  I think I'm going to adopt this as
practice for all my plug-ins (ie. putting a "Preferences" folder inside
the "Data" folder, and then building my usual folder structure under
that for each plug-in).  If any other plug-in vendor wants to copy this
idea, they are more than welcome too.  Customers like plug-ins that work
the same way. :)

Jake

Jesse Barnum wrote:

>
>
> No, I don't think that will cause any problems at all that I know of.
> We already create a 360PluginLog subfolder in the Logs directory, and
> that's worked fine so far.
>
> --Jesse Barnum, President, 360Works
> http://www.360works.com <http://www.360works.com> 770-234-9293
> FBA Platinum, FileMaker 8 Certified
> == SuperContainer: A Better Container Field ==
>
> On Jun 20, 2008, at 12:36 PM, Jake Traynham wrote:
>
>  > You've probably dealt with server more than I have, and probably
>  > dealt with customers trying to set up server more than I have ... can
>  > you think of any reason why putting a "Preferences" folder in the
>  > "Data"
>  > folder would cause problems?
>
>

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/
Peter Wagemans

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Agreed. Pity that the API does not provide any functionality there.
I'm not such a hot programmer, and letting the API take care of a  
prefs location would certainly help.
It would also enforce what Jake is suggesting.
As this will not likely happen in the near future, anyone interested  
in providing some sample code to be used as a base for people of my  
skill level ( being very basic ) ?
For the Mac side I'm doing
FSRef prefsFolderRef;
OSErr err =  
FSFindFolder(kUserDomain,kPreferencesFolderType,TRUE,&prefsFolderRef);
My prefs file ends up in "FileMaker Server/Library/Preferences" this  
way.
For Windows I'm using the registry.

-- peter

On 20-jun-08, at 19:55, Jake Traynham wrote:

> I think I'm going to adopt this as
> practice for all my plug-ins (ie. putting a "Preferences" folder  
> inside
> the "Data" folder, and then building my usual folder structure under
> that for each plug-in). If any other plug-in vendor wants to copy this
> idea, they are more than welcome too. Customers like plug-ins that  
> work
> the same way. :)


 

smime.p7s (3K) Download Attachment
Jake Traynham

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Hi Peter,

   I don't have any complete code for you because I built a
cross-platform file spec class for myself a while back and it does all
the platform specific stuff for me.  However, what I'm basically doing
at the moment is finding the location of the host application and then
going up a few directories and then into the Data folder.

   So, on Mac, I'm doing something along the lines of:

ProcessSerialNumber process;
FSRef appLocation;
if (GetCurrentProcess(&process) == noErr)
   {
     if (GetProcessBundleLocation(&process, &appLocation) == noErr)
       {
         // use the appLocation FSRef
       }
   }

   On Windows, it's something like this:

char appLocation[MAX_PATH];
if (GetModuleFileName(NULL, appLocation, MAX_PATH) != 0)
   {
     // use the appLocation path
   }

   The paths returned to you will be:

OSX: Server Process: /Library/FileMaker Server/Database Server/bin/fmserverd
OSX: WPE Process: /Library/FileMaker Server/Web
Publishing/publishing-engine/wpc/FM Web Publishing
Win: Server Process: C:\Program Files\FileMaker Server\Database
Server\fmserver.exe
Win: WPE Process: C:\Program Files\FileMaker Server\Web
Publishing\publishing-engine\wpc\fmswpc.exe

   So, then just take off the directories (however you do that with
straight FSRefs) till you get to the "FileMaker Server" folder, then add
on "Data" and "Preferences".

   I hope this helps.  Sorry I couldn't give you a complete solution.

Jake


Peter Wagemans wrote:

> Agreed. Pity that the API does not provide any functionality there.
> I'm not such a hot programmer, and letting the API take care of a prefs
> location would certainly help.
> It would also enforce what Jake is suggesting.
> As this will not likely happen in the near future, anyone interested in
> providing some sample code to be used as a base for people of my skill
> level ( being very basic ) ?
> For the Mac side I'm doing
> FSRef prefsFolderRef;
> OSErr err =
> FSFindFolder(kUserDomain,kPreferencesFolderType,TRUE,&prefsFolderRef);
> My prefs file ends up in "FileMaker Server/Library/Preferences" this way.
> For Windows I'm using the registry.
>
> -- peter
>
> On 20-jun-08, at 19:55, Jake Traynham wrote:
>
>> I think I'm going to adopt this as
>> practice for all my plug-ins (ie. putting a "Preferences" folder inside
>> the "Data" folder, and then building my usual folder structure under
>> that for each plug-in). If any other plug-in vendor wants to copy this
>> idea, they are more than welcome too. Customers like plug-ins that work
>> the same way. :)
>

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/
Peter Wagemans

Re: Plugin Prefs on Server

Reply Threaded More More options
Print post
Permalink
Hi Jake,
Of course, this is very helpful. Thanks for sharing this,
I can't even start to write code without knowing the right function  
calls, you just gave them.
Cheers! -- peter

On 24-jun-08, at 22:47, Jake Traynham wrote:

> Hi Peter,
>
> I don't have any complete code for you because I built a
> cross-platform file spec class for myself a while back and it does all
> the platform specific stuff for me. However, what I'm basically doing
> at the moment is finding the location of the host application and then
> going up a few directories and then into the Data folder.
>
> So, on Mac, I'm doing something along the lines of:
>
> ProcessSerialNumber process;
> FSRef appLocation;
> if (GetCurrentProcess(&process) == noErr)
> {
> if (GetProcessBundleLocation(&process, &appLocation) == noErr)
> {
> // use the appLocation FSRef
> }
> }
>
> On Windows, it's something like this:
>
> char appLocation[MAX_PATH];
> if (GetModuleFileName(NULL, appLocation, MAX_PATH) != 0)
> {
> // use the appLocation path
> }
>
> The paths returned to you will be:
>
> OSX: Server Process: /Library/FileMaker Server/Database Server/bin/
> fmserverd
> OSX: WPE Process: /Library/FileMaker Server/Web
> Publishing/publishing-engine/wpc/FM Web Publishing
> Win: Server Process: C:\Program Files\FileMaker Server\Database
> Server\fmserver.exe
> Win: WPE Process: C:\Program Files\FileMaker Server\Web
> Publishing\publishing-engine\wpc\fmswpc.exe
>
> So, then just take off the directories (however you do that with
> straight FSRefs) till you get to the "FileMaker Server" folder, then  
> add
> on "Data" and "Preferences".
>
> I hope this helps. Sorry I couldn't give you a complete solution.
>
> Jake
>
> Peter Wagemans wrote:
> > Agreed. Pity that the API does not provide any functionality there.
> > I'm not such a hot programmer, and letting the API take care of a  
> prefs
> > location would certainly help.
> > It would also enforce what Jake is suggesting.
> > As this will not likely happen in the near future, anyone  
> interested in
> > providing some sample code to be used as a base for people of my  
> skill
> > level ( being very basic ) ?
> > For the Mac side I'm doing
> > FSRef prefsFolderRef;
> > OSErr err =
> >  
> FSFindFolder(kUserDomain,kPreferencesFolderType,TRUE,&prefsFolderRef);
> > My prefs file ends up in "FileMaker Server/Library/Preferences"  
> this way.
> > For Windows I'm using the registry.
> >
> > -- peter
> >
> > On 20-jun-08, at 19:55, Jake Traynham wrote:
> >
> >> I think I'm going to adopt this as
> >> practice for all my plug-ins (ie. putting a "Preferences" folder  
> inside
> >> the "Data" folder, and then building my usual folder structure  
> under
> >> that for each plug-in). If any other plug-in vendor wants to copy  
> this
> >> idea, they are more than welcome too. Customers like plug-ins  
> that work
> >> the same way. :)
> >
>
> --
> Jake Traynham
> Owner, CNS Plug-ins
> http://www.cnsplug-ins.com/
>
>


 

smime.p7s (3K) Download Attachment