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];
}
}
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);
}
}
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);
}
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();
}
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();
}
Aggregations