Search in sources :

Example 1 with CDBFieldDoesNotExistEx

use of alma.cdbErrType.CDBFieldDoesNotExistEx in project ACS by ACS-Community.

the class CharacteristicModelImpl method find_characteristic.

/**
	 * @see alma.ACS.CharacteristicModelOperations#find_characteristic(java.lang.String)
	 */
public String[] find_characteristic(String wildcard) {
    //cmenay
    try {
        String[] allSeq;
        if (prefix == "")
            allSeq = dao.get_string_seq("");
        else
            allSeq = dao.get_string_seq(prefix);
        int max;
        max = allSeq.length;
        ArrayList<String> arrSeq = new ArrayList<String>();
        String regExpStr = WildcharMatcher.simpleWildcardToRegex(wildcard);
        Pattern pattern = Pattern.compile(regExpStr);
        for (int i = 0; i < max; i++) if (pattern.matcher(allSeq[i]).matches())
            arrSeq.add(allSeq[i]);
        if (arrSeq.isEmpty())
            throw new CDBFieldDoesNotExistEx();
        String[] ret = new String[arrSeq.size()];
        for (int i = 0; i < arrSeq.size(); i++) ret[i] = arrSeq.get(i);
        return ret;
    } catch (CDBFieldDoesNotExistEx e) {
        return new String[0];
    } catch (WrongCDBDataTypeEx e) {
        return new String[0];
    }
}
Also used : Pattern(java.util.regex.Pattern) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) ArrayList(java.util.ArrayList) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Example 2 with CDBFieldDoesNotExistEx

use of alma.cdbErrType.CDBFieldDoesNotExistEx in project ACS by ACS-Community.

the class TestHighLevelNodes method testMACI_Managers.

public void testMACI_Managers() throws Exception {
    HashSet<String> xmlNodes = new HashSet<String>(Arrays.asList(xmlDAL.list_nodes("MACI/Managers").split(" ")));
    HashSet<String> rdbNodes = new HashSet<String>(Arrays.asList(rdbDAL.list_nodes("MACI/Managers").split(" ")));
    logger.info("XML: " + xmlNodes.toString() + "; TMCDB: " + rdbNodes.toString());
    assertEquals(xmlNodes, rdbNodes);
    for (Iterator<String> iterator = xmlNodes.iterator(); iterator.hasNext(); ) {
        String xmlstring = "MACI/Managers/" + (String) iterator.next();
        DAO xmlDao = xmlDAL.get_DAO_Servant(xmlstring);
        DAO rdbDao = rdbDAL.get_DAO_Servant(xmlstring);
        examineLoggingConfig(xmlDao, rdbDao);
        assertEquals(xmlDao.get_string("Startup"), rdbDao.get_string("Startup"));
        assertEquals(xmlDao.get_string("ServiceComponents"), rdbDao.get_string("ServiceComponents"));
        String sx = null;
        boolean xbool = true;
        try {
            sx = xmlDao.get_string("ServiceDaemons");
        } catch (CDBFieldDoesNotExistEx e) {
            xbool = false;
        }
        String sr = null;
        try {
            sr = rdbDao.get_string("ServiceDaemons");
        } catch (CDBFieldDoesNotExistEx e) {
            if (xbool)
                fail("Service Daemons: XML CDB has value: " + sx + " but TMCDB can't find the field.");
            // Neither CDB can find it; move to next property
            continue;
        }
        if (!xbool)
            fail("Service Daemons: TMCDB has value: " + sr + " but XML CDB can't find the field.");
        // TODO: Redo this once Matej's implementation is complete
        assertEquals(sx, sr);
    }
}
Also used : DAO(com.cosylab.CDB.DAO) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 3 with CDBFieldDoesNotExistEx

use of alma.cdbErrType.CDBFieldDoesNotExistEx in project ACS by ACS-Community.

the class TestHighLevelNodes method examineDeployInfo.

private void examineDeployInfo(String xmlstring) throws Exception {
    boolean noRecordXml = false;
    DAO xmlDao = null;
    DAO rdbDao = null;
    try {
        xmlDao = xmlDAL.get_DAO_Servant(xmlstring + "/DeployInfo");
    } catch (CDBRecordDoesNotExistEx ex) {
        noRecordXml = true;
    }
    try {
        rdbDao = rdbDAL.get_DAO_Servant(xmlstring + "/DeployInfo");
        if (noRecordXml)
            fail("DeployInfo found for TMCDB in " + xmlstring + " but not in  XML CDB");
    } catch (CDBRecordDoesNotExistEx ex) {
        if (!noRecordXml)
            fail("DeployInfo found for XML CDB in " + xmlstring + " but not in TMCDB");
    }
    if (noRecordXml)
        return;
    //TODO: KeepAliveTime is an integer!
    final String[] propertyName = { "TypeModifiers", "Host", "Flags", "KeepAliveTime" };
    for (int i = 0; i < propertyName.length; i++) {
        System.out.println(propertyName[i]);
        String sx = null;
        boolean xbool = true;
        try {
            sx = xmlDao.get_string(propertyName[i]);
        } catch (CDBFieldDoesNotExistEx e) {
            xbool = false;
        }
        String sr = null;
        try {
            sr = rdbDao.get_string(propertyName[i]);
        } catch (CDBFieldDoesNotExistEx e) {
            if (xbool)
                fail("XML CDB has value: " + sx + " but TMCDB can't find the field.");
            // Neither CDB can find it; move to next property
            continue;
        }
        if (!xbool)
            fail("TMCDB has value: " + sr + " but XML CDB can't find the field.");
        assertEquals(sx, sr);
    }
    checkEqualsBoolean("StartOnDemand", xmlDao, rdbDao);
}
Also used : DAO(com.cosylab.CDB.DAO) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) CDBRecordDoesNotExistEx(alma.cdbErrType.CDBRecordDoesNotExistEx)

Example 4 with CDBFieldDoesNotExistEx

use of alma.cdbErrType.CDBFieldDoesNotExistEx in project ACS by ACS-Community.

the class CharacteristicModelImpl method get_characteristic_by_name.

/*********************** [ CharacteristicModel ] ***********************/
/**
	 * @see alma.ACS.CharacteristicModelOperations#get_characteristic_by_name(java.lang.String)
	 */
public Any get_characteristic_by_name(String name) throws NoSuchCharacteristic {
    try {
        String strVal = new String();
        if (prefix == "")
            strVal = dao.get_string(name);
        else
            strVal = dao.get_string(prefix + name);
        //I needed the getAny() to create a new Any, since a constructor for
        // Any (i.e: new Any() ), doesn't exist
        Any value_p = m_container.getAdvancedContainerServices().getAny();
        value_p.insert_string(strVal);
        return value_p;
    } catch (CDBFieldDoesNotExistEx fde) {
        NoSuchCharacteristic nsc = new NoSuchCharacteristic();
        nsc.characteristic_name = name;
        nsc.component_name = modelName;
        throw nsc;
    } catch (SystemException se) {
        throw se;
    } catch (WrongCDBDataTypeEx wct) {
    }
    throw new NoSuchCharacteristic();
}
Also used : SystemException(org.omg.CORBA.SystemException) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) Any(org.omg.CORBA.Any) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Example 5 with CDBFieldDoesNotExistEx

use of alma.cdbErrType.CDBFieldDoesNotExistEx in project ACS by ACS-Community.

the class CharacteristicModelImpl method get_all_characteristics.

/**
	 * @see alma.ACS.CharacteristicModelOperations#get_all_characteristics()
	 */
public PropertySet get_all_characteristics() {
    String[] allSeq;
    try {
        if (prefix == "")
            allSeq = dao.get_string_seq("");
        else
            allSeq = dao.get_string_seq(prefix);
        Property[] p = new Property[allSeq.length];
        for (int i = 0; i < allSeq.length; i++) {
            Any a = get_characteristic_by_name(allSeq[i]);
            p[i] = new Property(allSeq[i], a);
        }
        //dangerous methods!! 
        ORB orb = m_container.getAdvancedContainerServices().getORB();
        POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        rootpoa.the_POAManager().activate();
        PropertySetImpl psetImpl = new PropertySetImpl(p);
        PropertySetPOATie psetTie = new PropertySetPOATie(psetImpl, rootpoa);
        return psetTie._this(orb);
    } catch (CDBFieldDoesNotExistEx e) {
    } catch (WrongCDBDataTypeEx e) {
    } catch (NoSuchCharacteristic e) {
    } catch (MultipleExceptions e) {
    } catch (InvalidName e) {
    } catch (AdapterInactive e) {
    } catch (NullPointerException e) {
        System.out.println(e);
    }
    throw new NO_IMPLEMENT();
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) POA(org.omg.PortableServer.POA) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) Any(org.omg.CORBA.Any) PropertySetImpl(alma.ACS.jbaci.PropertySetImpl) PropertySetPOATie(org.omg.CosPropertyService.PropertySetPOATie) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) MultipleExceptions(org.omg.CosPropertyService.MultipleExceptions) Property(org.omg.CosPropertyService.Property) ORB(org.omg.CORBA.ORB) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Aggregations

CDBFieldDoesNotExistEx (alma.cdbErrType.CDBFieldDoesNotExistEx)6 WrongCDBDataTypeEx (alma.cdbErrType.WrongCDBDataTypeEx)4 NoSuchCharacteristic (alma.ACS.NoSuchCharacteristic)2 CDBRecordDoesNotExistEx (alma.cdbErrType.CDBRecordDoesNotExistEx)2 DAO (com.cosylab.CDB.DAO)2 Any (org.omg.CORBA.Any)2 POA (org.omg.PortableServer.POA)2 PropertySetImpl (alma.ACS.jbaci.PropertySetImpl)1 BACIPropertyType (alma.TMCDB.baci.BACIPropertyType)1 EmptyStringHandlerBACIPropertyType (alma.TMCDB.baci.EmptyStringHandlerBACIPropertyType)1 ClientLogManager (alma.acs.logging.ClientLogManager)1 BACIProperty (alma.acs.tmcdb.BACIProperty)1 ChannelMapping (alma.acs.tmcdb.ChannelMapping)1 Component (alma.acs.tmcdb.Component)1 ComponentType (alma.acs.tmcdb.ComponentType)1 Computer (alma.acs.tmcdb.Computer)1 Configuration (alma.acs.tmcdb.Configuration)1 Container (alma.acs.tmcdb.Container)1 ContainerStartupOption (alma.acs.tmcdb.ContainerStartupOption)1 DomainsMapping (alma.acs.tmcdb.DomainsMapping)1