Search in sources :

Example 1 with Solution

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;
}
Also used : HashMap(java.util.HashMap) SolutionMetaData(com.servoy.j2db.persistence.SolutionMetaData) Solution(com.servoy.j2db.persistence.Solution)

Example 2 with Solution

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();
}
Also used : RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow) Window(java.awt.Window) FormWindow(com.servoy.j2db.FormWindow) SwingRuntimeWindow(com.servoy.j2db.smart.SwingRuntimeWindow) Solution(com.servoy.j2db.persistence.Solution) IntrospectionException(java.beans.IntrospectionException) ServoyException(com.servoy.j2db.util.ServoyException) RhinoException(org.mozilla.javascript.RhinoException) RemoteException(java.rmi.RemoteException) MalformedURLException(java.net.MalformedURLException) RepositoryException(com.servoy.j2db.persistence.RepositoryException)

Example 3 with Solution

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);
    }
}
Also used : Properties(java.util.Properties) Solution(com.servoy.j2db.persistence.Solution)

Example 4 with Solution

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();
    }
}
Also used : FlattenedForm(com.servoy.j2db.persistence.FlattenedForm) Set(java.util.Set) IPersist(com.servoy.j2db.persistence.IPersist) Media(com.servoy.j2db.persistence.Media) IFormController(com.servoy.j2db.IFormController) Solution(com.servoy.j2db.persistence.Solution)

Example 5 with Solution

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;
    }
}
Also used : RootObjectMetaData(com.servoy.j2db.persistence.RootObjectMetaData) RootObjectReference(com.servoy.j2db.persistence.RootObjectReference) ArrayList(java.util.ArrayList) RepositoryException(com.servoy.j2db.persistence.RepositoryException) JSONObject(org.json.JSONObject) IRootObject(com.servoy.j2db.persistence.IRootObject) Solution(com.servoy.j2db.persistence.Solution)

Aggregations

Solution (com.servoy.j2db.persistence.Solution)59 FlattenedSolution (com.servoy.j2db.FlattenedSolution)17 Form (com.servoy.j2db.persistence.Form)16 ScriptMethod (com.servoy.j2db.persistence.ScriptMethod)14 RepositoryException (com.servoy.j2db.persistence.RepositoryException)12 ArrayList (java.util.ArrayList)9 RemoteException (java.rmi.RemoteException)8 HashMap (java.util.HashMap)8 FlattenedForm (com.servoy.j2db.persistence.FlattenedForm)7 IPersist (com.servoy.j2db.persistence.IPersist)6 TableNode (com.servoy.j2db.persistence.TableNode)6 ServoyException (com.servoy.j2db.util.ServoyException)6 JSONObject (org.json.JSONObject)6 IFormController (com.servoy.j2db.IFormController)5 Map (java.util.Map)5 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)5 JavaScriptException (org.mozilla.javascript.JavaScriptException)5 IRepository (com.servoy.j2db.persistence.IRepository)4 List (java.util.List)4 ApplicationException (com.servoy.j2db.ApplicationException)3