Module: RRT_RUBY::RRTDeployment::DeploymentFinderModule

Included in:
DeploymentFinder, RRT_RUBY::RRTFinder
Defined in:
lib/rrt_ruby/rrt_deployment.rb

Overview

Adds functionality for querying deployment view elements.

Instance Method Summary collapse

Instance Method Details

#find_deployment_package(package_name, debug = false) ⇒ Object

This will return the first deployment package matching the name nil if no deployment package is found if no fully qualified name is provided, then the first match is returned



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/rrt_ruby/rrt_deployment.rb', line 73

def find_deployment_package package_name,debug=false
	#get the simple package name
	splitted=package_name.split("::")
	simple_name=splitted[splitted.size-1] unless splitted.size==0
	#get a collection with all the packages with the same name
	col=@model.FindModelElements(simple_name)
	count=col.Count
	$stdout.puts "There are #{count} packages named #{simple_name}" if debug
	1.upto(count){|i|
		obj=col.GetAt(i)
		#match the first if no qualified name is given
		return obj if package_name==simple_name&&obj.Name==simple_name && obj.IsClass("DeploymentPackage")
		#match the qualified name
		return obj if obj.GetQualifiedName==package_name && obj.IsClass("DeploymentPackage")
	}
	return nil
end

#processors(root_package, debug = false) ⇒ Object

delivers all processors under the defined package. If the parameter does not correspond to a deployment view package it will return an empty array



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rrt_ruby/rrt_deployment.rb', line 56

def processors root_package,debug=false
	components=Array.new
	#first of all find the package in the model
	pkg= find_deployment_package(root_package,debug)
	begin 
		comps=pkg.GetAllProcessors
		$stdout.puts("There are #{comps.Count} processors under #{pkg.GetQualifiedName}") if debug
		cnt=comps.Count
		1.upto(cnt){|i|
			components<<Processor.new(comps.GetAt(i))
		}
	end if pkg
	return components
end