Skip to content

Instantly share code, notes, and snippets.

Avatar

Josef Šustáček sustacek

  • Liferay, Inc.
  • South Moravia, Czech Republic
View GitHub Profile
@sustacek
sustacek / Cloud Formation boolean Parameter
Last active Oct 27, 2020
The snippet of a Cloud Formation template, which supports input of boolean parameter and using it for a resource with Boolean property.
View Cloud Formation boolean Parameter
{
...
"Parameters": {
"DbRdsMultiAZ": {
"Type": "String",
"Description": "Specifies if the RDS instance is deployed in multiple Availability Zones.",
"AllowedValues": [
"yes",
"no"
],
@sustacek
sustacek / gist:b0af0ae1969668042b112542cc8f4eb1
Created Mar 4, 2019
Enhanced log4j monitoring for DXP 7.1 - tomcat/webapps/ROOT/WEB-INF/classes/META-INF/portal-log4j-ext.xml
View gist:b0af0ae1969668042b112542cc8f4eb1
<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender class="org.apache.log4j.rolling.RollingFileAppender" name="TEXT_FILE">
<!-- Inspired by: http://www.baeldung.com/java-logging-rolling-file-appenders -->
<!--
=== What happens when current log file needs to be rotated? ===
-->
@sustacek
sustacek / build.gradle
Last active Nov 4, 2020
Liferay Workspace - Tomcat version check between configs and used bundle
View build.gradle
// [root]/build.gradle
// A sanity check in case the Tomcat version inside the bundle changes and we miss it
[
(initBundle): gradle.liferayWorkspace.homeDir,
(distBundle): file("${buildDir}/dist")
].each {Task task, File destDir ->
task.configure {
doLast {
println "Checking Tomcat files in " + destDir
@sustacek
sustacek / build.gradle
Created Dec 2, 2020
Verify bundle checksum in Liferay Workspace
View build.gradle
// Make sure we can use the classes from the Download plugin, like the Verify below
buildscript {
repositories { jcenter() }
dependencies { classpath group: "de.undercouch", name: "gradle-download-task", version: "4.0.4" }
}
apply plugin: de.undercouch.gradle.tasks.download.DownloadTaskPlugin
[
'SHA-256': 'liferay.workspace.bundle.checksum[sha-256]',
'MD5': 'liferay.workspace.bundle.checksum[md5]',
@sustacek
sustacek / ConfigsLister.java
Last active Feb 10, 2021
OSGi - list all instances of a factory config
View ConfigsLister.java
import aQute.bnd.annotation.metatype.Meta;
import com.liferay.portal.configuration.metatype.annotations.ExtendedObjectClassDefinition;
import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import java.io.IOException;