use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class DebugClientHandler method createDebugHeadlessClient.
public synchronized SessionClient createDebugHeadlessClient(ServletRequest req, String userName, String password, String method, Object[] objects, String preferedSolution) throws Exception {
if (debugHeadlessClient != null && !debugHeadlessClient.isShutDown()) {
debugHeadlessClient.shutDown(true);
}
SolutionMetaData solutionMetaData = (currentSolution == null) ? null : currentSolution.getSolutionMetaData();
if (preferedSolution != null && solutionMetaData != null && !preferedSolution.equals(solutionMetaData.getName())) {
Map<String, Solution> modules = new HashMap<String, Solution>();
currentSolution.getReferencedModulesRecursive(modules);
if (modules.containsKey(preferedSolution)) {
solutionMetaData = (SolutionMetaData) ApplicationServerRegistry.get().getLocalRepository().getRootObjectMetaData(preferedSolution, IRepository.SOLUTIONS);
}
}
debugHeadlessClient = new DebugHeadlessClient(req, userName, password, method, objects, solutionMetaData, designerCallback) {
@Override
public void shutDown(boolean force) {
super.shutDown(force);
debugHeadlessClient = null;
}
};
testAndStartDebugger();
return debugHeadlessClient;
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class DebugJ2DBClient method shutDown.
/**
* @see com.servoy.j2db.smart.J2DBClient#shutDown(boolean)
*/
@Override
public void shutDown(boolean force) {
shutDown = true;
try {
Solution solution = getSolution();
if (solution != null) {
if (!closeSolution(force, null) && !force) {
// could not close
shutDown = false;
return;
}
}
logout(null);
if (unitTestsRunning) {
repository = null;
applicationServerAccess = null;
}
} catch (Exception ex) {
Debug.error(ex);
}
getLoadingUIEffects().setClientShouldBeShowing(!shutDown);
// dispose owned windows
Window[] ownedWindows = getMainApplicationFrame().getOwnedWindows();
if (ownedWindows != null) {
for (Window w : ownedWindows) w.dispose();
}
getMainApplicationFrame().setVisible(false);
saveSettings();
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class AbstractApplication method setI18NMessagesFilter.
public void setI18NMessagesFilter(String columnname, String[] value) {
Properties properties = new Properties();
Messages.loadMessagesFromDatabaseInternal(null, getClientInfo().getClientId(), getSettings(), getDataServer(), getRepository(), properties, locale, Messages.ALL_LOCALES, null, null, columnname, value, getFoundSetManager());
Solution solution = getSolution();
Messages.loadMessagesFromDatabaseInternal(solution != null ? solution.getI18nDataSource() : null, getClientInfo().getClientId(), getSettings(), getDataServer(), getRepository(), properties, locale, Messages.ALL_LOCALES, null, null, columnname, value, getFoundSetManager());
synchronized (messages) {
messages.put(locale, properties);
}
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class DebugNGClient method refreshPersists.
@Override
public void refreshPersists(Collection<IPersist> changes) {
if (isShutDown())
return;
// flush the solution model cache of the form element helper when there is a solution copy.
// so that FormComponents are recreated with the latest data once.
Solution solutionCopy = getFlattenedSolution().getSolutionCopy(false);
if (solutionCopy != null)
solutionCopy.setRuntimeProperty(FormElementHelper.SOLUTION_MODEL_CACHE, null);
Set<IFormController>[] scopesAndFormsToReload = DebugUtils.getScopesAndFormsToReload(this, changes);
for (IFormController controller : scopesAndFormsToReload[1]) {
if (controller.getForm() instanceof FlattenedForm) {
FlattenedForm ff = (FlattenedForm) controller.getForm();
ff.reload();
}
}
boolean forcePageReload = false;
if (scopesAndFormsToReload[1] == null || scopesAndFormsToReload[1].size() < 1) {
for (IPersist persist : changes) {
// that one, can also have other css included, using the 'import' statement
if (persist instanceof Media && !PersistHelper.getOrderedStyleSheets(getFlattenedSolution()).isEmpty()) {
String name = ((Media) persist).getName().toLowerCase();
if (name.endsWith(".less") || name.endsWith(".css")) {
forcePageReload = true;
break;
}
}
}
}
refreshForms(scopesAndFormsToReload[1], forcePageReload);
for (IFormController controller : scopesAndFormsToReload[0]) {
controller.getFormScope().reload();
}
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class FlattenedSolution method setSolution.
public void setSolution(SolutionMetaData sol, boolean loadLoginSolution, boolean loadMainSolution, IActiveSolutionHandler activeSolutionHandler) throws RepositoryException, RemoteException {
// $NON-NLS-1$
if (sol == null)
throw new IllegalArgumentException("use close method!");
isLoadingSolution = true;
try {
copySolution = null;
persistFactory = null;
mainSolution = null;
user_created_styles = null;
all_styles = null;
if (index != null) {
index.destroy();
index = null;
}
mainSolutionMetaData = sol;
if (loadLoginSolution) {
// get login solution
Solution[] loginSolutionAndModules = activeSolutionHandler.loadLoginSolutionAndModules(mainSolutionMetaData);
if (loginSolutionAndModules != null && loginSolutionAndModules.length > 0) {
if (loginFlattenedSolution == null) {
loginFlattenedSolution = new ExtendsConfiguratingFlattenedSolution();
}
loginFlattenedSolution.setSolutionAndModules(loginSolutionAndModules[0].getName(), loginSolutionAndModules);
loginFlattenedSolution.setParentSolution(this);
}
}
// get regular solution if available
if (// local or already access to repository
loadMainSolution && activeSolutionHandler.haveRepositoryAccess()) {
// Note: referencedModules includes main solution
List<RootObjectReference> referencedModules = activeSolutionHandler.getRepository().getActiveSolutionModuleMetaDatas(mainSolutionMetaData.getRootObjectId());
if (referencedModules != null && referencedModules.size() != 0) {
List<RootObjectMetaData> solutionAndModuleMetaDatas = new ArrayList<RootObjectMetaData>();
for (RootObjectReference moduleReference : referencedModules) {
RootObjectMetaData moduleMetaData = moduleReference.getMetaData();
if (moduleMetaData == null) {
// $NON-NLS-1$
throw new RepositoryException(Messages.getString("servoy.client.module.notfound", new Object[] { moduleReference.toString() }));
}
solutionAndModuleMetaDatas.add(moduleMetaData);
}
Solution[] mods = activeSolutionHandler.loadActiveSolutions(solutionAndModuleMetaDatas.toArray(new RootObjectMetaData[solutionAndModuleMetaDatas.size()]));
setSolutionAndModules(mainSolutionMetaData.getName(), mods);
}
}
} finally {
isLoadingSolution = false;
}
}
Aggregations