本文整理汇总了Java中org.geotools.data.DataStoreFactorySpi类的典型用法代码示例。如果您正苦于以下问题:Java DataStoreFactorySpi类的具体用法?Java DataStoreFactorySpi怎么用?Java DataStoreFactorySpi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataStoreFactorySpi类属于org.geotools.data包,在下文中一共展示了DataStoreFactorySpi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateAvailableDataStores
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
/**
* Populates the list of available data stores that can be connected to.
*/
private void populateAvailableDataStores()
{
DataAccessFactory fac;
logger.debug("Available data store factories:");
Iterator<DataStoreFactorySpi> iterator = DataStoreFinder.getAvailableDataStores();
while (iterator.hasNext()) {
fac = (DataAccessFactory) iterator.next();
logger.debug("\t" + fac.getDisplayName());
availableDataStoreList.add(fac.getDisplayName());
}
}
示例2: populateNameMap
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
/**
* Populate name map.
*/
private static void populateNameMap() {
Iterator<DataStoreFactorySpi> datastore = DataStoreFinder.getAvailableDataStores();
while (datastore.hasNext()) {
DataStoreFactorySpi dSPI = datastore.next();
Param dbType = null;
for (Param param : dSPI.getParametersInfo()) {
if (param.key.equals(JDBCDataStoreFactory.DBTYPE.key)) {
dbType = param;
break;
}
}
if (dbType != null) {
nameMap.put(dSPI.getDisplayName(), (String) dbType.sample);
}
}
}
示例3: JDataStoreWizard
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
public JDataStoreWizard(final DataStoreFactorySpi format, final Map<String, Object> params) {
setWindowTitle(format == null ? "Connect" : format.getDisplayName());
connectionParameters = params == null ? new HashMap<String, Object>() : params;
if (format == null) {
dataChoosePage = new JDataChoosePage();
}
fillInDefaults(format, params);
this.format = format;
dataStorePage = new JDataStorePage(format, connectionParameters);
dataStorePage.setLevel("user");
if (countParamsAtLevel(format, "advanced") != 0) {
dataStorePage = new JDataStorePage(format, connectionParameters);
dataStorePage.setLevel("advanced");
}
}
示例4: countParamsAtLevel
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
private int countParamsAtLevel(final DataStoreFactorySpi format, final String level) {
if (format == null)
return 0;
int count = 0;
final Param[] parametersInfo = format.getParametersInfo();
if (level == null) {
return parametersInfo.length;
}
for (final Param param : parametersInfo) {
final String check = param.getLevel();
if (level.equals(check)) {
count++;
}
}
return count;
}
示例5: JDataStorePage
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
public JDataStorePage(final DataStoreFactorySpi format, Map<String, Object> params) {
super(ID);
if (format != null) {
setTitle(format.getDisplayName());
setDescription(format.getDescription());
}
this.format = format;
if (params == null) {
params = new HashMap<String, Object>();
if (format != null) {
for (final Param param : format.getParametersInfo()) {
params.put(param.key, param.sample);
}
}
}
this.connectionParameters = params;
}
示例6: testFactoryWithMissingRequired
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
@Test
public void testFactoryWithMissingRequired() throws IOException {
assertTrue(new ElasticDataStoreFactory().isAvailable());
scanForPlugins();
Map<String,Serializable> map = new HashMap<>();
map.put(ElasticDataStoreFactory.HOSTNAME.key, "localhost");
map.put(ElasticDataStoreFactory.HOSTPORT.key, PORT);
Iterator<DataStoreFactorySpi> ps = getAvailableDataSources();
ElasticDataStoreFactory fac;
while (ps.hasNext()) {
fac = (ElasticDataStoreFactory) ps.next();
assertTrue(!fac.canProcess(map));
}
assertNull(source);
}
示例7: getAvailableDataSources
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
public Iterator<DataStoreFactorySpi> getAvailableDataSources() {
Set<DataStoreFactorySpi> availableDS = new HashSet<>();
Iterator<DataStoreFactorySpi> it = getServiceRegistry().getServiceProviders(DataStoreFactorySpi.class, null,
null);
ElasticDataStoreFactory dsFactory;
while (it.hasNext()) {
Object ds = it.next();
if (ds instanceof ElasticDataStoreFactory) {
dsFactory = (ElasticDataStoreFactory) ds;
if (dsFactory.isAvailable()) {
availableDS.add(dsFactory);
}
}
}
return availableDS.iterator();
}
示例8: populateAvailableDataStores
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
/**
* Populates the list of available data stores that can be connected to.
*/
private void populateAvailableDataStores() {
DataAccessFactory fac = null;
logger.debug("Available data store factories:");
Iterator<DataStoreFactorySpi> iterator = DataStoreFinder.getAvailableDataStores();
while (iterator.hasNext()) {
fac = (DataAccessFactory) iterator.next();
logger.debug("\t" + fac.getDisplayName());
availableDataStoreList.add(fac.getDisplayName());
}
}
示例9: fillInDefaults
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
private void fillInDefaults(final DataStoreFactorySpi format, final Map<String, Object> params) {
if (format == null)
return;
for (final Param param : format.getParametersInfo()) {
if (param.required && "program".equals(param.getLevel())) {
if (!params.containsKey(param.key)) {
params.put(param.key, param.sample);
}
}
}
}
示例10: setFormat
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
/**
* Setter for the format.
*
* @param format
* the format to set.
*/
public void setFormat(final DataStoreFactorySpi format) {
if (this.format == format) {
return;
}
if (connectionParameters.isEmpty()) {
fillInDefaults(format, connectionParameters);
}
if (dataStorePage != null) {
dataStorePage.setFormat(format);
}
}
示例11: createControl
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
public void createControl( Composite parent ) {
Composite mainComposite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
mainComposite.setLayout(gridLayout);
List<DataStoreFactorySpi> factoryList = new ArrayList<DataStoreFactorySpi>();
for( Iterator<DataStoreFactorySpi> iter = DataStoreFinder.getAvailableDataStores(); iter.hasNext(); ) {
factoryList.add(iter.next());
}
TableViewer viewer = new TableViewer(mainComposite);
GridData viewerGD = new GridData(SWT.FILL, SWT.FILL, true, false);
viewer.getTable().setLayoutData(viewerGD);
viewer.addSelectionChangedListener(this);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new LabelProvider(){
public String getText( Object element ) {
if (element instanceof DataStoreFactorySpi) {
DataStoreFactorySpi factory = (DataStoreFactorySpi) element;
return factory.getDisplayName();
}
return super.getText(element);
}
});
viewer.setInput(factoryList.toArray());
setControl(mainComposite);
canFlip = false;
}
示例12: selectionChanged
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
public void selectionChanged( SelectionChangedEvent event ) {
ISelection selection = event.getSelection();
if (selection instanceof StructuredSelection) {
StructuredSelection sel = (StructuredSelection) selection;
Object selObj = sel.getFirstElement();
if (selObj instanceof DataStoreFactorySpi) {
selectedFactory = (DataStoreFactorySpi) selObj;
}
}
if (selectedFactory != null) {
canFlip = true;
}
getWizard().getContainer().updateButtons();
}
示例13: initStore
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
private synchronized void initStore() {
final String requestDataStoreName = (String) dataStoreParams
.get(DSID_PROP_NAME);
if (requestDataStoreName != null
&& !requestDataStoreName.equals(dataStoreName)
&& dataStore != null) {
dataStore.dispose();
dataStore = null;
}
if (dataStore == null) {
final Map<String, Serializable> params = dataStoreParams;
for (Iterator<?> i = DataStoreFinder.getAvailableDataStores(); i
.hasNext();) {
DataStoreFactorySpi factory = (DataStoreFactorySpi) i.next();
try {
if (factory.canProcess(params)) {
this.dataStore = factory.createDataStore(params);
if (!dataStore.getNames().contains(
this.featureType.getName())) {
dataStore.createSchema(this.featureType);
}
dataStoreName = (String) params.get(DSID_PROP_NAME);
return;
}
} catch (Throwable warning) {
LOGGER.warning(factory.getDisplayName() + " failed:"
+ warning);
warning.printStackTrace();
}
}
}
}
示例14: testFactory
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
@Test
public void testFactory() throws IOException {
assertTrue(new ElasticDataStoreFactory().isAvailable());
scanForPlugins();
Map<String,Serializable> map = new HashMap<>();
map.put(ElasticDataStoreFactory.HOSTNAME.key, "localhost");
map.put(ElasticDataStoreFactory.HOSTPORT.key, PORT);
map.put(ElasticDataStoreFactory.INDEX_NAME.key, "sample");
Iterator<DataStoreFactorySpi> ps = getAvailableDataSources();
ElasticDataStoreFactory fac;
while (ps.hasNext()) {
fac = (ElasticDataStoreFactory) ps.next();
try {
if (fac.canProcess(map)) {
source = fac.createDataStore(map);
}
} catch (Throwable t) {
LOGGER.log(Level.WARNING, "Could not acquire " + fac.getDescription() + ":" + t, t);
}
}
assertNotNull(source);
assertTrue(source instanceof ElasticDataStore);
}
示例15: connect
import org.geotools.data.DataStoreFactorySpi; //导入依赖的package包/类
private void connect(DataStoreFactorySpi format) throws Exception {
JDataStoreWizard wizard = new JDataStoreWizard(format);
int result = wizard.showModalDialog();
if (result == JWizard.FINISH) {
Map<String, Object> connectionParameters = wizard.getConnectionParameters();
dataStore = DataStoreFinder.getDataStore(connectionParameters);
if (dataStore == null) {
JOptionPane.showMessageDialog(null, "Could not connect - check parameters");
}
updateUI();
}
}