This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.jcr.Node; | |
import javax.jcr.Session; | |
import org.apache.felix.scr.annotations.Component; | |
import org.apache.felix.scr.annotations.Property; | |
import org.apache.felix.scr.annotations.Reference; | |
import org.apache.felix.scr.annotations.Service; | |
import org.apache.sling.api.SlingConstants; | |
import org.apache.sling.event.EventUtil; | |
import org.apache.sling.event.JobProcessor; | |
import org.apache.sling.jcr.api.SlingRepository; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Serializable; | |
import java.util.Arrays; | |
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.Map; | |
import javax.jcr.Node; | |
import javax.jcr.Repository; | |
import javax.jcr.RepositoryException; | |
import javax.jcr.Session; | |
import javax.jcr.observation.Event; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String[] value2,value3; | |
private String value1; | |
@SuppressWarnings("unused") | |
@Activate | |
protected void activate(final Map<String, Object> config) { | |
//Read single value | |
this.value1 = PropertiesUtil.toString(config.get(VALUE1)); | |
//Read multivalue | |
this.value2=PropertiesUtil.toStringArray(config.get(VALUE2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.util.Dictionary; | |
import org.apache.felix.scr.annotations.Component; | |
import org.apache.felix.scr.annotations.Reference; | |
import org.apache.felix.scr.annotations.ReferenceCardinality; | |
import org.apache.felix.scr.annotations.ReferencePolicy; | |
import org.apache.felix.scr.annotations.Service; | |
import org.osgi.service.cm.Configuration; | |
import org.osgi.service.cm.ConfigurationAdmin; | |
import org.slf4j.Logger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service(value=<Your Class>.class) | |
@Component(label = "....", description = "..", metatype = true, immediate=true) | |
@Properties({ | |
@Property(name="service.description", value=".."), | |
@Property(name="service.vendor", value="..") | |
}) | |
public class <Your class> implements <Interface> { | |
//Single value | |
@Property(unbounded=PropertyUnbounded.DEFAULT,description=".....") | |
private static final String VALUE1 = "my.custom.value1"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
import java.util.Set; | |
import java.util.TreeMap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Iterator; | |
import java.util.Set; | |
import org.apache.sling.api.SlingHttpServletRequest; | |
import org.apache.sling.api.resource.Resource; | |
/** | |
* Custom Impression Provider Service | |
* @author Yogesh Upadhyay | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.day.crx.statistics.Entry; | |
import com.day.crx.statistics.PathBuilder; | |
/** | |
* Custom Impression Path Builder | |
* @author Yogesh Upadhyay | |
* | |
*/ | |
public class ImpressionsPathBuilder extends PathBuilder { | |
/** The name of the node that contains the statistical data about a page */ | |
public static final String STATS_NAME = ".stats"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date; | |
import org.apache.sling.api.resource.Resource; | |
/** | |
* Custom Page Impression Service | |
* @author Yogesh Upadhyay | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import javax.jcr.RepositoryException; | |
import org.apache.felix.scr.annotations.Activate; | |
import org.apache.felix.scr.annotations.Component; | |
import org.apache.felix.scr.annotations.Deactivate; | |
import org.apache.felix.scr.annotations.Reference; | |
import org.apache.felix.scr.annotations.Service; |