Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

Commit 4e5b82d

Browse files
author
vbarathan
committed
version 1.15.1
1 parent bf4ee1f commit 4e5b82d

22 files changed

+717
-114
lines changed

INSTALL.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ standard Java installation.
2929
3. mail.jar in Sun's JavaMail API (version 1.4 or greater).
3030
Sun's JavaMail package available for download from
3131
"http://java.sun.com/products/javamail/downloads/index.html". This is only
32-
required for media specific APIs including Document List Data API, Picasa
33-
Web Album API and YouTube Data API.
32+
required for media specific APIs including Google Base data API,
33+
Document List data API, Picasa Web Album API and YouTube data API.
3434
4. activation.jar in Sun's JavaBeans Activation Framewrok.
3535
This is required only if using JDK version 1.5.
3636
Sun's JavaBeansActivationFramework is available for download from
3737
"http://java.sun.com/products/javabeans/jaf/downloads/index.html". This is
38-
only required for media specific APIs including Document List Data API,
39-
Picasa Web Album API and YouTube Data API.
38+
only required for media specific APIs including Google Base data API,
39+
Document List data API, Picasa Web Album API and YouTube data API.
4040
5. servlet.jar in Sun's Servlet API (version 2.3 or greater).
4141
This is required only if executing code samples in 'sample.authsub' or
4242
'sample.gbase.recipe' packages. Sun's Servlet API package can be

RELEASE_NOTES.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
Google Data API - Release Notes
22

3+
4+
Notes for v1.15.1
5+
-----------------
6+
Dec 6, 2007
7+
o Added support for media feed in Google Base data API. With the media feed
8+
support you can manage binary attachments to your Google Base items. With
9+
this change you will require Java Mail and Java Activation Framework to
10+
use Google Base data API.
11+
312
Notes for v1.15.0
413
-----------------
514
Nov 15, 2007

java/build/gbase.xml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@
1616

1717

1818
<!-- build Google Base API -->
19-
<target name="build.gbase" depends="core.build.core.client">
19+
<path id="build.gbase.classpath">
20+
<pathelement location="${mail.jar}"/>
21+
<pathelement location="${activation.jar}"/>
22+
<pathelement location="${gdata-media.jar}"/>
23+
</path>
24+
25+
<target name="build.gbase" depends="core.build.core.media">
2026
<mkdir dir="${build.classes.base}"/>
2127
<javac debug="false" sourcepath=""
2228
srcdir="${build.src}"
23-
destdir="${build.classes.base}"
24-
classpath="${gdata-client.jar}">
29+
destdir="${build.classes.base}">
2530
<include name="**/gbase/client/*.java"/>
31+
<classpath refid="build.gbase.classpath"/>
2632
</javac>
2733
<jar destfile="${gdata-base.jar}"
2834
basedir="${build.classes.base}"
@@ -65,6 +71,19 @@
6571
</target>
6672

6773
<!-- samples compile -->
74+
<path id="sample.gbase.cmdline.compile.classpath">
75+
<pathelement location="${mail.jar}"/>
76+
<pathelement location="${activation.jar}"/>
77+
<pathelement location="${gdata-base.jar}"/>
78+
</path>
79+
80+
<path id="sample.gbase.recipe.compile.classpath">
81+
<pathelement location="${mail.jar}"/>
82+
<pathelement location="${activation.jar}"/>
83+
<pathelement location="${servlet.jar}"/>
84+
<pathelement location="${gdata-base.jar}"/>
85+
</path>
86+
6887
<target name="sample.gbase.cmdline.compile" depends="sample.gbase.dirs,sample.gbase.dependencies"
6988
description="Compile Java sources">
7089
<javac srcdir="${sample.gbase.cmdlinedir}"
@@ -93,17 +112,6 @@
93112
</target>
94113

95114
<!-- samples build -->
96-
<path id="sample.gbase.cmdline.compile.classpath">
97-
<pathelement location="${gdata-client.jar}"/>
98-
<pathelement location="${gdata-base.jar}"/>
99-
</path>
100-
101-
<path id="sample.gbase.recipe.compile.classpath">
102-
<pathelement location="${gdata-client.jar}"/>
103-
<pathelement location="${gdata-base.jar}"/>
104-
<pathelement location="${servlet.jar}"/>
105-
</path>
106-
107115
<target name="sample.gbase.cmdline.build" depends="sample.gbase.cmdline.compile"
108116
description="build the command-line tools ${gdata-base-cmdline.jar}">
109117
<jar destfile="${sample.gbase.cmdline.jar}"

java/build/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ spreadsheet.spec.version=1.0
1212
youtube.spec.version=1.0
1313

1414
# Implementation version
15-
client.impl.version=1.15.0
15+
client.impl.version=1.15.1
1616
media.impl.version=1.0.0
1717
appsforyourdomain.impl.version=1.1.0
18-
base.impl.version=1.0.4
18+
base.impl.version=1.1.0
1919
calendar.impl.version=1.0.7
2020
codesearch.impl.version=1.0.5
2121
docs.impl.version=1.0.0

java/manifest/base.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Manifest-Version: 1.0
2-
Class-Path: [email protected]@.jar
2+
33

44
Name: com/google/api/gbase/client/
55
Specification-Title: Google Base data API client
902 Bytes
Binary file not shown.

java/sample/gbase/cmdline/CommandFactory.java

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package sample.gbase.cmdline;
1717

1818
import java.net.MalformedURLException;
19+
import java.util.Arrays;
1920

2021
/**
2122
* Creates and initializes commands given command-line
@@ -61,6 +62,16 @@ public static Command createCommand(String[] args) {
6162
return createGetCommand(args);
6263
} else if("batch".equals(commandName)) {
6364
return createBatchCommand(args);
65+
} else if("query-media".equals(commandName)) {
66+
return createQueryMediaCommand(args);
67+
} else if("insert-media".equals(commandName)) {
68+
return createInsertMediaCommand(args);
69+
} else if("update-media".equals(commandName)) {
70+
return createUpdateMediaCommand(args);
71+
} else if("delete-media".equals(commandName)) {
72+
return createDeleteMediaCommand(args);
73+
} else if("get-media".equals(commandName)) {
74+
return createGetMediaCommand(args);
6475
} else {
6576
throw error("Unknown command: " + commandName +
6677
". Available commands: " + ALL_COMMANDS);
@@ -83,7 +94,7 @@ private static Command createQueryCommand(String[] args) {
8394
}
8495

8596
/**
86-
* Creates and initializes a {@link QueryCommand}.
97+
* Creates and initializes a {@link InsertCommand}.
8798
*/
8899
private static Command createInsertCommand(String[] args) {
89100
InsertCommand command = new InsertCommand();
@@ -122,7 +133,7 @@ private static Command createUpdateCommand(String[] args) {
122133
private static Command createDeleteCommand(String[] args) {
123134
DeleteCommand command = new DeleteCommand();
124135
args = parseAndSetCommonArguments(command, args);
125-
136+
126137
command.setItemId(getItemId(args));
127138

128139
return command;
@@ -134,11 +145,86 @@ private static Command createDeleteCommand(String[] args) {
134145
private static Command createGetCommand(String[] args) {
135146
GetCommand command = new GetCommand();
136147
args = parseAndSetCommonArguments(command, args);
148+
137149
command.setItemId(getItemId(args));
138150

151+
return command;
152+
}
153+
154+
/**
155+
* Creates and initializes a {@link QueryMediaCommand}.
156+
*/
157+
private static Command createQueryMediaCommand(String[] args) {
158+
QueryMediaCommand command = new QueryMediaCommand();
159+
args = parseAndSetCommonArguments(command, args);
160+
161+
if (args.length == 1) {
162+
command.setItemMediaUrl(args[0]);
163+
} else {
164+
throw error("Expected [item_media_feed_url], got " + Arrays.toString(args));
165+
}
166+
139167
return command;
140168
}
141169

170+
/**
171+
* Creates and initializes a {@link InsertMediaCommand}.
172+
*/
173+
private static Command createInsertMediaCommand(String[] args) {
174+
InsertMediaCommand command = new InsertMediaCommand();
175+
args = parseAndSetCommonArguments(command, args);
176+
177+
if (args.length < 3 || args.length > 4) {
178+
throw error("Expected four arguments: [item_media_feed_url attachment_path_to_file " +
179+
"attachment_mime_type caption?], got " + Arrays.toString(args));
180+
}
181+
182+
command.setItemMediaUrl(args[0]);
183+
command.setAttachmentFile(args[1]);
184+
command.setAttachmentMimeType(args[2]);
185+
if (args.length == 4) {
186+
command.setCaption(args[3]);
187+
}
188+
189+
return command;
190+
}
191+
192+
/**
193+
* Creates and initializes a {@link UpdateMediaCommand}.
194+
*/
195+
private static Command createUpdateMediaCommand(String[] args) {
196+
UpdateMediaCommand command = new UpdateMediaCommand();
197+
args = parseAndSetCommonArguments(command, args);
198+
199+
command.setAttachmentId(getItemId(args));
200+
201+
return command;
202+
}
203+
204+
/**
205+
* Creates and initializes a {@link DeleteMediaCommand}.
206+
*/
207+
private static Command createDeleteMediaCommand(String[] args) {
208+
DeleteMediaCommand command = new DeleteMediaCommand();
209+
args = parseAndSetCommonArguments(command, args);
210+
211+
command.setAttachmentId(getItemId(args));
212+
213+
return command;
214+
}
215+
216+
/**
217+
* Creates and initializes a {@link GetMediaCommand).
218+
*/
219+
private static Command createGetMediaCommand(String[] args) {
220+
GetMediaCommand command = new GetMediaCommand();
221+
args = parseAndSetCommonArguments(command, args);
222+
223+
command.setAttachmentId(getItemId(args));
224+
225+
return command;
226+
}
227+
142228
/**
143229
* Get the item id from the command line and make sure it's the
144230
* only argument left.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* Copyright (c) 2007 Google Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
package sample.gbase.cmdline;
17+
18+
import com.google.gdata.client.Service;
19+
20+
/**
21+
* Deletes a media attachment from an item.
22+
* This command is called from {@link CustomerTool}.
23+
*/
24+
public class DeleteMediaCommand extends Command {
25+
26+
private String attachmentId;
27+
28+
@Override
29+
public void execute() throws Exception {
30+
Service service = createService();
31+
Service.GDataRequest request =
32+
service.createDeleteRequest(fixEditUrl(attachmentId));
33+
34+
// Send the request (HTTP DELETE)
35+
request.execute();
36+
37+
System.out.println("Item deleted successfully.");
38+
}
39+
40+
/** Sets the Id of the media attachment, which is also its URL. */
41+
public void setAttachmentId(String attachmentId) {
42+
this.attachmentId = attachmentId;
43+
}
44+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* Copyright (c) 2007 Google Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
package sample.gbase.cmdline;
17+
18+
import com.google.gdata.client.Service;
19+
20+
import java.net.URL;
21+
22+
/**
23+
* Displays the media entry (meta-data) of one attachment.
24+
* This command is called from {@link CustomerTool}.
25+
*/
26+
public class GetMediaCommand extends Command {
27+
28+
private String attachmentId;
29+
30+
@Override
31+
public void execute() throws Exception {
32+
Service service = createService();
33+
Service.GDataRequest request =
34+
service.createEntryRequest(new URL(attachmentId));
35+
36+
// Send the request (HTTP GET)
37+
request.execute();
38+
39+
// Save the response
40+
outputRawResponse(request);
41+
}
42+
43+
/** Sets the id/URL of the media attachment to display. */
44+
public void setAttachmentId(String attachmentId) {
45+
this.attachmentId = attachmentId;
46+
}
47+
}

0 commit comments

Comments
 (0)