FileDocCategorySizeDatePackage
StaticTest.javaAPI DocGlassfish v2 API6823Fri May 04 22:34:12 BST 2007com.sun.enterprise.admin.verifier.tests

StaticTest

public class StaticTest extends Object
PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms. Copyright 2001-2002 by iPlanet/Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All rights reserved.

Fields Summary
static Logger
_logger
public static final String
ADD
Represents the ADD configbean request
public static final String
DELETE
Represents the DELETE configbean request
public static final String
UPDATE
Represents the UPDATE configbean request
public static final String
SET
Represents the SET configbean request
public static final String
IAS_NAME
public static final String
XML_1
public static final String
XML_2
Constructors Summary
public StaticTest()

    //</addition>
    
      
    
Methods Summary
public static booleancheckAddress(java.lang.String address)

        if(address.equalsIgnoreCase("ANY") || address.equalsIgnoreCase("INADDR_ANY") || 
                                address.equalsIgnoreCase("localhost")) 
            return false;
        else 
            return true;
    
public static booleancheckObjectName(java.lang.String id)
should just take in the id. construct the name inside this method

        String name = IAS_NAME + id;
        new ObjectName(name);  // verify that it's good
        return true;
    
public static booleancheckObjectName(java.lang.String id, com.sun.enterprise.admin.verifier.Result result)
method to be called by verifier

        try {
            return checkObjectName(id);
        } catch(MalformedObjectNameException ex) {
            _logger.log(Level.FINE, "serverxmlverifier.exception", ex);
            result.failed(ex.getMessage());
            return false;
        }
    
public static booleancheckXMLName(java.lang.String name)
external method to be called by instller, etc for checking if the string is a valid xml string This is a very expensive test. Be prudent in using it.

            //Construct a valid xml string
            String xml = XML_1 + name + XML_2;
            ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
            InputSource is = new InputSource(bais);
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setValidating(false);
            DocumentBuilder db = dbf.newDocumentBuilder();
            db.parse(is);
            return true;
    
public static booleancheckXMLName(java.lang.String name, com.sun.enterprise.admin.verifier.Result result)
method called by verifier for checking for a valid xml string This is a very expensive test. Be prudent in using it.

        try {
            return checkXMLName(name);
        } catch (Exception s) {
            _logger.log(Level.FINE, "serverxmlverifier.exception", s);
            result.failed(s.getMessage());
            return false;
        }
    
public static ConfiggetConfig(com.sun.enterprise.config.ConfigContext context)

        
        Config mConfig=null;
        try {
            mConfig = ServerBeansFactory.getConfigBean(context);
        } catch(Exception e) {
        }
        return mConfig;
    
public static booleanisPortValid(int i)

        if(i > 0 && i <= 65535) 
            return true;
        else
            return false;