Any service that implements GenericService
will also have access to getNucleus()
which in turn gives you access to getRealPath(String str)
.
As I'm not sure why you need to use context.getRealPath(String str)
you should note that there are occasions where it may not be best suited for your needs. For example you won't be able to access it if you deploy your application in a .war.
That said, this may be a simpler approach that doesn't care which environment you deploy it to:
private String getBasePath() {
String basePath = DynamoEnv.getProperty("atg.dynamo.server.home");
return basePath;
}
It is environment agnostic and since you can't run ATG without a home folder... should work wonders.