|
14 | 14 | import fi.helsinki.cs.tmc.utilities.BgTaskListenerList;
|
15 | 15 | import fi.helsinki.cs.tmc.utilities.CancellableCallable;
|
16 | 16 | import hy.tmc.core.TmcCore;
|
| 17 | +import hy.tmc.core.exceptions.TmcCoreException; |
17 | 18 | import java.util.ArrayList;
|
18 | 19 | import java.util.List;
|
19 | 20 | import java.util.logging.Level;
|
20 | 21 | import java.util.logging.Logger;
|
21 |
| -import org.apache.http.auth.Credentials; |
22 | 22 | import org.openide.util.Exceptions;
|
23 | 23 |
|
24 | 24 | /**
|
@@ -61,22 +61,26 @@ public RefreshCoursesAction addListener(BgTaskListener<List<Course>> listener) {
|
61 | 61 | }
|
62 | 62 |
|
63 | 63 | public void run() {
|
64 |
| -// Credentials credentials = new Credentials(this.tmcSettings.getUsername(), |
65 |
| -// this.tmcSettings.getPassword()) {}; |
66 |
| -// System.out.println(credentials); |
67 |
| -// ListenableFuture<Boolean> login = this.tmcCore.login(credentials, tmcSettings.getServerBaseUrl()); |
68 |
| -// Futures.addCallback(login, new FutureCallback<Boolean>() { |
69 |
| -// @Override |
70 |
| -// public void onSuccess(Boolean v) { |
71 |
| -// System.out.println("TOIMIIIII: " + v); |
72 |
| -// } |
73 |
| -// |
74 |
| -// @Override |
75 |
| -// public void onFailure(Throwable thrwbl) { |
76 |
| -// System.out.println("LOGIN LATAUS FEILASI1: " ); |
77 |
| -// Exceptions.printStackTrace(thrwbl); |
78 |
| -// } |
79 |
| -// }); |
| 64 | +// try { |
| 65 | +// Credentials credentials = new Credentials(this.tmcSettings.getUsername(), |
| 66 | +// this.tmcSettings.getPassword()) {}; |
| 67 | +// System.out.println(credentials); |
| 68 | +// ListenableFuture<Boolean> login = this.tmcCore.login(credentials, tmcSettings.getServerBaseUrl()+"/user"); |
| 69 | +// Futures.addCallback(login, new FutureCallback<Boolean>() { |
| 70 | +// @Override |
| 71 | +// public void onSuccess(Boolean loginSuccess) { |
| 72 | +// |
| 73 | +// } |
| 74 | +// |
| 75 | +// @Override |
| 76 | +// public void onFailure(Throwable thrwbl) { |
| 77 | +// System.out.println("LOGIN LATAUS FEILASI1: " ); |
| 78 | +// Exceptions.printStackTrace(thrwbl); |
| 79 | +// } |
| 80 | +// }); |
| 81 | +// } catch (TmcCoreException ex) { |
| 82 | +// Exceptions.printStackTrace(ex); |
| 83 | +// } |
80 | 84 | }
|
81 | 85 |
|
82 | 86 | public void oldRun() {
|
|
0 commit comments