mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
switched compiler to janino
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -40,23 +40,25 @@ public class CloudPresenter {
|
|||||||
private boolean loggedIn = false;
|
private boolean loggedIn = false;
|
||||||
|
|
||||||
public CloudPresenter(CloudListener listener) {
|
public CloudPresenter(CloudListener listener) {
|
||||||
serviceUrl =
|
|
||||||
ConfigurationManager.getInstance().readString(IServiceAPI.URL_KEY, "http://www.diy-fever.com/diylc/api/v1");
|
|
||||||
ProxyFactory factory = new ProxyFactory(new PhpFlatProxy());
|
|
||||||
service = factory.createProxy(IServiceAPI.class, serviceUrl);
|
|
||||||
if (service == null)
|
|
||||||
LOG.warn("Service proxy not created!");
|
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IServiceAPI getService() {
|
||||||
|
if (service == null) {
|
||||||
|
serviceUrl =
|
||||||
|
ConfigurationManager.getInstance().readString(IServiceAPI.URL_KEY, "http://www.diy-fever.com/diylc/api/v1");
|
||||||
|
ProxyFactory factory = new ProxyFactory(new PhpFlatProxy());
|
||||||
|
service = factory.createProxy(IServiceAPI.class, serviceUrl);
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean logIn(String username, String password) throws CloudException {
|
public boolean logIn(String username, String password) throws CloudException {
|
||||||
if (service == null)
|
|
||||||
return false;
|
|
||||||
LOG.info("Trying to login to cloud as " + username);
|
LOG.info("Trying to login to cloud as " + username);
|
||||||
|
|
||||||
String res;
|
String res;
|
||||||
try {
|
try {
|
||||||
res = service.login(username, password, getMachineId());
|
res = getService().login(username, password, getMachineId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CloudException(e);
|
throw new CloudException(e);
|
||||||
}
|
}
|
||||||
@@ -75,9 +77,6 @@ public class CloudPresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryLogInWithToken() throws CloudException {
|
public boolean tryLogInWithToken() throws CloudException {
|
||||||
if (service == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
String username = ConfigurationManager.getInstance().readString(USERNAME_KEY, null);
|
String username = ConfigurationManager.getInstance().readString(USERNAME_KEY, null);
|
||||||
String token = ConfigurationManager.getInstance().readString(TOKEN_KEY, null);
|
String token = ConfigurationManager.getInstance().readString(TOKEN_KEY, null);
|
||||||
|
|
||||||
@@ -85,7 +84,7 @@ public class CloudPresenter {
|
|||||||
LOG.info("Trying to login to cloud using a token as " + username);
|
LOG.info("Trying to login to cloud using a token as " + username);
|
||||||
String res;
|
String res;
|
||||||
try {
|
try {
|
||||||
res = service.loginWithToken(username, token, getMachineId());
|
res = getService().loginWithToken(username, token, getMachineId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CloudException(e);
|
throw new CloudException(e);
|
||||||
}
|
}
|
||||||
@@ -117,7 +116,7 @@ public class CloudPresenter {
|
|||||||
if (categories == null) {
|
if (categories == null) {
|
||||||
Object res;
|
Object res;
|
||||||
try {
|
try {
|
||||||
res = service.getCategories();
|
res = getService().getCategories();
|
||||||
if (res != null && res.equals(ERROR))
|
if (res != null && res.equals(ERROR))
|
||||||
throw new CloudException("Could not fetch categories from the server.");
|
throw new CloudException("Could not fetch categories from the server.");
|
||||||
if (res instanceof List<?>) {
|
if (res instanceof List<?>) {
|
||||||
@@ -145,7 +144,7 @@ public class CloudPresenter {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
String res =
|
String res =
|
||||||
service.upload(username, token, getMachineId(), projectName, category, description, diylcVersion, keywords,
|
getService().upload(username, token, getMachineId(), projectName, category, description, diylcVersion, keywords,
|
||||||
thumbnail, project);
|
thumbnail, project);
|
||||||
if (!res.equals(SUCCESS))
|
if (!res.equals(SUCCESS))
|
||||||
throw new CloudException(res);
|
throw new CloudException(res);
|
||||||
@@ -162,7 +161,7 @@ public class CloudPresenter {
|
|||||||
throw new CloudException("Login failed. Please try to login again.");
|
throw new CloudException("Login failed. Please try to login again.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String res = service.postComment(username, token, getMachineId(), projectId, comment);
|
String res = getService().postComment(username, token, getMachineId(), projectId, comment);
|
||||||
if (!res.equals(SUCCESS))
|
if (!res.equals(SUCCESS))
|
||||||
throw new CloudException(res);
|
throw new CloudException(res);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -173,7 +172,7 @@ public class CloudPresenter {
|
|||||||
public void createUserAccount(String username, String password, String email, String website, String bio)
|
public void createUserAccount(String username, String password, String email, String website, String bio)
|
||||||
throws CloudException {
|
throws CloudException {
|
||||||
try {
|
try {
|
||||||
String res = service.createUser(username, password, email, website, bio);
|
String res = getService().createUser(username, password, email, website, bio);
|
||||||
if (res == null)
|
if (res == null)
|
||||||
throw new CloudException("Could not create user account.");
|
throw new CloudException("Could not create user account.");
|
||||||
if (!SUCCESS.equals(res))
|
if (!SUCCESS.equals(res))
|
||||||
@@ -189,7 +188,7 @@ public class CloudPresenter {
|
|||||||
|
|
||||||
Object res;
|
Object res;
|
||||||
try {
|
try {
|
||||||
res = service.getUserDetails(username, token, getMachineId());
|
res = getService().getUserDetails(username, token, getMachineId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CloudException(e);
|
throw new CloudException(e);
|
||||||
}
|
}
|
||||||
@@ -209,7 +208,7 @@ public class CloudPresenter {
|
|||||||
|
|
||||||
String res;
|
String res;
|
||||||
try {
|
try {
|
||||||
res = service.updatePassword(username, oldPassword, newPassword);
|
res = getService().updatePassword(username, oldPassword, newPassword);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CloudException(e);
|
throw new CloudException(e);
|
||||||
}
|
}
|
||||||
@@ -223,7 +222,7 @@ public class CloudPresenter {
|
|||||||
|
|
||||||
String res;
|
String res;
|
||||||
try {
|
try {
|
||||||
res = service.updateUserDetails(username, token, getMachineId(), email, website, bio);
|
res = getService().updateUserDetails(username, token, getMachineId(), email, website, bio);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CloudException(e);
|
throw new CloudException(e);
|
||||||
}
|
}
|
||||||
@@ -235,7 +234,7 @@ public class CloudPresenter {
|
|||||||
throws CloudException {
|
throws CloudException {
|
||||||
LOG.info(String.format("search(%1$s,%2$s,%3$s,%4$d,%5$d)", criteria, category, sortOrder, pageNumber, itemsPerPage));
|
LOG.info(String.format("search(%1$s,%2$s,%3$s,%4$d,%5$d)", criteria, category, sortOrder, pageNumber, itemsPerPage));
|
||||||
try {
|
try {
|
||||||
Object res = service.search(criteria, category, pageNumber, itemsPerPage, sortOrder);
|
Object res = getService().search(criteria, category, pageNumber, itemsPerPage, sortOrder);
|
||||||
// Thread.sleep(2000);
|
// Thread.sleep(2000);
|
||||||
if (res == null)
|
if (res == null)
|
||||||
throw new CloudException("Failed to retreive search results.");
|
throw new CloudException("Failed to retreive search results.");
|
||||||
@@ -268,7 +267,7 @@ public class CloudPresenter {
|
|||||||
|
|
||||||
public String[] getSortings() throws CloudException {
|
public String[] getSortings() throws CloudException {
|
||||||
try {
|
try {
|
||||||
return service.getSortings().toArray(new String[0]);
|
return getService().getSortings().toArray(new String[0]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CloudException(e);
|
throw new CloudException(e);
|
||||||
}
|
}
|
||||||
@@ -276,7 +275,7 @@ public class CloudPresenter {
|
|||||||
|
|
||||||
public List<CommentEntity> getComments(int projectId) throws CloudException {
|
public List<CommentEntity> getComments(int projectId) throws CloudException {
|
||||||
try {
|
try {
|
||||||
Object res = service.getComments(projectId);
|
Object res = getService().getComments(projectId);
|
||||||
if (res == null)
|
if (res == null)
|
||||||
throw new CloudException("Failed to retreive search results.");
|
throw new CloudException("Failed to retreive search results.");
|
||||||
if (res instanceof String)
|
if (res instanceof String)
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-compiler-3.0.6.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/janino-3.0.6.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
|
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
|
|
||||||
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/swing-framework.jar"/>
|
<classpathentry kind="lib" path="lib/swing-framework.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bancika-http-proxy.jar"/>
|
<classpathentry kind="lib" path="lib/bancika-http-proxy.jar"/>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1341,6 +1341,10 @@
|
|||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Project Cloud feature introduced with global project sharing functionality</description>
|
<description>Project Cloud feature introduced with global project sharing functionality</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added Public Announcements feature</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
|||||||
Reference in New Issue
Block a user