Skip to content

Commit a3d6e58

Browse files
committed
Downmerge from "develop" branch
2 parents d626cd2 + ddf8d01 commit a3d6e58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1905
-238
lines changed

NOTICES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ THIRD PARTY COMPONENTS
2727
This software includes third party software subject to the associated copyrights, as follows:
2828
- Simple XML 2.7 (Apache 2.0) - http://simple.sourceforge.net/
2929
- Spring Android 1.0.1 (Apache 2.0) - http://www.springsource.org/spring-android
30+
- RoboSpice 1.4.5 (Apache 2.0) - https://github.com/octo-online/robospice
3031

3132
The text of licenses for the above software is included with the
3233
Jaspersoft Mobile SDK for Android package, in the /licenses folder.

client/pom.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@
3131
<parent>
3232
<artifactId>js-android-sdk-aggregator</artifactId>
3333
<groupId>com.jaspersoft.android.sdk</groupId>
34-
<version>1.5</version>
34+
<version>1.6</version>
3535
</parent>
3636

37-
<groupId>com.jaspersoft.android.sdk</groupId>
3837
<artifactId>js-android-sdk-client</artifactId>
3938
<name>js-android-sdk-client</name>
40-
<version>1.5</version>
39+
<version>1.6</version>
4140

4241
<dependencies>
4342

@@ -49,7 +48,14 @@
4948
<groupId>org.springframework.android</groupId>
5049
<artifactId>spring-android-rest-template</artifactId>
5150
</dependency>
52-
51+
<dependency>
52+
<groupId>com.octo.android.robospice</groupId>
53+
<artifactId>robospice</artifactId>
54+
</dependency>
55+
<dependency>
56+
<groupId>com.octo.android.robospice</groupId>
57+
<artifactId>robospice-spring-android</artifactId>
58+
</dependency>
5359
<dependency>
5460
<!-- Using Simple for XML marshaling -->
5561
<groupId>org.simpleframework</groupId>

client/src/main/java/com/jaspersoft/android/sdk/client/JsRestClient.java

Lines changed: 314 additions & 115 deletions
Large diffs are not rendered by default.

client/src/main/java/com/jaspersoft/android/sdk/client/JsServerProfile.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public JsServerProfile() {}
4949
* Creates a new JsServerProfile entity with the specified parameters.
5050
*
5151
* @param alias The name used to refer to this JsServerProfile. The alias is mainly used to display the name
52-
* of this JsServerProfile in UI (i.e. when displaying a list of available servers).
52+
* of this JsServerProfile in UI (e.g. when displaying a list of available servers).
5353
* @param serverUrl The URL of JasperReports Server. The url does not include the /core/ portion of the uri,
54-
* i.e. http://hostname:port/jasperserver
54+
* e.g. http://hostname:port/jasperserver
5555
* @param organization The name of an organization (used in JasperReport Server Professional which supports multi-tenancy).
5656
* May be <code>null</code> or empty.
5757
* @param username The username, must be a valid account on JasperReports Server.
@@ -66,9 +66,9 @@ public JsServerProfile(String alias, String serverUrl, String organization, Stri
6666
*
6767
* @param id Unique identifier of this JsServerProfile. May be <code>null</code>.
6868
* @param alias The name used to refer to this JsServerProfile. The alias is mainly used to display the name
69-
* of this JsServerProfile in UI (i.e. when displaying a list of available servers).
69+
* of this JsServerProfile in UI (e.g. when displaying a list of available servers).
7070
* @param serverUrl The URL of JasperReports Server. The url does not include the /core/ portion of the uri,
71-
* i.e. http://hostname:port/jasperserver
71+
* e.g. http://hostname:port/jasperserver
7272
* @param organization The name of an organization (used in JasperReport Server Professional which supports multi-tenancy).
7373
* May be <code>null</code> or empty.
7474
* @param username The username, must be a valid account on JasperReports Server.

client/src/main/java/com/jaspersoft/android/sdk/client/async/JsAsyncTaskManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@
5151
*
5252
* @author Volodya Sabadosh ([email protected])
5353
* @author Ivan Gadzhega
54-
* @version $Id$
5554
* @since 1.0
55+
*
56+
* @deprecated Use {@link JsXmlSpiceService} instead.
5657
*/
58+
59+
@Deprecated
5760
public class JsAsyncTaskManager implements JsProgressTracker, DialogInterface.OnCancelListener {
5861

5962
private static final String TAG = "JsAsyncTaskManager";

client/src/main/java/com/jaspersoft/android/sdk/client/async/JsOnTaskCallbackListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
*
3333
* @author Volodya Sabadosh ([email protected])
3434
* @author Ivan Gadzhega
35-
* @version $Id$
3635
* @since 1.0
3736
*/
37+
38+
@Deprecated
3839
public interface JsOnTaskCallbackListener {
3940

4041
/**

client/src/main/java/com/jaspersoft/android/sdk/client/async/JsProgressTracker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
*
3434
* @author Volodya Sabadosh ([email protected])
3535
* @author Ivan Gadzhega
36-
* @version $Id$
3736
* @since 1.0
3837
*/
38+
39+
@Deprecated
3940
public interface JsProgressTracker {
4041

4142
/**
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (C) 2012-2013 Jaspersoft Corporation. All rights reserved.
3+
* http://community.jaspersoft.com/project/mobile-sdk-android
4+
*
5+
* Unless you have purchased a commercial license agreement from Jaspersoft,
6+
* the following license terms apply:
7+
*
8+
* This program is part of Jaspersoft Mobile SDK for Android.
9+
*
10+
* Jaspersoft Mobile SDK is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* Jaspersoft Mobile SDK is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with Jaspersoft Mobile SDK for Android. If not, see
22+
* <http://www.gnu.org/licenses/lgpl>.
23+
*/
24+
25+
package com.jaspersoft.android.sdk.client.async;
26+
27+
import android.app.Application;
28+
import com.octo.android.robospice.SpiceService;
29+
import com.octo.android.robospice.persistence.CacheManager;
30+
import com.octo.android.robospice.persistence.exception.CacheCreationException;
31+
import com.octo.android.robospice.persistence.springandroid.xml.SimpleSerializerObjectPersisterFactory;
32+
33+
/**
34+
* This class offers a {@link SpiceService} dedicated to xml web services. Provides
35+
* caching.
36+
*
37+
* @author Ivan Gadzhega
38+
* @since 1.6
39+
*/
40+
public class JsXmlSpiceService extends SpiceService {
41+
42+
@Override
43+
public CacheManager createCacheManager(Application application) throws CacheCreationException {
44+
CacheManager cacheManager = new CacheManager();
45+
cacheManager.addPersister(new SimpleSerializerObjectPersisterFactory(application));
46+
return cacheManager;
47+
}
48+
49+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (C) 2012-2013 Jaspersoft Corporation. All rights reserved.
3+
* http://community.jaspersoft.com/project/mobile-sdk-android
4+
*
5+
* Unless you have purchased a commercial license agreement from Jaspersoft,
6+
* the following license terms apply:
7+
*
8+
* This program is part of Jaspersoft Mobile SDK for Android.
9+
*
10+
* Jaspersoft Mobile SDK is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* Jaspersoft Mobile SDK is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with Jaspersoft Mobile SDK for Android. If not, see
22+
* <http://www.gnu.org/licenses/lgpl>.
23+
*/
24+
25+
package com.jaspersoft.android.sdk.client.async.request;
26+
27+
import com.jaspersoft.android.sdk.client.JsRestClient;
28+
import com.octo.android.robospice.request.SpiceRequest;
29+
import roboguice.util.temp.Ln;
30+
31+
/**
32+
* Base class for writing requests using {@link JsRestClient}.
33+
* Simply override {@link #loadDataFromNetwork()} to define the network operation of a request.
34+
*
35+
* @author Ivan Gadzhega
36+
* @since 1.6
37+
*/
38+
public abstract class BaseRequest<T> extends SpiceRequest<T> {
39+
40+
private JsRestClient jsRestClient;
41+
42+
public BaseRequest(JsRestClient jsRestClient, Class<T> clazz) {
43+
super(clazz);
44+
this.jsRestClient = jsRestClient;
45+
}
46+
47+
/**
48+
* This method doesn't really work within the Spring Android module : once the request is
49+
* loading data from network, there is no way to interrupt it. This is weakness of the spring android framework,
50+
* and seems to come from even deeper. The IO operations on which it relies don't support the interrupt flag
51+
* properly.
52+
* Nevertheless, there are still some opportunities to cancel the request, basically during cache operations.
53+
*/
54+
@Override
55+
public void cancel() {
56+
super.cancel();
57+
Ln.w(BaseRequest.class.getName(), "Cancel can't be invoked directly on "
58+
+ BaseRequest.class.getName() + " requests. You must call SpiceManager.cancelAllRequests().");
59+
}
60+
61+
public JsRestClient getJsRestClient() {
62+
return jsRestClient;
63+
}
64+
65+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (C) 2012-2013 Jaspersoft Corporation. All rights reserved.
3+
* http://community.jaspersoft.com/project/mobile-sdk-android
4+
*
5+
* Unless you have purchased a commercial license agreement from Jaspersoft,
6+
* the following license terms apply:
7+
*
8+
* This program is part of Jaspersoft Mobile SDK for Android.
9+
*
10+
* Jaspersoft Mobile SDK is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* Jaspersoft Mobile SDK is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with Jaspersoft Mobile SDK for Android. If not, see
22+
* <http://www.gnu.org/licenses/lgpl>.
23+
*/
24+
25+
package com.jaspersoft.android.sdk.client.async.request;
26+
27+
import com.jaspersoft.android.sdk.client.JsRestClient;
28+
29+
/**
30+
* Request that deletes the resource with the specified URI.
31+
*
32+
* @author Ivan Gadzhega
33+
* @since 1.6
34+
*/
35+
public class DeleteResourceRequest extends BaseRequest<Void> {
36+
37+
private String uri;
38+
39+
/**
40+
* Creates a new instance of {@link DeleteResourceRequest}.
41+
* @param uri resource URI (e.g. /reports/samples/)
42+
*/
43+
public DeleteResourceRequest(JsRestClient jsRestClient, String uri) {
44+
super(jsRestClient, Void.class);
45+
this.uri = uri;
46+
}
47+
48+
@Override
49+
public Void loadDataFromNetwork() throws Exception {
50+
getJsRestClient().deleteResource(uri);
51+
return null;
52+
}
53+
54+
//---------------------------------------------------------------------
55+
// Getters & Setters
56+
//---------------------------------------------------------------------
57+
58+
public String getUri() {
59+
return uri;
60+
}
61+
62+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (C) 2012-2013 Jaspersoft Corporation. All rights reserved.
3+
* http://community.jaspersoft.com/project/mobile-sdk-android
4+
*
5+
* Unless you have purchased a commercial license agreement from Jaspersoft,
6+
* the following license terms apply:
7+
*
8+
* This program is part of Jaspersoft Mobile SDK for Android.
9+
*
10+
* Jaspersoft Mobile SDK is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* Jaspersoft Mobile SDK is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with Jaspersoft Mobile SDK for Android. If not, see
22+
* <http://www.gnu.org/licenses/lgpl>.
23+
*/
24+
25+
package com.jaspersoft.android.sdk.client.async.request;
26+
27+
import com.jaspersoft.android.sdk.client.JsRestClient;
28+
import com.jaspersoft.android.sdk.client.oxm.ResourceDescriptor;
29+
30+
/**
31+
* Request that modifies the resource with specified ResourceDescriptor.
32+
*
33+
* @author Ivan Gadzhega
34+
* @since 1.6
35+
*/
36+
public class ModifyResourceRequest extends BaseRequest<Void> {
37+
38+
private ResourceDescriptor resourceDescriptor;
39+
40+
/**
41+
* Creates a new instance of {@link ModifyResourceRequest}.
42+
* @param resourceDescriptor descriptor of resource being modified
43+
*/
44+
public ModifyResourceRequest(JsRestClient jsRestClient, ResourceDescriptor resourceDescriptor) {
45+
super(jsRestClient, Void.class);
46+
this.resourceDescriptor = resourceDescriptor;
47+
}
48+
49+
@Override
50+
public Void loadDataFromNetwork() throws Exception {
51+
getJsRestClient().modifyResource(resourceDescriptor);
52+
return null;
53+
}
54+
55+
//---------------------------------------------------------------------
56+
// Getters & Setters
57+
//---------------------------------------------------------------------
58+
59+
public ResourceDescriptor getResourceDescriptor() {
60+
return resourceDescriptor;
61+
}
62+
63+
}

0 commit comments

Comments
 (0)