Skip to content

Instantly share code, notes, and snippets.

@chetanmeh
chetanmeh / logging-example.txt
Created August 19, 2012 13:38
Pax runner example demonstrating Logging
#This is a Pax Runner config file which uses Felix ConfigAdmin, Pax Logging and other bundles to
#demonstrate how to configure pax logging.
#It uses File install bundle and configures it to watch the config folder. We would add org.ops4j.pax.logging.cfg
#file to this folder which would then be picked by File install and thus update Pax logging config
--platform=felix
--vmOptions=-Dorg.osgi.service.http.port=9090 \
-Dfelix.fileinstall.dir=../config
#List of profiles to run
//Provide details around the bootdelgation state
println "Bootdelgation property value :- "+bundleContext.getProperty("org.osgi.framework.bootdelegation")
println "Felix bootdelgation entries"
bundleContext.bundle.framework.bootPackages.each {
println it
}
@chetanmeh
chetanmeh / MultiplexingAuthorizableAction.java
Created October 19, 2012 14:42
DS sample to manage multiple references (SLING-2575)
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
import javax.jcr.*;
import org.apache.felix.scr.annotations.*;
import org.apache.jackrabbit.api.security.user.*;
import org.apache.jackrabbit.core.security.user.action.AbstractAuthorizableAction;
@chetanmeh
chetanmeh / sling-logging-categories.md
Last active December 10, 2015 23:38
Useful categories for logging in Sling

#Logging Categories

  • org.apache.sling.auth.core
  • org.apache.sling.engine
  • org.apache.sling.resourceresolver
  • org.apache.sling.jcr.resource
  • org.apache.sling.audit.osgi.installer - Audit logs of installation done by Sling OSGi Installer

#Web Console Url

@chetanmeh
chetanmeh / bundle.info
Created January 21, 2013 15:01
Felix 4.x bundle.info description
11 #Bundle Id
slinginstall:/path/to/foo.jar #Bundle original location
32 #Persistence State (INSTALLED, RESOLVED etc)
1 #Start level
1358768421064 #Last modified
0 #Refresh Count
@chetanmeh
chetanmeh / diffIntellijTestResult.groovy
Created March 7, 2013 09:12
Script to perform diff between two Intellij test run result which are exported as xml
/**
* Utility class that diffs 2 Intellij test runs and performs diff between the two runs. It works
* on xml report created by Intellij as mentioned in http://www.jetbrains.com/idea/webhelp/export-test-results.html
*
* How to run
*
* - Run first test suite and export the result as xml
* - Run first test suite again post change and export the result as xml
*
* Run the script
@chetanmeh
chetanmeh / .bashrc
Last active February 28, 2020 09:48
Script to launch a KDE Konsole window with multiple tabs. It is based on script provided in [Linux Journal](http://www.linuxjournal.com/content/start-and-control-konsole-dbus). It helps to bootstrap development env by launching multiple tabs with preconfigured directory and titles.
source ~/path/to/tabs.sh
load-dev(){
#Create sessi data format '<Tab Name/Title> <Profile Name> <Working Directory>'
local sessions=(
oak Shell 'clear; cd ~/git/apache/oak'
sling Shell 'clear; cd ~/git/apache/sling'
felix Shell 'clear; cd ~/git/apache/felix'
)
start_sessions sessions[@]
This scripts provide details related to various caches used in Oak MongoMK module while running within Sling OSGi Container
The script is based on (JAMM) [1]. Steps are provided below
1. Download JAMM from Maven
$wget http://repo1.maven.org/maven2/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
2. Modify the Quickstart launching by specifying agent and bootdelegation list
$java -javaagent:<path to>/jamm.jar -Dorg.apache.sling.launcher.bootdelegation=,org.github.jamm -jar
3. Deploy the Script Console jar
$wget http://repo1.maven.org/maven2/org/apache/sling/org.apache.sling.scripting.console/1.0.0/org.apache.sling.scripting.console-1.0.0.jar
$wget http://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.1.3/groovy-all-2.1.3.jar
@chetanmeh
chetanmeh / SessionSynchronizer.java
Created August 23, 2013 06:04
SessionSynchronizer - Demonstrates an example of using SessionOperationInterceptor https://issues.apache.org/jira/browse/OAK-960
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@chetanmeh
chetanmeh / logstash-cq.conf
Last active December 23, 2015 08:19
cq-logstash
#Logstash Config File for parsing existing Logs in Cq/Sling based application
input {
stdin {
type => "stdin-type"
}
file {
type => "cq-ci-author"
path => ["/path/crx-quickstart/logs/error.log"]
debug => false