Package com.sun.enterprise.config.serverbeans.validation

Examples of com.sun.enterprise.config.serverbeans.validation.Result


        super(desc);
        flag = false;
    }

    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        String choice = cce.getChoice();
        try {
            if (choice.equals(StaticTest.ADD) || choice.equals(StaticTest.VALIDATE)) {
                final IdentityAssertionTrust iat = (IdentityAssertionTrust) cce.getObject();
                Config c = (Config) ((SecurityService) cce.getClassObject()).parent();
                boolean isDefault = iat.isIsDefault();
                if (isDefault) {
                    String trustId = checkIsDefault(c);
                    if (flag && (trustId != null)) {
                        result.failed(_strMgr.getString("DefaultTrustConfigExists", trustId));
                    }
                }
            }
            if (choice.equals(StaticTest.UPDATE)) {
                if (ConfigBean.toBoolean((String) cce.getObject())) {
                    final IdentityAssertionTrust iat = (IdentityAssertionTrust) cce.getClassObject();
                    final Config c = (Config) ((SecurityService) iat.parent()).parent();
                    String trustId = checkIsDefault(c);
                    if (flag) {
                        result.failed(_strMgr.getString("DefaultTrustConfigExists", trustId));
                    }
                }
            }
        } catch (Exception e) {
            _logger.log(Level.INFO, e.toString());
View Full Code Here


    public SipListenerTest(ValidationDescriptor desc) {
        super(desc);
    }

    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        String choice = cce.getChoice();
        try {
            if (choice.equals(StaticTest.ADD) || choice.equals(StaticTest.VALIDATE)) {
                final SipListener sl = (SipListener) cce.getObject();
                Config c = (Config) ((SipService) cce.getClassObject()).parent();
                String addr = sl.getExternalSipAddress();
                String port = sl.getExternalSipPort();
                if (sl.getType().equals("internal")) {
                    if (addr != null || port != null) {
                        result.failed(_strMgr.getString("ExternalIsFalse"));
                    }
                }
            }
           if (choice.equals(StaticTest.UPDATE)) {
              if(ServerTags.EXTERNAL_SIP_ADDRESS.equals(cce.getName()) || ServerTags.EXTERNAL_SIP_PORT.equals(cce.getName())) {
                    final SipListener sl = (SipListener) cce.getClassObject();
                    final Config c = (Config) ((SipService) sl.parent()).parent();
                    if (sl.getType().equals("internal")) {
                            result.failed(_strMgr.getString("ExternalIsFalse"));
                    }
              } 
           }
        } catch (Exception e) {
            _logger.log(Level.INFO, e.toString());
View Full Code Here

    DeployableAppTest(final ValidationDescriptor desc){
        super(desc);
    }

    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom
                                             // validation do basic
                                             // validation
        try{
            if(cce.getChoice().equals(StaticTest.UPDATE) || cce.getChoice().equals(StaticTest.DELETE)) {
           
                if(!getObjectType(cce).equals("user"))
                    result.failed(smh.getLocalString(getClass().getName()+".systemAppNotChangeable",
                                                     "System Application, Attribute Not Changeable"));
            }
        }
        catch (final ConfigException ce){
            _logger.log(Level.WARNING, "domainxmlverifier.exception", ce);
View Full Code Here

    public ProfilerTest(ValidationDescriptor desc) {
        super(desc);
    }
   
    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
       
        if(cce.getChoice().equals(StaticTest.VALIDATE)) {
            Profiler profiler = (Profiler) cce.getObject();
            validateAttribute(ServerTags.CLASSPATH, profiler.getClasspath(), result);
            JvmOptionsTest.validateJvmOptions(profiler.getJvmOptions(), result);
View Full Code Here

    public DomainTest(ValidationDescriptor desc) {
        super(desc);
    }
   
    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
       
        if(cce.getChoice().equals(StaticTest.ADD) || cce.getChoice().equals(StaticTest.VALIDATE)) {
             Domain domain = (Domain)cce.getObject();
/*
             String locale = domain.getLocale();
View Full Code Here

    }
   
    public Result validate(final ConfigContextEvent cce) {
        _logger.log(Level.CONFIG, "SslTest validation");
       
        final Result result = super.validate(cce); // Before doing custom validation do basic validation
       
        final String choice = cce.getChoice();
        if(choice.equals(StaticTest.UPDATE)) {
            return performUpdateChecks(result, cce);
        } else if (choice.equals(StaticTest.SET)) {
View Full Code Here

    public LifecycleModuleTest(ValidationDescriptor desc) {
        super(desc);
    }
   
    public Result validate(final ConfigContextEvent cce) {
        final Result result = super.validate(cce); // Before doing custom validation do basic validation
        if(cce.getChoice().equals(StaticTest.UPDATE) || cce.getChoice().equals(StaticTest.VALIDATE)) {
            validateAttribute(cce.getName(), (LifecycleModule) cce.getObject(), result);
        }
        return result;
    }
View Full Code Here

    public HttpListenerTest(ValidationDescriptor desc) {
        super(desc);
    }
   
    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        String choice = cce.getChoice();
       
        if(choice.equals(StaticTest.ADD) || choice.equals(StaticTest.VALIDATE)) {
            final HttpListener h = (HttpListener)cce.getObject();
            String vsId = h.getDefaultVirtualServer();
            try {
                Config config = (Config) ((HttpService) cce.getClassObject()).parent();
                if( config!=null ) {
                    boolean exists = checkVSExists(vsId, config);
                    if(!exists) {
                        result.failed(smh.getLocalString(getClass().getName() + ".virtualserverNotFound",
                                                         "Attribute(default-virtual-server={0}) : Virtual Server not found", new Object[]{vsId}));
                    } else if (h.isEnabled()){
                            // When the listener is enabled then the virtual
                            // server must be on.
                        if (! isVirtualServerOn(h, config, result)){
                            result.failed(smh.getLocalString(getClass().getName() + ".cannotAddVsNotOn",
                                                             "Cannot add this HttpListener \"{0}\" because it is enabled but its virtual server \"{1}\" has a state other than \"on\" ({2})",
                                                             new Object[]{h.getId(), vsId, getDefaultVirtualServer(vsId, config).getState()}));
                        }
                    }
                }
               
            }
            catch(Exception e){
                _logger.log(Level.FINE, "domainxmlverifier.error", e);
               
            }
        } else if (choice.equals(StaticTest.UPDATE)) {
            if (cce.getName().equals("enabled") && ConfigBean.toBoolean((String) cce.getObject())){
                final HttpListener h = (HttpListener) cce.getClassObject();
                final Config c = (Config) ((HttpService) h.parent()).parent();
                final VirtualServer vs = getDefaultVirtualServer(h.getDefaultVirtualServer(), c);
                if (null != vs && !vs.getState().equals("on")){
                    result.failed(smh.getLocalString(getClass().getName() + ".cannotUpdateVSNotOn",
                                                     "Cannot enable this HttpListener \"{0}\" because its virtual server \"{1}\" has a state other than \"on\" ({2})",
                                                     new Object[]{h.getId(), vs.getId(), vs.getState()}));
                                                    
                }
            } else if (ServerTags.ENABLED.equals(cce.getName()) && ! ConfigBean.toBoolean((String) cce.getObject())) {
                final HttpListener h = (HttpListener) cce.getClassObject();
                if (com.sun.enterprise.config.serverbeans.ServerHelper.ADMIN_HTTP_LISTNER_ID.equals(h.getId())) {
                    //this is rather stupid
                    final String locmsg = this.getClass().getName() + ".cantDisableAdminVS";
                    final String enmsg = "ADMVAL1076: The http-listener reserved for administrative purposes can not be disabled.";
                    final String msg = smh.getLocalString(locmsg, enmsg);
                    result.failed(msg);                   
                }
            }
        } else if (StaticTest.DELETE.equals(choice)) {
            //the admin-listener cannot be deleted
            if (cce.getObject() instanceof HttpListener) {
                final HttpListener h = (HttpListener) cce.getObject();
                // this assumes that "admin-listener" is reserved in any config, although it makes sense only for DAS
                // so, I am not making any checks if this is DAS's config
                if (com.sun.enterprise.config.serverbeans.ServerHelper.ADMIN_HTTP_LISTNER_ID.equals(h.getId())) {
                    //this is rather stupid
                    final String locmsg = this.getClass().getName() + ".cantDeleteAdminListener";
                    final String enmsg = "ADMVAL1075: The http-listener reserved for administrative purposes can not be deleted.";
                    final String msg = smh.getLocalString(locmsg, enmsg);
                    result.failed(msg);
                }
            }
        } else {
            _logger.log(Level.SEVERE, "domainxmlverifier.unknownchoice", choice);
        }
View Full Code Here

        return (Cluster) cce.getValidationTarget();
    }
   

    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        boolean flag = false;
        String choice = cce.getChoice();
        try {
            if (choice.equals(StaticTest.UPDATE)){
                validateUpdate(cce, result);
View Full Code Here

    }
   
   

    public Result validate(ConfigContextEvent cce) {
        Result result = super.validate(cce); // Before doing custom validation do basic validation
        boolean flag = false;
        String choice = cce.getChoice();
        try {
            if (choice.equals(StaticTest.SET)){
                validateSet(cce, result);
            } else if (choice.equals(StaticTest.UPDATE)){
                validateUpdate(cce, result);
            } else if (choice.equals(StaticTest.ADD)){
                validateAdd(cce, result);
            } else if(choice.equals(StaticTest.VALIDATE)) {
                Domain domain = (Domain)cce.getConfigContext().getRootConfigBean();
                Servers servers = domain.getServers();
                Server[] server = servers.getServer();
                    String svrName = server[0].getName();
                    if(!server[0].getName().equals("server"))
                        result.failed(smh.getLocalString(getClass().getName() + ".invalidserverName",
                                                         "Invalid Server Name {0}: Required 'server'", new Object[]{svrName}));
            }
           
           
            } catch(Exception e) {
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.validation.Result

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.