Skip to content
Snippets Groups Projects
Commit 74fae128 authored by Dominique Marcadet's avatar Dominique Marcadet
Browse files

NSD single file and zip van be loaded in editor

parent be442ccb
No related branches found
No related tags found
1 merge request!8Resolve "add needed stuff to allow for loading NSD files with RiseClipseEditor"
...@@ -36,4 +36,13 @@ ...@@ -36,4 +36,13 @@
org.eclipse.emf.edit.provider.IItemPropertySource"/> org.eclipse.emf.edit.provider.IItemPropertySource"/>
</extension> </extension>
<extension
point="fr.centralesupelec.edf.riseclipse.main.meta_models">
<meta_model
adapterFactory="fr.centralesupelec.edf.riseclipse.iec61850.nsd.provider.NsdItemProviderAdapterFactory"
name="IEC61850 NSD (version 2017A)"
uri="http://www.iec.ch/61850/2016/NSD">
</meta_model>
</extension>
</plugin> </plugin>
...@@ -44,4 +44,14 @@ ...@@ -44,4 +44,14 @@
class="fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceFactoryImpl"/> class="fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceFactoryImpl"/>
</extension> </extension>
<extension
point="fr.centralesupelec.edf.riseclipse.main.meta_models">
<meta_model
name="IEC61850 NSD (version 2017A)"
resourceFactory="fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceFactoryImpl"
resourceSetFactory="fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceSetFactory"
uri="http://www.iec.ch/61850/2016/NSD">
</meta_model>
</extension>
</plugin> </plugin>
...@@ -20,9 +20,11 @@ ...@@ -20,9 +20,11 @@
package fr.centralesupelec.edf.riseclipse.iec61850.nsd.util; package fr.centralesupelec.edf.riseclipse.iec61850.nsd.util;
import org.eclipse.emf.common.util.URI; import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseResource;
/** /**
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* The <b>Resource </b> associated with the package. * The <b>Resource </b> associated with the package.
...@@ -30,7 +32,7 @@ import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; ...@@ -30,7 +32,7 @@ import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
* @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceFactoryImpl * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.util.NsdResourceFactoryImpl
* @generated * @generated
*/ */
public class NsdResourceImpl extends XMLResourceImpl { public class NsdResourceImpl extends XMLResourceImpl implements IRiseClipseResource {
/** /**
* Creates an instance of the resource. * Creates an instance of the resource.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
...@@ -42,4 +44,9 @@ public class NsdResourceImpl extends XMLResourceImpl { ...@@ -42,4 +44,9 @@ public class NsdResourceImpl extends XMLResourceImpl {
super( uri ); super( uri );
} }
@Override
public void printStatistics( IRiseClipseConsole console ) {
// TODO !
}
} //NsdResourceImpl } //NsdResourceImpl
/**
* Copyright (c) 2019 CentraleSupélec & EDF.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* This file is part of the RiseClipse tool
*
* Contributors:
* Computer Science Department, CentraleSupélec
* EDF R&D
* Contacts:
* dominique.marcadet@centralesupelec.fr
* aurelie.dehouck-neveu@edf.fr
* Web site:
* http://wdi.supelec.fr/software/RiseClipse/
*
*/
package fr.centralesupelec.edf.riseclipse.iec61850.nsd.util;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseResourceSet;
import fr.centralesupelec.edf.riseclipse.util.RiseClipseResourceSetFactory;
public class NsdResourceSetFactory extends RiseClipseResourceSetFactory {
/* (non-Javadoc)
* @see fr.centralesupelec.edf.riseclipse.util.RiseClipseResourceSetFactory#createResourceSet()
*/
@Override
public IRiseClipseResourceSet createResourceSet() {
// TODO Auto-generated method stub
return new NsdResourceSetImpl();
}
}
...@@ -24,15 +24,14 @@ import java.util.HashMap; ...@@ -24,15 +24,14 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.DocumentRoot; import fr.centralesupelec.edf.riseclipse.iec61850.nsd.DocumentRoot;
import fr.centralesupelec.edf.riseclipse.iec61850.nsd.NS; import fr.centralesupelec.edf.riseclipse.iec61850.nsd.NS;
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole; import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole; import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.RiseClipseResourceSet;
public class NsdResourceSetImpl extends ResourceSetImpl { public class NsdResourceSetImpl extends RiseClipseResourceSet {
private Map< String, NS > nsdResources; private Map< String, NS > nsdResources;
...@@ -71,8 +70,60 @@ public class NsdResourceSetImpl extends ResourceSetImpl { ...@@ -71,8 +70,60 @@ public class NsdResourceSetImpl extends ResourceSetImpl {
nsdResources.put( ns.getId(), ns ); nsdResources.put( ns.getId(), ns );
} }
/* (non-Javadoc)
* @see fr.centralesupelec.edf.riseclipse.util.RiseClipseResourceSet#finalizeLoad(fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole)
*/
@Override
public void finalizeLoad( IRiseClipseConsole console ) {
buildExplicitLinks( console );
}
/*
* The following links are implicit:
*
* DependsOn.id -> NS.id DONE
* AnyLNClass.base -> AbstractLNClass DONE
* DataObject.type -> CDC.name DONE
* DataObject.presCond -> PresenceCondition.name DONE
* DataObject.dsPresCond -> PresenceCondition.name DONE
* SubDataObject.type -> CDC.name DONE
* SubDataObject.presCond -> PresenceCondition.name DONE
* SubDataObject.sizeAttribute -> DataAttribute.name DONE
* SubDataObject.maxIndexAttribute -> DataAttribute.name DONE
* DataAttribute.fc -> FunctionalConstraint.abbreviation DONE
* DataAttribute.presCond -> PresenceCondition.name DONE
* DataAttribute.sizeAttribute -> DataAttribute.name DONE
* DataAttribute.maxIndexAttribute -> DataAttribute.name DONE
* ServiceParameter.name -> DataAttribute.name ? Name of the data attribute but may be not name of a DataAttribute ?
* SubDataAttribute.presCond -> PresenceCondition.name DONE
* SubDataAttribute.sizeAttribute -> DataAttribute.name ? Which DataAttribute ?
* SubDataAttribute.maxIndexAttribute -> DataAttribute.name ? Which DataAttribute ?
* Enumeration.inheritedFrom -> Enumeration.name DONE
* ServiceCDC.cdc -> CDC.name ? not sure and in ServiceNS file
* ServiceCDC.ServiceDataAttribute -> DataAttribute.name ? not sure and in ServiceNS file
* ServiceDataAttribute.fc -> FunctionalConstraint.abbreviation ? in ServiceNS file
* ServiceDataAttribute.presCond -> PresenceCondition.name ? in ServiceNS file
* AppliesTo.id -> NS.id ? in ServiceNS file
* ServiceTypeRealization.fc -> FunctionalConstraint.abbreviation ? ServiceTypeRealization is not a name of a type but a name of a reference
* ServiceTypeRealization.presCond -> PresenceCondition.name ? ServiceTypeRealization is not a name of a type but a name of a reference
*
*/
private void buildExplicitLinks( IRiseClipseConsole console ) {
for( Resource resource : getResources() ) {
DocumentRoot root = (DocumentRoot) resource.getContents().get( 0 );
NS ns = ( NS ) root.getNS();
ns.buildExplicitLinks( console );
}
}
public NS getNS( String id ) {
return nsdResources.get( id );
}
/* /*
* Constraints * Constraints
*
* NSDoc: * NSDoc:
* Name: uniqueDocID Selector: nsd:Doc Field: @id * Name: uniqueDocID Selector: nsd:Doc Field: @id
* Within an NSDoc element, there shall not be two Doc sub-elements with same id. * Within an NSDoc element, there shall not be two Doc sub-elements with same id.
...@@ -173,46 +224,5 @@ public class NsdResourceSetImpl extends ResourceSetImpl { ...@@ -173,46 +224,5 @@ public class NsdResourceSetImpl extends ResourceSetImpl {
* ServiceNS/ServiceCDCs: * ServiceNS/ServiceCDCs:
* Name: uniqueServiceCDC Selector: nsd:ServiceCDC Field: @cdc @variant * Name: uniqueServiceCDC Selector: nsd:ServiceCDC Field: @cdc @variant
* Within an ServiceNS, there shall not be two ServiceCDC sub-elements with same name and (if defined) variant. * Within an ServiceNS, there shall not be two ServiceCDC sub-elements with same name and (if defined) variant.
*
*
* The following links are implicit:
* DependsOn.id -> NS.id DONE
* AnyLNClass.base -> AbstractLNClass DONE
* DataObject.type -> CDC.name DONE
* DataObject.presCond -> PresenceCondition.name DONE
* DataObject.dsPresCond -> PresenceCondition.name DONE
* SubDataObject.type -> CDC.name DONE
* SubDataObject.presCond -> PresenceCondition.name DONE
* SubDataObject.sizeAttribute -> DataAttribute.name DONE
* SubDataObject.maxIndexAttribute -> DataAttribute.name DONE
* DataAttribute.fc -> FunctionalConstraint.abbreviation DONE
* DataAttribute.presCond -> PresenceCondition.name DONE
* DataAttribute.sizeAttribute -> DataAttribute.name DONE
* DataAttribute.maxIndexAttribute -> DataAttribute.name DONE
* ServiceParameter.name -> DataAttribute.name ? Name of the data attribute but may be not name of a DataAttribute ?
* SubDataAttribute.presCond -> PresenceCondition.name DONE
* SubDataAttribute.sizeAttribute -> DataAttribute.name ? Which DataAttribute ?
* SubDataAttribute.maxIndexAttribute -> DataAttribute.name ? Which DataAttribute ?
* Enumeration.inheritedFrom -> Enumeration.name DONE
* ServiceCDC.cdc -> CDC.name ? not sure and in ServiceNS file
* ServiceCDC.ServiceDataAttribute -> DataAttribute.name ? not sure and in ServiceNS file
* ServiceDataAttribute.fc -> FunctionalConstraint.abbreviation ? in ServiceNS file
* ServiceDataAttribute.presCond -> PresenceCondition.name ? in ServiceNS file
* AppliesTo.id -> NS.id ? in ServiceNS file
* ServiceTypeRealization.fc -> FunctionalConstraint.abbreviation ? ServiceTypeRealization is not a name of a type but a name of a reference
* ServiceTypeRealization.presCond -> PresenceCondition.name ? ServiceTypeRealization is not a name of a type but a name of a reference
*/ */
public void buildExplicitLinks( IRiseClipseConsole console ) {
for( Resource resource : getResources() ) {
DocumentRoot root = (DocumentRoot) resource.getContents().get( 0 );
NS ns = ( NS ) root.getNS();
ns.buildExplicitLinks( console );
}
}
public NS getNS( String id ) {
return nsdResources.get( id );
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment