Examples of PublisherException


Examples of org.eclipse.persistence.platform.database.oracle.publisher.PublisherException

            }

            if (t != null) {
                result = t;
                if (mustBeNew && predefined) {
                    throw new PublisherException("duplicate type " + result.toString());
                }
                else if (mustBeNew) {
                    t.setNameObject(sqlName);
                }
                return result;
            }

            String schema = sqlName.getSchemaName();
            String type = sqlName.getTypeName();
            if (whatIsIt == IS_TOPLEVEL) {
                return new SqlToplevelType(sqlName, parentType, signatureFilter, this);
            }
            else if ((whatIsIt & IS_PACKAGE) != 0) {
                Iterator<ViewRow> rowIter = m_viewCache.getRows(ALL_OBJECTS,
                    new String[]{"'PACKAGE' AS TYPECODE"}, new String[]{OWNER, OBJECT_NAME,
                        "OBJECT_TYPE", "STATUS"}, new Object[]{schema, type, "PACKAGE", "VALID"},
                    new String[0]);

                if (rowIter.hasNext()) {
                    m_viewCache.fetch(type, signatureFilter);
                    result = new SqlPackageType(sqlName, parentType, signatureFilter, this);
                }
                if (result != null) {
                    return result;
                }
                if (whatIsIt == IS_PACKAGE) {
                    throw new PublisherException("package not found " + sqlName.toString());
                }
            }

            /* determine whether this is an opaque type */
            Iterator<ViewRow> iter = m_viewCache.getRows(ALL_TYPES, new String[0], new String[]{
                OWNER, TYPE_NAME, "PREDEFINED"}, new Object[]{schema, type, "NO"},
                new String[0]);
            if (iter.hasNext()) {
                AllTypes allTypes = (AllTypes)iter.next();
                String typeCode = allTypes.typeCode;
                byte[] typeOID = allTypes.typeOid;
                int dbTypeCode = 0;
                int kind = 0;
                if (!m_getTypeCodeWarning) {
                    try {
                        Object[] outParams = m_viewCache.getOutParameters(
                            "BEGIN sys.sqljutl.get_typecode(:1, :2, :3, :4); END;",
                            new Object[]{typeOID}, new int[]{OracleTypes.INTEGER,
                                OracleTypes.VARCHAR, OracleTypes.INTEGER});
                        if (outParams == null) {
                            throw new SQLException("no data from sqljutl.get_typecode call");
                        }
                        dbTypeCode = ((Integer)outParams[0]).intValue();
                        kind = ((Integer)outParams[2]).intValue();
                    }
                    catch (SQLException exn) {
                        String msg = exn.getMessage();
                        if (isPre920()) {
                            // an older database version will not have GET_TYPECODE
                            msg = null;
                            m_getTypeCodeWarning = true;
                        }
                        else if (msg.indexOf("PLS-00201") > 0) {
                            msg = "cannot determine type " + type;
                            m_getTypeCodeWarning = true;
                        }
                        else {
                            msg = "error determining type " + type;
                        }
                        if (msg != null) {
                            throw new PublisherException(msg);
                        }
                    }
                }

                if (dbTypeCode == SqlType.CODE_OPAQUE) {
                    result = new SqlObjectType(sqlName, OracleTypes.OPAQUE, generateMe, parentType,
                        this);
                }
                else if (dbTypeCode == SqlType.CODE_SQLJTYPE && kind != 0) {
                    result = new SqlSqljType(sqlName, kind, parentType, this);
                }
                else if (typeCode.equals("OBJECT")) {
                    result = new SqlObjectType(sqlName, generateMe, parentType, this);
                    if (SqlName.langIsOtt()) {
                        /*
                         * For C only. Maura - I'm not sure about this, but
                         * it seems that a ref typedef has to be generated
                         * for every struct. That's the purpose of the
                         * following SqlRefType
                         */
                        new SqlRefType(sqlName, result, parentType, generateMe, this);
                    }
                    if (PublisherModifier.isIncomplete(result.getModifiers())) {
                        /*
                         * give warning
                         * about incomplete
                         * type and
                         * continue
                         */
                        int line = sqlName.getLine();
                        int column = sqlName.getColumn();
                        String mesg = "incomplete type " + sqlName.toString();

                        if (line > 0 || column > 0) {
                            mesg = "" + line + "." + column + ": " + mesg;
                        }
                        System.err.println(mesg);
                    }
                }
                else if (typeCode.equals("COLLECTION")) {
                    if ((whatIsIt & IS_COLLECTION) == 0) {
                        throw new PublisherException("collection found " + sqlName.toString());
                    }
                    Iterator<ViewRow> iter3 = m_viewCache.getRows(ALL_COLL_TYPES, new String[0],
                        new String[]{OWNER, TYPE_NAME}, new Object[]{schema, type},
                        new String[0]);
                    if (iter3.hasNext()) {
                        AllCollTypes act = (AllCollTypes)iter3.next();
                        String collTypeCode = act.collType;
                        if (collTypeCode.equals("TABLE")) {
                            result = new SqlTableType(sqlName, generateMe, parentType, this);
                        }
                        else {
                            // "VARYING ARRAY"
                            result = new SqlArrayType(sqlName, generateMe, parentType, this);
                        }
                    }
                }
            }
            if (result != null) {
                return result;
            }

            if (result != null) {
                return result;
            }
            else {
                // Note that this type is not supported, so we will not look
                // it up again.
                result = addPredefType(sqlName, OracleTypes.UNSUPPORTED);
                // Now add an error message
                if ((whatIsIt & IS_PACKAGE) != 0) {
                    throw new PublisherException("type not found " + sqlName.toString());
                }
            }
        }
        catch (SQLException e) {
            System.err.println(e.getMessage());
View Full Code Here

Examples of org.eclipse.persistence.platform.database.oracle.publisher.PublisherException

            }
        }
        if (result != null) {
            return result;
        }
        throw new PublisherException("unsupported Type " + schema + "." + type);
    }
View Full Code Here

Examples of org.eclipse.persistence.platform.database.oracle.publisher.PublisherException

        }
        if (st != null) {
            m_predefTypes.put(name, st);
        }
        else {
            throw new PublisherException("Cannot find Type " + name);
        }
        return st;
    }
View Full Code Here

Examples of org.eclipse.persistence.platform.database.oracle.publisher.PublisherException

            }

            if (t != null) {
                result = t;
                if (mustBeNew && predefined) {
                    throw new PublisherException("duplicate type " + result.toString());
                }
                else if (mustBeNew) {
                    t.setNameObject(sqlName);
                }
                return result;
            }

            String schema = sqlName.getSchemaName();
            String type = sqlName.getTypeName();
            if (whatIsIt == IS_TOPLEVEL) {
                return new SqlToplevelType(sqlName, parentType, signatureFilter, this);
            }
            else if ((whatIsIt & IS_PACKAGE) != 0) {
                Iterator<ViewRow> rowIter = m_viewCache.getRows(ALL_OBJECTS,
                    new String[]{"'PACKAGE' AS TYPECODE"}, new String[]{OWNER, OBJECT_NAME,
                        "OBJECT_TYPE", "STATUS"}, new Object[]{schema, type, "PACKAGE", "VALID"},
                    new String[0]);

                if (rowIter.hasNext()) {
                    m_viewCache.fetch(type, signatureFilter);
                    result = new SqlPackageType(sqlName, parentType, signatureFilter, this);
                }
                if (result != null) {
                    return result;
                }
                if (whatIsIt == IS_PACKAGE) {
                    throw new PublisherException("package not found " + sqlName.toString());
                }
            }

            /* determine whether this is an opaque type */
            Iterator<ViewRow> iter = m_viewCache.getRows(ALL_TYPES, new String[0], new String[]{
                OWNER, TYPE_NAME, "PREDEFINED"}, new Object[]{schema, type, "NO"},
                new String[0]);
            if (iter.hasNext()) {
                AllTypes allTypes = (AllTypes)iter.next();
                String typeCode = allTypes.typeCode;
                byte[] typeOID = allTypes.typeOid;
                int dbTypeCode = 0;
                int kind = 0;
                if (!m_getTypeCodeWarning) {
                    try {
                        Object[] outParams = m_viewCache.getOutParameters(
                            "BEGIN sys.sqljutl.get_typecode(:1, :2, :3, :4); END;",
                            new Object[]{typeOID}, new int[]{OracleTypes.INTEGER,
                                OracleTypes.VARCHAR, OracleTypes.INTEGER});
                        if (outParams == null) {
                            throw new SQLException("no data from sqljutl.get_typecode call");
                        }
                        dbTypeCode = ((Integer)outParams[0]).intValue();
                        kind = ((Integer)outParams[2]).intValue();
                    }
                    catch (SQLException exn) {
                        String msg = exn.getMessage();
                        if (isPre920()) {
                            // an older database version will not have GET_TYPECODE
                            msg = null;
                            m_getTypeCodeWarning = true;
                        }
                        else if (msg.indexOf("PLS-00201") > 0) {
                            msg = "cannot determine type " + type;
                            m_getTypeCodeWarning = true;
                        }
                        else {
                            msg = "error determining type " + type;
                        }
                        if (msg != null) {
                            throw new PublisherException(msg);
                        }
                    }
                }

                if (dbTypeCode == SqlType.CODE_OPAQUE) {
                    result = new SqlObjectType(sqlName, OracleTypes.OPAQUE, generateMe, parentType,
                        this);
                }
                else if (dbTypeCode == SqlType.CODE_SQLJTYPE && kind != 0) {
                    result = new SqlSqljType(sqlName, kind, parentType, this);
                }
                else if (typeCode.equals("OBJECT")) {
                    result = new SqlObjectType(sqlName, generateMe, parentType, this);
                    if (SqlName.langIsOtt()) {
                        /*
                         * For C only. Maura - I'm not sure about this, but
                         * it seems that a ref typedef has to be generated
                         * for every struct. That's the purpose of the
                         * following SqlRefType
                         */
                        new SqlRefType(sqlName, result, parentType, generateMe, this);
                    }
                    if (PublisherModifier.isIncomplete(result.getModifiers())) {
                        /*
                         * give warning
                         * about incomplete
                         * type and
                         * continue
                         */
                        int line = sqlName.getLine();
                        int column = sqlName.getColumn();
                        String mesg = "incomplete type " + sqlName.toString();

                        if (line > 0 || column > 0) {
                            mesg = "" + line + "." + column + ": " + mesg;
                        }
                        System.err.println(mesg);
                    }
                }
                else if (typeCode.equals("COLLECTION")) {
                    if ((whatIsIt & IS_COLLECTION) == 0) {
                        throw new PublisherException("collection found " + sqlName.toString());
                    }
                    Iterator<ViewRow> iter3 = m_viewCache.getRows(ALL_COLL_TYPES, new String[0],
                        new String[]{OWNER, TYPE_NAME}, new Object[]{schema, type},
                        new String[0]);
                    if (iter3.hasNext()) {
                        AllCollTypes act = (AllCollTypes)iter3.next();
                        String collTypeCode = act.collType;
                        if (collTypeCode.equals("TABLE")) {
                            result = new SqlTableType(sqlName, generateMe, parentType, this);
                        }
                        else {
                            // "VARYING ARRAY"
                            result = new SqlArrayType(sqlName, generateMe, parentType, this);
                        }
                    }
                }
            }
            if (result != null) {
                return result;
            }

            if (result != null) {
                return result;
            }
            else {
                // Note that this type is not supported, so we will not look
                // it up again.
                result = addPredefType(sqlName, OracleTypes.UNSUPPORTED);
                // Now add an error message
                if ((whatIsIt & IS_PACKAGE) != 0) {
                    throw new PublisherException("type not found " + sqlName.toString());
                }
            }
        }
        catch (SQLException e) {
            System.err.println(e.getMessage());
View Full Code Here

Examples of org.eclipse.persistence.platform.database.oracle.publisher.PublisherException

            }
        }
        if (result != null) {
            return result;
        }
        throw new PublisherException("unsupported Type " + schema + "." + type);
    }
View Full Code Here

Examples of org.eclipse.persistence.platform.database.oracle.publisher.PublisherException

        }
        if (st != null) {
            m_predefTypes.put(name, st);
        }
        else {
            throw new PublisherException("Cannot find Type " + name);
        }
        return st;
    }
View Full Code Here

Examples of org.ejbca.core.model.ca.publisher.PublisherException

    try{
      String bcIssuerDN = CertTools.stringToBCDNString(issuerDN);
      caAdminSession.verifyExistenceOfCA(bcIssuerDN.hashCode());
      CertReqHistory certreqhist = certificateStoreSession.getCertReqHistory(admin,new BigInteger(serialNumberInHex,16), bcIssuerDN);
      if(certreqhist == null){
        throw new PublisherException("Error: the  certificate with  serialnumber : " + serialNumberInHex +" and issuerdn " + issuerDN + " couldn't be found in database.");
      }

      ejbhelper.isAuthorizedToRepublish(admin, certreqhist.getUsername(),bcIssuerDN.hashCode());

      if(certreqhist != null){
        CertificateProfile certprofile = certificateProfileSession.getCertificateProfile(admin,certreqhist.getUserDataVO().getCertificateProfileId());
        java.security.cert.Certificate cert = certificateStoreSession.findCertificateByFingerprint(admin, certreqhist.getFingerprint());
        if(certprofile != null){
          CertificateInfo certinfo = certificateStoreSession.getCertificateInfo(admin, certreqhist.getFingerprint());
          if(certprofile.getPublisherList().size() > 0){
            if(publisherSession.storeCertificate(admin, certprofile.getPublisherList(), cert, certreqhist.getUserDataVO().getUsername(), certreqhist.getUserDataVO().getPassword(), certreqhist.getUserDataVO().getDN(),
                certinfo.getCAFingerprint(), certinfo.getStatus() , certinfo.getType(), certinfo.getRevocationDate().getTime(), certinfo.getRevocationReason(), certinfo.getTag(), certinfo.getCertificateProfileId(), certinfo.getUpdateTime().getTime(), certreqhist.getUserDataVO().getExtendedinformation())){
            }else{
              throw new PublisherException("Error: publication failed to at least one of the defined publishers.");
            }
          }else{
            throw new PublisherException("Error no publisher defined for the given certificate.");
          }

        }else{
          throw new PublisherException("Error : Certificate profile couldn't be found for the given certificate.");
        }   
      }
        } catch (RuntimeException e) {  // EJBException, ClassCastException, ...
            throw EjbcaWSHelper.getInternalException(e, logger);
        } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.