Search in sources :

Example 1 with Publishers

use of org.xipki.ca.dbtool.jaxb.ca.CAConfigurationType.Publishers in project xipki by xipki.

the class CaConfigurationDbExporter method exportPublisher.

// method exportResponder
private void exportPublisher(CAConfigurationType caconf) throws DataAccessException, IOException {
    System.out.println("exporting table PUBLISHER");
    Publishers publishers = new Publishers();
    final String sql = "SELECT ID,NAME,TYPE,CONF FROM PUBLISHER";
    Statement stmt = null;
    ResultSet rs = null;
    try {
        stmt = createStatement();
        rs = stmt.executeQuery(sql);
        while (rs.next()) {
            String name = rs.getString("NAME");
            PublisherType publisher = new PublisherType();
            publisher.setId(rs.getInt("ID"));
            publisher.setName(name);
            publisher.setType(rs.getString("TYPE"));
            publisher.setConf(buildFileOrValue(rs.getString("CONF"), "ca-conf/conf-publisher-" + name));
            publishers.getPublisher().add(publisher);
        }
    } catch (SQLException ex) {
        throw translate(sql, ex);
    } finally {
        releaseResources(stmt, rs);
    }
    caconf.setPublishers(publishers);
    System.out.println(" exported table PUBLISHER");
}
Also used : CaHasPublisherType(org.xipki.ca.dbtool.jaxb.ca.CaHasPublisherType) PublisherType(org.xipki.ca.dbtool.jaxb.ca.PublisherType) SQLException(java.sql.SQLException) Statement(java.sql.Statement) Publishers(org.xipki.ca.dbtool.jaxb.ca.CAConfigurationType.Publishers) CaHasPublishers(org.xipki.ca.dbtool.jaxb.ca.CAConfigurationType.CaHasPublishers) ResultSet(java.sql.ResultSet)

Aggregations

ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 CaHasPublishers (org.xipki.ca.dbtool.jaxb.ca.CAConfigurationType.CaHasPublishers)1 Publishers (org.xipki.ca.dbtool.jaxb.ca.CAConfigurationType.Publishers)1 CaHasPublisherType (org.xipki.ca.dbtool.jaxb.ca.CaHasPublisherType)1 PublisherType (org.xipki.ca.dbtool.jaxb.ca.PublisherType)1