Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into access-certification
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Nov 28, 2015
2 parents 8569a98 + e1b30c8 commit e9b7d7f
Show file tree
Hide file tree
Showing 15 changed files with 227 additions and 249 deletions.
4 changes: 2 additions & 2 deletions build-system/pom.xml
Expand Up @@ -74,7 +74,7 @@
<activiti-spring.version>5.17.0</activiti-spring.version>
<commons-email.version>1.3</commons-email.version>
<xmlsec.version>2.0.1</xmlsec.version>
<connid.version>1.4.1.23</connid.version>
<connid.version>1.4.2.0</connid.version>
<jasper.version>6.1.1</jasper.version>
<derby.version>10.11.1.1</derby.version>
<wro4j.version>1.7.1</wro4j.version>
Expand Down Expand Up @@ -463,7 +463,7 @@
<dependency>
<groupId>com.evolveum.polygon</groupId>
<artifactId>connector-ldap</artifactId>
<version>1.4.2.0-SNAPSHOT</version>
<version>1.4.2.0</version>
<exclusions>
<exclusion> <!-- Version in dependency of org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j conflicts with xalan -->
<groupId>xml-apis</groupId>
Expand Down
Expand Up @@ -961,7 +961,7 @@ private void prepareActivation(ResourceActivationDefinitionType activation){
existence.getInbound().addAll(newInbounds);

List<MappingType> outbounds = existence.getOutbound();
List<MappingType> newOutbounds = existence.getOutbound();
List<MappingType> newOutbounds = new ArrayList<>();

for(MappingType outbound: outbounds){
if(!WizardUtil.isEmptyMapping(outbound)){
Expand Down
Expand Up @@ -73,6 +73,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.query_3.QueryType;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -319,7 +320,9 @@ public void onClick(AjaxRequestTarget target) {
objectEditPerformed(target, object.getOid(), type);
}
};

cellItem.add(panel);
cellItem.add(new AttributeModifier("class", "col-md-3"));

}

Expand Down
Expand Up @@ -103,6 +103,7 @@
<cssClass>fa fa-user</cssClass>
</icon>
<color>blue</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfProfile</authorization>
</userDashboardLink>
<userDashboardLink>
<targetUrl>/self/credentials</targetUrl>
Expand All @@ -112,6 +113,7 @@
<cssClass>fa fa-shield</cssClass>
</icon>
<color>red</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfCredentials</authorization>
</userDashboardLink>
<userDashboardLink>
<targetUrl>/admin/users</targetUrl>
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -185,6 +185,7 @@ public void setDebugListener(LensDebugListener debugListener) {
private static final int DEFAULT_MAX_CLICKS = 200;

public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task task, OperationResult result) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException {
LOGGER.trace("Running clockwork for context {}", context);
if (InternalsConfig.consistencyChecks) {
context.checkConsistence();
}
Expand Down
2 changes: 1 addition & 1 deletion model/model-intest/src/test/resources/logback-test.xml
Expand Up @@ -76,7 +76,7 @@
<logger name="com.evolveum.midpoint.security" level="DEBUG" />
<logger name="com.evolveum.midpoint.model.impl.sync.FocusValidityScannerTaskHandler" level="DEBUG" />
<logger name="com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeTaskHandler" level="DEBUG" />
<logger name="com.evolveum.midpoint.model.impl.sync.SynchronizationService" level="DEBUG" />
<logger name="com.evolveum.midpoint.model.impl.sync.SynchronizationService" level="TRACE" />
<logger name="com.evolveum.midpoint.model.impl.controller.ModelController" level="DEBUG" />
<logger name="com.evolveum.midpoint.model.impl.controller.ModelInteractionServiceImpl" level="TRACE" />
<logger name="com.evolveum.icf.dummy" level="INFO" />
Expand Down
Expand Up @@ -226,7 +226,13 @@ public <T extends ShadowType> T handleError(T shadow, FailedOperation op, Except

Collection<? extends ItemDelta> deadModification = PropertyDelta.createModificationReplacePropertyCollection(ShadowType.F_DEAD, shadow.asPrismObject().getDefinition(), true);
ConstraintsChecker.onShadowModifyOperation(deadModification);
cacheRepositoryService.modifyObject(ShadowType.class, shadow.getOid(), deadModification, result);
try {
cacheRepositoryService.modifyObject(ShadowType.class, shadow.getOid(), deadModification, result);
} catch (ObjectNotFoundException e) {
// The shadow is not there. So we cannot mark it as dead.
LOGGER.debug("Cannot modify shadow {} in consistency compensation (discovery): {} - this is probably harmless", shadow, e.getMessage());

}

shadow.setDead(true);
ResourceObjectShadowChangeDescription getChange = createResourceObjectShadowChangeDescription(shadow,
Expand Down
Expand Up @@ -23,7 +23,7 @@
<name>ICF com.evolveum.polygon.connector.ldap.LdapConnector</name>
<framework>http://midpoint.evolveum.com/xml/ns/public/connector/icf-1</framework>
<connectorType>com.evolveum.polygon.connector.ldap.LdapConnector</connectorType>
<connectorVersion>1.4.2.0-SNAPSHOT</connectorVersion>
<connectorVersion>1.4.2.0</connectorVersion>
<connectorBundle>com.evolveum.polygon.connector-ldap</connectorBundle>
<namespace>http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-ldap/com.evolveum.polygon.connector.ldap.LdapConnector</namespace>
<schema>
Expand Down
Expand Up @@ -24,36 +24,18 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true" default-autowire="byName">

<bean id="testC3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" lazy-init="true"
destroy-method="close">
<property name="driverClass" value="#{testSqlRepositoryFactory.sqlConfiguration.driverClassName}"/>
<property name="jdbcUrl" value="#{testSqlRepositoryFactory.sqlConfiguration.jdbcUrl}"/>
<property name="user" value="#{testSqlRepositoryFactory.sqlConfiguration.jdbcUsername}"/>
<property name="password" value="#{testSqlRepositoryFactory.sqlConfiguration.jdbcPassword}"/>

<property name="acquireIncrement" value="3"/>
<property name="minPoolSize" value="#{testSqlRepositoryFactory.sqlConfiguration.minPoolSize}"/>
<property name="maxPoolSize" value="#{testSqlRepositoryFactory.sqlConfiguration.maxPoolSize}"/>
<property name="idleConnectionTestPeriod" value="1800"/>
<property name="connectionTesterClassName" value="com.evolveum.midpoint.repo.sql.util.MidPointConnectionTester" />
<property name="connectionCustomizerClassName"
value="com.evolveum.midpoint.repo.sql.util.MidPointConnectionCustomizer"/>
</bean>

<bean id="testJndiDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName" value="#{testSqlRepositoryFactory.sqlConfiguration.dataSource}"/>
<bean id="testDataSourceFactory" class="com.evolveum.midpoint.repo.sql.DataSourceFactory">
<property name="configuration" value="#{testSqlRepositoryFactory.sqlConfiguration}" />
</bean>

<bean name="testSqlDataSource" class="com.evolveum.midpoint.repo.sql.CompositeDataSource" lazy-init="true">
<property name="configuration" value="#{testSqlRepositoryFactory.sqlConfiguration}"/>
<property name="testing" value="true"/>
</bean>
<bean id="testDataSource" factory-bean="testDataSourceFactory" factory-method="createDataSource"
depends-on="testDataSourceFactory"/>

<!-- Hibernate session factory -->
<bean id="testSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
depends-on="testSqlDataSource" lazy-init="true">
depends-on="testDataSource" lazy-init="true">

<property name="dataSource" value="#{testSqlDataSource.dataSource}" />
<property name="dataSource" ref="testDataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">#{testSqlRepositoryFactory.sqlConfiguration.hibernateDialect}</prop>
Expand Down

This file was deleted.

@@ -0,0 +1,89 @@
/*
* Copyright (c) 2010-2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.repo.sql;

import com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException;
import com.evolveum.midpoint.repo.sql.util.MidPointConnectionCustomizer;
import com.evolveum.midpoint.repo.sql.util.MidPointConnectionTester;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.apache.commons.lang.StringUtils;
import org.springframework.jndi.JndiObjectFactoryBean;

import javax.naming.NamingException;
import javax.sql.DataSource;
import java.beans.PropertyVetoException;

/**
* @author Viliam Repan (lazyman)
*/
public class DataSourceFactory {

private static final Trace LOGGER = TraceManager.getTrace(DataSourceFactory.class);

private SqlRepositoryConfiguration configuration;

public void setConfiguration(SqlRepositoryConfiguration configuration) {
this.configuration = configuration;
}

public DataSource createDataSource() throws RepositoryServiceFactoryException {
LOGGER.info("Loading datasource.");
if (configuration == null) {
throw new RepositoryServiceFactoryException("SQL configuration is null, couldn't create datasource.");
}

try {
if (StringUtils.isNotEmpty(configuration.getDataSource())) {
LOGGER.info("JDNI datasource present in configuration, looking for '{}'.",
new Object[]{configuration.getDataSource()});
return createJNDIDataSource();
}

LOGGER.info("Constructing default C3P0 datasource with connection pooling.");
return createC3P0DataSource();
} catch (Exception ex) {
throw new RepositoryServiceFactoryException("Couldn't initialize datasource, reason: " + ex.getMessage(), ex);
}
}

private DataSource createJNDIDataSource() throws IllegalArgumentException, NamingException {
JndiObjectFactoryBean factory = new JndiObjectFactoryBean();
factory.setJndiName(configuration.getDataSource());
factory.afterPropertiesSet();

return (DataSource) factory.getObject();
}

private DataSource createC3P0DataSource() throws PropertyVetoException {
ComboPooledDataSource ds = new ComboPooledDataSource();
ds.setDriverClass(configuration.getDriverClassName());
ds.setJdbcUrl(configuration.getJdbcUrl());
ds.setUser(configuration.getJdbcUsername());
ds.setPassword(configuration.getJdbcPassword());

ds.setAcquireIncrement(3);
ds.setMinPoolSize(configuration.getMinPoolSize());
ds.setMaxPoolSize(configuration.getMaxPoolSize());
ds.setIdleConnectionTestPeriod(1800);
ds.setConnectionTesterClassName(MidPointConnectionTester.class.getName());
ds.setConnectionCustomizerClassName(MidPointConnectionCustomizer.class.getName());

return ds;
}
}
29 changes: 6 additions & 23 deletions repo/repo-sql-impl/src/main/resources/ctx-repository-session.xml
Expand Up @@ -24,35 +24,18 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true" default-autowire="byName">

<bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" lazy-init="true"
destroy-method="close">
<property name="driverClass" value="#{sqlRepositoryFactory.sqlConfiguration.driverClassName}"/>
<property name="jdbcUrl" value="#{sqlRepositoryFactory.sqlConfiguration.jdbcUrl}"/>
<property name="user" value="#{sqlRepositoryFactory.sqlConfiguration.jdbcUsername}"/>
<property name="password" value="#{sqlRepositoryFactory.sqlConfiguration.jdbcPassword}"/>

<property name="acquireIncrement" value="3"/>
<property name="minPoolSize" value="#{sqlRepositoryFactory.sqlConfiguration.minPoolSize}"/>
<property name="maxPoolSize" value="#{sqlRepositoryFactory.sqlConfiguration.maxPoolSize}"/>
<property name="idleConnectionTestPeriod" value="1800"/>
<property name="connectionTesterClassName" value="com.evolveum.midpoint.repo.sql.util.MidPointConnectionTester" />
<property name="connectionCustomizerClassName"
value="com.evolveum.midpoint.repo.sql.util.MidPointConnectionCustomizer"/>
</bean>

<bean id="jndiDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName" value="#{sqlRepositoryFactory.sqlConfiguration.dataSource}"/>
</bean>

<bean name="sqlDataSource" class="com.evolveum.midpoint.repo.sql.CompositeDataSource" lazy-init="true">
<bean id="dataSourceFactory" class="com.evolveum.midpoint.repo.sql.DataSourceFactory">
<property name="configuration" value="#{sqlRepositoryFactory.sqlConfiguration}" />
</bean>

<bean id="dataSource" factory-bean="dataSourceFactory" factory-method="createDataSource"
depends-on="dataSourceFactory"/>

<!-- Hibernate session factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
depends-on="sqlDataSource" lazy-init="true">
depends-on="dataSource" lazy-init="true">

<property name="dataSource" value="#{sqlDataSource.dataSource}" />
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">#{sqlRepositoryFactory.sqlConfiguration.hibernateDialect}</prop>
Expand Down

0 comments on commit e9b7d7f

Please sign in to comment.