use of org.pentaho.platform.api.engine.IConfiguration in project pentaho-platform by pentaho.
the class PentahoSystem method setSystemProperties.
private static void setSystemProperties() {
ISystemConfig systemConfig = PentahoSystem.get(ISystemConfig.class);
if (systemConfig == null) {
return;
}
final IConfiguration configuration = systemConfig.getConfiguration(JAVA_SYSTEM_PROPERTIES);
if (configuration != null) {
try {
final Properties systemSettingsProperties = configuration.getProperties();
for (String propName : systemSettingsProperties.stringPropertyNames()) {
System.setProperty(propName, systemSettingsProperties.getProperty(propName));
}
} catch (IOException e) {
Logger.warn(PentahoSystem.class.getName(), Messages.getInstance().getErrorString("PentahoSystem.WARN_SYSTEM_PROPERTIES_READ_FAIL", // $NON-NLS-1$
JAVA_SYSTEM_PROPERTIES));
}
}
}
use of org.pentaho.platform.api.engine.IConfiguration in project pentaho-platform by pentaho.
the class SystemResource method getAuthenticationProvider.
/**
* Return JSON string reporting which authentication provider is currently in use
*
* Response sample: { "authenticationType": "JCR_BASED_AUTHENTICATION" }
*
* @return AuthenticationProvider represented as JSON response
* @throws Exception
*/
@GET
@Path("/authentication-provider")
@Produces({ MediaType.APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getAuthenticationProvider() throws Exception {
try {
if (canAdminister()) {
IConfiguration config = this.systemConfig.getConfiguration("security");
String provider = config.getProperties().getProperty("provider");
return Response.ok(new AuthenticationProvider(provider)).type(MediaType.APPLICATION_JSON).build();
} else {
return Response.status(UNAUTHORIZED).build();
}
} catch (Throwable t) {
// $NON-NLS-1$
logger.error(Messages.getInstance().getString("SystemResource.GENERAL_ERROR"), t);
throw new Exception(t);
}
}
Aggregations