Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将LDAP.xml配置文件转换为.java配置文件?_Java_Xml_Spring_Scala_Configuration Files - Fatal编程技术网

如何将LDAP.xml配置文件转换为.java配置文件?

如何将LDAP.xml配置文件转换为.java配置文件?,java,xml,spring,scala,configuration-files,Java,Xml,Spring,Scala,Configuration Files,我的任务是转换可流动LDAP库的xml配置文件,并将其添加到已存在的Java配置中,以用于其他所有正在使用的内容 我无法看到xml在转换为Java时如何适应现有的Java代码。我看到的所有示例似乎都是使用SpringLDAP实现的,这与SpringLDAP略有不同 可流动配置: <bean id="processEngineConfiguration" class="...SomeProcessEngineConfigurationClass"> ...

我的任务是转换可流动LDAP库的xml配置文件,并将其添加到已存在的Java配置中,以用于其他所有正在使用的内容

我无法看到xml在转换为Java时如何适应现有的Java代码。我看到的所有示例似乎都是使用SpringLDAP实现的,这与SpringLDAP略有不同

可流动配置:

<bean id="processEngineConfiguration" class="...SomeProcessEngineConfigurationClass">
        ...
        <property name="configurators">
          <list>
              <bean class="org.flowable.ldap.LDAPConfigurator">

                <!-- Server connection params -->
                <property name="server" value="ldap://localhost" />
                <property name="port" value="33389" />
                <property name="user" value="uid=admin, ou=users, o=flowable" />
                <property name="password" value="pass" />

                <!-- Query params -->
                <property name="baseDn" value="o=flowable" />
                <property name="queryUserByUserId" value="(&(objectClass=inetOrgPerson)(uid={0}))" />
                <property name="queryUserByFullNameLike" value="(&(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))" />
                <property name="queryGroupsForUser" value="(&(objectClass=groupOfUniqueNames)(uniqueMember={0}))" />

                <!-- Attribute config -->
                <property name="userIdAttribute" value="uid" />
                <property name="userFirstNameAttribute" value="cn" />
                <property name="userLastNameAttribute" value="sn" />
                <property name="userEmailAttribute" value="mail" />


                <property name="groupIdAttribute" value="cn" />
                <property name="groupNameAttribute" value="cn" />

              </bean>
          </list>
        </property>
    </bean>

@DwB我想我错提了我的问题。我不是在尝试从xml转换到xml,我是在尝试从xml转换到java没有“
.java
配置文件”这样的东西你似乎有一个Bean,它被表示为一个
org.flowable.ldap.LDAPConfigurator
java类,它是由
LDAPConfigurator.java
文件设置的,如果这是你想要的mean@cricket_007对但是在给定的代码中,我遇到了集成LDAPConfigurator文件的问题。我可以访问那里的setter和getter方法来操作服务器和密码等。我只是不确定在给定的代码中放置它的位置。我看到您有
engineConfig.setBeans
,因此可以设置可以反序列化的可用类。我不知道春天though@DwB我想我把问题说错了。我不是在尝试从xml转换到xml,我是在尝试从xml转换到java没有“
.java
配置文件”这样的东西你似乎有一个Bean,它被表示为一个
org.flowable.ldap.LDAPConfigurator
java类,它是由
LDAPConfigurator.java
文件设置的,如果这是你想要的mean@cricket_007对但是在给定的代码中,我遇到了集成LDAPConfigurator文件的问题。我可以访问那里的setter和getter方法来操作服务器和密码等。我只是不确定在给定的代码中放置它的位置。我看到您有
engineConfig.setBeans
,因此可以设置可以反序列化的可用类。但我不知道春天
@Configuration
@EnableTransactionManagement
@ComponentScan(basePackages = Array("com.name.product.engine.services"))
class FlowableEngineConfig {

  @Bean
  def processEngineConfiguration(env: Environment, dataSource: DataSource, transactionManager: PlatformTransactionManager, applicationContext: ApplicationContext): ProcessEngineConfiguration = {
    val updateSchema = env.getProperty("conduct.engine.database.updateSchema", "true").trim.toLowerCase match {
      case "update" | "true" =>
        AbstractEngineConfiguration.DB_SCHEMA_UPDATE_TRUE
      case "none" =>
        null
      case x =>
        AbstractEngineConfiguration.DB_SCHEMA_UPDATE_FALSE
    }

    val engineConfig = new SpringProcessEngineConfiguration()


    engineConfig.setDataSource(dataSource)
    engineConfig.setTransactionManager(transactionManager)
    engineConfig.setTransactionsExternallyManaged(true)
    engineConfig.setDatabaseSchemaUpdate(updateSchema)

    engineConfig.setAsyncExecutorActivate(true)
    engineConfig.setAsyncExecutor(asyncExecutor())

    engineConfig.setHistoryLevel(HistoryLevel.FULL)


//    engineConfig.setCustomFormTypes(Seq[org.flowable.engine.form.AbstractFormType](
//      ISODateFormType
//    ).asJava)

    engineConfig.setExpressionManager(new SpringExpressionManager(applicationContext, null))
    engineConfig.setBeans(new SpringBeanFactoryProxyMap(applicationContext))

    // Enable safe XML. See http://www.flowable.org/docs/userguide/index.html#advanced.safe.bpmn.xml
    engineConfig.setEnableSafeBpmnXml(true)
    engineConfig.setProcessDefinitionCacheLimit(128)

    //engineConfig.setDisableIdmEngine(true)

    engineConfig.addConfigurator(new SpringFormEngineConfigurator())
    engineConfig.addConfigurator(new SpringDmnEngineConfigurator())

    engineConfig
  }

  @Bean
  def processEngine(engineConfig: ProcessEngineConfiguration): ProcessEngine = {
    engineConfig.buildProcessEngine()
  }

  @Bean
  def clock(engineConfig: ProcessEngineConfiguration): Clock = {
    engineConfig.getClock
  }

  @Bean
  def asyncExecutor(): AsyncExecutor = {
    val asyncExecutor = new DefaultAsyncJobExecutor()
    asyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(5000)
    asyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(5000)
    asyncExecutor
  }

  @Bean
  def dataSource(env: Environment): DataSource = {

    val hconf = new HikariConfig()

    env.getRequiredProperty("conductor.engine.database.platform").trim.toLowerCase() match {
      case "postgresql" =>
        hconf.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource")
        hconf.addDataSourceProperty("serverName", env.getRequiredProperty("conduct.engine.database.hostname"))
        hconf.addDataSourceProperty("portNumber", env.getRequiredProperty("conduct.engine.database.port", classOf[Int]))
        hconf.addDataSourceProperty("databaseName", env.getRequiredProperty("conduct.engine.database.name"))
        hconf.addDataSourceProperty("applicationName", "conduct")

      case "h2" =>
        hconf.setDataSourceClassName("org.h2.jdbcx.JdbcDataSource")
        val dbName = env.getRequiredProperty("conduct.engine.database.name")
        hconf.addDataSourceProperty("URL", s"jdbc:h2:file:./$dbName")

      case "h2mem" =>
        hconf.setDataSourceClassName("org.h2.jdbcx.JdbcDataSource")
        val dbName = env.getRequiredProperty("conduct.engine.database.name")
        hconf.addDataSourceProperty("URL", s"jdbc:h2:mem:$dbName")

      case x =>
        throw new RuntimeException(s"Unknown database platform $x")
    }

    hconf.setUsername(env.getRequiredProperty("conduct.engine.database.username"))
    hconf.setPassword(env.getRequiredProperty("conduct.engine.database.password"))

    hconf.setMinimumIdle(env.getRequiredProperty("conduct.engine.database.minConnections", classOf[Int]))
    hconf.setMaximumPoolSize(env.getRequiredProperty("conduct.engine.database.maxConnections", classOf[Int]))

    hconf.setInitializationFailFast(env.getRequiredProperty("conduct.engine.database.initializationFailFast", classOf[Boolean]))

    hconf.setTransactionIsolation("TRANSACTION_READ_COMMITTED")

    new HikariDataSource(hconf)
  }