Count to 10
From CCIL
Contents
Goal
This tutorial uses the counters component, to create a simple pipeline that executes exactly 10 times.
Project
This project contains only a distribution. Once compiled, it will produce a zip which contains all you need to run the application.
ccil-tutorials-count10 |- distribution \- pom.xml
Setup
Distribution
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>ccil-tutorials-count10</artifactId> <name>ccil-tutorials-count10</name> <url>http://ccil.sourceforge.net/documentation/index.php?title=Count_to_10</url> <packaging>pom</packaging> <properties> </properties> <parent> <groupId>net.ccil</groupId> <artifactId>ccil-tutorials</artifactId> <version>1.3.6</version> </parent> <dependencies> <!-- App --> <dependency> <artifactId>ccil-app</artifactId> <groupId>net.ccil</groupId> <version>${ccil.version}</version> </dependency> <dependency> <artifactId>ccil-common-generic</artifactId> <groupId>net.ccil</groupId> <version>${ccil.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.17</version> </dependency> </dependencies> <build> <finalName>${project.name}</finalName> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> <descriptor>bin.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>attached</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <organization> <name>Data Craft and Magic ltd.</name> <url>http://datacraftmagic.com/</url> </organization> </project>
Startup script
bin/ccil-tutorials-count10.sh
#!/bin/bash CCIL_HOME=`dirname $PWD` CCIL_CONTEXT=$CCIL_HOME/context java -cp "$CCIL_HOME/lib/*:$CCIL_HOME/config:$CCIL_HOME/launcher/*" -Dserver.config.file=ccil-tutorials-count10.ttl -Dserver.home.dir=$CCIL_HOME -Xmx1024M -Dserver.context.dir=$CCIL_CONTEXT -Dserver.jmx.enabled=false net.ccil.execution.CcilConsoleApp -execute -root $CCIL_HOME/context/apps "$@"
Configuration
TBD: add code from CCIL example
# # CCIL console configuration # @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix config: <https://sourceforge.net/projects/cybercore/config#>. @prefix entity: <https://sourceforge.net/projects/cybercore/entities#>. @prefix service: <https://sourceforge.net/projects/cybercore/services#>. @prefix ccil: <https://sourceforge.net/projects/ccil/properties#>. @prefix ccil: <https://sourceforge.net/projects/ccil/properties#>. # generic ----------------------------------------------- service:echo rdf:type entity:service ; entity:implementation "net.ccil.stages.generic.EchoStage" ; entity:classpath "" ; entity:arguments "" .
The application context
# Count to 10 #------------------------------------- context.title=Counters tutorial context.description=Introducing the very basics of CCIL - counters context.author=Atanas Ilchev context.comment=Count to 10 tutorial context.thumbnail = media/logo.png context.step1.pipeline = COUNTER_INIT,COUNTER_GET,ASSIGN_MSG,PRINT_MSG # step 1 -------------------------- COUNTER_INIT = counter-create COUNTER_INIT.name = count COUNTER_GET = counter-get COUNTER_GET.name = count COUNTER_GET.output = count_value ASSIGN_MSG = assign-str ASSIGN_MSG.value = ${count_value} ASSIGN_MSG.output = counter_text PRINT_MSG = print PRINT_MSG.input = counter_text # step 2 -------------------------- # step 3 -------------------------- READ = readfile READ.file = hello.txt READ.output = msg # step 4 -------------------------- APPEND = append-text APPEND.text = (step 4) APPEND.input = msg APPEND.output = msg WRITE = writefile WRITE.input = msg WRITE.file = * hello_from_step4.txt WRITE.append = true WRITE.separator = {NL} WRITE.encoding = utf-8
Further steps
TBA
Links
TBA