use of com.servoy.j2db.util.UIUtils.ThrowingRunnable in project servoy-client by Servoy.
the class RemoteActiveSolutionHandler method loadLoginSolutionAndModules.
@Override
public Solution[] loadLoginSolutionAndModules(final SolutionMetaData mainSolutionDef) throws RepositoryException, RemoteException {
final SolutionMetaData[] loginSolutionDefinitions = getApplicationServer().getLoginSolutionDefinitions(mainSolutionDef);
if (loginSolutionDefinitions == null) {
throw new RepositoryException("Could not load login solution");
}
final Solution[] solutions = new Solution[loginSolutionDefinitions.length];
if (loginSolutionDefinitions.length > 0) {
ThrowingRunnable<RepositoryException, RemoteException> r = new ThrowingRunnable<RepositoryException, RemoteException>() {
@Override
public void run() {
try {
int[] sol_ids = new int[loginSolutionDefinitions.length];
for (int i = 0; i < sol_ids.length; i++) {
sol_ids[i] = loginSolutionDefinitions[i].getRootObjectId();
}
long[] asus = getApplicationServer().getActiveRootObjectsLastModified(sol_ids);
ConcurrentMap<String, IServer> sps = getRepository().getServerProxies(loginSolutionDefinitions);
for (int i = 0; i < loginSolutionDefinitions.length; i++) {
Solution s = loadCachedSolution(loginSolutionDefinitions[i], asus[i], sps);
if (s == null) {
// do full load
s = getApplicationServer().getLoginSolution(mainSolutionDef, loginSolutionDefinitions[i]);
}
if (s != null) {
if (s.getRepository() == null) {
// transient
s.setRepository(getRepository());
}
loadedActiveSolutionUpdateSequences.put(new Integer(s.getSolutionID()), new Long(asus[i]));
s.setServerProxies(sps);
}
solutions[i] = s;
}
} catch (RepositoryException eo) {
e1 = eo;
} catch (RemoteException et) {
e2 = et;
}
}
};
UIUtils.runWhileDispatchingEvents(r, getServiceProvider());
}
return solutions;
}
use of com.servoy.j2db.util.UIUtils.ThrowingRunnable in project servoy-client by Servoy.
the class RemoteActiveSolutionHandler method loadActiveSolutions.
@Override
public Solution[] loadActiveSolutions(final RootObjectMetaData[] solutionDefs) throws RepositoryException, RemoteException {
final int[] sol_ids = new int[solutionDefs.length];
for (int i = 0; i < sol_ids.length; i++) {
sol_ids[i] = solutionDefs[i].getRootObjectId();
}
final Solution[] retval = new Solution[solutionDefs.length];
ThrowingRunnable<RepositoryException, RemoteException> r = new ThrowingRunnable<RepositoryException, RemoteException>() {
@Override
public void run() {
try {
long[] asus = getApplicationServer().getActiveRootObjectsLastModified(sol_ids);
ConcurrentMap<String, IServer> sps = getRepository().getServerProxies(solutionDefs);
for (int i = 0; i < solutionDefs.length; i++) {
Solution s = loadCachedSolution(solutionDefs[i], asus[i], sps);
if (s == null) {
// do full load
s = loadSolution(solutionDefs[i]);
}
if (s != null) {
if (s.getRepository() == null) {
// transient
s.setRepository(getRepository());
}
loadedActiveSolutionUpdateSequences.put(new Integer(s.getSolutionID()), new Long(asus[i]));
s.setServerProxies(sps);
}
retval[i] = s;
}
} catch (RepositoryException eo) {
e1 = eo;
} catch (RemoteException et) {
e2 = et;
}
}
};
UIUtils.runWhileDispatchingEvents(r, getServiceProvider());
return retval;
}
Aggregations