remove left-over support for commercial variants from configuration editing tool
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
164763e13c
commit
4f59df2451
16 changed files with 34 additions and 633 deletions
|
@ -103,153 +103,6 @@ public class Config {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the release information from a file named RELEASEINFO located in
|
|
||||||
* the etc directory of the installation.
|
|
||||||
*
|
|
||||||
* @return true if the release information could be loaded, false otherwise.
|
|
||||||
*/
|
|
||||||
public boolean loadReleaseInfo(){
|
|
||||||
FileInputStream fis = null;
|
|
||||||
if (config == null){
|
|
||||||
config = new Properties ();
|
|
||||||
}
|
|
||||||
boolean result = true;
|
|
||||||
String homeDir = System.getenv("OSPL_HOME");
|
|
||||||
String separator = System.getProperty("file.separator");
|
|
||||||
File releaseFile = new File (homeDir + separator + "etc" + separator + "RELEASEINFO");
|
|
||||||
if(releaseFile.exists()) {
|
|
||||||
try {
|
|
||||||
fis = new FileInputStream(releaseFile);
|
|
||||||
config.load(fis);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
result = false;
|
|
||||||
} catch (IOException e) {
|
|
||||||
result = false;
|
|
||||||
} finally {
|
|
||||||
if (fis != null) {
|
|
||||||
try {
|
|
||||||
fis.close();
|
|
||||||
} catch (IOException ie) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we don't have a value for the version property then try
|
|
||||||
// to load the value from the development tree RELEASE file
|
|
||||||
String version = config.getProperty("PACKAGE_VERSION");
|
|
||||||
if (version == null) {
|
|
||||||
releaseFile = new File (homeDir + separator + "release_info" + separator + "RELEASE");
|
|
||||||
if(releaseFile.exists()) {
|
|
||||||
try {
|
|
||||||
fis = new FileInputStream(releaseFile);
|
|
||||||
config.load(fis);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
result = false;
|
|
||||||
} catch (IOException e) {
|
|
||||||
result = false;
|
|
||||||
} finally {
|
|
||||||
if (fis != null) {
|
|
||||||
try {
|
|
||||||
fis.close();
|
|
||||||
} catch (IOException ie) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!result){
|
|
||||||
config = null;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the default configuration. This located in the home directory of
|
|
||||||
* the user in the '.splice_tooling.properties' file.
|
|
||||||
*
|
|
||||||
* @return true if the default configuration could be loaded, false
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
public boolean loadDefault(){
|
|
||||||
String key, value;
|
|
||||||
boolean result = true;
|
|
||||||
String homeDir = System.getProperty("user.home");
|
|
||||||
String separator = System.getProperty("file.separator");
|
|
||||||
config = new Properties();
|
|
||||||
FileInputStream fis = null;
|
|
||||||
|
|
||||||
// Load the release information so that we have the PACKAGE_VERSION property.
|
|
||||||
result = loadReleaseInfo();
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
String version = config.getProperty("PACKAGE_VERSION");
|
|
||||||
if (version != null) {
|
|
||||||
version = version.replaceAll("\"", "");
|
|
||||||
version = new String ("." + version);
|
|
||||||
} else {
|
|
||||||
version = new String ("");
|
|
||||||
}
|
|
||||||
configFile = new File(homeDir + separator + ".ospl_tooling.properties" + version);
|
|
||||||
} else {
|
|
||||||
configFile = new File(homeDir + separator + ".ospl_tooling.properties");
|
|
||||||
// Reset the result flag.
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(configFile.exists())) {
|
|
||||||
try {
|
|
||||||
configFile.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
fis = new FileInputStream(configFile);
|
|
||||||
config.load(fis);
|
|
||||||
Properties newConfig = new Properties(config);
|
|
||||||
if(validator != null){
|
|
||||||
Iterator<Object> iter = config.keySet().iterator();
|
|
||||||
|
|
||||||
while(iter.hasNext()){
|
|
||||||
key = (String)iter.next();
|
|
||||||
value = config.getProperty(key);
|
|
||||||
value = validator.getValidatedValue(key, value);
|
|
||||||
|
|
||||||
if(value == null){
|
|
||||||
newConfig.remove(key);
|
|
||||||
} else {
|
|
||||||
newConfig.setProperty(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
config = newConfig;
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
result = false;
|
|
||||||
} catch (IOException e) {
|
|
||||||
result = false;
|
|
||||||
} finally {
|
|
||||||
if (fis != null) {
|
|
||||||
try {
|
|
||||||
fis.close();
|
|
||||||
} catch (IOException ie) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!result){
|
|
||||||
config = null;
|
|
||||||
configFile = null;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the configuration from the supplied URI.
|
* Loads the configuration from the supplied URI.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
|
|
||||||
*
|
|
||||||
* This program and the accompanying materials are made available under the
|
|
||||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
|
||||||
* v. 1.0 which is available at
|
|
||||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
|
||||||
*/
|
|
||||||
package org.eclipse.cyclonedds.common.util;
|
|
||||||
|
|
||||||
public class ConfigModeIntializer {
|
|
||||||
|
|
||||||
public static final String COMMUNITY = "COMMUNITY";
|
|
||||||
public static final String COMMERCIAL = "COMMERCIAL";
|
|
||||||
public static final int COMMUNITY_MODE = 1;
|
|
||||||
public static final int COMMERCIAL_MODE = 2;
|
|
||||||
public static final int COMMUNITY_MODE_FILE_OPEN = 3;
|
|
||||||
public static final int LITE_MODE = 4;
|
|
||||||
public static int CONFIGURATOR_MODE = COMMERCIAL_MODE;
|
|
||||||
|
|
||||||
public static void setMode(int mode) {
|
|
||||||
CONFIGURATOR_MODE = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMode() {
|
|
||||||
return CONFIGURATOR_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -48,14 +48,6 @@ public class Initializer {
|
||||||
if(args.length > 0){
|
if(args.length > 0){
|
||||||
Report.getInstance().writeInfoLog("Reading configuration from " + args[0] + ".");
|
Report.getInstance().writeInfoLog("Reading configuration from " + args[0] + ".");
|
||||||
result = Config.getInstance().load(args[0]);
|
result = Config.getInstance().load(args[0]);
|
||||||
|
|
||||||
if(!result){
|
|
||||||
Report.getInstance().writeInfoLog("Applying default configuration.");
|
|
||||||
result = Config.getInstance().loadDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
result = Config.getInstance().loadDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result){
|
if(!result){
|
||||||
|
|
|
@ -32,7 +32,6 @@ import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.common.util.Report;
|
import org.eclipse.cyclonedds.common.util.Report;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaAttribute;
|
import org.eclipse.cyclonedds.config.meta.MetaAttribute;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaConfiguration;
|
import org.eclipse.cyclonedds.config.meta.MetaConfiguration;
|
||||||
|
@ -100,161 +99,6 @@ public class DataConfiguration {
|
||||||
}
|
}
|
||||||
this.initExisting(repair);
|
this.initExisting(repair);
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
// The following code is document validation specific to OpenSplice
|
|
||||||
int currentMode = ConfigModeIntializer.CONFIGURATOR_MODE;
|
|
||||||
|
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE) {
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.COMMERCIAL_MODE);
|
|
||||||
}
|
|
||||||
/* correct service tags */
|
|
||||||
DataElement dataDomain = findDataElement(this.rootElement, "Domain");
|
|
||||||
ArrayList<DataElement> domainServices = new ArrayList<DataElement>();
|
|
||||||
/* collect all service tags */
|
|
||||||
for (DataNode dn : dataDomain.getChildren()) {
|
|
||||||
if (dn instanceof DataElement) {
|
|
||||||
if (dn.getNode().getNodeName().equals("Service")) {
|
|
||||||
domainServices.add((DataElement) dn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<DataElement> tmpServices = new ArrayList<DataElement>(services);
|
|
||||||
ArrayList<DataElement> tmpDomainServices = new ArrayList<DataElement>(domainServices);
|
|
||||||
ArrayList<MetaNode> comServices = new ArrayList<MetaNode>();
|
|
||||||
/* domain element is not a service */
|
|
||||||
tmpServices.remove(dataDomain);
|
|
||||||
|
|
||||||
for (DataElement de : domainServices) {
|
|
||||||
if (dataDomain != de) {
|
|
||||||
String domainserviceName = de.getNode().getAttributes().getNamedItem("name").getNodeValue();
|
|
||||||
for (DataElement del : services) {
|
|
||||||
Node node = del.getNode().getAttributes().getNamedItem("name");
|
|
||||||
if (node != null) {
|
|
||||||
String serviceName = node.getNodeValue();
|
|
||||||
if (serviceName.equals(domainserviceName)) {
|
|
||||||
tmpDomainServices.remove(de);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* tmpDomainServices now contains a list of services that are
|
|
||||||
* not in the configuration file but which are configured in the
|
|
||||||
* domain tag
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (DataElement de : tmpDomainServices) {
|
|
||||||
String serviceName = de.getNode().getAttributes().getNamedItem("name").getNodeValue();
|
|
||||||
MetaNode[] mn = ((MetaElement) this.getRootElement().getMetadata()).getChildren();
|
|
||||||
|
|
||||||
for (MetaNode m : mn) {
|
|
||||||
if (m instanceof MetaElement) {
|
|
||||||
MetaElement metaDomainService = findMetaElement((MetaElement) rootElement.getMetadata(),
|
|
||||||
"Service");
|
|
||||||
MetaElement maDomainCommand = findMetaElement(metaDomainService, "Command");
|
|
||||||
MetaAttribute maServiceName = findMetaAttribute((MetaElement) m, "name");
|
|
||||||
if (maServiceName != null && maDomainCommand != null) {
|
|
||||||
DataValue serviceNameValue = findDataValueforMetaValue(de, maServiceName.getValue());
|
|
||||||
|
|
||||||
DataValue domainCommandValue = findDataValueforMetaValue(de,
|
|
||||||
((MetaValue) maDomainCommand.getChildren()[0]));
|
|
||||||
String name = getServiceForCommand((String) domainCommandValue.getValue());
|
|
||||||
if (((MetaElement) m).getName().equals(name)) {
|
|
||||||
/* we got the service we need to add */
|
|
||||||
comServices.add(m);
|
|
||||||
DataNode dn = this.addNodeWithDependency(rootElement, m);
|
|
||||||
serviceNameValue = findDataValueforMetaValue((DataElement) dn, maServiceName
|
|
||||||
.getValue());
|
|
||||||
|
|
||||||
/* set name for service Element */
|
|
||||||
serviceNameValue.setValue(serviceName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (DataElement de : services) {
|
|
||||||
if (dataDomain != de) {
|
|
||||||
String serviceName = de.getNode().getAttributes().getNamedItem("name").getNodeValue();
|
|
||||||
for (DataElement del : domainServices) {
|
|
||||||
String domainserviceName = del.getNode().getAttributes().getNamedItem("name")
|
|
||||||
.getNodeValue();
|
|
||||||
if (serviceName.equals(domainserviceName)) {
|
|
||||||
/*
|
|
||||||
* found a match in both service and domain
|
|
||||||
* elements remove it from the tmp services
|
|
||||||
* object
|
|
||||||
*/
|
|
||||||
tmpServices.remove(de);
|
|
||||||
MetaAttribute maDomainName = findMetaAttribute((MetaElement) del.getMetadata(), "name");
|
|
||||||
DataValue domainNameValue = findDataValueforMetaValueInCurrentElement(del, maDomainName
|
|
||||||
.getValue());
|
|
||||||
this.serviceNames.add(domainNameValue);
|
|
||||||
|
|
||||||
MetaAttribute maServiceName = findMetaAttribute((MetaElement) de.getMetadata(), "name");
|
|
||||||
DataValue serviceNameValue = findDataValueforMetaValue(de, maServiceName.getValue());
|
|
||||||
this.serviceNames.add(serviceNameValue);
|
|
||||||
|
|
||||||
getServiceNames().add(serviceNameValue);
|
|
||||||
getServiceNames().add(domainNameValue);
|
|
||||||
|
|
||||||
/* set dependencies */
|
|
||||||
domainNameValue.addDataValueDependency(serviceNameValue);
|
|
||||||
serviceNameValue.addDataValueDependency(domainNameValue);
|
|
||||||
de.addDependency(del);
|
|
||||||
del.addDependency(de);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigModeIntializer.setMode(currentMode);
|
|
||||||
/*
|
|
||||||
* tmpServices now contains all services that are missing from
|
|
||||||
* the domain service element, we can add them now
|
|
||||||
*/
|
|
||||||
if ((!tmpDomainServices.isEmpty() || !tmpServices.isEmpty()) && !repair) {
|
|
||||||
if (!tmpDomainServices.isEmpty() && !tmpServices.isEmpty()) {
|
|
||||||
throw new DataException("There is/are " + tmpServices.size()
|
|
||||||
+ " service(s) that is/are not configured in the Domain tag and "
|
|
||||||
+ tmpDomainServices.size()
|
|
||||||
+ " service element(s) that do not match a configured service");
|
|
||||||
} else if (!tmpDomainServices.isEmpty()) {
|
|
||||||
throw new DataException("There are " + tmpDomainServices.size()
|
|
||||||
+ " service element(s) that do not match a configured service");
|
|
||||||
} else {
|
|
||||||
throw new DataException("There is/are " + tmpServices.size()
|
|
||||||
+ " service(s) that is/are not configured in the Domain tag");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tmpServices.isEmpty() && repair) {
|
|
||||||
for (DataElement de : tmpServices) {
|
|
||||||
String serviceName = de.getNode().getAttributes().getNamedItem("name").getNodeValue();
|
|
||||||
createDomainServiceForSerivce(de, de.getMetadata(), serviceName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* remove commerial items from xml tree in community mode */
|
|
||||||
for (MetaNode m : comServices) {
|
|
||||||
if (m.getVersion().equals(ConfigModeIntializer.COMMERCIAL)
|
|
||||||
&& (currentMode == ConfigModeIntializer.COMMUNITY_MODE || currentMode == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN)) {
|
|
||||||
NodeList nl = this.getDocument().getElementsByTagName(
|
|
||||||
((MetaElement) m).getName());
|
|
||||||
for (int i = 0; i < nl.getLength(); i++) {
|
|
||||||
Node child = nl.item(i);
|
|
||||||
if (child != null) {
|
|
||||||
child.getParentNode().removeChild(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (SAXException se) {
|
} catch (SAXException se) {
|
||||||
throw new DataException(se.getMessage());
|
throw new DataException(se.getMessage());
|
||||||
|
@ -352,9 +196,6 @@ public class DataConfiguration {
|
||||||
|
|
||||||
public void addNode(DataElement parent, MetaNode child) throws DataException {
|
public void addNode(DataElement parent, MetaNode child) throws DataException {
|
||||||
if((parent.getOwner().equals(this))){
|
if((parent.getOwner().equals(this))){
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN) {
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.COMMUNITY_MODE);
|
|
||||||
}
|
|
||||||
DataNode added = this.createDataForMeta(parent, child);
|
DataNode added = this.createDataForMeta(parent, child);
|
||||||
|
|
||||||
if(parent.equals(this.rootElement)){
|
if(parent.equals(this.rootElement)){
|
||||||
|
@ -372,9 +213,6 @@ public class DataConfiguration {
|
||||||
public DataNode addNodeWithDependency(DataElement parent, MetaNode child) throws DataException {
|
public DataNode addNodeWithDependency(DataElement parent, MetaNode child) throws DataException {
|
||||||
DataNode result = null;
|
DataNode result = null;
|
||||||
if ((parent.getOwner().equals(this))) {
|
if ((parent.getOwner().equals(this))) {
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN) {
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.COMMUNITY_MODE);
|
|
||||||
}
|
|
||||||
DataNode added = this.createDataForMeta(parent, child);
|
DataNode added = this.createDataForMeta(parent, child);
|
||||||
|
|
||||||
if (parent.equals(this.rootElement)) {
|
if (parent.equals(this.rootElement)) {
|
||||||
|
@ -432,11 +270,6 @@ public class DataConfiguration {
|
||||||
/* get the newly created domain element */
|
/* get the newly created domain element */
|
||||||
dataDomain = (DataElement) addNodeWithDependency(dataDomain, metaDomainService);
|
dataDomain = (DataElement) addNodeWithDependency(dataDomain, metaDomainService);
|
||||||
|
|
||||||
if (metaNode.getVersion().equals(ConfigModeIntializer.COMMERCIAL)
|
|
||||||
&& (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE || ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN)) {
|
|
||||||
commercialServices.add(dataDomain.getNode());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find name and command DataValue objects for the domain element
|
* find name and command DataValue objects for the domain element
|
||||||
*/
|
*/
|
||||||
|
@ -863,10 +696,6 @@ public class DataConfiguration {
|
||||||
throw new DataException("RootElement is 'null'.");
|
throw new DataException("RootElement is 'null'.");
|
||||||
}
|
}
|
||||||
this.document.appendChild(domElement);
|
this.document.appendChild(domElement);
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
domElement.setAttribute("version", Double.toString(this.metadata.getVersion()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.rootElement = new DataElement(metaElement, domElement);
|
this.rootElement = new DataElement(metaElement, domElement);
|
||||||
this.rootElement.setOwner(this);
|
this.rootElement.setOwner(this);
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cyclonedds.config.data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaAttribute;
|
import org.eclipse.cyclonedds.config.meta.MetaAttribute;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaElement;
|
import org.eclipse.cyclonedds.config.meta.MetaElement;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaNode;
|
import org.eclipse.cyclonedds.config.meta.MetaNode;
|
||||||
|
@ -82,10 +81,6 @@ public class DataElement extends DataNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nodeMeta instanceof MetaElement){
|
if(nodeMeta instanceof MetaElement){
|
||||||
if (nodeMeta.getVersion().equals(ConfigModeIntializer.COMMERCIAL)
|
|
||||||
&& (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE || ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN)) {
|
|
||||||
addToDOM = 0;
|
|
||||||
}
|
|
||||||
if(count == ((MetaElement)nodeMeta).getMaxOccurrences()){
|
if(count == ((MetaElement)nodeMeta).getMaxOccurrences()){
|
||||||
throw new DataException("Maximum number of occurrences for " +
|
throw new DataException("Maximum number of occurrences for " +
|
||||||
((MetaElement)nodeMeta).getName()+ " reached.");
|
((MetaElement)nodeMeta).getName()+ " reached.");
|
||||||
|
@ -99,10 +94,6 @@ public class DataElement extends DataNode {
|
||||||
this.node.appendChild(textNode);
|
this.node.appendChild(textNode);
|
||||||
}
|
}
|
||||||
} else if(nodeMeta instanceof MetaAttribute){
|
} else if(nodeMeta instanceof MetaAttribute){
|
||||||
if (nodeMeta.getVersion().equals(ConfigModeIntializer.COMMERCIAL)
|
|
||||||
&& (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE || ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN)) {
|
|
||||||
addToDOM = 0;
|
|
||||||
}
|
|
||||||
if (addToDOM == 1) {
|
if (addToDOM == 1) {
|
||||||
((Element)this.node).setAttributeNode((Attr)node.getNode());
|
((Element)this.node).setAttributeNode((Attr)node.getNode());
|
||||||
}
|
}
|
||||||
|
@ -170,29 +161,15 @@ public class DataElement extends DataNode {
|
||||||
if(count == ((MetaElement)nodeMeta).getMinOccurrences()){
|
if(count == ((MetaElement)nodeMeta).getMinOccurrences()){
|
||||||
throw new DataException("Minimum number of occurrences for " +
|
throw new DataException("Minimum number of occurrences for " +
|
||||||
((MetaElement)nodeMeta).getName()+ " reached.");
|
((MetaElement)nodeMeta).getName()+ " reached.");
|
||||||
} else if (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMERCIAL_MODE) {
|
} else
|
||||||
((Element) this.node).removeChild(node.getNode());
|
((Element) this.node).removeChild(node.getNode());
|
||||||
} else {
|
|
||||||
if (!nodeMeta.getVersion().equals(
|
|
||||||
ConfigModeIntializer.COMMERCIAL)) {
|
|
||||||
if (!node.getOwner().getCommercialServices()
|
|
||||||
.contains(node.getNode())) {
|
|
||||||
((Element) this.node).removeChild(node.getNode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(nodeMeta instanceof MetaAttribute){
|
} else if(nodeMeta instanceof MetaAttribute){
|
||||||
if(((MetaAttribute)nodeMeta).isRequired()){
|
if(((MetaAttribute)nodeMeta).isRequired()){
|
||||||
throw new DataException("Cannot remove required attribute " +
|
throw new DataException("Cannot remove required attribute " +
|
||||||
((MetaAttribute)nodeMeta).getName()+ ".");
|
((MetaAttribute)nodeMeta).getName()+ ".");
|
||||||
} else if (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMERCIAL_MODE) {
|
} else {
|
||||||
((Element) this.node)
|
((Element) this.node)
|
||||||
.removeAttributeNode((Attr) node.getNode());
|
.removeAttributeNode((Attr) node.getNode());
|
||||||
} else {
|
|
||||||
if (!nodeMeta.getVersion().equals(
|
|
||||||
ConfigModeIntializer.COMMERCIAL)) {
|
|
||||||
((Element)this.node).removeAttributeNode((Attr)node.getNode());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
((Element)this.node).removeChild(node.getNode());
|
((Element)this.node).removeChild(node.getNode());
|
||||||
|
|
|
@ -17,8 +17,8 @@ public class MetaAttribute extends MetaNode {
|
||||||
private MetaValue value;
|
private MetaValue value;
|
||||||
|
|
||||||
public MetaAttribute(String doc, String name, boolean required,
|
public MetaAttribute(String doc, String name, boolean required,
|
||||||
MetaValue value, String version, String dimension) {
|
MetaValue value, String dimension) {
|
||||||
super(doc, version, dimension);
|
super(doc, dimension);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.required = required;
|
this.required = required;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
@ -88,7 +88,6 @@ public class MetaAttribute extends MetaNode {
|
||||||
result += "\nAttribute\n";
|
result += "\nAttribute\n";
|
||||||
result += "-Name: " + this.name + "\n";
|
result += "-Name: " + this.name + "\n";
|
||||||
result += "-Required: " + this.required + "\n";
|
result += "-Required: " + this.required + "\n";
|
||||||
result += "-Version: " + this.version + "\n";
|
|
||||||
result += "-Value: " + value.toString();
|
result += "-Value: " + value.toString();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.common.util.Report;
|
import org.eclipse.cyclonedds.common.util.Report;
|
||||||
import org.w3c.dom.Attr;
|
import org.w3c.dom.Attr;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -36,16 +35,13 @@ import org.xml.sax.SAXParseException;
|
||||||
|
|
||||||
public class MetaConfiguration {
|
public class MetaConfiguration {
|
||||||
|
|
||||||
private double version;
|
|
||||||
private final MetaElement rootElement;
|
private final MetaElement rootElement;
|
||||||
private final ArrayList<MetaElement> services;
|
private final ArrayList<MetaElement> services;
|
||||||
private static HashMap<String, String> serviceMapping = new HashMap<String, String>();
|
private static HashMap<String, String> serviceMapping = new HashMap<String, String>();
|
||||||
private static final double LATEST_VERSION_OSPL = 6.1;
|
|
||||||
private static MetaConfiguration instance = null;
|
private static MetaConfiguration instance = null;
|
||||||
|
|
||||||
|
|
||||||
private MetaConfiguration(double version, MetaElement rootElement, ArrayList<MetaElement> services) {
|
private MetaConfiguration(MetaElement rootElement, ArrayList<MetaElement> services) {
|
||||||
this.version = version;
|
|
||||||
this.rootElement = rootElement;
|
this.rootElement = rootElement;
|
||||||
this.services = services;
|
this.services = services;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +72,6 @@ public class MetaConfiguration {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getVersion() {
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MetaConfiguration load(String fileName){
|
private static MetaConfiguration load(String fileName){
|
||||||
MetaConfiguration config = null;
|
MetaConfiguration config = null;
|
||||||
|
|
||||||
|
@ -87,9 +79,6 @@ public class MetaConfiguration {
|
||||||
|
|
||||||
if(is != null){
|
if(is != null){
|
||||||
config = load(is);
|
config = load(is);
|
||||||
if (config != null) {
|
|
||||||
config.version = LATEST_VERSION_OSPL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +136,6 @@ public class MetaConfiguration {
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("MetaConfiguration version: " + this.version + "\n");
|
|
||||||
buf.append("ROOT_ELEMENT:");
|
buf.append("ROOT_ELEMENT:");
|
||||||
buf.append(this.rootElement.toString().replaceAll("\n", "\n\t"));
|
buf.append(this.rootElement.toString().replaceAll("\n", "\n\t"));
|
||||||
for(MetaElement me: this.services){
|
for(MetaElement me: this.services){
|
||||||
|
@ -167,8 +155,6 @@ public class MetaConfiguration {
|
||||||
try{
|
try{
|
||||||
ArrayList<MetaElement> metaElements = new ArrayList<MetaElement>();
|
ArrayList<MetaElement> metaElements = new ArrayList<MetaElement>();
|
||||||
Element rootElement = dom.getDocumentElement();
|
Element rootElement = dom.getDocumentElement();
|
||||||
float version = Float.parseFloat(rootElement.getAttribute("version"));
|
|
||||||
|
|
||||||
|
|
||||||
NodeList children = rootElement.getChildNodes();
|
NodeList children = rootElement.getChildNodes();
|
||||||
|
|
||||||
|
@ -179,10 +165,6 @@ public class MetaConfiguration {
|
||||||
if(childElement instanceof Element){
|
if(childElement instanceof Element){
|
||||||
if("rootElement".equals(childName)){
|
if("rootElement".equals(childName)){
|
||||||
rootMetaElement = parseElement((Element)childElement, true);
|
rootMetaElement = parseElement((Element)childElement, true);
|
||||||
if (rootMetaElement.getName().equals("Lite")
|
|
||||||
|| rootMetaElement.getName().equals("CycloneDDS")){
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.LITE_MODE);
|
|
||||||
}
|
|
||||||
} else if("element".equals(childName)){
|
} else if("element".equals(childName)){
|
||||||
metaElement = parseElement((Element)childElement, false);
|
metaElement = parseElement((Element)childElement, false);
|
||||||
if(metaElement != null){
|
if(metaElement != null){
|
||||||
|
@ -192,19 +174,12 @@ public class MetaConfiguration {
|
||||||
rootMetaElement.addChild(metaElement);
|
rootMetaElement.addChild(metaElement);
|
||||||
metaElements.add(metaElement);
|
metaElements.add(metaElement);
|
||||||
}
|
}
|
||||||
} else if ("serviceMapping".equals(childName)
|
|
||||||
&& ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
// Service mapping only for configuring OSPL systems.
|
|
||||||
res = parseServiceMapping((Element) childElement, false);
|
|
||||||
if (!res) {
|
|
||||||
throw new MetaException("Could not resolve meta configuration for service mapping.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((rootMetaElement != null) && (version != 0.0)){
|
if((rootMetaElement != null)){
|
||||||
configuration = new MetaConfiguration(version, rootMetaElement, metaElements);
|
configuration = new MetaConfiguration(rootMetaElement, metaElements);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch(Exception exc){
|
} catch(Exception exc){
|
||||||
|
@ -306,12 +281,10 @@ public class MetaConfiguration {
|
||||||
String nodeName, name;
|
String nodeName, name;
|
||||||
int minOccurrences, maxOccurrences;
|
int minOccurrences, maxOccurrences;
|
||||||
String comment = null;
|
String comment = null;
|
||||||
String version = null;
|
|
||||||
String dimension = null;
|
String dimension = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
name = element.getAttribute("name");
|
name = element.getAttribute("name");
|
||||||
version = element.getAttribute("version");
|
|
||||||
|
|
||||||
//if(!isRootElement){
|
//if(!isRootElement){
|
||||||
minOccurrences = Integer.parseInt(element.getAttribute("minOccurrences"));
|
minOccurrences = Integer.parseInt(element.getAttribute("minOccurrences"));
|
||||||
|
@ -372,7 +345,7 @@ public class MetaConfiguration {
|
||||||
}
|
}
|
||||||
if(name != null){
|
if(name != null){
|
||||||
result = new MetaElement(comment, name, minOccurrences,
|
result = new MetaElement(comment, name, minOccurrences,
|
||||||
maxOccurrences, metaChildren, version, dimension);
|
maxOccurrences, metaChildren, dimension);
|
||||||
} else {
|
} else {
|
||||||
throw getException(element, "No name found");
|
throw getException(element, "No name found");
|
||||||
}
|
}
|
||||||
|
@ -421,7 +394,7 @@ public class MetaConfiguration {
|
||||||
MetaValue data;
|
MetaValue data;
|
||||||
ArrayList<MetaNode> metaChildren;
|
ArrayList<MetaNode> metaChildren;
|
||||||
NodeList children;
|
NodeList children;
|
||||||
String name, comment, nodeName, version, dimension;
|
String name, comment, nodeName, dimension;
|
||||||
int minOccurrences, maxOccurrences;
|
int minOccurrences, maxOccurrences;
|
||||||
Node node;
|
Node node;
|
||||||
NodeList nodes;
|
NodeList nodes;
|
||||||
|
@ -430,7 +403,6 @@ public class MetaConfiguration {
|
||||||
dimension = null;
|
dimension = null;
|
||||||
comment = parseComment(element);
|
comment = parseComment(element);
|
||||||
name = element.getAttribute("name");
|
name = element.getAttribute("name");
|
||||||
version = element.getAttribute("version");
|
|
||||||
minOccurrences = Integer.parseInt(element.getAttribute("minOccurrences"));
|
minOccurrences = Integer.parseInt(element.getAttribute("minOccurrences"));
|
||||||
maxOccurrences = Integer.parseInt(element.getAttribute("maxOccurrences"));
|
maxOccurrences = Integer.parseInt(element.getAttribute("maxOccurrences"));
|
||||||
|
|
||||||
|
@ -478,7 +450,7 @@ public class MetaConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = new MetaElement(comment, name, minOccurrences,
|
result = new MetaElement(comment, name, minOccurrences,
|
||||||
maxOccurrences, metaChildren, version, dimension);
|
maxOccurrences, metaChildren, dimension);
|
||||||
} else {
|
} else {
|
||||||
throw getException(element, "No data found");
|
throw getException(element, "No data found");
|
||||||
}
|
}
|
||||||
|
@ -494,7 +466,7 @@ public class MetaConfiguration {
|
||||||
private static MetaAttribute parseAttribute(Element element) throws MetaException{
|
private static MetaAttribute parseAttribute(Element element) throws MetaException{
|
||||||
MetaAttribute result;
|
MetaAttribute result;
|
||||||
MetaValue data;
|
MetaValue data;
|
||||||
String name, comment, version;
|
String name, comment;
|
||||||
boolean required;
|
boolean required;
|
||||||
String dimension;
|
String dimension;
|
||||||
|
|
||||||
|
@ -502,15 +474,13 @@ public class MetaConfiguration {
|
||||||
comment = parseComment(element);
|
comment = parseComment(element);
|
||||||
name = element.getAttribute("name");
|
name = element.getAttribute("name");
|
||||||
required = Boolean.parseBoolean(element.getAttribute("required"));
|
required = Boolean.parseBoolean(element.getAttribute("required"));
|
||||||
version = element.getAttribute("version");
|
|
||||||
|
|
||||||
if(name != null){
|
if(name != null){
|
||||||
data = parseValue(element, element.getNodeName().substring(9));
|
data = parseValue(element, element.getNodeName().substring(9));
|
||||||
|
|
||||||
if(data != null){
|
if(data != null){
|
||||||
dimension = getDimensionChild(element);
|
dimension = getDimensionChild(element);
|
||||||
result = new MetaAttribute(comment, name, required, data,
|
result = new MetaAttribute(comment, name, required, data, dimension);
|
||||||
version, dimension);
|
|
||||||
} else {
|
} else {
|
||||||
throw getException(element, "No data found");
|
throw getException(element, "No data found");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ public class MetaElement extends MetaNode {
|
||||||
private ArrayList<MetaNode> children;
|
private ArrayList<MetaNode> children;
|
||||||
|
|
||||||
public MetaElement(String doc, String name, int minOccurrences,
|
public MetaElement(String doc, String name, int minOccurrences,
|
||||||
int maxOccurrences, ArrayList<MetaNode> children, String version,
|
int maxOccurrences, ArrayList<MetaNode> children,
|
||||||
String dimension) {
|
String dimension) {
|
||||||
super(doc, version, dimension);
|
super(doc, dimension);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.minOccurrences = minOccurrences;
|
this.minOccurrences = minOccurrences;
|
||||||
this.maxOccurrences = maxOccurrences;
|
this.maxOccurrences = maxOccurrences;
|
||||||
|
@ -106,7 +106,6 @@ public class MetaElement extends MetaNode {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("\nElement\n");
|
buf.append("\nElement\n");
|
||||||
buf.append("-Name: " + this.name + "\n");
|
buf.append("-Name: " + this.name + "\n");
|
||||||
buf.append("-Version: " + this.version + "\n");
|
|
||||||
buf.append("-MinOcccurrences: " + this.minOccurrences + "\n");
|
buf.append("-MinOcccurrences: " + this.minOccurrences + "\n");
|
||||||
buf.append("-MaxOcccurrences: " + this.maxOccurrences + "\n");
|
buf.append("-MaxOcccurrences: " + this.maxOccurrences + "\n");
|
||||||
if(this.children.size() > 0){
|
if(this.children.size() > 0){
|
||||||
|
|
|
@ -13,12 +13,10 @@ package org.eclipse.cyclonedds.config.meta;
|
||||||
|
|
||||||
public abstract class MetaNode {
|
public abstract class MetaNode {
|
||||||
String doc;
|
String doc;
|
||||||
String version;
|
|
||||||
String dimension;
|
String dimension;
|
||||||
|
|
||||||
public MetaNode(String doc, String version, String dimension) {
|
public MetaNode(String doc, String dimension) {
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
this.version = version;
|
|
||||||
this.dimension = dimension;
|
this.dimension = dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +28,6 @@ public abstract class MetaNode {
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDimension() {
|
public String getDimension() {
|
||||||
return this.dimension;
|
return this.dimension;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,11 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cyclonedds.config.meta;
|
package org.eclipse.cyclonedds.config.meta;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
|
|
||||||
public abstract class MetaValue extends MetaNode {
|
public abstract class MetaValue extends MetaNode {
|
||||||
Object defaultValue;
|
Object defaultValue;
|
||||||
|
|
||||||
public MetaValue(String doc, Object defaultValue, String dimension) {
|
public MetaValue(String doc, Object defaultValue, String dimension) {
|
||||||
super(doc, ConfigModeIntializer.COMMUNITY, dimension);
|
super(doc, dimension);
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import javax.swing.JTabbedPane;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.common.view.MainWindow;
|
import org.eclipse.cyclonedds.common.view.MainWindow;
|
||||||
import org.eclipse.cyclonedds.common.view.StatusPanel;
|
import org.eclipse.cyclonedds.common.view.StatusPanel;
|
||||||
import org.eclipse.cyclonedds.config.data.DataConfiguration;
|
import org.eclipse.cyclonedds.config.data.DataConfiguration;
|
||||||
|
@ -71,15 +70,10 @@ public class ConfigWindow extends MainWindow implements DataConfigurationListene
|
||||||
private DataNodePopup popupSupport = null;
|
private DataNodePopup popupSupport = null;
|
||||||
private ConfigTransferHandler transferHandler = null;
|
private ConfigTransferHandler transferHandler = null;
|
||||||
|
|
||||||
private String windowTitle = "Configurator";
|
private String windowTitle = "Eclipse Cyclone DDS Configurator";
|
||||||
public static final String OSPL_WINDOW_TITLE = "Vortex OpenSplice Configurator";
|
|
||||||
public static final String LITE_WINDOW_TITLE = "Vortex DDS Configurator";
|
|
||||||
|
|
||||||
public static final String OSPL_SERVICE_LABEL = "Service";
|
public static String SERVICE_LABEL = "Component";
|
||||||
public static final String LITE_SERVICE_LABEL = "Component";
|
public static String SERVICE_TEXT = "component";
|
||||||
|
|
||||||
public static String SERVICE_LABEL;
|
|
||||||
public static String SERVICE_TEXT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default constructor
|
* This is the default constructor
|
||||||
|
@ -237,12 +231,7 @@ public class ConfigWindow extends MainWindow implements DataConfigurationListene
|
||||||
return this.controller;
|
return this.controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindowTitle (int configMode) {
|
public void setWindowTitle () {
|
||||||
if (configMode == ConfigModeIntializer.LITE_MODE) {
|
|
||||||
this.windowTitle = LITE_WINDOW_TITLE;
|
|
||||||
} else {
|
|
||||||
this.windowTitle = OSPL_WINDOW_TITLE;
|
|
||||||
}
|
|
||||||
super.setTitle(this.windowTitle);
|
super.setTitle(this.windowTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,10 +340,6 @@ public class ConfigWindow extends MainWindow implements DataConfigurationListene
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
this.setSize(800, 600);
|
this.setSize(800, 600);
|
||||||
this.controller = new ConfigWindowController(this);
|
this.controller = new ConfigWindowController(this);
|
||||||
// setServiceLabel relies on the
|
|
||||||
// ConfigModeIntializer.CONFIGURATOR_MODE variable which
|
|
||||||
// has been set during construction of ConfigWndowController
|
|
||||||
this.setServiceLabel();
|
|
||||||
this.popupSupport = new DataNodePopup();
|
this.popupSupport = new DataNodePopup();
|
||||||
this.transferHandler = new ConfigTransferHandler(this);
|
this.transferHandler = new ConfigTransferHandler(this);
|
||||||
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
@ -373,22 +358,6 @@ public class ConfigWindow extends MainWindow implements DataConfigurationListene
|
||||||
this.setAppLogo();
|
this.setAppLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the proper service label to be used throughout the configurator UI.
|
|
||||||
* Ospl uses the label "Service" while Lite uses the label "Component"
|
|
||||||
* (since the concept of service does not really exist)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void setServiceLabel(){
|
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE){
|
|
||||||
SERVICE_LABEL = OSPL_SERVICE_LABEL;
|
|
||||||
SERVICE_TEXT = OSPL_SERVICE_LABEL.toLowerCase();
|
|
||||||
} else {
|
|
||||||
SERVICE_LABEL = LITE_SERVICE_LABEL;
|
|
||||||
SERVICE_TEXT = LITE_SERVICE_LABEL.toLowerCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method initializes jContentPane
|
* This method initializes jContentPane
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,7 +27,6 @@ import javax.swing.JOptionPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.common.util.Report;
|
import org.eclipse.cyclonedds.common.util.Report;
|
||||||
import org.eclipse.cyclonedds.config.data.DataConfiguration;
|
import org.eclipse.cyclonedds.config.data.DataConfiguration;
|
||||||
import org.eclipse.cyclonedds.config.data.DataException;
|
import org.eclipse.cyclonedds.config.data.DataException;
|
||||||
|
@ -60,25 +59,12 @@ public class ConfigWindowController implements ActionListener {
|
||||||
// Initialize the MetaConfiguration. This is done so the Configurator can know for
|
// Initialize the MetaConfiguration. This is done so the Configurator can know for
|
||||||
// which product its meant for, according to the meta config file.
|
// which product its meant for, according to the meta config file.
|
||||||
MetaConfiguration.getInstance();
|
MetaConfiguration.getInstance();
|
||||||
view.setWindowTitle(ConfigModeIntializer.CONFIGURATOR_MODE);
|
view.setWindowTitle();
|
||||||
|
|
||||||
String osplHome = System.getenv("OSPL_HOME");
|
|
||||||
File f = null;
|
File f = null;
|
||||||
String fileSep = System.getProperty("file.separator");
|
String fileSep = System.getProperty("file.separator");
|
||||||
|
|
||||||
if(osplHome == null){
|
f = new File(System.getProperty("user.dir") + fileSep);
|
||||||
f = new File(System.getProperty("user.dir") + fileSep);
|
|
||||||
} else {
|
|
||||||
f = new File(osplHome + fileSep + "etc" + fileSep + "config" + fileSep);
|
|
||||||
|
|
||||||
if((!f.exists()) || (!f.isDirectory())){
|
|
||||||
f = new File(osplHome + fileSep + "etc" + fileSep);
|
|
||||||
|
|
||||||
if((!f.exists()) || (!f.isDirectory())){
|
|
||||||
f = new File(System.getProperty("user.dir") + fileSep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.openFileChooser.setCurrentDirectory(f);
|
this.openFileChooser.setCurrentDirectory(f);
|
||||||
this.openFileChooser.setDialogTitle("Open configuration");
|
this.openFileChooser.setDialogTitle("Open configuration");
|
||||||
this.openFileChooser.setMultiSelectionEnabled(false);
|
this.openFileChooser.setMultiSelectionEnabled(false);
|
||||||
|
@ -242,52 +228,9 @@ public class ConfigWindowController implements ActionListener {
|
||||||
DataConfiguration config = null;
|
DataConfiguration config = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE &&
|
|
||||||
ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
config = new DataConfiguration(f, false);
|
config = new DataConfiguration(f, false);
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
Report.getInstance().writeInfoLog("ConfigWindowController handleOpen\n" + e.getMessage());
|
Report.getInstance().writeInfoLog("ConfigWindowController handleOpen\n" + e.getMessage());
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE) {
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.COMMUNITY_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int answer = JOptionPane.showConfirmDialog(
|
|
||||||
view,
|
|
||||||
"The configuration is not valid.\nReason: " +
|
|
||||||
e.getMessage() +
|
|
||||||
"\nTry automatic repairing?",
|
|
||||||
"Invalid configuration",
|
|
||||||
JOptionPane.YES_NO_OPTION);
|
|
||||||
|
|
||||||
if(answer == JOptionPane.YES_OPTION){
|
|
||||||
try {
|
|
||||||
config = new DataConfiguration(f, true);
|
|
||||||
|
|
||||||
view.setStatus("Configuration repaired successfully.", false);
|
|
||||||
} catch (DataException e1) {
|
|
||||||
JOptionPane.showMessageDialog(view,
|
|
||||||
"Configuration could not be repaired.\nReason: '" +
|
|
||||||
e.getMessage() + "'"
|
|
||||||
, "Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
handleSetStatus("Configuration could not be repaired.", false);
|
|
||||||
handleNextAction();
|
|
||||||
}
|
|
||||||
} else if(answer == JOptionPane.NO_OPTION){
|
|
||||||
handleSetStatus("Configuration not opened.", false);
|
|
||||||
handleNextAction();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
JOptionPane.showConfirmDialog(
|
|
||||||
view,
|
|
||||||
"The configuration is not valid.\nReason: " +
|
|
||||||
e.getMessage(),
|
|
||||||
"Invalid configuration",
|
|
||||||
JOptionPane.PLAIN_MESSAGE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(config != null){
|
if(config != null){
|
||||||
view.setDataConfiguration(config);
|
view.setDataConfiguration(config);
|
||||||
|
@ -326,23 +269,11 @@ public class ConfigWindowController implements ActionListener {
|
||||||
DataConfiguration config = null;
|
DataConfiguration config = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE &&
|
|
||||||
ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
ConfigModeIntializer
|
|
||||||
.setMode(ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
config = new DataConfiguration(f, false);
|
config = new DataConfiguration(f, false);
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
Report.getInstance().writeInfoLog(
|
Report.getInstance().writeInfoLog(
|
||||||
"ConfigWindowController handleOpen\n"
|
"ConfigWindowController handleOpen\n"
|
||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE &&
|
|
||||||
ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE) {
|
|
||||||
ConfigModeIntializer
|
|
||||||
.setMode(ConfigModeIntializer.COMMUNITY_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int answer = JOptionPane.showConfirmDialog(
|
int answer = JOptionPane.showConfirmDialog(
|
||||||
view,
|
view,
|
||||||
"The configuration is not valid.\nReason: "
|
"The configuration is not valid.\nReason: "
|
||||||
|
@ -533,9 +464,6 @@ public class ConfigWindowController implements ActionListener {
|
||||||
public void run(){
|
public void run(){
|
||||||
view.setDataConfiguration(null);
|
view.setDataConfiguration(null);
|
||||||
newInProgress = false;
|
newInProgress = false;
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN) {
|
|
||||||
ConfigModeIntializer.setMode(ConfigModeIntializer.COMMUNITY_MODE);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
DataConfiguration config = new DataConfiguration();
|
DataConfiguration config = new DataConfiguration();
|
||||||
view.setDataConfiguration(config);
|
view.setDataConfiguration(config);
|
||||||
|
@ -628,13 +556,8 @@ public class ConfigWindowController implements ActionListener {
|
||||||
public static final String CONFIG_SUFFIX = ".xml";
|
public static final String CONFIG_SUFFIX = ".xml";
|
||||||
|
|
||||||
public ConfigChooseFilter(){
|
public ConfigChooseFilter(){
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.LITE_MODE) {
|
ConfigChooseFilter.description = "Eclipse Cyclone DDS config files (*" +
|
||||||
ConfigChooseFilter.description = "Cyclone DDS config files (*" +
|
ConfigChooseFilter.CONFIG_SUFFIX + ")";
|
||||||
ConfigChooseFilter.CONFIG_SUFFIX + ")";
|
|
||||||
} else {
|
|
||||||
ConfigChooseFilter.description = "OpenSplice config files (*" +
|
|
||||||
ConfigChooseFilter.CONFIG_SUFFIX + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.logging.Logger;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.config.data.DataNode;
|
import org.eclipse.cyclonedds.config.data.DataNode;
|
||||||
|
|
||||||
public class DataElementTableCellRenderer extends DefaultTableCellRenderer {
|
public class DataElementTableCellRenderer extends DefaultTableCellRenderer {
|
||||||
|
@ -43,27 +42,9 @@ public class DataElementTableCellRenderer extends DefaultTableCellRenderer {
|
||||||
node = node.getParent();
|
node = node.getParent();
|
||||||
table.setToolTipText(null);
|
table.setToolTipText(null);
|
||||||
|
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE) {
|
comp.setBackground (Color.WHITE);
|
||||||
if (node.getMetadata().getVersion().equals(ConfigModeIntializer.COMMERCIAL)) {
|
comp.setForeground (Color.BLACK);
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMUNITY_MODE_FILE_OPEN) {
|
table.setToolTipText(null);
|
||||||
comp.setBackground (Color.LIGHT_GRAY);
|
|
||||||
comp.setForeground (Color.GRAY);
|
|
||||||
table.setToolTipText("This element is not part of the community edition");
|
|
||||||
} else {
|
|
||||||
comp.setBackground (Color.RED);
|
|
||||||
comp.setForeground (Color.BLACK);
|
|
||||||
table.setToolTipText("This element is found in the configuration file but not part of the community edition");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
comp.setBackground (Color.WHITE);
|
|
||||||
comp.setForeground (Color.BLACK);
|
|
||||||
table.setToolTipText(null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
comp.setBackground (Color.WHITE);
|
|
||||||
comp.setForeground (Color.BLACK);
|
|
||||||
table.setToolTipText(null);
|
|
||||||
}
|
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.config.data.DataAttribute;
|
import org.eclipse.cyclonedds.config.data.DataAttribute;
|
||||||
import org.eclipse.cyclonedds.config.data.DataConfiguration;
|
import org.eclipse.cyclonedds.config.data.DataConfiguration;
|
||||||
import org.eclipse.cyclonedds.config.data.DataConfigurationListener;
|
import org.eclipse.cyclonedds.config.data.DataConfigurationListener;
|
||||||
|
@ -131,9 +130,7 @@ public class DataElementTableModel extends DefaultTableModel implements DataConf
|
||||||
public boolean isCellEditable(int row, int column) {
|
public boolean isCellEditable(int row, int column) {
|
||||||
boolean result;
|
boolean result;
|
||||||
|
|
||||||
if(column == 1 && ConfigModeIntializer.CONFIGURATOR_MODE == ConfigModeIntializer.COMMERCIAL_MODE) {
|
if(column == 1) {
|
||||||
result = true;
|
|
||||||
} else if (column == 1 && !element.getMetadata().getVersion().equals(ConfigModeIntializer.COMMERCIAL)) {
|
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
result = false;
|
result = false;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.cyclonedds.config.meta.MetaAttribute;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaElement;
|
import org.eclipse.cyclonedds.config.meta.MetaElement;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaNode;
|
import org.eclipse.cyclonedds.config.meta.MetaNode;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaValue;
|
import org.eclipse.cyclonedds.config.meta.MetaValue;
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
|
|
||||||
public class DataNodePopup implements MouseListener, ActionListener {
|
public class DataNodePopup implements MouseListener, ActionListener {
|
||||||
|
|
||||||
|
@ -137,10 +136,6 @@ public class DataNodePopup implements MouseListener, ActionListener {
|
||||||
if(parentParent != null){
|
if(parentParent != null){
|
||||||
current = this.countOccurrences((DataElement)parent.getParent(), parent.getMetadata());
|
current = this.countOccurrences((DataElement)parent.getParent(), parent.getMetadata());
|
||||||
min = ((MetaElement)metaParent).getMinOccurrences();
|
min = ((MetaElement)metaParent).getMinOccurrences();
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE && metaParent.getVersion().equals(ConfigModeIntializer.COMMERCIAL)) {
|
|
||||||
reset.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(min == 0){
|
if(min == 0){
|
||||||
remove.setEnabled(true);
|
remove.setEnabled(true);
|
||||||
} else if(current > min){
|
} else if(current > min){
|
||||||
|
@ -151,10 +146,6 @@ public class DataNodePopup implements MouseListener, ActionListener {
|
||||||
}
|
}
|
||||||
} else if(parent instanceof DataAttribute){
|
} else if(parent instanceof DataAttribute){
|
||||||
metaParent = parent.getMetadata();
|
metaParent = parent.getMetadata();
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.COMMERCIAL_MODE && metaParent.getVersion().equals(ConfigModeIntializer.COMMERCIAL)) {
|
|
||||||
reset.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(((MetaAttribute)metaParent).isRequired()){
|
if(((MetaAttribute)metaParent).isRequired()){
|
||||||
remove.setEnabled(false);
|
remove.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -387,40 +378,8 @@ public class DataNodePopup implements MouseListener, ActionListener {
|
||||||
|
|
||||||
public void addService(DataNode dataNode, MetaNode metaNode) throws DataException {
|
public void addService(DataNode dataNode, MetaNode metaNode) throws DataException {
|
||||||
if (dataNode instanceof DataElement) {
|
if (dataNode instanceof DataElement) {
|
||||||
if (ConfigModeIntializer.CONFIGURATOR_MODE != ConfigModeIntializer.LITE_MODE){
|
/* get the newly created service element */
|
||||||
String serviceName = null;
|
dataNode.getOwner().addNode((DataElement) dataNode, metaNode);
|
||||||
|
|
||||||
String suggestedName = dataNode.getOwner().getMetaAttributeValue((MetaElement) metaNode, "name");
|
|
||||||
/*
|
|
||||||
* generate a new name if there is already a service with the
|
|
||||||
* default name
|
|
||||||
*/
|
|
||||||
if (dataNode.getOwner().containsServiceName(suggestedName)) {
|
|
||||||
String tmp = suggestedName + "_1";
|
|
||||||
for (int i = 1; dataNode.getOwner().containsServiceName(tmp); i++) {
|
|
||||||
tmp = suggestedName + "_" + i;
|
|
||||||
}
|
|
||||||
suggestedName = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
serviceName = (String) JOptionPane.showInputDialog(null, "Please enter a service name:",
|
|
||||||
"Set the service name", JOptionPane.QUESTION_MESSAGE, null, null, suggestedName);
|
|
||||||
|
|
||||||
if (serviceName != null) {
|
|
||||||
if (!dataNode.getOwner().containsServiceName(serviceName)) {
|
|
||||||
/* get the newly created service element */
|
|
||||||
dataNode = dataNode.getOwner().addNodeWithDependency((DataElement) dataNode, metaNode);
|
|
||||||
dataNode.getOwner().createDomainServiceForSerivce(dataNode, metaNode, serviceName);
|
|
||||||
} else {
|
|
||||||
this.notifyStatus("Error: Servicename is already in use", false, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.notifyStatus("Error: Please fill in a servicename", false, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* get the newly created service element */
|
|
||||||
dataNode.getOwner().addNode((DataElement) dataNode, metaNode);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.notifyStatus("Error: Unexpected type of parent found: '" + dataNode.getClass() + "'.", false, false);
|
this.notifyStatus("Error: Unexpected type of parent found: '" + dataNode.getClass() + "'.", false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import javax.swing.JFrame;
|
||||||
import javax.swing.WindowConstants;
|
import javax.swing.WindowConstants;
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
|
|
||||||
import org.eclipse.cyclonedds.common.util.ConfigModeIntializer;
|
|
||||||
import org.eclipse.cyclonedds.common.view.StatusPanel;
|
import org.eclipse.cyclonedds.common.view.StatusPanel;
|
||||||
import org.eclipse.cyclonedds.config.meta.MetaConfiguration;
|
import org.eclipse.cyclonedds.config.meta.MetaConfiguration;
|
||||||
|
|
||||||
|
@ -37,8 +36,7 @@ public class HelpWindow extends JFrame implements TreeSelectionListener {
|
||||||
private JScrollPane docScrollPane = null;
|
private JScrollPane docScrollPane = null;
|
||||||
private MetaNodeDocPane docPane = null;
|
private MetaNodeDocPane docPane = null;
|
||||||
|
|
||||||
public static final String OSPL_HELP_WINDOW_TITLE = "Vortex OpenSplice Configurator | Help";
|
public static final String HELP_WINDOW_TITLE = "Eclipse Cyclone DDS Configurator | Help";
|
||||||
public static final String LITE_HELP_WINDOW_TITLE = "Vortex DDS Configurator | Help";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default constructor
|
* This is the default constructor
|
||||||
|
@ -58,18 +56,13 @@ public class HelpWindow extends JFrame implements TreeSelectionListener {
|
||||||
this.setSize(640, 480);
|
this.setSize(640, 480);
|
||||||
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
this.setContentPane(getJContentPane());
|
this.setContentPane(getJContentPane());
|
||||||
setWindowTitle(ConfigModeIntializer.CONFIGURATOR_MODE);
|
setWindowTitle();
|
||||||
getElementTree().getSelectionModel().addTreeSelectionListener(this);
|
getElementTree().getSelectionModel().addTreeSelectionListener(this);
|
||||||
getDocPane().setNode(getElementTree().getSelectedMetaElement());
|
getDocPane().setNode(getElementTree().getSelectedMetaElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWindowTitle (int configMode) {
|
public void setWindowTitle () {
|
||||||
String windowTitle = "Configurator | Help";
|
String windowTitle = HELP_WINDOW_TITLE;
|
||||||
if (configMode == ConfigModeIntializer.LITE_MODE) {
|
|
||||||
windowTitle = LITE_HELP_WINDOW_TITLE;
|
|
||||||
} else {
|
|
||||||
windowTitle = OSPL_HELP_WINDOW_TITLE;
|
|
||||||
}
|
|
||||||
this.setTitle(windowTitle);
|
this.setTitle(windowTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue