JBoss 7 - using *.properties files from filesystem - jboss7.x

I have a webapplication (maven,spring,,hibernate) which contains different *.properties files which can be found within src/main/resource. Now my customer want to edit this files (e.g. change email address..) --> whats the best solution/ best practise? exclude *.properties from .war file and put it into filesystem? Jboss modules?
Can someone give me a hint?

If I were you I'd move these properties from static files to a persistent storage (i.e. DB) and then provide a UI to end user to modify their values.

Writing a custom module might work. This isn't as bad as it sounds, check out HowToPutAnExternalFileInTheClasspath.
See also migration-issues-to-jboss-7-1 and Where to put property file in JBOSS 7 or Glassflish? (Best practice)

Related

Asp.net Core SQLite Database Location

In ASP.NET Core when using SQLite database the file blogger.db is stored at the root of my project.
I was wondering where the file should go in production? I know it's a bad idea to put it the wwwroot folder.
Thank you.
I know it's a bad idea to put it the wwwroot folder.
Indeed, because otherwise, it would be potentially accessible as a static file since only those files in wwwroot may be served by Static Files Middleware.
I was wondering where the file should go in production?
The simplest way is to put it in App_Data folder.
However, there is no single recommendation on where to store it. Basically, you may put it wherever you want, once you had some restrictions on the .db file access.
For instance, you may store it at C:\data and have the access to that folder to be restricted only to the account which the application is running under.

Where should additional files be put when writing my own magento extension?

I'm writing my magento extension and came up with a question. The main extension files/directory structure is quite clear. We have dirs for extension configuration files, models, helpers, database resources, frontend and backend scripts and stylesheets etc.
But what if my extension uses some files that aren't classes or resources to be included to frontend or backend?
For instance: image files that will only be attached to emails and will never be retrieved by a browser directly.
Should/could I just create a directory /app/code/community/MyNamespace/MyExtensionName/images?
The same dir tree for better readability:
app
code
community
MyNamespace
MyExtensionName
images
Or is there any other correct/recommended way to achieve that?
There's never been clear guidance on how to do this from Magento Inc. itself, and Magento's module structure doesn't offer clear guidance. The approach I've always taken is
Pretend I'm on the Magento core team
Pretend my fellow team members are sociopaths who don't care if anything I've done breaks
If you're adding frontend files for public consumption (to js, skin, etc), I always create a folder that's a lowercase version of my full module name, and drop all files in there
/js/namespace_modulename/file.js
In the case of files that aren't going to be served publicly (i.e. you only need access to them via PHP), creating a folder in the root of your module (as you've done above) is appropriate. I'd suggest something like
app
code
community
MyNamespace
MyExtensionName
assets
images
You never know when there'll be something else you want to add, and having everything under one folder will help keep the module structure clean.
There's even sort of a precedent for this in Magento's core code. Take a look at the
app/code/core/Mage/Sales/doc
folder.
Create a folder into media directory and place your files/images into that folder
media
MyExtensionName
images
And access them like
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'/MyExtensionName/images/pic.jpg';

Configure Azure Cache (<dataCacheClients>...) of WebRole in cscfg file?

Currently, I have my Azure Cache configuration
<dataCacheClients>
<dataCacheClient name="default">
...
inside my Web.config of my Azure WebRole. I would like to be able to easily modify the Azure Cache settings after the cspkg package has been created, i.e. I would like to move the configuration into the cscfg file.
I don't think that's possible without hand-coding all the possible configuration options of Azure Caches (and then interpreting those options and setting the configuration programmatically in the DataCacheFactory). Am I overlooking something?
in webrole (RoleEntryPoint derived class) onstart, you could overwrite web.config caching part with the relevant settings from your .cscfg file
also add eventhandler to the environment changing (RoleEnvironment.Changing += RoleEnvironmentChanging;) with e.Cancel = true so that the webrole restarts when ever you change .cscfg # the management portal
One walkarround is to rename your .cspkg file to .zip file. Then unzip the file and take a look to the files. You will find .cssx files (the larger files) representing each webrole / working role. rename to .zip and expand. Then you will find a "approot" folder. Your dlls, webconfig, etc are there. You can mess with the webconfig and zip+rename the way back.
It's not elegant at all, but sometimes is the best way to figure out what exactly are you publishing.

Best Method for online update

I was trying to work out the best method of synchronising an update of files via vb.net. I want to automatically update some files in a few folders from an FTP site to a local drive. This would ideally be the same folder structure, but on a specified local folder. I have looked at the FTP methods in .net and am able to transfer individual files successfully, but wondered if there was an elegant method to collecting the entire folder from the FTP and it's contents to be re-created locally. I have established the reading of an XML via linq from the ftp to establish an update single and decide whether the local machine is up-to-date or not, it's just the transfer of the folders that i'm stuck on as it's different to using a IO method.
Can any gurus confirm that this is the best way of approaching this task?
cheers CS
Your approach looks fine to me. You will have to transfer the files/folders individually if you are using the base class library.
There may be 3rd party libraries available which will do this on one shot.

Why does JAXRS Jersey create temp directories on the app server?

I am running Jersey on a weblogic server and I noticed a few extra folders were created. The folders look like this,
n179u/.tld_cache/jersey-server-1.0.3.1.jar/META-INF/taglib.tld
and contain the files
crc.ser and des.ser
So, my question is what are these directories used for and is it possible to tell jersey to create them in a different location?
Just looking at the extension .ser of the files in the folder, my guess is that it is serializing state.