Commit 70299bde authored by mobreza's avatar mobreza

geneses-client-api updated, resolving issues

parent 0c78af81
...@@ -231,7 +231,7 @@ public class SettingsDialog extends Dialog { ...@@ -231,7 +231,7 @@ public class SettingsDialog extends Dialog {
try { try {
String res = genesysClient.me(); String res = genesysClient.me();
System.err.println("/me: " + res); System.err.println("/me: " + res);
oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken()); oauthSettings.setAccessToken(genesysClient.getTokens().getAccessToken());
SwtUtil.showMessageBox(getParent(), "OAuth", "Tokens are up to date."); SwtUtil.showMessageBox(getParent(), "OAuth", "Tokens are up to date.");
...@@ -241,7 +241,7 @@ public class SettingsDialog extends Dialog { ...@@ -241,7 +241,7 @@ public class SettingsDialog extends Dialog {
+ oauthSettings.getServerUrl() + "\n\n" + e.getMessage()); + oauthSettings.getServerUrl() + "\n\n" + e.getMessage());
} catch (OAuthAuthenticationException e) { } catch (OAuthAuthenticationException e) {
_log.warn(e.getMessage()); _log.warn(e.getMessage());
String authorizationUrl = genesysClient.getAuthorizationUrl(null); String authorizationUrl = genesysClient.getAuthorizationUrl();
VerifierDialog vd = new VerifierDialog(getParent(), SWT.NONE); VerifierDialog vd = new VerifierDialog(getParent(), SWT.NONE);
String verifierCode = vd.open(authorizationUrl); String verifierCode = vd.open(authorizationUrl);
...@@ -250,8 +250,8 @@ public class SettingsDialog extends Dialog { ...@@ -250,8 +250,8 @@ public class SettingsDialog extends Dialog {
_log.info("Got verifier code: " + verifierCode); _log.info("Got verifier code: " + verifierCode);
try { try {
genesysClient.authenticate(verifierCode); genesysClient.authenticate(verifierCode);
oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken()); oauthSettings.setAccessToken(genesysClient.getTokens().getAccessToken());
oauthSettings.setRefreshToken(genesysClient.getRefreshToken().getToken()); oauthSettings.setRefreshToken(genesysClient.getTokens().getRefreshToken());
} catch (Throwable e1) { } catch (Throwable e1) {
_log.error(e1.getMessage(), e1); _log.error(e1.getMessage(), e1);
SwtUtil.showMessageBox(getParent(), "OAuth error", e1.getMessage()); SwtUtil.showMessageBox(getParent(), "OAuth error", e1.getMessage());
......
...@@ -102,7 +102,8 @@ public class SheetDisplay extends Composite { ...@@ -102,7 +102,8 @@ public class SheetDisplay extends Composite {
@Autowired @Autowired
private ColumnDefs columnDefs; private ColumnDefs columnDefs;
private static final ObjectMapper mapper = new ObjectMapper(); @Autowired
private ObjectMapper mapper;
private static class ContentProvider implements IStructuredContentProvider { private static class ContentProvider implements IStructuredContentProvider {
@Override @Override
......
...@@ -18,6 +18,7 @@ import org.genesys2.anno.parser.XlsxDataSourceParser; ...@@ -18,6 +18,7 @@ import org.genesys2.anno.parser.XlsxDataSourceParser;
import org.genesys2.anno.reader.JDBCRowReader; import org.genesys2.anno.reader.JDBCRowReader;
import org.genesys2.anno.util.ConnectionUtils; import org.genesys2.anno.util.ConnectionUtils;
import org.genesys2.client.oauth.GenesysClient; import org.genesys2.client.oauth.GenesysClient;
import org.genesys2.client.oauth.GenesysTokens;
import org.genesys2.client.oauth.api.GenesysApi; import org.genesys2.client.oauth.api.GenesysApi;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
...@@ -30,6 +31,8 @@ import org.springframework.context.annotation.Scope; ...@@ -30,6 +31,8 @@ import org.springframework.context.annotation.Scope;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import com.fasterxml.jackson.databind.ObjectMapper;
/** /**
* Main Spring configuration * Main Spring configuration
* *
...@@ -51,10 +54,10 @@ public class SpringConfig { ...@@ -51,10 +54,10 @@ public class SpringConfig {
return dataSourceLoader; return dataSourceLoader;
} }
@Bean @Bean
public JdbcDrivers jdbcDrivers() { public JdbcDrivers jdbcDrivers() {
return new JdbcDrivers(); return new JdbcDrivers();
} }
@Bean @Bean
public ExecutorService getExecutorService() { public ExecutorService getExecutorService() {
...@@ -91,8 +94,9 @@ public class SpringConfig { ...@@ -91,8 +94,9 @@ public class SpringConfig {
@Bean @Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public SheetDisplay sheetDisplay(IDataSource dataSource,IDataSourceSheet dataSourceSheet, Composite parent, TreeViewer treeViewer, int style) { public SheetDisplay sheetDisplay(IDataSource dataSource, IDataSourceSheet dataSourceSheet, Composite parent,
return new SheetDisplay(dataSource,dataSourceSheet, parent, treeViewer, style); TreeViewer treeViewer, int style) {
return new SheetDisplay(dataSource, dataSourceSheet, parent, treeViewer, style);
} }
@Bean @Bean
...@@ -152,13 +156,19 @@ public class SpringConfig { ...@@ -152,13 +156,19 @@ public class SpringConfig {
return extraClassLoader; return extraClassLoader;
} }
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper();
}
@Bean @Bean
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
final PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); final PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
// Need to ignore "genesys.properties" if not found // Need to ignore "genesys.properties" if not found
propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true); propertyPlaceholderConfigurer.setIgnoreResourceNotFound(true);
propertyPlaceholderConfigurer.setLocations(new Resource[] { new ClassPathResource("genesys.properties"), new ClassPathResource("local.properties") }); propertyPlaceholderConfigurer.setLocations(new Resource[] { new ClassPathResource("genesys.properties"),
new ClassPathResource("local.properties") });
return propertyPlaceholderConfigurer; return propertyPlaceholderConfigurer;
} }
...@@ -168,8 +178,10 @@ public class SpringConfig { ...@@ -168,8 +178,10 @@ public class SpringConfig {
GenesysClient genesysClient = new GenesysClient(); GenesysClient genesysClient = new GenesysClient();
genesysClient.setGenesysApi(new GenesysApi()); genesysClient.setGenesysApi(new GenesysApi());
genesysClient.setBaseUrl(oauthSettings.getServerUrl()); genesysClient.setBaseUrl(oauthSettings.getServerUrl());
genesysClient.setAccessToken(oauthSettings.getAccessToken()); GenesysTokens genesysTokens = new GenesysTokens();
genesysClient.setRefreshToken(oauthSettings.getRefreshToken()); genesysTokens.setAccessToken(oauthSettings.getAccessToken());
genesysTokens.setRefreshToken(oauthSettings.getRefreshToken());
genesysClient.setTokens(genesysTokens);
genesysClient.connect(oauthSettings.getClientKey(), oauthSettings.getClientSecret(), "oob"); genesysClient.connect(oauthSettings.getClientKey(), oauthSettings.getClientSecret(), "oob");
return genesysClient; return genesysClient;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment