use of com.liferay.ide.core.properties.PortalPropertiesConfiguration in project liferay-ide by liferay.
the class LiferayPropertiesSourceViewerConfiguration method _parseKeys.
private PropKey[] _parseKeys(InputStream inputStream) throws ConfigurationException, IOException {
List<PropKey> parsed = new ArrayList<>();
PortalPropertiesConfiguration config = new PortalPropertiesConfiguration();
config.load(inputStream);
inputStream.close();
Iterator<?> keys = config.getKeys();
PropertiesConfigurationLayout layout = config.getLayout();
while (keys.hasNext()) {
String key = keys.next().toString();
String comment = layout.getComment(key);
parsed.add(new PropKey(key, comment == null ? null : comment.replaceAll("\n", "\n<br/>")));
}
PropKey[] parsedKeys = parsed.toArray(new PropKey[0]);
Arrays.sort(parsedKeys, new Comparator<PropKey>() {
@Override
public int compare(PropKey o1, PropKey o2) {
return o1.getKey().compareTo(o2.getKey());
}
});
return parsedKeys;
}
use of com.liferay.ide.core.properties.PortalPropertiesConfiguration in project liferay-ide by liferay.
the class PortalServerBehavior method getRuntimeStartVMArguments.
private String[] getRuntimeStartVMArguments() {
if (!getPortalServer().getLaunchSettings()) {
File portalext = getPortalRuntime().getLiferayHome().append("portal-ext.properties").toFile();
if (getPortalServer().getDeveloperMode()) {
try {
if (!portalext.exists()) {
portalext.createNewFile();
}
final PortalPropertiesConfiguration config = new PortalPropertiesConfiguration();
InputStream in = Files.newInputStream(portalext.toPath());
config.load(in);
in.close();
String[] p = config.getStringArray("include-and-override");
boolean existing = false;
for (String prop : p) {
if (prop.equals("portal-developer.properties")) {
existing = true;
break;
}
}
if (!existing) {
config.addProperty("include-and-override", "portal-developer.properties");
}
config.save(portalext);
} catch (Exception e) {
LiferayServerCore.logError(e);
}
} else if (portalext.exists()) {
String contents = FileUtil.readContents(portalext, true);
contents = contents.replace("include-and-override=portal-developer.properties", "");
try {
FileUtils.write(portalext, contents);
} catch (IOException e) {
LiferayServerCore.logError(e);
}
}
}
final List<String> retval = new ArrayList<>();
Collections.addAll(retval, getPortalServer().getMemoryArgs());
Collections.addAll(retval, getPortalRuntime().getPortalBundle().getRuntimeStartVMArgs());
return retval.toArray(new String[0]);
}
Aggregations