{"id":70,"date":"2017-11-14T12:04:24","date_gmt":"2017-11-14T11:04:24","guid":{"rendered":"http:\/\/people.unipi.it\/giacomo_tanganelli\/?page_id=70"},"modified":"2017-12-18T10:53:53","modified_gmt":"2017-12-18T09:53:53","slug":"om2m-installation","status":"publish","type":"page","link":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/","title":{"rendered":"OM2M Installation"},"content":{"rendered":"<h1 id=\"prerequisites\">Prerequisites<\/h1>\n<ul>\n<li>Git<\/li>\n<li>Apache Maven<\/li>\n<li>Oracle Java 8<\/li>\n<\/ul>\n<h4 id=\"install-git\">Install Git<\/h4>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span>sudo apt-get install git\r\n<\/code><\/pre>\n<\/div>\n<h4 id=\"install-apache-maven\">Install Apache Maven<\/h4>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span>sudo apt-get install maven\r\n<\/code><\/pre>\n<\/div>\n<h4 id=\"install-oracle-java-8\">Install Oracle Java 8<\/h4>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span>sudo add-apt-repository ppa:webupd8team\/java\r\n<span class=\"gp\">$ <\/span>sudo apt-get update\r\n<span class=\"gp\">$ <\/span>sudo apt-get install oracle-java8-installer\r\n<\/code><\/pre>\n<\/div>\n<h5 id=\"configure-javahome\">Configure JAVA_HOME<\/h5>\n<p>To set this environment variable, we will first need to find out where Java is installed. You can do this by executing:<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span>sudo update-alternatives --config java\r\n<\/code><\/pre>\n<\/div>\n<p>Copy the path from your preferred installation and then open\u00a0<code class=\"highlighter-rouge\">\/etc\/environment<\/code>\u00a0using nano or your favorite text editor.<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span>sudo nano \/etc\/environment\r\n<\/code><\/pre>\n<\/div>\n<p>At the end of this file, add the following line, making sure to replace the highlighted path with your own copied path.<\/p>\n<div class=\"language-vim highlighter-rouge\">\n<pre class=\"highlight\"><code>JAVA_HOME<span class=\"p\">=<\/span><span class=\"s2\">\"\/usr\/lib\/jvm\/java-8-oracle\"<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p>Save and exit the file, and reload it.<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span><span class=\"nb\">source<\/span> \/etc\/environment\r\n<\/code><\/pre>\n<\/div>\n<p>You can now test whether the environment variable has been set by executing the following command:<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span><span class=\"nb\">echo<\/span> <span class=\"nv\">$JAVA_HOME<\/span><\/code><\/pre>\n<p>This will return the path you just set.<\/p>\n<h1 id=\"configure-eclipse-for-developing-om2m\">Configure Eclipse for developing oM2M<\/h1>\n<p>First of all, install the lastest\u00a0<a href=\"http:\/\/www.eclipse.org\/downloads\/packages\/eclipse-rcp-and-rap-developers\/neon1a\">Eclipse for RCP and RAP Developers<\/a>\u00a0(at time of writing Eclipse Neon 1).<\/p>\n<h3 id=\"install-tycho-plugin\">Install Tycho Plugin<\/h3>\n<p>Click Window -&gt; Preferences -&gt; maven -&gt; discovery -&gt; open catalog and type Tycho. Check the \u201cTycho Configurator\u201d checkbox and install the connector.<\/p>\n<h3 id=\"clone-om2m-repository\">Clone oM2M repository<\/h3>\n<ul>\n<li>Select Window-&gt;Show View -&gt; Other.<\/li>\n<li>In the dialog box, select the Git view.<\/li>\n<li>Click on \u201cClone a Git repository\u201d.<\/li>\n<li>In the URI form type: https:\/\/git.eclipse.org\/r\/om2m\/org.eclipse.om2m<\/li>\n<li>In the second page, keep\u00a0<strong>ONLY<\/strong>\u00a0the \u201cmaster\u201d branch checkbox selected and click Next.<\/li>\n<li>In the third page, check the \u201cimport all existing projects after clone finishes\u201d and click \u201cFinish\u201d.<\/li>\n<li>This will clone the oM2M repository inside:\u00a0<code class=\"highlighter-rouge\">$HOME\/git\/<\/code><\/li>\n<\/ul>\n<h1 id=\"debug-mn-cse\">Enable CoAP on\u00a0MN<\/h1>\n<p>In order to enable CoAP an the MN edit the <code class=\"highlighter-rouge\">$HOME\/git\/om2m\/org.eclipse.om2m\/org.eclipse.om2m.site.mn-cse\/om2m.product<\/code>:<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">&lt;plugins&gt;<\/span>\r\n<span class=\"gp\">...<\/span>\r\n<span class=\"gp\">&lt;plugin id=\"org.eclipse.jetty.util\"\/&gt;<\/span>\r\n<span class=\"gp\">&lt;plugin id=\"org.eclipse.om2m.binding.coap\"\/&gt;<\/span>\r\n<span class=\"gp\">&lt;plugin id=\"org.eclipse.om2m.binding.http\"\/&gt;<\/span>\r\n<span class=\"gp\">...<\/span>\r\n<span class=\"gp\">&lt;\/plugins&gt;<\/span>\r\n<span class=\"gp\">...<\/span>\r\n&lt;configurations&gt;\r\n...\r\n&lt;plugin id=\"org.eclipse.equinox.http.jetty\" autoStart=\"true\" startLevel=\"1\" \/&gt;\r\n&lt;plugin id=\"org.eclipse.om2m.binding.coap\" autoStart=\"true\u201d startLevel=\"2\" \/&gt;\r\n&lt;plugin id=\"org.eclipse.om2m.binding.http\" autoStart=\"true\" startLevel=\"2\" \/&gt;\r\n...\r\n&lt;\/configurations&gt;\r\n<span class=\"gp\">...<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p>Then edit the code of\u00a0<code class=\"highlighter-rouge\">$HOME\/git\/org.eclipse.om2m\/org.eclipse.om2m.binding.coap\/src\/main\/java\/org\/eclipse\/om2m\/binding\/coap\/CoAPServer.java<\/code>,\u00a0change line 145 from:<\/p>\n<div class=\"language-java highlighter-rouge\">\n<pre class=\"highlight\"><code>requestPrimitive.setTo(request.getUri());<\/code><\/pre>\n<\/div>\n<p>to:<\/p>\n<div class=\"language-java highlighter-rouge\">\n<pre class=\"highlight\"><code>requestPrimitive.setTo(targetId);<\/code><\/pre>\n<\/div>\n<p><a name=\"notifications\"><\/a><\/p>\n<h4 id=\"install-oracle-java-8\">CoAP Notifications<\/h4>\n<p>Edit the code of <code class=\"highlighter-rouge\">$HOME\/git\/org.eclipse.om2m\/org.eclipse.om2m.binding.coap\/src\/main\/java\/org\/eclipse\/om2m\/binding\/coap\/CoAPClient.java<\/code>, at line 334 change the switch statements according to:<\/p>\n<div class=\"language-java highlighter-rouge\">\n<pre class=\"highlight\"><code>\r\n case 69: return ResponseStatusCode.OK;\r\n case 68: return ResponseStatusCode.ACCEPTED;\r\n case 65: return ResponseStatusCode.CREATED; \r\n case 66: return ResponseStatusCode.DELETED;\r\n case 128: return ResponseStatusCode.BAD_REQUEST;\r\n case 131: return ResponseStatusCode.ACCESS_DENIED;\r\n case 132: return ResponseStatusCode.NOT_FOUND;\r\n case 133: return ResponseStatusCode.OPERATION_NOT_ALLOWED;\r\n case 134: return ResponseStatusCode.CONFLICT;\r\n case 160: return ResponseStatusCode.INTERNAL_SERVER_ERROR;\r\n case 161: return ResponseStatusCode.NOT_IMPLEMENTED;\r\n case 163: return ResponseStatusCode.SERVICE_UNAVAILABLE;\r\n default: return ResponseStatusCode.INTERNAL_SERVER_ERROR;\r\n<\/code><\/pre>\n<\/div>\n<p>Finally, change the code of <code class=\"highlighter-rouge\">$HOME\/git\/org.eclipse.om2m\/org.eclipse.om2m.core\/src\/main\/java\/org\/eclipse\/om2m\/core\/notifier\/Notifier.java<\/code>,\u00a0change line 310 from:<\/p>\n<div class=\"language-java highlighter-rouge\">\n<pre class=\"highlight\"><code>if(ResponseStatusCode.OK.equals(response.getResponseStatusCode())){<\/code><\/pre>\n<\/div>\n<p>to:<\/p>\n<div class=\"language-java highlighter-rouge\">\n<pre class=\"highlight\"><code>if(ResponseStatusCode.CREATED.equals(response.getResponseStatusCode())){<\/code><\/pre>\n<\/div>\n<h1 id=\"build-om2m\">Build oM2M<\/h1>\n<h3 id=\"build-from-shell\">Build from shell<\/h3>\n<p>Replace the $HOME with your home folder path.<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"gp\">$ <\/span><span class=\"nb\">cd<\/span> <span class=\"nv\">$HOME<\/span>\/git\r\n<span class=\"gp\">$ <\/span>mvn clean install\r\n<\/code><\/pre>\n<\/div>\n<h3 id=\"build-from-eclipse\">Build from Eclipse<\/h3>\n<ul>\n<li>Select \u201corg.eclipse.om2m\u201d package and right click<\/li>\n<li>Select \u201cRun as -&gt; maven install\u201d<\/li>\n<\/ul>\n<h4 id=\"build-results\">Build Results<\/h4>\n<p>Two Eclipse products will be generated after a successful built: * The IN product can be found on this\u00a0<em>generic<\/em>\u00a0directory:<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"nv\">$HOME<\/span>\/git\/om2m\/org.eclipse.om2m\/org.eclipse.om2m.site.in-cse\/target\/products\/in-cse\/&lt;os&gt;\/&lt;ws&gt;\/&lt;arch&gt;\r\n<\/code><\/pre>\n<\/div>\n<ul>\n<li>The MN product can be found on this\u00a0<em>generic<\/em>\u00a0directory:<\/li>\n<\/ul>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"nv\">$HOME<\/span>\/git\/om2m\/org.eclipse.om2m\/org.eclipse.om2m.site.mn-cse\/target\/products\/mn-cse\/&lt;os&gt;\/&lt;ws&gt;\/&lt;arch&gt;\r\n<\/code><\/pre>\n<\/div>\n<ul>\n<li>The ASN product can be found on this\u00a0<em>generic<\/em>\u00a0directory:<\/li>\n<\/ul>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code><span class=\"nv\">$HOME<\/span>\/git\/om2m\/org.eclipse.om2m\/org.eclipse.om2m.site.asn-cse\/target\/products\/asn-cse\/&lt;os&gt;\/&lt;ws&gt;\/&lt;arch&gt;\r\n<\/code><\/pre>\n<\/div>\n<p>where on a linux environment running in a 64 bit machine the last part of each URI is translated to:<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<pre class=\"highlight\"><code>linux\/gtk\/x86_64<\/code><\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisites Git Apache Maven Oracle Java 8 Install Git $ sudo apt-get install git Install Apache Maven $ sudo apt-get&hellip;<\/p>\n<p><a class=\"btn btn-dark btn-sm unipi-read-more-link\" href=\"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":450,"featured_media":0,"parent":80,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-70","page","type-page","status-publish","hentry"],"acf":[],"featured_image_src":null,"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>OM2M Installation - Giacomo Tanganelli<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OM2M Installation - Giacomo Tanganelli\" \/>\n<meta property=\"og:description\" content=\"Prerequisites Git Apache Maven Oracle Java 8 Install Git $ sudo apt-get install git Install Apache Maven $ sudo apt-get&hellip;Read More...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/\" \/>\n<meta property=\"og:site_name\" content=\"Giacomo Tanganelli\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-18T09:53:53+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/om2m\\\/om2m-installation\\\/\",\"url\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/om2m\\\/om2m-installation\\\/\",\"name\":\"OM2M Installation - Giacomo Tanganelli\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/#website\"},\"datePublished\":\"2017-11-14T11:04:24+00:00\",\"dateModified\":\"2017-12-18T09:53:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/om2m\\\/om2m-installation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/om2m\\\/om2m-installation\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/om2m\\\/om2m-installation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Teaching\",\"item\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"OM2M\",\"item\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/teaching\\\/om2m\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"OM2M Installation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/#website\",\"url\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/\",\"name\":\"Giacomo Tanganelli\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/people.unipi.it\\\/giacomo_tanganelli\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OM2M Installation - Giacomo Tanganelli","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/","og_locale":"en_US","og_type":"article","og_title":"OM2M Installation - Giacomo Tanganelli","og_description":"Prerequisites Git Apache Maven Oracle Java 8 Install Git $ sudo apt-get install git Install Apache Maven $ sudo apt-get&hellip;Read More...","og_url":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/","og_site_name":"Giacomo Tanganelli","article_modified_time":"2017-12-18T09:53:53+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/","url":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/","name":"OM2M Installation - Giacomo Tanganelli","isPartOf":{"@id":"https:\/\/people.unipi.it\/giacomo_tanganelli\/#website"},"datePublished":"2017-11-14T11:04:24+00:00","dateModified":"2017-12-18T09:53:53+00:00","breadcrumb":{"@id":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/om2m-installation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/people.unipi.it\/giacomo_tanganelli\/"},{"@type":"ListItem","position":2,"name":"Teaching","item":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/"},{"@type":"ListItem","position":3,"name":"OM2M","item":"https:\/\/people.unipi.it\/giacomo_tanganelli\/teaching\/om2m\/"},{"@type":"ListItem","position":4,"name":"OM2M Installation"}]},{"@type":"WebSite","@id":"https:\/\/people.unipi.it\/giacomo_tanganelli\/#website","url":"https:\/\/people.unipi.it\/giacomo_tanganelli\/","name":"Giacomo Tanganelli","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/people.unipi.it\/giacomo_tanganelli\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/pages\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/users\/450"}],"replies":[{"embeddable":true,"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":9,"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/pages\/70\/revisions"}],"predecessor-version":[{"id":141,"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/pages\/70\/revisions\/141"}],"up":[{"embeddable":true,"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/pages\/80"}],"wp:attachment":[{"href":"https:\/\/people.unipi.it\/giacomo_tanganelli\/wp-json\/wp\/v2\/media?parent=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}