ENTAXY-480 release version 1.8.3
This commit is contained in:
@ -0,0 +1,61 @@
|
||||
[#ftl attributes={"generated.type":"blueprint.fragment"}]
|
||||
[#--
|
||||
|
||||
~~~~~~licensing~~~~~~
|
||||
file-adapter
|
||||
==========
|
||||
Copyright (C) 2020 - 2023 EmDev LLC
|
||||
==========
|
||||
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.
|
||||
~~~~~~/licensing~~~~~~
|
||||
|
||||
--]
|
||||
|
||||
<!-- <service interface="org.apache.camel.Component" ref="[=objectId]">
|
||||
<service-properties>
|
||||
<entry key="connection.name" value="[=objectId]"/>
|
||||
</service-properties>
|
||||
</service> -->
|
||||
|
||||
[#if properties??]
|
||||
[#if properties.ext_createResourceProvider??]
|
||||
[#if properties.ext_createResourceProvider]
|
||||
<!-- RESOURCE PROVIDER BEAN -->
|
||||
<bean id="[=objectId].resourceProvider" class="ru.entaxy.esb.resources.provider.FileResourceProvider">
|
||||
<property name="protocol" value="[=objectId]" />
|
||||
<property name="rootDirectory" value="[=properties.rootDirectory]" />
|
||||
</bean>
|
||||
|
||||
<service interface="ru.entaxy.esb.resources.EntaxyResourceProvider" ref="[=objectId].resourceProvider">
|
||||
<service-properties>
|
||||
<entry key="connection.name" value="[=objectId]"/>
|
||||
<entry key="protocol" value="[=objectId]"/>
|
||||
</service-properties>
|
||||
</service>
|
||||
[/#if]
|
||||
[/#if]
|
||||
[/#if]
|
||||
|
||||
<bean id="[=objectId]" class="ru.entaxy.platform.adapter.file.ExtendedFileComponent">
|
||||
[#if properties??]
|
||||
[#list properties as key, value]
|
||||
[#if !key?starts_with("##") && !key?starts_with("__") && !key?starts_with("ext_")] [#-- we skip additional properties --]
|
||||
[#if key?starts_with("file_")] [#-- we add parent component properties --]
|
||||
<property name="[=key[5..]]" value="[=value]"/>
|
||||
[#else]
|
||||
<property name="[=key]" value="[=value]"/>
|
||||
[/#if]
|
||||
[/#if]
|
||||
[/#list]
|
||||
[/#if]
|
||||
</bean>
|
@ -0,0 +1,24 @@
|
||||
[#ftl attributes={"generated.type":"blueprint.fragment"}]
|
||||
[#--
|
||||
|
||||
~~~~~~licensing~~~~~~
|
||||
file-adapter
|
||||
==========
|
||||
Copyright (C) 2020 - 2023 EmDev LLC
|
||||
==========
|
||||
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.
|
||||
~~~~~~/licensing~~~~~~
|
||||
|
||||
--]
|
||||
<reference id="[=objectId]" interface="org.apache.camel.Component"
|
||||
filter="(connection.name=[=objectId])"/>
|
@ -0,0 +1,64 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* generator-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.base.generator.template.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.url.AbstractURLStreamHandlerService;
|
||||
import org.osgi.service.url.URLStreamHandlerService;
|
||||
|
||||
import ru.entaxy.base.generator.template.Template;
|
||||
import ru.entaxy.base.generator.template.TemplateService;
|
||||
|
||||
@Component(service = URLStreamHandlerService.class, property = "url.handler.protocol=templates", immediate = true)
|
||||
public class TemplateServiceURLResolver extends AbstractURLStreamHandlerService {
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
TemplateService templateService;
|
||||
|
||||
@Override
|
||||
public URLConnection openConnection(URL url) throws IOException {
|
||||
String templateId = url.toString();
|
||||
templateId = templateId.replace("templates:", "");
|
||||
templateId = templateId.replace("/", ".");
|
||||
|
||||
Template template = templateService.getTemplateById(templateId);
|
||||
if (template == null) {
|
||||
// we'll try without file extension
|
||||
int index = templateId.lastIndexOf(".");
|
||||
if (index>0)
|
||||
templateId = templateId.substring(0, index);
|
||||
template = templateService.getTemplateById(templateId);
|
||||
}
|
||||
|
||||
if (template == null)
|
||||
return null;
|
||||
|
||||
String templateUrl = template.getTemplateLocation().toString() + template.getTemplateFullName();
|
||||
URL resultUrl = new URL(templateUrl);
|
||||
return resultUrl.openConnection();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,336 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-factory
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.base.objects.factory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory.CONFIGURATION.DIRECTIVES;
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory.CONFIGURATION.DIRECTIVES.OVERRIDE_MODE;
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory.FieldInfo;
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory.OutputInfo;
|
||||
import ru.entaxy.platform.base.objects.factory.Importer.ImportInfo;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.JSONUtils;
|
||||
|
||||
public class EntaxyFactoryUtils {
|
||||
|
||||
public static final String PROP_HIERARCHY = "hierarchy";
|
||||
|
||||
public static Gson gson = new Gson();
|
||||
|
||||
public static String getEffectiveJson(EntaxyFactory factory) {
|
||||
JsonObject result = new JsonObject();
|
||||
|
||||
// factory
|
||||
JsonObject factoryData = new JsonObject();
|
||||
factoryData.addProperty(EntaxyFactory.CONFIGURATION.FACTORY.ID, factory.getId());
|
||||
factoryData.addProperty(EntaxyFactory.CONFIGURATION.FACTORY.TYPE, factory.getType());
|
||||
factoryData.addProperty(EntaxyFactory.CONFIGURATION.FACTORY.CATEGORY, factory.getCategory());
|
||||
factoryData.addProperty(EntaxyFactory.CONFIGURATION.FACTORY.LABEL, factory.getLabel());
|
||||
factoryData.addProperty(EntaxyFactory.CONFIGURATION.FACTORY.DESCRIPTION, factory.getDescription());
|
||||
result.add(EntaxyFactory.CONFIGURATION.FACTORY_SECTION_NAME, factoryData);
|
||||
|
||||
// typed data
|
||||
String type = factory.getType();
|
||||
JsonElement typeData = gson.toJsonTree(factory.getTypeInfo());
|
||||
result.add(type, typeData);
|
||||
|
||||
// fields
|
||||
JsonObject fieldsData = new JsonObject();
|
||||
for (FieldInfo fi: factory.getFields()) {
|
||||
fieldsData.add(fi.getName(), fi.getJsonOrigin());
|
||||
}
|
||||
result.add(EntaxyFactory.CONFIGURATION.FIELDS_SECTION_NAME, fieldsData);
|
||||
|
||||
// outputs
|
||||
JsonObject outputsData = new JsonObject();
|
||||
for (OutputInfo oi: factory.getOutputs()) {
|
||||
JsonObject outputData = new JsonObject();
|
||||
outputData.addProperty(EntaxyFactory.CONFIGURATION.OUTPUTS.ATTRIBUTES.IS_DEFAULT, oi.isDefault());
|
||||
outputData.addProperty(EntaxyFactory.CONFIGURATION.OUTPUTS.ATTRIBUTES.GENERATOR, oi.getGenerator());
|
||||
outputData.add(EntaxyFactory.CONFIGURATION.OUTPUTS.ATTRIBUTES.SCOPES
|
||||
, gson.toJsonTree(oi.getScopes()));
|
||||
if (oi.getConfig() != null)
|
||||
outputData.add(EntaxyFactory.CONFIGURATION.OUTPUTS.ATTRIBUTES.CONFIG
|
||||
, gson.toJsonTree(oi.getConfig()));
|
||||
JsonObject outputFields = new JsonObject();
|
||||
for (FieldInfo fi: oi.getFields()) {
|
||||
outputFields.add(fi.getName(), fi.getJsonOrigin());
|
||||
}
|
||||
outputData.add(EntaxyFactory.CONFIGURATION.OUTPUTS.ATTRIBUTES.FIELDS, outputFields);
|
||||
outputsData.add(oi.getType(), outputData);
|
||||
}
|
||||
result.add(EntaxyFactory.CONFIGURATION.OUTPUTS_SECTION_NAME, outputsData);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static JsonObject cleanJson(JsonObject origin) {
|
||||
JsonObject result = origin.deepCopy();
|
||||
|
||||
cleanObject(result, EntaxyFactory.CONFIGURATION.DIRECTIVES.getAllDirectives());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void cleanObject(JsonObject origin, Set<String> toRemove) {
|
||||
for (String name: toRemove)
|
||||
origin.remove(name);
|
||||
for (Entry<String, JsonElement> entry: origin.entrySet())
|
||||
if (entry.getValue().isJsonObject())
|
||||
cleanObject(entry.getValue().getAsJsonObject(), toRemove);
|
||||
}
|
||||
|
||||
public static interface FactoryConfigurationStorage {
|
||||
JsonObject getConfiguration(String factoryId);
|
||||
}
|
||||
|
||||
public static JsonObject calculateEffectiveJson(JsonObject origin, FactoryConfigurationStorage storage) {
|
||||
JsonObject originCopy = origin.deepCopy();
|
||||
JsonObject result = originCopy;
|
||||
JsonObject error = new JsonObject();
|
||||
JsonObject errorData = new JsonObject();
|
||||
JsonArray errorReqs = new JsonArray();
|
||||
|
||||
error.add("#CALC_ERROR", errorData);
|
||||
errorData.add("#REQS", errorReqs);
|
||||
|
||||
// process imports in originCopy
|
||||
|
||||
Importer importer = new Importer(originCopy);
|
||||
List<ImportInfo> imports = importer.findImports();
|
||||
if (!imports.isEmpty()) {
|
||||
final Map<String, JsonObject> factoryJsonMap = new HashMap<>();
|
||||
imports.stream()
|
||||
.forEach(imp->
|
||||
imp.importDescriptors.stream()
|
||||
.filter(id->CommonUtils.isValid(id.factoryId))
|
||||
.forEach(id->factoryJsonMap.put(id.factoryId, null))
|
||||
);
|
||||
boolean inconsistent = false;
|
||||
for (String factoryId: factoryJsonMap.keySet()) {
|
||||
JsonObject factoryJson;
|
||||
if ("#".equals(factoryId))
|
||||
factoryJson = origin;
|
||||
else
|
||||
factoryJson = storage.getConfiguration(factoryId);
|
||||
if (factoryJson == null) {
|
||||
inconsistent = true;
|
||||
errorReqs.add(factoryId);
|
||||
} else {
|
||||
factoryJsonMap.put(factoryId, factoryJson);
|
||||
}
|
||||
|
||||
}
|
||||
if (inconsistent)
|
||||
return error;
|
||||
|
||||
importer.addImportedSources(factoryJsonMap);
|
||||
importer.processImports(imports);
|
||||
|
||||
}
|
||||
|
||||
// process inheritance
|
||||
String parent = getParentFromJson(origin);
|
||||
if (CommonUtils.isValid(parent)) {
|
||||
JsonObject parentObject = storage.getConfiguration(parent);
|
||||
if (parentObject == null) {
|
||||
errorReqs.add(parent);
|
||||
return error;
|
||||
}
|
||||
result = parentObject.deepCopy();
|
||||
prepareTypeInfo(result, originCopy);
|
||||
processObjectOverriding(result, originCopy, OVERRIDE_MODE.UPDATE);
|
||||
} else {
|
||||
result = originCopy;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void prepareTypeInfo(JsonObject parent, JsonObject child) {
|
||||
JsonElement parentTypeE = JSONUtils.findElement(parent, "factory.type");
|
||||
JsonElement childTypeE = JSONUtils.findElement(child, "factory.type");
|
||||
String parentType = "";
|
||||
String childType = "";
|
||||
if ((parentTypeE!=null) && parentTypeE.isJsonPrimitive())
|
||||
parentType = parentTypeE.getAsString();
|
||||
if ((childTypeE!=null) && childTypeE.isJsonPrimitive())
|
||||
childType = childTypeE.getAsString();
|
||||
|
||||
JsonObject parentProperties = getTypeProperties(parent);
|
||||
JsonObject childProperties = getTypeProperties(child);
|
||||
if (childProperties==null)
|
||||
return;
|
||||
if (!parentType.equals(childType) && CommonUtils.isValid(childType)) {
|
||||
// copy parent type info with child type
|
||||
parent.add(childType, getTypeProperties(parent).deepCopy());
|
||||
}
|
||||
JsonElement parentHierarchy = JSONUtils.findElement(parentProperties, PROP_HIERARCHY);
|
||||
JsonArray childHierarchy = new JsonArray();
|
||||
if ((parentHierarchy != null) && parentHierarchy.isJsonArray()) {
|
||||
childHierarchy.addAll(parentHierarchy.getAsJsonArray());
|
||||
}
|
||||
childHierarchy.add(JSONUtils.findElement(parent, "factory.id"));
|
||||
childProperties.add(PROP_HIERARCHY, childHierarchy);
|
||||
}
|
||||
|
||||
public static JsonObject resolveVariants(JsonObject root) {
|
||||
JsonObject result = root.deepCopy();
|
||||
processObjectVariants(result, root);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void processObjectVariants(JsonObject currentObject, JsonObject root) {
|
||||
JsonObject variants = getVariants(currentObject);
|
||||
if (variants != null) {
|
||||
String property = variants.has("property")
|
||||
?variants.get("property").getAsString()
|
||||
:"";
|
||||
if (CommonUtils.isValid(property)) {
|
||||
JsonObject values = (variants.has("values") && variants.get("values").isJsonObject())
|
||||
?variants.get("values").getAsJsonObject()
|
||||
:null;
|
||||
if (values != null) {
|
||||
JsonObject typeProperties = getTypeProperties(root);
|
||||
JsonElement je = JSONUtils.findElement(typeProperties, property);
|
||||
if (je != null) {
|
||||
String value = je.getAsString();
|
||||
if (values.has(value) && values.get(value).isJsonObject()) {
|
||||
JsonObject variant = values.get(value).getAsJsonObject();
|
||||
for (Entry<String, JsonElement> entry: variant.entrySet()) {
|
||||
currentObject.remove(entry.getKey());
|
||||
currentObject.add(entry.getKey(), entry.getValue().deepCopy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
currentObject.remove(DIRECTIVES.VARIANTS);
|
||||
}
|
||||
for (Entry<String, JsonElement> entry: currentObject.entrySet()) {
|
||||
if (entry.getValue().isJsonObject())
|
||||
processObjectVariants(entry.getValue().getAsJsonObject(), root);
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonObject getVariants(JsonObject currentObject) {
|
||||
if (currentObject.has(DIRECTIVES.VARIANTS) && currentObject.get(DIRECTIVES.VARIANTS).isJsonObject())
|
||||
return currentObject.get(DIRECTIVES.VARIANTS).getAsJsonObject();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JsonObject getTypeProperties(JsonObject currentObject) {
|
||||
JsonElement type = JSONUtils.findElement(currentObject, "factory.type");
|
||||
if (type == null)
|
||||
return new JsonObject();
|
||||
String typeValue = type.getAsString();
|
||||
if (!CommonUtils.isValid(typeValue))
|
||||
return new JsonObject();
|
||||
JsonElement typeProperties = JSONUtils.findElement(currentObject, typeValue);
|
||||
if (typeProperties.isJsonObject())
|
||||
return typeProperties.getAsJsonObject();
|
||||
return new JsonObject();
|
||||
}
|
||||
|
||||
public static String getParentFromJson(JsonObject jsonObject) {
|
||||
if (!jsonObject.has(EntaxyFactory.CONFIGURATION.FACTORY_SECTION_NAME))
|
||||
return null;
|
||||
JsonObject fs = jsonObject.get(EntaxyFactory.CONFIGURATION.FACTORY_SECTION_NAME).getAsJsonObject();
|
||||
if (fs.has(EntaxyFactory.CONFIGURATION.FACTORY.PARENT))
|
||||
return fs.get(EntaxyFactory.CONFIGURATION.FACTORY.PARENT).getAsString();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void processObjectOverriding(JsonObject currentObject, JsonObject newObject, OVERRIDE_MODE defaultMode) {
|
||||
|
||||
OVERRIDE_MODE mode = getOverrideMode(currentObject, defaultMode);
|
||||
|
||||
if (OVERRIDE_MODE.IGNORE.equals(mode))
|
||||
return;
|
||||
|
||||
if (OVERRIDE_MODE.REPLACE.equals(mode)) {
|
||||
Set<String> set = new HashSet<String>(currentObject.keySet());
|
||||
for (String entry: set)
|
||||
currentObject.remove(entry);
|
||||
for (Entry<String, JsonElement> entry: newObject.entrySet())
|
||||
currentObject.add(entry.getKey(), entry.getValue().deepCopy());
|
||||
return;
|
||||
}
|
||||
|
||||
if (OVERRIDE_MODE.APPEND.equals(mode)) {
|
||||
for (Entry<String, JsonElement> entry: newObject.entrySet())
|
||||
if (!currentObject.has(entry.getKey()))
|
||||
currentObject.add(entry.getKey(), entry.getValue().deepCopy());
|
||||
return;
|
||||
}
|
||||
|
||||
if (OVERRIDE_MODE.UPDATE.equals(mode)) {
|
||||
|
||||
|
||||
// update existing
|
||||
Set<String> set = new HashSet<String>(currentObject.keySet());
|
||||
for (String key: set) {
|
||||
if (newObject.has(key)) {
|
||||
JsonElement currentElement = currentObject.get(key);
|
||||
JsonElement newElement = newObject.get(key);
|
||||
if (currentElement.isJsonObject() && newElement.isJsonObject()) {
|
||||
processObjectOverriding(currentElement.getAsJsonObject(), newElement.getAsJsonObject(), mode);
|
||||
} else {
|
||||
currentObject.remove(key);
|
||||
currentObject.add(key, newElement.deepCopy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add new
|
||||
for (Entry<String, JsonElement> entry: newObject.entrySet())
|
||||
if (!currentObject.has(entry.getKey()))
|
||||
currentObject.add(entry.getKey(), entry.getValue().deepCopy());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static EntaxyFactory.CONFIGURATION.DIRECTIVES.OVERRIDE_MODE getOverrideMode(JsonObject object, OVERRIDE_MODE defaultMode) {
|
||||
OVERRIDE_MODE result = defaultMode;
|
||||
if (object.has(EntaxyFactory.CONFIGURATION.DIRECTIVES.OVERRIDE)) {
|
||||
try {
|
||||
OVERRIDE_MODE mode = OVERRIDE_MODE.valueOfLabel(object.get(EntaxyFactory.CONFIGURATION.DIRECTIVES.OVERRIDE).getAsString());
|
||||
if (mode != null)
|
||||
result = mode;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,382 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-factory
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.base.objects.factory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory.CONFIGURATION.DIRECTIVES.OVERRIDE_MODE;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.JSONUtils;
|
||||
|
||||
public class Importer {
|
||||
|
||||
protected JsonObject origin;
|
||||
|
||||
protected Map<String, JsonObject> importedSources = new HashMap<>();
|
||||
|
||||
public Importer(JsonObject origin) {
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public List<ImportInfo> findImports(){
|
||||
return findImports(this.origin);
|
||||
}
|
||||
|
||||
public List<ImportInfo> findImports(JsonObject object) {
|
||||
List<ImportInfo> result = new ArrayList<>();
|
||||
if (object.has(EntaxyFactory.CONFIGURATION.DIRECTIVES.IMPORT))
|
||||
result.add(new ImportInfo(object));
|
||||
for (Entry<String, JsonElement> entry: object.entrySet())
|
||||
if (entry.getValue().isJsonObject())
|
||||
result.addAll(findImports(entry.getValue().getAsJsonObject()));
|
||||
return result;
|
||||
}
|
||||
|
||||
public void processImports(List<ImportInfo> imports) {
|
||||
for (ImportInfo ii: imports) {
|
||||
JsonObject newData = new JsonObject();
|
||||
for (ImportDescriptor id: ii.importDescriptors) {
|
||||
|
||||
JsonObject imported = importedSources.get(id.factoryId);
|
||||
if (imported == null)
|
||||
continue;
|
||||
|
||||
JsonElement je = JSONUtils.findElement(imported, id.location);
|
||||
if ((je==null) || !je.isJsonObject())
|
||||
continue;
|
||||
|
||||
Filter f;
|
||||
if (id.origin.has("filter"))
|
||||
f = CompositeFilter.create(id.origin.get("filter"));
|
||||
else
|
||||
f = new NullFilter();
|
||||
|
||||
List<Entry<String, JsonElement>> filteredList = je.getAsJsonObject().entrySet()
|
||||
.stream()
|
||||
.filter(e->f.isAccepted(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
JsonObject idResult = new JsonObject();
|
||||
|
||||
for (Entry<String, JsonElement> entry: filteredList)
|
||||
idResult.add(id.prefix + entry.getKey(), entry.getValue());
|
||||
|
||||
EntaxyFactoryUtils.processObjectOverriding(
|
||||
newData
|
||||
, idResult
|
||||
, OVERRIDE_MODE.UPDATE);
|
||||
}
|
||||
|
||||
JsonObject current = ii.owner.deepCopy();
|
||||
current.remove(EntaxyFactory.CONFIGURATION.DIRECTIVES.IMPORT);
|
||||
EntaxyFactoryUtils.processObjectOverriding(newData, current, OVERRIDE_MODE.UPDATE);
|
||||
Set<String> keys = new HashSet<>(ii.owner.keySet());
|
||||
for (String key: keys)
|
||||
ii.owner.remove(key);
|
||||
for (Entry<String, JsonElement> entry: newData.entrySet())
|
||||
ii.owner.add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// INTERNAL CLASSES
|
||||
|
||||
public static abstract class Filter {
|
||||
|
||||
public static final String ATTRIBUTE_KEY = "$key";
|
||||
public static final String ATTRIBUTE_VALUE = "$value";
|
||||
|
||||
abstract public boolean isAccepted(String key, JsonElement value);
|
||||
|
||||
}
|
||||
|
||||
public static class CompositeFilter extends Filter {
|
||||
|
||||
List<Filter> filters = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean isAccepted(String key, JsonElement value) {
|
||||
for (Filter f: filters)
|
||||
if (!f.isAccepted(key, value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Filter create(JsonElement object) {
|
||||
|
||||
if (!object.isJsonObject())
|
||||
return new NullFilter();
|
||||
|
||||
final CompositeFilter filter = new CompositeFilter();
|
||||
|
||||
if (object.getAsJsonObject().has(ContainsFilter.FILTER_NAME)) {
|
||||
JsonElement je = object.getAsJsonObject().get(ContainsFilter.FILTER_NAME);
|
||||
if (je.isJsonArray())
|
||||
je.getAsJsonArray().forEach(e->filter.filters.add(new ContainsFilter(e)));
|
||||
}
|
||||
|
||||
if (object.getAsJsonObject().has(ContainedFilter.FILTER_NAME)) {
|
||||
JsonElement je = object.getAsJsonObject().get(ContainedFilter.FILTER_NAME);
|
||||
if (je.isJsonArray())
|
||||
je.getAsJsonArray().forEach(e->filter.filters.add(new ContainedFilter(e)));
|
||||
}
|
||||
|
||||
return filter;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class NullFilter extends Filter {
|
||||
|
||||
@Override
|
||||
public boolean isAccepted(String key, JsonElement value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static abstract class CommonFilter extends Filter {
|
||||
|
||||
String attribute = null;
|
||||
List<String> values = new ArrayList<>();
|
||||
|
||||
boolean isInversed = false;
|
||||
|
||||
protected CommonFilter(JsonElement element) {
|
||||
if (!element.isJsonObject())
|
||||
return;
|
||||
JsonObject jo = element.getAsJsonObject();
|
||||
if (jo.has("inverse"))
|
||||
this.isInversed = jo.get("inverse").getAsBoolean();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isAccepted(String key, JsonElement value) {
|
||||
if (isInversed)
|
||||
return !calculateAccepted(key, value);
|
||||
else
|
||||
return calculateAccepted(key, value);
|
||||
}
|
||||
|
||||
protected abstract boolean calculateAccepted(String key, JsonElement value);
|
||||
|
||||
}
|
||||
|
||||
public static class ContainedFilter extends CommonFilter {
|
||||
|
||||
public static final String FILTER_NAME = "contained";
|
||||
|
||||
public ContainedFilter(JsonElement element) {
|
||||
super(element);
|
||||
if (!element.isJsonObject())
|
||||
return;
|
||||
JsonObject jo = element.getAsJsonObject();
|
||||
if (jo.has("attribute"))
|
||||
this.attribute = jo.get("attribute").getAsString();
|
||||
if (jo.has("values")) {
|
||||
if (jo.get("values").isJsonPrimitive())
|
||||
values.add(jo.get("values").getAsString());
|
||||
if (jo.get("values").isJsonArray())
|
||||
jo.get("values").getAsJsonArray().forEach(v->values.add(v.getAsString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean calculateAccepted(String key, JsonElement value) {
|
||||
if (values.isEmpty())
|
||||
return true;
|
||||
String testValue = "";
|
||||
if (ATTRIBUTE_KEY.equals(attribute))
|
||||
testValue = key;
|
||||
else if (ATTRIBUTE_VALUE.equals(attribute))
|
||||
testValue = value.getAsString();
|
||||
else {
|
||||
if (value.isJsonObject()) {
|
||||
JsonObject jo = value.getAsJsonObject();
|
||||
if (jo.has(attribute))
|
||||
testValue = jo.get(attribute).getAsString();
|
||||
}
|
||||
}
|
||||
if (!CommonUtils.isValid(testValue))
|
||||
return false;
|
||||
|
||||
return values.contains(testValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class ContainsFilter extends CommonFilter {
|
||||
|
||||
public static final String FILTER_NAME = "contains";
|
||||
|
||||
String separator = ",";
|
||||
boolean containsAll = false;
|
||||
|
||||
public ContainsFilter(JsonElement element) {
|
||||
super(element);
|
||||
if (!element.isJsonObject())
|
||||
return;
|
||||
JsonObject jo = element.getAsJsonObject();
|
||||
if (jo.has("attribute"))
|
||||
this.attribute = jo.get("attribute").getAsString();
|
||||
if (jo.has("separator"))
|
||||
this.separator = jo.get("separator").getAsString();
|
||||
if (jo.has("containsAll"))
|
||||
this.containsAll = jo.get("containsAll").getAsBoolean();
|
||||
if (jo.has("values")) {
|
||||
if (jo.get("values").isJsonPrimitive())
|
||||
values.add(jo.get("values").getAsString());
|
||||
if (jo.get("values").isJsonArray())
|
||||
jo.get("values").getAsJsonArray().forEach(v->values.add(v.getAsString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean calculateAccepted(String key, JsonElement value) {
|
||||
if (values.isEmpty())
|
||||
return true;
|
||||
|
||||
String testValue = "";
|
||||
List<String> vals = new ArrayList<>();
|
||||
|
||||
if (ATTRIBUTE_KEY.equals(attribute))
|
||||
testValue = key;
|
||||
else if (ATTRIBUTE_VALUE.equals(attribute))
|
||||
testValue = value.getAsString();
|
||||
else {
|
||||
if (value.isJsonObject()) {
|
||||
JsonObject jo = value.getAsJsonObject();
|
||||
if (jo.has(attribute)) {
|
||||
JsonElement je = jo.get(attribute);
|
||||
if (je.isJsonPrimitive()) {
|
||||
testValue = jo.get(attribute).getAsString();
|
||||
|
||||
if (!CommonUtils.isValid(testValue))
|
||||
return false;
|
||||
|
||||
String[] arr = testValue.split(separator);
|
||||
vals = Arrays.asList(arr).stream().map(s->s.trim()).collect(Collectors.toList());
|
||||
} else if (je.isJsonArray()) {
|
||||
JsonArray ja = je.getAsJsonArray();
|
||||
for (int i=0; i<ja.size(); i++) {
|
||||
if (ja.get(i) == null)
|
||||
continue;
|
||||
if (ja.get(i).isJsonPrimitive())
|
||||
vals.add(ja.get(i).getAsString());
|
||||
else
|
||||
vals.add(ja.get(i).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (containsAll)
|
||||
return vals.containsAll(values);
|
||||
|
||||
for (String v: values)
|
||||
if (vals.contains(v))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ImportInfo {
|
||||
public JsonObject owner;
|
||||
public JsonElement importElement;
|
||||
public List<ImportDescriptor> importDescriptors = new ArrayList<>();
|
||||
|
||||
public ImportInfo(JsonObject owner) {
|
||||
|
||||
List<JsonObject> foundImports = new ArrayList<>();
|
||||
|
||||
this.owner = owner;
|
||||
this.importElement = owner.get(EntaxyFactory.CONFIGURATION.DIRECTIVES.IMPORT);
|
||||
if (this.importElement.isJsonObject()) {
|
||||
foundImports.add(this.importElement.getAsJsonObject());
|
||||
}
|
||||
if (this.importElement.isJsonArray()) {
|
||||
JsonArray ja = this.importElement.getAsJsonArray();
|
||||
for (int i=0; i<ja.size(); i++) {
|
||||
JsonElement je = ja.get(i);
|
||||
if (je.isJsonObject())
|
||||
foundImports.add(je.getAsJsonObject());
|
||||
}
|
||||
}
|
||||
for (JsonObject jo: foundImports)
|
||||
this.importDescriptors.add(new ImportDescriptor(jo));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ImportDescriptor {
|
||||
public String factoryId;
|
||||
public String location = "";
|
||||
public String prefix = "";
|
||||
public JsonObject origin;
|
||||
|
||||
public ImportDescriptor (JsonObject origin) {
|
||||
this.origin = origin;
|
||||
if (this.origin.has("sourceFactoryId"))
|
||||
this.factoryId = this.origin.get("sourceFactoryId").getAsString();
|
||||
if (this.origin.has("location"))
|
||||
this.location = this.origin.get("location").getAsString();
|
||||
if (this.origin.has("prefix"))
|
||||
this.prefix = this.origin.get("prefix").getAsString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// S & G
|
||||
|
||||
public Map<String, JsonObject> getImportedSources() {
|
||||
return importedSources;
|
||||
}
|
||||
|
||||
public void addImportedSources(Map<String, JsonObject> importedSources) {
|
||||
this.importedSources.putAll(importedSources);
|
||||
}
|
||||
|
||||
public void setImportedSources(Map<String, JsonObject> importedSources) {
|
||||
this.importedSources = importedSources;
|
||||
}
|
||||
|
||||
public JsonObject getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-factory
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.base.objects.factory.exceptions;
|
||||
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory;
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactoryException;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class NotSupportedForAbstractFactory extends EntaxyFactoryException {
|
||||
|
||||
private static String getMessage(EntaxyFactory factory, String operation) {
|
||||
return String.format("Factory [%s] is abstract, operation [%s] not supported"
|
||||
, factory.getId()
|
||||
, operation);
|
||||
}
|
||||
|
||||
public NotSupportedForAbstractFactory(EntaxyFactory factory, String operation) {
|
||||
super(getMessage(factory, operation));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-factory
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.base.objects.factory.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory;
|
||||
|
||||
@Component (service = FactoryRegistry.class, immediate = true)
|
||||
public class FactoryRegistry {
|
||||
|
||||
protected Map<String, String> inheritance = new HashMap<>();
|
||||
protected Map<String, EntaxyFactory> factories = new HashMap<>();
|
||||
|
||||
@Reference (unbind = "removeFactory", cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC
|
||||
, policyOption = ReferencePolicyOption.GREEDY)
|
||||
public void addFactory(EntaxyFactory entaxyFactory) {
|
||||
this.inheritance.put(entaxyFactory.getId(), entaxyFactory.getParent());
|
||||
this.factories.put(entaxyFactory.getId(), entaxyFactory);
|
||||
}
|
||||
|
||||
public void removeFactory(EntaxyFactory entaxyFactory) {
|
||||
this.inheritance.remove(entaxyFactory.getId());
|
||||
this.factories.remove(entaxyFactory.getId());
|
||||
}
|
||||
|
||||
public String getParentFactory(String factoryId) {
|
||||
return this.inheritance.get(factoryId);
|
||||
}
|
||||
}
|
@ -0,0 +1,448 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-factory
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.base.objects.factory.tracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Dictionary;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactory;
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactoryUtils;
|
||||
import ru.entaxy.platform.base.objects.factory.EntaxyFactoryUtils.FactoryConfigurationStorage;
|
||||
import ru.entaxy.platform.base.objects.factory.impl.DefaultFactory;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.JSONUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.BundleTrackerCustomizerListener;
|
||||
|
||||
@Component (service = TrackedFactoryManager.class, immediate = true)
|
||||
public class TrackedFactoryManager implements BundleTrackerCustomizerListener<List<TrackedFactory>>, FactoryConfigurationStorage {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TrackedFactoryManager.class);
|
||||
|
||||
public static final String DEFAULT_PARENT = "base-object";
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected Map<String, TrackedManagedFactory> managedFactories = new HashMap<>();
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void added(List<TrackedFactory> managedObject) {
|
||||
if (managedObject == null) {
|
||||
log.debug("managedObject is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// List<TrackedManagedFactory> processedFactories = new ArrayList<>();
|
||||
|
||||
FactoryProcessor factoryProcessor = new FactoryProcessor();
|
||||
|
||||
for (TrackedFactory tf: managedObject) {
|
||||
log.info("Added factory: " + tf.getId());
|
||||
|
||||
TrackedManagedFactory tmf = new TrackedManagedFactory(tf);
|
||||
|
||||
// if we already have factory with the same id
|
||||
if (managedFactories.containsKey(tmf.factoryId)) {
|
||||
tmf = managedFactories.get(tmf.factoryId);
|
||||
|
||||
// remove old service
|
||||
tmf.deactivate();
|
||||
|
||||
tmf.reload(tf);
|
||||
|
||||
tmf.detachParent();
|
||||
|
||||
tmf.detachRequirements();
|
||||
|
||||
} else {
|
||||
this.managedFactories.put(tmf.factoryId, tmf);
|
||||
}
|
||||
|
||||
if (!CommonUtils.isValid(tmf.parent) && !DEFAULT_PARENT.equalsIgnoreCase(tmf.factoryId)) {
|
||||
tmf.setParent(DEFAULT_PARENT);
|
||||
}
|
||||
|
||||
if (CommonUtils.isValid(tmf.parent)) {
|
||||
TrackedManagedFactory parentF = managedFactories.get(tmf.parent);
|
||||
if ((parentF != null) && parentF.isActive) {
|
||||
tmf.attachParent(parentF);
|
||||
} else {
|
||||
tmf.addWaiting(tmf.parent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (String requirement: tmf.requirements) {
|
||||
TrackedManagedFactory req = managedFactories.get(requirement);
|
||||
if (req != null)
|
||||
tmf.attachRequirement(req);
|
||||
else
|
||||
tmf.addWaiting(requirement);
|
||||
}
|
||||
|
||||
if (tmf.isConsistent())
|
||||
factoryProcessor.add(tmf);
|
||||
|
||||
|
||||
|
||||
// processedFactories.add(tmf);
|
||||
|
||||
}
|
||||
|
||||
factoryProcessor.process();
|
||||
|
||||
/*log.debug("Added factory: " + tf.getId());
|
||||
if (TrackedFactory.trackedFactoriesMap.containsKey(tf.getId())) {
|
||||
TrackedFactory.trackedFactoriesMap.get(tf.getId()).unregister();
|
||||
}
|
||||
DefaultFactory defaultFactory = new DefaultFactory();
|
||||
defaultFactory.setFactoryId(tf.getId());
|
||||
defaultFactory.configure(tf.getConfigString());
|
||||
if (defaultFactory.isValid()) {
|
||||
|
||||
tf.setId(defaultFactory.getFactoryId());
|
||||
|
||||
Dictionary<String, String> props = new Hashtable<String, String>();
|
||||
props.put(EntaxyFactory.SERVICE.PROP_ID, defaultFactory.getFactoryId());
|
||||
props.put(EntaxyFactory.SERVICE.PROP_TYPE, defaultFactory.getFactoryType());
|
||||
props.put(EntaxyFactory.SERVICE.PROP_ORIGIN_BUNDLE, tf.getBundle().getBundleId()+"");
|
||||
|
||||
tf.setServiceRegistration(
|
||||
this.bundleContext.registerService(EntaxyFactory.class, defaultFactory, props)
|
||||
);
|
||||
|
||||
TrackedFactory.trackedFactoriesMap.put(tf.getId(), tf);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modified(List<TrackedFactory> managedObject) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removed(List<TrackedFactory> managedObject) {
|
||||
if (managedObject == null)
|
||||
return;
|
||||
for (TrackedFactory tf: managedObject) {
|
||||
try {
|
||||
tf.getServiceRegistration().unregister();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
TrackedFactory.trackedFactoriesMap.remove(tf.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// implement FactoryConfigurationStorage
|
||||
public JsonObject getConfiguration(String factoryId) {
|
||||
TrackedManagedFactory tmf = managedFactories.get(factoryId);
|
||||
if (tmf == null)
|
||||
return null;
|
||||
if (!tmf.isConsistent() || !tmf.isUpToDate)
|
||||
return null;
|
||||
return tmf.jsonEffective;
|
||||
};
|
||||
|
||||
public List<TrackedManagedFactory> getManagedFactories() {
|
||||
return new ArrayList<>(this.managedFactories.values());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected class FactoryProcessor {
|
||||
|
||||
List<TrackedManagedFactory> factories = new ArrayList<>();
|
||||
|
||||
public void add(TrackedManagedFactory tmf) {
|
||||
synchronized (factories) {
|
||||
if (!factories.contains(tmf))
|
||||
factories.add(tmf);
|
||||
}
|
||||
}
|
||||
|
||||
public void process() {
|
||||
while (!this.factories.isEmpty()) {
|
||||
|
||||
List<TrackedManagedFactory> processed = new ArrayList<>();
|
||||
List<TrackedManagedFactory> toProcess = new ArrayList<>();
|
||||
|
||||
for (TrackedManagedFactory currentFactory: factories) {
|
||||
processFactory(currentFactory);
|
||||
if (currentFactory.isActive) {
|
||||
processed.add(currentFactory);
|
||||
|
||||
for (TrackedManagedFactory waitingFactory: managedFactories.values())
|
||||
if (waitingFactory.isWaiting(currentFactory.factoryId)) {
|
||||
waitingFactory.stopWaiting(currentFactory.factoryId);
|
||||
if (waitingFactory.isConsistent())
|
||||
toProcess.add(waitingFactory);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (processed.isEmpty())
|
||||
break;
|
||||
|
||||
for (TrackedManagedFactory tmf: toProcess)
|
||||
if (!this.factories.contains(tmf))
|
||||
this.factories.add(tmf);
|
||||
|
||||
for (TrackedManagedFactory tmf: processed)
|
||||
this.factories.remove(tmf);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void processFactory(TrackedManagedFactory factory) {
|
||||
if (factory.isConsistent()) {
|
||||
|
||||
if (CommonUtils.isValid(factory.parent)) {
|
||||
TrackedManagedFactory parentF = managedFactories.get(factory.parent);
|
||||
factory.attachParent(parentF);
|
||||
}
|
||||
|
||||
for (String requirement: factory.requirements) {
|
||||
TrackedManagedFactory req = managedFactories.get(requirement);
|
||||
factory.attachRequirement(req);
|
||||
}
|
||||
|
||||
|
||||
JsonObject effective = EntaxyFactoryUtils.calculateEffectiveJson(factory.jsonOrigin, TrackedFactoryManager.this);
|
||||
if (!effective.has("#CALC_ERROR")) {
|
||||
|
||||
factory.jsonEffective = effective.deepCopy();
|
||||
JsonObject jsonFinal = EntaxyFactoryUtils.resolveVariants(effective);
|
||||
|
||||
// create factory
|
||||
factory.updateConfiguration(jsonFinal);
|
||||
if (createFactory(factory)) {
|
||||
factory.activate();
|
||||
}
|
||||
|
||||
} else {
|
||||
JsonObject jo = effective.get("#CALC_ERROR").getAsJsonObject();
|
||||
if (jo.has("#REQS")) {
|
||||
JsonArray ja = jo.get("#REQS").getAsJsonArray();
|
||||
|
||||
final TrackedManagedFactory tmfF = factory;
|
||||
ja.forEach(item->tmfF.addRequirement(item.getAsString()));
|
||||
ja.forEach(item->tmfF.addWaiting(item.getAsString()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info("Factory {} is inconsistent, waiting for: {}"
|
||||
, factory.factoryId
|
||||
, factory.waitingFor.stream().collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean createFactory(TrackedManagedFactory factory) {
|
||||
DefaultFactory defaultFactory = new DefaultFactory();
|
||||
defaultFactory.setFactoryId(factory.factoryId);
|
||||
defaultFactory.configure(EntaxyFactoryUtils.cleanJson(factory.jsonFinal));
|
||||
if (defaultFactory.isValid()) {
|
||||
|
||||
// to ensure id is correct
|
||||
factory.trackedFactory.setId(defaultFactory.getId());
|
||||
|
||||
Dictionary<String, String> props = new Hashtable<String, String>();
|
||||
props.put(EntaxyFactory.SERVICE.PROP_ID, defaultFactory.getId());
|
||||
props.put(EntaxyFactory.SERVICE.PROP_TYPE, defaultFactory.getType());
|
||||
props.put(EntaxyFactory.SERVICE.PROP_ORIGIN_BUNDLE, factory.trackedFactory.getBundle().getBundleId()+"");
|
||||
|
||||
factory.trackedFactory.setServiceRegistration(
|
||||
TrackedFactoryManager.this.bundleContext.registerService(EntaxyFactory.class, defaultFactory, props)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class TrackedManagedFactory {
|
||||
|
||||
TrackedFactory trackedFactory;
|
||||
|
||||
// original JSON description
|
||||
JsonObject jsonOrigin;
|
||||
// JSON with inheritance & imports resolved
|
||||
JsonObject jsonEffective;
|
||||
// JSON with VARIANTS resolved
|
||||
JsonObject jsonFinal;
|
||||
|
||||
JsonObject jsonFactorySection = null;
|
||||
|
||||
public String factoryId = null;
|
||||
public String parent = null;
|
||||
|
||||
public List<String> requirements = new ArrayList<>();
|
||||
|
||||
TrackedManagedFactory parentFactory = null;
|
||||
List<TrackedManagedFactory> requiredFactories = new ArrayList<>();
|
||||
List<TrackedManagedFactory> affectedFactories = new ArrayList<>();
|
||||
|
||||
public List<String> waitingFor = new ArrayList<>();
|
||||
|
||||
public boolean isUpToDate = false;
|
||||
|
||||
public boolean isActive = false;
|
||||
|
||||
public TrackedManagedFactory(TrackedFactory factory) {
|
||||
reload(factory);
|
||||
}
|
||||
|
||||
public void reload(TrackedFactory factory) {
|
||||
this.jsonFactorySection = null;
|
||||
this.factoryId = null;
|
||||
this.parent = null;
|
||||
this.requirements = new ArrayList<>();
|
||||
this.trackedFactory = factory;
|
||||
this.waitingFor.clear();
|
||||
this.jsonOrigin = JSONUtils.getJsonRootObject(this.trackedFactory.getConfigString());
|
||||
if (this.jsonOrigin.has(EntaxyFactory.CONFIGURATION.FACTORY_SECTION_NAME)) {
|
||||
this.jsonFactorySection = this.jsonOrigin.get(EntaxyFactory.CONFIGURATION.FACTORY_SECTION_NAME).getAsJsonObject();
|
||||
if (this.jsonFactorySection.has(EntaxyFactory.CONFIGURATION.FACTORY.ID))
|
||||
this.factoryId = this.jsonFactorySection.get(EntaxyFactory.CONFIGURATION.FACTORY.ID).getAsString();
|
||||
if (this.jsonFactorySection.has(EntaxyFactory.CONFIGURATION.FACTORY.PARENT))
|
||||
this.parent = this.jsonFactorySection.get(EntaxyFactory.CONFIGURATION.FACTORY.PARENT).getAsString();
|
||||
if (this.jsonFactorySection.has(EntaxyFactory.CONFIGURATION.FACTORY.REQUIRES)) {
|
||||
JsonElement je = this.jsonFactorySection.get(EntaxyFactory.CONFIGURATION.FACTORY.REQUIRES);
|
||||
if (je.isJsonArray()) {
|
||||
JsonArray ja = je.getAsJsonArray();
|
||||
ja.forEach(item->this.requirements.add(item.getAsString()));
|
||||
}
|
||||
if (je.isJsonPrimitive()) {
|
||||
this.requirements.add(je.getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return CommonUtils.isValid(factoryId);
|
||||
}
|
||||
|
||||
public void setParent(String parentValue) {
|
||||
this.parent = parentValue;
|
||||
JsonObject fs = this.jsonOrigin.get(EntaxyFactory.CONFIGURATION.FACTORY_SECTION_NAME).getAsJsonObject();
|
||||
fs.remove(EntaxyFactory.CONFIGURATION.FACTORY.PARENT);
|
||||
fs.addProperty(EntaxyFactory.CONFIGURATION.FACTORY.PARENT, parentValue);
|
||||
}
|
||||
|
||||
public void attachParent(TrackedManagedFactory parentTmf) {
|
||||
if (this.parentFactory != parentTmf)
|
||||
detachParent();
|
||||
this.parentFactory = parentTmf;
|
||||
parentTmf.attachAffected(this);
|
||||
this.isUpToDate = false;
|
||||
}
|
||||
|
||||
public void detachParent() {
|
||||
if (this.parentFactory != null) {
|
||||
this.parentFactory.detachAffected(this);
|
||||
this.parentFactory = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addRequirement(String req) {
|
||||
if (!this.requirements.contains(req))
|
||||
this.requirements.add(req);
|
||||
}
|
||||
public void attachRequirement(TrackedManagedFactory requiredTmf) {
|
||||
if (!this.requiredFactories.contains(requiredTmf))
|
||||
this.requiredFactories.add(requiredTmf);
|
||||
requiredTmf.attachAffected(this);
|
||||
}
|
||||
public void detachRequirements() {
|
||||
for (TrackedManagedFactory tmf: requiredFactories)
|
||||
tmf.detachAffected(this);
|
||||
this.requiredFactories.clear();
|
||||
}
|
||||
|
||||
public void attachAffected(TrackedManagedFactory affectedTmf) {
|
||||
if (!this.affectedFactories.contains(affectedTmf))
|
||||
this.affectedFactories.add(affectedTmf);
|
||||
}
|
||||
public void detachAffected(TrackedManagedFactory affectedTmf) {
|
||||
this.affectedFactories.remove(affectedTmf);
|
||||
}
|
||||
|
||||
public void addWaiting(String waitFactoryId) {
|
||||
if (!this.waitingFor.contains(waitFactoryId))
|
||||
this.waitingFor.add(waitFactoryId);
|
||||
}
|
||||
public boolean isWaiting(String waitFactoryId) {
|
||||
return this.waitingFor.contains(waitFactoryId);
|
||||
}
|
||||
public void stopWaiting(String waitFactoryId) {
|
||||
this.waitingFor.remove(waitFactoryId);
|
||||
}
|
||||
|
||||
public boolean isConsistent() {
|
||||
return this.waitingFor.isEmpty();
|
||||
}
|
||||
|
||||
public void updateConfiguration(JsonObject jsonObject) {
|
||||
this.jsonFinal = jsonObject.deepCopy();
|
||||
this.isUpToDate = true;
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
this.isActive = true;
|
||||
}
|
||||
|
||||
public void deactivate() {
|
||||
this.trackedFactory.unregister();
|
||||
this.isActive = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
"factory": {
|
||||
"id": "base-object",
|
||||
"type": "entaxy.runtime.object",
|
||||
"description": "Abstract object",
|
||||
"isAbstract": true,
|
||||
"label": "object"
|
||||
},
|
||||
"entaxy.runtime.object": {
|
||||
"isEntaxyObject": true
|
||||
},
|
||||
"fields": {
|
||||
"objectId": {
|
||||
"displayName": "Object Id",
|
||||
"type": "String",
|
||||
"required": true,
|
||||
"immutable": true,
|
||||
"addToOutput": "*"
|
||||
},
|
||||
"##publish": {
|
||||
"type": "Map",
|
||||
"required": true,
|
||||
"isHidden": true,
|
||||
"configurable": false,
|
||||
"defaultValue":{
|
||||
"name": {
|
||||
"@CALCULATED": {
|
||||
"expression": "${objectId}",
|
||||
"lazy": true
|
||||
}
|
||||
},
|
||||
"factory": {
|
||||
"@CALCULATED": {
|
||||
"expression": "${factoryId}",
|
||||
"lazy": false
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"@CALCULATED": {
|
||||
"expression": "${#FACTORY#.factory.label}",
|
||||
"lazy": false
|
||||
}
|
||||
},
|
||||
"scope": {
|
||||
"@CALCULATED": {
|
||||
"expression": "${scope}",
|
||||
"allowObjects": false,
|
||||
"lazy": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputs": {
|
||||
"init": {
|
||||
"isDefault": true,
|
||||
"fields": {
|
||||
"##publish": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
201
platform/runtime/base/resources/LICENSE.txt
Normal file
201
platform/runtime/base/resources/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
18
platform/runtime/base/resources/pom.xml
Normal file
18
platform/runtime/base/resources/pom.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime</groupId>
|
||||
<artifactId>base</artifactId>
|
||||
<version>1.8.3</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>ENTAXY :: PLATFORM :: BASE :: RESOURCES</name>
|
||||
<description>ENTAXY :: PLATFORM :: BASE :: RESOURCES</description>
|
||||
<modules>
|
||||
<module>resources-api</module>
|
||||
<module>resources-service</module>
|
||||
<module>resources-management</module>
|
||||
</modules>
|
||||
</project>
|
201
platform/runtime/base/resources/resources-api/LICENSE.txt
Normal file
201
platform/runtime/base/resources/resources-api/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
18
platform/runtime/base/resources/resources-api/pom.xml
Normal file
18
platform/runtime/base/resources/resources-api/pom.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<version>1.8.3</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-api</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ENTAXY :: PLATFORM :: BASE :: RESOURCES :: API</name>
|
||||
<description>ENTAXY :: PLATFORM :: BASE :: RESOURCES :: API</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>ru.entaxy.esb.resources</bundle.osgi.export.pkg>
|
||||
</properties>
|
||||
|
||||
</project>
|
@ -0,0 +1,36 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
public interface EntaxyResource {
|
||||
|
||||
InputStream getInputStream();
|
||||
String getAsString();
|
||||
|
||||
void save(InputStream inputStream);
|
||||
|
||||
boolean exists();
|
||||
|
||||
URL getLocation();
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources;
|
||||
|
||||
public interface EntaxyResourceProvider {
|
||||
|
||||
String getProtocol();
|
||||
EntaxyResource getResource(String location);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources;
|
||||
|
||||
public interface EntaxyResourceService {
|
||||
|
||||
EntaxyResource getResource(String location);
|
||||
|
||||
}
|
201
platform/runtime/base/resources/resources-management/LICENSE.txt
Normal file
201
platform/runtime/base/resources/resources-management/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
33
platform/runtime/base/resources/resources-management/pom.xml
Normal file
33
platform/runtime/base/resources/resources-management/pom.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<version>1.8.3</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-management</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ENTAXY :: PLATFORM :: BASE :: RESOURCES :: MANAGEMENT</name>
|
||||
<description>ENTAXY :: PLATFORM :: BASE :: RESOURCES :: MANAGEMENT</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>ru.entaxy.esb.resources.management</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>ru.entaxy.esb.resources.management.impl</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>management-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.management;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface EntaxyResourceServiceMBean {
|
||||
|
||||
public static final String RESOURCE_SERVICE_KEY = "category";
|
||||
|
||||
public static final String RESOURCE_SERVICE_KEY_VALUE = "resource";
|
||||
|
||||
@Operation(desc = "Get resource from location")
|
||||
String getResource(
|
||||
@Parameter(name = "location", desc = "Location of the resource") String location) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.management.impl;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.annotations.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
import ru.entaxy.esb.resources.management.EntaxyResourceServiceMBean;
|
||||
|
||||
import javax.management.DynamicMBean;
|
||||
import javax.management.MBeanRegistration;
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
@Component(service = { EntaxyResourceServiceMBean.class, DynamicMBean.class, MBeanRegistration.class }, property = {
|
||||
ManagementCore.JMX_OBJECTNAME + "=" + ManagementCore.Q_RUNTIME_S + "," + EntaxyResourceServiceMBean.RESOURCE_SERVICE_KEY + "="
|
||||
+ EntaxyResourceServiceMBean.RESOURCE_SERVICE_KEY_VALUE }, scope = ServiceScope.SINGLETON, immediate = true)
|
||||
public class EntaxyResourceServiceMBeanImpl extends AnnotatedMBean<EntaxyResourceServiceMBean>
|
||||
implements EntaxyResourceServiceMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EntaxyResourceServiceMBeanImpl.class);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY
|
||||
, service = EntaxyResourceService.class
|
||||
, collectionType = CollectionType.SERVICE)
|
||||
EntaxyResourceService entaxyResourceService;
|
||||
|
||||
public EntaxyResourceServiceMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(EntaxyResourceServiceMBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResource(String location) throws Exception {
|
||||
return entaxyResourceService.getResource(location).getAsString();
|
||||
}
|
||||
}
|
201
platform/runtime/base/resources/resources-service/LICENSE.txt
Normal file
201
platform/runtime/base/resources/resources-service/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
49
platform/runtime/base/resources/resources-service/pom.xml
Normal file
49
platform/runtime/base/resources/resources-service/pom.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<version>1.8.3</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-service</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ENTAXY :: PLATFORM :: BASE :: RESOURCES :: SERVICE</name>
|
||||
<description>ENTAXY :: PLATFORM :: BASE :: RESOURCES :: SERVICE</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>ru.entaxy.esb.resources.provider</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>
|
||||
ru.entaxy.esb.resources.impl,
|
||||
ru.entaxy.esb.resources.tracker
|
||||
</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.scr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>base-support</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,80 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.resources.EntaxyResource;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceProvider;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
|
||||
@Component (service = EntaxyResourceService.class, immediate = true)
|
||||
public class EntaxyResourceServiceImpl implements EntaxyResourceService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EntaxyResourceServiceImpl.class);
|
||||
|
||||
protected Map<String, EntaxyResourceProvider> providers = new HashMap<>();
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MULTIPLE, collectionType = CollectionType.SERVICE
|
||||
, policyOption = ReferencePolicyOption.GREEDY
|
||||
, unbind = "removeProvider")
|
||||
public void addProvider(EntaxyResourceProvider provider) {
|
||||
synchronized (providers) {
|
||||
this.providers.put(provider.getProtocol(), provider);
|
||||
log.info("RESOURCE PROVIDER ADDED: " + provider.getProtocol());
|
||||
}
|
||||
}
|
||||
|
||||
public void removeProvider(EntaxyResourceProvider provider) {
|
||||
synchronized (providers) {
|
||||
this.providers.remove(provider.getProtocol());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EntaxyResource getResource(String location) {
|
||||
if (!CommonUtils.isValid(location))
|
||||
return null;
|
||||
int index = location.indexOf(":");
|
||||
if (index>0) {
|
||||
String protocol = location.substring(0, index);
|
||||
String path = location.substring(index+1);
|
||||
if (providers.containsKey(protocol)) {
|
||||
return providers.get(protocol).getResource(path);
|
||||
} else {
|
||||
log.warn("Provider not found for protocol: [{}]", protocol);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.provider;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.FileLock;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.resources.EntaxyResource;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceProvider;
|
||||
|
||||
public class FileResourceProvider implements EntaxyResourceProvider {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FileResourceProvider.class);
|
||||
|
||||
private String protocol;
|
||||
private String rootDirectory;
|
||||
private File root;
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getRootDirectory() {
|
||||
return rootDirectory;
|
||||
}
|
||||
|
||||
public void setRootDirectory(String rootDirectory) {
|
||||
this.rootDirectory = rootDirectory;
|
||||
root = new File(this.rootDirectory);
|
||||
if (!root.exists())
|
||||
root.mkdirs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntaxyResource getResource(String location) {
|
||||
Path rootPath = root.toPath();
|
||||
Path targetPath = Paths.get(rootPath.toString(), location);
|
||||
log.debug("TARGET PATH :: " + targetPath.toAbsolutePath().toString());
|
||||
File targetFile = new File(targetPath.toAbsolutePath().toString());
|
||||
log.debug("TARGET FILE :: " + targetFile.getAbsolutePath());
|
||||
return new FileResource(targetFile);
|
||||
}
|
||||
|
||||
public static class FileResource implements EntaxyResource {
|
||||
|
||||
private File file;
|
||||
|
||||
public FileResource(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
if (!exists())
|
||||
return null;
|
||||
try {
|
||||
return file.toURI().toURL().openStream();
|
||||
} catch (IOException e) {
|
||||
FileResourceProvider.log.error("Error getting resource", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsString() {
|
||||
if (!exists())
|
||||
return null;
|
||||
try {
|
||||
return IOUtils.toString(getInputStream());
|
||||
} catch (IOException e) {
|
||||
FileResourceProvider.log.error("Error getting resource as string", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(InputStream inputStream) {
|
||||
if (!file.exists())
|
||||
try {
|
||||
log.debug("\nMAKE DIRS", file.getParentFile().getAbsolutePath());
|
||||
file.getParentFile().mkdirs();
|
||||
// file.createNewFile();
|
||||
} catch (Exception e1) {
|
||||
log.error("Error creating resource", e1);
|
||||
}
|
||||
try (FileOutputStream fileOutputStream = new FileOutputStream(file)){
|
||||
FileChannel channel = fileOutputStream.getChannel();
|
||||
FileLock lock = channel.lock();
|
||||
byte[] bytes = IOUtils.toByteArray(inputStream);
|
||||
channel.write(ByteBuffer.wrap(bytes));
|
||||
|
||||
lock.release();
|
||||
channel.close();
|
||||
IOUtils.closeQuietly(fileOutputStream);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error saving resource", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getLocation() {
|
||||
try {
|
||||
return this.file.toURI().toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.tracker;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
|
||||
public class ResourceProvider {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ResourceProvider.class);
|
||||
|
||||
public static final String RESOURCE_PATH = "/ru/entaxy/resource";
|
||||
|
||||
protected Bundle bundle;
|
||||
|
||||
protected Map<String, List<ResourceDescriptor>> resources = new HashMap<>();
|
||||
|
||||
public ResourceProvider(Bundle bundle) {
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
public Map<String, List<ResourceDescriptor>> getResources(){
|
||||
if (!resources.isEmpty())
|
||||
return resources;
|
||||
|
||||
Enumeration<URL> foundEntries = bundle.findEntries(ResourceProvider.RESOURCE_PATH, "*.*", true);
|
||||
while (foundEntries.hasMoreElements()) {
|
||||
URL entry = foundEntries.nextElement();
|
||||
log.debug("FOUND :: " + entry.toString());
|
||||
if (entry.toString().endsWith("/")) {
|
||||
log.debug(":: .. is folder");
|
||||
continue;
|
||||
}
|
||||
String localPath = entry.toString();
|
||||
localPath = localPath.substring(localPath.indexOf(ResourceProvider.RESOURCE_PATH) + ResourceProvider.RESOURCE_PATH.length() + 1);
|
||||
|
||||
String resourceName = localPath.substring(localPath.lastIndexOf("/")+1);
|
||||
|
||||
String path = localPath.lastIndexOf("/")>=0
|
||||
?localPath.substring(0, localPath.lastIndexOf("/"))
|
||||
:"";
|
||||
int splitIndex = path.indexOf("/");
|
||||
String protocol = splitIndex>0
|
||||
?path.substring(0, splitIndex)
|
||||
:"";
|
||||
|
||||
if (splitIndex>0)
|
||||
path = path.substring(splitIndex+1);
|
||||
|
||||
if (!CommonUtils.isValid(protocol) || !CommonUtils.isValid(resourceName))
|
||||
continue;
|
||||
|
||||
if (!resources.containsKey(protocol))
|
||||
resources.put(protocol, new ArrayList<>());
|
||||
|
||||
resources.get(protocol).add(new ResourceDescriptor(entry, path + "/" + resourceName));
|
||||
|
||||
}
|
||||
|
||||
return resources;
|
||||
|
||||
}
|
||||
|
||||
public static class ResourceDescriptor {
|
||||
|
||||
public URL url;
|
||||
public String location;
|
||||
|
||||
public ResourceDescriptor(URL url, String location) {
|
||||
this.url = url;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.tracker;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.UniformBundleTrackerCustomizer;
|
||||
|
||||
public class ResourceProviderCustomizer extends UniformBundleTrackerCustomizer<List<ResourceProvider>> {
|
||||
|
||||
@Override
|
||||
protected List<ResourceProvider> createManagedObject(Bundle bundle, BundleEvent event,
|
||||
Map<String, List<?>> filterResults) {
|
||||
return Collections.singletonList(new ResourceProvider(bundle));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.tracker;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.resources.EntaxyResource;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
import ru.entaxy.esb.resources.tracker.ResourceProvider.ResourceDescriptor;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.BundleTrackerCustomizerListener;
|
||||
|
||||
public class ResourceProviderCustomizerListener implements BundleTrackerCustomizerListener<List<ResourceProvider>> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ResourceProviderCustomizerListener.class);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected EntaxyResourceService entaxyResourceService;
|
||||
|
||||
public ResourceProviderCustomizerListener(BundleContext context, EntaxyResourceService service) {
|
||||
this.bundleContext = context;
|
||||
this.entaxyResourceService = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void added(List<ResourceProvider> managedObject) {
|
||||
for (ResourceProvider provider: managedObject) {
|
||||
Map<String, List<ResourceDescriptor>> resources = provider.getResources();
|
||||
String message = "";
|
||||
message += "\nFOUND RESOURCES";
|
||||
for (String protocol: resources.keySet()) {
|
||||
message += "\n\tPROTOCOL :: " + protocol;
|
||||
List<ResourceDescriptor> list = resources.get(protocol);
|
||||
for (ResourceDescriptor rd: list) {
|
||||
message += "\n\t\t :: " + rd.location + " | " + rd.url.toString();
|
||||
|
||||
EntaxyResource resource = entaxyResourceService.getResource(protocol + ":" + rd.location);
|
||||
if (resource == null) {
|
||||
message += "\n\t\t -> NULL";
|
||||
} else {
|
||||
try {
|
||||
resource.save(rd.url.openStream());
|
||||
message += "\n\t\t -> " + resource.getAsString();
|
||||
} catch (IOException e) {
|
||||
log.error("Error saving resource", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modified(List<ResourceProvider> managedObject) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removed(List<ResourceProvider> managedObject) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* 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.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.resources.tracker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.util.tracker.BundleTracker;
|
||||
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.BundleTrackerUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleHeaderFilter;
|
||||
|
||||
@Component
|
||||
public class TrackerManager {
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected BundleTracker<List<ResourceProvider>> providerTracker;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
EntaxyResourceService entaxyResourceService;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
providerTracker = BundleTrackerUtils.<List<ResourceProvider>>createBuilder()
|
||||
.addFilter(
|
||||
(new BundleHeaderFilter()).header("Entaxy-Resource-Provider")
|
||||
)
|
||||
.customizer(
|
||||
(new ResourceProviderCustomizer())
|
||||
.listener(new ResourceProviderCustomizerListener(bundleContext, entaxyResourceService))
|
||||
)
|
||||
.bundleState(Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED)
|
||||
.get();
|
||||
providerTracker.open(); }
|
||||
|
||||
}
|
54
platform/runtime/base/src/main/features/support.xml
Normal file
54
platform/runtime/base/src/main/features/support.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
base
|
||||
==========
|
||||
Copyright (C) 2020 - 2023 EmDev LLC
|
||||
==========
|
||||
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.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
|
||||
|
||||
<features name="entaxy-platform-base-support-${project.version}"
|
||||
xmlns="http://karaf.apache.org/xmlns/features/v1.3.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
|
||||
|
||||
<repository>mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features</repository>
|
||||
<repository>mvn:ru.entaxy.esb.underlying/entaxy-underlying-features/${project.version}/xml/features</repository>
|
||||
|
||||
<!-- legacy repo -->
|
||||
<repository>mvn:ru.entaxy.esb.system/system-parent/${project.version}/xml/basics</repository>
|
||||
|
||||
<feature name="base-support" version="${project.version}" start-level="70">
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base/base-support/${project.version}</bundle>
|
||||
</feature>
|
||||
|
||||
<feature name="resources" version="${project.version}" start-level="70">
|
||||
<feature version="${project.version}" dependency="true">base-support</feature>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.resources/resources-api/${project.version}</bundle>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.resources/resources-service/${project.version}</bundle>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.resources/resources-management/${project.version}</bundle>
|
||||
</feature>
|
||||
|
||||
<feature name="generator" version="${project.version}" start-level="70">
|
||||
<feature version="${project.version}" dependency="true">base-support</feature>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.connecting.generator/generator-api/${project.version}</bundle>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.connecting.generator/generator-factory/${project.version}</bundle>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.connecting.generator/template-service-shell/${project.version}</bundle>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.connecting.generator/ftl-generator/${project.version}</bundle>
|
||||
<bundle>mvn:ru.entaxy.esb.platform.runtime.base.connecting.generator/common-templates-collection/${project.version}</bundle>
|
||||
</feature>
|
||||
|
||||
</features>
|
Reference in New Issue
Block a user