diff options
33 files changed, 340 insertions, 6263 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 522f5ba0c43..b862b66634b 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -189,15 +189,7 @@ Slice::Gen::generate(const UnitPtr& p) { H << "\n#include <Ice/Object.h>"; H << "\n#include <Ice/Outgoing.h>"; - if(p->hasContentsWithMetaData("ami")) - { - H << "\n#include <Ice/OutgoingAsync.h>"; - } H << "\n#include <Ice/Incoming.h>"; - if(p->hasContentsWithMetaData("amd")) - { - H << "\n#include <Ice/IncomingAsync.h>"; - } H << "\n#include <Ice/Direct.h>"; C << "\n#include <Ice/LocalException.h>"; } @@ -269,12 +261,6 @@ Slice::Gen::generate(const UnitPtr& p) TypesVisitor typesVisitor(H, C, _dllExport, _stream); p->visit(&typesVisitor, false); - AsyncVisitor asyncVisitor(H, C, _dllExport); - p->visit(&asyncVisitor, false); - - AsyncImplVisitor asyncImplVisitor(H, C, _dllExport); - p->visit(&asyncImplVisitor, false); - ProxyVisitor proxyVisitor(H, C, _dllExport); p->visit(&proxyVisitor, false); @@ -1387,10 +1373,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) vector<string> paramsDecl; vector<string> args; - vector<string> paramsAMI; - vector<string> paramsDeclAMI; - vector<string> argsAMI; - ParamDeclList paramList = p->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { @@ -1416,15 +1398,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) params.push_back(typeString); paramsDecl.push_back(typeString + ' ' + paramName); args.push_back(paramName); - - if(!(*q)->isOutParam()) - { - string inputTypeString = inputTypeToString((*q)->type()); - - paramsAMI.push_back(inputTypeString); - paramsDeclAMI.push_back(inputTypeString + ' ' + paramName); - argsAMI.push_back(paramName); - } } string thisPointer = fixKwd(scope.substr(0, scope.size() - 2)) + "*"; @@ -1485,35 +1458,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; C << eb; C << eb; - - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - if(cl->hasMetaData("ami") || p->hasMetaData("ami")) - { - string classNameAMI = "AMI_" + cl->name(); - string classScope = fixKwd(cl->scope()); - string classScopedAMI = classScope + classNameAMI; - - H << nl << "void " << name << "_async" << spar << ("const" + classScopedAMI + '_' + name + "Ptr&") - << paramsAMI << epar << ';'; - H << nl << "void " << name << "_async" << spar << ("const" + classScopedAMI + '_' + name + "Ptr&") - << paramsAMI << "const ::Ice::Context&" << epar << ';'; - - C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar - << ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << epar; - C << sb; - C << nl << name << "_async" << spar << "__cb" << argsAMI << "__defaultContext()" << epar << ';'; - C << eb; - - C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar - << ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << "const ::Ice::Context& __ctx" - << epar; - C << sb; - // Async requests may only be sent twoway. - C << nl << "__checkTwowayOnly(\"" << name << "\");"; - C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "__ctx" << epar << ';'; - C << eb; - } } Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& dllExport) : @@ -2414,19 +2358,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) argsAMD += "__current)"; bool nonmutating = p->mode() == Operation::Nonmutating; - bool amd = !cl->isLocal() && (cl->hasMetaData("amd") || p->hasMetaData("amd")); H << sp; - if(!amd) - { - H << nl << "virtual " << retS << ' ' << fixKwd(name) << params - << (nonmutating ? " const" : "") << " = 0;"; - } - else - { - H << nl << "virtual void " << name << "_async" << paramsAMD - << (nonmutating ? " const" : "") << " = 0;"; - } + H << nl << "virtual " << retS << ' ' << fixKwd(name) << params << (nonmutating ? " const" : "") << " = 0;"; if(!cl->isLocal()) { @@ -2437,91 +2371,61 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name << "(::IceInternal::Incoming& __in, const ::Ice::Current& __current)" << (nonmutating ? " const" : ""); C << sb; - if(!amd) - { - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // + ExceptionList throws = p->throws(); + throws.sort(); + throws.unique(); + + // + // Arrange exceptions into most-derived to least-derived order. If we don't + // do this, a base exception handler can appear before a derived exception + // handler, causing compiler warnings and resulting in the base exception + // being marshaled instead of the derived exception. + // #if defined(__SUNPRO_CC) - throws.sort(derivedToBaseCompare); + throws.sort(derivedToBaseCompare); #else - throws.sort(Slice::DerivedToBaseCompare()); + throws.sort(Slice::DerivedToBaseCompare()); #endif - if(!inParams.empty()) - { - C << nl << "::IceInternal::BasicStream* __is = __in.is();"; - } - if(ret || !outParams.empty() || !throws.empty()) - { - C << nl << "::IceInternal::BasicStream* __os = __in.os();"; - } - writeAllocateCode(C, inParams, 0); - writeUnmarshalCode(C, inParams, 0); - writeAllocateCode(C, outParams, 0); - if(!throws.empty()) - { - C << nl << "try"; - C << sb; - } - C << nl; - if(ret) - { - C << retS << " __ret = "; - } - C << fixKwd(name) << args << ';'; - writeMarshalCode(C, outParams, ret); - if(!throws.empty()) - { - C << eb; - ExceptionList::const_iterator r; - for(r = throws.begin(); r != throws.end(); ++r) - { - C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)"; - C << sb; - C << nl << "__os->write(__ex);"; - C << nl << "return ::IceInternal::DispatchUserException;"; - C << eb; - } - } - C << nl << "return ::IceInternal::DispatchOK;"; + if(!inParams.empty()) + { + C << nl << "::IceInternal::BasicStream* __is = __in.is();"; } - else + if(ret || !outParams.empty() || !throws.empty()) + { + C << nl << "::IceInternal::BasicStream* __os = __in.os();"; + } + writeAllocateCode(C, inParams, 0); + writeUnmarshalCode(C, inParams, 0); + writeAllocateCode(C, outParams, 0); + if(!throws.empty()) { - if(!inParams.empty()) - { - C << nl << "::IceInternal::BasicStream* __is = __in.is();"; - } - writeAllocateCode(C, inParams, 0); - writeUnmarshalCode(C, inParams, 0); - C << nl << classScopedAMD << '_' << name << "Ptr __cb = new IceAsync" << classScopedAMD << '_' << name - << "(__in);"; C << nl << "try"; C << sb; - C << nl << name << "_async" << argsAMD << ';'; - C << eb; - C << nl << "catch(const ::Ice::Exception& __ex)"; - C << sb; - C << nl << "__cb->ice_exception(__ex);"; - C << eb; - C << nl << "catch(const ::std::exception& __ex)"; - C << sb; - C << nl << "__cb->ice_exception(__ex);"; - C << eb; - C << nl << "catch(...)"; - C << sb; - C << nl << "__cb->ice_exception();"; + } + C << nl; + if(ret) + { + C << retS << " __ret = "; + } + C << fixKwd(name) << args << ';'; + writeMarshalCode(C, outParams, ret); + if(!throws.empty()) + { C << eb; - C << nl << "return ::IceInternal::DispatchAsync;"; - } + ExceptionList::const_iterator r; + for(r = throws.begin(); r != throws.end(); ++r) + { + C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)"; + C << sb; + C << nl << "__os->write(__ex);"; + C << nl << "return ::IceInternal::DispatchUserException;"; + C << eb; + } + } + C << nl << "return ::IceInternal::DispatchOK;"; C << eb; } } @@ -3240,601 +3144,104 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) TypePtr ret = op->returnType(); string retS = returnTypeToString(ret); - if(!p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"))) + H << sp << nl << "virtual " << retS << ' ' << fixKwd(opName) << '('; + H.useCurrentPosAsIndent(); + ParamDeclList paramList = op->parameters(); + ParamDeclList::const_iterator q; + for(q = paramList.begin(); q != paramList.end(); ++q) { - H << sp << nl << "virtual void " << opName << "_async("; - H.useCurrentPosAsIndent(); - H << "const " << classScopedAMD << '_' << opName << "Ptr&"; - ParamDeclList paramList = op->parameters(); - ParamDeclList::const_iterator q; - for(q = paramList.begin(); q != paramList.end(); ++q) + if(q != paramList.begin()) { - if(!(*q)->isOutParam()) - { - H << ',' << nl << inputTypeToString((*q)->type()); - } + H << ',' << nl; } - H << ',' << nl << "const Ice::Current&"; - H.restoreIndent(); - - bool nonmutating = op->mode() == Operation::Nonmutating; - - H << ")" << (nonmutating ? " const" : "") << ';'; - - C << sp << nl << "void" << nl << scope << name << "I::" << opName << "_async("; - C.useCurrentPosAsIndent(); - C << "const " << classScopedAMD << '_' << opName << "Ptr& " << opName << "CB"; - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if(!(*q)->isOutParam()) - { - C << ',' << nl << inputTypeToString((*q)->type()) << ' ' << fixKwd((*q)->name()); - } - } - C << ',' << nl << "const Ice::Current& current"; - C.restoreIndent(); - C << ")" << (nonmutating ? " const" : ""); - C << sb; - - string result = "r"; - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->name() == result) - { - result = "_" + result; - break; - } - } - if(ret) - { - writeDecl(C, result, ret); - } - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - writeDecl(C, fixKwd((*q)->name()), (*q)->type()); - } - } - - C << nl << opName << "CB->ice_response("; - if(ret) - { - C << result; - } - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - if(ret || q != paramList.begin()) - { - C << ", "; - } - C << fixKwd((*q)->name()); - } - } - C << ");"; - - C << eb; - } - else - { - H << sp << nl << "virtual " << retS << ' ' << fixKwd(opName) << '('; - H.useCurrentPosAsIndent(); - ParamDeclList paramList = op->parameters(); - ParamDeclList::const_iterator q; - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if(q != paramList.begin()) - { - H << ',' << nl; - } #if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) - // - // Work around for Sun CC 5.5 bug #4853566 - // - string typeString; - if((*q)->isOutParam()) - { - typeString = outputTypeToString((*q)->type()); - } - else - { - typeString = inputTypeToString((*q)->type()); - } + // + // Work around for Sun CC 5.5 bug #4853566 + // + string typeString; + if((*q)->isOutParam()) + { + typeString = outputTypeToString((*q)->type()); + } + else + { + typeString = inputTypeToString((*q)->type()); + } #else - string typeString = (*q)->isOutParam() ? - outputTypeToString((*q)->type()) : inputTypeToString((*q)->type()); + string typeString = (*q)->isOutParam() ? + outputTypeToString((*q)->type()) : inputTypeToString((*q)->type()); #endif - H << typeString; - } - if(!p->isLocal()) + H << typeString; + } + if(!p->isLocal()) + { + if(!paramList.empty()) { - if(!paramList.empty()) - { - H << ',' << nl; - } - H << "const Ice::Current&"; + H << ',' << nl; } - H.restoreIndent(); + H << "const Ice::Current&"; + } + H.restoreIndent(); - bool nonmutating = op->mode() == Operation::Nonmutating; + bool nonmutating = op->mode() == Operation::Nonmutating; - H << ")" << (nonmutating ? " const" : "") << ';'; + H << ")" << (nonmutating ? " const" : "") << ';'; - C << sp << nl << retS << nl; - C << scope.substr(2) << name << "I::" << fixKwd(opName) << '('; - C.useCurrentPosAsIndent(); - for(q = paramList.begin(); q != paramList.end(); ++q) + C << sp << nl << retS << nl; + C << scope.substr(2) << name << "I::" << fixKwd(opName) << '('; + C.useCurrentPosAsIndent(); + for(q = paramList.begin(); q != paramList.end(); ++q) + { + if(q != paramList.begin()) { - if(q != paramList.begin()) - { - C << ',' << nl; - } + C << ',' << nl; + } #if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) - // - // Work around for Sun CC 5.5 bug #4853566 - // - string typeString; - if((*q)->isOutParam()) - { - typeString = outputTypeToString((*q)->type()); - } - else - { - typeString = inputTypeToString((*q)->type()); - } + // + // Work around for Sun CC 5.5 bug #4853566 + // + string typeString; + if((*q)->isOutParam()) + { + typeString = outputTypeToString((*q)->type()); + } + else + { + typeString = inputTypeToString((*q)->type()); + } #else - string typeString = (*q)->isOutParam() ? - outputTypeToString((*q)->type()) : inputTypeToString((*q)->type()); + string typeString = (*q)->isOutParam() ? + outputTypeToString((*q)->type()) : inputTypeToString((*q)->type()); #endif - C << typeString << ' ' << fixKwd((*q)->name()); - } - if(!p->isLocal()) - { - if(!paramList.empty()) - { - C << ',' << nl; - } - C << "const Ice::Current& current"; - } - C.restoreIndent(); - C << ')'; - C << (nonmutating ? " const" : ""); - C << sb; - - if(ret) + C << typeString << ' ' << fixKwd((*q)->name()); + } + if(!p->isLocal()) + { + if(!paramList.empty()) { - writeReturn(C, ret); + C << ',' << nl; } - - C << eb; + C << "const Ice::Current& current"; } - } - - H << eb << ';'; - - return true; -} - -Slice::Gen::AsyncVisitor::AsyncVisitor(Output& h, Output& c, const string& dllExport) : - H(h), C(c), _dllExport(dllExport) -{ -} - -bool -Slice::Gen::AsyncVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls() || (!p->hasContentsWithMetaData("ami") && !p->hasContentsWithMetaData("amd"))) - { - return false; - } - - string name = fixKwd(p->name()); - - H << sp << nl << "namespace " << name << nl << '{'; - - return true; -} - -void -Slice::Gen::AsyncVisitor::visitModuleEnd(const ModulePtr& p) -{ - H << sp << nl << '}'; -} - -void -Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) -{ - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - - if(cl->isLocal() || - (!cl->hasMetaData("ami") && !p->hasMetaData("ami") && !cl->hasMetaData("amd") && !p->hasMetaData("amd"))) - { - return; - } - - string name = p->name(); - - string className = cl->name(); - string classNameAMI = "AMI_" + className; - string classNameAMD = "AMD_" + className; - string classScope = fixKwd(cl->scope()); - string classScopedAMI = classScope + classNameAMI; - string classScopedAMD = classScope + classNameAMD; - string proxyName = classScope + className + "Prx"; - - vector<string> params; - vector<string> paramsDecl; - vector<string> args; - - vector<string> paramsInvoke; - vector<string> paramsDeclInvoke; - - paramsInvoke.push_back("const " + proxyName + "&"); - paramsDeclInvoke.push_back("const " + proxyName + "& __prx"); - - TypePtr ret = p->returnType(); - string retS = inputTypeToString(ret); - - if(ret) - { - params.push_back(retS); - paramsDecl.push_back(retS + " __ret"); - args.push_back("__ret"); - } - - TypeStringList inParams; - TypeStringList outParams; - ParamDeclList paramList = p->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - string paramName = fixKwd((*q)->name()); - TypePtr type = (*q)->type(); - string typeString = inputTypeToString(type); - - if((*q)->isOutParam()) - { - params.push_back(typeString); - paramsDecl.push_back(typeString + ' ' + paramName); - args.push_back(paramName); - - outParams.push_back(make_pair(type, paramName)); - } - else - { - paramsInvoke.push_back(typeString); - paramsDeclInvoke.push_back(typeString + ' ' + paramName); - - inParams.push_back(make_pair(type, paramName)); - } - } - - paramsInvoke.push_back("const ::Ice::Context&"); - paramsDeclInvoke.push_back("const ::Ice::Context& __ctx"); - - if(cl->hasMetaData("ami") || p->hasMetaData("ami")) - { - H << sp << nl << "class " << _dllExport << classNameAMI << '_' << name - << " : public ::IceInternal::OutgoingAsync"; - H << sb; - H.dec(); - H << nl << "public:"; - H.inc(); - H << sp; - H << nl << "virtual void ice_response" << spar << params << epar << " = 0;"; - H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;"; - H << sp; - H << nl << "void __invoke" << spar << paramsInvoke << epar << ';'; - H << sp; - H.dec(); - H << nl << "protected:"; - H.inc(); - H << sp; - H << nl << "virtual void __response(bool);"; - H << eb << ';'; - H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMI << '_' << name << "> " << classNameAMI - << '_' << name << "Ptr;"; - - C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__invoke" << spar - << paramsDeclInvoke << epar; - C << sb; - C << nl << "try"; - C << sb; - C << nl << "static const ::std::string __operation(\"" << name << "\");"; - C << nl << "__prepare(__prx, __operation, static_cast< ::Ice::OperationMode>(" << p->mode() << "), __ctx);"; - writeMarshalCode(C, inParams, 0); - /* remove. - if(p->sendsClasses()) - { - C << nl << "__os->writePendingObjects();"; - } - */ - C << nl << "__os->endWriteEncaps();"; - C << eb; - C << nl << "catch(const ::Ice::LocalException& __ex)"; - C << sb; - C << nl << "__finished(__ex);"; - C << nl << "return;"; - C << eb; - C << nl << "__send();"; - C << eb; - - C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__response(bool __ok)"; - C << sb; - writeAllocateCode(C, outParams, ret); - C << nl << "try"; - C << sb; - C << nl << "if(!__ok)"; - C << sb; - C << nl << "__is->throwException();"; - C << eb; - writeUnmarshalCode(C, outParams, ret); - C << eb; - C << nl << "catch(const ::Ice::LocalException& __ex)"; - C << sb; - C << nl << "__finished(__ex);"; - C << nl << "return;"; - C << eb; - - // - // Generate a catch block for each legal user exception. - // (See comment in DelegateMVisitor::visitOperation() for details.) - // - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); -#if defined(__SUNPRO_CC) - throws.sort(derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) - { - string scoped = (*i)->scoped(); - C << nl << "catch(const " << fixKwd((*i)->scoped()) << "& __ex)"; - C << sb; - C << nl << "ice_exception(__ex);"; - C << nl << "return;"; - C << eb; - } - C << nl << "catch(const ::Ice::UserException&)"; - C << sb; - C << nl << "ice_exception(::Ice::UnknownUserException(__FILE__, __LINE__));"; - C << nl << "return;"; - C << eb; - C << nl << "ice_response" << spar << args << epar << ';'; - C << eb; - } - - if(cl->hasMetaData("amd") || p->hasMetaData("amd")) - { - H << sp << nl << "class " << _dllExport << classNameAMD << '_' << name - << " : virtual public ::IceUtil::Shared"; - H << sb; - H.dec(); - H << nl << "public:"; - H.inc(); - H << sp; - H << nl << "virtual void ice_response" << spar << params << epar << " = 0;"; - H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;"; - H << nl << "virtual void ice_exception(const ::std::exception&) = 0;"; - H << nl << "virtual void ice_exception() = 0;"; - H << eb << ';'; - H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMD << '_' << name << "> " - << classNameAMD << '_' << name << "Ptr;"; - } -} - -Slice::Gen::AsyncImplVisitor::AsyncImplVisitor(Output& h, Output& c, const string& dllExport) : - H(h), C(c), _dllExport(dllExport) -{ -} - -bool -Slice::Gen::AsyncImplVisitor::visitUnitStart(const UnitPtr& p) -{ - if(!p->hasNonLocalClassDecls() || !p->hasContentsWithMetaData("amd")) - { - return false; - } - - H << sp << nl << "namespace IceAsync" << nl << '{'; + C.restoreIndent(); + C << ')'; + C << (nonmutating ? " const" : ""); + C << sb; - return true; -} + if(ret) + { + writeReturn(C, ret); + } -void -Slice::Gen::AsyncImplVisitor::visitUnitEnd(const UnitPtr& p) -{ - H << sp << nl << '}'; -} - -bool -Slice::Gen::AsyncImplVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls() || !p->hasContentsWithMetaData("amd")) - { - return false; + C << eb; } - string name = fixKwd(p->name()); - - H << sp << nl << "namespace " << name << nl << '{'; + H << eb << ';'; return true; } void -Slice::Gen::AsyncImplVisitor::visitModuleEnd(const ModulePtr& p) -{ - H << sp << nl << '}'; -} - -void -Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) -{ - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - - if(cl->isLocal() || (!cl->hasMetaData("amd") && !p->hasMetaData("amd"))) - { - return; - } - - string name = p->name(); - - string classNameAMD = "AMD_" + cl->name(); - string classScope = fixKwd(cl->scope()); - string classScopedAMD = classScope + classNameAMD; - - string params; - string paramsDecl; - string args; - - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - TypePtr ret = p->returnType(); - string retS = inputTypeToString(ret); - - if(ret) - { - params += retS; - paramsDecl += retS; - paramsDecl += ' '; - paramsDecl += "__ret"; - args += "__ret"; - } - - TypeStringList outParams; - ParamDeclList paramList = p->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - string paramName = fixKwd((*q)->name()); - TypePtr type = (*q)->type(); - string typeString = inputTypeToString(type); - - if(ret || !outParams.empty()) - { - params += ", "; - paramsDecl += ", "; - args += ", "; - } - - params += typeString; - paramsDecl += typeString; - paramsDecl += ' '; - paramsDecl += paramName; - args += paramName; - - outParams.push_back(make_pair(type, paramName)); - } - } - - H << sp << nl << "class " << _dllExport << classNameAMD << '_' << name - << " : public " << classScopedAMD << '_' << name << ", public ::IceInternal::IncomingAsync"; - H << sb; - H.dec(); - H << nl << "public:"; - H.inc(); - - H << sp; - H << nl << classNameAMD << '_' << name << "(::IceInternal::Incoming&);"; - - H << sp; - H << nl << "virtual void ice_response(" << params << ");"; - H << nl << "virtual void ice_exception(const ::Ice::Exception&);"; - H << nl << "virtual void ice_exception(const ::std::exception&);"; - H << nl << "virtual void ice_exception();"; - H << eb << ';'; - - C << sp << nl << "IceAsync" << classScopedAMD << '_' << name << "::" << classNameAMD << '_' << name - << "(::IceInternal::Incoming& in) :"; - C.inc(); - C << nl << "IncomingAsync(in)"; - C.dec(); - C << sb; - C << eb; - - C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name << "::ice_response(" - << paramsDecl << ')'; - C << sb; - if(ret || !outParams.empty()) - { - C << nl << "try"; - C << sb; - C << nl << "::IceInternal::BasicStream* __os = this->__os();"; - writeMarshalCode(C, outParams, ret); - C << eb; - C << nl << "catch(const ::Ice::Exception& __ex)"; - C << sb; - C << nl << "__exception(__ex);"; - C << nl << "return;"; - C << eb; - } - C << nl << "__response(true);"; - C << eb; - - C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name - << "::ice_exception(const ::Ice::Exception& ex)"; - C << sb; - if(throws.empty()) - { - C << nl << "__exception(ex);"; - } - else - { - C << nl << "try"; - C << sb; - C << nl << "ex.ice_throw();"; - C << eb; - ExceptionList::const_iterator r; - for(r = throws.begin(); r != throws.end(); ++r) - { - C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)"; - C << sb; - C << nl << "__os()->write(__ex);"; - C << nl << "__response(false);"; - C << eb; - } - C << nl << "catch(const ::Ice::Exception& __ex)"; - C << sb; - C << nl << "__exception(__ex);"; - C << eb; - } - C << eb; - - C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name - << "::ice_exception(const ::std::exception& ex)"; - C << sb; - C << nl << "__exception(ex);"; - C << eb; - - C << sp << nl << "void" << nl << "IceAsync" << classScopedAMD << '_' << name - << "::ice_exception()"; - C << sb; - C << nl << "__exception();"; - C << eb; -} - -void Slice::Gen::validateMetaData(const UnitPtr& unit) { MetaDataVisitor visitor; diff --git a/cpp/src/slice2cppe/Gen.h b/cpp/src/slice2cppe/Gen.h index 6bfd9b6d1c8..4c5d86ae417 100644 --- a/cpp/src/slice2cppe/Gen.h +++ b/cpp/src/slice2cppe/Gen.h @@ -263,44 +263,6 @@ private: void writeReturn(::IceUtil::Output&, const TypePtr&); }; - class AsyncVisitor : public ::IceUtil::noncopyable, public ParserVisitor - { - public: - - AsyncVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual void visitOperation(const OperationPtr&); - - private: - - ::IceUtil::Output& H; - ::IceUtil::Output& C; - - std::string _dllExport; - }; - - class AsyncImplVisitor : public ::IceUtil::noncopyable, public ParserVisitor - { - public: - - AsyncImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&); - - virtual bool visitUnitStart(const UnitPtr&); - virtual void visitUnitEnd(const UnitPtr&); - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual void visitOperation(const OperationPtr&); - - private: - - ::IceUtil::Output& H; - ::IceUtil::Output& C; - - std::string _dllExport; - }; - private: class MetaDataVisitor : public ParserVisitor diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp index 54693cfe77e..e5d33c25a03 100644 --- a/cpp/src/slice2javae/Gen.cpp +++ b/cpp/src/slice2javae/Gen.cpp @@ -88,56 +88,6 @@ Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package) } vector<string> -Slice::JavaVisitor::getParamsAsync(const OperationPtr& op, const string& package, bool amd) -{ - vector<string> params; - - string name = op->name(); - ContainerPtr container = op->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - string classNameAsync = getAbsolute(cl, package, amd ? "AMD_" : "AMI_", '_' + name); - params.push_back(classNameAsync + " __cb"); - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if(!(*q)->isOutParam()) - { - StringList metaData = (*q)->getMetaData(); - string typeString = typeToString((*q)->type(), TypeModeIn, package, metaData); - params.push_back(typeString + ' ' + fixKwd((*q)->name())); - } - } - - return params; -} - -vector<string> -Slice::JavaVisitor::getParamsAsyncCB(const OperationPtr& op, const string& package) -{ - vector<string> params; - - TypePtr ret = op->returnType(); - if(ret) - { - string retS = typeToString(ret, TypeModeIn, package, op->getMetaData()); - params.push_back(retS + " __ret"); - } - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData()); - params.push_back(typeString + ' ' + fixKwd((*q)->name())); - } - } - - return params; -} - -vector<string> Slice::JavaVisitor::getArgs(const OperationPtr& op) { vector<string> args; @@ -151,64 +101,6 @@ Slice::JavaVisitor::getArgs(const OperationPtr& op) return args; } -vector<string> -Slice::JavaVisitor::getArgsAsync(const OperationPtr& op) -{ - vector<string> args; - - args.push_back("__cb"); - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if(!(*q)->isOutParam()) - { - args.push_back(fixKwd((*q)->name())); - } - } - - return args; -} - -vector<string> -Slice::JavaVisitor::getArgsAsyncCB(const OperationPtr& op) -{ - vector<string> args; - - TypePtr ret = op->returnType(); - if(ret) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)) - { - args.push_back("__ret.value"); - } - else - { - args.push_back("__ret"); - } - } - - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type())) - { - args.push_back(fixKwd((*q)->name()) + ".value"); - } - else - { - args.push_back(fixKwd((*q)->name())); - } - } - } - - return args; -} - void Slice::JavaVisitor::writeThrowsClause(const string& package, const ExceptionList& throws) { @@ -447,25 +339,14 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) ClassDefPtr cl = ClassDefPtr::dynamicCast(container); assert(cl); - bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd"); - vector<string> params; vector<string> args; TypePtr ret; - if(amd) - { - opName += "_async"; - params = getParamsAsync(op, package, true); - args = getArgsAsync(op); - } - else - { - opName = fixKwd(opName); - ret = op->returnType(); - params = getParams(op, package); - args = getArgs(op); - } + opName = fixKwd(opName); + ret = op->returnType(); + params = getParams(op, package); + args = getArgs(op); ExceptionList throws = op->throws(); throws.sort(); @@ -552,239 +433,157 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) << " __obj, IceInternal.Incoming __in, Ice.Current __current)"; out << sb; - bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd"); - if(!amd) - { - TypePtr ret = op->returnType(); + TypePtr ret = op->returnType(); - ParamDeclList inParams; - ParamDeclList outParams; - ParamDeclList paramList = op->parameters(); - ParamDeclList::const_iterator pli; - for(pli = paramList.begin(); pli != paramList.end(); ++pli) + ParamDeclList inParams; + ParamDeclList outParams; + ParamDeclList paramList = op->parameters(); + ParamDeclList::const_iterator pli; + for(pli = paramList.begin(); pli != paramList.end(); ++pli) + { + if((*pli)->isOutParam()) { - if((*pli)->isOutParam()) - { - outParams.push_back(*pli); - } - else - { - inParams.push_back(*pli); - } + outParams.push_back(*pli); + } + else + { + inParams.push_back(*pli); } + } - ExceptionList throws = op->throws(); - throws.sort(); - throws.unique(); + ExceptionList throws = op->throws(); + throws.sort(); + throws.unique(); - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // + // + // Arrange exceptions into most-derived to least-derived order. If we don't + // do this, a base exception handler can appear before a derived exception + // handler, causing compiler warnings and resulting in the base exception + // being marshaled instead of the derived exception. + // #if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); + throws.sort(Slice::derivedToBaseCompare); #else - throws.sort(Slice::DerivedToBaseCompare()); + throws.sort(Slice::DerivedToBaseCompare()); #endif - int iter; - - if(!inParams.empty()) - { - out << nl << "IceInternal.BasicStream __is = __in.is();"; - } - if(!outParams.empty() || ret || !throws.empty()) - { - out << nl << "IceInternal.BasicStream __os = __in.os();"; - } + int iter; - // - // Unmarshal 'in' parameters. - // - iter = 0; - for(pli = inParams.begin(); pli != inParams.end(); ++pli) - { - StringList metaData = (*pli)->getMetaData(); - TypePtr paramType = (*pli)->type(); - string paramName = fixKwd((*pli)->name()); - string typeS = typeToString(paramType, TypeModeIn, package, metaData); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) - { - out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();"; - writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, - metaData, string()); - } - else - { - out << nl << typeS << ' ' << paramName << ';'; - writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData); - } - } - if(op->sendsClasses()) - { - out << nl << "__is.readPendingObjects();"; - } - - // - // Create holders for 'out' parameters. - // - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData()); - out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();"; - } - - // - // Call on the servant. - // - if(!throws.empty()) - { - out << nl << "try"; - out << sb; - } - out << nl; - if(ret) - { - string retS = typeToString(ret, TypeModeReturn, package, opMetaData); - out << retS << " __ret = "; - } - out << "__obj." << fixKwd(opName) << '('; - for(pli = inParams.begin(); pli != inParams.end(); ++pli) - { - TypePtr paramType = (*pli)->type(); - out << fixKwd((*pli)->name()); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) - { - out << ".value"; - } - out << ", "; - } - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - out << fixKwd((*pli)->name()) << ", "; - } - out << "__current);"; + if(!inParams.empty()) + { + out << nl << "IceInternal.BasicStream __is = __in.is();"; + } + if(!outParams.empty() || ret || !throws.empty()) + { + out << nl << "IceInternal.BasicStream __os = __in.os();"; + } - // - // Marshal 'out' parameters and return value. - // - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, true, - (*pli)->getMetaData()); - } - if(ret) - { - writeMarshalUnmarshalCode(out, package, ret, "__ret", true, iter, false, opMetaData); - } - if(op->returnsClasses()) + // + // Unmarshal 'in' parameters. + // + iter = 0; + for(pli = inParams.begin(); pli != inParams.end(); ++pli) + { + StringList metaData = (*pli)->getMetaData(); + TypePtr paramType = (*pli)->type(); + string paramName = fixKwd((*pli)->name()); + string typeS = typeToString(paramType, TypeModeIn, package, metaData); + BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); + if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) { - out << nl << "__os.writePendingObjects();"; + out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();"; + writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, + metaData, string()); } - out << nl << "return IceInternal.DispatchStatus.DispatchOK;"; - - // - // Handle user exceptions. - // - if(!throws.empty()) + else { - out << eb; - ExceptionList::const_iterator t; - for(t = throws.begin(); t != throws.end(); ++t) - { - string exS = getAbsolute(*t, package); - out << nl << "catch(" << exS << " ex)"; - out << sb; - out << nl << "__os.writeUserException(ex);"; - out << nl << "return IceInternal.DispatchStatus.DispatchUserException;"; - out << eb; - } + out << nl << typeS << ' ' << paramName << ';'; + writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData); } - - out << eb; } - else + if(op->sendsClasses()) { - ParamDeclList inParams; - ParamDeclList paramList = op->parameters(); - ParamDeclList::const_iterator pli; - for(pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if(!(*pli)->isOutParam()) - { - inParams.push_back(*pli); - } - } + out << nl << "__is.readPendingObjects();"; + } - int iter; + // + // Create holders for 'out' parameters. + // + for(pli = outParams.begin(); pli != outParams.end(); ++pli) + { + string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData()); + out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();"; + } - if(!inParams.empty()) + // + // Call on the servant. + // + if(!throws.empty()) + { + out << nl << "try"; + out << sb; + } + out << nl; + if(ret) + { + string retS = typeToString(ret, TypeModeReturn, package, opMetaData); + out << retS << " __ret = "; + } + out << "__obj." << fixKwd(opName) << '('; + for(pli = inParams.begin(); pli != inParams.end(); ++pli) + { + TypePtr paramType = (*pli)->type(); + out << fixKwd((*pli)->name()); + BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); + if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) { - out << nl << "IceInternal.BasicStream __is = __in.is();"; + out << ".value"; } + out << ", "; + } + for(pli = outParams.begin(); pli != outParams.end(); ++pli) + { + out << fixKwd((*pli)->name()) << ", "; + } + out << "__current);"; - // - // Unmarshal 'in' parameters. - // - iter = 0; - for(pli = inParams.begin(); pli != inParams.end(); ++pli) - { - StringList metaData = (*pli)->getMetaData(); - TypePtr paramType = (*pli)->type(); - string paramName = fixKwd((*pli)->name()); - string typeS = typeToString(paramType, TypeModeIn, package, metaData); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) - { - out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();"; - writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, metaData, - string()); - } - else - { - out << nl << typeS << ' ' << paramName << ';'; - writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData); - } - } - if(op->sendsClasses()) - { - out << nl << "__is.readPendingObjects();"; - } + // + // Marshal 'out' parameters and return value. + // + for(pli = outParams.begin(); pli != outParams.end(); ++pli) + { + writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, true, + (*pli)->getMetaData()); + } + if(ret) + { + writeMarshalUnmarshalCode(out, package, ret, "__ret", true, iter, false, opMetaData); + } + if(op->returnsClasses()) + { + out << nl << "__os.writePendingObjects();"; + } + out << nl << "return IceInternal.DispatchStatus.DispatchOK;"; - // - // Call on the servant. - // - string classNameAMD = "AMD_" + p->name(); - out << nl << classNameAMD << '_' << opName << " __cb = new _" << classNameAMD << '_' << opName - << "(__in);"; - out << nl << "try"; - out << sb; - out << nl << "__obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(__cb, " : "("); - for(pli = inParams.begin(); pli != inParams.end(); ++pli) + // + // Handle user exceptions. + // + if(!throws.empty()) + { + out << eb; + ExceptionList::const_iterator t; + for(t = throws.begin(); t != throws.end(); ++t) { - TypePtr paramType = (*pli)->type(); - out << fixKwd((*pli)->name()); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) - { - out << ".value"; - } - out << ", "; + string exS = getAbsolute(*t, package); + out << nl << "catch(" << exS << " ex)"; + out << sb; + out << nl << "__os.writeUserException(ex);"; + out << nl << "return IceInternal.DispatchStatus.DispatchUserException;"; + out << eb; } - out << "__current);"; - out << eb; - out << nl << "catch(java.lang.Exception ex)"; - out << sb; - out << nl << "__cb.ice_exception(ex);"; - out << eb; - out << nl << "return IceInternal.DispatchStatus.DispatchAsync;"; - - out << eb; } + + out << eb; } OperationList allOps = p->allOperations(); @@ -934,9 +733,6 @@ Slice::Gen::generate(const UnitPtr& p, bool stream) DispatcherVisitor dispatcherVisitor(_dir); p->visit(&dispatcherVisitor, false); - - AsyncVisitor asyncVisitor(_dir); - p->visit(&asyncVisitor, false); } void @@ -1106,24 +902,15 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) TypePtr ret; vector<string> params; - bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")); - - if(amd) - { - params = getParamsAsync(op, package, true); - } - else - { - params = getParams(op, package); - ret = op->returnType(); - } + params = getParams(op, package); + ret = op->returnType(); string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData()); ExceptionList throws = op->throws(); throws.sort(); throws.unique(); - out << sp << nl << retS << ' ' << (amd ? name + "_async" : fixKwd(name)) << spar << params; + out << sp << nl << retS << ' ' << fixKwd(name) << spar << params; if(!noCurrent && !p->isLocal()) { out << "Ice.Current __current"; @@ -1253,41 +1040,17 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) { ContainerPtr container = (*r)->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd"); -#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) - // - // Work around for Sun CC 5.5 bug #4853566 - // - string opName; - if(hasAMD) - { - opName = (*r)->name() + "_async"; - } - else - { - opName = fixKwd((*r)->name()); - } -#else - string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name()); -#endif + + string opName = fixKwd((*r)->name()); + TypePtr ret = (*r)->returnType(); string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData()); - vector<string> params; - vector<string> args; - if(hasAMD) - { - params = getParamsAsync((*r), package, true); - args = getArgsAsync(*r); - } - else - { - params = getParams((*r), package); - args = getArgs(*r); - } + vector<string> params = getParams((*r), package); + vector<string> args = getArgs(*r); out << sp; - out << nl << "public " << (hasAMD ? "void" : retS) << nl << opName << spar << params; + out << nl << "public " << retS << nl << opName << spar << params; if(!p->isLocal()) { out << "Ice.Current __current"; @@ -1300,7 +1063,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) writeThrowsClause(package, throws); out << sb; out << nl; - if(ret && !hasAMD) + if(ret) { out << "return "; } @@ -2840,31 +2603,6 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << eb; out << eb; out << eb; - - if(cl->hasMetaData("ami") || op->hasMetaData("ami")) - { - vector<string> paramsAMI = getParamsAsync(op, package, false); - vector<string> argsAMI = getArgsAsync(op); - - // - // Write two versions of the operation - with and without a - // context parameter - // - out << sp; - out << nl << "public void" << nl << op->name() << "_async" << spar << paramsAMI << epar; - out << sb; - out << nl << op->name() << "_async" << spar << argsAMI << "__defaultContext()" << epar << ';'; - out << eb; - - out << sp; - out << nl << "public void" << nl << op->name() << "_async" << spar << paramsAMI << "java.util.Map __ctx" - << epar; - out << sb; - // Async requests may only be sent twoway. - out << nl << "__checkTwowayOnly(\"" << p->name() << "\");"; - out << nl << "__cb.__invoke" << spar << "this" << argsAMI << "__ctx" << epar << ';'; - out << eb; - } } out << sp << nl << "public static " << name << "Prx" << nl << "checkedCast(Ice.ObjectPrx b)"; @@ -3815,20 +3553,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) out << nl << "public " << retS << ' ' << name << spar << params << "java.util.Map __ctx" << epar; writeThrowsClause(package, throws); out << ';'; - - if(cl->hasMetaData("ami") || p->hasMetaData("ami")) - { - vector<string> paramsAMI = getParamsAsync(p, package, false); - - // - // Write two versions of the operation - with and without a - // context parameter. - // - out << sp; - out << nl << "public void " << p->name() << "_async" << spar << paramsAMI << epar << ';'; - out << nl << "public void " << p->name() << "_async" << spar << paramsAMI << "java.util.Map __ctx" - << epar << ';'; - } } Slice::Gen::DelegateVisitor::DelegateVisitor(const string& dir) : @@ -4199,102 +3923,30 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package, ContainerPtr container = op->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - if(!local && (cl->hasMetaData("amd") || op->hasMetaData("amd"))) + out << sp << nl << "public " << retS << nl << fixKwd(opName) << spar << params; + if(!local) { - vector<string> paramsAMD = getParamsAsync(op, package, true); - - out << sp << nl << "public void" << nl << opName << "_async" << spar << paramsAMD << "Ice.Current __current" - << epar; - - ExceptionList throws = op->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - writeThrowsClause(package, throws); - - out << sb; - - string result = "__r"; - ParamDeclList paramList = op->parameters(); - ParamDeclList::const_iterator q; - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->name() == result) - { - result = "_" + result; - break; - } - } - if(ret) - { - writeDecl(out, package, result, ret, opMetaData); - } - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - writeDecl(out, package, fixKwd((*q)->name()), (*q)->type(), (*q)->getMetaData()); - } - } - - out << nl << "__cb.ice_response("; - if(ret) - { - out << result; - } - for(q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - if(ret || q != paramList.begin()) - { - out << ", "; - } - out << fixKwd((*q)->name()); - } - } - out << ");"; - - out << eb; + out << "Ice.Current __current"; } - else - { - out << sp << nl << "public " << retS << nl << fixKwd(opName) << spar << params; - if(!local) - { - out << "Ice.Current __current"; - } - out << epar; - - ExceptionList throws = op->throws(); - throws.sort(); - throws.unique(); + out << epar; - writeThrowsClause(package, throws); + ExceptionList throws = op->throws(); + throws.sort(); + throws.unique(); - out << sb; + writeThrowsClause(package, throws); - // - // Return value - // - if(ret) - { - writeReturn(out, ret); - } + out << sb; - out << eb; + // + // Return value + // + if(ret) + { + writeReturn(out, ret); } + + out << eb; } Slice::Gen::ImplVisitor::ImplVisitor(const string& dir) : @@ -4450,361 +4102,3 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p) return false; } - -Slice::Gen::AsyncVisitor::AsyncVisitor(const string& dir) : - JavaVisitor(dir) -{ -} - -void -Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) -{ - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - - if(cl->isLocal()) - { - return; - } - - string name = p->name(); - string classPkg = getPackage(cl); - StringList opMetaData = p->getMetaData(); - - if(cl->hasMetaData("ami") || p->hasMetaData("ami")) - { - string classNameAMI = "AMI_" + cl->name(); - string absoluteAMI = getAbsolute(cl, "", "AMI_", "_" + name); - - if(!open(absoluteAMI)) - { - return; - } - - Output& out = output(); - - TypePtr ret = p->returnType(); - - ParamDeclList inParams; - ParamDeclList outParams; - ParamDeclList paramList = p->parameters(); - ParamDeclList::const_iterator pli; - for(pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if((*pli)->isOutParam()) - { - outParams.push_back(*pli); - } - else - { - inParams.push_back(*pli); - } - } - - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - int iter; - - vector<string> params = getParamsAsyncCB(p, classPkg); - vector<string> args = getArgsAsyncCB(p); - - vector<string> paramsInvoke = getParamsAsync(p, classPkg, false); - - out << sp << nl << "public abstract class " << classNameAMI << '_' << name - << " extends IceInternal.OutgoingAsync"; - out << sb; - out << sp; - out << nl << "public abstract void ice_response" << spar << params << epar << ';'; - out << nl << "public abstract void ice_exception(Ice.LocalException ex);"; - if(!throws.empty()) - { - out << nl << "public abstract void ice_exception(Ice.UserException ex);"; - } - - out << sp << nl << "public final void" << nl << "__invoke" << spar << "Ice.ObjectPrx __prx" - << paramsInvoke << "java.util.Map __ctx" << epar; - out << sb; - out << nl << "try"; - out << sb; - out << nl << "__prepare(__prx, \"" << p->name() << "\", " << sliceModeToIceMode(p) << ", __ctx);"; - iter = 0; - for(pli = inParams.begin(); pli != inParams.end(); ++pli) - { - StringList metaData = (*pli)->getMetaData(); - string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData); - writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), fixKwd((*pli)->name()), true, iter, false, - metaData); - } - if(p->sendsClasses()) - { - out << nl << "__os.writePendingObjects();"; - } - out << nl << "__os.endWriteEncaps();"; - out << eb; - out << nl << "catch(Ice.LocalException __ex)"; - out << sb; - out << nl << "__finished(__ex);"; - out << nl << "return;"; - out << eb; - out << nl << "__send();"; - out << eb; - - out << sp << nl << "protected final void" << nl << "__response(boolean __ok)"; - out << sb; - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - TypePtr paramType = (*pli)->type(); - string paramName = fixKwd((*pli)->name()); - string typeS = typeToString(paramType, TypeModeIn, classPkg, (*pli)->getMetaData()); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) - { - out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();"; - } - else - { - out << nl << typeS << ' ' << paramName << ';'; - } - } - if(ret) - { - string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)) - { - out << nl << retS << "Holder __ret = new " << retS << "Holder();"; - } - else - { - out << nl << retS << " __ret;"; - } - } - out << nl << "try"; - out << sb; - out << nl << "if(!__ok)"; - out << sb; - out << nl << "try"; - out << sb; - out << nl << "__is.throwException();"; - out << eb; - for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r) - { - out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)"; - out << sb; - out << nl << "throw __ex;"; - out << eb; - } - out << nl << "catch(Ice.UserException __ex)"; - out << sb; - out << nl << "throw new Ice.UnknownUserException();"; - out << eb; - out << eb; - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - TypePtr paramType = (*pli)->type(); - string paramName = fixKwd((*pli)->name()); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) - { - out << nl << "__is.readObject(" << paramName << ".getPatcher());"; - } - else - { - writeMarshalUnmarshalCode(out, classPkg, paramType, paramName, false, iter, false, - (*pli)->getMetaData()); - } - } - if(ret) - { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)) - { - out << nl << "__is.readObject(__ret.getPatcher());"; - } - else - { - writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", false, iter, false, opMetaData); - } - } - if(p->returnsClasses()) - { - out << nl << "__is.readPendingObjects();"; - } - out << eb; - out << nl << "catch(Ice.LocalException __ex)"; - out << sb; - out << nl << "__finished(__ex);"; - out << nl << "return;"; - out << eb; - if(!throws.empty()) - { - out << nl << "catch(Ice.UserException __ex)"; - out << sb; - out << nl << "ice_exception(__ex);"; - out << nl << "return;"; - out << eb; - } - out << nl << "ice_response" << spar << args << epar << ';'; - out << eb; - out << eb; - - close(); - } - - if(cl->hasMetaData("amd") || p->hasMetaData("amd")) - { - string classNameAMD = "AMD_" + cl->name(); - string absoluteAMD = getAbsolute(cl, "", "AMD_", "_" + name); - - string classNameAMDI = "_AMD_" + cl->name(); - string absoluteAMDI = getAbsolute(cl, "", "_AMD_", "_" + name); - - vector<string> paramsAMD = getParamsAsyncCB(p, classPkg); - - { - if(!open(absoluteAMD)) - { - return; - } - - Output& out = output(); - - out << sp << nl << "public interface " << classNameAMD << '_' << name; - out << sb; - out << sp << nl << "void ice_response" << spar << paramsAMD << epar << ';'; - out << sp << nl << "void ice_exception(java.lang.Exception ex);"; - out << eb; - - close(); - } - - { - if(!open(absoluteAMDI)) - { - return; - } - - Output& out = output(); - - TypePtr ret = p->returnType(); - - ParamDeclList outParams; - ParamDeclList paramList = p->parameters(); - ParamDeclList::const_iterator pli; - for(pli = paramList.begin(); pli != paramList.end(); ++pli) - { - if((*pli)->isOutParam()) - { - outParams.push_back(*pli); - } - } - - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); - - // - // Arrange exceptions into most-derived to least-derived order. If we don't - // do this, a base exception handler can appear before a derived exception - // handler, causing compiler warnings and resulting in the base exception - // being marshaled instead of the derived exception. - // -#if defined(__SUNPRO_CC) - throws.sort(Slice::derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - - int iter; - - out << sp << nl << "final class " << classNameAMDI << '_' << name - << " extends IceInternal.IncomingAsync implements " << classNameAMD << '_' << name; - out << sb; - - out << sp << nl << "public" << nl << classNameAMDI << '_' << name << "(IceInternal.Incoming in)"; - out << sb; - out << nl << "super(in);"; - out << eb; - - out << sp << nl << "public void" << nl << "ice_response" << spar << paramsAMD << epar; - out << sb; - iter = 0; - if(ret || !outParams.empty()) - { - out << nl << "try"; - out << sb; - out << nl << "IceInternal.BasicStream __os = this.__os();"; - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - StringList metaData = (*pli)->getMetaData(); - string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData); - writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), fixKwd((*pli)->name()), true, iter, - false, metaData); - } - if(ret) - { - string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData); - writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", true, iter, false, opMetaData); - } - if(p->returnsClasses()) - { - out << nl << "__os.writePendingObjects();"; - } - out << eb; - out << nl << "catch(Ice.LocalException __ex)"; - out << sb; - out << nl << "ice_exception(__ex);"; - out << eb; - } - out << nl << "__response(true);"; - out << eb; - - out << sp << nl << "public void" << nl << "ice_exception(java.lang.Exception ex)"; - out << sb; - if(throws.empty()) - { - out << nl << "__exception(ex);"; - } - else - { - out << nl << "try"; - out << sb; - out << nl << "throw ex;"; - out << eb; - ExceptionList::const_iterator r; - for(r = throws.begin(); r != throws.end(); ++r) - { - string exS = getAbsolute(*r, classPkg); - out << nl << "catch(" << exS << " __ex)"; - out << sb; - out << nl << "__os().writeUserException(__ex);"; - out << nl << "__response(false);"; - out << eb; - } - out << nl << "catch(java.lang.Exception __ex)"; - out << sb; - out << nl << "__exception(__ex);"; - out << eb; - } - out << eb; - - out << eb; - - close(); - } - } -} diff --git a/cpp/src/slice2javae/Gen.h b/cpp/src/slice2javae/Gen.h index c172f30119f..907851578f2 100644 --- a/cpp/src/slice2javae/Gen.h +++ b/cpp/src/slice2javae/Gen.h @@ -31,15 +31,11 @@ protected: // Compose the parameter lists for an operation. // std::vector<std::string> getParams(const OperationPtr&, const std::string&); - std::vector<std::string> getParamsAsync(const OperationPtr&, const std::string&, bool); - std::vector<std::string> getParamsAsyncCB(const OperationPtr&, const std::string&); // // Compose the argument lists for an operation. // std::vector<std::string> getArgs(const OperationPtr&); - std::vector<std::string> getArgsAsync(const OperationPtr&); - std::vector<std::string> getArgsAsyncCB(const OperationPtr&); // // Generate a throws clause containing only non-local exceptions. @@ -247,15 +243,6 @@ private: virtual bool visitClassDefStart(const ClassDefPtr&); }; - - class AsyncVisitor : public JavaVisitor - { - public: - - AsyncVisitor(const std::string&); - - virtual void visitOperation(const OperationPtr&); - }; }; } diff --git a/cppe/all.dsw b/cppe/all.dsw index a6fb7a3ed63..7b1e50a6d43 100644 --- a/cppe/all.dsw +++ b/cppe/all.dsw @@ -345,12 +345,6 @@ Package=<4> Project_Dep_Name adapterDeactivationS
End Project Dependency
Begin Project Dependency
- Project_Dep_Name exceptionsAMDS
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name operationsAMDS
- End Project Dependency
- Begin Project Dependency
Project_Dep_Name sliceexC
End Project Dependency
Begin Project Dependency
@@ -438,9 +432,6 @@ Package=<4> Project_Dep_Name slice2cs
End Project Dependency
Begin Project Dependency
- Project_Dep_Name sliceexAMDS
- End Project Dependency
- Begin Project Dependency
Project_Dep_Name sliceobAMDS
End Project Dependency
Begin Project Dependency
@@ -666,24 +657,6 @@ Package=<4> ###############################################################################
-Project: "exceptionsAMDS"=.\test\ice\exceptions\exceptionsAMDS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "exceptionsC"=.\test\ice\exceptions\exceptionsC.dsp - Package Owner=<4>
Package=<5>
@@ -828,24 +801,6 @@ Package=<4> ###############################################################################
-Project: "gcC"=.\test\ice\gc\gcC.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "helloC"=.\demo\ice\hello\helloC.dsp - Package Owner=<4>
Package=<5>
@@ -1197,78 +1152,6 @@ Package=<4> ###############################################################################
-Project: "objectsC"=.\test\ice\objects\objectsC.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "objectsCOL"=.\test\ice\objects\objectsCOL.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "objectsS"=.\test\ice\objects\objectsS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "operationsAMDS"=.\test\ice\operations\operationsAMDS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "operationsC"=.\test\ice\operations\operationsC.dsp - Package Owner=<4>
Package=<5>
@@ -1323,24 +1206,6 @@ Package=<4> ###############################################################################
-Project: "sliceexAMDS"=.\test\ice\slicing\exceptions\sliceexAMDS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "sliceexC"=.\test\ice\slicing\exceptions\sliceexC.dsp - Package Owner=<4>
Package=<5>
@@ -1377,60 +1242,6 @@ Package=<4> ###############################################################################
-Project: "sliceobAMDS"=.\test\ice\slicing\objects\sliceobAMDS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "sliceobC"=.\test\ice\slicing\objects\sliceobC.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "sliceobS"=.\test\ice\slicing\objects\sliceobS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "streamC"=.\test\ice\stream\streamC.dsp - Package Owner=<4>
Package=<5>
@@ -1530,48 +1341,6 @@ Package=<4> ###############################################################################
-Project: "valueC"=.\demo\ice\value\valueC.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name icessl
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "valueS"=.\demo\ice\value\valueS.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name iceutil
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name icessl
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name ice
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "workqueue"=.\demo\iceutil\workqueue\workqueue.dsp - Package Owner=<4>
Package=<5>
diff --git a/cppe/config/PropertyNames.def b/cppe/config/PropertyNames.def index ec5202de54c..c377bb6c5f7 100644 --- a/cppe/config/PropertyNames.def +++ b/cppe/config/PropertyNames.def @@ -139,7 +139,6 @@ Ice: Trace.Slicing UseEventLog UseSyslog - Warn.AMICallback Warn.Connections Warn.Dispatch Warn.Leaks diff --git a/javae/src/Ice/AMD_Object_ice_invoke.java b/javae/src/Ice/AMD_Object_ice_invoke.java deleted file mode 100644 index a499f48fd4c..00000000000 --- a/javae/src/Ice/AMD_Object_ice_invoke.java +++ /dev/null @@ -1,16 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface AMD_Object_ice_invoke -{ - void ice_response(boolean ok, byte[] outParams); - void ice_exception(java.lang.Exception ex); -} diff --git a/javae/src/Ice/AMI_Object_ice_invoke.java b/javae/src/Ice/AMI_Object_ice_invoke.java deleted file mode 100644 index ac805549695..00000000000 --- a/javae/src/Ice/AMI_Object_ice_invoke.java +++ /dev/null @@ -1,49 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public abstract class AMI_Object_ice_invoke extends IceInternal.OutgoingAsync -{ - public abstract void ice_response(boolean ok, byte[] outParams); - public abstract void ice_exception(LocalException ex); - - public final void __invoke(Ice.ObjectPrx prx, String operation, OperationMode mode, - byte[] inParams, java.util.Map context) - { - try - { - __prepare(prx, operation, mode, context); - __os.writeBlob(inParams); - __os.endWriteEncaps(); - } - catch(LocalException ex) - { - __finished(ex); - return; - } - __send(); - } - - protected final void __response(boolean ok) // ok == true means no user exception. - { - byte[] outParams; - try - { - int sz = __is.getReadEncapsSize(); - outParams = __is.readBlob(sz); - } - catch(LocalException ex) - { - __finished(ex); - return; - } - ice_response(ok, outParams); - } -} diff --git a/javae/src/Ice/BlobjectAsync.java b/javae/src/Ice/BlobjectAsync.java deleted file mode 100644 index d6f07dd03cd..00000000000 --- a/javae/src/Ice/BlobjectAsync.java +++ /dev/null @@ -1,34 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public abstract class BlobjectAsync extends Ice.ObjectImpl -{ - public abstract void - ice_invoke_async(AMD_Object_ice_invoke cb, byte[] inParams, Current current); - - public IceInternal.DispatchStatus - __dispatch(IceInternal.Incoming in, Current current) - { - byte[] inParams; - int sz = in.is().getReadEncapsSize(); - inParams = in.is().readBlob(sz); - AMD_Object_ice_invoke cb = new _AMD_Object_ice_invoke(in); - try - { - ice_invoke_async(cb, inParams, current); - } - catch(java.lang.Exception ex) - { - cb.ice_exception(ex); - } - return IceInternal.DispatchStatus.DispatchAsync; - } -} diff --git a/javae/src/Ice/ConnectionI.java b/javae/src/Ice/ConnectionI.java index af07710f91d..75fc4efd7aa 100644 --- a/javae/src/Ice/ConnectionI.java +++ b/javae/src/Ice/ConnectionI.java @@ -418,25 +418,10 @@ public final class ConnectionI implements Connection } // - // Check for timed out async requests. - // - java.util.Iterator i = _asyncRequests.entryIterator(); - while(i.hasNext()) - { - IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next(); - IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue(); - if(out.__timedOut()) - { - setState(StateClosed, new TimeoutException()); - return; - } - } - - // // Active connection management for idle connections. // if(_acmTimeout > 0 && - _requests.isEmpty() && _asyncRequests.isEmpty() && + _requests.isEmpty() && !_batchStreamInUse && _batchStream.isEmpty() && _dispatchCount == 0) { @@ -588,107 +573,6 @@ public final class ConnectionI implements Connection } } - public void - sendAsyncRequest(IceInternal.BasicStream os, IceInternal.OutgoingAsync out, boolean compress) - { - int requestId = 0; - IceInternal.BasicStream stream = null; - - synchronized(this) - { - if(_exception != null) - { - throw _exception; - } - - assert(_state > StateNotValidated); - assert(_state < StateClosing); - - // - // Create a new unique request ID. - // - requestId = _nextRequestId++; - if(requestId <= 0) - { - _nextRequestId = 1; - requestId = _nextRequestId++; - } - - // - // Fill in the request ID. - // - os.pos(IceInternal.Protocol.headerSize); - os.writeInt(requestId); - - // - // Add to the async requests map. - // - _asyncRequests.put(requestId, out); - - stream = doCompress(os, _overrideCompress ? _overrideCompressValue : compress); - - if(_acmTimeout > 0) - { - _acmAbsoluteTimeoutMillis = System.currentTimeMillis() + _acmTimeout * 1000; - } - } - - try - { - synchronized(_sendMutex) - { - if(_transceiver == null) // Has the transceiver already been closed? - { - assert(_exception != null); - throw _exception; // The exception is immutable at this point. - } - - // - // Send the request. - // - IceInternal.TraceUtil.traceRequest("sending asynchronous request", os, _logger, _traceLevels); - _transceiver.write(stream, _endpoint.timeout()); - } - } - catch(LocalException ex) - { - synchronized(this) - { - setState(StateClosed, ex); - assert(_exception != null); - - // - // If the request has already been removed from the - // async request map, we are out of luck. It would - // mean that finished() has been called already, and - // therefore the exception has been set using the - // OutgoingAsync::__finished() callback. In this case, - // we cannot throw the exception here, because we must - // not both raise an exception and have - // OutgoingAsync::__finished() called with an - // exception. This means that in some rare cases, a - // request will not be retried even though it - // could. But I honestly don't know how I could avoid - // this, without a very elaborate and complex design, - // which would be bad for performance. - // - IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync)_asyncRequests.remove(requestId); - if(o != null) - { - assert(o == out); - throw _exception; - } - } - } - finally - { - if(stream != null && stream != os) - { - stream.destroy(); - } - } - } - private final static byte[] _requestBatchHdr = { IceInternal.Protocol.magic[0], @@ -1454,7 +1338,6 @@ public final class ConnectionI implements Connection byte compress; IceInternal.ServantManager servantManager; ObjectAdapter adapter; - IceInternal.OutgoingAsync outAsync; } private void @@ -1561,11 +1444,7 @@ public final class ConnectionI implements Connection } else { - info.outAsync = (IceInternal.OutgoingAsync)_asyncRequests.remove(info.requestId); - if(info.outAsync == null) - { - throw new UnknownRequestIdException(); - } + throw new UnknownRequestIdException(); } break; } @@ -1856,7 +1735,6 @@ public final class ConnectionI implements Connection LocalException exception = null; IceInternal.IntMap requests = null; - IceInternal.IntMap asyncRequests = null; try { @@ -1905,8 +1783,8 @@ public final class ConnectionI implements Connection // // We cannot simply return here. We have to make sure - // that all requests (regular and async) are notified - // about the closed connection below. + // that all requests are notified about the closed + // connection below. // closed = true; } @@ -1915,22 +1793,10 @@ public final class ConnectionI implements Connection { requests = _requests; _requests = new IceInternal.IntMap(); - - asyncRequests = _asyncRequests; - _asyncRequests = new IceInternal.IntMap(); } } // - // Asynchronous replies must be handled outside the thread - // synchronization, so that nested calls are possible. - // - if(info.outAsync != null) - { - info.outAsync.__finished(info.stream); - } - - // // Method invocation (or multiple invocations for batch messages) // must be done outside the thread synchronization, so that nested // calls are possible. @@ -1949,17 +1815,6 @@ public final class ConnectionI implements Connection } } - if(asyncRequests != null) - { - java.util.Iterator i = asyncRequests.entryIterator(); - while(i.hasNext()) - { - IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next(); - IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue(); - out.__finished(_exception); // The exception is immutable at this point. - } - } - if(exception != null) { assert(closed); @@ -2068,7 +1923,6 @@ public final class ConnectionI implements Connection private int _nextRequestId; private IceInternal.IntMap _requests = new IceInternal.IntMap(); - private IceInternal.IntMap _asyncRequests = new IceInternal.IntMap(); private LocalException _exception; diff --git a/javae/src/Ice/ObjectPrx.java b/javae/src/Ice/ObjectPrx.java index b5881785897..4d874ca0ce8 100644 --- a/javae/src/Ice/ObjectPrx.java +++ b/javae/src/Ice/ObjectPrx.java @@ -30,10 +30,6 @@ public interface ObjectPrx boolean ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, java.util.Map __context); - void ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams); - void ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams, - java.util.Map context); - Identity ice_getIdentity(); ObjectPrx ice_newIdentity(Identity newIdentity); diff --git a/javae/src/Ice/ObjectPrxHelperBase.java b/javae/src/Ice/ObjectPrxHelperBase.java index aa34dd342cb..83cf3a01f45 100644 --- a/javae/src/Ice/ObjectPrxHelperBase.java +++ b/javae/src/Ice/ObjectPrxHelperBase.java @@ -176,20 +176,6 @@ public class ObjectPrxHelperBase implements ObjectPrx } } - public final void - ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams) - { - ice_invoke_async(cb, operation, mode, inParams, null); - } - - public final void - ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams, - java.util.Map context) - { - __checkTwowayOnly("ice_invoke_async"); - cb.__invoke(this, operation, mode, inParams, context); - } - public final Identity ice_getIdentity() { diff --git a/javae/src/Ice/_AMD_Object_ice_invoke.java b/javae/src/Ice/_AMD_Object_ice_invoke.java deleted file mode 100644 index f0185838c25..00000000000 --- a/javae/src/Ice/_AMD_Object_ice_invoke.java +++ /dev/null @@ -1,40 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -final class _AMD_Object_ice_invoke extends IceInternal.IncomingAsync implements AMD_Object_ice_invoke -{ - public - _AMD_Object_ice_invoke(IceInternal.Incoming in) - { - super(in); - } - - public void - ice_response(boolean ok, byte[] outParams) - { - try - { - __os().writeBlob(outParams); - } - catch(Ice.LocalException ex) - { - __exception(ex); - return; - } - __response(ok); - } - - public void - ice_exception(java.lang.Exception ex) - { - __exception(ex); - } -} diff --git a/javae/src/IceInternal/DispatchStatus.java b/javae/src/IceInternal/DispatchStatus.java index 714c27f8240..fb269c562d2 100644 --- a/javae/src/IceInternal/DispatchStatus.java +++ b/javae/src/IceInternal/DispatchStatus.java @@ -46,18 +46,10 @@ public final class DispatchStatus public static final DispatchStatus DispatchUnknownException = new DispatchStatus(_DispatchUnknownException); - // - // "Pseudo dispatch status", used internally only to indicate - // async dispatch. - // - public static final int _DispatchAsync = 8; - public static final DispatchStatus DispatchAsync = - new DispatchStatus(_DispatchAsync); - public static DispatchStatus convert(int val) { - assert val < 9; + assert val < 8; return __values[val]; } diff --git a/javae/src/IceInternal/Incoming.java b/javae/src/IceInternal/Incoming.java index 0cebf970904..f46edf8f577 100644 --- a/javae/src/IceInternal/Incoming.java +++ b/javae/src/IceInternal/Incoming.java @@ -157,7 +157,7 @@ final public class Incoming extends IncomingBase } finally { - if(_locator != null && _servant != null && status != DispatchStatus.DispatchAsync) + if(_locator != null && _servant != null) { _locator.finished(_current, _servant, _cookie.value); } @@ -378,18 +378,6 @@ final public class Incoming extends IncomingBase _is.endReadEncaps(); - // - // DispatchAsync is "pseudo dispatch status", used internally - // only to indicate async dispatch. - // - if(status == DispatchStatus.DispatchAsync) - { - // - // If this was an asynchronous dispatch, we're done here. - // - return; - } - if(_response) { _os.endWriteEncaps(); diff --git a/javae/src/IceInternal/IncomingAsync.java b/javae/src/IceInternal/IncomingAsync.java deleted file mode 100644 index 1bdcbc974ce..00000000000 --- a/javae/src/IceInternal/IncomingAsync.java +++ /dev/null @@ -1,324 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class IncomingAsync extends IncomingBase -{ - public - IncomingAsync(Incoming in) // Adopts the argument. It must not be used afterwards. - { - super(in); - } - - protected void - finalize() - { - // - // I must call __destroy() in the finalizer and not in - // __response() or __exception(), because an exception may be - // raised after the creation of an IncomingAsync but before - // calling __response() or __exception(). This can happen if - // an AMD operation raises an exception instead of calling - // ice_response() or ice_exception(). - // - __destroy(); - } - - final protected void - __response(boolean ok) - { - try - { - if(_locator != null && _servant != null) - { - _locator.finished(_current, _servant, _cookie.value); - } - - if(_response) - { - _os.endWriteEncaps(); - - int save = _os.pos(); - _os.pos(Protocol.headerSize + 4); // Dispatch status position. - - if(ok) - { - _os.writeByte((byte)DispatchStatus._DispatchOK); - } - else - { - _os.writeByte((byte)DispatchStatus._DispatchUserException); - } - - _os.pos(save); - - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(Ice.LocalException ex) - { - _connection.exception(ex); - } - catch(java.lang.Exception ex) - { - Ice.UnknownException uex = new Ice.UnknownException(); - //uex.unknown = ex.toString(); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - uex.unknown = sw.toString(); - _connection.exception(uex); - } - } - - final protected void - __exception(java.lang.Exception exc) - { - try - { - if(_locator != null && _servant != null) - { - _locator.finished(_current, _servant, _cookie.value); - } - - try - { - throw exc; - } - catch(Ice.RequestFailedException ex) - { - if(ex.id == null) - { - ex.id = _current.id; - } - - if(ex.facet == null) - { - ex.facet = _current.facet; - } - - if(ex.operation == null || ex.operation.length() == 0) - { - ex.operation = _current.operation; - } - - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - if(ex instanceof Ice.ObjectNotExistException) - { - _os.writeByte((byte)DispatchStatus._DispatchObjectNotExist); - } - else if(ex instanceof Ice.FacetNotExistException) - { - _os.writeByte((byte)DispatchStatus._DispatchFacetNotExist); - } - else if(ex instanceof Ice.OperationNotExistException) - { - _os.writeByte((byte)DispatchStatus._DispatchOperationNotExist); - } - else - { - assert(false); - } - ex.id.__write(_os); - - // - // For compatibility with the old FacetPath. - // - if(ex.facet == null || ex.facet.length() == 0) - { - _os.writeStringSeq(null); - } - else - { - String[] facetPath = { ex.facet }; - _os.writeStringSeq(facetPath); - } - - _os.writeString(ex.operation); - - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(Ice.UnknownLocalException ex) - { - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - _os.writeByte((byte)DispatchStatus._DispatchUnknownLocalException); - _os.writeString(ex.unknown); - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(Ice.UnknownUserException ex) - { - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - _os.writeByte((byte)DispatchStatus._DispatchUnknownUserException); - _os.writeString(ex.unknown); - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(Ice.UnknownException ex) - { - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - _os.writeByte((byte)DispatchStatus._DispatchUnknownException); - _os.writeString(ex.unknown); - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(Ice.LocalException ex) - { - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - _os.writeByte((byte)DispatchStatus._DispatchUnknownLocalException); - //_os.writeString(ex.toString()); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _os.writeString(sw.toString()); - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(Ice.UserException ex) - { - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - _os.writeByte((byte)DispatchStatus._DispatchUnknownUserException); - //_os.writeString(ex.toString()); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _os.writeString(sw.toString()); - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - catch(java.lang.Exception ex) - { - if(_os.instance().properties().getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_response) - { - _os.endWriteEncaps(); - _os.resize(Protocol.headerSize + 4, false); // Dispatch status position. - _os.writeByte((byte)DispatchStatus._DispatchUnknownException); - //_os.writeString(ex.toString()); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _os.writeString(sw.toString()); - _connection.sendResponse(_os, _compress); - } - else - { - _connection.sendNoResponse(); - } - } - } - catch(Ice.LocalException ex) - { - _connection.exception(ex); - } - catch(java.lang.Exception ex) - { - Ice.UnknownException uex = new Ice.UnknownException(); - //uex.unknown = ex.toString(); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - uex.unknown = sw.toString(); - _connection.exception(uex); - } - } - - final protected BasicStream - __os() - { - return _os; - } -} diff --git a/javae/src/IceInternal/OutgoingAsync.java b/javae/src/IceInternal/OutgoingAsync.java deleted file mode 100644 index dd14bb10a77..00000000000 --- a/javae/src/IceInternal/OutgoingAsync.java +++ /dev/null @@ -1,489 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class OutgoingAsync -{ - public - OutgoingAsync() - { - } - - public abstract void ice_exception(Ice.LocalException ex); - - public final void - __finished(BasicStream is) - { - synchronized(_monitor) - { - int status; - - try - { - __is.swap(is); - - status = (int)__is.readByte(); - - switch(status) - { - case DispatchStatus._DispatchOK: - case DispatchStatus._DispatchUserException: - { - __is.startReadEncaps(); - break; - } - - case DispatchStatus._DispatchObjectNotExist: - case DispatchStatus._DispatchFacetNotExist: - case DispatchStatus._DispatchOperationNotExist: - { - Ice.Identity id = new Ice.Identity(); - id.__read(__is); - - // - // For compatibility with the old FacetPath. - // - String[] facetPath = __is.readStringSeq(); - String facet; - if(facetPath.length > 0) - { - if(facetPath.length > 1) - { - throw new Ice.MarshalException(); - } - facet = facetPath[0]; - } - else - { - facet = ""; - } - - String operation = __is.readString(); - - Ice.RequestFailedException ex = null; - switch(status) - { - case DispatchStatus._DispatchObjectNotExist: - { - ex = new Ice.ObjectNotExistException(); - break; - } - - case DispatchStatus._DispatchFacetNotExist: - { - ex = new Ice.FacetNotExistException(); - break; - } - - case DispatchStatus._DispatchOperationNotExist: - { - ex = new Ice.OperationNotExistException(); - break; - } - - default: - { - assert(false); - break; - } - } - - ex.id = id; - ex.facet = facet; - ex.operation = operation; - throw ex; - } - - case DispatchStatus._DispatchUnknownException: - case DispatchStatus._DispatchUnknownLocalException: - case DispatchStatus._DispatchUnknownUserException: - { - String unknown = __is.readString(); - - Ice.UnknownException ex = null; - switch(status) - { - case DispatchStatus._DispatchUnknownException: - { - ex = new Ice.UnknownException(); - break; - } - - case DispatchStatus._DispatchUnknownLocalException: - { - ex = new Ice.UnknownLocalException(); - break; - } - - case DispatchStatus._DispatchUnknownUserException: - { - ex = new Ice.UnknownUserException(); - break; - } - - default: - { - assert(false); - break; - } - } - - ex.unknown = unknown; - throw ex; - } - - default: - { - throw new Ice.UnknownReplyStatusException(); - } - } - } - catch(Ice.LocalException ex) - { - __finished(ex); - return; - } - - assert(status == DispatchStatus._DispatchOK || status == DispatchStatus._DispatchUserException); - - try - { - __response(status == DispatchStatus._DispatchOK); - } - catch(java.lang.Exception ex) - { - warning(ex); - } - finally - { - cleanup(); - } - } - } - - public final void - __finished(Ice.LocalException exc) - { - synchronized(_monitor) - { - if(_reference != null) - { - try - { - IndirectReference ir = (IndirectReference)_reference; - ir.getLocatorInfo().clearObjectCache(ir); - } - catch(ClassCastException ex) - { - } - - boolean doRetry = false; - - // - // A CloseConnectionException indicates graceful - // server shutdown, and is therefore always repeatable - // without violating "at-most-once". That's because by - // sending a close connection message, the server - // guarantees that all outstanding requests can safely - // be repeated. Otherwise, we can also retry if the - // operation mode is Nonmutating or Idempotent. - // - if(_mode == Ice.OperationMode.Nonmutating || _mode == Ice.OperationMode.Idempotent || - exc instanceof Ice.CloseConnectionException) - { - try - { - ProxyFactory proxyFactory = _reference.getInstance().proxyFactory(); - if(proxyFactory != null) - { - _cnt = proxyFactory.checkRetryAfterException(exc, _cnt); - } - else - { - throw exc; // The communicator is already destroyed, so we cannot retry. - } - - doRetry = true; - } - catch(Ice.LocalException ex) - { - } - } - - if(doRetry) - { - _connection = null; - __send(); - return; - } - } - - try - { - ice_exception(exc); - } - catch(java.lang.Exception ex) - { - warning(ex); - } - finally - { - cleanup(); - } - } - } - - public final boolean - __timedOut() - { - // - // No synchronization necessary, because - // _absoluteTimeoutMillis is declared volatile. We cannot - // synchronize here because otherwise there might be deadlocks - // when Ice.ConnectionI calls back on this object with this - // function. - // - if(_absoluteTimeoutMillis > 0) - { - return System.currentTimeMillis() >= _absoluteTimeoutMillis; - } - else - { - return false; - } - } - - protected final void - __prepare(Ice.ObjectPrx prx, String operation, Ice.OperationMode mode, java.util.Map context) - { - synchronized(_monitor) - { - try - { - // - // We must first wait for other requests to finish. - // - while(_reference != null) - { - try - { - _monitor.wait(); - } - catch(InterruptedException ex) - { - } - } - - _reference = ((Ice.ObjectPrxHelperBase)prx).__reference(); - assert(_connection == null); - _connection = _reference.getConnection(_compress); - _cnt = 0; - _mode = mode; - assert(__is == null); - __is = new BasicStream(_reference.getInstance()); - assert(__os == null); - __os = new BasicStream(_reference.getInstance()); - - // - // If we are using a router, then add the proxy to the router info object. - // - try - { - RoutableReference rr = (RoutableReference)_reference; - if(rr != null && rr.getRouterInfo() != null) - { - rr.getRouterInfo().addProxy(prx); - } - - } - catch(ClassCastException ex) - { - } - - _connection.prepareRequest(__os); - - _reference.getIdentity().__write(__os); - - // - // For compatibility with the old FacetPath. - // - String facet = _reference.getFacet(); - if(facet == null || facet.length() == 0) - { - __os.writeStringSeq(null); - } - else - { - String[] facetPath = { facet }; - __os.writeStringSeq(facetPath); - } - - __os.writeString(operation); - - __os.writeByte((byte)mode.value()); - - if(context == null) - { - __os.writeSize(0); - } - else - { - final int sz = context.size(); - __os.writeSize(sz); - if(sz > 0) - { - java.util.Iterator i = context.entrySet().iterator(); - while(i.hasNext()) - { - java.util.Map.Entry entry = (java.util.Map.Entry)i.next(); - __os.writeString((String)entry.getKey()); - __os.writeString((String)entry.getValue()); - } - } - } - - __os.startWriteEncaps(); - } - catch(Ice.LocalException ex) - { - cleanup(); - throw ex; - } - } - } - - protected final void - __send() - { - synchronized(_monitor) - { - try - { - while(true) - { - if(_connection == null) - { - _connection = _reference.getConnection(_compress); - } - - if(_connection.timeout() >= 0) - { - _absoluteTimeoutMillis = System.currentTimeMillis() + _connection.timeout(); - } - else - { - _absoluteTimeoutMillis = 0; - } - - try - { - _connection.sendAsyncRequest(__os, this, _compress.value); - - // - // Don't do anything after sendAsyncRequest() returned - // without an exception. I such case, there will be - // callbacks, i.e., calls to the __finished() - // functions. Since there is no mutex protection, we - // cannot modify state here and in such callbacks. - // - return; - } - catch(Ice.LocalException ex) - { - try - { - IndirectReference ir = (IndirectReference)_reference; - if(ir != null && ir.getLocatorInfo() != null) - { - ir.getLocatorInfo().clearObjectCache(ir); - } - } - catch(ClassCastException e) - { - } - - ProxyFactory proxyFactory = _reference.getInstance().proxyFactory(); - if(proxyFactory != null) - { - _cnt = proxyFactory.checkRetryAfterException(ex, _cnt); - } - else - { - throw ex; // The communicator is already destroyed, so we cannot retry. - } - } - - _connection = null; - } - } - catch(Ice.LocalException ex) - { - __finished(ex); - } - } - } - - protected abstract void __response(boolean ok); - - private final void - warning(java.lang.Exception ex) - { - if(_reference != null) // Don't print anything if cleanup() was already called. - { - if(_reference.getInstance().properties().getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0) - { - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - IceUtil.OutputBase out = new IceUtil.OutputBase(pw); - out.setUseTab(false); - out.print("exception raised by AMI callback:\n"); - ex.printStackTrace(pw); - pw.flush(); - _reference.getInstance().logger().warning(sw.toString()); - } - } - } - - private final void - cleanup() - { - _reference = null; - _connection = null; - if(__is != null) - { - __is.destroy(); - __is = null; - } - if(__os != null) - { - __os.destroy(); - __os = null; - } - - _monitor.notify(); - } - - protected BasicStream __is; - protected BasicStream __os; - - private Reference _reference; - private Ice.ConnectionI _connection; - private int _cnt; - private Ice.OperationMode _mode; - private Ice.BooleanHolder _compress = new Ice.BooleanHolder(); - - // - // Must be volatile, because we don't want to lock the monitor - // below in __timedOut(), to avoid deadlocks. - // - private volatile long _absoluteTimeoutMillis; - - private final java.lang.Object _monitor = new java.lang.Object(); -} diff --git a/javae/src/IceInternal/PropertyNames.java b/javae/src/IceInternal/PropertyNames.java index ae82556d85b..fd37740a9d4 100644 --- a/javae/src/IceInternal/PropertyNames.java +++ b/javae/src/IceInternal/PropertyNames.java @@ -52,7 +52,6 @@ public final class PropertyNames "^Ice\\.Trace\\.Slicing$", "^Ice\\.UseEventLog$", "^Ice\\.UseSyslog$", - "^Ice\\.Warn\\.AMICallback$", "^Ice\\.Warn\\.Connections$", "^Ice\\.Warn\\.Dispatch$", "^Ice\\.Warn\\.Leaks$", diff --git a/javae/test/IceE/build.xml b/javae/test/IceE/build.xml index 3618295c83d..f83f8ef8479 100644 --- a/javae/test/IceE/build.xml +++ b/javae/test/IceE/build.xml @@ -14,13 +14,11 @@ <target name="all"> <ant dir="adapterDeactivation"/> <ant dir="exceptions"/> - <ant dir="exceptionsAMD"/> <ant dir="facets"/> <ant dir="faultTolerance"/> <ant dir="inheritance"/> <ant dir="location"/> <ant dir="operations"/> - <ant dir="operationsAMD"/> <ant dir="slicing"/> <ant dir="custom"/> <ant dir="translator"/> @@ -32,13 +30,11 @@ <target name="clean"> <ant dir="adapterDeactivation" target="clean"/> <ant dir="exceptions" target="clean"/> - <ant dir="exceptionsAMD" target="clean"/> <ant dir="facets" target="clean"/> <ant dir="faultTolerance" target="clean"/> <ant dir="inheritance" target="clean"/> <ant dir="location" target="clean"/> <ant dir="operations" target="clean"/> - <ant dir="operationsAMD" target="clean"/> <ant dir="slicing" target="clean"/> <ant dir="custom" target="clean"/> <ant dir="translator" target="clean"/> diff --git a/javae/test/IceE/exceptions/AllTests.java b/javae/test/IceE/exceptions/AllTests.java index 17440fc2b49..8b1f9a13266 100644 --- a/javae/test/IceE/exceptions/AllTests.java +++ b/javae/test/IceE/exceptions/AllTests.java @@ -62,627 +62,6 @@ public class AllTests private boolean _called; } - private static class AMI_Thrower_throwAasAI extends AMI_Thrower_throwAasA - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwAasAObjectNotExistI extends AMI_Thrower_throwAasA - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ObjectNotExistException ex) - { - Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); - test(ex.id.equals(id)); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwAasAFacetNotExistI extends AMI_Thrower_throwAasA - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.FacetNotExistException ex) - { - test(ex.facet.equals("no such facet")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwAorDasAorDI extends AMI_Thrower_throwAorDasAorD - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(D ex) - { - test(ex.dMem == -1); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwBasAI extends AMI_Thrower_throwBasA - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwCasAI extends AMI_Thrower_throwCasA - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwBasBI extends AMI_Thrower_throwBasB - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwCasBI extends AMI_Thrower_throwCasB - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwCasCI extends AMI_Thrower_throwCasC - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwUndeclaredAI extends AMI_Thrower_throwUndeclaredA - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwUndeclaredBI extends AMI_Thrower_throwUndeclaredB - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwUndeclaredCI extends AMI_Thrower_throwUndeclaredC - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwLocalExceptionI extends AMI_Thrower_throwLocalException - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwNonIceExceptionI extends AMI_Thrower_throwNonIceException - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownException ex) - { - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Thrower_throwAssertExceptionI extends AMI_Thrower_throwAssertException - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ConnectionLostException ex) - { - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_WrongOperation_noSuchOperationI extends AMI_WrongOperation_noSuchOperation - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.OperationNotExistException ex) - { - test(ex.operation.equals("noSuchOperation")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - public static ThrowerPrx allTests(Ice.Communicator communicator) { @@ -1081,172 +460,6 @@ public class AllTests System.out.println("ok"); - System.out.print("catching exact types with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI(); - thrower.throwAasA_async(cb, 1); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - thrower.throwAasA_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); - thrower.throwAorDasAorD_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); - thrower.throwAorDasAorD_async(cb, -1); - test(cb.check()); - } - - { - AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI(); - thrower.throwBasB_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI(); - thrower.throwCasC_async(cb, 1, 2, 3); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - thrower.throwCasC_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching derived types with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI(); - thrower.throwBasA_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI(); - thrower.throwCasA_async(cb, 1, 2, 3); - test(cb.check()); - } - - { - AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI(); - thrower.throwCasB_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - - if(thrower.supportsUndeclaredExceptions()) - { - System.out.print("catching unknown user exception with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI(); - thrower.throwUndeclaredA_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI(); - thrower.throwUndeclaredB_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI(); - thrower.throwUndeclaredC_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - System.out.print("testing assert in the server with AMI... "); - System.out.flush(); - - AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI(); - thrower.throwAssertException_async(cb); - test(cb.check()); - - System.out.println("ok"); - } - - System.out.print("catching object not exist exception with AMI... "); - System.out.flush(); - - { - Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_newIdentity(id)); - AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(); - thrower2.throwAasA_async(cb, 1); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching facet not exist exception with AMI... "); - System.out.flush(); - - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); - { - AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI(); - thrower2.throwAasA_async(cb, 1); - test(cb.check()); - } - } - catch(Exception ex) - { - test(false); - } - - System.out.println("ok"); - - System.out.print("catching operation not exist exception with AMI... "); - System.out.flush(); - - { - AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI(); - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.noSuchOperation_async(cb); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching unknown local exception with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI(); - thrower.throwLocalException_async(cb); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching unknown non-Ice exception with AMI... "); - System.out.flush(); - - AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI(); - thrower.throwNonIceException_async(cb); - test(cb.check()); - - System.out.println("ok"); - return thrower; } } diff --git a/javae/test/IceE/exceptions/Test.ice b/javae/test/IceE/exceptions/Test.ice index 177935c8678..e1dfc3f6e91 100644 --- a/javae/test/IceE/exceptions/Test.ice +++ b/javae/test/IceE/exceptions/Test.ice @@ -39,7 +39,7 @@ exception D int dMem; }; -["ami"] interface Thrower +interface Thrower { void shutdown(); bool supportsUndeclaredExceptions(); @@ -61,7 +61,7 @@ exception D void throwAssertException(); }; -["ami"] interface WrongOperation +interface WrongOperation { void noSuchOperation(); }; diff --git a/javae/test/IceE/exceptions/run.py b/javae/test/IceE/exceptions/run.py index 6f5919ca7d6..933168e6403 100755 --- a/javae/test/IceE/exceptions/run.py +++ b/javae/test/IceE/exceptions/run.py @@ -22,35 +22,12 @@ import TestUtil name = os.path.join("Ice", "exceptions") testdir = os.path.join(toplevel, "test", name) -nameAMD = os.path.join("Ice", "exceptionsAMD") -testdirAMD = os.path.join(toplevel, "test", nameAMD) print "tests with regular server." classpath = os.getenv("CLASSPATH", "") os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + classpath TestUtil.clientServerTestWithOptions("", " --Ice.Warn.Connections=0") -print "tests with AMD server." -server = "java -ea Server --Ice.ProgramName=Server " -client = "java -ea Client --Ice.ProgramName=Client " -print "starting server...", -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdirAMD, "classes") + TestUtil.sep + classpath -serverPipe = os.popen(server + TestUtil.serverOptions + " 2>&1") -TestUtil.getAdapterReady(serverPipe) -print "ok" -print "starting client...", -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + classpath -(clientPipeIn, clientPipe) = os.popen4(client + TestUtil.clientOptions + " --Ice.Warn.Connections=0") -print "ok" -TestUtil.printOutputFromPipe(clientPipe) -clientStatus = clientPipe.close() -serverStatus = serverPipe.close() -if clientStatus or serverStatus: - TestUtil.killServers() - sys.exit(1) - print "tests with collocated server." TestUtil.collocatedTest() sys.exit(0) diff --git a/javae/test/IceE/faultTolerance/AllTests.java b/javae/test/IceE/faultTolerance/AllTests.java index 5d2057ea04c..cd569568021 100644 --- a/javae/test/IceE/faultTolerance/AllTests.java +++ b/javae/test/IceE/faultTolerance/AllTests.java @@ -62,177 +62,6 @@ public class AllTests private boolean _called; } - private static class AMI_Test_pidI extends AMI_TestIntf_pid - { - public void - ice_response(int pid) - { - _pid = pid; - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public void - ice_exception(Ice.UserException ex) - { - test(false); - } - - public int - pid() - { - return _pid; - } - - public boolean - check() - { - return callback.check(); - } - - private int _pid; - - private Callback callback = new Callback(); - } - - private static class AMI_Test_shutdownI extends AMI_TestIntf_shutdown - { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public void - ice_exception(Ice.UserException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_abortI extends AMI_TestIntf_abort - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - try - { - throw ex; - } - catch(Ice.ConnectionLostException exc) - { - } - catch(Ice.ConnectFailedException exc) - { - } - catch(Ice.SocketException exc) - { - } - catch(Exception exc) - { - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_idempotentAbortI extends AMI_TestIntf_idempotentAbort - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - delegate.ice_exception(ex); - } - - public void - ice_exception(Ice.UserException ex) - { - delegate.ice_exception(ex); - } - - public boolean - check() - { - return delegate.check(); - } - - private AMI_Test_abortI delegate = new AMI_Test_abortI(); - } - - private static class AMI_Test_nonmutatingAbortI extends AMI_TestIntf_nonmutatingAbort - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - delegate.ice_exception(ex); - } - - public void - ice_exception(Ice.UserException ex) - { - delegate.ice_exception(ex); - } - - public boolean - check() - { - return delegate.check(); - } - - private AMI_Test_abortI delegate = new AMI_Test_abortI(); - } - public static void allTests(Ice.Communicator communicator, int[] ports) { @@ -255,121 +84,68 @@ public class AllTests System.out.println("ok"); int oldPid = 0; - boolean ami = false; for(int i = 1, j = 0; i <= ports.length; ++i, ++j) { if(j > 3) { j = 0; - ami = !ami; } - if(!ami) - { - System.out.print("testing server #" + i + "... "); - System.out.flush(); - int pid = obj.pid(); - test(pid != oldPid); - System.out.println("ok"); - oldPid = pid; - } - else - { - System.out.print("testing server #" + i + " with AMI... "); - System.out.flush(); - AMI_Test_pidI cb = new AMI_Test_pidI(); - obj.pid_async(cb); - test(cb.check()); - int pid = cb.pid(); - test(pid != oldPid); - System.out.println("ok"); - oldPid = pid; - } + System.out.print("testing server #" + i + "... "); + System.out.flush(); + int pid = obj.pid(); + test(pid != oldPid); + System.out.println("ok"); + oldPid = pid; if(j == 0) { - if(!ami) + System.out.print("shutting down server #" + i + "... "); + System.out.flush(); + obj.shutdown(); + System.out.println("ok"); + } + else if(j == 1 || i + 1 > ports.length) + { + System.out.print("aborting server #" + i + "... "); + System.out.flush(); + try { - System.out.print("shutting down server #" + i + "... "); - System.out.flush(); - obj.shutdown(); - System.out.println("ok"); + obj.abort(); + test(false); } - else + catch(Ice.ConnectionLostException ex) { - System.out.print("shutting down server #" + i + " with AMI... "); - System.out.flush(); - AMI_Test_shutdownI cb = new AMI_Test_shutdownI(); - obj.shutdown_async(cb); - test(cb.check()); System.out.println("ok"); } - } - else if(j == 1 || i + 1 > ports.length) - { - if(!ami) + catch(Ice.ConnectFailedException exc) { - System.out.print("aborting server #" + i + "... "); - System.out.flush(); - try - { - obj.abort(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.ConnectFailedException exc) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - System.out.println("ok"); - } + System.out.println("ok"); } - else + catch(Ice.SocketException ex) { - System.out.print("aborting server #" + i + " with AMI... "); - System.out.flush(); - AMI_Test_abortI cb = new AMI_Test_abortI(); - obj.abort_async(cb); - test(cb.check()); System.out.println("ok"); } } else if(j == 2) { - if(!ami) + System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); + System.out.flush(); + try + { + obj.idempotentAbort(); + test(false); + } + catch(Ice.ConnectionLostException ex) + { + System.out.println("ok"); + } + catch(Ice.ConnectFailedException exc) { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); - System.out.flush(); - try - { - obj.idempotentAbort(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.ConnectFailedException exc) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - System.out.println("ok"); - } + System.out.println("ok"); } - else + catch(Ice.SocketException ex) { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); - System.out.flush(); - AMI_Test_idempotentAbortI cb = new AMI_Test_idempotentAbortI(); - obj.idempotentAbort_async(cb); - test(cb.check()); System.out.println("ok"); } @@ -377,35 +153,23 @@ public class AllTests } else if(j == 3) { - if(!ami) + System.out.print("aborting server #" + i + " and #" + (i + 1) + " with nonmutating call... "); + System.out.flush(); + try + { + obj.nonmutatingAbort(); + test(false); + } + catch(Ice.ConnectionLostException ex) { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with nonmutating call... "); - System.out.flush(); - try - { - obj.nonmutatingAbort(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.ConnectFailedException exc) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - System.out.println("ok"); - } + System.out.println("ok"); + } + catch(Ice.ConnectFailedException exc) + { + System.out.println("ok"); } - else + catch(Ice.SocketException ex) { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with nonmutating AMI call... "); - System.out.flush(); - AMI_Test_nonmutatingAbortI cb = new AMI_Test_nonmutatingAbortI(); - obj.nonmutatingAbort_async(cb); - test(cb.check()); System.out.println("ok"); } diff --git a/javae/test/IceE/faultTolerance/Test.ice b/javae/test/IceE/faultTolerance/Test.ice index 2bd5f952638..c8fb558df9a 100644 --- a/javae/test/IceE/faultTolerance/Test.ice +++ b/javae/test/IceE/faultTolerance/Test.ice @@ -13,7 +13,7 @@ module Test { -["ami"] interface TestIntf +interface TestIntf { void shutdown(); void abort(); diff --git a/javae/test/IceE/location/ServerLocator.java b/javae/test/IceE/location/ServerLocator.java index 11cd1d3cf50..cf3c1a60c9e 100644 --- a/javae/test/IceE/location/ServerLocator.java +++ b/javae/test/IceE/location/ServerLocator.java @@ -16,18 +16,18 @@ public class ServerLocator extends Ice._LocatorDisp _registryPrx = registryPrx; } - public void - findAdapterById_async(Ice.AMD_Locator_findAdapterById response, String adapter, Ice.Current current) + public Ice.ObjectPrx + findAdapterById(String adapter, Ice.Current current) throws Ice.AdapterNotFoundException { - response.ice_response(_registry.getAdapter(adapter)); + return _registry.getAdapter(adapter); } - public void - findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, Ice.Current current) + public Ice.ObjectPrx + findObjectById(Ice.Identity id, Ice.Current current) throws Ice.ObjectNotFoundException { - response.ice_response(_registry.getObject(id)); + return _registry.getObject(id); } public Ice.LocatorRegistryPrx diff --git a/javae/test/IceE/location/ServerLocatorRegistry.java b/javae/test/IceE/location/ServerLocatorRegistry.java index 480f45f3dbf..ea16c6d8203 100644 --- a/javae/test/IceE/location/ServerLocatorRegistry.java +++ b/javae/test/IceE/location/ServerLocatorRegistry.java @@ -10,16 +10,13 @@ public class ServerLocatorRegistry extends Ice._LocatorRegistryDisp { public void - setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, String adapter, Ice.ObjectPrx object, - Ice.Current current) + setAdapterDirectProxy(String adapter, Ice.ObjectPrx object, Ice.Current current) { _adapters.put(adapter, object); - cb.ice_response(); } public void - setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, String id, Ice.ProcessPrx proxy, - Ice.Current current) + setServerProcessProxy(String id, Ice.ProcessPrx proxy, Ice.Current current) { } diff --git a/javae/test/IceE/operations/AllTests.java b/javae/test/IceE/operations/AllTests.java index 6416499a72d..5462f725044 100644 --- a/javae/test/IceE/operations/AllTests.java +++ b/javae/test/IceE/operations/AllTests.java @@ -64,12 +64,6 @@ public class AllTests derived.opDerived(); System.out.println("ok"); - System.out.print("testing twoway operations with AMI... "); - System.out.flush(); - TwowaysAMI.twowaysAMI(communicator, cl); - TwowaysAMI.twowaysAMI(communicator, derived); - System.out.println("ok"); - System.out.print("testing batch oneway operations... "); System.out.flush(); BatchOneways.batchOneways(cl); diff --git a/javae/test/IceE/operations/TwowaysAMI.java b/javae/test/IceE/operations/TwowaysAMI.java deleted file mode 100644 index 2ea1964a06c..00000000000 --- a/javae/test/IceE/operations/TwowaysAMI.java +++ /dev/null @@ -1,1387 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -class TwowaysAMI -{ - private static void - test(boolean b) - { - if(!b) - { - throw new RuntimeException(); - } - } - - private static class Callback - { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; - } - - private static class AMI_MyClass_opVoidI extends Test.AMI_MyClass_opVoid - { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opByteI extends Test.AMI_MyClass_opByte - { - public void - ice_response(byte r, byte b) - { - test(b == (byte)0xf0); - test(r == (byte)0xff); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opBoolI extends Test.AMI_MyClass_opBool - { - public void - ice_response(boolean r, boolean b) - { - test(b); - test(!r); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opShortIntLongI extends Test.AMI_MyClass_opShortIntLong - { - public void - ice_response(long r, short s, int i, long l) - { - test(s == 10); - test(i == 11); - test(l == 12); - test(r == 12); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opFloatDoubleI extends Test.AMI_MyClass_opFloatDouble - { - public void - ice_response(double r, float f, double d) - { - test(f == 3.14f); - test(d == 1.1E10); - test(r == 1.1E10); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStringI extends Test.AMI_MyClass_opString - { - public void - ice_response(String r, String s) - { - test(s.equals("world hello")); - test(r.equals("hello world")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opMyEnumI extends Test.AMI_MyClass_opMyEnum - { - public void - ice_response(Test.MyEnum r, Test.MyEnum e) - { - test(e == Test.MyEnum.enum2); - test(r == Test.MyEnum.enum3); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opMyClassI extends Test.AMI_MyClass_opMyClass - { - public void - ice_response(Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2) - { - test(c1.ice_getIdentity().equals(Ice.Util.stringToIdentity("test"))); - test(c2.ice_getIdentity().equals(Ice.Util.stringToIdentity("noSuchIdentity"))); - test(r.ice_getIdentity().equals(Ice.Util.stringToIdentity("test"))); - // We can't do the callbacks below in thread per connection mode. - /* - { - r.opVoid(); - c1.opVoid(); - try - { - c2.opVoid(); - test(false); - } - catch(Ice.ObjectNotExistException ex) - { - } - } - */ - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStructI extends Test.AMI_MyClass_opStruct - { - public void - ice_response(Test.Structure rso, Test.Structure so) - { - test(rso.p == null); - test(rso.e == Test.MyEnum.enum2); - test(rso.s.s.equals("def")); - test(so.e == Test.MyEnum.enum3); - test(so.s.s.equals("a new string")); - // We can't do the callbacks below in thread per connection mode. - /* - { - so.p.opVoid(); - } - */ - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opByteSI extends Test.AMI_MyClass_opByteS - { - public void - ice_response(byte[] rso, byte[] bso) - { - test(bso.length == 4); - test(bso[0] == (byte)0x22); - test(bso[1] == (byte)0x12); - test(bso[2] == (byte)0x11); - test(bso[3] == (byte)0x01); - test(rso.length == 8); - test(rso[0] == (byte)0x01); - test(rso[1] == (byte)0x11); - test(rso[2] == (byte)0x12); - test(rso[3] == (byte)0x22); - test(rso[4] == (byte)0xf1); - test(rso[5] == (byte)0xf2); - test(rso[6] == (byte)0xf3); - test(rso[7] == (byte)0xf4); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opBoolSI extends Test.AMI_MyClass_opBoolS - { - public void - ice_response(boolean[] rso, boolean[] bso) - { - test(bso.length == 4); - test(bso[0]); - test(bso[1]); - test(!bso[2]); - test(!bso[3]); - test(rso.length == 3); - test(!rso[0]); - test(rso[1]); - test(rso[2]); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opShortIntLongSI extends Test.AMI_MyClass_opShortIntLongS - { - public void - ice_response(long[] rso, short[] sso, int[] iso, - long[] lso) - { - test(sso.length == 3); - test(sso[0] == 1); - test(sso[1] == 2); - test(sso[2] == 3); - test(iso.length == 4); - test(iso[0] == 8); - test(iso[1] == 7); - test(iso[2] == 6); - test(iso[3] == 5); - test(lso.length == 6); - test(lso[0] == 10); - test(lso[1] == 30); - test(lso[2] == 20); - test(lso[3] == 10); - test(lso[4] == 30); - test(lso[5] == 20); - test(rso.length == 3); - test(rso[0] == 10); - test(rso[1] == 30); - test(rso[2] == 20); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opFloatDoubleSI extends Test.AMI_MyClass_opFloatDoubleS - { - public void - ice_response(double[] rso, float[] fso, double[] dso) - { - test(fso.length == 2); - test(fso[0] == 3.14f); - test(fso[1] == 1.11f); - test(dso.length == 3); - test(dso[0] == 1.3E10); - test(dso[1] == 1.2E10); - test(dso[2] == 1.1E10); - test(rso.length == 5); - test(rso[0] == 1.1E10); - test(rso[1] == 1.2E10); - test(rso[2] == 1.3E10); - test((float)rso[3] == 3.14f); - test((float)rso[4] == 1.11f); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStringSI extends Test.AMI_MyClass_opStringS - { - public void - ice_response(String[] rso, String[] sso) - { - test(sso.length == 4); - test(sso[0].equals("abc")); - test(sso[1].equals("de")); - test(sso[2].equals("fghi")); - test(sso[3].equals("xyz")); - test(rso.length == 3); - test(rso[0].equals("fghi")); - test(rso[1].equals("de")); - test(rso[2].equals("abc")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opByteSSI extends Test.AMI_MyClass_opByteSS - { - public void - ice_response(byte[][] rso, byte[][] bso) - { - test(bso.length == 2); - test(bso[0].length == 1); - test(bso[0][0] == (byte)0xff); - test(bso[1].length == 3); - test(bso[1][0] == (byte)0x01); - test(bso[1][1] == (byte)0x11); - test(bso[1][2] == (byte)0x12); - test(rso.length == 4); - test(rso[0].length == 3); - test(rso[0][0] == (byte)0x01); - test(rso[0][1] == (byte)0x11); - test(rso[0][2] == (byte)0x12); - test(rso[1].length == 1); - test(rso[1][0] == (byte)0xff); - test(rso[2].length == 1); - test(rso[2][0] == (byte)0x0e); - test(rso[3].length == 2); - test(rso[3][0] == (byte)0xf2); - test(rso[3][1] == (byte)0xf1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opBoolSSI extends Test.AMI_MyClass_opBoolSS - { - public void - ice_response(boolean[][] rso, boolean[][] bso) - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opShortIntLongSSI extends Test.AMI_MyClass_opShortIntLongSS - { - public void - ice_response(long[][] rso, short[][] sso, int[][] iso, long[][] lso) - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opFloatDoubleSSI extends Test.AMI_MyClass_opFloatDoubleSS - { - public void - ice_response(double[][] rso, float[][] fso, double[][] dso) - { - test(fso.length == 3); - test(fso[0].length == 1); - test(fso[0][0] == 3.14f); - test(fso[1].length == 1); - test(fso[1][0] == 1.11f); - test(fso[2].length == 0); - test(dso.length == 1); - test(dso[0].length == 3); - test(dso[0][0] == 1.1E10); - test(dso[0][1] == 1.2E10); - test(dso[0][2] == 1.3E10); - test(rso.length == 2); - test(rso[0].length == 3); - test(rso[0][0] == 1.1E10); - test(rso[0][1] == 1.2E10); - test(rso[0][2] == 1.3E10); - test(rso[1].length == 3); - test(rso[1][0] == 1.1E10); - test(rso[1][1] == 1.2E10); - test(rso[1][2] == 1.3E10); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStringSSI extends Test.AMI_MyClass_opStringSS - { - public void - ice_response(String[][] rso, String[][] sso) - { - test(sso.length == 5); - test(sso[0].length == 1); - test(sso[0][0].equals("abc")); - test(sso[1].length == 2); - test(sso[1][0].equals("de")); - test(sso[1][1].equals("fghi")); - test(sso[2].length == 0); - test(sso[3].length == 0); - test(sso[4].length == 1); - test(sso[4][0].equals("xyz")); - test(rso.length == 3); - test(rso[0].length == 1); - test(rso[0][0].equals("xyz")); - test(rso[1].length == 0); - test(rso[2].length == 0); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStringSSSI extends Test.AMI_MyClass_opStringSSS - { - public void - ice_response(String[][][] rsso, String[][][] ssso) - { - test(ssso.length == 5); - test(ssso[0].length == 2); - test(ssso[0][0].length == 2); - test(ssso[0][1].length == 1); - test(ssso[1].length == 1); - test(ssso[1][0].length == 1); - test(ssso[2].length == 2); - test(ssso[2][0].length == 2); - test(ssso[2][1].length == 1); - test(ssso[3].length == 1); - test(ssso[3][0].length == 1); - test(ssso[4].length == 0); - test(ssso[0][0][0].equals("abc")); - test(ssso[0][0][1].equals("de")); - test(ssso[0][1][0].equals("xyz")); - test(ssso[1][0][0].equals("hello")); - test(ssso[2][0][0].equals("")); - test(ssso[2][0][1].equals("")); - test(ssso[2][1][0].equals("abcd")); - test(ssso[3][0][0].equals("")); - - test(rsso.length == 3); - test(rsso[0].length == 0); - test(rsso[1].length == 1); - test(rsso[1][0].length == 1); - test(rsso[2].length == 2); - test(rsso[2][0].length == 2); - test(rsso[2][1].length == 1); - test(rsso[1][0][0].equals("")); - test(rsso[2][0][0].equals("")); - test(rsso[2][0][1].equals("")); - test(rsso[2][1][0].equals("abcd")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opByteBoolDI extends Test.AMI_MyClass_opByteBoolD - { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Byte((byte)10), Boolean.TRUE); - di1.put(new Byte((byte)100), Boolean.FALSE); - test(_do.equals(di1)); - test(ro.size() == 4); - test(((Boolean)ro.get(new Byte((byte)10))).booleanValue() == true); - test(((Boolean)ro.get(new Byte((byte)11))).booleanValue() == false); - test(((Boolean)ro.get(new Byte((byte)100))).booleanValue() == false); - test(((Boolean)ro.get(new Byte((byte)101))).booleanValue() == true); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opShortIntDI extends Test.AMI_MyClass_opShortIntD - { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Short((short)110), new Integer(-1)); - di1.put(new Short((short)1100), new Integer(123123)); - test(_do.equals(di1)); - test(ro.size() == 4); - test(((Integer)ro.get(new Short((short)110))).intValue() == -1); - test(((Integer)ro.get(new Short((short)111))).intValue() == -100); - test(((Integer)ro.get(new Short((short)1100))).intValue() == 123123); - test(((Integer)ro.get(new Short((short)1101))).intValue() == 0); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opLongFloatDI extends Test.AMI_MyClass_opLongFloatD - { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Long(999999110L), new Float(-1.1f)); - di1.put(new Long(999999111L), new Float(123123.2f)); - test(_do.equals(di1)); - test(ro.size() == 4); - test(((Float)ro.get(new Long(999999110L))).floatValue() == -1.1f); - test(((Float)ro.get(new Long(999999120L))).floatValue() == -100.4f); - test(((Float)ro.get(new Long(999999111L))).floatValue() == 123123.2f); - test(((Float)ro.get(new Long(999999130L))).floatValue() == 0.5f); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStringStringDI extends Test.AMI_MyClass_opStringStringD - { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { - java.util.Map di1 = new java.util.HashMap(); - di1.put("foo", "abc -1.1"); - di1.put("bar", "abc 123123.2"); - test(_do.equals(di1)); - test(ro.size() == 4); - test(((String)ro.get("foo")).equals("abc -1.1")); - test(((String)ro.get("FOO")).equals("abc -100.4")); - test(((String)ro.get("bar")).equals("abc 123123.2")); - test(((String)ro.get("BAR")).equals("abc 0.5")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opStringMyEnumDI extends Test.AMI_MyClass_opStringMyEnumD - { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { - java.util.Map di1 = new java.util.HashMap(); - di1.put("abc", Test.MyEnum.enum1); - di1.put("", Test.MyEnum.enum2); - test(_do.equals(di1)); - test(ro.size() == 4); - test(((Test.MyEnum)ro.get("abc")) == Test.MyEnum.enum1); - test(((Test.MyEnum)ro.get("qwerty")) == Test.MyEnum.enum3); - test(((Test.MyEnum)ro.get("")) == Test.MyEnum.enum2); - test(((Test.MyEnum)ro.get("Hello!!")) == Test.MyEnum.enum2); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opIntSI extends Test.AMI_MyClass_opIntS - { - AMI_MyClass_opIntSI(int l) - { - _l = l; - } - - public void - ice_response(int[] r) - { - test(r.length == _l); - for(int j = 0; j < r.length; ++j) - { - test(r[j] == -j); - } - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private int _l; - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opContextEqualI extends Test.AMI_MyClass_opContext - { - AMI_MyClass_opContextEqualI(java.util.Map d) - { - _d = d; - } - - public void - ice_response(java.util.Map r) - { - test(r.equals(_d)); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private java.util.Map _d; - private Callback callback = new Callback(); - } - - private static class AMI_MyClass_opContextNotEqualI extends Test.AMI_MyClass_opContext - { - AMI_MyClass_opContextNotEqualI(java.util.Map d) - { - _d = d; - } - - public void - ice_response(java.util.Map r) - { - test(!r.equals(_d)); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private java.util.Map _d; - private Callback callback = new Callback(); - } - - private static class AMI_MyDerivedClass_opDerivedI extends Test.AMI_MyDerivedClass_opDerived - { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - static void - twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) - { - { - AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI(); - p.opVoid_async(cb); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - p.opVoid_async(cb); - test(cb.check()); - } - - { - AMI_MyClass_opByteI cb = new AMI_MyClass_opByteI(); - p.opByte_async(cb, (byte)0xff, (byte)0x0f); - test(cb.check()); - } - - { - AMI_MyClass_opBoolI cb = new AMI_MyClass_opBoolI(); - p.opBool_async(cb, true, false); - test(cb.check()); - } - - { - AMI_MyClass_opShortIntLongI cb = new AMI_MyClass_opShortIntLongI(); - p.opShortIntLong_async(cb, (short)10, 11, 12L); - test(cb.check()); - } - - { - AMI_MyClass_opFloatDoubleI cb = new AMI_MyClass_opFloatDoubleI(); - p.opFloatDouble_async(cb, 3.14f, 1.1E10); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - p.opFloatDouble_async(cb, 3.14f, 1.1E10); - test(cb.check()); - } - - { - AMI_MyClass_opStringI cb = new AMI_MyClass_opStringI(); - p.opString_async(cb, "hello", "world"); - test(cb.check()); - } - - { - AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI(); - p.opMyEnum_async(cb, Test.MyEnum.enum2); - test(cb.check()); - } - - { - AMI_MyClass_opMyClassI cb = new AMI_MyClass_opMyClassI(); - p.opMyClass_async(cb, p); - test(cb.check()); - } - - { - Test.Structure si1 = new Test.Structure(); - si1.p = p; - si1.e = Test.MyEnum.enum3; - si1.s = new Test.AnotherStruct(); - si1.s.s = "abc"; - Test.Structure si2 = new Test.Structure(); - si2.p = null; - si2.e = Test.MyEnum.enum2; - si2.s = new Test.AnotherStruct(); - si2.s.s = "def"; - - AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(); - p.opStruct_async(cb, si1, si2); - test(cb.check()); - } - - { - final byte[] bsi1 = - { - (byte)0x01, - (byte)0x11, - (byte)0x12, - (byte)0x22 - }; - final byte[] bsi2 = - { - (byte)0xf1, - (byte)0xf2, - (byte)0xf3, - (byte)0xf4 - }; - - AMI_MyClass_opByteSI cb = new AMI_MyClass_opByteSI(); - p.opByteS_async(cb, bsi1, bsi2); - test(cb.check()); - } - - { - final boolean[] bsi1 = { true, true, false }; - final boolean[] bsi2 = { false }; - - AMI_MyClass_opBoolSI cb = new AMI_MyClass_opBoolSI(); - p.opBoolS_async(cb, bsi1, bsi2); - test(cb.check()); - } - - { - final short[] ssi = { 1, 2, 3 }; - final int[] isi = { 5, 6, 7, 8 }; - final long[] lsi = { 10, 30, 20 }; - - AMI_MyClass_opShortIntLongSI cb = new AMI_MyClass_opShortIntLongSI(); - p.opShortIntLongS_async(cb, ssi, isi, lsi); - test(cb.check()); - } - - { - final float[] fsi = { 3.14f, 1.11f }; - final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; - - AMI_MyClass_opFloatDoubleSI cb = new AMI_MyClass_opFloatDoubleSI(); - p.opFloatDoubleS_async(cb, fsi, dsi); - test(cb.check()); - } - - { - final String[] ssi1 = { "abc", "de", "fghi" }; - final String[] ssi2 = { "xyz" }; - - AMI_MyClass_opStringSI cb = new AMI_MyClass_opStringSI(); - p.opStringS_async(cb, ssi1, ssi2); - test(cb.check()); - } - - { - final byte[][] bsi1 = - { - { (byte)0x01, (byte)0x11, (byte)0x12 }, - { (byte)0xff } - }; - final byte[][] bsi2 = - { - { (byte)0x0e }, - { (byte)0xf2, (byte)0xf1 } - }; - - AMI_MyClass_opByteSSI cb = new AMI_MyClass_opByteSSI(); - p.opByteSS_async(cb, bsi1, bsi2); - test(cb.check()); - } - - { - final float[][] fsi = - { - { 3.14f }, - { 1.11f }, - { }, - }; - final double[][] dsi = - { - { 1.1E10, 1.2E10, 1.3E10 } - }; - - AMI_MyClass_opFloatDoubleSSI cb = new AMI_MyClass_opFloatDoubleSSI(); - p.opFloatDoubleSS_async(cb, fsi, dsi); - test(cb.check()); - } - - { - final String[][] ssi1 = - { - { "abc" }, - { "de", "fghi" } - }; - final String[][] ssi2 = - { - { }, - { }, - { "xyz" } - }; - - AMI_MyClass_opStringSSI cb = new AMI_MyClass_opStringSSI(); - p.opStringSS_async(cb, ssi1, ssi2); - test(cb.check()); - } - - { - final String[][][] sssi1 = - { - { - { - "abc", "de" - }, - { - "xyz" - } - }, - { - { - "hello" - } - } - }; - - final String[][][] sssi2 = - { - { - { - "", "" - }, - { - "abcd" - } - }, - { - { - "" - } - }, - { - } - }; - - AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI(); - p.opStringSSS_async(cb, sssi1, sssi2); - test(cb.check()); - } - - { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Byte((byte)10), Boolean.TRUE); - di1.put(new Byte((byte)100), Boolean.FALSE); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Byte((byte)10), Boolean.TRUE); - di2.put(new Byte((byte)11), Boolean.FALSE); - di2.put(new Byte((byte)101), Boolean.TRUE); - - AMI_MyClass_opByteBoolDI cb = new AMI_MyClass_opByteBoolDI(); - p.opByteBoolD_async(cb, di1, di2); - test(cb.check()); - } - - { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Short((short)110), new Integer(-1)); - di1.put(new Short((short)1100), new Integer(123123)); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Short((short)110), new Integer(-1)); - di2.put(new Short((short)111), new Integer(-100)); - di2.put(new Short((short)1101), new Integer(0)); - - AMI_MyClass_opShortIntDI cb = new AMI_MyClass_opShortIntDI(); - p.opShortIntD_async(cb, di1, di2); - test(cb.check()); - } - - { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Long(999999110L), new Float(-1.1f)); - di1.put(new Long(999999111L), new Float(123123.2f)); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Long(999999110L), new Float(-1.1f)); - di2.put(new Long(999999120L), new Float(-100.4f)); - di2.put(new Long(999999130L), new Float(0.5f)); - - AMI_MyClass_opLongFloatDI cb = new AMI_MyClass_opLongFloatDI(); - p.opLongFloatD_async(cb, di1, di2); - test(cb.check()); - } - - { - java.util.Map di1 = new java.util.HashMap(); - di1.put("foo", "abc -1.1"); - di1.put("bar", "abc 123123.2"); - java.util.Map di2 = new java.util.HashMap(); - di2.put("foo", "abc -1.1"); - di2.put("FOO", "abc -100.4"); - di2.put("BAR", "abc 0.5"); - - AMI_MyClass_opStringStringDI cb = new AMI_MyClass_opStringStringDI(); - p.opStringStringD_async(cb, di1, di2); - test(cb.check()); - } - - { - java.util.Map di1 = new java.util.HashMap(); - di1.put("abc", Test.MyEnum.enum1); - di1.put("", Test.MyEnum.enum2); - java.util.Map di2 = new java.util.HashMap(); - di2.put("abc", Test.MyEnum.enum1); - di2.put("qwerty", Test.MyEnum.enum3); - di2.put("Hello!!", Test.MyEnum.enum2); - - AMI_MyClass_opStringMyEnumDI cb = new AMI_MyClass_opStringMyEnumDI(); - p.opStringMyEnumD_async(cb, di1, di2); - test(cb.check()); - } - - { - int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - - for(int l = 0; l < lengths.length; ++l) - { - int[] s = new int[lengths[l]]; - for(int i = 0; i < s.length; ++i) - { - s[i] = i; - } - AMI_MyClass_opIntSI cb = new AMI_MyClass_opIntSI(lengths[l]); - p.opIntS_async(cb, s); - test(cb.check()); - } - } - - { - java.util.Map ctx = new java.util.HashMap(); - ctx.put("one", "ONE"); - ctx.put("two", "TWO"); - ctx.put("three", "THREE"); - { - test(p.ice_getContext().isEmpty()); - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(ctx); - p.opContext_async(cb); - test(cb.check()); - } - { - test(p.ice_getContext().isEmpty()); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p.opContext_async(cb, ctx); - test(cb.check()); - } - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx)); - test(p2.ice_getContext().equals(ctx)); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p2.opContext_async(cb); - test(cb.check()); - } - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p2.opContext_async(cb, ctx); - test(cb.check()); - } - - { - // - // Test that default context is obtained correctly from communicator. - // - java.util.HashMap dflt = new java.util.HashMap(); - dflt.put("a", "b"); - communicator.setDefaultContext(dflt); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); - p.opContext_async(cb); - test(cb.check()); - } - - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_newContext(new java.util.HashMap())); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); - p2.opContext_async(cb); - test(cb.check()); - } - - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); - p2.opContext_async(cb); - test(cb.check()); - } - - communicator.setDefaultContext(new java.util.HashMap()); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); - p.opContext_async(cb); - test(cb.check()); - } - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); - p2.opContext_async(cb); - test(cb.check()); - } - } - } - - { - Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); - test(derived != null); - AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI(); - derived.opDerived_async(cb); - test(cb.check()); - } - } -} diff --git a/javae/test/IceE/operations/run.py b/javae/test/IceE/operations/run.py index 0499202cdce..808039b7430 100755 --- a/javae/test/IceE/operations/run.py +++ b/javae/test/IceE/operations/run.py @@ -22,35 +22,12 @@ import TestUtil name = os.path.join("Ice", "operations") testdir = os.path.join(toplevel, "test", name) -nameAMD = os.path.join("Ice", "operationsAMD") -testdirAMD = os.path.join(toplevel, "test", nameAMD) print "tests with regular server." classpath = os.getenv("CLASSPATH", "") os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + classpath TestUtil.clientServerTest() -print "tests with AMD server." -server = "java -ea Server --Ice.ProgramName=Server " -client = "java -ea Client --Ice.ProgramName=Client " -print "starting server...", -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdirAMD, "classes") + TestUtil.sep + classpath -serverPipe = os.popen(server + TestUtil.serverOptions + " 2>&1") -TestUtil.getAdapterReady(serverPipe) -print "ok" -print "starting client...", -classpath = os.getenv("CLASSPATH", "") -os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + classpath -clientPipe = os.popen(client + TestUtil.clientOptions + " 2>&1") -print "ok" -TestUtil.printOutputFromPipe(clientPipe) -clientStatus = clientPipe.close() -serverStatus = serverPipe.close() -if clientStatus or serverStatus: - TestUtil.killServers() - sys.exit(1) - print "tests with collocated server." TestUtil.collocatedTest() sys.exit(0) diff --git a/javae/test/IceE/slicing/Test.ice b/javae/test/IceE/slicing/Test.ice index 9abf479efb6..b3b6105fd44 100644 --- a/javae/test/IceE/slicing/Test.ice +++ b/javae/test/IceE/slicing/Test.ice @@ -33,7 +33,7 @@ exception KnownMostDerived extends KnownIntermediate string kmd; }; -["ami"] interface TestIntf +interface TestIntf { void baseAsBase() throws Base; void unknownDerivedAsBase() throws Base; diff --git a/javae/test/IceE/slicing/csrc/AllTests.java b/javae/test/IceE/slicing/csrc/AllTests.java index dff102d48c9..4ddd01319e9 100644 --- a/javae/test/IceE/slicing/csrc/AllTests.java +++ b/javae/test/IceE/slicing/csrc/AllTests.java @@ -62,568 +62,6 @@ public class AllTests private boolean _called; } - private static class AMI_Test_baseAsBaseI extends AMI_TestIntf_baseAsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("Base.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_unknownDerivedAsBaseI extends AMI_TestIntf_unknownDerivedAsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("UnknownDerived.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownDerivedAsBaseI extends AMI_TestIntf_knownDerivedAsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownDerived k) - { - test(k.b.equals("KnownDerived.b")); - test(k.kd.equals("KnownDerived.kd")); - test(k.ice_name().equals("Test::KnownDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownDerivedAsKnownDerivedI extends AMI_TestIntf_knownDerivedAsKnownDerived - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownDerived k) - { - test(k.b.equals("KnownDerived.b")); - test(k.kd.equals("KnownDerived.kd")); - test(k.ice_name().equals("Test::KnownDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_unknownIntermediateAsBaseI extends AMI_TestIntf_unknownIntermediateAsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("UnknownIntermediate.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownIntermediateAsBaseI extends AMI_TestIntf_knownIntermediateAsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("KnownIntermediate.b")); - test(ki.ki.equals("KnownIntermediate.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownMostDerivedAsBaseI extends AMI_TestIntf_knownMostDerivedAsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownIntermediateAsKnownIntermediateI - extends AMI_TestIntf_knownIntermediateAsKnownIntermediate - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("KnownIntermediate.b")); - test(ki.ki.equals("KnownIntermediate.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownMostDerivedAsKnownIntermediateI - extends AMI_TestIntf_knownMostDerivedAsKnownIntermediate - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_knownMostDerivedAsKnownMostDerivedI - extends AMI_TestIntf_knownMostDerivedAsKnownMostDerived - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_unknownMostDerived1AsBaseI extends AMI_TestIntf_unknownMostDerived1AsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("UnknownMostDerived1.b")); - test(ki.ki.equals("UnknownMostDerived1.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_unknownMostDerived1AsKnownIntermediateI - extends AMI_TestIntf_unknownMostDerived1AsKnownIntermediate - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("UnknownMostDerived1.b")); - test(ki.ki.equals("UnknownMostDerived1.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class AMI_Test_unknownMostDerived2AsBaseI extends AMI_TestIntf_unknownMostDerived2AsBase - { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("UnknownMostDerived2.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - } - public static TestIntfPrx allTests(Ice.Communicator communicator, boolean collocated) { @@ -663,15 +101,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("base (AMI)... "); - System.out.flush(); - { - AMI_Test_baseAsBaseI cb = new AMI_Test_baseAsBaseI(); - test.baseAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of unknown derived... "); System.out.flush(); { @@ -694,15 +123,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of unknown derived (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownDerivedAsBaseI cb = new AMI_Test_unknownDerivedAsBaseI(); - test.unknownDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("non-slicing of known derived as base... "); System.out.flush(); { @@ -726,15 +146,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("non-slicing of known derived as base (AMI)... "); - System.out.flush(); - { - AMI_Test_knownDerivedAsBaseI cb = new AMI_Test_knownDerivedAsBaseI(); - test.knownDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("non-slicing of known derived as derived... "); System.out.flush(); { @@ -758,15 +169,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("non-slicing of known derived as derived (AMI)... "); - System.out.flush(); - { - AMI_Test_knownDerivedAsKnownDerivedI cb = new AMI_Test_knownDerivedAsKnownDerivedI(); - test.knownDerivedAsKnownDerived_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of unknown intermediate as base... "); System.out.flush(); { @@ -789,15 +191,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of unknown intermediate as base (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownIntermediateAsBaseI cb = new AMI_Test_unknownIntermediateAsBaseI(); - test.unknownIntermediateAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of known intermediate as base... "); System.out.flush(); { @@ -821,15 +214,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of known intermediate as base (AMI)... "); - System.out.flush(); - { - AMI_Test_knownIntermediateAsBaseI cb = new AMI_Test_knownIntermediateAsBaseI(); - test.knownIntermediateAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of known most derived as base... "); System.out.flush(); { @@ -854,15 +238,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of known most derived as base (AMI)... "); - System.out.flush(); - { - AMI_Test_knownMostDerivedAsBaseI cb = new AMI_Test_knownMostDerivedAsBaseI(); - test.knownMostDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("non-slicing of known intermediate as intermediate... "); System.out.flush(); { @@ -886,15 +261,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("non-slicing of known intermediate as intermediate (AMI)... "); - System.out.flush(); - { - AMI_Test_knownIntermediateAsKnownIntermediateI cb = new AMI_Test_knownIntermediateAsKnownIntermediateI(); - test.knownIntermediateAsKnownIntermediate_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("non-slicing of known most derived as intermediate... "); System.out.flush(); { @@ -919,15 +285,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("non-slicing of known most derived as intermediate (AMI)... "); - System.out.flush(); - { - AMI_Test_knownMostDerivedAsKnownIntermediateI cb = new AMI_Test_knownMostDerivedAsKnownIntermediateI(); - test.knownMostDerivedAsKnownIntermediate_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("non-slicing of known most derived as most derived... "); System.out.flush(); { @@ -952,15 +309,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("non-slicing of known most derived as most derived (AMI)... "); - System.out.flush(); - { - AMI_Test_knownMostDerivedAsKnownMostDerivedI cb = new AMI_Test_knownMostDerivedAsKnownMostDerivedI(); - test.knownMostDerivedAsKnownMostDerived_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as base... "); System.out.flush(); { @@ -984,15 +332,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as base (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownMostDerived1AsBaseI cb = new AMI_Test_unknownMostDerived1AsBaseI(); - test.unknownMostDerived1AsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as intermediate... "); System.out.flush(); { @@ -1016,16 +355,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownMostDerived1AsKnownIntermediateI cb = - new AMI_Test_unknownMostDerived1AsKnownIntermediateI(); - test.unknownMostDerived1AsKnownIntermediate_async(cb); - test(cb.check()); - } - System.out.println("ok"); - System.out.print("slicing of unknown most derived, unknown intermediate thrown as base... "); System.out.flush(); { @@ -1048,15 +377,6 @@ public class AllTests } System.out.println("ok"); - System.out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownMostDerived2AsBaseI cb = new AMI_Test_unknownMostDerived2AsBaseI(); - test.unknownMostDerived2AsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - return test; } } diff --git a/javae/test/IceE/slicing/run.py b/javae/test/IceE/slicing/run.py index 0b89376bab8..5ced7f976e6 100755 --- a/javae/test/IceE/slicing/run.py +++ b/javae/test/IceE/slicing/run.py @@ -22,13 +22,8 @@ import TestUtil name = os.path.join("Ice", "slicing", "exceptions") testdir = os.path.join(toplevel, "test", name) -nameAMD = os.path.join("Ice", "slicing", "exceptionsAMD") -testdirAMD = os.path.join(toplevel, "test", nameAMD) print "tests with regular server." TestUtil.clientServerTestWithClasspath(os.path.join(testdir, "sclasses"), os.path.join(testdir, "cclasses")) -print "tests with AMD server." -TestUtil.clientServerTestWithClasspath(os.path.join(testdirAMD, "classes"), os.path.join(testdir, "cclasses")) - sys.exit(0) diff --git a/javae/test/IceE/translator/Metadata.ice b/javae/test/IceE/translator/Metadata.ice index bccf46f920b..f4cc4ce1b2a 100644 --- a/javae/test/IceE/translator/Metadata.ice +++ b/javae/test/IceE/translator/Metadata.ice @@ -33,24 +33,6 @@ module MetadataTest StringDict opStringDict(StringDict inArg, out StringDict outArg); StringMap opStringMap(StringMap inArg, out StringMap outArg); - ["ami"] IntSeq opIntSeqAMI(IntSeq inArg, out IntSeq outArg); - ["ami"] IntList opIntListAMI(IntList inArg, out IntList outArg); - - ["ami"] ObjectSeq opObjectSeqAMI(ObjectSeq inArg, out ObjectSeq outArg); - ["ami"] ObjectList opObjectListAMI(ObjectList inArg, out ObjectList outArg); - - ["ami"] StringDict opStringDictAMI(StringDict inArg, out StringDict outArg); - ["ami"] StringMap opStringMapAMI(StringMap inArg, out StringMap outArg); - - ["amd"] IntSeq opIntSeqAMD(IntSeq inArg, out IntSeq outArg); - ["amd"] IntList opIntListAMD(IntList inArg, out IntList outArg); - - ["amd"] ObjectSeq opObjectSeqAMD(ObjectSeq inArg, out ObjectSeq outArg); - ["amd"] ObjectList opObjectListAMD(ObjectList inArg, out ObjectList outArg); - - ["amd"] StringDict opStringDictAMD(StringDict inArg, out StringDict outArg); - ["amd"] StringMap opStringMapAMD(StringMap inArg, out StringMap outArg); - ["java:type:java.util.LinkedList"] IntSeq opIntSeq2(["java:type:java.util.ArrayList"] IntSeq inArg, out ["java:type:Test.CustomList"] IntSeq outArg); @@ -66,37 +48,5 @@ module MetadataTest ["java:type:java.util.ArrayList"] ObjectList opObjectList2(["java:type:java.util.ArrayList"] ObjectList inArg, out ["java:type:Test.CustomList"] ObjectList outArg); - - ["ami", "java:type:java.util.LinkedList"] IntSeq - opIntSeq2AMI(["java:type:java.util.ArrayList"] IntSeq inArg, - out ["java:type:Test.CustomList"] IntSeq outArg); - - ["ami", "java:type:java.util.ArrayList"] IntList - opIntList2AMI(["java:type:java.util.ArrayList"] IntList inArg, - out ["java:type:Test.CustomList"] IntList outArg); - - ["ami", "java:type:java.util.LinkedList"] ObjectSeq - opObjectSeq2AMI(["java:type:java.util.ArrayList"] ObjectSeq inArg, - out ["java:type:Test.CustomList"] ObjectSeq outArg); - - ["ami", "java:type:java.util.ArrayList"] ObjectList - opObjectList2AMI(["java:type:java.util.ArrayList"] ObjectList inArg, - out ["java:type:Test.CustomList"] ObjectList outArg); - - ["amd", "java:type:java.util.LinkedList"] IntSeq - opIntSeq2AMD(["java:type:java.util.ArrayList"] IntSeq inArg, - out ["java:type:Test.CustomList"] IntSeq outArg); - - ["amd", "java:type:java.util.ArrayList"] IntList - opIntList2AMD(["java:type:java.util.ArrayList"] IntList inArg, - out ["java:type:Test.CustomList"] IntList outArg); - - ["amd", "java:type:java.util.LinkedList"] ObjectSeq - opObjectSeq2AMD(["java:type:java.util.ArrayList"] ObjectSeq inArg, - out ["java:type:Test.CustomList"] ObjectSeq outArg); - - ["amd", "java:type:java.util.ArrayList"] ObjectList - opObjectList2AMD(["java:type:java.util.ArrayList"] ObjectList inArg, - out ["java:type:Test.CustomList"] ObjectList outArg); }; }; |