Package org.apache.tuscany.sca.binding.corba.provider.exceptions

Examples of org.apache.tuscany.sca.binding.corba.provider.exceptions.RequestConfigurationException


     * @throws Exception
     */
    private void handleApplicationException(ApplicationException ae) throws Exception {
        try {
            if (exceptions.size() == 0) {
                RequestConfigurationException exception =
                    new RequestConfigurationException(
                                                      "ApplicationException occured, but no exception type was specified.",
                                                      ae.getId());
                throw exception;
            }
            InputStream is = ae.getInputStream();
            String exceptionId = is.read_string();
            TypeTree tree = exceptions.get(exceptionId);
            if (tree == null) {
                RequestConfigurationException exception =
                    new RequestConfigurationException(
                                                      "ApplicationException occured, but no such exception was defined",
                                                      ae.getId());
                throw exception;
            } else {
                Exception ex = (Exception)TypeHelpersProxy.read(tree.getRootNode(), is);
View Full Code Here


     * @throws Exception
     */
    private void handleApplicationException(ApplicationException ae) throws Exception {
        try {
            if (exceptions.size() == 0) {
                RequestConfigurationException exception =
                    new RequestConfigurationException(
                                                      "ApplicationException occured, but no exception type was specified.",
                                                      ae.getId());
                throw exception;
            }
            InputStream is = ae.getInputStream();
            String exceptionId = is.read_string();
            TypeTree tree = exceptions.get(exceptionId);
            if (tree == null) {
                RequestConfigurationException exception =
                    new RequestConfigurationException(
                                                      "ApplicationException occured, but no such exception was defined",
                                                      ae.getId());
                throw exception;
            } else {
                Exception ex = (Exception)TypeHelpersProxy.read(tree.getRootNode(), is);
View Full Code Here

            node.setJavaClass(forClass);
            try {
                // set the actual array size for further use by ArrayTypeHelper
                node.setAttributes(attributes.getCorbaArrayLength()[0]);
            } catch (ArrayIndexOutOfBoundsException e) {
                RequestConfigurationException exc =
                    new RequestConfigurationException("Annotated array size doesn't match declared arrays size");
                throw exc;
            }
        } else if (primitives.contains(forClass)) {
            node.setNodeType(NodeType.primitive);
            node.setJavaClass(forClass);
            node.setChildren(null);
        } else if (forClass.isInterface()) {
            node.setNodeType(NodeType.reference);
            node.setJavaClass(forClass);
            node.setChildren(null);
        } else if (isStructType(forClass)) {
            node.setNodeType(NodeType.struct);
            node.setJavaClass(forClass);
        } else if (isEnumType(forClass)) {
            node.setNodeType(NodeType.idl_enum);
            node.setJavaClass(forClass);
        } else if (isUserException(forClass)) {
            node.setNodeType(NodeType.exception);
            node.setJavaClass(forClass);
        } else if (isUnionType(forClass)) {
            node.setNodeType(NodeType.union);
            node.setJavaClass(forClass);
            node.setAttributes(getUnionAttributes(forClass));
        } else {
            RequestConfigurationException e =
                new RequestConfigurationException("User defined type which cannot be handled: " + forClass
                    .getCanonicalName());
            throw e;
        }
        return node;
    }
View Full Code Here

            if (note != null) {
                int fieldMod = forClass.getDeclaredFields()[i].getModifiers();
                if (Modifier.isPrivate(fieldMod) && !Modifier.isFinal(fieldMod) && !Modifier.isStatic(fieldMod)) {
                    if (note.type().equals(CorbaUnionElementType.discriminator)) {
                        if (discriminatorPresent) {
                            throw new RequestConfigurationException(
                                                                    "More than one discriminators declared on: " + forClass);
                        }
                        discriminatorPresent = true;
                    } else {
                        atLeastOneOption = true;
                    }
                } else {
                    throw new RequestConfigurationException(
                                                            "Annotated union field should be private, not final and no static on class: " + forClass);
                }
            }
        }
        if (atLeastOneOption && !discriminatorPresent) {
            throw new RequestConfigurationException("No discriminator annotation found on: " + forClass);
        } else if (!atLeastOneOption && discriminatorPresent) {
            throw new RequestConfigurationException("No union option found on: " + forClass);
        } else if (discriminatorPresent && atLeastOneOption) {
            return true;
        } else {
            return false;
        }
View Full Code Here

                    attributes.setDiscriminatorName(forClass.getDeclaredFields()[i].getName());
                } else if (note.type().equals(CorbaUnionElementType.defaultOption)) {
                    attributes.setDefaultOptionName(forClass.getDeclaredFields()[i].getName());
                } else if (note.type().equals(CorbaUnionElementType.option)) {
                    if (attributes.getOptionsMapping().containsKey(note.optionNumber())) {
                        throw new RequestConfigurationException("In " + forClass
                            + ": field \""
                            + forClass.getDeclaredFields()[i].getName()
                            + "\" uses already used option id: "
                            + note.optionNumber());
                    } else {
View Full Code Here

     * @throws Exception
     */
    private void handleApplicationException(ApplicationException ae) throws Exception {
        try {
            if (exceptions.size() == 0) {
                RequestConfigurationException exception =
                    new RequestConfigurationException(
                                                      "ApplicationException occured, but no exception type was specified.",
                                                      ae.getId());
                throw exception;
            }
            InputStream is = ae.getInputStream();
            String exceptionId = is.read_string();
            TypeTree tree = exceptions.get(exceptionId);
            if (tree == null) {
                RequestConfigurationException exception =
                    new RequestConfigurationException(
                                                      "ApplicationException occured, but no such exception was defined",
                                                      ae.getId());
                throw exception;
            } else {
                Exception ex = (Exception)TypeHelpersProxy.read(tree.getRootNode(), is);
View Full Code Here

            node.setJavaClass(forClass);
            try {
                // set the actual array size for further use by ArrayTypeHelper
                node.setAttributes(attributes.getCorbaArrayLength()[0]);
            } catch (ArrayIndexOutOfBoundsException e) {
                RequestConfigurationException exc =
                    new RequestConfigurationException("Annotated array size doesn't match declared arrays size");
                throw exc;
            }
        } else if (primitives.contains(forClass)) {
            node.setNodeType(NodeType.primitive);
            node.setJavaClass(forClass);
            node.setChildren(null);
        } else if (forClass.isInterface()) {
            node.setNodeType(NodeType.reference);
            node.setJavaClass(forClass);
            node.setChildren(null);
        } else if (isStructType(forClass)) {
            node.setNodeType(NodeType.struct);
            node.setJavaClass(forClass);
        } else if (isEnumType(forClass)) {
            node.setNodeType(NodeType.idl_enum);
            node.setJavaClass(forClass);
        } else if (isUserException(forClass)) {
            node.setNodeType(NodeType.exception);
            node.setJavaClass(forClass);
        } else if (isUnionType(forClass)) {
            node.setNodeType(NodeType.union);
            node.setJavaClass(forClass);
            node.setAttributes(getUnionAttributes(forClass));
        } else {
            RequestConfigurationException e =
                new RequestConfigurationException("User defined type which cannot be handled: " + forClass
                    .getCanonicalName());
            throw e;
        }
        return node;
    }
View Full Code Here

            if (note != null) {
                int fieldMod = forClass.getDeclaredFields()[i].getModifiers();
                if (Modifier.isPrivate(fieldMod) && !Modifier.isFinal(fieldMod) && !Modifier.isStatic(fieldMod)) {
                    if (note.type().equals(CorbaUnionElementType.discriminator)) {
                        if (discriminatorPresent) {
                            throw new RequestConfigurationException(
                                                                    "More than one discriminators declared on: " + forClass);
                        }
                        discriminatorPresent = true;
                    } else {
                        atLeastOneOption = true;
                    }
                } else {
                    throw new RequestConfigurationException(
                                                            "Annotated union field should be private, not final and no static on class: " + forClass);
                }
            }
        }
        if (atLeastOneOption && !discriminatorPresent) {
            throw new RequestConfigurationException("No discriminator annotation found on: " + forClass);
        } else if (!atLeastOneOption && discriminatorPresent) {
            throw new RequestConfigurationException("No union option found on: " + forClass);
        } else if (discriminatorPresent && atLeastOneOption) {
            return true;
        } else {
            return false;
        }
View Full Code Here

                    attributes.setDiscriminatorName(forClass.getDeclaredFields()[i].getName());
                } else if (note.type().equals(CorbaUnionElementType.defaultOption)) {
                    attributes.setDefaultOptionName(forClass.getDeclaredFields()[i].getName());
                } else if (note.type().equals(CorbaUnionElementType.option)) {
                    if (attributes.getOptionsMapping().containsKey(note.optionNumber())) {
                        throw new RequestConfigurationException("In " + forClass
                            + ": field \""
                            + forClass.getDeclaredFields()[i].getName()
                            + "\" uses already used option id: "
                            + note.optionNumber());
                    } else {
View Full Code Here

            node.setJavaClass(forClass);
            try {
                // set the actual array size for further use by ArrayTypeHelper
                node.setAttributes(attributes.getCorbaArrayLength()[0]);
            } catch (ArrayIndexOutOfBoundsException e) {
                RequestConfigurationException exc =
                    new RequestConfigurationException("Annotated array size doesn't match declared arrays size");
                throw exc;
            }
        } else if (primitives.contains(forClass)) {
            node.setNodeType(NodeType.primitive);
            node.setJavaClass(forClass);
            node.setChildren(null);
        } else if (forClass.isInterface()) {
            node.setNodeType(NodeType.reference);
            node.setJavaClass(forClass);
            node.setChildren(null);
        } else if (isStructType(forClass)) {
            node.setNodeType(NodeType.struct);
            node.setJavaClass(forClass);
        } else if (isEnumType(forClass)) {
            node.setNodeType(NodeType.idl_enum);
            node.setJavaClass(forClass);
        } else if (isUserException(forClass)) {
            node.setNodeType(NodeType.exception);
            node.setJavaClass(forClass);
        } else if (isUnionType(forClass)) {
            node.setNodeType(NodeType.union);
            node.setJavaClass(forClass);
            node.setAttributes(getUnionAttributes(forClass));
        } else {
            RequestConfigurationException e =
                new RequestConfigurationException("User defined type which cannot be handled: " + forClass
                    .getCanonicalName());
            throw e;
        }
        return node;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.corba.provider.exceptions.RequestConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.