@Override
	public List<ParsingError> doValidate() {

		// Component checks
		List<ParsingError> result = new ArrayList<> ();
		if( Utils.isEmptyOrWhitespaces( this.componentName ))
			result.add( error( ErrorCode.CMD_MISSING_COMPONENT_NAME ));

		else if( this.component == null )
			result.add( error( ErrorCode.CMD_INEXISTING_COMPONENT, component( this.componentName )));

		else if( ! this.component.getAncestors().isEmpty()) {

			Instance resolvedParentInstance;
			if( this.parentInstancePath == null )
				result.add( error( ErrorCode.CMD_MISSING_PARENT_INSTANCE ));
			else if(( resolvedParentInstance = this.context.resolveInstance( this.parentInstancePath )) == null )
				result.add( error( ErrorCode.CMD_NO_MATCHING_INSTANCE, instance( this.parentInstancePath )));
			else if( ! this.component.getAncestors().contains( resolvedParentInstance.getComponent()))
				result.add( error( ErrorCode.CMD_NOT_AN_ACCEPTABLE_PARENT, component( this.componentName )));

		} else if( this.parentInstancePath != null ) {
			result.add( error( ErrorCode.CMD_CANNOT_HAVE_ANY_PARENT, component( this.componentName )));
		}

		// Instance stuff
		if( Utils.isEmptyOrWhitespaces( this.instanceName ))
			result.add( error( ErrorCode.CMD_MISSING_INSTANCE_NAME ));
		else if( ! this.instanceName.matches( ParsingConstants.PATTERN_FLEX_ID ))
			result.add( error( ErrorCode.CMD_INVALID_INSTANCE_NAME, instance( this.instanceName )));

		String newInstancePath = (this.parentInstancePath == null ? "" : this.parentInstancePath) + "/" + this.instanceName;
		if( this.context.instancePathToComponentName.containsKey( newInstancePath ))
			result.add( error( ErrorCode.CMD_CONFLICTING_INSTANCE_NAME ));

		return result;
	}
@ Override public List < ParsingError > doValidate ( ) { List < ParsingError > result = new ArrayList < > ( ) ; if ( Utils . isEmptyOrWhitespaces ( this . componentName ) ) result . add ( error ( ErrorCode . CMD_MISSING_COMPONENT_NAME ) ) ; else if ( this . component == null ) result . add ( error ( ErrorCode . CMD_INEXISTING_COMPONENT , component ( this . componentName ) ) ) ; else if ( ! this . component . getAncestors ( ) . isEmpty ( ) ) { Instance resolvedParentInstance ; if ( this . parentInstancePath == null ) result . add ( error ( ErrorCode . CMD_MISSING_PARENT_INSTANCE ) ) ; else if ( ( resolvedParentInstance = this . context . resolveInstance ( this . parentInstancePath ) ) == null ) result . add ( error ( ErrorCode . CMD_NO_MATCHING_INSTANCE , instance ( this . parentInstancePath ) ) ) ; else if ( ! this . component . getAncestors ( ) . contains ( resolvedParentInstance . getComponent ( ) ) ) result . add ( error ( ErrorCode . CMD_NOT_AN_ACCEPTABLE_PARENT , component ( this . componentName ) ) ) ; } else if ( this . parentInstancePath != null ) { result . add ( error ( ErrorCode . CMD_CANNOT_HAVE_ANY_PARENT , component ( this . componentName ) ) ) ; } if ( Utils . isEmptyOrWhitespaces ( this . instanceName ) ) result . add ( error ( ErrorCode . CMD_MISSING_INSTANCE_NAME ) ) ; else if ( ! this . instanceName . matches ( ParsingConstants . PATTERN_FLEX_ID ) ) result . add ( error ( ErrorCode . CMD_INVALID_INSTANCE_NAME , instance ( this . instanceName ) ) ) ; String newInstancePath = ( this . parentInstancePath == null ? "" : this . parentInstancePath ) + "/" + this . instanceName ; if ( this . context . instancePathToComponentName . containsKey ( newInstancePath ) ) result . add ( error ( ErrorCode . CMD_CONFLICTING_INSTANCE_NAME ) ) ; return result ; }
/*
(non-Javadoc)
@see net.roboconf.core.commands.AbstractCommandInstruction#doValidate()