Get the extension or create as needed

@param extensionName
extension name
@param tableName
table name
@param columnName
column name
@param definition
extension definition
@param scopeType
extension scope type
@return extension
345831
protected Extensions getOrCreate(String extensionName, String tableName,
			String columnName, String definition, ExtensionScopeType scopeType) {

		Extensions extension = get(extensionName, tableName, columnName);

		if (extension == null) {
			try {
				if (!extensionsDao.isTableExists()) {
					geoPackage.createExtensionsTable();
				}

				extension = new Extensions();
				extension.setTableName(tableName);
				extension.setColumnName(columnName);
				extension.setExtensionName(extensionName);
				extension.setDefinition(definition);
				extension.setScope(scopeType);

				extensionsDao.create(extension);
			} catch (SQLException e) {
				throw new GeoPackageException("Failed to create '"
						+ extensionName + "' extension for GeoPackage: "
						+ geoPackage.getName() + ", Table Name: " + tableName
						+ ", Column Name: " + columnName, e);
			}
		}

		return extension;
	}
555177
public static List<ScopeListExtension> findAll(Collection<? extends Extension> extensions)
    {
        List<ScopeListExtension> result = new ArrayList<ScopeListExtension>();
        for (Extension extension : extensions)
        {
            if (SCOPE_LIST_EXTENSION_ID == extension.getId())
                result.add((ScopeListExtension)extension);
        }
        return result;
    }
84281
@Override
    public ExtensionDef property(String name, String value) {
        extension.getOrCreate("property@name=" + name).attribute("name", name).text(value);
        return this;
    }
891195
@Override
    public Object create(Class<?> extensionClass) {
        log.debug("Create instance for extension '{}'", extensionClass.getName());
        try {
            return extensionClass.newInstance();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }

        return null;
    }
645185
@Override
    public ExtensionProcessor createExtensionProcessor(IServletContext webapp) throws Exception {
        ExtensionFactory delegate = this.delegate;
        if (delegate != null)
            return delegate.createExtensionProcessor(webapp);
        return null;
    }
1320585
public static String getExtension(String fileName) {
		if (fileName==null){
			return null;
		} else {
			int number=fileName.lastIndexOf('.');
			
			if (number>=0){
				return fileName.substring(number+1, fileName.length());
			} else {
				return null;
			}
		}		
	}
23812
public static String getExtension(String fileName) {
        if (fileName == null)
            return null;

        String[] tokens = split(fileName);
        if (tokens.length >= 2)
            return tokens[tokens.length - 1];

        return null;
    }
902355
public boolean has(String tableName, String columnName,
			GeometryType geometryType) {

		String extensionName = getExtensionName(geometryType);
		boolean exists = has(extensionName, tableName, columnName);

		return exists;
	}
977755
public CompletableFuture<String> getScope(final String scopeName) {
        Preconditions.checkNotNull(scopeName);
        return streamStore.getScopeConfiguration(scopeName);
    }
351772
public Extensions getOrCreate() {

		// Create the attributes table
		if (!geoPackage.isTable(TABLE_NAME)) {

			AttributesColumn propertyColumn = AttributesColumn.createColumn(1,
					COLUMN_PROPERTY, GeoPackageDataType.TEXT, true, null);
			AttributesColumn valueColumn = AttributesColumn.createColumn(2,
					COLUMN_VALUE, GeoPackageDataType.TEXT, false, null);

			List<AttributesColumn> additionalColumns = new ArrayList<>();
			additionalColumns.add(propertyColumn);
			additionalColumns.add(valueColumn);

			List<UserUniqueConstraint<AttributesColumn>> uniqueConstraints = new ArrayList<>();
			uniqueConstraints.add(new UserUniqueConstraint<AttributesColumn>(
					propertyColumn, valueColumn));

			geoPackage.createAttributesTableWithId(TABLE_NAME,
					additionalColumns, uniqueConstraints);
		}

		Extensions extension = getOrCreate(EXTENSION_NAME, TABLE_NAME, null,
				EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE);

		return extension;
	}
1030360
public Extensions getOrCreate(FeatureTable featureTable) {
		return getOrCreate(featureTable.getTableName(), featureTable
				.getGeometryColumn().getName());
	}
306454
public static String getExtensionName(GeometryType geometryType) {

		if (!isExtension(geometryType)) {
			throw new GeoPackageException(GeometryType.class.getSimpleName()
					+ " is not an extension: " + geometryType.getName());
		}

		if (!isGeoPackageExtension(geometryType)) {
			throw new GeoPackageException(
					GeometryType.class.getSimpleName()
							+ " is not a GeoPackage extension, User-Defined requires an author: "
							+ geometryType.getName());
		}

		String extensionName = GeoPackageConstants.GEO_PACKAGE_EXTENSION_AUTHOR
				+ Extensions.EXTENSION_NAME_DIVIDER
				+ GeoPackageConstants.GEOMETRY_EXTENSION_PREFIX
				+ Extensions.EXTENSION_NAME_DIVIDER + geometryType.getName();

		return extensionName;
	}
215474
private ExtensionHandler getExtensionHandler(LocalExtension localExtension) throws ComponentLookupException
    {
        return this.componentManager.getInstance(ExtensionHandler.class, localExtension.getType().toLowerCase());
    }
932300
protected boolean has(String extensionName, String tableName,
			String columnName) {
		Extensions extension = get(extensionName, tableName, columnName);
		return extension != null;
	}
710845
protected List<Extensions> getExtensions(String extensionName,
			String tableName) {

		List<Extensions> extensions = null;
		try {
			if (extensionsDao.isTableExists()) {
				extensions = extensionsDao.queryByExtension(extensionName,
						tableName);
			}
		} catch (SQLException e) {
			throw new GeoPackageException("Failed to query for '"
					+ extensionName + "' extension for GeoPackage: "
					+ geoPackage.getName() + ", Table Name: " + tableName, e);
		}
		return extensions;
	}
61008
public Extension get(String name) throws IOException {
        Extension obj = map.get(name);
        if (obj == null) {
            throw new IOException("No extension found with name " + name);
        }
        return (obj);
    }
726577
@Override
	public int update(Extensions extensions) throws SQLException {

		UpdateBuilder<Extensions, Void> ub = updateBuilder();
		ub.updateColumnValue(Extensions.COLUMN_DEFINITION,
				extensions.getDefinition());
		ub.updateColumnValue(Extensions.COLUMN_SCOPE, extensions.getScope()
				.getValue());

		setUniqueWhere(ub.where(), extensions.getExtensionName(), true,
				extensions.getTableName(), true, extensions.getColumnName());

		PreparedUpdate<Extensions> update = ub.prepare();
		int updated = update(update);

		return updated;
	}