use of org.omg.CORBA.ORBPackage.InvalidName 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();
}
use of org.omg.CORBA.ORBPackage.InvalidName in project narayana by jbosstm.
the class OTSImpleManager method init.
private static final synchronized void init() {
if (_current == null) {
if (OTSImpleManager._theFactory == null) {
/*
* Only check once, when the factory is first created.
*/
int resolver = Services.CONFIGURATION_FILE;
boolean requireTransactionManager = false;
if (jtsPropertyManager.getJTSEnvironmentBean().isTransactionManager()) {
requireTransactionManager = true;
String resolveMechanism = opPropertyManager.getOrbPortabilityEnvironmentBean().getResolveService();
if (resolveMechanism.compareTo("NAME_SERVICE") == 0)
resolver = Services.NAME_SERVICE;
else {
if (resolveMechanism.compareTo("BIND_CONNECT") == 0)
resolver = Services.BIND_CONNECT;
}
}
if (requireTransactionManager) {
try {
if (resolver != Services.BIND_CONNECT) {
String[] params = new String[1];
params[0] = Services.otsKind;
org.omg.CORBA.Object obj = ORBManager.getServices().getService(Services.transactionService, params, resolver);
params = null;
OTSImpleManager._theFactoryRef = org.omg.CosTransactions.TransactionFactoryHelper.narrow(obj);
} else {
}
if (OTSImpleManager._theFactoryRef == null)
throw new BAD_PARAM();
} catch (InvalidName e1) {
jtsLogger.i18NLogger.warn_otsserverfailed(e1);
throw new FatalError(e1.toString(), e1);
} catch (BAD_PARAM ex1) {
jtsLogger.i18NLogger.warn_otsserverfailed(ex1);
throw new FatalError(ex1.toString(), ex1);
} catch (IOException e2) {
jtsLogger.i18NLogger.warn_otsservererror(e2);
throw new FatalError(e2.toString(), e2);
} catch (SystemException e3) {
jtsLogger.i18NLogger.warn_otsservererror(e3);
throw new FatalError(e3.toString(), e3);
} catch (UserException e4) {
jtsLogger.i18NLogger.warn_otsservererror(e4);
throw new FatalError(e4.toString(), e4);
}
} else {
/* force to be local */
OTSImpleManager._theFactory = new TransactionFactoryImple();
}
}
if (OTSImpleManager._current == null) {
try {
OTSImpleManager._current = new CurrentImple();
OTSImpleManager._currentRef = OTSImpleManager._current;
} catch (Exception e) {
OTSImpleManager._current = null;
throw new com.arjuna.ats.arjuna.exceptions.FatalError("OTSImpleManager.current: " + e.toString(), e);
}
}
}
}
use of org.omg.CORBA.ORBPackage.InvalidName in project narayana by jbosstm.
the class Services method getService.
public org.omg.CORBA.Object getService(String serviceName, Object[] params, int mechanism) throws org.omg.CORBA.ORBPackage.InvalidName, IOException, SystemException {
org.omg.CORBA.Object objRef = null;
switch(mechanism) {
case RESOLVE_INITIAL_REFERENCES:
{
try {
objRef = _orb.orb().resolve_initial_references(serviceName);
} catch (SystemException ex) {
throw ex;
} catch (InvalidName exp) {
throw exp;
} catch (Exception e) {
if (opLogger.logger.isTraceEnabled()) {
opLogger.logger.trace("Services.getService - resolve_initial_references on " + serviceName + " failed: " + e.toString());
}
throw new InvalidName();
}
}
break;
case NAME_SERVICE:
{
String kind = ((params == null) ? null : (String) params[0]);
try {
org.omg.CORBA.Object nsRef = _orb.orb().resolve_initial_references(Services.nameService);
NamingContext ncRef = NamingContextHelper.narrow(nsRef);
// bind the Object Reference in Naming
NameComponent nc = new NameComponent(serviceName, kind);
NameComponent[] path = { nc };
objRef = ncRef.resolve(path);
} catch (SystemException ex) {
throw ex;
} catch (UserException e) {
throw new org.omg.CORBA.ORBPackage.InvalidName();
}
}
break;
case CONFIGURATION_FILE:
{
String cosservicesRoot = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesRoot();
String configLocation = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesFile();
String configFile = cosservicesRoot + File.separatorChar + configLocation;
LineNumberReader input;
try {
input = new LineNumberReader(new FileReader(configFile));
} catch (FileNotFoundException e) {
if (opLogger.logger.isTraceEnabled()) {
opLogger.logger.trace("Services.getService could not open config file " + configFile);
}
throw new InvalidName();
}
String ior = null;
try {
boolean finished = false;
while ((ior == null) && !finished) {
String line = input.readLine();
if (line == null)
finished = true;
else {
int occur = line.indexOf(serviceName);
if (// should be first on line
occur == 0)
// +1 for space separator
ior = line.substring(serviceName.length() + 1);
}
}
input.close();
} catch (SystemException ex) {
input.close();
throw ex;
} catch (Exception e) {
opLogger.i18NLogger.warn_Services_unexpectedexception("Services.getService", e);
input.close();
throw new UNKNOWN();
}
if (ior == null) {
opLogger.i18NLogger.warn_Services_servicenotfound(serviceName, configFile);
throw new InvalidName();
} else {
try {
objRef = _orb.orb().string_to_object(ior);
} catch (Exception e) {
objRef = null;
}
}
}
break;
case FILE:
{
try {
String fileDir = opPropertyManager.getOrbPortabilityEnvironmentBean().getFileDir();
File f = null;
if (fileDir != null && fileDir.length() != 0)
f = new File(fileDir + File.separator + serviceName);
else
f = new File(serviceName);
FileInputStream ifile = new FileInputStream(f);
int size = (int) f.length();
byte[] b = new byte[size];
ifile.read(b);
ifile.close();
String objString = new String(b, StandardCharsets.UTF_8);
objRef = _orb.orb().string_to_object(objString);
objString = null;
} catch (SystemException ex) {
throw ex;
} catch (FileNotFoundException e) {
throw new InvalidName();
}
}
break;
case NAMED_CONNECT:
{
opLogger.i18NLogger.warn_Services_unsupportedoption("NAMED_CONNECT");
throw new BAD_PARAM();
}
}
return objRef;
}
use of org.omg.CORBA.ORBPackage.InvalidName in project alliance by codice.
the class OrderMgrImplTest method setUp.
@Before
public void setUp() throws Exception {
setupCommonMocks();
setupOrderMgrMocks();
try {
setupOrb();
orbRunThread = new Thread(() -> orb.run());
orbRunThread.start();
} catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
LOGGER.error("Unable to start the CORBA server", e);
} catch (IOException e) {
LOGGER.error("Unable to generate the IOR file", e);
} catch (SecurityServiceException e) {
LOGGER.error("Unable to setup guest security credentials", e);
}
String managerId = UUID.randomUUID().toString();
orderMgr = new OrderMgrImpl();
orderMgr.setFilterBuilder(new GeotoolsFilterBuilder());
orderMgr.setCatalogFramework(mockCatalogFramework);
if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
try {
rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderMgr);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
LOGGER.error("Error activating ProductMgr: {}", e);
}
}
rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
use of org.omg.CORBA.ORBPackage.InvalidName in project alliance by codice.
the class ProductMgrImplTest method setUp.
@Before
public void setUp() throws Exception {
setupCommonMocks();
setupProductMgrMocks();
try {
setupOrb();
orbRunThread = new Thread(() -> orb.run());
orbRunThread.start();
} catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
LOGGER.error("Unable to start the CORBA server", e);
} catch (IOException e) {
LOGGER.error("Unable to generate the IOR file", e);
} catch (SecurityServiceException e) {
LOGGER.error("Unable to setup guest security credentials", e);
}
String managerId = UUID.randomUUID().toString();
productMgr = new ProductMgrImpl(null);
productMgr.setFilterBuilder(new GeotoolsFilterBuilder());
productMgr.setCatalogFramework(mockCatalogFramework);
productMgr.setOutgoingValidationEnabled(false);
if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
try {
rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), productMgr);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
LOGGER.error("Error activating ProductMgr: {}", e);
}
}
rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
Aggregations