How to resolve ${com.wowza.wms.ConfigHome} from properties?

Hi!

If I’ve to use a .properties file and I’d like to have it in my apps. conf folder, how may I get hold of the file path of the file to read it with the Properties class’ load method?

How can I’ve something like this in my application configuration?

ConfigDir

${com.wowza.wms.ConfigHome}\settings.properties

Thanks,

Attila

The Properties class is a Java class you can use in your Module directly.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html

If you want to use Application.xml /Properties, you can use Wowza WMSProperties.

<Property>
<Name>someProperty</Name>
<Value>someValue</Value>
</Property>
public void onAppStart(IApplicationInstance appInstance) {
	String someValue = appInstance.getProperties().getPropertyStr("someValue");
}

Great! Glad it’s solved:

From Application.xml

${com.wowza.wms.AppHome} - Application home directory

${com.wowza.wms.ConfigHome} - Configuration home directory

${com.wowza.wms.context.VHost} - Virtual host name

${com.wowza.wms.context.VHostConfigHome} - Virtual host config directory

${com.wowza.wms.context.Application} - Application name

${com.wowza.wms.context.ApplicationInstance} - Application instance name

Also there is configuration reference, [wowza-install-dir]/documentation/WowzaMediaServer_ConfigurationReference.pdf

Richard

Let me rephrase my question:

I WANT to use the Properties class, not WMSProperties.

// This type comes from Spring

FileSystemResource f = new FileSystemResource (“my.properties”);

Properties p = new Properties ();

// This will throw a FileNotFoundException

p.load (f.getInputStream ());

Question 1:

How can I resolve Wowza “environment” folders, like the conf\MyApplication folder? Which makes me able to instantiate a FileSystemResource like this:

FileSystemResource f = new FileSystemResource (getSomehowTheConfFolder () + “\my.properties”);

Question 2:

You are supporting the expansion of ${com.wowza.wms.ConfigHome} to the real folder in StreamFolder settings section of Application.xml.

What function can I use to achieve the same and have a setting like this in my Application.xml:

ConfigDir

${com.wowza.wms.ConfigHome}\settings.proper ties

Filename

The Type=Filename should trigger your own mechanism of expanding variables inside that property value…

Thanks,

Attila

Maybe the environment manipulation functions should be more documented, since there is a very good way to achieve what I like.

String appHome = Bootstrap.getServerHome (Bootstrap.APPHOME);

StringBuilder sb = new StringBuilder();

String configPath = sb

.append(appHome)

.append(File.separatorChar)

.append(“conf”)

.append(File.separatorChar)

.append (appInstance.getApplication ().getName ())

.append (File.separatorChar).append(“my.properties”).toString();

This is producing for me:

C:/Program Files/Wowza Media Systems/Wowza Media Server 2/conf/testapp/my.properties what I can use to open the file and do what I want.

also I’ve found useful the Bootstrap.getServerHome (Bootstrap.CONFIGHOME) call.

Can you provide a full reference of the settings you are storing within the System object properties, com.wowza.wms.* ? This can be very useful!

Expand environment variables can be done also this way.

Thanks,

Attila

Cool, I’ll check out that document too :slight_smile:

In another thread you mentioned a PPM system you’ve…I’d like to get to the point and see how can I leverage the billing data needed from the media stream action interface events…

Thanks again Richard :slight_smile:

  • Attila