资源说明:
Enabling Services on top of CCNx Protocol. BUILDING and INSTALLING 1. Download the latest CCNx code from :- http://www.ccnx.org/software-download-information-request/download-releases/ Latest source should work fine, we tested our design on 0.4.0 release. 2. Build and install CCN. Include ccn/bin into your environment PATH. 3. Create a folder which will act as your local repository eg. /home/columbia/repo 4. Create a symbolic link, /node-repo for the above created folder - $ sudo ln -s /home/columbia/repo /node-repo [You may have to do "sudo su" then create sym-link] 3. Clone two projects from github in your workspace:- https://github.com/ccnxserv/CCNServices https://github.com/ccnxserv/NetServServiceCore 4. Copy all the jar files from lib folder to /node-repo folder for both the above projects. 5. Build both the project, both projects use ant build scripts and create jar files in the /node-repo folder. ~CCNServices $ ant ~NetServServiceCore $ ant [This creates ccnservices.jar and netserv-service-core.jar files in /node-repo] RUNNING THE DEMO 6. With ccn deamon in you PATH, you should be able to give ccnd command. $ ccnd This will start ccn deamon, with log level=verbose. 7. Now we can run ccnservice in another terminal. Issue following command with your directory being CCNServices project. ~CCNServices $ ant run-ccnservices -DCCNX_PREFIX=ccnx:/ -DFILE_PREFIX=/node-repo This should start listening to ccnx content requests with ccnx:// namespace, effectively all the requests. You can change this to suit your needs. Eg. ccnx://columbia/irt etc. 8. In a new directory, kind of scratchpad, you can issue ccnx get commands to fetch content. ~scratchpad$ ccngetfile ccnx://test.txt temp.txt Note: test.txt is a file that is already present in the repository, this command will only return the file if it is present. For executing services. ~scratchpad$ ccngetfile ccnx://test.txt+service temp.txt This command executes "service" on test.txt content and returns result in temp.txt, You can do more exotic stuff as ~scratchpad$ ccngetfile ccnx://test.txt+service1+service2 temp.txt This command will execute services in a chain. EXAMPLE SERVICES clone https://github.com/ccnxserv/CCNServiceExamples repository This repository has two examples services, linenumber & nextservice. a. linenumber.jar : appends a linenumber for each line in a text file build linenumber.jar using ant $CCNServiceExamples/Linenumber/: ant [creates linenumber.jar in /node-repo] You can apply this service on an exiting text file in the repository. [simply copy paste any text file into /node-repo] ~scratchpad$ ccngetfile ccnx://text.txt+linenumber text.txt b. nextservice.jar : appends a line "ADDED BY NEXT SERVICE" in the end of a text file. build nextservice.jar using ant ~CCNServiceExamples/NextService$ ant [creates nextservice.jar in /node-repo] ~scratchpad$ ccngetfile ccnx://text.txt+nextservice text2.txt Chaining ~scratchpad$ ccngetfile ccnx://text.txt+linenumber+nextservice text3.txt FOR CREATING NEW SERVICES 9. You need to create OSGi bundles the usual way. When creating a CCNService, you need to implement CCNService interface present in the NetServServiceCore jar file. When creating service jar you need to add "CCN-Service" manifest attribute with the value as the above class's path, this step is important as it tells the framework which class acts as a CCNService at runtime. Note: Compiling requires eclipse-osgi & netservservicecore jar in the classpath, make sure the jar file has the same name as the project, lowercases, this keeps things simple when issuing commands on ccnx.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。