You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split off the "normal case" example from the "legacy case" one.
* Split off the "normal case" example from the "legacy case" one.
(and create a "normal case" example, first)
* Correct damage from "helpful" IDE renaming help.
* Switch gcloud-java-examples to appassembler
This has the following benefits:
* Stat example now works
* Easier to see what is available (list the bin folder)
* Easier to see what running an example entails (read the script)
* Simpler command line (no more -Dexec.args)
* Rename example to examples and switch a Stat to ListFilesystems
* Clean up pom
Fix indent to 2, remove redundant groupId line that's inherited from the
parent.
* Reviewer comments and update_docs_version.sh
* Added blank line
* Sweating the small stuff
Adding a \n at the end of the last line.
The sample doesn't have anything about GCS in it. It gets that ability from the nio jar that
34
+
we're adding to the classpath. You can use the nio "fat shaded" jar for this purpose as it also
35
+
includes the dependencies for gcloud-java-nio.
36
+
The underlying mechanism is Java's standard [ServiceLoader](https://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html)
37
+
facility, the [standard way](http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/filesystemprovider.html) to plug in NIO providers like this one.
38
+
39
+
If you have access to a project's source code you can also simply add gcloud-java-nio as
40
+
a dependency and let Maven pull in the required dependencies (this is what the nio unit tests do).
41
+
This approach is preferable as the fat jar approach may waste memory on multiple copies of dependencies.
Copy file name to clipboardExpand all lines: gcloud-java-examples/README.md
+27-32Lines changed: 27 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,9 @@ To run examples from your command line:
37
37
38
38
2. Set your current project using `gcloud config set project PROJECT_ID`. This step is not necessary for `ResourceManagerExample`.
39
39
40
-
3. Compile using Maven (`mvn compile` in command line from your base project directory)
40
+
3. Compile using Maven: `cd gcloud-java-examples` in command line from your base project directory and then `mvn package appassembler:assemble -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true`.
41
41
42
-
4. Run an example using Maven from command line.
42
+
4. Run an example from the command line using the Maven-generated scripts.
43
43
44
44
* Here's an example run of `BigQueryExample`.
45
45
@@ -55,62 +55,57 @@ To run examples from your command line:
target/appassembler/bin/BigQueryExamplequery 'select * from new_dataset_id.new_table_id'
63
63
```
64
64
65
65
* Here's an example run of `DatastoreExample`.
66
66
67
67
Be sure to change the placeholder project ID "your-project-id" with your own project ID. Also note that you have to enable the Google Cloud Datastore API on the [Google Developers Console][developers-console] before running the following commands.
Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket. Also ensure that you have a test file (`test.txt` is chosen here) to upload to Cloud Storage stored locally on your machine.
* Here's an example run of `Stat`, illustrating the use of the gcloud-java-nio jar.
93
92
94
-
Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket with a file in it.
* Here's an example run of `Stat`, illustrating the use of gcloud-java-nio.
94
+
95
+
Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket with a file in it.
96
+
97
+
Run the sample with (from the gcloud-java-examples folder):
0 commit comments