Add documentation for CLI

This commit is contained in:
jamesagnew 2015-10-12 18:47:49 -04:00
parent b827823004
commit 0ab8ee386f
16 changed files with 136 additions and 85 deletions

View File

@ -8,7 +8,7 @@
</encoder>
</appender>
<logger name="ca.uhn.fhir.cli" additivity="false" level="info">
<logger name="ca.uhn.fhir" additivity="false" level="info">
<appender-ref ref="STDOUT" />
</logger>

View File

@ -1,8 +1,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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- The parent of this project is the deployable POM. This project isn't deployable, but this keeps it before the root pom in the reactor order when building the site. I don't know why this works...
Need to investigate this. -->
<!-- The parent of this project is the deployable POM. This project isn't deployable, but this keeps it before the root pom in the reactor order when building the
site. I don't know why this works... Need to investigate this. -->
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
@ -321,10 +321,11 @@
</execution>
</executions>
</plugin>
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>${maven_cobertura_plugin_version}</version> <configuration> <check> <branchRate>85</branchRate>
<lineRate>85</lineRate> <haltOnFailure>true</haltOnFailure> <totalBranchRate>85</totalBranchRate> <totalLineRate>85</totalLineRate> <packageLineRate>85</packageLineRate> <packageBranchRate>85</packageBranchRate>
<regexes> <regex> <pattern>com.example.reallyimportant.*</pattern> <branchRate>90</branchRate> <lineRate>80</lineRate> </regex> <regex> <pattern>com.example.boringcode.*</pattern> <branchRate>40</branchRate>
<lineRate>30</lineRate> </regex> </regexes> </check> </configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal> </goals> </execution> </executions> </plugin> -->
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>${maven_cobertura_plugin_version}</version> <configuration>
<check> <branchRate>85</branchRate> <lineRate>85</lineRate> <haltOnFailure>true</haltOnFailure> <totalBranchRate>85</totalBranchRate> <totalLineRate>85</totalLineRate>
<packageLineRate>85</packageLineRate> <packageBranchRate>85</packageBranchRate> <regexes> <regex> <pattern>com.example.reallyimportant.*</pattern> <branchRate>90</branchRate>
<lineRate>80</lineRate> </regex> <regex> <pattern>com.example.boringcode.*</pattern> <branchRate>40</branchRate> <lineRate>30</lineRate> </regex> </regexes> </check>
</configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal> </goals> </execution> </executions> </plugin> -->
</plugins>
<resources>
</resources>

View File

@ -109,6 +109,7 @@
<descriptor>${project.basedir}/src/assembly/hapi-fhir-android-distribution.xml</descriptor>
<descriptor>${project.basedir}/src/assembly/hapi-fhir-cli.xml</descriptor>
</descriptors>
<finalName>hapi-fhir-${project.version}</finalName>
</configuration>
</execution>
</executions>

View File

@ -25,6 +25,7 @@
<include>hapi-fhir-cli</include>
<include>hapi-fhir-cli.cmd</include>
</includes>
<fileMode>0555</fileMode>
</fileSet>
</fileSets>

View File

@ -343,8 +343,10 @@
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders-dstu2.xml</targetResourceSpringBeansFile>
<baseResourceNames></baseResourceNames>
<excludeResourceNames>
<!--
<excludeResourceName>OperationDefinition</excludeResourceName>
<excludeResourceName>OperationOutcome</excludeResourceName>
-->
</excludeResourceNames>
</configuration>
</execution>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="FHIR_UT" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>ca.uhn.fhir.jpa.entity.ForcedId</class>
<class>ca.uhn.fhir.jpa.entity.ResourceHistoryTable</class>
<class>ca.uhn.fhir.jpa.entity.ResourceHistoryTag</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamToken</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamUri</class>
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamCoords</class>
<class>ca.uhn.fhir.jpa.entity.ResourceLink</class>
<class>ca.uhn.fhir.jpa.entity.ResourceTable</class>
<class>ca.uhn.fhir.jpa.entity.ResourceTag</class>
<class>ca.uhn.fhir.jpa.entity.SubscriptionTable</class>
<class>ca.uhn.fhir.jpa.entity.SubscriptionFlaggedResource</class>
<class>ca.uhn.fhir.jpa.entity.TagDefinition</class>
<class>ca.uhn.fhir.jpa.entity.Search</class>
<class>ca.uhn.fhir.jpa.entity.SearchResult</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="ca.uhn.fhir.jpa.util.HapiDerbyTenSevenDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.jdbc.batch_size" value="20" />
<property name="hibernate.cache.use_minimal_puts" value="true" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.cache.use_query_cache" value="false" />
<property name="hibernate.cache.use_second_level_cache" value="false" />
<property name="hibernate.cache.use_structured_entries" value="false" />
</properties>
</persistence-unit>
</persistence>

View File

@ -12,7 +12,7 @@
<context:annotation-config />
<context:mbean-server />
<bean depends-on="dbServer" id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<bean depends-on="dbServer" id="myPersistenceDataSourceDstu1" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<!-- ;create=true /opt/glassfish/glassfish4/glassfish/nodes/localhost-domain1/fhirtest/fhirdb -->
<!-- <property name="url" value="jdbc:hsqldb:hsql://localhost/uhnfhirdb"/>-->
<!-- <property name="url" value="jdbc:derby:directory:#{systemproperties['fhir.db.location']};create=true" /> -->
@ -25,7 +25,7 @@
</bean>
<bean depends-on="dbServer" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="dataSource" ref="myPersistenceDataSourceDstu1" />
<!--
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
-->

View File

@ -11,7 +11,7 @@
<context:annotation-config />
<context:mbean-server />
<bean depends-on="dbServer" id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<bean depends-on="dbServer" id="myPersistenceDataSourceDstu2" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.apache.derby.jdbc.ClientDriver"></property>
<property name="url" value="jdbc:derby://localhost:1527/#{systemProperties['fhir.db.location.dstu2']};create=true" />
<property name="username" value="SA" />
@ -24,7 +24,7 @@
value="sa"/> <property name="testOnBorrow" value="true"/> <property name="validationQuery" value="select 1;"/> </bean> -->
<bean depends-on="dbServer" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="dataSource" ref="myPersistenceDataSourceDstu2" />
<!--
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
-->
@ -56,6 +56,7 @@
<entry key="hibernate.cache.use_structured_entries" value="false" />
<entry key="hibernate.search.default.directory_provider" value="filesystem" />
<entry key="hibernate.search.default.indexBase" value="#{systemProperties['fhir.lucene.location.dstu2']};" />
<entry key="hibernate.search.lucene_version" value="LUCENE_CURRENT" />
</map>
</property>
</bean>

View File

@ -24,20 +24,6 @@
<ref bean="myLoggingInterceptor"/>
</util:list>
<!--
<bean class="ca.uhn.fhirtest.HsqldbServer" id="dbServer" init-method="start">
<constructor-arg>
<value>
server.database.0=file:#{systemProperties['fhir.db.location']}/hsql-fhir-db
server.dbname.0=uhnfhirdb
server.remote_open=true
hsqldb.reconfig_logging=false
hsqldb.default_table_type=cached
</value>
</constructor-arg>
</bean>
-->
<!--for mysql-->
<!--
<bean id="dbServer" class="ca.uhn.fhirtest.MySqlServer">

View File

@ -30,8 +30,8 @@ public class UhnFhirTestApp {
System.setProperty("fhir.db.location", "./target/testdb");
System.setProperty("fhir.db.location.dstu2", "./target/testdb_dstu2");
System.setProperty("fhir.lucene.location.dstu2", "./target/testlucene_dstu2");
System.setProperty("fhir.baseurl.dstu1", base + "Dstu1");
System.setProperty("fhir.baseurl.dstu2", base + "Dstu1");
System.setProperty("fhir.baseurl.dstu1", base.replace("Dstu2", "Dstu1"));
System.setProperty("fhir.baseurl.dstu2", base);
Server server = new Server(myPort);

View File

@ -204,7 +204,7 @@
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
<!-- This property is used in some of the site documentation where the version is shown, so that we can deploy the site even if the project is on a snapshot version. -->
<hapi_stable_version>1.1</hapi_stable_version>
<hapi_stable_version>1.2</hapi_stable_version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -74,6 +74,7 @@
<menu name="Using HAPI" inherit="bottom" >
<item name="Documentation Index" href="./docindex.html"/>
<item name="Command Line Tool (cli)" href="./doc_cli.html" />
</menu>
<menu name="Documentation" inherit="top" >
@ -112,6 +113,7 @@
<item name="Model API (RI DSTU2)" href="./apidocs-hl7org-dstu2/index.html" />
<item name="JPA Server API" href="./apidocs-jpaserver/index.html" />
</item>
<item name="Command Line Tool (hapi-fhir-cli)" href="./doc_cli.html" />
<item name="Maven Plugin (hapi-tinder-plugin)" href="./doc_tinder.html" />
</menu>

97
src/site/xdoc/doc_cli.xml Normal file
View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<properties>
<title>Command Line Tool</title>
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
</properties>
<body>
<section name="Command Line Tool for HAPI FHIR">
<p>
<b>hapi-fhir-cli</b> is the HAPI FHIR Command Line tool. It features a number of HAPI's
built-in features as easy to use command line options.
</p>
<subsection name="Download and Installation">
<p>
You can get the tool by downloading it from our
<a href="https://github.com/jamesagnew/hapi-fhir/releases">GitHub Releases</a> page
(look for the archive named <code>hapi-fhir-[version]-cli.tar.bz2</code> or <code>.zip</code> on Windows).
</p>
<p>
When you have downloaded the archive (either ZIP or tar.bz2), expand it into a directory
where you will keep it, and add this directory to your path.
</p>
<p>
You can now try the tool out by executing the following command: <code>hapi-fhir-cli</code>
This command should show a help screen, as shown in the screeenshot below.
</p>
<img src="./images/hapi-fhir-cli.png" alt="Basic screen shot" style="margin-left: 40px;"/>
</subsection>
<subsection name="Troubleshooting">
<p>
The tool should work correctly on any system that has Java 6 (or newer) installed. If
it is not working correctly, first try the following command to test if Java is installed:<br/>
<code>$ java -version</code>
</p>
<p>
If this command does not produce output similar to the following, you should install/reinstall
Java.<br/>
<pre><![CDATA[$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)]]></pre>
</p>
<p>
If this does not help, please post a question on our
<a href="https://groups.google.com/d/forum/hapi-fhir">Google Group</a>.
</p>
</subsection>
</section>
<section name="Server (run-server)">
<p>
The CLI tool can be used to start a local, fully functional FHIR server which you can use
for testing. To start this server, simply issue the command <code>hapi-fhir-cli run-server</code>
as shown in the example below:
</p>
<img src="./images/hapi-fhir-cli-run-server.png" alt="Run Server" style="margin-left: 40px;"/>
<p>
Once the server has started, you can access the testing webpage by pointing your
browser at <a href="http://localhost:8080/">http://localhost:8080/</a>. The FHIR
server base URL will be <a href="http://localhost:8080/baseDstu2/">http://localhost:8080/baseDstu2/</a>.
</p>
<p>
Note that by default this server will not be populated with any resources at all. You can
easily populate it with the FHIR example resources by <b>leaving it running</b> and opening
a second terminal window, then using the <code>hapi-fhir-cli upload-examples</code> command
(see the section below).
</p>
<p>
The server uses a local Derby database instance for storage. You may want to execute
this command in an empty directory, which you can clear if you want to reset the server.
</p>
</section>
<section name="Upload Example Resources (upload-examples)">
<p>
The <b>upload-examples</b> command downloads the complete set of FHIR example resources from
the HL7 website, and uploads them to a server of your choice. This can be useful to
populate a server with test data.
</p>
<p>
To execute this command, uploading test resources to a local CLI server, issue
the following: <code>hapi-fhir-cli upload-examples -t http://localhost:8080/baseDstu2</code>
</p>
<p>
Note that this command may take a surprisingly long time to complete because of the
large number of examples.
</p>
</section>
</body>
</document>

View File

@ -54,6 +54,8 @@
<li><a href="./doc_rest_etag.html">ETags</a></li>
<li><a href="./doc_jpa.html">JPA/Database Server</a></li>
<li><a href="./doc_tinder.html">Maven Plugin (hapi-tinder-plugin)</a></li>
<li><a href="./doc_cli.html">Command Line Tool (hapi-fhir-cli)</a></li>
</ul>
<h4>JavaDocs</h4>