<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Developers, Developers, Developers!</title>
	<atom:link href="http://maksim.sorokin.dk/it/feed/" rel="self" type="application/rss+xml" />
	<link>http://maksim.sorokin.dk/it</link>
	<description>Maksim Sorokin IT Blog</description>
	<lastBuildDate>Sun, 05 Feb 2012 19:37:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Drupal 7 Views &#8212; Collapsible Grouping Field</title>
		<link>http://maksim.sorokin.dk/it/2012/02/05/drupal-7-views-collapsible-grouping-field/</link>
		<comments>http://maksim.sorokin.dk/it/2012/02/05/drupal-7-views-collapsible-grouping-field/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 19:37:38 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[drupa]]></category>
		<category><![CDATA[drupal 7]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=887</guid>
		<description><![CDATA[The idea for this solution was stolen somewhere from Drupal forums (cannot find the link now) and combined with this post. 1. Go to the edit page of the view 2. Click Advanced 3. Click Theme: Information 4. In the new window choose "Style output" 5. Copy the appeared code into new file "views-view-table.tpl.php". 6. [...]]]></description>
			<content:encoded><![CDATA[<p>The idea for this solution was stolen somewhere from Drupal forums (cannot find the link now) and combined with <a href="http://www.willhallonline.co.uk/blog/collapsible-fieldsets-drupal-7-nodes">this post</a>.</p>
<p>1. Go to the edit page of the view<br />
2. Click Advanced<br />
3. Click Theme: Information<br />
4. In the new window choose "Style output"<br />
5. Copy the appeared code into new file "views-view-table.tpl.php".<br />
6. Edit this new file. Add something like this (take a look onto highlighted lines):</p>
<pre class="brush: php; highlight: [21,22,23,24,25,26,51,53]; title: ;">
&lt;?php
/**
 * @file views-view-table.tpl.php
 * Template to display a view as a table.
 *
 * - $title : The title of this group of rows.  May be empty.
 * - $header: An array of header labels keyed by field id.
 * - $header_classes: An array of header classes keyed by field id.
 * - $fields: An array of CSS IDs to use for each field id.
 * - $classes: A class or classes to apply to the table, based on settings.
 * - $row_classes: An array of classes to apply to each row, indexed by row
 *   number. This matches the index in $rows.
 * - $rows: An array of row items. Each row is an array of content.
 *   $rows are keyed by row number, fields within rows are keyed by field ID.
 * - $field_classes: An array of classes to apply to each field, indexed by
 *   field id, then row number. This matches the index in $rows.
 * @ingroup views_templates
 */
?&gt;

&lt;?php drupal_add_js('misc/form.js'); ?&gt;
&lt;?php drupal_add_js('misc/collapse.js'); ?&gt;

&lt;fieldset class=&quot;collapsible collapsed&quot;&gt;
  &lt;legend&gt;&lt;span class=&quot;fieldset-legend&quot;&gt;&lt;?php if (!empty($title)) : ?&gt;&lt;?php print $title; ?&gt;&lt;?php endif; ?&gt;&lt;/span&gt;&lt;/legend&gt;
&lt;div class=&quot;fieldset-wrapper&quot;&gt;

&lt;table &lt;?php if ($classes) { print 'class=&quot;'. $classes . '&quot; '; } ?&gt;&lt;?php print $attributes; ?&gt;&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;?php foreach ($header as $field =&gt; $label): ?&gt;
        &lt;th &lt;?php if ($header_classes[$field]) { print 'class=&quot;'. $header_classes[$field] . '&quot; '; } ?&gt;&gt;
          &lt;?php print $label; ?&gt;
        &lt;/th&gt;
      &lt;?php endforeach; ?&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;?php foreach ($rows as $row_count =&gt; $row): ?&gt;
      &lt;tr class=&quot;&lt;?php print implode(' ', $row_classes[$row_count]); ?&gt;&quot;&gt;
        &lt;?php foreach ($row as $field =&gt; $content): ?&gt;
          &lt;td &lt;?php if ($field_classes[$field][$row_count]) { print 'class=&quot;'. $field_classes[$field][$row_count] . '&quot; '; } ?&gt;&lt;?php print drupal_attributes($field_attributes[$field][$row_count]); ?&gt;&gt;
            &lt;?php print $content; ?&gt;
          &lt;/td&gt;
        &lt;?php endforeach; ?&gt;
      &lt;/tr&gt;
    &lt;?php endforeach; ?&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;/div&gt;

&lt;/fieldset&gt;
</pre>
<p>7. Save the file<br />
8. Copy the file to the "templates" folder of the theme.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2012/02/05/drupal-7-views-collapsible-grouping-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PACKT] JBoss AS 7 Configuration, Deployment and Administration</title>
		<link>http://maksim.sorokin.dk/it/2012/01/06/packt-jboss-as-7-configuration-deployment-and-administration/</link>
		<comments>http://maksim.sorokin.dk/it/2012/01/06/packt-jboss-as-7-configuration-deployment-and-administration/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 17:23:17 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[jboss as 7]]></category>
		<category><![CDATA[PACKT]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=879</guid>
		<description><![CDATA[I have just been contacted from PACKT to review a book JBoss AS 7 Configuration, Deployment and Administration book. I agreed immediately, since PACKT releases quite good and qualitative stuff. In two words, as the title says, the JBoss AS 7 book deals with administration topics, new and advanced features of the JBoss Application Server [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.packtpub.com/jboss-as-7-configuration-deployment-administration/book?utm_source=touilleur-express.fr&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_009643"><img class="alignleft size-full wp-image-881" src="http://maksim.sorokin.dk/it/wp-content/uploads/2012/01/jbossas7.jpg" alt="" width="300" height="300" /></a> I have just been contacted from PACKT to review a book <a href="http://www.packtpub.com/jboss-as-7-configuration-deployment-administration/book?utm_source=touilleur-express.fr&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_009643">JBoss AS 7 Configuration, Deployment and Administration book</a>. I agreed immediately, since PACKT releases quite good and qualitative stuff.</p>
<p>In two words, as the title says, the JBoss AS 7 book deals with administration topics, new and advanced features of the JBoss Application Server 7. It seems like it is a must-have book for everyone using or looking forward to migrate/update to JBoss AS 7.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2012/01/06/packt-jboss-as-7-configuration-deployment-and-administration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Resources on Social Engineering</title>
		<link>http://maksim.sorokin.dk/it/2011/12/16/some-resources-on-social-engineering/</link>
		<comments>http://maksim.sorokin.dk/it/2011/12/16/some-resources-on-social-engineering/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 16:56:00 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[deception]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[social engineering]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=872</guid>
		<description><![CDATA[I have recently been to social engineering lecture by some security specialist. The presentation was ok. There were no surprises as I was interested in social engineering some time ago. However, there were some useful resources and and tools mentioned, which I want to list here: Google hacking database TinEye -- reverse image search SpoofCard [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently been to social engineering lecture by some security specialist. The presentation was ok. There were no surprises as I was interested in social engineering some time ago. However, there were some useful resources and and tools mentioned, which I want to list here:</p>
<ul>
<li><a href="http://www.exploit-db.com/google-dorks/">Google hacking database</a></li>
<li><a href="http://www.tineye.com/">TinEye</a> -- reverse image search</li>
<li><a href="http://www.spoofcard.com/">SpoofCard</a> -- caller ID spoofing</li>
<li>social-engineer.org has some <a href="http://www.social-engineer.org/podcast/">podcasts</a></li>
<li><a href="http://www.spyassociates.com/">Spying tools</a> (well, this is too insane, actually)</li>
<li><a href="http://www.longhornlockpicking.com/">Longhorn lock picking club</a></li>
<li><a href="http://www.pjrc.com/teensy/">Teensy USB</a> -- can be used for backdoor infection etc.</li>
<li><a href="http://theplugbot.com/">The PlugBot</a> -- fake power supply</li>
<li><a href="http://ctas.paterva.com/view/What_is_Maltego">Maltego</a> -- a tool for bringing a picture of the organization (hoes does different infrastructure elements relate to each other)</li>
<li><a href="http://www.shodanhq.com/">Shodan Search</a></li>
<li>books: <a href="http://www.amazon.com/Social-Engineering-Art-Human-Hacking/dp/0470639539">Social Engineering: The Art of Human Hacking</a>, <a href="http://www.amazon.co.uk/Emotions-Revealed-Understanding-Faces-Feelings/dp/0753817659">Emotions Revealed: Understanding Faces and Feelings</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/12/16/some-resources-on-social-engineering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Berlin &#8212; Google Developer Day 2011</title>
		<link>http://maksim.sorokin.dk/it/2011/11/22/berlin-google-developer-day-2011/</link>
		<comments>http://maksim.sorokin.dk/it/2011/11/22/berlin-google-developer-day-2011/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 11:40:11 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Berlin]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=864</guid>
		<description><![CDATA[Very well organized event. It was a good chance to talk to Google people and other developers that are interested in latest technologies from Google. However, some talks were more like common-sense and did not gave much new insights. Some talks were in how-to fashion. Furthermore, some presenters were somewhat unprepared and boring. Talks about [...]]]></description>
			<content:encoded><![CDATA[<p>Very well organized event. It was a good chance to talk to Google people and other developers that are interested in latest technologies from Google.</p>
<p>However, some talks were more like common-sense and did not gave much new insights. Some talks were in how-to fashion. Furthermore, some presenters were somewhat unprepared and boring. Talks about html5 were very tight to Google products and are not that well supported by other vendors. Several talks were done by Berlin universities people. Those were somewhat boring and abstract.</p>
<p>Anyhow, here are some photos:<br />
<img src="http://maksim.sorokin.dk/it/wp-content/uploads/2011/11/IMAG0408_small.jpg" alt="" class="alignnone size-full wp-image-865" /><br />
<img src="http://maksim.sorokin.dk/it/wp-content/uploads/2011/11/IMAG0410_small.jpg" alt="" class="alignnone size-full wp-image-866" /><br />
<img src="http://maksim.sorokin.dk/it/wp-content/uploads/2011/11/IMAG0414_small.jpg" alt="" class="alignnone size-full wp-image-867" /></p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/11/22/berlin-google-developer-day-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java SE 7 Certificates Are Almost Out!</title>
		<link>http://maksim.sorokin.dk/it/2011/10/04/java-se-7-certificates-are-almost-out/</link>
		<comments>http://maksim.sorokin.dk/it/2011/10/04/java-se-7-certificates-are-almost-out/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 13:09:47 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=842</guid>
		<description><![CDATA[Check the Oracle certification page. Java SE 7 certificates are now in beta (programmer certificate is not available yet, however). The price is 50$, instead of ordinary 300$. However, it has twice more questions and is twice longer.]]></description>
			<content:encoded><![CDATA[<p>Check the <a href="http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=140">Oracle certification page</a>. Java SE 7 certificates are now in beta (programmer certificate is not available yet, however). The price is 50$, instead of ordinary 300$. However, it has twice more questions and is twice longer.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/10/04/java-se-7-certificates-are-almost-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven + Apache Felix + CXF + DOSGi: An Example of DOSGi Service</title>
		<link>http://maksim.sorokin.dk/it/2011/09/18/maven-apache-felix-cxf-dosgi-an-example-of-dosgi-service/</link>
		<comments>http://maksim.sorokin.dk/it/2011/09/18/maven-apache-felix-cxf-dosgi-an-example-of-dosgi-service/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 22:04:29 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache Felix]]></category>
		<category><![CDATA[DOSGi]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=827</guid>
		<description><![CDATA[Link in series Link to two Felix instances Here is yet another post in Maven + Apache Felix + CXF + DOSGi series. Here I will show how to use Apache CXF DOSGi for cosuming remote services. You may see the sources on my GitHub account. We will have three projects dosgiRemote.service, dosgiRemote.service.api and dosgiRemote.consumer. [...]]]></description>
			<content:encoded><![CDATA[<p>Link in series</p>
<p>Link to two Felix instances</p>
<p>Here is yet another post in <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-cxf-dosgi-series/">Maven + Apache Felix + CXF + DOSGi series</a>.</p>
<p>Here I will show how to use <a href="http://cxf.apache.org/dosgi-releases.html">Apache CXF DOSGi</a> for cosuming remote services. You may see the sources on <a href="https://github.com/mah01/examples/tree/master/dosgiRemote">my GitHub account</a>.</p>
<p>We will have <span id="more-827"></span> three projects <code>dosgiRemote.service</code>, <code>dosgiRemote.service.api</code> and <code>dosgiRemote.consumer</code>. <code>dosgiRemote.service.api</code> provides an interface for a service. <code>dosgiRemote.service</code> provides implementation for the service. <code>dosgiRemote.consume</code> will consume the service.<br />
<code>dosgiRemote.service.api</code> has to be shared between <code>dosgiRemote.service</code> and <code>dosgiRemote.consumer</code> as both has to know which service they are publishing and consuming. <code>dosgiRemote.service.api</code> and <code>dosgiRemote.service</code> will run in one OSGi container. <code>dosgiRemote.service.api</code> and <code>dosgiRemote.consumer</code> will run in another OSGi container. You may see how to do that in Eclipse in the <a href="http://maksim.sorokin.dk/it/2011/08/11/apache-felix-running-two-instances-of-felix-launcher-in-the-eclipse/">previous post</a>.</p>
<p><code>dosgiRemote.service.api</code> contains the following interface to a service:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiRemote.service.api;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path(&quot;greeter&quot;)
public interface Greeter {

  @GET
  @Path(&quot;sayHello/{name}&quot;)
  @Produces(MediaType.TEXT_PLAIN)
  String sayHello(@PathParam(&quot;name&quot;) String name);
}
</pre>
<p><code>dosgiRemote.service</code> provides the following implementation:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiRemote.internal.service;

import dk.sorokin.maksim.dosgiRemote.service.api.Greeter;

public class GreeterImpl implements Greeter {

  public String sayHello(String name) {
    return &quot;Hello, &quot; + name;
  }
}
</pre>
<p>Also, <code>dosgiRemote.service</code> registers a service in the following way:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiRemote.internal;

import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import dk.sorokin.maksim.dosgiRemote.internal.service.GreeterImpl;
import dk.sorokin.maksim.dosgiRemote.service.api.Greeter;

public class Activator implements BundleActivator {

  public void start(BundleContext context) throws Exception {
    Dictionary&lt;String, String&gt; restProps = new Hashtable&lt;String, String&gt;();

    restProps.put(&quot;service.exported.interfaces&quot;, &quot;*&quot;);
    restProps.put(&quot;service.exported.configs&quot;, &quot;org.apache.cxf.rs&quot;);
    restProps.put(&quot;service.exported.intents&quot;, &quot;HTTP&quot;);
    restProps.put(&quot;org.apache.cxf.rs.address&quot;, &quot;http://localhost:8080/&quot;);
    context.registerService(Greeter.class.getName(), new GreeterImpl(), restProps);
  }

  public void stop(BundleContext context) throws Exception {
    //
  }
}
</pre>
<p><code>dosgiRemote.consumer</code> will have <code>OSGI-INF\remote-service\remote-services.xml</code>, according to <a href="http://cxf.apache.org/distributed-osgi-reference.html#DistributedOSGiReference-%7B%7Bremoteservices.xml%7D%7Dfiles">DOSGi documentation</a>:</p>
<pre class="brush: xml; title: ;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;service-descriptions xmlns=&quot;http://www.osgi.org/xmlns/sd/v1.0.0&quot;&gt;
  &lt;service-description&gt;
    &lt;provide interface=&quot;dk.sorokin.maksim.dosgiRemote.service.api.Greeter&quot; /&gt;
    &lt;property name=&quot;service.exported.interfaces&quot;&gt;*&lt;/property&gt;
    &lt;property name=&quot;service.exported.configs&quot;&gt;org.apache.cxf.rs&lt;/property&gt;
    &lt;property name=&quot;service.exported.intents&quot;&gt;HTTP&lt;/property&gt;
    &lt;property name=&quot;org.apache.cxf.rs.address&quot;&gt;http://localhost:8080&lt;/property&gt;
  &lt;/service-description&gt;
&lt;/service-descriptions&gt;
</pre>
<p>And the Activator class for <code>dosgiRemote.consumer</code> will be:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiRemote.consumer.internal;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;

import dk.sorokin.maksim.dosgiRemote.service.api.Greeter;

public class Activator implements BundleActivator {

  @Override
  public void start(BundleContext context) throws Exception {
    ServiceTracker serviceTracker = new ServiceTracker(context, Greeter.class.getName(), null) {
      @Override
      public Object addingService(ServiceReference reference) {
        Object result = super.addingService(reference);

        Object svc = context.getService(reference);
        if (svc instanceof Greeter) {
          final Greeter greeter = (Greeter) svc;
          System.out.println(greeter.sayHello(&quot;Max&quot;));
        }

        return result;
      }
    };
    serviceTracker.open();
  }

  public void stop(BundleContext context) throws Exception {
    //
  }
}
</pre>
<p>We will have two startup configuration for Apache Felix, as described above. The first one:</p>
<pre class="brush: plain; title: ;">
felix.auto.deploy.action=install,start
felix.log.level=1

org.osgi.framework.storage.clean=onFirstInit

felix.auto.start.1 = \
 assembly:/C:/projects/dosgiRemote/dosgiRemote.service.api/target/classes \
 assembly:/C:/projects/dosgiRemote/dosgiRemote.service/target/classes
</pre>
<p>And the second one:</p>
<pre class="brush: plain; title: ;">
felix.auto.deploy.action=install,start
felix.log.level=1

org.osgi.framework.storage.clean=onFirstInit

felix.auto.start.1 = \
 assembly:/C:/projects/dosgiRemote/dosgiRemote.service.api/target/classes \
 assembly:/C:/projects/dosgiRemote/dosgiRemote.service/target/classes
</pre>
<p>Launch the first configuration and then the second. You should see the following message in the console:</p>
<pre class="brush: plain; title: ;">
Hello, Max
</pre>
<p>You could also see the same message in the browser on <a href="http://localhost:8080/greeter/sayHello/Max">http://localhost:8080/greeter/sayHello/Max</a>.</p>
<p>You may pass objects as well. Refer to <a href="http://maksim.sorokin.dk/it/2011/07/24/maven-apache-felix-cxf-creating-a-restful-webservice-with-cxf-returning-and-object/">previous</a> <a href="http://maksim.sorokin.dk/it/2011/07/26/maven-apache-felix-cxf-creating-a-restful-webservice-with-cxf-consuming-an-object/">posts</a> to do that.</p>
<p>You can take the sources from may <a href="https://github.com/mah01/examples/tree/master/dosgiRemote">GitHub account</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/09/18/maven-apache-felix-cxf-dosgi-an-example-of-dosgi-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Felix: Running Two Instances of Felix Launcher in The Eclipse</title>
		<link>http://maksim.sorokin.dk/it/2011/08/11/apache-felix-running-two-instances-of-felix-launcher-in-the-eclipse/</link>
		<comments>http://maksim.sorokin.dk/it/2011/08/11/apache-felix-running-two-instances-of-felix-launcher-in-the-eclipse/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 08:00:00 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache Felix]]></category>
		<category><![CDATA[CXF]]></category>
		<category><![CDATA[DOSGi]]></category>
		<category><![CDATA[OSGi]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=829</guid>
		<description><![CDATA[This is a next post in Maven + Apache Felix + CXF + DOSGi series. As was shown in the first post, one my have a separate project for Apache Felix in conveniently launch it using Eclipse. You need to have two instance of Apache Felix running in the same Eclipse, for example if you [...]]]></description>
			<content:encoded><![CDATA[<p>This is a next post in <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-cxf-dosgi-series/">Maven + Apache Felix + CXF + DOSGi series</a>.</p>
<p>As was shown in the <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-easy-development-and-debugging-with-eclipse/">first post</a>, one my have a separate project for Apache Felix in conveniently launch it using Eclipse.</p>
<p>You need to have two instance of Apache Felix running in the same Eclipse, for example if you are testing DOSGi remote services between different OSGi instances. </p>
<p>First, you will need to have two Apache Felix configurations. The first one can be default: <code>conf\config.properties</code>:</p>
<pre class="brush: plain; title: ;">
felix.auto.deploy.action=install,start
felix.log.level=1

org.osgi.framework.storage.clean=onFirstInit

felix.auto.start.1 = ...
</pre>
<p>Then you need to have second one for the second instance. Let's create it here: <code>conf\secondConfig.properties</code>:</p>
<pre class="brush: plain; title: ;">
felix.auto.deploy.action=install,start
felix.log.level=1

org.osgi.framework.storage.clean=onFirstInit

org.osgi.service.http.port=8081
org.osgi.framework.storage=secondCache

felix.auto.start.1= ...
</pre>
<p>Note <code>org.osgi.service.http.port</code> and <code>org.osgi.framework.storage</code>. Former is needed to tell OSGi to use different http port. The latter one specifies different cache for OSGi bundle (by default it is <code>felix-cache</code>), which is used to contain all started bundles.</p>
<p>Then the start configuration is the same as was described in the <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-easy-development-and-debugging-with-eclipse/">first post</a>. For the second configuration one has to provide a location of <code>conf\secondConfig.properties</code>. In "VM arguments" specify:</p>
<pre class="brush: plain; title: ;">
-Dfelix.config.properties=file:conf/secondConfig.properties
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/08/11/apache-felix-running-two-instances-of-felix-launcher-in-the-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven + Apache Felix: Strategy to Handle non-OSGi Dependencies</title>
		<link>http://maksim.sorokin.dk/it/2011/08/09/maven-apache-felix-strategy-to-handle-non-osgi-dependencies/</link>
		<comments>http://maksim.sorokin.dk/it/2011/08/09/maven-apache-felix-strategy-to-handle-non-osgi-dependencies/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 16:06:47 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache Felix]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[OSGi]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=821</guid>
		<description><![CDATA[This is another post in Maven + Apache Felix + CXF + DOSGi series. Sometimes in the project plain Maven dependencies has to be used. A simple strategy to use those in OSGi project handled by Maven is to have a separate module, containing all non-OSGi dependencies and converting those to OSGi bundles using Apache [...]]]></description>
			<content:encoded><![CDATA[<p>This is another post in <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-cxf-dosgi-series/">Maven + Apache Felix + CXF + DOSGi series</a>.</p>
<p>Sometimes in the project plain Maven dependencies has to be used. A simple strategy to use those in OSGi project handled by Maven is to have a separate module, containing all non-OSGi dependencies and converting those to OSGi bundles using <a href="http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html">Apache Felix Maven Bundle Plugin</a>.<br />
So one may have the following structure of the project:</p>
<pre class="brush: plain; title: ;">
project
    ...
    project.nonOsgiDependencies
        project.nonOsgiDependencies.base64
        project.nonOsgiDependencies.mysqlConnector
        project.nonOsgiDependencies.xercesImpl
</pre>
<p>This <code>nonOsgiDependencies</code> projects would contain <span id="more-821"></span> just a <code>pom.xml</code> file, which would have a dependency on required maven dependency and would use <a href="http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html">maven-bundle-plugin</a> to wrap it. Here is an example of such <code>pom.xml</code> for <code>net.iharder:base64</code></p>
<pre class="brush: xml; title: ;">
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

  &lt;parent&gt;
    &lt;artifactId&gt;project.nonOsgiDependencies&lt;/artifactId&gt;
    &lt;groupId&gt;dk.sorokin.maksim&lt;/groupId&gt;
    &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;

  &lt;artifactId&gt;ecosystem.nonOsgiDependencies.base64&lt;/artifactId&gt;

  &lt;name&gt;net.iharder:base64 Maven Dependency&lt;/name&gt;

  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
        &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;wrap-dependency&lt;/id&gt;
            &lt;goals&gt;
              &lt;goal&gt;bundle&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;instructions&gt;
                &lt;Embed-Dependency&gt;*&lt;/Embed-Dependency&gt;
                &lt;Export-Package&gt;net.iharder&lt;/Export-Package&gt;
              &lt;/instructions&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;

  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;net.iharder&lt;/groupId&gt;
      &lt;artifactId&gt;base64&lt;/artifactId&gt;
      &lt;version&gt;2.3.8&lt;/version&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
&lt;/project&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/08/09/maven-apache-felix-strategy-to-handle-non-osgi-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven + Apache Felix + CXF: Securing a Service with HTTP Basic Authentication</title>
		<link>http://maksim.sorokin.dk/it/2011/08/06/maven-apache-felix-cxf-securing-a-service-with-http-basic-authentication/</link>
		<comments>http://maksim.sorokin.dk/it/2011/08/06/maven-apache-felix-cxf-securing-a-service-with-http-basic-authentication/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 08:35:32 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[basic authentication]]></category>
		<category><![CDATA[CXF]]></category>
		<category><![CDATA[DOSGi]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=808</guid>
		<description><![CDATA[This is another post in series Maven + Apache Felix + CXF + DOSGi Series. Here I will describe how to secure CXF published web services with HTTP basic authentication. You can find the sources on my GitHub account. We will have three projects here. The first one defines an interface for a service. Another [...]]]></description>
			<content:encoded><![CDATA[<p>This is another post in series <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-cxf-dosgi-series/">Maven + Apache Felix + CXF + DOSGi Series</a>. Here I will describe how to secure CXF published web services with HTTP basic authentication. You can find the sources on <a href="https://github.com/mah01/examples/tree/master/dosgiSecurity">my GitHub account</a>.</p>
<p>We will have three projects here. The first one defines an interface for a service. Another one provides implementation for it. And the third one will provide security.</p>
<pre class="brush: plain; title: ;">
dosgiSecurity
    dosgiSecurity-api
    dosgiSecurity-impl
    dosgiSecurity-security
</pre>
<p><code>dosgiSecurity</code> will be just a holder project.</p>
<p>Our interface <code>HelloService</code> in bundle <code>dosgiSecurity-api</code> will be similar to the one we defined in<span id="more-808"></span> previous posts:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiSecurity.api;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path(&quot;helloService&quot;)
public interface HelloService {

  @GET
  @Path(&quot;sayHello/{name}&quot;)
  @Produces(MediaType.TEXT_PLAIN)
  String sayHello(@PathParam(&quot;name&quot;) String name);
}
</pre>
<p>And implementation class <code>HelloServiceImpl</code> in bundle <code>dosgiSecurity-impl</code>:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiSecurity.impl.internal.service;

import dk.sorokin.maksim.dosgiSecurity.api.HelloService;

public class HelloServiceImpl implements HelloService {

  public String sayHello(String name) {
    return &quot;Hello &quot; + name;
  }
}
</pre>
<p>And <code>SecurityFilter</code> in bundle <code>dosgiSecurity-security</code>, is just a servlet filter. It checks for <code>Authorization</code> header and verifies it:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiSecurity.impl.internal.service;

import dk.sorokin.maksim.dosgiSecurity.api.HelloService;

public class HelloServiceImpl implements HelloService {

  public String sayHello(String name) {
    return &quot;Hello &quot; + name;
  }
}
</pre>
<p>The service is published in an <code>Activator</code> in <code>dosgiSecurity.impl</code>:</p>
<pre class="brush: java; title: ;">
package dk.sorokin.maksim.dosgiSecurity.impl.internal;

import java.util.Dictionary;
import java.util.Hashtable;

import javax.servlet.Filter;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import dk.sorokin.maksim.dosgiSecurity.api.HelloService;
import dk.sorokin.maksim.dosgiSecurity.impl.internal.service.HelloServiceImpl;
import dk.sorokin.maksim.dosgiSecurity.security.SecurityFilter;

public class Activator implements BundleActivator {

  public void start(BundleContext context) throws Exception {
    Dictionary&lt;String, String&gt; restProps = new Hashtable&lt;String, String&gt;();

    restProps.put(&quot;service.exported.interfaces&quot;, &quot;*&quot;);
    restProps.put(&quot;service.exported.configs&quot;, &quot;org.apache.cxf.rs&quot;);
    restProps.put(&quot;service.exported.intents&quot;, &quot;HTTP&quot;);
    restProps.put(&quot;org.apache.cxf.rs.httpservice.context&quot;, &quot;/secured&quot;);
    restProps.put(&quot;org.apache.cxf.rs.address&quot;, &quot;http://localhost:8080/&quot;);
    context.registerService(HelloService.class.getName(), new HelloServiceImpl(), restProps);

    Dictionary&lt;String, String&gt; filterProps = new Hashtable&lt;String, String&gt;();
    filterProps.put(&quot;org.apache.cxf.httpservice.filter&quot;, Boolean.TRUE.toString());
    filterProps.put(&quot;servletNames&quot;, &quot;none&quot;);
    context.registerService(Filter.class.getName(), new SecurityFilter(), filterProps);
  }

  public void stop(BundleContext context) throws Exception {
    //
  }
}
</pre>
<p>And a Felix Launcher (refer to the <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-easy-development-and-debugging-with-eclipse/">first post in series</a>) is:</p>
<pre class="brush: plain; title: ;">
felix.auto.deploy.action=install,start
felix.log.level=1

org.osgi.framework.storage.clean=onFirstInit

felix.auto.start.1 = \
 assembly:/C:/projects/dosgiSecurity/dosgiSecurity.security/target/classes \
 assembly:/C:/projects/dosgiSecurity/dosgiSecurity.api/target/classes \
 assembly:/C:/projects/dosgiSecurity/dosgiSecurity.impl/target/classes
</pre>
<p>Now build all that with Maven using <code>mvn clean install</code> and run it (assuming that you have DOSGi Single Bundle Distribution in Felix, as we discussed in previous posts). When Felix is launched, go to <a href="http://localhost:8080/secured/helloService/sayHello/Max">http://localhost:8080/secured/helloService/sayHello/Max</a>. You should see:</p>
<pre class="brush: plain; title: ;">
HTTP ERROR: 403

FORBIDDEN
RequestURI=/secured/helloService/sayHello/Max

Powered by Jetty://
</pre>
<p>Now launch Fiddler2 (or similar program) and build custom request with Request Builder with the same url as shown above. And add the following line in "Request Headers":</p>
<pre class="brush: plain; title: ;">
Authorization: Basic U3V6eTpyb2NrZXQ=
</pre>
<p>You should get:</p>
<pre class="brush: plain; title: ;">
HTTP/1.1 200 OK
Content-Type: text/plain
Date: Tue, 02 Aug 2011 15:15:43 GMT
Content-Length: 9
Server: Jetty(6.1.x)

Hello max
</pre>
<p>Source files can be found <a href="https://github.com/mah01/examples/tree/master/dosgiSecurity">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/08/06/maven-apache-felix-cxf-securing-a-service-with-http-basic-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven + Apache Felix + CXF: RESTful Webservice with CXF. Using POST.</title>
		<link>http://maksim.sorokin.dk/it/2011/08/02/maven-apache-felix-cxf-restful-webservice-with-cxf-using-post/</link>
		<comments>http://maksim.sorokin.dk/it/2011/08/02/maven-apache-felix-cxf-restful-webservice-with-cxf-using-post/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 15:32:35 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache Felix]]></category>
		<category><![CDATA[CXF]]></category>
		<category><![CDATA[DOSGi]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=786</guid>
		<description><![CDATA[It is another post in Maven + Apache Felix + CXF + DOSGi Series. In this post I showed you how to create a RESTful webservice consuming and creating a String. However, the example was using @GET method. Here I will show, what changes need to be done in order to consume input from @POST. [...]]]></description>
			<content:encoded><![CDATA[<p>It is another post in <a href="http://maksim.sorokin.dk/it/2011/07/19/maven-apache-felix-cxf-dosgi-series/">Maven + Apache Felix + CXF + DOSGi Series</a>.</p>
<p>In <a href="http://maksim.sorokin.dk/it/2011/07/21/maven-apache-felix-cxf-creating-a-restful-webservice-with-cxf-a-simple-string-example/">this post</a> I showed you how to create a RESTful webservice consuming and creating a String. However, the example was using <code>@GET</code> method. Here I will show, what changes need to be done in order to consume input from <code>@POST</code>. As usual, sources are available in the end of the post.</p>
<p>Simply change <code>@GET</code> to <code>@POST</code> and remove <span id="more-786"></span> <code>@PathParam("name")</code> from <code>MyService</code> webservice interface:</p>
<pre class="brush: java; title: ;">
package test.bundle;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path(&quot;myService&quot;)
public interface MyService {

  @POST
  @Path(&quot;sayHello&quot;)
  @Produces(MediaType.TEXT_PLAIN)
  String sayHello(String name);
}
</pre>
<p>Then you can make POST requests to http://localhost:8080/myService/sayHello with request body. I suggest using <a href="http://www.fiddler2.com/fiddler2/">Fiddler2</a> tool for debugging.</p>
<p>If you want to consume object (well, XML and then convert it into object), you will need to create <a href="http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-CustomMessageBodyProviders">message body reader</a> and reference it in the Activator. An example of message body reader could be:</p>
<pre class="brush: java; title: ;">
package dk.codeunited.ecosystem.integration.myRecord.pub.api;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.Provider;

import dk.codeunited.ecosystem.integration.myRecord.pub.api.pojos.Logbook;

@Provider
public class MyMessageReaderProvider implements MessageBodyReader&lt;MyMessage&gt; {

  @Override
  public boolean isReadable(Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mt) {
    return true;
  }

  @Override
  public MyMessage readFrom(Class&lt;MyMessage&gt; clazz, Type t, Annotation[] a, MediaType mt,
      MultivaluedMap&lt;String, String&gt; headers, InputStream is) {
    // reader an object from InputStream
  }
}
</pre>
<p>And then registration in Activator:</p>
<pre class="brush: java; title: ;">
    restProps.put(&quot;org.apache.cxf.rs.provider&quot;, MyMessageReaderProvider.class.getName());
</pre>
<p><a href='http://maksim.sorokin.dk/it/wp-content/uploads/2011/07/felix_post.zip'>Here are source to POST example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2011/08/02/maven-apache-felix-cxf-restful-webservice-with-cxf-using-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

