use of org.omg.CORBA.BAD_OPERATION in project jdk8u_jdk by JetBrains.
the class _HelloImpl_Tie method _invoke.
public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
try {
org.omg.CORBA_2_3.portable.InputStream in = (org.omg.CORBA_2_3.portable.InputStream) _in;
switch(method.length()) {
case 8:
if (method.equals("sayHello")) {
String arg0 = (String) in.read_value(String.class);
String result = target.sayHello(arg0);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 14:
if (method.equals("sayHelloToTest")) {
Test arg0 = (Test) in.read_value(Test.class);
String result = target.sayHelloToTest(arg0);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 19:
if (method.equals("sayHelloWithHashMap")) {
ConcurrentHashMap arg0 = (ConcurrentHashMap) in.read_value(ConcurrentHashMap.class);
String result = target.sayHelloWithHashMap(arg0);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 20:
if (method.equals("sayHelloWithHashMap2")) {
HashMap arg0 = (HashMap) in.read_value(HashMap.class);
String result = target.sayHelloWithHashMap2(arg0);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 23:
if (method.equals("sayHelloWithInetAddress")) {
InetAddress arg0 = (InetAddress) in.read_value(InetAddress.class);
String result = target.sayHelloWithInetAddress(arg0);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 25:
if (method.equals("sayHelloWithReentrantLock")) {
ReentrantLock arg0 = (ReentrantLock) in.read_value(ReentrantLock.class);
String result = target.sayHelloWithReentrantLock(arg0);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
}
throw new BAD_OPERATION();
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}
use of org.omg.CORBA.BAD_OPERATION in project JFramework by gugumall.
the class _JRouterAbstract_Tie method _invoke.
public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
try {
JRouterAbstract target = this.target;
if (target == null) {
throw new java.io.IOException();
}
org.omg.CORBA_2_3.portable.InputStream in = (org.omg.CORBA_2_3.portable.InputStream) _in;
switch(method.length()) {
case 7:
if (method.equals("startup")) {
target.startup();
OutputStream out = reply.createReply();
return out;
}
case 8:
if (method.equals("shutdown")) {
target.shutdown();
OutputStream out = reply.createReply();
return out;
}
case 11:
if (method.equals("heartbeat__")) {
String result = target.heartbeat();
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 17:
if (method.equals("_get_routerConfig")) {
RouterConfig result = target.getRouterConfig();
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, RouterConfig.class);
return out;
} else if (method.equals("_set_routerConfig")) {
RouterConfig arg0 = (RouterConfig) in.read_value(RouterConfig.class);
target.setRouterConfig(arg0);
OutputStream out = reply.createReply();
return out;
}
case 67:
if (method.equals("service__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue")) {
String arg0 = (String) in.read_value(String.class);
String arg1 = (String) in.read_value(String.class);
String arg2 = (String) in.read_value(String.class);
ServiceBase result = target.service(arg0, arg1, arg2);
OutputStream out = reply.createReply();
Util.writeRemoteObject(out, result);
return out;
}
case 86:
if (method.equals("getAllServiceNodeAvailable__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue")) {
String arg0 = (String) in.read_value(String.class);
String arg1 = (String) in.read_value(String.class);
String arg2 = (String) in.read_value(String.class);
ServiceBase[] result = target.getAllServiceNodeAvailable(arg0, arg1, arg2);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(cast_array(result), ServiceBase[].class);
return out;
}
case 90:
if (method.equals("unregister__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue")) {
String arg0 = (String) in.read_value(String.class);
String arg1 = (String) in.read_value(String.class);
String arg2 = (String) in.read_value(String.class);
String arg3 = (String) in.read_value(String.class);
String result = target.unregister(arg0, arg1, arg2, arg3);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 144:
if (method.equals("service__j_app_webserver_JSession__javax_servlet_http_HttpSession__javax_servlet_http_HttpServletRequest__javax_servlet_http_HttpServletResponse")) {
JSession arg0 = (JSession) in.read_value(JSession.class);
HttpSession arg1 = (HttpSession) in.read_value(HttpSession.class);
HttpServletRequest arg2 = (HttpServletRequest) in.read_value(HttpServletRequest.class);
HttpServletResponse arg3 = (HttpServletResponse) in.read_value(HttpServletResponse.class);
target.service(arg0, arg1, arg2, arg3);
OutputStream out = reply.createReply();
return out;
}
case 145:
if (method.equals("register__j_app_webserver_JSession__javax_servlet_http_HttpSession__javax_servlet_http_HttpServletRequest__javax_servlet_http_HttpServletResponse")) {
JSession arg0 = (JSession) in.read_value(JSession.class);
HttpSession arg1 = (HttpSession) in.read_value(HttpSession.class);
HttpServletRequest arg2 = (HttpServletRequest) in.read_value(HttpServletRequest.class);
HttpServletResponse arg3 = (HttpServletResponse) in.read_value(HttpServletResponse.class);
target.register(arg0, arg1, arg2, arg3);
OutputStream out = reply.createReply();
return out;
}
case 146:
if (method.equals("heartbeat__j_app_webserver_JSession__javax_servlet_http_HttpSession__javax_servlet_http_HttpServletRequest__javax_servlet_http_HttpServletResponse")) {
JSession arg0 = (JSession) in.read_value(JSession.class);
HttpSession arg1 = (HttpSession) in.read_value(HttpSession.class);
HttpServletRequest arg2 = (HttpServletRequest) in.read_value(HttpServletRequest.class);
HttpServletResponse arg3 = (HttpServletResponse) in.read_value(HttpServletResponse.class);
target.heartbeat(arg0, arg1, arg2, arg3);
OutputStream out = reply.createReply();
return out;
}
case 147:
if (method.equals("unregister__j_app_webserver_JSession__javax_servlet_http_HttpSession__javax_servlet_http_HttpServletRequest__javax_servlet_http_HttpServletResponse")) {
JSession arg0 = (JSession) in.read_value(JSession.class);
HttpSession arg1 = (HttpSession) in.read_value(HttpSession.class);
HttpServletRequest arg2 = (HttpServletRequest) in.read_value(HttpServletRequest.class);
HttpServletResponse arg3 = (HttpServletResponse) in.read_value(HttpServletResponse.class);
target.unregister(arg0, arg1, arg2, arg3);
OutputStream out = reply.createReply();
return out;
}
case 148:
if (method.equals("register__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue__CORBA_WStringValue")) {
String arg0 = (String) in.read_value(String.class);
String arg1 = (String) in.read_value(String.class);
String arg2 = (String) in.read_value(String.class);
String arg3 = (String) in.read_value(String.class);
String arg4 = (String) in.read_value(String.class);
String arg5 = (String) in.read_value(String.class);
String arg6 = (String) in.read_value(String.class);
String result = target.register(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value(result, String.class);
return out;
}
case 163:
if (method.equals("getAllServiceNodeAvailable__j_app_webserver_JSession__javax_servlet_http_HttpSession__javax_servlet_http_HttpServletRequest__javax_servlet_http_HttpServletResponse")) {
JSession arg0 = (JSession) in.read_value(JSession.class);
HttpSession arg1 = (HttpSession) in.read_value(HttpSession.class);
HttpServletRequest arg2 = (HttpServletRequest) in.read_value(HttpServletRequest.class);
HttpServletResponse arg3 = (HttpServletResponse) in.read_value(HttpServletResponse.class);
target.getAllServiceNodeAvailable(arg0, arg1, arg2, arg3);
OutputStream out = reply.createReply();
return out;
}
}
throw new BAD_OPERATION();
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}
use of org.omg.CORBA.BAD_OPERATION in project alliance by codice.
the class OrderRequestImpl method complete.
@Override
public State complete(DeliveryManifestHolder deliveryManifestHolder) throws ProcessingFault, SystemFault {
DeliveryManifest deliveryManifest = new DeliveryManifest();
List<PackageElement> packageElements = new ArrayList<>();
if (!orderContainsSupportedDelivery()) {
throw new NO_IMPLEMENT("Only HTTP(s) is supported");
}
try {
String filename = null;
PackagingSpecFormatType packageFormatType = PackagingSpecFormatType.FILESUNC;
List<ResourceContainer> files = new ArrayList<>();
if (order.prod_list == null) {
throw new BAD_OPERATION("No products specified for the order");
}
for (ProductDetails productDetails : order.prod_list) {
requestProductResource(files, productDetails);
}
if (order.pSpec != null) {
PackagingSpec packagingSpec = order.pSpec;
filename = packagingSpec.package_identifier;
packageFormatType = PackagingSpecFormatType.valueOf(packagingSpec.packaging_format_and_compression);
}
if (order.del_list != null) {
for (DeliveryDetails deliveryDetails : order.del_list) {
Destination destination = deliveryDetails.dests;
Optional<DestinationSink> destinationSink = destinationSinkFactory.apply(destination);
if (destinationSink.isPresent()) {
List<String> filesSent = writeData(destinationSink.get(), packageFormatType, files, filename);
PackageElement packageElement = new PackageElement();
packageElement.files = filesSent.toArray(new String[filesSent.size()]);
packageElements.add(packageElement);
}
}
}
} catch (UnsupportedEncodingException | WrongAdapter | WrongPolicy e) {
LOGGER.debug("Unable to get Metacard for product:", e);
} catch (IOException | ExecutionException | SecurityServiceException e) {
LOGGER.debug("Unable to retrieve resource:", e);
}
if (order.pSpec != null) {
deliveryManifest.package_name = order.pSpec.package_identifier;
}
deliveryManifest.elements = packageElements.toArray(new PackageElement[packageElements.size()]);
deliveryManifestHolder.value = deliveryManifest;
return State.COMPLETED;
}
use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class Client05 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
TransactionFactory transactionFactory = null;
String[] transactionFactoryParams = new String[1];
transactionFactoryParams[0] = ORBServices.otsKind;
transactionFactory = TransactionFactoryHelper.narrow(ORBServices.getService(ORBServices.transactionService, transactionFactoryParams));
boolean correct;
Control control = transactionFactory.create(4);
Thread.sleep(8000);
try {
control.get_terminator().commit(false);
correct = false;
} catch (INVALID_TRANSACTION invalidTransaction) {
correct = true;
} catch (BAD_OPERATION badOperation) {
correct = true;
} catch (org.omg.CORBA.OBJECT_NOT_EXIST object_not_exist_exception) {
// This test creates a transaction with timeout period of 4 seconds then
// sleeps for 8 seconds.
// When the timeout goes off at the transaction service, the transaction is
// rolled back and destroyed.
// The subsequent call to commit on the transaction results in an
// org.omg.CORBA.OBJECT_NOT_EXIST exception being thrown.
// The JTS specification appears to be quite vague in this area, however our
// implementation is compliant with this vagueness.
// Hence, For the purposes of this test, org.omg.CORBA.OBJECT_NOT_EXIST being thrown
// does not indicate a failure - BD 20/06/01
correct = true;
} catch (Exception exception) {
System.err.println("Client05.main: commit exception = " + exception);
correct = false;
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client05.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client05.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.BAD_OPERATION in project narayana by jbosstm.
the class ArjunaTransactionImple method register_resource.
/**
* Resources are only registered with the current transaction, whereas
* subtransaction aware resources are registered with their parents when the
* current transaction ends.
*/
public RecoveryCoordinator register_resource(Resource r) throws SystemException, Inactive {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource ( " + r + " ) - called for " + get_uid());
}
if (r == null)
throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
currentStatus = determineStatus(this);
if (currentStatus != Status.StatusActive) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource - transaction not active: " + Utility.stringStatus(currentStatus));
}
if (currentStatus == Status.StatusMarkedRollback) {
throw new TRANSACTION_ROLLEDBACK(ExceptionCodes.MARKED_ROLLEDBACK, CompletionStatus.COMPLETED_NO);
} else
throw new Inactive();
}
AbstractRecord corbaRec = null;
BasicAction registerIn = this;
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple " + get_uid() + " ::register_resource: ");
}
//
// Creation of recovery coordinator (DBI)
//
//
// Pack the params:
// [0] = Transaction* this
//
int index = 0;
Object[] params = new Object[10];
params[index++] = this;
RecoveryCoordinator recoveryCoordinator = null;
Uid recoveryCoordinatorUid = null;
try {
recoveryCoordinator = RecoveryCreator.createRecoveryCoordinator(r, params);
if (recoveryCoordinator == null)
throw new BAD_OPERATION("RecoveryCoordinator " + jtsLogger.i18NLogger.get_orbspecific_coordinator_rcnotcreated());
} catch (NO_IMPLEMENT ex) {
/*
* This is legal, and is meant to show that this ORB or
* configuration simply doesn't support crash recovery.
*/
recoveryCoordinator = null;
} catch (SystemException e) {
jtsLogger.i18NLogger.warn_orbspecific_coordinator_rccreate(get_uid(), e);
try {
rollback_only();
} catch (Inactive ex1) {
} catch (SystemException ex2) {
jtsLogger.i18NLogger.warn_orbspecific_coordinator_rbofail("ArjunaTransactionImple.register_resource", get_uid(), ex2);
throw ex2;
}
throw e;
}
if (recoveryCoordinator != null) {
//
// We got a RecoveryCoordinator, so unpack the other return values:
// [0] = RecoveryCoordinator Uid*
//
index = 0;
recoveryCoordinatorUid = (Uid) params[index++];
} else {
//
// We didn't get a RecoveryCoordinator, so we don't assume that
// the other return values have been populated.
//
recoveryCoordinatorUid = Uid.nullUid();
}
try {
SubtransactionAwareResource staResource = org.omg.CosTransactions.SubtransactionAwareResourceHelper.narrow(r);
if (staResource != null) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " - subtransaction aware resource: YES");
}
/*
* If here the narrow was ok so we have a subtran aware
* resource.
*/
Coordinator coord = null;
if (parentHandle != null) {
/*
* If we are a SubTranResource then we get registered with
* the current transaction and its parents upon completion.
* The first parameter to the record indicates whether we
* should be propagated (registered) with the parent
* transaction.
*/
coord = parentHandle.get_coordinator();
}
corbaRec = createOTSRecord(true, r, coord, recoveryCoordinatorUid);
coord = null;
staResource = null;
} else
throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
} catch (BAD_PARAM ex) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " - subtransaction aware resource: NO");
}
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple " + get_uid() + " ::register_resource: Simple resource - " + ex);
}
corbaRec = createOTSRecord(true, r, null, recoveryCoordinatorUid);
} catch (Unavailable e1) {
throw new Inactive();
} catch (SystemException e2) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : catch (SystemException) - " + e2);
}
throw e2;
} catch (Exception e3) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : catch (...) - " + e3);
}
throw new UNKNOWN(e3.toString(), ExceptionCodes.UNKNOWN_EXCEPTION, CompletionStatus.COMPLETED_NO);
}
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : try end");
}
if (registerIn.add(corbaRec) != AddOutcome.AR_ADDED) {
corbaRec = null;
throw new INVALID_TRANSACTION(ExceptionCodes.ADD_FAILED, CompletionStatus.COMPLETED_NO);
} else {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : resource registered");
}
}
return recoveryCoordinator;
}
Aggregations