Project

General

Profile

« Previous | Next » 

Revision c42c645d

Added by Andreas Kohlbecker over 8 years ago

for managed servers the datasource name is now converted into a valid XML type NCName

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/server/CDMServerUtils.java
47 47
        configStringBuilder.append(" </bean>" + System.lineSeparator());
48 48

  
49 49
        for(CdmPersistentDataSource dataSource : CdmPersistentDataSource.getAllDataSources()) {
50
            String beanId = dataSource.getName();
50
            String beanId = xmlNCNamefrom(dataSource.getName());
51 51
            String user = dataSource.getUsername();
52 52
            String password = dataSource.getPassword();
53 53
            String driverClass = dataSource.getCdmSourceProperty(CdmSourceProperties.DRIVER_CLASS);
......
65 65
        return configStringBuilder.toString();
66 66
    }
67 67

  
68
    /**
69
     * Assures that the datasource name is converted into a valid XML type NCName.
70
     *
71
     * Prefixes the string and replaces all forbidden characters by '_'.
72
     *
73
     * @param dataSource
74
     * @return
75
     */
76
    public static String xmlNCNamefrom(String beanName) {
77
        return "MGD_" + beanName.replaceAll("[^a-zA-Z0-9]", "_");
78
    }
79

  
68 80
    public static File writeManagedServerConfig(String config, String fileName) throws IOException {
69 81
        File managedConfigFile = new File(CdmApplicationUtils.getWritableResourceDir(), fileName);
70 82
        if(managedConfigFile.exists()) {

Also available in: Unified diff