Skip to content

Instantly share code, notes, and snippets.

@aanchalsikka
aanchalsikka / SampleComponentImpl.java
Created November 13, 2017 10:51
Sample Component with DS annotations
package blog.techrevel.component.impl;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Deactivate;
@Component(name = "Sample Component", property = { "testProperty=Hello" })
@aanchalsikka
aanchalsikka / MultipleComponentPropertiesImpl.java
Created November 13, 2017 11:09
Multiple Component Properties
package blog.techrevel.component.impl;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Deactivate;
@Component(property = { "testProperty1=Hello", "testProperty2=World" })
@aanchalsikka
aanchalsikka / ComponentMultivaluedPropertyImpl.java
Created November 13, 2017 11:20
Multiple values of a propertya
package blog.techrevel.component.impl;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
@aanchalsikka
aanchalsikka / ConfigurableComponentPorpertiesImpl.java
Last active November 13, 2017 12:43
Creating configurable properties
package blog.techrevel.component.impl;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.AttributeType;
import org.osgi.service.metatype.annotations.Designate;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.osgi.service.metatype.annotations.Option;
import org.slf4j.Logger;
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr2dav</artifactId>
<version>2.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr2spi</artifactId>
<version>2.4.0</version>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- <Embed-Dependency> artifactId1, artifactId2;inline=true </Embed-Dependency> -->
<Export-Package>
blog.techrevel.service
</Export-Package>
package blog.techrevel.servlet;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
package blog.techrevel.api;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import org.apache.commons.codec.binary.Base64;
package blog.techrevel.api;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CurlExecutor2 {
public static void main(String[] args) {
<div data-sly-resource="${'/content/techrevel/blog/' @ resourceType='techrevel/components/content/example'}"></div>