anchor.diff:      printf "RUN=yes\n" > /etc/default/virtuoso && \
       # Cria o usuario virtuoso e adiciona as permissões para a DB
       useradd virtuoso --home $VIRTUOSO_HOME && \
  -    chown -R virtuoso:virtuoso $VIRTUOSO_HOME
  +    chown -R virtuoso:virtuoso $VIRTUOSO_HOME && \
  +    mkdir /usr/local/virtuoso-opensource/var/lib/virtuoso/db
   
   # Inicializa o serviço do virtuoso, mesmo que ele apresente erros
   RUN until service virtuoso-service start; do echo "Failed to start... Trying again."; done
  
positive.code:     git clone --branch $OPENIOT_BRANCH $OPENIOT_LINK && \
      cd /tmp/openiot/openiot && \
      xmlstarlet ed \
  			-L \
  			-N pomns="http://maven.apache.org/POM/4.0.0" \
  			--subnode "/pomns:project" \
  				--type elem \
  				-n repositories \
  			--subnode "/pomns:project/repositories" \
  				--type elem \
  				-n repository \
  			--subnode "//repositories/repository" \
  				--type elem \
  				-n id \
  				-v "wiser-releases" \
  			--subnode "//repository" \
  				--type elem \
  				-n url \
  				-v "https://github.com/WiserUFBA/wiser-mvn-repo/raw/master/releases" ./pom.xml && \
      mvn -X clean install && \
  	JBOSS_CONFIGURATION="$JBOSS_HOME/standalone/configuration" && \
  	cp ./utils/utils.commons/src/main/resources/security-config.ini "$JBOSS_CONFIGURATION" && \
  	cp ./utils/utils.commons/src/main/resources/properties/openiot.properties "$JBOSS_CONFIGURATION" && \
      cd / && \
      mv /tmp/openiot/openiot $OPENIOT_HOME && \
  	cd $OPENIOT_HOME/modules/lsm-light/lsm-light.server/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/modules/security/security-server/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/modules/security/security-management/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/modules/scheduler/scheduler.core/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/modules/sdum/sdum.core/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/ui/ui.requestDefinition/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/ui/ui.requestPresentation/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/ui/ui.schemaeditor/ && \
  	mvn -X jboss-as:deploy && \
  	cd $OPENIOT_HOME/ui/ide/ide.core/ && \
  	mvn -X jboss-as:deploy && \
      rm -r /tmp/openiot
  
  # Passo Final
  
negative.code: # Configuração do Jboss
  RUN mkdir $JBOSS_HOME/standalone/configuration/ssl && \
      JBOSS_SSL_CONFIG="CN=$JBOSS_SSL_ADDRESS," && \
      JBOSS_SSL_CONFIG="$JBOSS_SSL_CONFIG OU=$JBOSS_SSL_ORGANIZATION_UNITY," && \
      JBOSS_SSL_CONFIG="$JBOSS_SSL_CONFIG O=$JBOSS_SSL_ORGANIZATION," && \
      JBOSS_SSL_CONFIG="$JBOSS_SSL_CONFIG L=$JBOSS_SSL_CITY," && \
      JBOSS_SSL_CONFIG="$JBOSS_SSL_CONFIG S=$JBOSS_SSL_STATE," && \
      JBOSS_SSL_CONFIG="$JBOSS_SSL_CONFIG C=$JBOSS_SSL_COUNTRY" && \
      export JBOSS_SSL_CONFIG && \
      cd $JBOSS_HOME/standalone/configuration/ssl && \
      keytool -genkey \
              -noprompt \
              -alias jbosskey \
              -dname "$JBOSS_SSL_CONFIG" \
              -keyalg RSA \
              -keystore server.keystore \
              -storepass changeit \
              -keypass "$JBOSS_SSL_KEY" && \
      keytool -export \
              -noprompt \
              -alias jbosskey \
              -keypass "$JBOSS_SSL_KEY" \
              -file server.crt \
              -storepass changeit \
              -keystore server.keystore && \
      keytool -import \
              -noprompt \
              -alias jbosscert \
              -keypass "$JBOSS_SSL_KEY" \
              -file server.crt \
              -storepass changeit \
              -keystore server.keystore && \
      keytool -import \
              -noprompt \
              -keystore "$JAVA_HOME/jre/lib/security/cacerts" \
              -file server.crt \
              -alias incommon \
              -storepass changeit && \
      xmlstarlet ed \
              -L \
              -N serverns="urn:jboss:domain:1.2" \
              -N subsystemns="urn:jboss:domain:web:1.1" \
              --subnode "/serverns:server/_:profile/subsystemns:subsystem" \
                  --type elem \
                  -n connector \
              --insert "//subsystemns:subsystem/connector[not(@name)]" \
                  --type attr \
                  -n name \
                  -v "https" \
              --insert "//connector[@name='https']" \
                  --type attr \
                  -n protocol \
                  -v "HTTP/1.1" \
              --insert "//connector[@name='https']" \
                  --type attr \
                  -n scheme \
                  -v "https" \
              --insert "//connector[@name='https']" \
                  --type attr \
                  -n "socket-binding" \
                  -v "https" \
              --insert "//connector[@name='https']" \
                  --type attr \
                  -n "secure" \
                  -v "true" \
              --subnode "//connector[@name='https']" \
                  --type elem \
                  -n ssl \
              --insert "//connector[@name='https']/ssl" \
                  --type attr \
                  -n name \
                  -v "https" \
              --insert "//ssl" \
                  --type attr \
                  -n "key-alias" \
                  -v "jbosskey" \
              --insert "//ssl" \
                  --type attr \
                  -n "password" \
                  -v "$JBOSS_SSL_KEY" \
              --insert "//ssl" \
                  --type attr \
                  -n "certificate-key-file" \
                  -v "$JBOSS_HOME/standalone/configuration/ssl/server.keystore" \
              "$JBOSS_HOME/standalone/configuration/standalone.xml"
  
  # OpenIoT Installation Link
  ENV OPENIOT_LINK https://github.com/OpenIotOrg/openiot.git
  