Package com.adito.boot

Examples of com.adito.boot.PropertyDefinition


    }

    @SuppressWarnings("deprecation")
    private void setValidationString(String validationString) {
        PropertyClass propertyClass = PropertyClassManager.getInstance().getPropertyClass(RealmProperties.NAME);
        PropertyDefinition usernameProperty = propertyClass.getDefinition("activeDirectory.serviceAccountUsername");
        usernameProperty.setValidationString(validationString);
    }
View Full Code Here


     */
    public static int getUsersProfilePropertyIntOrDefault(HttpSession session, String propertyName, User user) {
        try {
            return Property.getPropertyInt(getPropertyProfileKey(session, propertyName, user));
        } catch (Exception expt) {
            PropertyDefinition definition = Property.getDefinition(getPropertyProfileKey(session, propertyName, null));
            return Integer.valueOf(definition.getDefaultValue());
        }
    }
View Full Code Here

     * @throws JDOMException
     * @throws CodedException
     */
    @Test
    public void validPortWithNoMetaData() throws IOException, JDOMException, CodedException {
        PropertyDefinition definition = getWebServerPortDefinition();
        definition.setTypeMeta("");
        PortValidator validator = new PortValidator();
        validator.validate(definition, "69", null);
    }
View Full Code Here

     * @throws JDOMException
     * @throws CodedException
     */
    @Test(expected = CoreException.class)
    public void invalidPortWithNoMetaData() throws IOException, JDOMException, CodedException {
        PropertyDefinition definition = getWebServerPortDefinition();
        definition.setTypeMeta("");
        PortValidator validator = new PortValidator();
        validator.validate(definition, "99999999", null);
    }
View Full Code Here

     * @throws IOException
     * @throws JDOMException
     */
    @Test
    public void validPortSocketNotInUse() throws CodedException, IOException, JDOMException {
        PropertyDefinition definition = getWebServerPortDefinition();
        assertPortNotInUse(69);
        PortValidator validator = new PortValidator();
        validator.validate(definition, "69", null);
    }
View Full Code Here

     * @throws IOException
     * @throws JDOMException
     */
    @Test(expected = CoreException.class)
    public void validPortSocketInUse() throws CodedException, IOException, JDOMException {
        PropertyDefinition definition = getWebServerPortDefinition();
        assertPortNotInUse(69);

        ServerSocket socket = new ServerSocket(69);
        try {
            PortValidator validator = new PortValidator();
View Full Code Here

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        if (isCommiting()) {
            ActionErrors errs = null;
            PropertyItem[] items = getPropertyItems();
            for (int i = 0; i < items.length; i++) {
                PropertyDefinition def = items[i].getDefinition();
                try {
                    def.validate(String.valueOf(items[i].getPropertyValue()), getClass().getClassLoader());
                } catch (CoreException ce) {
                    if (errs == null) {
                        errs = new ActionErrors();
                    }
                    ce.getBundleActionMessage().setArg3(
                        CoreUtil.getMessageResources(request.getSession(), def.getMessageResourcesKey()).getMessage(
                            (Locale) request.getSession().getAttribute(Globals.LOCALE_KEY), def.getName() + ".name"));
                    errs.add(Globals.ERROR_KEY, ce.getBundleActionMessage());
                } catch (Exception e) {
                    errs.add(Globals.ERROR_KEY, new ActionMessage("properties.error.failedToValidate", e.getMessage()));
                }
            }
View Full Code Here

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errs = super.validate(mapping, request);
        if (isCommiting()) {
            try {
                for (AttributeValueItem item : attributeValueItems) {
                    PropertyDefinition def = item.getDefinition();
                    try {
                        def.validate(item.getValue().toString(), getClass().getClassLoader());
                    } catch (CoreException ce) {
                        ce.getBundleActionMessage().setArg3(item.getLabel());
                        errs.add(Globals.ERROR_KEY, ce.getBundleActionMessage());
                    }
                }
View Full Code Here

            }
            PropertyClass propertyClass = PropertyClassManager.getInstance().getPropertyClass(propertyClassName);
            if(propertyClass == null) {
                throw new Exception("Invalid property class.");
            }
            PropertyDefinition def = propertyClass.getDefinition(name);
            if(def == null) {
                throw new Exception("No property definition with name of " + name);
            }
            else{
                // set the label and description from the messages resources if they have any.
                // If there are Application resources for the definition then set the label and description
                String label = CoreUtil.getMessage(request, def.getMessageResourcesKey(), def.getNameMessageResourceKey());
                if (label != null){
                    def.setLabel(label);
                }
//                String description = messageResources == null ? null : messageResources.getMessage(def.getDescriptionMessageResourceKey());
                String description = CoreUtil.getMessage(request, def.getMessageResourcesKey(), def.getDescriptionMessageResourceKey());
                if (description != null){
                    def.setDescription(description);
                }
            }
            request.setAttribute(Constants.REQ_ATTR_PROPERTY_DEFINITION, def);
            return mapping.findForward("property");
        }
View Full Code Here

            throw new Exception("Disabled.");
        }

        // Set the properties
        String oldVal, newVal;
        PropertyDefinition def;
        for (Iterator i = f.storedItems(); i.hasNext();) {
            PropertyItem item = (PropertyItem) i.next();
            def = item.getDefinition();
            newVal = String.valueOf(item.getPropertyValue());
            if (log.isDebugEnabled())
                log.debug("Setting '" + def.getName() + "' to '" + newVal + "'");
            oldVal = Property.setProperty(createKey(def, f, sessionInfo), newVal, sessionInfo);
            if ((oldVal == null && newVal != null) || !oldVal.equals(newVal)) {
                if (def.isRestartRequired()) {
                    restartRequired = true;
                }
            }
        }
        CoreUtil.resetMainNavigation(request.getSession());
View Full Code Here

TOP

Related Classes of com.adito.boot.PropertyDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.