![JAR search and dependency download from the Maven repository](/logo.png)
org.compass.spring.device.ojb.SpringOjbGpsDevice Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compass Show documentation
Show all versions of compass Show documentation
Compass Search Engine Framework
/*
* Copyright 2004-2006 the original author or authors.
*
* 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 org.compass.spring.device.ojb;
import org.apache.ojb.broker.PersistenceBroker;
import org.compass.gps.CompassGpsException;
import org.compass.gps.device.ojb.OjbGpsDevice;
import org.springframework.orm.ojb.OjbFactoryUtils;
import org.springframework.orm.ojb.PersistenceBrokerTemplate;
/**
* An extension of the OjbGpsDevice
that utilizes Spring ojb
* features. Uses Spring PersistenceBrokerTemplate
and
* OjbFactoryUtils
to get the current
* PersistenceBroker
for batch indexing (the index()
* operation).
*
* You can provide the PersistenceBrokerTemplate
, though it is
* not required since it is created the same way the
* PersistenceBrokerDaoSupport
does.
*
* Can be used with
* {@link SpringOjbGpsDeviceInterceptor} to
* provide real-time data mirroring without the need to write any code.
*
* @author kimchy
*/
public class SpringOjbGpsDevice extends OjbGpsDevice {
private PersistenceBrokerTemplate persistenceBrokerTemplate = createPersistenceBrokerTemplate();
protected PersistenceBrokerTemplate createPersistenceBrokerTemplate() {
return new PersistenceBrokerTemplate();
}
/**
* Uses Spring PersistenceBrokerTemplate and OjbFactoryUtils
* to get OJB PersistenceBroker
*/
protected PersistenceBroker doGetIndexPersistentBroker() throws CompassGpsException {
return OjbFactoryUtils.getPersistenceBroker(persistenceBrokerTemplate.getPbKey(), persistenceBrokerTemplate
.isAllowCreate());
}
/**
* Returns the Spring's PersistenceBrokerTemplate.
*/
public PersistenceBrokerTemplate getPersistenceBrokerTemplate() {
return persistenceBrokerTemplate;
}
/**
* Sets Spring's
* PersistenceBrokerTemplate to be used to fetch OJB
* PersistenceBroker
for batch indexing (the index()
operation).
*
* This is an optional parameter, since the PersistenceBrokerTemplate
can be automatically created.
*
* @param persistenceBrokerTemplate
*/
public void setPersistenceBrokerTemplate(PersistenceBrokerTemplate persistenceBrokerTemplate) {
this.persistenceBrokerTemplate = persistenceBrokerTemplate;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy