Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 368356
Collapse All | Expand All

(-)a/.gitignore (+1 lines)
Lines 17-19 Link Here
17
bitset_test
17
bitset_test
18
rangeset_test
18
rangeset_test
19
testaif
19
testaif
20
/.project
(-)a/core/org.eclipse.ptp.proxy/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-7 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp.proxy
4
Bundle-SymbolicName: org.eclipse.ptp.proxy
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %pluginProvider
6
Bundle-Vendor: %pluginProvider
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
(-)a/core/org.eclipse.ptp.remote.remotetools.ui/src/org/eclipse/ptp/remote/remotetools/ui/RemoteToolsUIFileManager.java (+3 lines)
Lines 39-44 Link Here
39
				connection, shell, RemoteResourceBrowser.SINGLE);
39
				connection, shell, RemoteResourceBrowser.SINGLE);
40
		browser.setType(RemoteResourceBrowser.DIRECTORY_BROWSER);
40
		browser.setType(RemoteResourceBrowser.DIRECTORY_BROWSER);
41
		browser.setInitialPath(filterPath);
41
		browser.setInitialPath(filterPath);
42
		browser.setTitle(message);
42
		browser.showConnections(showConnections);
43
		browser.showConnections(showConnections);
43
		if (browser.open() == Window.CANCEL) {
44
		if (browser.open() == Window.CANCEL) {
44
			return null;
45
			return null;
Lines 64-69 Link Here
64
				connection, shell, RemoteResourceBrowser.SINGLE);
65
				connection, shell, RemoteResourceBrowser.SINGLE);
65
		browser.setType(RemoteResourceBrowser.FILE_BROWSER);
66
		browser.setType(RemoteResourceBrowser.FILE_BROWSER);
66
		browser.setInitialPath(filterPath);
67
		browser.setInitialPath(filterPath);
68
		browser.setTitle(message);
67
		browser.showConnections(showConnections);
69
		browser.showConnections(showConnections);
68
		if (browser.open() == Window.CANCEL) {
70
		if (browser.open() == Window.CANCEL) {
69
			return null;
71
			return null;
Lines 89-94 Link Here
89
				connection, shell, RemoteResourceBrowser.MULTI);
91
				connection, shell, RemoteResourceBrowser.MULTI);
90
		browser.setType(RemoteResourceBrowser.FILE_BROWSER);
92
		browser.setType(RemoteResourceBrowser.FILE_BROWSER);
91
		browser.setInitialPath(filterPath);
93
		browser.setInitialPath(filterPath);
94
		browser.setTitle(message);
92
		browser.showConnections(showConnections);
95
		browser.showConnections(showConnections);
93
		if (browser.open() == Window.CANCEL) {
96
		if (browser.open() == Window.CANCEL) {
94
			return null;
97
			return null;
(-)a/core/org.eclipse.ptp.utils/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-7 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp.utils
4
Bundle-SymbolicName: org.eclipse.ptp.utils
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %pluginProvider
6
Bundle-Vendor: %pluginProvider
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
(-)a/debug/org.eclipse.ptp.debug.sdm/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp.debug.sdm
4
Bundle-SymbolicName: org.eclipse.ptp.debug.sdm
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %pluginProvider
6
Bundle-Vendor: %pluginProvider
7
Require-Bundle: org.eclipse.ptp.proxy,
7
Require-Bundle: org.eclipse.ptp.proxy,
8
 org.eclipse.ptp.utils
8
 org.eclipse.ptp.utils
(-)a/pom.xml (+6 lines)
Lines 16-21 Link Here
16
		<tycho-version>0.13.0</tycho-version>
16
		<tycho-version>0.13.0</tycho-version>
17
		<eclipse-release>indigo</eclipse-release>
17
		<eclipse-release>indigo</eclipse-release>
18
		<eclipse-site>http://download.eclipse.org/releases/${eclipse-release}</eclipse-site>
18
		<eclipse-site>http://download.eclipse.org/releases/${eclipse-release}</eclipse-site>
19
		<photran-site>file://home/data/httpd/download.eclipse.org/tools/ptp/builds/hudson/ptp-photran-release</photran-site>
19
	</properties>
20
	</properties>
20
21
21
	<licenses>
22
	<licenses>
Lines 196-201 Link Here
196
			<url>${eclipse-site}</url>
197
			<url>${eclipse-site}</url>
197
			<layout>p2</layout>
198
			<layout>p2</layout>
198
		</repository>
199
		</repository>
200
		<repository>
201
			<id>photran</id>
202
			<url>${photran-site}</url>
203
			<layout>p2</layout>
204
		</repository>
199
	</repositories>
205
	</repositories>
200
206
201
	<pluginRepositories>
207
	<pluginRepositories>
(-)a/rdt/org.eclipse.ptp.rdt.core.remotejars/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Remotejars
3
Bundle-Name: Remotejars
4
Bundle-SymbolicName: org.eclipse.ptp.rdt.core.remotejars
4
Bundle-SymbolicName: org.eclipse.ptp.rdt.core.remotejars
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Require-Bundle: org.eclipse.ptp.rdt.core;bundle-version="1.1.0",
6
Require-Bundle: org.eclipse.ptp.rdt.core;bundle-version="1.1.0",
7
 org.eclipse.ptp.rdt.make.ui;bundle-version="1.1.0",
7
 org.eclipse.ptp.rdt.make.ui;bundle-version="1.1.0",
8
 org.eclipse.ptp.rdt.managedbuilder.xlc.ui;bundle-version="3.0.0",
8
 org.eclipse.ptp.rdt.managedbuilder.xlc.ui;bundle-version="3.0.0",
(-)a/rdt/org.eclipse.ptp.rdt.core.remotejars/pom.xml (-1 / +1 lines)
Lines 10-16 Link Here
10
	</parent>
10
	</parent>
11
11
12
	<artifactId>org.eclipse.ptp.rdt.core.remotejars</artifactId>
12
	<artifactId>org.eclipse.ptp.rdt.core.remotejars</artifactId>
13
	<version>5.0.4-SNAPSHOT</version>
13
	<version>5.0.5-SNAPSHOT</version>
14
	<packaging>eclipse-plugin</packaging>
14
	<packaging>eclipse-plugin</packaging>
15
15
16
	<profiles>
16
	<profiles>
(-)a/releng/org.eclipse.ptp-feature/pom.xml (-1 / +1 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <groupId>org.eclipse.ptp.features</groupId>
12
  <artifactId>org.eclipse.ptp</artifactId>
13
  <artifactId>org.eclipse.ptp</artifactId>
13
  <version>5.0.5-SNAPSHOT</version>
14
  <version>5.0.5-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.aix.ppc/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %fragmentName.aix.ppc
3
Bundle-Name: %fragmentName.aix.ppc
4
Bundle-SymbolicName: org.eclipse.ptp.aix.ppc;singleton:=true
4
Bundle-SymbolicName: org.eclipse.ptp.aix.ppc;singleton:=true
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Bundle-Vendor: %pluginProvider
8
Bundle-Vendor: %pluginProvider
(-)a/releng/org.eclipse.ptp.core-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.core</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.core</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.etfw-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.etfw</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.etfw</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.etfw.ppw-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.etfw.ppw</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.etfw.ppw</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.etfw.tau-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.etfw.tau</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.etfw.tau</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.etfw.tau.fortran-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.etfw.tau.fortran</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.etfw.tau.fortran</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.external-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.external</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.external</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.gem-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.gem</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.gem</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.linux.ppc/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %fragmentName.linux.ppc
3
Bundle-Name: %fragmentName.linux.ppc
4
Bundle-SymbolicName: org.eclipse.ptp.linux.ppc;singleton:=true
4
Bundle-SymbolicName: org.eclipse.ptp.linux.ppc;singleton:=true
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Bundle-Vendor: %pluginProvider
8
Bundle-Vendor: %pluginProvider
(-)a/releng/org.eclipse.ptp.linux.x86/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %fragmentName.linux.x86
3
Bundle-Name: %fragmentName.linux.x86
4
Bundle-SymbolicName: org.eclipse.ptp.linux.x86;singleton:=true
4
Bundle-SymbolicName: org.eclipse.ptp.linux.x86;singleton:=true
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Bundle-Vendor: %pluginProvider
8
Bundle-Vendor: %pluginProvider
(-)a/releng/org.eclipse.ptp.linux.x86_64/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %fragmentName.linux.x86_64
3
Bundle-Name: %fragmentName.linux.x86_64
4
Bundle-SymbolicName: org.eclipse.ptp.linux.x86_64;singleton:=true
4
Bundle-SymbolicName: org.eclipse.ptp.linux.x86_64;singleton:=true
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Bundle-Vendor: %pluginProvider
8
Bundle-Vendor: %pluginProvider
(-)a/releng/org.eclipse.ptp.macosx.ppc/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %fragmentName.macosx.ppc
3
Bundle-Name: %fragmentName.macosx.ppc
4
Bundle-SymbolicName: org.eclipse.ptp.macosx.ppc;singleton:=true
4
Bundle-SymbolicName: org.eclipse.ptp.macosx.ppc;singleton:=true
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Bundle-Vendor: %pluginProvider
8
Bundle-Vendor: %pluginProvider
(-)a/releng/org.eclipse.ptp.macosx.x86/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %fragmentName.macosx.x86
3
Bundle-Name: %fragmentName.macosx.x86
4
Bundle-SymbolicName: org.eclipse.ptp.macosx.x86;singleton:=true
4
Bundle-SymbolicName: org.eclipse.ptp.macosx.x86;singleton:=true
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
6
Fragment-Host: org.eclipse.ptp.core;bundle-version="2.0.0"
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Bundle-Vendor: %pluginProvider
8
Bundle-Vendor: %pluginProvider
(-)a/releng/org.eclipse.ptp.pldt-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.pldt</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.pldt</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.pldt.fortran-feature/pom.xml (-3 / +3 lines)
Lines 10-17 Link Here
10
    <relativePath>../../pom.xml</relativePath>
10
    <relativePath>../../pom.xml</relativePath>
11
  </parent>
11
  </parent>
12
12
13
  <artifactId>org.eclipse.ptp.pldt.fortran</artifactId>
14
  <version>5.0.4-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
  <groupId>org.eclipse.ptp.features</groupId>
13
  <groupId>org.eclipse.ptp.features</groupId>
14
  <artifactId>org.eclipse.ptp.pldt.fortran</artifactId>
15
  <version>5.0.5-SNAPSHOT</version>
16
  <packaging>eclipse-feature</packaging>
17
</project>
17
</project>
(-)a/releng/org.eclipse.ptp.pldt.lapi-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.pldt.lapi</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.pldt.lapi</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.pldt.upc-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.pldt.upc</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.pldt.upc</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rdt-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rdt</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rdt</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rdt.remotejars-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rdt.remotejars</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rdt.remotejars</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rdt.remotetools-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rdt.remotetools</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rdt.remotetools</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rdt.sync-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rdt.sync</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rdt.sync</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rdt.sync.fortran-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rdt.sync.fortran</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rdt.sync.fortran</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rdt.xlc-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rdt.xlc</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rdt.xlc</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.remote-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.remote</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.remote</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.remote.remotetools-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.remote.remotetools</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.remote.remotetools</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.remote.rse-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.remote.rse</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.remote.rse</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.remotetools-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.remotetools</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.remotetools</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.repo/fixPom.xsl (+3 lines)
Lines 67-72 Link Here
67
	<xsl:template match="p:version[preceding-sibling::p:artifactId='org.eclipse.ptp']">
67
	<xsl:template match="p:version[preceding-sibling::p:artifactId='org.eclipse.ptp']">
68
		<version><xsl:value-of select="$newVersion"/>-SNAPSHOT</version>
68
		<version><xsl:value-of select="$newVersion"/>-SNAPSHOT</version>
69
	</xsl:template>
69
	</xsl:template>
70
	<xsl:template match="p:version[preceding-sibling::p:artifactId='org.eclipse.ptp.rdt.remotejars']">
71
		<version><xsl:value-of select="$newVersion"/>-SNAPSHOT</version>
72
	</xsl:template>
70
73
71
	<xsl:template match="@*|node()">
74
	<xsl:template match="@*|node()">
72
		<xsl:copy>
75
		<xsl:copy>
(-)a/releng/org.eclipse.ptp.repo/update_versions (+27 lines)
Lines 57-72 Link Here
57
	org.eclipse.ptp.services-feature \
57
	org.eclipse.ptp.services-feature \
58
	org.eclipse.ptp.utils-feature"
58
	org.eclipse.ptp.utils-feature"
59
59
60
PTP_PLUGINS="\
61
	releng/org.eclipse.ptp.aix.ppc \
62
	releng/org.eclipse.ptp.linux.ppc \
63
	releng/org.eclipse.ptp.linux.x86 \
64
	releng/org.eclipse.ptp.linux.x86_64 \
65
	releng/org.eclipse.ptp.macosx.ppc \
66
	releng/org.eclipse.ptp.macosx.x86 \
67
	releng/org.eclipse.ptp \
68
	debug/org.eclipse.ptp.debug.sdm \
69
	core/org.eclipse.ptp.utils \
70
	core/org.eclipse.ptp.proxy \
71
	rms/org.eclipse.ptp.rm.ibm.pe.proxy \
72
	rms/org.eclipse.ptp.rm.ibm.ll.proxy \
73
	rms/org.eclipse.ptp.rm.slurm.proxy \
74
	tools/sci/org.eclipse.ptp.sci \
75
	rdt/org.eclipse.ptp.rdt.core.remotejars"
76
	
60
update_feature() {
77
update_feature() {
61
	sed -e "s/^\([ \t]*\)version=\"[0-9]\.[0-9]\.[0-9]\.qualifier\"/\1version=\"$2\.qualifier\"/" < releng/$1/feature.xml > $TMP_DIR/${1}_feature.xml
78
	sed -e "s/^\([ \t]*\)version=\"[0-9]\.[0-9]\.[0-9]\.qualifier\"/\1version=\"$2\.qualifier\"/" < releng/$1/feature.xml > $TMP_DIR/${1}_feature.xml
62
	mv $TMP_DIR/${1}_feature.xml releng/$1/feature.xml
79
	mv $TMP_DIR/${1}_feature.xml releng/$1/feature.xml
63
}
80
}
64
81
82
update_manifest() {
83
	sed -e "s/^Bundle-Version: *[0-9]\.[0-9]\.[0-9]\.qualifier/Bundle-Version: $2.qualifier/" < $1/META-INF/MANIFEST.MF > $TMP_DIR/${1}_MANIFEST.MF
84
	mv $TMP_DIR/${1}_MANIFEST.MF $1/META-INF/MANIFEST.MF
85
}
86
65
for feature in $PTP_FEATURES; do
87
for feature in $PTP_FEATURES; do
66
	echo "Updating $feature..."
88
	echo "Updating $feature..."
67
	update_feature $feature $ptp_version
89
	update_feature $feature $ptp_version
68
done
90
done
69
91
92
for plugin in $PTP_PLUGINS; do
93
	echo "Updating $plugin..."
94
	update_manifest $plugin $ptp_version
95
done
96
70
(cd releng/org.eclipse.ptp.repo && ant -DnewVersion="$ptp_version" -f fixModules.xml)
97
(cd releng/org.eclipse.ptp.repo && ant -DnewVersion="$ptp_version" -f fixModules.xml)
71
98
72
exit 0
99
exit 0
(-)a/releng/org.eclipse.ptp.rm.ibm.ll-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.ibm.ll</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.ibm.ll</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.ibm.pe-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.ibm.pe</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.ibm.pe</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.jaxb-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.jaxb</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.jaxb</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.jaxb.contrib-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.jaxb.contrib</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.jaxb.contrib</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.jaxb.pbs-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.jaxb.pbs</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.jaxb.pbs</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.lml-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.lml</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.lml</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.lml_jaxb-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.lml_jaxb</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.lml_jaxb</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.mpich2-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.mpich2</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.mpich2</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.openmpi-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.openmpi</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.openmpi</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.rm.slurm-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.rm.slurm</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.rm.slurm</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.sci-feature/pom.xml (-1 / +1 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <groupId>org.eclipse.ptp.features</groupId>
12
  <artifactId>org.eclipse.ptp.sci</artifactId>
13
  <artifactId>org.eclipse.ptp.sci</artifactId>
13
  <version>5.0.5-SNAPSHOT</version>
14
  <version>5.0.5-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.sdk-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.sdk</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.sdk</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.sdm-feature/pom.xml (-1 / +1 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <groupId>org.eclipse.ptp.features</groupId>
12
  <artifactId>org.eclipse.ptp.debug.sdm</artifactId>
13
  <artifactId>org.eclipse.ptp.debug.sdm</artifactId>
13
  <version>5.0.5-SNAPSHOT</version>
14
  <version>5.0.5-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.services-feature/pom.xml (-3 / +3 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <artifactId>org.eclipse.ptp.services</artifactId>
13
  <version>5.0.4-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
12
  <groupId>org.eclipse.ptp.features</groupId>
13
  <artifactId>org.eclipse.ptp.services</artifactId>
14
  <version>5.0.5-SNAPSHOT</version>
15
  <packaging>eclipse-feature</packaging>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp.utils-feature/pom.xml (-1 / +1 lines)
Lines 9-16 Link Here
9
    <relativePath>../../pom.xml</relativePath>
9
    <relativePath>../../pom.xml</relativePath>
10
  </parent>
10
  </parent>
11
11
12
  <groupId>org.eclipse.ptp.features</groupId>
12
  <artifactId>org.eclipse.ptp.utils</artifactId>
13
  <artifactId>org.eclipse.ptp.utils</artifactId>
13
  <version>5.0.5-SNAPSHOT</version>
14
  <version>5.0.5-SNAPSHOT</version>
14
  <packaging>eclipse-feature</packaging>
15
  <packaging>eclipse-feature</packaging>
15
  <groupId>org.eclipse.ptp.features</groupId>
16
</project>
16
</project>
(-)a/releng/org.eclipse.ptp/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-7 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp
4
Bundle-SymbolicName: org.eclipse.ptp
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %providerName
6
Bundle-Vendor: %providerName
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
(-)a/rms/org.eclipse.ptp.rm.ibm.ll.proxy/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp.rm.ibm.ll.proxy
4
Bundle-SymbolicName: org.eclipse.ptp.rm.ibm.ll.proxy
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Localization: plugin
6
Bundle-Localization: plugin
7
Bundle-Vendor: %pluginProvider
7
Bundle-Vendor: %pluginProvider
8
Require-Bundle: org.eclipse.ptp.proxy,
8
Require-Bundle: org.eclipse.ptp.proxy,
(-)a/rms/org.eclipse.ptp.rm.ibm.pe.proxy/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp.rm.ibm.pe.proxy
4
Bundle-SymbolicName: org.eclipse.ptp.rm.ibm.pe.proxy
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %pluginProvider
6
Bundle-Vendor: %pluginProvider
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Require-Bundle: org.eclipse.ptp.proxy,
8
Require-Bundle: org.eclipse.ptp.proxy,
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/ILMLCoreConstants.java (+227 lines)
Lines 18-27 Link Here
18
18
19
	public static final int UNDEFINED = -1;
19
	public static final int UNDEFINED = -1;
20
20
21
	public static final int COPY_BUFFER_SIZE = 64 * 1024;
22
	public static final int STREAM_BUFFER_SIZE = 8 * 1024;
23
	public static final int EOF = -1;
24
	public static final long MINUTE_IN_MS = 60 * 60 * 1000;
25
	public static final long VALIDATE_TIMER = 500;
26
	public static final long STANDARD_WAIT = 1000;
27
	public static final int READY_FILE_BLOCK = 60;
28
29
	/* CHARACTERS */
30
	public static final String LEN = "N";//$NON-NLS-1$
31
	public static final String ZEROSTR = "";//$NON-NLS-1$
32
	public static final String TAB = "\t"; //$NON-NLS-1$
33
	public static final String SP = " ";//$NON-NLS-1$
34
	public static final String EQ = "=";//$NON-NLS-1$
35
	public static final String QT = "\"";//$NON-NLS-1$
36
	public static final String QM = "?";//$NON-NLS-1$
37
	public static final String PD = "#";//$NON-NLS-1$
38
	public static final String PDRX = "[#]";//$NON-NLS-1$
39
	public static final String CM = ",";//$NON-NLS-1$
40
	public static final String CO = ":";//$NON-NLS-1$
41
	public static final String SC = ";";//$NON-NLS-1$
42
	public static final String LT = "<"; //$NON-NLS-1$
43
	public static final String LTS = "</";//$NON-NLS-1$
44
	public static final String GT = ">";//$NON-NLS-1$
45
	public static final String GTLT = "><";//$NON-NLS-1$
46
	public static final String HYPH = "-";//$NON-NLS-1$
47
	public static final String AT = "@";//$NON-NLS-1$
48
	public static final String DOL = "$";//$NON-NLS-1$
49
	public static final String PIP = "|";//$NON-NLS-1$
50
	public static final String REGPIP = "[|]";//$NON-NLS-1$
51
	public static final String DOT = ".";//$NON-NLS-1$
52
	public static final String Z3 = "000";//$NON-NLS-1$
53
	public static final String OPENP = "(";//$NON-NLS-1$
54
	public static final String OPENSQ = "[";//$NON-NLS-1$
55
	public static final String OPENV = "${";//$NON-NLS-1$
56
	public static final String OPENVRM = "${rm:";//$NON-NLS-1$
57
	public static final String OPENVLT = "${lt:";//$NON-NLS-1$
58
	public static final String VRM = "rm:";//$NON-NLS-1$
59
	public static final String VLC = "lc:";//$NON-NLS-1$
60
	public static final String CLOSP = ")";//$NON-NLS-1$
61
	public static final String CLOSSQ = "]";//$NON-NLS-1$
62
	public static final String CLOSV = "}";//$NON-NLS-1$
63
	public static final String CLOSVAL = "#value}";//$NON-NLS-1$
64
	public static final String BKESC = "\\\\";//$NON-NLS-1$
65
	public static final String BKBKESC = "\\\\\\\\";//$NON-NLS-1$
66
	public static final String DLESC = "\\$";//$NON-NLS-1$
67
	public static final String DLESCESC = "\\\\\\$";//$NON-NLS-1$
68
	public static final String SPESC = "\\\\s";//$NON-NLS-1$
69
	public static final String LNSEPESC = "\\\\n";//$NON-NLS-1$
70
	public static final String TBESC = "\\t";//$NON-NLS-1$
71
	public static final String TBESCESC = "\\\\t";//$NON-NLS-1$
72
	public static final String LNESC = "\\n";//$NON-NLS-1$
73
	public static final String RTESC = "\\r";//$NON-NLS-1$
74
	public static final String LINE_SEP = System.getProperty("line.separator"); //$NON-NLS-1$
75
	public static final String REMOTE_LINE_SEP = "\n"; //$NON-NLS-1$
76
	public static final String REMOTE_PATH_SEP = "/"; //$NON-NLS-1$
77
	public static final String PATH_SEP = System.getProperty("file.separator"); //$NON-NLS-1$
78
79
	/* KEY WORDS */
80
	public static final String TRUE = "true";//$NON-NLS-1$
81
	public static final String FALSE = "false";//$NON-NLS-1$
82
	public static final String YES = "yes";//$NON-NLS-1$
83
	public static final String NO = "no";//$NON-NLS-1$
84
	public static final String NOT = "not";//$NON-NLS-1$
85
	public static final String OR = "or";//$NON-NLS-1$
86
	public static final String AND = "and";//$NON-NLS-1$
87
	public static final String xEQ = "EQ";//$NON-NLS-1$
88
	public static final String xLT = "LT";//$NON-NLS-1$
89
	public static final String xGT = "GT";//$NON-NLS-1$
90
	public static final String xLE = "LE";//$NON-NLS-1$
91
	public static final String xGE = "GE";//$NON-NLS-1$
92
	public static final String GET = "get";//$NON-NLS-1$
93
	public static final String SET = "set";//$NON-NLS-1$
94
	public static final String IS = "is";//$NON-NLS-1$
95
	public static final String CLASS = "class";//$NON-NLS-1$
96
	public static final String STRING = "string";//$NON-NLS-1$
97
	public static final String NAME = "name";//$NON-NLS-1$
98
	public static final String VALUE = "value";//$NON-NLS-1$
99
	public static final String BASIC = "basic";//$NON-NLS-1$
100
	public static final String CHOICE = "choice";//$NON-NLS-1$
101
	public static final String sDEFAULT = "default";//$NON-NLS-1$
102
	public static final String DESC = "description";//$NON-NLS-1$
103
	public static final String MAX = "max";//$NON-NLS-1$
104
	public static final String MIN = "min";//$NON-NLS-1$
105
	public static final String READONLY = "readOnly";//$NON-NLS-1$
106
	public static final String STATUS = "status";//$NON-NLS-1$
107
	public static final String TOOLTIP = "tooltip";//$NON-NLS-1$
108
	public static final String TYPE = "type";//$NON-NLS-1$
109
	public static final String VALIDATOR = "validator";//$NON-NLS-1$
110
	public static final String SELECTED = "visible";//$NON-NLS-1$
111
	public static final String LOCAL = "local";//$NON-NLS-1$
112
	public static final String JOB_ID_TAG = "@jobId";//$NON-NLS-1$
113
	public static final String NAME_TAG = AT + NAME;
114
	public static final String VALUE_TAG = AT + VALUE;
115
116
	/* TYPE MATCHING */
117
	public static final String NT = "nt";//$NON-NLS-1$
118
	public static final String BOOL = "bool";//$NON-NLS-1$
119
	public static final String ET = "et";//$NON-NLS-1$
120
	public static final String IST = "ist";//$NON-NLS-1$
121
	public static final String ECTOR = "ector";//$NON-NLS-1$
122
123
	/* STANDARD PROPERTIES */
124
	public static final String ID = "id";//$NON-NLS-1$
125
	public static final String JAVA_USER_HOME = "user.home";//$NON-NLS-1$
126
	public static final String JAVA_TMP_DIR = "java.io.tmpdir";//$NON-NLS-1$
127
	public static final String FILE_SCHEME = "file";//$NON-NLS-1$
128
	public static final String XMLSchema = "http://www.w3.org/2001/XMLSchema"; //$NON-NLS-1$
129
	public static final String SCHEMA = "schema/"; //$NON-NLS-1$
130
	public static final String RM_XSD = SCHEMA + "lgui.xsd";//$NON-NLS-1$
131
	public static final String JAXB = "JAXB";//$NON-NLS-1$
132
	public static final String JAXB_CONTEXT = "org.eclipse.ptp.rm.jaxb.core.data";//$NON-NLS-1$
133
	public static final String RM_CONFIG_PROPS = "rm_configurations.properties";//$NON-NLS-1$
134
	public static final String RM_XSD_PATH = "rm_schema_path";//$NON-NLS-1$
135
	public static final String RM_XSD_URL = "rm_schema_url";//$NON-NLS-1$
136
	public static final String PREV_RM_XSD_PATH = "prev_rm_schema_path";//$NON-NLS-1$
137
	public static final String EXTERNAL_RM_XSD_PATHS = "external_rm_schema_paths";//$NON-NLS-1$
138
	public static final String CHECKED_ATTRIBUTES = "checked_attributes";//$NON-NLS-1$
139
	public static final String SHOW_ONLY_CHECKED = "show_only_checked";//$NON-NLS-1$
140
	public static final String IS_PRESET = "is_preset";//$NON-NLS-1$
141
	public static final String SCRIPT_PATH = "script_path";//$NON-NLS-1$
142
	public static final String SCRIPT = "script";//$NON-NLS-1$
143
	public static final String SCRIPT_FILE = "managed_file_for_script";//$NON-NLS-1$
144
	public static final String CSH = "csh";//$NON-NLS-1$
145
	public static final String SH = ".sh";//$NON-NLS-1$
146
	public static final String SETENV = "setenv";//$NON-NLS-1$
147
	public static final String EXPORT = "export";//$NON-NLS-1$
148
	public static final String DATE_FORMAT = "yyyy/MM/dd HH:mm:ss";//$NON-NLS-1$
149
150
	public static final String RESOURCE_MANAGERS = "resourceManagers";//$NON-NLS-1$
151
	public static final String CUSTOM = "custom";//$NON-NLS-1$
152
	public static final String CONTROL_USER_NAME = "controlUserName";//$NON-NLS-1$
153
	public static final String MONITOR_USER_NAME = "monitorUserName";//$NON-NLS-1$
154
	public static final String CONTROL_CONNECTION_NAME = "controlConnectionName";//$NON-NLS-1$
155
	public static final String MONITOR_CONNECTION_NAME = "monitorConnectionName";//$NON-NLS-1$
156
	public static final String LOCALHOST = "localhost";//$NON-NLS-1$
157
	public static final String CONTROL_PATH = "controlPath"; //$NON-NLS-1$
158
	public static final String MONITOR_PATH = "monitorPath"; //$NON-NLS-1$
159
	public static final String CONTROL_OPTIONS = "controlOptions"; //$NON-NLS-1$
160
	public static final String MONITOR_OPTIONS = "monitorOptions"; //$NON-NLS-1$
161
	public static final String CONTROL_INVOCATION_OPTIONS = "controlInvocationOptions"; //$NON-NLS-1$
162
	public static final String MONITOR_INVOCATION_OPTIONS = "monitorInvocationOptions"; //$NON-NLS-1$
163
	public static final String CONTROL_ADDRESS = "controlAddress"; //$NON-NLS-1$
164
	public static final String LOCAL_ADDRESS = "localAddress"; //$NON-NLS-1$
165
	public static final String MONITOR_ADDRESS = "monitorAddress"; //$NON-NLS-1$
166
	public static final String CONTROL_USER_VAR = "control.user.name";//$NON-NLS-1$
167
	public static final String CONTROL_ADDRESS_VAR = "control.address";//$NON-NLS-1$
168
	public static final String MONITOR_USER_VAR = "monitor.user.name";//$NON-NLS-1$
169
	public static final String MONITOR_ADDRESS_VAR = "monitor.address";//$NON-NLS-1$
170
	public static final String ARPA = ".in-addr.arpa";//$NON-NLS-1$
171
	public static final String ECLIPSESETTINGS = ".eclipsesettings";//$NON-NLS-1$
172
	public static final String DEBUG_PACKAGE = "org.eclipse.debug";//$NON-NLS-1$
173
	public static final String PTP_PACKAGE = "org.eclipse.ptp";//$NON-NLS-1$
174
175
	//	public static final String STARTUP = "OnStartUp";//$NON-NLS-1$
176
	//	public static final String SHUTDOWN = "OnShutDown";//$NON-NLS-1$
177
	//	public static final String DISCATTR = "DiscoverAttributes";//$NON-NLS-1$
178
	//	public static final String JOBSTATUS = "GetJobStatus";//$NON-NLS-1$
179
	//	public static final String VALIDATE = "ValidateJob";//$NON-NLS-1$
180
181
	public static final String JOB_ATTRIBUTE = "jobAttribute";//$NON-NLS-1$
182
	public static final String ATTRIBUTE = "attribute";//$NON-NLS-1$
183
	public static final String PROPERTY = "property";//$NON-NLS-1$
184
	public static final String QUEUES = "available_queues";//$NON-NLS-1$
185
	public static final String JOB_ID = "job_id";//$NON-NLS-1$
186
	public static final String RM_ID = "rm_id";//$NON-NLS-1$
187
	public static final String STDOUT_REMOTE_FILE = "stdout_remote_path";//$NON-NLS-1$
188
	public static final String STDERR_REMOTE_FILE = "stderr_remote_path";//$NON-NLS-1$
189
	public static final String EXEC_PATH = "executablePath";//$NON-NLS-1$
190
	public static final String PROG_ARGS = "progArgs";//$NON-NLS-1$
191
	public static final String DIRECTORY = "directory";//$NON-NLS-1$
192
	public static final String MPI_CMD = "mpiCommand";//$NON-NLS-1$
193
	public static final String MPI_ARGS = "mpiArgs";//$NON-NLS-1$
194
195
	public static final String CASE_INSENSITIVE = "CASE_INSENSITIVE";//$NON-NLS-1$
196
	public static final String MULTILINE = "MULTILINE";//$NON-NLS-1$
197
	public static final String DOTALL = "DOTALL";//$NON-NLS-1$
198
	public static final String UNICODE_CASE = "UNICODE_CASE";//$NON-NLS-1$
199
	public static final String CANON_EQ = "CANON_EQ";//$NON-NLS-1$
200
	public static final String LITERAL = "LITERAL";//$NON-NLS-1$
201
	public static final String COMMENTS = "COMMENTS";//$NON-NLS-1$
202
203
	public static final String DOT_XML = ".xml";//$NON-NLS-1$
204
	public static final String TOKENIZER_EXT_PT = "streamParserTokenizer";//$NON-NLS-1$
205
	public static final String TAIL = "tail";//$NON-NLS-1$
206
	public static final String MINUS_F = "-F";//$NON-NLS-1$
207
	public static final String CONFIGURATION_FILE_ATTRIBUTE = "configurationFile"; //$NON-NLS-1$
208
	public static final String RM_CONFIG_EXTENSION_POINT = "org.eclipse.ptp.rm.jaxb.core.JAXBResourceManagerConfigurations"; //$NON-NLS-1$
209
	public static final String IMPORTED_JAXB_CONFIG = "org.eclipse.ptp.rm.jaxb.ImportedConfigurations"; //$NON-NLS-1$
210
	/*
211
	 * EFS Attributes
212
	 */
213
	public static final String ATTRIBUTE_READ_ONLY = "ATTRIBUTE_READ_ONLY";//$NON-NLS-1$
214
	public static final String ATTRIBUTE_IMMUTABLE = "ATTRIBUTE_IMMUTABLE";//$NON-NLS-1$
215
	public static final String ATTRIBUTE_OWNER_READ = "ATTRIBUTE_OWNER_READ";//$NON-NLS-1$
216
	public static final String ATTRIBUTE_OWNER_WRITE = "ATTRIBUTE_OWNER_WRITE";//$NON-NLS-1$
217
	public static final String ATTRIBUTE_OWNER_EXECUTE = "ATTRIBUTE_OWNER_EXECUTE";//$NON-NLS-1$
218
	public static final String ATTRIBUTE_GROUP_READ = "ATTRIBUTE_GROUP_READ";//$NON-NLS-1$
219
	public static final String ATTRIBUTE_GROUP_WRITE = "ATTRIBUTE_GROUP_WRITE";//$NON-NLS-1$
220
	public static final String ATTRIBUTE_GROUP_EXECUTE = "ATTRIBUTE_GROUP_EXECUTE";//$NON-NLS-1$
221
	public static final String ATTRIBUTE_OTHER_READ = "ATTRIBUTE_OTHER_READ";//$NON-NLS-1$
222
	public static final String ATTRIBUTE_OTHER_WRITE = "ATTRIBUTE_OTHER_WRITE";//$NON-NLS-1$
223
	public static final String ATTRIBUTE_OTHER_EXECUTE = "ATTRIBUTE_OTHER_EXECUTE";//$NON-NLS-1$
224
	public static final String ATTRIBUTE_EXECUTABLE = "ATTRIBUTE_EXECUTABLE";//$NON-NLS-1$
225
	public static final String ATTRIBUTE_ARCHIVE = "ATTRIBUTE_ARCHIVE";//$NON-NLS-1$
226
	public static final String ATTRIBUTE_HIDDEN = "ATTRIBUTE_HIDDEN";//$NON-NLS-1$
227
	public static final String ATTRIBUTE_SYMLINK = "ATTRIBUTE_SYMLINK";//$NON-NLS-1$
228
	public static final String ATTRIBUTE_LINK_TARGET = "ATTRIBUTE_LINK_TARGET";//$NON-NLS-1$
229
230
	/*
231
	 * IRemoteProcessBuilder
232
	 */
233
	public static final String TAG_NONE = "NONE";//$NON-NLS-1$
234
	public static final String TAG_ALLOCATE_PTY = "ALLOCATE_PTY";//$NON-NLS-1$
235
	public static final String TAG_FORWARD_X11 = "FORWARD_X11";//$NON-NLS-1$
236
21
	/*
237
	/*
22
	 * Element keywords
238
	 * Element keywords
23
	 */
239
	 */
24
	public static String INCLUDE_ELEMENT = "include"; //$NON-NLS-1$
240
	public static String INCLUDE_ELEMENT = "include"; //$NON-NLS-1$
25
	public static String TABLE_ELEMENT = "table"; //$NON-NLS-1$
241
	public static String TABLE_ELEMENT = "table"; //$NON-NLS-1$
242
	public static String USAGEBAR_ELEMENT = "usagebar"; //$NON-NLS-1$
243
	public static String TEXT_ELEMENT = "text"; //$NON-NLS-1$
244
	public static String INFOBOX_ELEMENT = "infobox"; //$NON-NLS-1$
245
	public static String CHART_ELEMENT = "chart"; //$NON-NLS-1$
246
	public static String CHARTGROUP_ELEMENT = "chartgroup"; //$NON-NLS-1$
247
	public static String NODEDISPLAY_ELEMENT = "nodedisplay"; //$NON-NLS-1$
248
	public static String ABSLAYOUT_ELEMENT = "abslayout"; //$NON-NLS-1$
249
	public static String SPLITLAYOUT_ELEMENT = "splitlayout"; //$NON-NLS-1$
250
	public static String TABLELAYOUT_ELEMENT = "tablelayout"; //$NON-NLS-1$
251
	public static String COMPONENTLAYOUT_ELEMENT = "componentlayout"; //$NON-NLS-1$
252
	public static String NODEDISPLAYLAYOUT_ELEMENT = "nodedisplaylayout"; //$NON-NLS-1$
26
	public static String TITLE_PREFIX = "title_"; //$NON-NLS-1$
253
	public static String TITLE_PREFIX = "title_"; //$NON-NLS-1$
27
}
254
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/LMLCorePlugin.java (-98 / +16 lines)
Lines 21-46 Link Here
21
 *******************************************************************************/
21
 *******************************************************************************/
22
package org.eclipse.ptp.rm.lml.core;
22
package org.eclipse.ptp.rm.lml.core;
23
23
24
import java.net.MalformedURLException;
24
import java.io.File;
25
import java.io.IOException;
25
import java.net.URL;
26
import java.net.URL;
26
import java.util.MissingResourceException;
27
import java.util.MissingResourceException;
27
import java.util.ResourceBundle;
28
import java.util.ResourceBundle;
28
29
29
import javax.xml.XMLConstants;
30
import org.eclipse.core.runtime.FileLocator;
30
import javax.xml.bind.JAXBContext;
31
import javax.xml.bind.JAXBException;
32
import javax.xml.bind.Marshaller;
33
import javax.xml.bind.Unmarshaller;
34
import javax.xml.validation.Schema;
35
import javax.xml.validation.SchemaFactory;
36
37
import org.eclipse.core.runtime.IStatus;
31
import org.eclipse.core.runtime.IStatus;
32
import org.eclipse.core.runtime.Path;
38
import org.eclipse.core.runtime.Plugin;
33
import org.eclipse.core.runtime.Plugin;
39
import org.eclipse.core.runtime.Status;
34
import org.eclipse.core.runtime.Status;
40
import org.eclipse.ptp.rm.lml.core.messages.Messages;
35
import org.eclipse.ptp.rm.lml.core.messages.Messages;
41
import org.eclipse.ptp.rm.lml.core.util.DebugUtil;
36
import org.eclipse.ptp.rm.lml.core.util.DebugUtil;
37
import org.osgi.framework.Bundle;
42
import org.osgi.framework.BundleContext;
38
import org.osgi.framework.BundleContext;
43
import org.xml.sax.SAXException;
44
39
45
public class LMLCorePlugin extends Plugin {
40
public class LMLCorePlugin extends Plugin {
46
	public static final String PLUGIN_ID = "org.eclipse.ptp.rm.lml.core"; //$NON-NLS-1$
41
	public static final String PLUGIN_ID = "org.eclipse.ptp.rm.lml.core"; //$NON-NLS-1$
Lines 48-68 Link Here
48
	// The shared instance.
43
	// The shared instance.
49
	private static LMLCorePlugin fPlugin;
44
	private static LMLCorePlugin fPlugin;
50
45
51
	/*
52
	 * Unmarshaller for JAXB-generator
53
	 */
54
	private static Unmarshaller unmarshaller;
55
56
	/*
57
	 * Marshaller for JAXB-model
58
	 */
59
	private static Marshaller marshaller;
60
61
	/**
46
	/**
62
	 * Returns the shared instance.
47
	 * Returns the shared instance.
63
	 */
48
	 */
64
	public static LMLCorePlugin getDefault() {
49
	public static LMLCorePlugin getDefault() {
65
		return fPlugin;
50
		return fPlugin;
51
	}
52
53
	public static URL getResource(String resource) throws IOException {
54
		URL url = null;
55
		if (getDefault() != null) {
56
			final Bundle bundle = getDefault().getBundle();
57
			url = FileLocator.find(bundle, new Path(ILMLCoreConstants.PATH_SEP + resource), null);
58
		} else {
59
			url = new File(resource).toURI().toURL();
60
		}
61
		return url;
66
	}
62
	}
67
63
68
	/**
64
	/**
Lines 144-187 Link Here
144
	}
140
	}
145
141
146
	/**
142
	/**
147
	 * Get the JAXB marshaller
148
	 * 
149
	 * @return the JAXB marshaller
150
	 */
151
	public Marshaller getMarshaller() {
152
		if (marshaller == null) {
153
			try {
154
				createMarshaller();
155
			} catch (final JAXBException e) {
156
				log(e);
157
			}
158
		}
159
		return marshaller;
160
	}
161
162
	/**
163
	 * Returns the plugin's resource bundle,
143
	 * Returns the plugin's resource bundle,
164
	 */
144
	 */
165
	public ResourceBundle getResourceBundle() {
145
	public ResourceBundle getResourceBundle() {
166
		return resourceBundle;
146
		return resourceBundle;
167
	}
168
169
	/**
170
	 * Get the JAXB unmarshaller.
171
	 * 
172
	 * @return the JAXB unmarshaller
173
	 */
174
	public Unmarshaller getUnmarshaller() {
175
		if (unmarshaller == null) {
176
			try {
177
				createUnmarshaller();
178
			} catch (final JAXBException e) {
179
				log(e);
180
			} catch (final MalformedURLException e) {
181
				log(e);
182
			}
183
		}
184
		return unmarshaller;
185
	}
147
	}
186
148
187
	/**
149
	/**
Lines 190-196 Link Here
190
	@Override
152
	@Override
191
	public void start(BundleContext context) throws Exception {
153
	public void start(BundleContext context) throws Exception {
192
		super.start(context);
154
		super.start(context);
193
		createUnmarshaller();
194
		DebugUtil.configurePluginDebugOptions();
155
		DebugUtil.configurePluginDebugOptions();
195
	}
156
	}
196
157
Lines 204-252 Link Here
204
		} finally {
165
		} finally {
205
			super.stop(context);
166
			super.stop(context);
206
			fPlugin = null;
167
			fPlugin = null;
207
		}
208
	}
209
210
	private void createMarshaller() throws JAXBException {
211
		final JAXBContext jc = JAXBContext.newInstance("org.eclipse.ptp.rm.lml.internal.core.elements", //$NON-NLS-1$
212
				LMLCorePlugin.class.getClassLoader());
213
		marshaller = jc.createMarshaller();
214
	}
215
216
	/**
217
	 * For the generation of instances from classes by JAXB a unmarshaller is
218
	 * needed. In the method the needed unmarshaller is created. It is said
219
	 * where the classes for the instantiation are.
220
	 * 
221
	 * @throws MalformedURLException
222
	 * @throws JAXBException
223
	 */
224
	private void createUnmarshaller() throws MalformedURLException, JAXBException {
225
		final URL xsd = getBundle().getEntry("/schema/lgui.xsd"); //$NON-NLS-1$
226
227
		final JAXBContext jc = JAXBContext.newInstance("org.eclipse.ptp.rm.lml.internal.core.elements", //$NON-NLS-1$
228
				LMLCorePlugin.class.getClassLoader());
229
230
		unmarshaller = jc.createUnmarshaller();
231
232
		// if xsd is null => do not check for validity
233
		if (xsd != null) {
234
235
			Schema mySchema;
236
			final SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
237
238
			try {
239
240
				mySchema = sf.newSchema(xsd);
241
			} catch (final SAXException saxe) {
242
				// ...(error handling)
243
				mySchema = null;
244
245
			}
246
247
			// Connect schema to unmarshaller
248
			unmarshaller.setSchema(mySchema);
249
250
		}
168
		}
251
	}
169
	}
252
170
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/LMLManager.java (-42 / +45 lines)
Lines 13-41 Link Here
13
import java.io.InputStream;
13
import java.io.InputStream;
14
import java.io.OutputStream;
14
import java.io.OutputStream;
15
import java.util.HashMap;
15
import java.util.HashMap;
16
import java.util.List;
16
import java.util.Map;
17
import java.util.Map;
17
18
18
import javax.xml.bind.JAXBException;
19
20
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.ListenerList;
20
import org.eclipse.core.runtime.ListenerList;
23
import org.eclipse.core.runtime.Status;
24
import org.eclipse.ptp.rm.lml.core.events.ILguiAddedEvent;
21
import org.eclipse.ptp.rm.lml.core.events.ILguiAddedEvent;
25
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
22
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
26
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
23
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
27
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
24
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
25
import org.eclipse.ptp.rm.lml.core.events.ITableFilterEvent;
28
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
26
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
29
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
27
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
30
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
28
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
31
import org.eclipse.ptp.rm.lml.core.events.IViewUpdateEvent;
29
import org.eclipse.ptp.rm.lml.core.events.IViewUpdateEvent;
32
import org.eclipse.ptp.rm.lml.core.listeners.ILMLListener;
30
import org.eclipse.ptp.rm.lml.core.listeners.ILMLListener;
33
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
31
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
32
import org.eclipse.ptp.rm.lml.core.model.IPattern;
34
import org.eclipse.ptp.rm.lml.internal.core.elements.RequestType;
33
import org.eclipse.ptp.rm.lml.internal.core.elements.RequestType;
35
import org.eclipse.ptp.rm.lml.internal.core.events.LguiAddedEvent;
34
import org.eclipse.ptp.rm.lml.internal.core.events.LguiAddedEvent;
36
import org.eclipse.ptp.rm.lml.internal.core.events.LguiRemovedEvent;
35
import org.eclipse.ptp.rm.lml.internal.core.events.LguiRemovedEvent;
37
import org.eclipse.ptp.rm.lml.internal.core.events.MarkObjectEvent;
36
import org.eclipse.ptp.rm.lml.internal.core.events.MarkObjectEvent;
38
import org.eclipse.ptp.rm.lml.internal.core.events.SelectObjectEvent;
37
import org.eclipse.ptp.rm.lml.internal.core.events.SelectObjectEvent;
38
import org.eclipse.ptp.rm.lml.internal.core.events.TableFilterEvent;
39
import org.eclipse.ptp.rm.lml.internal.core.events.TableSortedEvent;
39
import org.eclipse.ptp.rm.lml.internal.core.events.TableSortedEvent;
40
import org.eclipse.ptp.rm.lml.internal.core.events.UnmarkObjectEvent;
40
import org.eclipse.ptp.rm.lml.internal.core.events.UnmarkObjectEvent;
41
import org.eclipse.ptp.rm.lml.internal.core.events.UnselectObjectEvent;
41
import org.eclipse.ptp.rm.lml.internal.core.events.UnselectObjectEvent;
Lines 70-76 Link Here
70
	/*
70
	/*
71
	 * A list of all listeners on the ILguiItem
71
	 * A list of all listeners on the ILguiItem
72
	 */
72
	 */
73
	private final ListenerList lmlListeners = new ListenerList();
73
	private final ListenerList viewListeners = new ListenerList();
74
74
75
	/*
75
	/*
76
	 * An instance of this class.
76
	 * An instance of this class.
Lines 84-90 Link Here
84
	}
84
	}
85
85
86
	public void addListener(ILMLListener listener, String view) {
86
	public void addListener(ILMLListener listener, String view) {
87
		lmlListeners.add(listener);
87
		viewListeners.add(listener);
88
	}
88
	}
89
89
90
	public void addUserJob(String name, String jobId, JobStatusData status) {
90
	public void addUserJob(String name, String jobId, JobStatusData status) {
Lines 108-113 Link Here
108
108
109
	}
109
	}
110
110
111
	public void filterLgui(String gid, List<IPattern> filterValues) {
112
		fireFilterLgui(gid, filterValues);
113
	}
114
111
	public String getCurrentLayout(String name) {
115
	public String getCurrentLayout(String name) {
112
		ILguiItem item = null;
116
		ILguiItem item = null;
113
		synchronized (LGUIS) {
117
		synchronized (LGUIS) {
Lines 122-127 Link Here
122
			return string;
126
			return string;
123
		}
127
		}
124
		return null;
128
		return null;
129
	}
130
131
	public Map<String, List<IPattern>> getCurrentPattern(String name) {
132
		ILguiItem item = null;
133
		synchronized (LGUIS) {
134
			item = LGUIS.get(name);
135
		}
136
		if (item != null) {
137
			final Map<String, List<IPattern>> map = item.getPattern();
138
			return map;
139
		}
140
		return new HashMap<String, List<IPattern>>();
125
	}
141
	}
126
142
127
	public ILguiItem getSelectedLguiItem() {
143
	public ILguiItem getSelectedLguiItem() {
Lines 162-173 Link Here
162
	 *            Layout from an earlier Eclipse session
178
	 *            Layout from an earlier Eclipse session
163
	 * @param jobs
179
	 * @param jobs
164
	 *            Array of earlier started jobs
180
	 *            Array of earlier started jobs
181
	 * @param pattern
165
	 */
182
	 */
166
	public void openLgui(String name, RequestType request, StringBuilder layout, JobStatusData[] jobs) {
183
	public void openLgui(String name, String username, RequestType request, StringBuilder layout, JobStatusData[] jobs,
184
			Map<String, List<IPattern>> pattern) {
167
		synchronized (LGUIS) {
185
		synchronized (LGUIS) {
168
			ILguiItem item = LGUIS.get(name);
186
			ILguiItem item = LGUIS.get(name);
169
			if (item == null) {
187
			if (item == null) {
170
				item = new LguiItem(name);
188
				item = new LguiItem(name, username);
171
				LGUIS.put(name, item);
189
				LGUIS.put(name, item);
172
			}
190
			}
173
			fLguiItem = item;
191
			fLguiItem = item;
Lines 175-180 Link Here
175
193
176
		fLguiItem.reloadLastLayout(layout);
194
		fLguiItem.reloadLastLayout(layout);
177
		fLguiItem.setRequest(request);
195
		fLguiItem.setRequest(request);
196
		fLguiItem.setPattern(pattern);
178
		restoreJobStatusData(fLguiItem, jobs);
197
		restoreJobStatusData(fLguiItem, jobs);
179
198
180
		if (!fLguiItem.isEmpty()) {
199
		if (!fLguiItem.isEmpty()) {
Lines 183-189 Link Here
183
	}
202
	}
184
203
185
	public void removeListener(ILMLListener listener) {
204
	public void removeListener(ILMLListener listener) {
186
		lmlListeners.remove(listener);
205
		viewListeners.remove(listener);
187
	}
206
	}
188
207
189
	public void removeUserJob(String name, String jobId) {
208
	public void removeUserJob(String name, String jobId) {
Lines 238-255 Link Here
238
			lguiItem = LGUIS.get(name);
257
			lguiItem = LGUIS.get(name);
239
		}
258
		}
240
		if (lguiItem != null) {
259
		if (lguiItem != null) {
241
			try {
260
			lguiItem.getCurrentLayout(output);
242
				lguiItem.getCurrentLayout(output);
261
			lguiItem.update(input);
243
			} catch (final JAXBException e) {
244
				throw new CoreException(new Status(IStatus.ERROR, LMLCorePlugin.getUniqueIdentifier(), e.getCause()
245
						.getLocalizedMessage()));
246
			}
247
			try {
248
				lguiItem.update(input);
249
			} catch (final JAXBException e) {
250
				throw new CoreException(new Status(IStatus.ERROR, LMLCorePlugin.getUniqueIdentifier(), e.getCause()
251
						.getLocalizedMessage()));
252
			}
253
262
254
			if (fLguiItem == lguiItem) {
263
			if (fLguiItem == lguiItem) {
255
				if (!isDisplayed) {
264
				if (!isDisplayed) {
Lines 273-286 Link Here
273
282
274
	private void fireChangeSelectedObject(String oid) {
283
	private void fireChangeSelectedObject(String oid) {
275
		final ISelectObjectEvent event = new SelectObjectEvent(oid);
284
		final ISelectObjectEvent event = new SelectObjectEvent(oid);
276
		for (final Object listener : lmlListeners.getListeners()) {
285
		for (final Object listener : viewListeners.getListeners()) {
286
			((ILMLListener) listener).handleEvent(event);
287
		}
288
	}
289
290
	private void fireFilterLgui(String gid, List<IPattern> filterValues) {
291
		final ITableFilterEvent event = new TableFilterEvent(gid, filterValues);
292
		for (final Object listener : viewListeners.getListeners()) {
277
			((ILMLListener) listener).handleEvent(event);
293
			((ILMLListener) listener).handleEvent(event);
278
		}
294
		}
279
	}
295
	}
280
296
281
	private void fireMarkObject(String oid) {
297
	private void fireMarkObject(String oid) {
282
		final IMarkObjectEvent event = new MarkObjectEvent(oid);
298
		final IMarkObjectEvent event = new MarkObjectEvent(oid);
283
		for (final Object listener : lmlListeners.getListeners()) {
299
		for (final Object listener : viewListeners.getListeners()) {
284
			((ILMLListener) listener).handleEvent(event);
300
			((ILMLListener) listener).handleEvent(event);
285
		}
301
		}
286
	}
302
	}
Lines 290-296 Link Here
290
	 */
306
	 */
291
	private void fireNewLgui() {
307
	private void fireNewLgui() {
292
		final ILguiAddedEvent event = new LguiAddedEvent();
308
		final ILguiAddedEvent event = new LguiAddedEvent();
293
		for (final Object listener : lmlListeners.getListeners()) {
309
		for (final Object listener : viewListeners.getListeners()) {
294
			((ILMLListener) listener).handleEvent(event);
310
			((ILMLListener) listener).handleEvent(event);
295
		}
311
		}
296
		isDisplayed = true;
312
		isDisplayed = true;
Lines 298-304 Link Here
298
314
299
	private void fireRemovedLgui(ILguiItem title) {
315
	private void fireRemovedLgui(ILguiItem title) {
300
		final ILguiRemovedEvent event = new LguiRemovedEvent();
316
		final ILguiRemovedEvent event = new LguiRemovedEvent();
301
		for (final Object listener : lmlListeners.getListeners()) {
317
		for (final Object listener : viewListeners.getListeners()) {
302
			((ILMLListener) listener).handleEvent(event);
318
			((ILMLListener) listener).handleEvent(event);
303
		}
319
		}
304
		isDisplayed = false;
320
		isDisplayed = false;
Lines 309-336 Link Here
309
	 */
325
	 */
310
	private void fireSortedLgui() {
326
	private void fireSortedLgui() {
311
		final ITableSortedEvent event = new TableSortedEvent(this, fLguiItem);
327
		final ITableSortedEvent event = new TableSortedEvent(this, fLguiItem);
312
		for (final Object listener : lmlListeners.getListeners()) {
328
		for (final Object listener : viewListeners.getListeners()) {
313
			((ILMLListener) listener).handleEvent(event);
329
			((ILMLListener) listener).handleEvent(event);
314
		}
330
		}
315
	}
331
	}
316
332
317
	private void fireUnmarkObject(String oid) {
333
	private void fireUnmarkObject(String oid) {
318
		final IUnmarkObjectEvent event = new UnmarkObjectEvent(oid);
334
		final IUnmarkObjectEvent event = new UnmarkObjectEvent(oid);
319
		for (final Object listener : lmlListeners.getListeners()) {
335
		for (final Object listener : viewListeners.getListeners()) {
320
			((ILMLListener) listener).handleEvent(event);
336
			((ILMLListener) listener).handleEvent(event);
321
		}
337
		}
322
	}
338
	}
323
339
324
	private void fireUnselectObject(String oid) {
340
	private void fireUnselectObject(String oid) {
325
		final IUnselectedObjectEvent event = new UnselectObjectEvent(oid);
341
		final IUnselectedObjectEvent event = new UnselectObjectEvent(oid);
326
		for (final Object listener : lmlListeners.getListeners()) {
342
		for (final Object listener : viewListeners.getListeners()) {
327
			((ILMLListener) listener).handleEvent(event);
343
			((ILMLListener) listener).handleEvent(event);
328
		}
344
		}
329
	}
345
	}
330
346
331
	private void fireUpdatedLgui() {
347
	private void fireUpdatedLgui() {
332
		final IViewUpdateEvent event = new ViewUpdateEvent();
348
		final IViewUpdateEvent event = new ViewUpdateEvent();
333
		for (final Object listener : lmlListeners.getListeners()) {
349
		for (final Object listener : viewListeners.getListeners()) {
334
			((ILMLListener) listener).handleEvent(event);
350
			((ILMLListener) listener).handleEvent(event);
335
		}
351
		}
336
	}
352
	}
Lines 348-364 Link Here
348
			}
364
			}
349
		}
365
		}
350
	}
366
	}
351
352
	// /**
353
	// * @param map
354
	// * @param memento
355
	// * guaranteed by caller to be non-<code>null</code>
356
	// */
357
	// private void saveJobStatusData(ILguiItem item, IMemento memento) {
358
	// for (final JobStatusData status : item.getUserJobs()) {
359
	// if (!status.isRemoved()) {
360
	// status.save(memento);
361
	// }
362
	// }
363
	// }
364
}
367
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/events/ITableFilterEvent.java (+27 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - Initial API and implementation
10
 * 
11
 * Modified by:
12
 * 		Claudia Knobloch, Forschungszentrum Juelich GmbH
13
 *******************************************************************************/
14
15
package org.eclipse.ptp.rm.lml.core.events;
16
17
import java.util.List;
18
19
import org.eclipse.ptp.rm.lml.core.model.IPattern;
20
21
public interface ITableFilterEvent {
22
23
	public String getGid();
24
25
	public List<IPattern> getPattern();
26
27
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/listeners/ILMLListener.java (-2 / +5 lines)
Lines 12-17 Link Here
12
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
12
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
13
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
13
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
14
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
14
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
15
import org.eclipse.ptp.rm.lml.core.events.ITableFilterEvent;
15
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
16
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
16
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
17
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
17
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
18
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
Lines 30-42 Link Here
30
31
31
	public void handleEvent(ISelectObjectEvent event);
32
	public void handleEvent(ISelectObjectEvent event);
32
33
34
	public void handleEvent(ITableFilterEvent event);
35
33
	/**
36
	/**
34
	 * Handles an IJobListSortedEevnt.
37
	 * Handles an IJobListSortedEevnt.
35
	 * 
38
	 * 
36
	 * @param e
39
	 * @param event
37
	 *            an IJobListSortedEvent
40
	 *            an IJobListSortedEvent
38
	 */
41
	 */
39
	public void handleEvent(ITableSortedEvent e);
42
	public void handleEvent(ITableSortedEvent event);
40
43
41
	public void handleEvent(IUnmarkObjectEvent event);
44
	public void handleEvent(IUnmarkObjectEvent event);
42
45
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/model/ILguiHandler.java (+10 lines)
Lines 12-15 Link Here
12
package org.eclipse.ptp.rm.lml.core.model;
12
package org.eclipse.ptp.rm.lml.core.model;
13
13
14
public interface ILguiHandler {
14
public interface ILguiHandler {
15
	/*
16
	 * Mandatory table fields
17
	 */
18
	public static String JOB_ID = "step"; //$NON-NLS-1$
19
	public static String JOB_OWNER = "owner"; //$NON-NLS-1$
20
	public static String JOB_STATUS = "status"; //$NON-NLS-1$
21
	public static String JOB_QUEUE_NAME = "queue"; //$NON-NLS-1$
22
23
	public static String ACTIVE_JOB_TABLE = "joblistrun"; //$NON-NLS-1$
24
	public static String INACTIVE_JOB_TABLE = "joblistwait"; //$NON-NLS-1$
15
}
25
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/model/ILguiItem.java (-18 / +16 lines)
Lines 12-17 Link Here
12
12
13
import java.io.InputStream;
13
import java.io.InputStream;
14
import java.io.OutputStream;
14
import java.io.OutputStream;
15
import java.util.List;
16
import java.util.Map;
15
17
16
import javax.xml.bind.JAXBException;
18
import javax.xml.bind.JAXBException;
17
19
Lines 77-88 Link Here
77
	 */
79
	 */
78
	public void addUserJob(String jobId, JobStatusData status, boolean force);
80
	public void addUserJob(String jobId, JobStatusData status, boolean force);
79
81
82
	public String[] getColumnTitlePattern(String gid);
83
80
	/**
84
	/**
81
	 * The meth
85
	 * The meth
82
	 * 
86
	 * 
83
	 * @param output
87
	 * @param output
84
	 */
88
	 */
85
	public void getCurrentLayout(OutputStream output) throws JAXBException;
89
	public void getCurrentLayout(OutputStream output);
86
90
87
	/**
91
	/**
88
	 * @return
92
	 * @return
Lines 114-119 Link Here
114
	 */
118
	 */
115
	public OverviewAccess getOverviewAccess();
119
	public OverviewAccess getOverviewAccess();
116
120
121
	public Map<String, List<IPattern>> getPattern();
122
123
	public List<IPattern> getPattern(String gid);
124
117
	/**
125
	/**
118
	 * @return
126
	 * @return
119
	 */
127
	 */
Lines 129-134 Link Here
129
	 * @return
137
	 * @return
130
	 */
138
	 */
131
	public JobStatusData[] getUserJobs();
139
	public JobStatusData[] getUserJobs();
140
141
	public String getUsername();
132
142
133
	/**
143
	/**
134
	 * Getting the version of the LguiType:
144
	 * Getting the version of the LguiType:
Lines 157-171 Link Here
157
167
158
	/**
168
	/**
159
	 * 
169
	 * 
160
	 * @param memento
170
	 * @param layout
161
	 */
171
	 */
162
	public void reloadLastLayout(StringBuilder layout);
172
	public void reloadLastLayout(StringBuilder layout);
163
164
	// /**
165
	// *
166
	// * @param memento
167
	// */
168
	// public void reloadLastLayout(IMemento memento);
169
173
170
	/**
174
	/**
171
	 * @param name
175
	 * @param name
Lines 179-193 Link Here
179
	 */
183
	 */
180
	public String saveCurrentLayout();
184
	public String saveCurrentLayout();
181
185
182
	// /**
186
	public void setPattern(Map<String, List<IPattern>> pattern);
183
	// * The Resource Manager is being closed. The current layout of the
187
184
	// different
188
	public void setPattern(String gid, List<IPattern> filterValues);
185
	// * monitoring parts should be saved during the closing.
186
	// *
187
	// * @param memento
188
	// * Memento in which the current layout should be saved
189
	// */
190
	// public void saveCurrentLayout(IMemento memento);
191
189
192
	public void setRequest(RequestType request);
190
	public void setRequest(RequestType request);
193
191
Lines 203-209 Link Here
203
	 * @param stream
201
	 * @param stream
204
	 * @throws JAXBException
202
	 * @throws JAXBException
205
	 */
203
	 */
206
	public void update(InputStream stream) throws JAXBException;
204
	public void update(InputStream stream);
207
205
208
	/**
206
	/**
209
	 * @param name
207
	 * @param name
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/model/IPattern.java (+34 lines)
Added Link Here
1
/**
2
 * Copyright (c) 2011 Forschungszentrum Juelich GmbH
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 * 		Claudia Knobloch, FZ Juelich
10
 */
11
package org.eclipse.ptp.rm.lml.core.model;
12
13
public interface IPattern {
14
15
	public String getColumnTitle();
16
17
	public String getMaxValueRange();
18
19
	public String getMinValueRange();
20
21
	public String getRelationOperator();
22
23
	public String getType();
24
25
	public String getRelationValue();
26
27
	public boolean isRange();
28
29
	public boolean isRelation();
30
31
	public IPattern setRange(String minValueRange, String maxValueRange);
32
33
	public IPattern setRelation(String relationOperator, String valueRelation);
34
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/model/ITableColumnLayout.java (+2 lines)
Lines 25-30 Link Here
25
	public static String COLUMN_TYPE_MANDATORY = "mandatory"; //$NON-NLS-1$
25
	public static String COLUMN_TYPE_MANDATORY = "mandatory"; //$NON-NLS-1$
26
	public static String COLUMN_TYPE_OPTIONAL = "optional"; //$NON-NLS-1$
26
	public static String COLUMN_TYPE_OPTIONAL = "optional"; //$NON-NLS-1$
27
27
28
	public String getOrder();
29
28
	/**
30
	/**
29
	 * Getting the style (LEFT or RIGHT) of the column.
31
	 * Getting the style (LEFT or RIGHT) of the column.
30
	 * 
32
	 * 
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/core/util/JAXBUtil.java (+552 lines)
Added Link Here
1
package org.eclipse.ptp.rm.lml.core.util;
2
3
import java.io.IOException;
4
import java.io.OutputStream;
5
import java.io.StringReader;
6
import java.io.StringWriter;
7
import java.math.BigInteger;
8
import java.net.URISyntaxException;
9
import java.net.URL;
10
import java.util.ArrayList;
11
import java.util.HashSet;
12
import java.util.List;
13
14
import javax.xml.bind.JAXBContext;
15
import javax.xml.bind.JAXBElement;
16
import javax.xml.bind.JAXBException;
17
import javax.xml.bind.Marshaller;
18
import javax.xml.bind.PropertyException;
19
import javax.xml.bind.Unmarshaller;
20
import javax.xml.namespace.QName;
21
import javax.xml.transform.Source;
22
import javax.xml.transform.stream.StreamSource;
23
import javax.xml.validation.Schema;
24
import javax.xml.validation.SchemaFactory;
25
import javax.xml.validation.Validator;
26
27
import org.eclipse.ptp.rm.lml.core.ILMLCoreConstants;
28
import org.eclipse.ptp.rm.lml.core.LMLCorePlugin;
29
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
30
import org.eclipse.ptp.rm.lml.internal.core.elements.AbslayoutType;
31
import org.eclipse.ptp.rm.lml.internal.core.elements.ChartType;
32
import org.eclipse.ptp.rm.lml.internal.core.elements.ChartgroupType;
33
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnType;
34
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentType;
35
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentlayoutType;
36
import org.eclipse.ptp.rm.lml.internal.core.elements.DataType;
37
import org.eclipse.ptp.rm.lml.internal.core.elements.GobjectType;
38
import org.eclipse.ptp.rm.lml.internal.core.elements.InfoboxType;
39
import org.eclipse.ptp.rm.lml.internal.core.elements.LayoutType;
40
import org.eclipse.ptp.rm.lml.internal.core.elements.LguiType;
41
import org.eclipse.ptp.rm.lml.internal.core.elements.Nodedisplay;
42
import org.eclipse.ptp.rm.lml.internal.core.elements.NodedisplaylayoutType;
43
import org.eclipse.ptp.rm.lml.internal.core.elements.ObjectFactory;
44
import org.eclipse.ptp.rm.lml.internal.core.elements.PaneType;
45
import org.eclipse.ptp.rm.lml.internal.core.elements.PatternMatchType;
46
import org.eclipse.ptp.rm.lml.internal.core.elements.PatternType;
47
import org.eclipse.ptp.rm.lml.internal.core.elements.SchemeType;
48
import org.eclipse.ptp.rm.lml.internal.core.elements.SplitlayoutType;
49
import org.eclipse.ptp.rm.lml.internal.core.elements.TableType;
50
import org.eclipse.ptp.rm.lml.internal.core.elements.TablelayoutType;
51
import org.eclipse.ptp.rm.lml.internal.core.elements.TextboxType;
52
import org.eclipse.ptp.rm.lml.internal.core.elements.UsagebarType;
53
import org.eclipse.ptp.rm.lml.internal.core.model.LguiItem;
54
import org.xml.sax.SAXException;
55
import org.xml.sax.SAXParseException;
56
57
public class JAXBUtil {
58
59
	private static JAXBUtil jaxbUtil;
60
61
	private static Unmarshaller unmarshaller;
62
63
	private static Marshaller marshaller;
64
65
	private static String JAXB_CLASSES = "org.eclipse.ptp.rm.lml.internal.core.elements";//$NON-NLS-1$
66
67
	private static String SCHEMA_LOCATION = "jaxb.schemaLocation";//$NON-NLS-1$
68
	private static String SCHEMA_FILE = "lgui.xsd";//$NON-NLS-1$
69
	private static String SCHEMA_LGUI = "lgui";//$NON-NLS-1$
70
	private static String SCHEMA_LML = "lml";//$NON-NLS-1$
71
	private static String SCHEMA_DIRECTORY = "http://www.llview.de";//$NON-NLS-1$
72
73
	private static Validator validator;
74
75
	public static JAXBUtil getInstance() {
76
		if (jaxbUtil == null) {
77
			jaxbUtil = new JAXBUtil();
78
		}
79
		return jaxbUtil;
80
	}
81
82
	/**
83
	 * Take a graphical object and minimize the data so that this instance is
84
	 * valid against the LML-Schema but at the same time as small as possible.
85
	 * 
86
	 * @param gobject
87
	 * @return a copy of gobj with minimal size, only attributes in GobjectType
88
	 *         are copied and lower special elements which are needed to make
89
	 *         lml-model valid
90
	 */
91
	@SuppressWarnings("unchecked")
92
	public static JAXBElement<GobjectType> minimizeGobjectType(
93
			GobjectType gobject, ObjectFactory objectFactory) {
94
95
		String qName = null;
96
		GobjectType value = null;
97
98
		if (gobject instanceof TableType) {
99
			value = objectFactory.createTableType();
100
			final TableType origin = (TableType) gobject;
101
			((TableType) value).setContenttype(origin.getContenttype());
102
			// copy all columns with pattern to table
103
			for (final ColumnType column : origin.getColumn()) {
104
				if (column.getPattern() != null) {
105
					((TableType) value).getColumn().add(column);
106
				}
107
			}
108
109
			qName = ILMLCoreConstants.TABLE_ELEMENT;
110
		} else if (gobject instanceof UsagebarType) {
111
			value = objectFactory.createUsagebarType();
112
113
			((UsagebarType) value).setCpucount(BigInteger.valueOf(0));
114
115
			qName = ILMLCoreConstants.USAGEBAR_ELEMENT;
116
		} else if (gobject instanceof TextboxType) {
117
			value = objectFactory.createTextboxType();
118
			((TextboxType) value).setText(ILMLCoreConstants.ZEROSTR);
119
120
			qName = ILMLCoreConstants.TEXT_ELEMENT;
121
		} else if (gobject instanceof InfoboxType) {
122
			value = objectFactory.createInfoboxType();
123
124
			qName = ILMLCoreConstants.INFOBOX_ELEMENT;
125
		} else if (gobject instanceof Nodedisplay) {
126
			value = objectFactory.createNodedisplay();
127
			final SchemeType scheme = objectFactory.createSchemeType();
128
			scheme.getEl1().add(objectFactory.createSchemeElement1());
129
			((Nodedisplay) value).setScheme(scheme);
130
131
			final DataType dat = objectFactory.createDataType();
132
			dat.getEl1().add(objectFactory.createDataElement1());
133
			((Nodedisplay) value).setData(dat);
134
135
			qName = ILMLCoreConstants.NODEDISPLAY_ELEMENT;
136
		} else if (gobject instanceof ChartType) {
137
			value = objectFactory.createChartType();
138
139
			qName = ILMLCoreConstants.CHART_ELEMENT;
140
		} else if (gobject instanceof ChartgroupType) {
141
			final ChartgroupType chartgroupType = objectFactory
142
					.createChartgroupType();
143
			// Add lower chart-elements to the minimized chart-group
144
			// Go through all charts minimize them and add them to ut
145
			for (final ChartType chart : ((ChartgroupType) gobject).getChart()) {
146
				final ChartType minimal = (ChartType) (minimizeGobjectType(
147
						chart, objectFactory).getValue());
148
				chartgroupType.getChart().add(minimal);
149
			}
150
151
			value = chartgroupType;
152
153
			qName = ILMLCoreConstants.CHARTGROUP_ELEMENT;
154
		}
155
156
		value.setDescription(gobject.getDescription());
157
		value.setId(gobject.getId());
158
		value.setTitle(gobject.getTitle());
159
160
		return new JAXBElement<GobjectType>(new QName(qName),
161
				(Class<GobjectType>) gobject.getClass(), value);
162
	}
163
164
	/**
165
	 * Replace a global layout within the lml-model by a new one
166
	 * 
167
	 * @param newLayout
168
	 *            new layout, which replaces the old in model with the same id
169
	 * @param lgui
170
	 *            lgui-instance, which is changed
171
	 */
172
	@SuppressWarnings("unchecked")
173
	public static void replaceGlobalLayout(LguiType newLayout, LguiType lgui) {
174
175
		for (final JAXBElement<?> layout : newLayout
176
				.getObjectsAndRelationsAndInformation()) {
177
			if (layout.getValue() instanceof LayoutType) {
178
				boolean replaced = false;
179
				for (final JAXBElement<?> object : lgui
180
						.getObjectsAndRelationsAndInformation()) {
181
					if (object.getValue() instanceof LayoutType) {
182
						if (((LayoutType) object.getValue()).getId().equals(
183
								((LayoutType) layout.getValue()).getId())) {
184
							((JAXBElement<LayoutType>) object)
185
									.setValue((LayoutType) layout.getValue());
186
							replaced = true;
187
							break;
188
						}
189
					}
190
				}
191
				if (!replaced) {
192
					lgui.getObjectsAndRelationsAndInformation().add(layout);
193
				}
194
			}
195
		}
196
	}
197
198
	/**
199
	 * Search for gid-attributes of a pane and put it into neededComponents
200
	 * Recursively search all graphical objects referenced by this pane
201
	 * 
202
	 * @param pane
203
	 *            part of SplitLayout, which is scanned for gid-attributes
204
	 * @param components
205
	 *            resulting Hashset
206
	 */
207
	private static void collectComponents(PaneType pane, HashSet<String> components) {
208
209
		if (pane.getGid() != null) {
210
			components.add(pane.getGid());
211
		} else {
212
			// top and bottom components?
213
			if (pane.getBottom() != null) {
214
				collectComponents(pane.getBottom(), components);
215
				collectComponents(pane.getTop(), components);
216
			} else {// Left and right
217
				collectComponents(pane.getLeft(), components);
218
				collectComponents(pane.getRight(), components);
219
			}
220
		}
221
222
	}
223
224
	/**
225
	 * * Uses the ResourceManagerData schema.
226
	 * 
227
	 * @return static singleton
228
	 * @throws IOException
229
	 * @throws SAXException
230
	 */
231
	@SuppressWarnings("unused")
232
	private synchronized static Validator getValidator() throws IOException, SAXException {
233
		if (validator == null) {
234
235
			final URL xsd = LMLCorePlugin.getResource(ILMLCoreConstants.RM_XSD);
236
			final SchemaFactory factory = SchemaFactory.newInstance(ILMLCoreConstants.XMLSchema);
237
			final Schema schema = factory.newSchema(xsd);
238
			validator = schema.newValidator();
239
		}
240
		return validator;
241
	}
242
243
	private static void validate(Source source) throws SAXException, IOException, URISyntaxException {
244
		try {
245
			getValidator().validate(source);
246
		} catch (final SAXParseException sax) {
247
			throw sax;
248
		}
249
	}
250
251
	private JAXBUtil() {
252
		jaxbUtil = this;
253
		try {
254
			final JAXBContext jaxbContext = JAXBContext.newInstance(JAXB_CLASSES);
255
			marshaller = jaxbContext.createMarshaller();
256
			unmarshaller = jaxbContext.createUnmarshaller();
257
258
		} catch (final JAXBException e) {
259
			marshaller = null;
260
			unmarshaller = null;
261
			// TODO Error Message?
262
		}
263
	}
264
265
	public void addComponentLayoutElement(LguiType lgui,
266
			ComponentlayoutType component) {
267
		if (component instanceof TablelayoutType) {
268
			lgui.getObjectsAndRelationsAndInformation()
269
					.add(new JAXBElement<TablelayoutType>(new QName(
270
							ILMLCoreConstants.TABLELAYOUT_ELEMENT),
271
							TablelayoutType.class, (TablelayoutType) component));
272
		} else if (component instanceof NodedisplaylayoutType) {
273
			lgui.getObjectsAndRelationsAndInformation().add(
274
					new JAXBElement<NodedisplaylayoutType>(new QName(
275
							ILMLCoreConstants.NODEDISPLAYLAYOUT_ELEMENT),
276
							NodedisplaylayoutType.class,
277
							(NodedisplaylayoutType) component));
278
		} else {
279
			lgui.getObjectsAndRelationsAndInformation().add(
280
					new JAXBElement<ComponentlayoutType>(new QName(
281
							ILMLCoreConstants.COMPONENTLAYOUT_ELEMENT),
282
							ComponentlayoutType.class, component));
283
		}
284
	}
285
286
	public void addLayoutElement(LguiType lgui, Object object) {
287
		if (object instanceof SplitlayoutType) {
288
			lgui.getObjectsAndRelationsAndInformation().add(
289
					new JAXBElement<SplitlayoutType>(new QName(
290
							ILMLCoreConstants.SPLITLAYOUT_ELEMENT),
291
							SplitlayoutType.class, (SplitlayoutType) object));
292
		} else if (object instanceof AbslayoutType) {
293
			lgui.getObjectsAndRelationsAndInformation().add(
294
					new JAXBElement<AbslayoutType>(new QName(
295
							ILMLCoreConstants.ABSLAYOUT_ELEMENT),
296
							AbslayoutType.class, (AbslayoutType) object));
297
		}
298
299
	}
300
301
	/**
302
	 * Add a new created layout to the model
303
	 * 
304
	 * @param layout
305
	 *            absolute or splitlayout
306
	 */
307
	public void addLayoutTag(LguiType lgui, ILguiItem lguiItem,
308
			LayoutType layout) {
309
310
		if (layout.getId() == null) {
311
			layout.setId(ILMLCoreConstants.ZEROSTR);
312
		}
313
314
		JAXBElement<? extends LayoutType> jaxbElement = null;
315
		// Create jaxbelement corresponding to the class-type
316
		if (layout instanceof AbslayoutType) {
317
318
			final AbslayoutType absLayout = (AbslayoutType) layout;
319
320
			jaxbElement = new JAXBElement<AbslayoutType>(new QName(
321
					ILMLCoreConstants.ABSLAYOUT_ELEMENT), AbslayoutType.class,
322
					absLayout);
323
324
		} else if (layout instanceof SplitlayoutType) {
325
326
			final SplitlayoutType splitLayout = (SplitlayoutType) layout;
327
328
			jaxbElement = new JAXBElement<SplitlayoutType>(new QName(
329
					ILMLCoreConstants.SPLITLAYOUT_ELEMENT),
330
					SplitlayoutType.class, splitLayout);
331
332
		} else {
333
			return;
334
		}
335
336
		lgui.getObjectsAndRelationsAndInformation().add(jaxbElement);
337
338
		lguiItem.notifyListeners();
339
340
	}
341
342
	public void addPatternInclude(PatternType pattern,
343
			PatternMatchType patternMatch) {
344
		pattern.getIncludeAndExclude().add(
345
				new JAXBElement<PatternMatchType>(new QName(
346
						ILMLCoreConstants.INCLUDE_ELEMENT),
347
						PatternMatchType.class, patternMatch));
348
	}
349
350
	public void addTable(LguiType lgui, TableType table) {
351
		lgui.getObjectsAndRelationsAndInformation().add(
352
				new JAXBElement<TableType>(new QName(
353
						ILMLCoreConstants.TABLE_ELEMENT), TableType.class,
354
						table));
355
	}
356
357
	public void getLayoutComponents(LguiType result, LguiType lgui, HashSet<String> components) {
358
359
		for (final JAXBElement<?> element : lgui.getObjectsAndRelationsAndInformation()) {
360
361
			final Object object = element.getValue();
362
363
			if (object instanceof LayoutType) {
364
				if (object instanceof SplitlayoutType) {
365
					lgui.getObjectsAndRelationsAndInformation().add(element);
366
				} else if (object instanceof AbslayoutType) {
367
					lgui.getObjectsAndRelationsAndInformation().add(element);
368
				}
369
370
				if (object instanceof SplitlayoutType) {
371
					if (((SplitlayoutType) object).getLeft() != null) {
372
						collectComponents(((SplitlayoutType) object).getLeft(), components);
373
						collectComponents(((SplitlayoutType) object).getRight(), components);
374
					}
375
				} else if (object instanceof AbslayoutType) {
376
					for (final ComponentType component : ((AbslayoutType) object).getComp()) {
377
						components.add(component.getGid());
378
					}
379
				}
380
			} else if (object instanceof ComponentlayoutType) {
381
				if (((ComponentlayoutType) object).isActive()) {
382
					addComponentLayoutElement(result, (ComponentlayoutType) object);
383
					components.add(((ComponentlayoutType) object).getGid());
384
				}
385
			}
386
		}
387
	}
388
389
	public ArrayList<Object> getObjects(LguiType lgui) {
390
		final ArrayList<Object> list = new ArrayList<Object>();
391
		for (final JAXBElement<?> element : lgui
392
				.getObjectsAndRelationsAndInformation()) {
393
			list.add(element.getValue());
394
		}
395
		return list;
396
	}
397
398
	public void marshal(LguiType lgui, OutputStream output) {
399
		try {
400
			marshaller.setProperty(SCHEMA_LOCATION, SCHEMA_DIRECTORY + SCHEMA_FILE);
401
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
402
			final QName tagname = new QName(SCHEMA_DIRECTORY, SCHEMA_LGUI, SCHEMA_LML);
403
404
			final JAXBElement<LguiType> rootElement = new JAXBElement<LguiType>(
405
					tagname, LguiType.class, lgui);
406
			/*
407
			 * Synchronize to avoid the dreaded
408
			 * "FWK005 parse may not be called while parsing" message
409
			 */
410
			synchronized (LguiItem.class) {
411
				marshaller.marshal(rootElement, output);
412
			}
413
			output.close(); // Must close to flush stream
414
		} catch (final PropertyException e) {
415
			// TODO ErrorMessage
416
		} catch (final IOException e) {
417
			// TODO ErrorMessage
418
		} catch (final JAXBException e) {
419
			// TODO ErrorMessage
420
		}
421
	}
422
423
	public void marshal(LguiType lgui, StringWriter writer) {
424
		try {
425
			marshaller.setProperty(SCHEMA_LOCATION, SCHEMA_DIRECTORY + SCHEMA_FILE);
426
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
427
			final QName tagname = new QName(SCHEMA_DIRECTORY, SCHEMA_LGUI, SCHEMA_LML);
428
429
			final JAXBElement<LguiType> rootElement = new JAXBElement<LguiType>(
430
					tagname, LguiType.class, lgui);
431
			/*
432
			 * Synchronize to avoid the dreaded
433
			 * "FWK005 parse may not be called while parsing" message
434
			 */
435
			synchronized (LguiItem.class) {
436
				marshaller.marshal(rootElement, writer);
437
			}
438
439
		} catch (final PropertyException e) {
440
			// TODO ErrorMessage
441
		} catch (final JAXBException e) {
442
			// TODO ErrorMessage
443
		}
444
	}
445
446
	/**
447
	 * Replace all componentlayouts for a graphical object with given gid
448
	 * through newlayout.getGid() with newlayout
449
	 * 
450
	 * @param newLayout
451
	 *            new layout, which is placed into the positions of old layouts
452
	 */
453
	@SuppressWarnings("unchecked")
454
	public void replaceComponentLayout(LguiType lgui, ILguiItem lguiItem, ComponentlayoutType newLayout) {
455
		if (newLayout == null) {
456
			return;
457
		}
458
		final List<JAXBElement<?>> objects = lgui.getObjectsAndRelationsAndInformation();
459
460
		boolean replaced = false;
461
462
		// Over all objects in lml-file
463
		for (int i = 0; i < objects.size(); i++) {
464
			final JAXBElement<?> object = objects.get(i);
465
466
			// Over all Componentlayouts
467
			if (object.getValue() instanceof ComponentlayoutType) {
468
469
				if (((ComponentlayoutType) object.getValue()).getGid() != null
470
						&& ((ComponentlayoutType) object.getValue()).getGid()
471
								.equals(newLayout.getGid())) {
472
473
					if (!replaced) {
474
475
						((JAXBElement<ComponentlayoutType>) object)
476
								.setValue(newLayout);
477
						lguiItem.notifyListeners();
478
						replaced = true;
479
					} else {// Delete this object
480
						objects.remove(object);
481
						// One step back
482
						i--;
483
					}
484
				}
485
486
			}
487
		}
488
489
		if (!replaced) {
490
			// Insert new layout, if there was nothing to replace
491
			// Takes any componentlayout
492
			JAXBElement<?> newElement = null;
493
494
			// Differ between several layouts, create different JAXBElements
495
			if (newLayout instanceof TablelayoutType) {
496
				newElement = new JAXBElement<TablelayoutType>(new QName(
497
						ILMLCoreConstants.TABLELAYOUT_ELEMENT),
498
						TablelayoutType.class, (TablelayoutType) newLayout);
499
			} else if (newLayout instanceof NodedisplaylayoutType) {
500
				newElement = new JAXBElement<NodedisplaylayoutType>(new QName(
501
						ILMLCoreConstants.NODEDISPLAYLAYOUT_ELEMENT),
502
						NodedisplaylayoutType.class,
503
						(NodedisplaylayoutType) newLayout);
504
			}
505
506
			if (newElement != null) {
507
				lgui.getObjectsAndRelationsAndInformation().add(newElement);
508
				lguiItem.notifyListeners();
509
			}
510
		}
511
512
	}
513
514
	/**
515
	 * Parsing an XML file. The method generates from an XML file an instance of
516
	 * LguiType.
517
	 * 
518
	 * @param string
519
	 *            String containing the information from the server side
520
	 * @return the generated LguiType
521
	 */
522
	@SuppressWarnings("unchecked")
523
	public LguiType unmarshal(String string) {
524
		/*
525
		 * Synchronize to avoid the dreaded
526
		 * "FWK005 parse may not be called while parsing" message
527
		 */
528
		Source source = new StreamSource(new StringReader(string));
529
		try {
530
			validate(source);
531
		} catch (final SAXException e1) {
532
			// TODO Auto-generated catch block
533
			e1.printStackTrace();
534
		} catch (final IOException e1) {
535
			// TODO Auto-generated catch block
536
			e1.printStackTrace();
537
		} catch (final URISyntaxException e1) {
538
			// TODO Auto-generated catch block
539
			e1.printStackTrace();
540
		}
541
		source = new StreamSource(new StringReader(string));
542
		JAXBElement<LguiType> jaxb = null;
543
		try {
544
			synchronized (LguiItem.class) {
545
				jaxb = (JAXBElement<LguiType>) unmarshaller.unmarshal(source);
546
			}
547
		} catch (final JAXBException e) {
548
			// TODO ErrorMessage
549
		}
550
		return jaxb.getValue();
551
	}
552
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/events/TableFilterEvent.java (+52 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006, 2007 Los Alamos National Security, LLC.
3
 * This material was produced under U.S. Government contract DE-AC52-06NA25396
4
 * for Los Alamos National Laboratory (LANL), which is operated by the Los Alamos
5
 * National Security, LLC (LANS) for the U.S. Department of Energy.  The U.S. Government has
6
 * rights to use, reproduce, and distribute this software. NEITHER THE
7
 * GOVERNMENT NOR LANS MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR
8
 * ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified
9
 * to produce derivative works, such modified software should be clearly marked,
10
 * so as not to confuse it with the version available from LANL.
11
 *
12
 * Additionally, this program and the accompanying materials
13
 * are made available under the terms of the Eclipse Public License v1.0
14
 * which accompanies this distribution, and is available at
15
 * http://www.eclipse.org/legal/epl-v10.html
16
 * 
17
 * Modified by:
18
 * 		Claudia Knobloch, Forschungszentrum Juelich GmbH
19
 *******************************************************************************/
20
21
package org.eclipse.ptp.rm.lml.internal.core.events;
22
23
import java.util.LinkedList;
24
import java.util.List;
25
26
import org.eclipse.ptp.rm.lml.core.events.ITableFilterEvent;
27
import org.eclipse.ptp.rm.lml.core.model.IPattern;
28
29
public class TableFilterEvent implements ITableFilterEvent {
30
31
	private List<IPattern> pattern;
32
33
	private final String gid;
34
35
	public TableFilterEvent(String gid, List<IPattern> pattern) {
36
		this.gid = gid;
37
		if (pattern == null) {
38
			pattern = new LinkedList<IPattern>();
39
		} else {
40
			this.pattern = pattern;
41
		}
42
	}
43
44
	public String getGid() {
45
		return gid;
46
	}
47
48
	public List<IPattern> getPattern() {
49
		return pattern;
50
	}
51
52
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LayoutAccess.java (-544 / +121 lines)
Lines 11-17 Link Here
11
11
12
package org.eclipse.ptp.rm.lml.internal.core.model;
12
package org.eclipse.ptp.rm.lml.internal.core.model;
13
13
14
import java.io.OutputStream;
15
import java.math.BigInteger;
14
import java.math.BigInteger;
16
import java.util.ArrayList;
15
import java.util.ArrayList;
17
import java.util.HashMap;
16
import java.util.HashMap;
Lines 20-58 Link Here
20
import java.util.List;
19
import java.util.List;
21
import java.util.Map;
20
import java.util.Map;
22
21
23
import javax.xml.bind.JAXBContext;
22
import org.eclipse.ptp.rm.lml.core.ILMLCoreConstants;
24
import javax.xml.bind.JAXBElement;
25
import javax.xml.bind.JAXBException;
26
import javax.xml.bind.Marshaller;
27
import javax.xml.namespace.QName;
28
29
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
23
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
30
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
24
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
31
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
25
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
26
import org.eclipse.ptp.rm.lml.core.util.JAXBUtil;
32
import org.eclipse.ptp.rm.lml.internal.core.elements.AbslayoutType;
27
import org.eclipse.ptp.rm.lml.internal.core.elements.AbslayoutType;
33
import org.eclipse.ptp.rm.lml.internal.core.elements.ChartType;
34
import org.eclipse.ptp.rm.lml.internal.core.elements.ChartgroupType;
35
import org.eclipse.ptp.rm.lml.internal.core.elements.ChartlayoutType;
28
import org.eclipse.ptp.rm.lml.internal.core.elements.ChartlayoutType;
36
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnType;
37
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnlayoutType;
29
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnlayoutType;
38
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentType;
30
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentType;
39
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentlayoutType;
31
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentlayoutType;
40
import org.eclipse.ptp.rm.lml.internal.core.elements.DataType;
41
import org.eclipse.ptp.rm.lml.internal.core.elements.GobjectType;
32
import org.eclipse.ptp.rm.lml.internal.core.elements.GobjectType;
42
import org.eclipse.ptp.rm.lml.internal.core.elements.InfoboxType;
43
import org.eclipse.ptp.rm.lml.internal.core.elements.InfoboxlayoutType;
33
import org.eclipse.ptp.rm.lml.internal.core.elements.InfoboxlayoutType;
44
import org.eclipse.ptp.rm.lml.internal.core.elements.LayoutType;
45
import org.eclipse.ptp.rm.lml.internal.core.elements.LguiType;
34
import org.eclipse.ptp.rm.lml.internal.core.elements.LguiType;
46
import org.eclipse.ptp.rm.lml.internal.core.elements.Nodedisplay;
47
import org.eclipse.ptp.rm.lml.internal.core.elements.NodedisplaylayoutType;
35
import org.eclipse.ptp.rm.lml.internal.core.elements.NodedisplaylayoutType;
48
import org.eclipse.ptp.rm.lml.internal.core.elements.ObjectFactory;
36
import org.eclipse.ptp.rm.lml.internal.core.elements.ObjectFactory;
49
import org.eclipse.ptp.rm.lml.internal.core.elements.PaneType;
50
import org.eclipse.ptp.rm.lml.internal.core.elements.SchemeType;
51
import org.eclipse.ptp.rm.lml.internal.core.elements.SplitlayoutType;
52
import org.eclipse.ptp.rm.lml.internal.core.elements.TableType;
37
import org.eclipse.ptp.rm.lml.internal.core.elements.TableType;
53
import org.eclipse.ptp.rm.lml.internal.core.elements.TablelayoutType;
38
import org.eclipse.ptp.rm.lml.internal.core.elements.TablelayoutType;
54
import org.eclipse.ptp.rm.lml.internal.core.elements.TextboxType;
55
import org.eclipse.ptp.rm.lml.internal.core.elements.UsagebarType;
56
import org.eclipse.ptp.rm.lml.internal.core.elements.UsagebarlayoutType;
39
import org.eclipse.ptp.rm.lml.internal.core.elements.UsagebarlayoutType;
57
40
58
/**
41
/**
Lines 64-69 Link Here
64
 * functions, which allow to merge layouts to one lml-model
47
 * functions, which allow to merge layouts to one lml-model
65
 */
48
 */
66
public class LayoutAccess extends LguiHandler {
49
public class LayoutAccess extends LguiHandler {
50
	/*
51
	 * create an objectfactory for all functions in this class
52
	 */
53
	private static ObjectFactory objectFactory = new ObjectFactory();
54
55
	private static final String LAYOUT_ENDING = "_layout";//$NON-NLS-1$
56
57
	private static String DEAFULT_ABS = "abs_default";//$NON-NLS-1$
58
59
	private static JAXBUtil jaxbUtil = JAXBUtil.getInstance();
60
67
	/**
61
	/**
68
	 * This method merges the layout information given by the "layout"-instance
62
	 * This method merges the layout information given by the "layout"-instance
69
	 * with the layout, which is included in "data". Component-layouts in "data"
63
	 * with the layout, which is included in "data". Component-layouts in "data"
Lines 85-96 Link Here
85
		if (data == null || layout == null) {
79
		if (data == null || layout == null) {
86
			return data;
80
			return data;
87
		}
81
		}
88
		final LguiItem lgui = new LguiItem(data);
82
		final LguiItem lguiData = new LguiItem(data);
89
		final LayoutAccess la = new LayoutAccess(lgui, lgui.getLguiType());
90
		// Replace component-layouts
83
		// Replace component-layouts
91
		for (final JAXBElement<?> el : layout.getObjectsAndRelationsAndInformation()) {
84
		for (final Object object : jaxbUtil.getObjects(layout)) {
92
			if (el.getValue() instanceof ComponentlayoutType) {
85
			if (object instanceof ComponentlayoutType) {
93
				la.replaceComponentLayout((ComponentlayoutType) el.getValue());
86
				jaxbUtil.replaceComponentLayout(data, lguiData, (ComponentlayoutType) object);
94
			}
87
			}
95
		}
88
		}
96
89
Lines 115-322 Link Here
115
		 * } }
108
		 * } }
116
		 **/
109
		 **/
117
110
118
		// Overwrite layouts with the same name
111
		JAXBUtil.replaceGlobalLayout(layout, data);
119
		for (final JAXBElement<?> el : layout.getObjectsAndRelationsAndInformation()) {
120
			if (el.getValue() instanceof LayoutType) {
121
				if (!replaceGlobalLayout((LayoutType) el.getValue(), data)) {
122
					// If not replaced, insert it
123
					data.getObjectsAndRelationsAndInformation().add(el);
124
				}
125
			}
126
		}
127
128
		return data;
112
		return data;
129
	}
113
	}
130
131
	/**
132
	 * Replace a global layout within the lml-model by a new one
133
	 * 
134
	 * @param newlayout
135
	 *            new layout, which replaces the old in model with the same id
136
	 * @param model
137
	 *            lgui-instance, which is changed
138
	 */
139
	@SuppressWarnings("unchecked")
140
	public static boolean replaceGlobalLayout(LayoutType newlayout, LguiType model) {
141
142
		final List<JAXBElement<?>> all = model.getObjectsAndRelationsAndInformation();
143
144
		// Go through all objects, search for layouttypes with newlayout.getId
145
		// as id and replace them with this layout
146
		for (int i = 0; i < all.size(); i++) {
147
			final JAXBElement<?> aobj = all.get(i);
148
			if (aobj.getValue() instanceof LayoutType) {
149
				final LayoutType old = (LayoutType) aobj.getValue();
150
				if (old.getId().equals(newlayout.getId())) {
151
					((JAXBElement<LayoutType>) aobj).setValue(newlayout);
152
					return true;
153
				}
154
			}
155
		}
156
157
		return false;
158
	}
159
160
	/**
161
	 * Search for gid-attributes of a pane and put it into neededComponents
162
	 * Recursively search all graphical objects referenced by this pane
163
	 * 
164
	 * @param p
165
	 *            part of SplitLayout, which is scanned for gid-attributes
166
	 * @param neededComponents
167
	 *            resulting Hashset
168
	 */
169
	private static void collectComponents(PaneType p, HashSet<String> neededComponents) {
170
171
		if (p.getGid() != null) {
172
			neededComponents.add(p.getGid());
173
		} else {
174
			// top and bottom components?
175
			if (p.getBottom() != null) {
176
				collectComponents(p.getBottom(), neededComponents);
177
				collectComponents(p.getTop(), neededComponents);
178
			} else {// Left and right
179
				collectComponents(p.getLeft(), neededComponents);
180
				collectComponents(p.getRight(), neededComponents);
181
			}
182
		}
183
184
	}
185
186
	/**
187
	 * Take a graphical object and minimize the data so that this instance is
188
	 * valid against the LML-Schema but at the same time as small as possible.
189
	 * 
190
	 * @param gobj
191
	 * @return a copy of gobj with minimal size, only attributes in GobjectType
192
	 *         are copied and lower special elements which are needed to make
193
	 *         lml-model valid
194
	 */
195
	@SuppressWarnings("unchecked")
196
	private static JAXBElement<GobjectType> minimizeGobjectType(GobjectType gobj) {
197
198
		String qname = "table"; //$NON-NLS-1$
199
		final Class<GobjectType> c = (Class<GobjectType>) gobj.getClass();
200
201
		GobjectType value = objectFactory.createGobjectType();
202
203
		if (gobj instanceof TableType) {
204
			final TableType tt = objectFactory.createTableType();
205
			final TableType orig = (TableType) gobj;
206
			tt.setContenttype(orig.getContenttype());
207
			// copy all columns with pattern to table
208
			for (final ColumnType col : orig.getColumn()) {
209
				if (col.getPattern() != null) {
210
					tt.getColumn().add(col);
211
				}
212
			}
213
214
			value = tt;
215
216
			qname = "table"; //$NON-NLS-1$
217
		} else if (gobj instanceof UsagebarType) {
218
			final UsagebarType ut = objectFactory.createUsagebarType();
219
220
			ut.setCpucount(BigInteger.valueOf(0));
221
222
			value = ut;
223
224
			qname = "usagebar"; //$NON-NLS-1$
225
		} else if (gobj instanceof TextboxType) {
226
			final TextboxType ut = objectFactory.createTextboxType();
227
228
			ut.setText(""); //$NON-NLS-1$
229
230
			value = ut;
231
232
			qname = "text"; //$NON-NLS-1$
233
		} else if (gobj instanceof InfoboxType) {
234
			final InfoboxType ut = objectFactory.createInfoboxType();
235
236
			value = ut;
237
238
			qname = "infobox"; //$NON-NLS-1$
239
		} else if (gobj instanceof Nodedisplay) {// Create minimal nodedisplay
240
			final Nodedisplay ut = objectFactory.createNodedisplay();
241
242
			value = ut;
243
			final SchemeType scheme = objectFactory.createSchemeType();
244
			scheme.getEl1().add(objectFactory.createSchemeElement1());
245
			ut.setScheme(scheme);
246
247
			final DataType dat = objectFactory.createDataType();
248
			dat.getEl1().add(objectFactory.createDataElement1());
249
			ut.setData(dat);
250
251
			qname = "nodedisplay"; //$NON-NLS-1$
252
		} else if (gobj instanceof ChartType) {
253
			final ChartType ut = objectFactory.createChartType();
254
255
			value = ut;
256
257
			qname = "chart"; //$NON-NLS-1$
258
		} else if (gobj instanceof ChartgroupType) {
259
			final ChartgroupType ut = objectFactory.createChartgroupType();
260
			// Add lower chart-elements to the minimized chart-group
261
			final ChartgroupType orig = (ChartgroupType) gobj;
262
			// Go through all charts minimize them and add them to ut
263
			for (final ChartType chart : orig.getChart()) {
264
				final ChartType min = (ChartType) (minimizeGobjectType(chart).getValue());
265
				ut.getChart().add(min);
266
			}
267
268
			value = ut;
269
270
			qname = "chartgroup"; //$NON-NLS-1$
271
		}
272
273
		value.setDescription(gobj.getDescription());
274
		value.setId(gobj.getId());
275
		value.setTitle(gobj.getTitle());
276
277
		final JAXBElement<GobjectType> res = new JAXBElement<GobjectType>(new QName(qname), c, value);
278
279
		return res;
280
	}
281
282
	/**
283
	 * @param obj
284
	 *            LguiType-instance
285
	 * @param output
286
	 *            OutputStream to save xml-representation of obj in
287
	 * @throws JAXBException
288
	 */
289
	@SuppressWarnings("unused")
290
	private static void objToLML(LguiType obj, OutputStream output) throws JAXBException {
291
292
		final JAXBContext jc = JAXBContext.newInstance("lml"); //$NON-NLS-1$
293
294
		final Marshaller mar = jc.createMarshaller();
295
296
		mar.setProperty("jaxb.schemaLocation", "http://www.llview.de lgui.xsd"); //$NON-NLS-1$ //$NON-NLS-2$
297
298
		final QName tagname = new QName("http://www.llview.de", "lgui", "lml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
299
300
		final JAXBElement<LguiType> rootel = new JAXBElement<LguiType>(tagname, LguiType.class, obj);
301
302
		mar.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
303
304
		mar.marshal(rootel, output);
305
	}
306
307
	// DefaultLayouts
308
	private final UsagebarlayoutType defaultUsagebar;
309
310
	private final ChartlayoutType defaultChart;
311
312
	private final TablelayoutType defaultTable;
313
314
	private final InfoboxlayoutType defaultInfobox;
315
316
	/*
317
	 * create an objectfactory for all functions in this class
318
	 */
319
	private static ObjectFactory objectFactory = new ObjectFactory();
320
114
321
	/**
115
	/**
322
	 * @param lguiItem
116
	 * @param lguiItem
Lines 326-335 Link Here
326
	 */
120
	 */
327
	public LayoutAccess(ILguiItem lguiItem, LguiType lgui) {
121
	public LayoutAccess(ILguiItem lguiItem, LguiType lgui) {
328
		super(lguiItem, lgui);
122
		super(lguiItem, lgui);
329
		defaultUsagebar = objectFactory.createUsagebarlayoutType();
330
		defaultChart = objectFactory.createChartlayoutType();
331
		defaultTable = objectFactory.createTablelayoutType();
332
		defaultInfobox = objectFactory.createInfoboxlayoutType();
333
123
334
		this.lguiItem.addListener(new ILguiListener() {
124
		this.lguiItem.addListener(new ILguiListener() {
335
			public void handleEvent(ILguiUpdatedEvent e) {
125
			public void handleEvent(ILguiUpdatedEvent e) {
Lines 339-383 Link Here
339
	}
129
	}
340
130
341
	/**
131
	/**
342
	 * Add a new created layout to the model
132
	 * Generates an absolute layout without needing a layout tag. Active components are placed in a grid on the screen. Use this
343
	 * 
133
	 * function, if no layout was specified by the lml-file.
344
	 * @param layout
345
	 *            absolute or splitlayout
346
	 */
347
	public void addLayoutTag(LayoutType layout) {
348
349
		if (layout.getId() == null) {
350
			layout.setId(""); //$NON-NLS-1$
351
		}
352
353
		JAXBElement<? extends LayoutType> jaxbel = null;
354
		// Create jaxbelement corresponding to the class-type
355
		if (layout instanceof AbslayoutType) {
356
357
			final AbslayoutType abslayout = (AbslayoutType) layout;
358
359
			jaxbel = new JAXBElement<AbslayoutType>(new QName("abslayout"), AbslayoutType.class, abslayout); //$NON-NLS-1$
360
361
		} else if (layout instanceof SplitlayoutType) {
362
363
			final SplitlayoutType splitlayout = (SplitlayoutType) layout;
364
365
			jaxbel = new JAXBElement<SplitlayoutType>(new QName("splitlayout"), SplitlayoutType.class, splitlayout); //$NON-NLS-1$
366
367
		} else {
368
			return;
369
		}
370
371
		lgui.getObjectsAndRelationsAndInformation().add(jaxbel);
372
373
		lguiItem.notifyListeners();
374
375
	}
376
377
	/**
378
	 * Generates an absolute layout without needing a layout tag. Active
379
	 * components are placed in a grid on the screen. Use this function, if no
380
	 * layout was specified by the lml-file.
381
	 * 
134
	 * 
382
	 * @param width
135
	 * @param width
383
	 *            width in pixels of the area, on which this layout is shown
136
	 *            width in pixels of the area, on which this layout is shown
Lines 387-512 Link Here
387
	 */
140
	 */
388
	public AbslayoutType generateDefaultAbsoluteLayout(int width, int height) {
141
	public AbslayoutType generateDefaultAbsoluteLayout(int width, int height) {
389
142
390
		// Collect active components
143
		final ArrayList<GobjectType> activeObjects = new ArrayList<GobjectType>();
391
		final List<GobjectType> gobjects = lguiItem.getOverviewAccess().getGraphicalObjects();
392
393
		final ArrayList<GobjectType> activeobjects = new ArrayList<GobjectType>();
394
		// Go through all graphical objects
144
		// Go through all graphical objects
395
		for (final GobjectType gobj : gobjects) {
145
		for (final GobjectType gobject : lguiItem.getOverviewAccess().getGraphicalObjects()) {
396
			// Get layouts for this object, normally there is only one
146
			// Get layouts for this object, normally there is only one
397
			final List<ComponentlayoutType> layouts = getComponentLayoutByGID(gobj.getId());
147
			final List<ComponentlayoutType> layouts = getComponentLayoutByGid(gobject
148
					.getId());
398
149
399
			if (layouts.size() == 0) {// assume gobj to be active if there is no
150
			if (layouts.size() == 0) {// assume gobject to be active if there is
400
										// componentlayout
151
										// no componentlayout
401
				activeobjects.add(gobj);
152
				activeObjects.add(gobject);
402
			}
153
			}
403
154
404
			// Search for a componentlayout which declares gobj to be active
155
			// Search for a componentlayout which declares gobject to be active
405
			for (final ComponentlayoutType complayout : layouts) {
156
			for (final ComponentlayoutType componentLayout : layouts) {
406
				if (complayout.isActive()) {
157
				if (componentLayout.isActive()) {
407
					activeobjects.add(gobj);
158
					activeObjects.add(gobject);
408
					break;
159
					break;
409
				}
160
				}
410
			}
161
			}
411
		}
162
		}
412
163
413
		// Now activeobjects contains all active graphical objects, which have
164
		// Now activeObjects contains all active graphical objects, which have
414
		// to be arranged on the screen
165
		// to be arranged on the screen
415
166
416
		final AbslayoutType res = objectFactory.createAbslayoutType();
167
		final AbslayoutType result = objectFactory.createAbslayoutType();
417
168
418
		res.setId("abs_default"); //$NON-NLS-1$
169
		result.setId(DEAFULT_ABS);
419
170
420
		// Try to create as many columns as rows
171
		// Try to create as many columns as rows
421
		int columns = (int) Math.round(Math.sqrt(activeobjects.size()));
172
		int columns = (int) Math.round(Math.sqrt(activeObjects.size()));
422
173
423
		if (columns == 0) {
174
		if (columns == 0) {
424
			columns = 1;
175
			columns = 1;
425
		}
176
		}
426
177
427
		int rows = (int) Math.ceil((double) activeobjects.size() / columns);
178
		int rows = (int) Math.ceil((double) activeObjects.size() / columns);
428
179
429
		if (rows == 0) {
180
		if (rows == 0) {
430
			rows = 1;
181
			rows = 1;
431
		}
182
		}
432
		// Calculate width and height of graphical objects
183
		// Calculate width and height of graphical objects
433
		int index = 0;
184
		int index = 0;
434
		final int rectwidth = width / columns;
185
		final int rectWidth = width / columns;
435
		final int rectheight = height / rows;
186
		final int rectHeight = height / rows;
436
187
437
		for (final GobjectType gobj : activeobjects) {
188
		for (final GobjectType gobject : activeObjects) {
438
189
439
			final ComponentType pos = objectFactory.createComponentType();
190
			final ComponentType component = objectFactory.createComponentType();
440
			pos.setGid(gobj.getId());
191
			component.setGid(gobject.getId());
441
			// Positioning the component
192
			// Positioning the component
442
			pos.setW(BigInteger.valueOf(rectwidth));
193
			component.setW(BigInteger.valueOf(rectWidth));
443
			pos.setH(BigInteger.valueOf(rectheight));
194
			component.setH(BigInteger.valueOf(rectHeight));
444
195
445
			pos.setX(BigInteger.valueOf((index % columns) * rectwidth));
196
			component.setX(BigInteger.valueOf((index % columns) * rectWidth));
446
			pos.setY(BigInteger.valueOf((index / columns) * rectheight));
197
			component.setY(BigInteger.valueOf((index / columns) * rectHeight));
447
198
448
			// Add this component position to the layout
199
			// Add this component position to the layout
449
			res.getComp().add(pos);
200
			result.getComp().add(component);
450
201
451
			index++;
202
			index++;
452
		}
203
		}
453
204
454
		return res;
205
		return result;
455
	}
456
457
	public String[] getActiveNodedisplayLayoutGid() {
458
		final ArrayList<String> nodedisplayID = new ArrayList<String>();
459
		final List<NodedisplaylayoutType> nodedisplayLayouts = getNodedisplayLayouts();
460
		for (final NodedisplaylayoutType nodedisplayLayout : nodedisplayLayouts) {
461
			if (nodedisplayLayout.isActive()) {
462
				nodedisplayID.add(nodedisplayLayout.getGid());
463
			}
464
		}
465
		return nodedisplayID.toArray(new String[nodedisplayID.size()]);
466
	}
467
468
	public String[] getActiveTableLayoutsGid() {
469
		final ArrayList<String> tableLayoutsId = new ArrayList<String>();
470
		final List<TablelayoutType> tableLayouts = getTableLayouts();
471
		for (final TablelayoutType tableLayout : tableLayouts) {
472
			if (tableLayout.isActive()) {
473
				tableLayoutsId.add(tableLayout.getGid());
474
			}
475
		}
476
		return tableLayoutsId.toArray(new String[tableLayoutsId.size()]);
477
	}
206
	}
478
207
479
	/**
208
	/**
480
	 * Simply returns the first layout found for a chart with the given id or a
209
	 * Simply returns the first layout found for a chart with the given id or a default-layout
481
	 * default-layout
482
	 * 
210
	 * 
483
	 * @param chartID
211
	 * @param chartId
484
	 * @return defaultlayout for a chart or first layout for chart with id
212
	 * @return defaultlayout for a chart or first layout for chart with id
485
	 *         chartid given by lml-file
213
	 *         chartid given by lml-file
486
	 */
214
	 */
487
	public ChartlayoutType getChartLayout(String chartID) {
215
	public ChartlayoutType getChartLayout(String chartId) {
488
		final List<ChartlayoutType> chartLayouts = getChartLayouts();
216
		for (final ChartlayoutType chartLayout : getChartLayouts()) {
489
		for (final ChartlayoutType chartLayout : chartLayouts) {
217
			if (chartLayout.getGid().equals(chartId)) {
490
			if (chartLayout.getGid().equals(chartID)) {
491
				return chartLayout;
218
				return chartLayout;
492
			}
219
			}
493
		}
220
		}
494
		return defaultChart;
221
		return objectFactory.createChartlayoutType();
495
	}
222
	}
496
223
497
	public List<ChartlayoutType> getChartLayouts() {
224
	public List<ChartlayoutType> getChartLayouts() {
498
		final List<ChartlayoutType> chartLayouts = new LinkedList<ChartlayoutType>();
225
		final List<ChartlayoutType> chartLayouts = new LinkedList<ChartlayoutType>();
499
		for (final ComponentlayoutType tag : getComponentLayouts()) {
226
		for (final ComponentlayoutType layout : getComponentLayouts()) {
500
			if (tag instanceof ChartlayoutType) {
227
			if (layout instanceof ChartlayoutType) {
501
				chartLayouts.add((ChartlayoutType) tag);
228
				chartLayouts.add((ChartlayoutType) layout);
502
			}
229
			}
503
		}
230
		}
504
		return chartLayouts;
231
		return chartLayouts;
505
	}
232
	}
506
233
507
	/**
234
	/**
508
	 * Search in component-layouts for layout for the graphical object with id
235
	 * Search in component-layouts for layout for the graphical object with gid.
509
	 * gid.
510
	 * 
236
	 * 
511
	 * @param gid
237
	 * @param gid
512
	 *            id of corresponding graphical object, for which layouts are
238
	 *            id of corresponding graphical object, for which layouts are
Lines 514-534 Link Here
514
	 * @return list of componentlayouts corresponding to the graphical object id
240
	 * @return list of componentlayouts corresponding to the graphical object id
515
	 *         gid
241
	 *         gid
516
	 */
242
	 */
517
	public List<ComponentlayoutType> getComponentLayoutByGID(String gid) {
243
	public List<ComponentlayoutType> getComponentLayoutByGid(String gid) {
518
244
		final ArrayList<ComponentlayoutType> result = new ArrayList<ComponentlayoutType>();
519
		final List<ComponentlayoutType> complayouts = getComponentLayouts();
245
		for (final ComponentlayoutType layout : getComponentLayouts()) {
520
246
			if (layout.getGid() != null && layout.getGid().equals(gid)) {
521
		final ArrayList<ComponentlayoutType> res = new ArrayList<ComponentlayoutType>();
247
				result.add(layout);
522
523
		for (final ComponentlayoutType alayout : complayouts) {
524
525
			if (alayout.getGid() != null && alayout.getGid().equals(gid)) {
526
527
				res.add(alayout);
528
			}
248
			}
529
		}
249
		}
530
250
		return result;
531
		return res;
532
	}
251
	}
533
252
534
	/**
253
	/**
Lines 538-552 Link Here
538
	 */
257
	 */
539
	public List<ComponentlayoutType> getComponentLayouts() {
258
	public List<ComponentlayoutType> getComponentLayouts() {
540
		final List<ComponentlayoutType> layouts = new LinkedList<ComponentlayoutType>();
259
		final List<ComponentlayoutType> layouts = new LinkedList<ComponentlayoutType>();
541
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
260
		for (final Object object : jaxbUtil.getObjects(lgui)) {
542
			if (tag.getValue() instanceof ComponentlayoutType) {
261
			if (object instanceof ComponentlayoutType) {
543
				layouts.add((ComponentlayoutType) tag.getValue());
262
				layouts.add((ComponentlayoutType) object);
544
			}
263
			}
545
		}
264
		}
546
		return layouts;
265
		return layouts;
547
	}
266
	}
548
267
549
	public TablelayoutType getDefaultTableLayout(String gid) {
268
	public TablelayoutType getDefaultTableLayoutFromTable(String gid) {
550
		TablelayoutType tableLayout = getTableLayout(gid);
269
		TablelayoutType tableLayout = getTableLayout(gid);
551
		if (tableLayout == null) {
270
		if (tableLayout == null) {
552
			tableLayout = new TablelayoutType();
271
			tableLayout = new TablelayoutType();
Lines 554-561 Link Here
554
			getTableLayouts().add(tableLayout);
273
			getTableLayouts().add(tableLayout);
555
		}
274
		}
556
		if (tableLayout.getColumn().size() <= 0) {
275
		if (tableLayout.getColumn().size() <= 0) {
557
			tableLayout.setId(gid + "_layout"); //$NON-NLS-1$
276
			tableLayout.setId(gid + LAYOUT_ENDING);
558
			tableLayout.setGid(gid);
559
			final TableType table = lguiItem.getTableHandler().getTable(gid);
277
			final TableType table = lguiItem.getTableHandler().getTable(gid);
560
			if (table != null) {
278
			if (table != null) {
561
				for (int i = 0; i < table.getColumn().size(); i++) {
279
				for (int i = 0; i < table.getColumn().size(); i++) {
Lines 573-614 Link Here
573
	}
291
	}
574
292
575
	public Map<String, String> getInactiveComponents() {
293
	public Map<String, String> getInactiveComponents() {
576
		final List<ComponentlayoutType> objects = getComponentLayouts();
577
		final ArrayList<String> inactive = new ArrayList<String>();
578
		final Map<String, String> inactiveMap = new HashMap<String, String>();
294
		final Map<String, String> inactiveMap = new HashMap<String, String>();
579
		for (final ComponentlayoutType object : objects) {
295
		for (final ComponentlayoutType object : getComponentLayouts()) {
580
			if (!object.isActive()) {
296
			if (!object.isActive()) {
581
				if (object.getClass().getSimpleName().equals("TablelayoutType")) { //$NON-NLS-1$
297
				if (object instanceof TablelayoutType) {
582
					final TableType table = lguiItem.getTableHandler().getTable(object.getGid());
298
					final TableType table = lguiItem.getTableHandler().getTable(object.getGid());
583
					if (table != null) {
299
					if (table != null) {
584
						inactiveMap.put(table.getTitle(), object.getGid());
300
						inactiveMap.put(table.getTitle(), object.getGid());
585
					}
301
					}
586
				} else if (object.getClass().getSimpleName().equals("NodedisplaylayoutType")) { //$NON-NLS-1$
302
				} else if (object instanceof NodedisplaylayoutType) {
587
					inactiveMap
303
					inactiveMap
588
							.put(lguiItem.getNodedisplayAccess().getNodedisplayById(object.getGid()).getTitle(), object.getGid());
304
							.put(lguiItem.getNodedisplayAccess().getNodedisplayById(object.getGid()).getTitle(), object.getGid());
589
				}
305
				}
590
				inactive.add(object.getGid());
591
			}
306
			}
592
		}
307
		}
593
		return inactiveMap;
308
		return inactiveMap;
594
	}
309
	}
595
310
596
	/**
311
	/**
597
	 * Simply returns the first layout found for a infobox with the given id or
312
	 * Simply returns the first layout found for a infobox with the given id or a default-layout
598
	 * a default-layout
599
	 * 
313
	 * 
600
	 * @param infoID
314
	 * @param infoID
601
	 * @return defaultlayout for a table or first layout for table with id
315
	 * @return defaultlayout for a table or first layout for table with id
602
	 *         tableid given by lml-file
316
	 *         tableid given by lml-file
603
	 */
317
	 */
604
	public InfoboxlayoutType getInfoboxLayout(String infoID) {
318
	public InfoboxlayoutType getInfoboxLayout(String infoId) {
605
		final List<InfoboxlayoutType> infoboxLayouts = getInfoboxLayout();
319
		for (final InfoboxlayoutType infoboxLayout : getInfoboxLayout()) {
606
		for (final InfoboxlayoutType infoboxLayout : infoboxLayouts) {
320
			if (infoboxLayout.getGid().equals(infoId)) {
607
			if (infoboxLayout.getGid().equals(infoID)) {
608
				return infoboxLayout;
321
				return infoboxLayout;
609
			}
322
			}
610
		}
323
		}
611
		return defaultInfobox;
324
		return objectFactory.createInfoboxlayoutType();
612
	}
325
	}
613
326
614
	public ColumnlayoutType[] getLayoutColumsToCids(BigInteger[] cids, String gid) {
327
	public ColumnlayoutType[] getLayoutColumsToCids(BigInteger[] cids, String gid) {
Lines 626-724 Link Here
626
	}
339
	}
627
340
628
	/**
341
	/**
629
	 * Remove all real data from model return only layout-information and data,
342
	 * Remove all real data from model return only layout-information and data, which is needed to make lml-model valid
630
	 * which is needed to make lml-model valid
631
	 * 
343
	 * 
632
	 * @param model
344
	 * @param model
633
	 *            lml-model with data and layout-information
345
	 *            lml-model with data and layout-information
634
	 * @return
346
	 * @return
635
	 */
347
	 */
636
	public LguiType getLayoutFromModel() {
348
	public LguiType getLayoutFromModel() {
349
		final LguiType result = objectFactory.createLguiType();
637
350
638
		// This is gid for all nodedisplaylayouts in requests => id for all
351
		final HashSet<String> components = new HashSet<String>();
639
		// nodedisplays
640
		final String dummystring = "__dummy_nd__";//$NON-NLS-1$
641
352
642
		final LguiType res = objectFactory.createLguiType();
353
		jaxbUtil.getLayoutComponents(result, lgui, components);
643
354
644
		final HashSet<String> neededComponents = new HashSet<String>();
355
		final List<GobjectType> gobjectList = new LinkedList<GobjectType>();
645
356
		for (final Object object : jaxbUtil.getObjects(lgui)) {
646
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
647
648
			final Object value = tag.getValue();
649
650
			// add normal global layouts
651
			if (value instanceof LayoutType) {
652
				res.getObjectsAndRelationsAndInformation().add(tag);
653
654
				if (value instanceof SplitlayoutType) {
655
					final SplitlayoutType splitlayout = (SplitlayoutType) value;
656
					// Collect needed components from layout recursively
657
					if (splitlayout.getLeft() != null) {
658
						collectComponents(splitlayout.getLeft(), neededComponents);
659
						collectComponents(splitlayout.getRight(), neededComponents);
660
					}
661
				} else if (value instanceof AbslayoutType) {
662
663
					final AbslayoutType abslayout = (AbslayoutType) value;
664
					// Just traverse comp-list for gid-attributes
665
					for (final ComponentType comp : abslayout.getComp()) {
666
						neededComponents.add(comp.getGid());
667
					}
668
669
				}
670
671
			} else if (value instanceof ComponentlayoutType) {
672
				if (((ComponentlayoutType) value).isActive()) {
673
					res.getObjectsAndRelationsAndInformation().add(tag);
674
675
					final ComponentlayoutType complayout = (ComponentlayoutType) value;
676
					neededComponents.add(complayout.getGid());
677
678
					// Workaround for nodedisplay
679
					if (value instanceof NodedisplaylayoutType) {
680
						final NodedisplaylayoutType nlayout = (NodedisplaylayoutType) value;
681
						nlayout.setGid(dummystring);
682
					}
683
684
				}
685
			}
686
687
		}
688
689
		final HashMap<String, GobjectType> idtoGobject = new HashMap<String, GobjectType>();
690
		// Search needed components in data-tag to discover, which type the
691
		// needed components have
692
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
693
694
			final Object value = tag.getValue();
695
			// is it a graphical object?
357
			// is it a graphical object?
696
			if (value instanceof GobjectType) {
358
			if (object instanceof GobjectType) {
697
				final GobjectType gobj = (GobjectType) value;
359
				if (components.contains(((GobjectType) object).getId())) {
698
				if (neededComponents.contains(gobj.getId())) {
360
					gobjectList.add((GobjectType) object);
699
					idtoGobject.put(gobj.getId(), gobj);
700
				}
361
				}
701
			}
362
			}
702
		}
363
		}
703
364
704
		// Add all gobjects in idtoGobject to the result, so that lml-modell is
365
		// Add all gobjects in idtoGobject to the result, so that lml-model is
705
		// valid
366
		// valid
706
		for (final GobjectType gobj : idtoGobject.values()) {
367
		for (final GobjectType gobject : gobjectList) {
707
			final JAXBElement<GobjectType> min = minimizeGobjectType(gobj);
368
			result.getObjectsAndRelationsAndInformation().add(JAXBUtil.minimizeGobjectType(gobject, objectFactory));
708
709
			// Workaround for nodedisplay
710
			final GobjectType newgobj = min.getValue();
711
			if (newgobj instanceof Nodedisplay) {
712
				((Nodedisplay) newgobj).setId(dummystring);
713
			}
714
715
			res.getObjectsAndRelationsAndInformation().add(min);
716
		}
369
		}
717
370
718
		// Set layout-attribute
371
		// Set layout-attribute
719
		res.setLayout(true);
372
		result.setLayout(true);
720
373
721
		return res;
374
		return result;
722
	}
375
	}
723
376
724
	/**
377
	/**
Lines 728-756 Link Here
728
	 */
381
	 */
729
	public List<NodedisplaylayoutType> getNodedisplayLayouts() {
382
	public List<NodedisplaylayoutType> getNodedisplayLayouts() {
730
		final List<NodedisplaylayoutType> nodedisplayLayouts = new LinkedList<NodedisplaylayoutType>();
383
		final List<NodedisplaylayoutType> nodedisplayLayouts = new LinkedList<NodedisplaylayoutType>();
731
		for (final ComponentlayoutType tag : getComponentLayouts()) {
384
		for (final ComponentlayoutType layout : getComponentLayouts()) {
732
			if (tag instanceof NodedisplaylayoutType) {
385
			if (layout instanceof NodedisplaylayoutType) {
733
				nodedisplayLayouts.add((NodedisplaylayoutType) tag);
386
				nodedisplayLayouts.add((NodedisplaylayoutType) layout);
734
			}
387
			}
735
		}
388
		}
736
		return nodedisplayLayouts;
389
		return nodedisplayLayouts;
390
737
	}
391
	}
738
392
739
	/**
393
	/**
740
	 * Getting the layout of a given table, the identifier of the layout is the
394
	 * Getting the layout of a given table, the identifier of the layout is the shared ID of table and layout.
741
	 * shared ID of table and layout.
742
	 * 
395
	 * 
743
	 * @param tablelayoutID
396
	 * @param tablelayoutID
744
	 *            ID of the desired tablelayout
397
	 *            ID of the desired tablelayout
745
	 * @return Corresponding layout of a table
398
	 * @return Corresponding layout of a table
746
	 */
399
	 */
747
	public TablelayoutType getTableLayout(String tablelayoutID) {
400
	public TablelayoutType getTableLayout(String tablelayoutId) {
748
		for (final TablelayoutType tag : getTableLayouts()) {
401
		for (final TablelayoutType layout : getTableLayouts()) {
749
			if (tag.getGid().equals(tablelayoutID)) {
402
			if (layout.getGid().equals(tablelayoutId)) {
750
				return tag;
403
				return layout;
751
			}
404
			}
752
		}
405
		}
753
		return defaultTable;
406
		return objectFactory.createTablelayoutType();
754
	}
407
	}
755
408
756
	/**
409
	/**
Lines 760-885 Link Here
760
	 */
413
	 */
761
	public List<TablelayoutType> getTableLayouts() {
414
	public List<TablelayoutType> getTableLayouts() {
762
		final List<TablelayoutType> tableLayouts = new LinkedList<TablelayoutType>();
415
		final List<TablelayoutType> tableLayouts = new LinkedList<TablelayoutType>();
763
		for (final ComponentlayoutType tag : getComponentLayouts()) {
416
		for (final ComponentlayoutType layout : getComponentLayouts()) {
764
			if (tag instanceof TablelayoutType) {
417
			if (layout instanceof TablelayoutType) {
765
				tableLayouts.add((TablelayoutType) tag);
418
				tableLayouts.add((TablelayoutType) layout);
766
			}
419
			}
767
		}
420
		}
768
		return tableLayouts;
421
		return tableLayouts;
769
	}
422
	}
770
423
771
	/**
424
	/**
772
	 * This function is only for easier understanding this class Textboxlayouts
425
	 * This function is only for easier understanding this class Textboxlayouts are identical to infoboxlayouts, so you could call
773
	 * are identical to infoboxlayouts, so you could call
774
	 * getInfoboxLayout(textid) and would get the same result.
426
	 * getInfoboxLayout(textid) and would get the same result.
775
	 * 
427
	 * 
776
	 * @param textID
428
	 * @param textID
777
	 *            id of a textbox
429
	 *            id of a textbox
778
	 * @return layout for a textbox with an info-tag in it
430
	 * @return layout for a textbox with an info-tag in it
779
	 */
431
	 */
780
	public InfoboxlayoutType getTextboxLayout(String textID) {
432
	public InfoboxlayoutType getTextboxLayout(String textId) {
781
		return getInfoboxLayout(textID);
433
		return getInfoboxLayout(textId);
782
	}
434
	}
783
435
784
	/**
436
	/**
785
	 * Simply returns the first layout found for a usagebar with the given id or
437
	 * Simply returns the first layout found for a usagebar with the given id or a default-layout
786
	 * a default-layout
787
	 * 
438
	 * 
788
	 * @param usagebarID
439
	 * @param usagebarId
789
	 * @return defaultlayout for a usagebar or first layout for usagebar with id
440
	 * @return defaultlayout for a usagebar or first layout for usagebar with id
790
	 *         usagebarid given by lml-file
441
	 *         usagebarid given by lml-file
791
	 */
442
	 */
792
	public UsagebarlayoutType getUsagebarLayout(String usagebarID) {
443
	public UsagebarlayoutType getUsagebarLayout(String usagebarId) {
793
		final List<UsagebarlayoutType> usagebarLayouts = getUsagebarLayouts();
794
		// Over all objects in lml-file
444
		// Over all objects in lml-file
795
		for (final UsagebarlayoutType usagebarLayout : usagebarLayouts) {
445
		for (final UsagebarlayoutType usagebarLayout : getUsagebarLayouts()) {
796
			if (usagebarLayout.getGid().equals(usagebarID)) {
446
			if (usagebarLayout.getGid().equals(usagebarId)) {
797
				return usagebarLayout;
447
				return usagebarLayout;
798
			}
448
			}
799
		}
449
		}
800
		return defaultUsagebar;
450
		return objectFactory.createUsagebarlayoutType();
801
	}
451
	}
802
452
803
	public List<UsagebarlayoutType> getUsagebarLayouts() {
453
	public List<UsagebarlayoutType> getUsagebarLayouts() {
804
		final List<UsagebarlayoutType> usagebarLayouts = new LinkedList<UsagebarlayoutType>();
454
		final List<UsagebarlayoutType> usagebarLayouts = new LinkedList<UsagebarlayoutType>();
805
		for (final ComponentlayoutType tag : getComponentLayouts()) {
455
		for (final ComponentlayoutType layout : getComponentLayouts()) {
806
			if (tag instanceof UsagebarlayoutType) {
456
			if (layout instanceof UsagebarlayoutType) {
807
				usagebarLayouts.add((UsagebarlayoutType) tag);
457
				usagebarLayouts.add((UsagebarlayoutType) layout);
808
			}
458
			}
809
		}
459
		}
810
		return usagebarLayouts;
460
		return usagebarLayouts;
811
	}
812
813
	/**
814
	 * Replace all componentlayouts for a graphical object with given gid
815
	 * through newlayout.getGid() with newlayout
816
	 * 
817
	 * @param newLayout
818
	 *            new layout, which is placed into the positions of old layouts
819
	 */
820
	@SuppressWarnings("unchecked")
821
	public void replaceComponentLayout(ComponentlayoutType newlayout) {
822
		if (newlayout == null) {
823
			return;
824
		}
825
		final String gid = newlayout.getGid();
826
827
		final List<JAXBElement<?>> allobjects = lgui.getObjectsAndRelationsAndInformation();
828
829
		boolean replaced = false;
830
831
		// Over all objects in lml-file
832
		for (int i = 0; i < allobjects.size(); i++) {
833
			final JAXBElement<?> aobj = allobjects.get(i);
834
835
			// Over all Componentlayouts
836
			if (aobj.getValue() instanceof ComponentlayoutType) {
837
838
				final ComponentlayoutType alayout = (ComponentlayoutType) aobj.getValue();
839
840
				if (alayout.getGid() != null && alayout.getGid().equals(gid)) {
841
842
					if (!replaced) {
843
844
						((JAXBElement<ComponentlayoutType>) aobj).setValue(newlayout);
845
						lguiItem.notifyListeners();
846
						replaced = true;
847
					} else {// Delete this object
848
						allobjects.remove(aobj);
849
						// One step back
850
						i--;
851
					}
852
				}
853
854
			}
855
		}
856
857
		if (!replaced) {// Insert new layout, if there was nothing to replace
858
			// Takes any componentlayout
859
			JAXBElement<?> newel = null;
860
861
			// Differ between several layouts, create different JAXBElements
862
			if (newlayout instanceof TablelayoutType) {
863
				newel = new JAXBElement<TablelayoutType>(new QName("tablelayout"), TablelayoutType.class, //$NON-NLS-1$
864
						(TablelayoutType) newlayout);
865
			} else if (newlayout instanceof NodedisplaylayoutType) {
866
				newel = new JAXBElement<NodedisplaylayoutType>(new QName("nodedisplaylayout"), NodedisplaylayoutType.class, //$NON-NLS-1$
867
						(NodedisplaylayoutType) newlayout);
868
			}
869
870
			if (newel != null) {
871
				lgui.getObjectsAndRelationsAndInformation().add(newel);
872
				lguiItem.notifyListeners();
873
			}
874
		}
875
876
	}
877
878
	/**
879
	 * Setting Changes in the Layout.
880
	 */
881
	public void setChangesLayoutColumn() {
882
883
	}
461
	}
884
462
885
	public String setComponentActive(String gid, boolean active) {
463
	public String setComponentActive(String gid, boolean active) {
Lines 887-895 Link Here
887
		final ComponentlayoutType component = getComponent(gid);
465
		final ComponentlayoutType component = getComponent(gid);
888
		if (component != null) {
466
		if (component != null) {
889
			if (component instanceof TablelayoutType) {
467
			if (component instanceof TablelayoutType) {
890
				type = "table"; //$NON-NLS-1$
468
				type = ILMLCoreConstants.TABLE_ELEMENT;
891
			} else if (component instanceof NodedisplaylayoutType) {
469
			} else if (component instanceof NodedisplaylayoutType) {
892
				type = "nodedisplay"; //$NON-NLS-1$
470
				type = ILMLCoreConstants.NODEDISPLAY_ELEMENT;
893
			}
471
			}
894
			component.setActive(active);
472
			component.setActive(active);
895
		}
473
		}
Lines 897-904 Link Here
897
	}
475
	}
898
476
899
	private ComponentlayoutType getComponent(String gid) {
477
	private ComponentlayoutType getComponent(String gid) {
900
		final List<ComponentlayoutType> objects = getComponentLayouts();
478
		for (final ComponentlayoutType object : getComponentLayouts()) {
901
		for (final ComponentlayoutType object : objects) {
902
			if (object.getGid().equals(gid)) {
479
			if (object.getGid().equals(gid)) {
903
				return object;
480
				return object;
904
			}
481
			}
Lines 908-916 Link Here
908
485
909
	private List<InfoboxlayoutType> getInfoboxLayout() {
486
	private List<InfoboxlayoutType> getInfoboxLayout() {
910
		final List<InfoboxlayoutType> infoboxLayouts = new LinkedList<InfoboxlayoutType>();
487
		final List<InfoboxlayoutType> infoboxLayouts = new LinkedList<InfoboxlayoutType>();
911
		for (final ComponentlayoutType tag : getComponentLayouts()) {
488
		for (final ComponentlayoutType layout : getComponentLayouts()) {
912
			if (tag instanceof InfoboxlayoutType) {
489
			if (layout instanceof InfoboxlayoutType) {
913
				infoboxLayouts.add((InfoboxlayoutType) tag);
490
				infoboxLayouts.add((InfoboxlayoutType) layout);
914
			}
491
			}
915
		}
492
		}
916
		return infoboxLayouts;
493
		return infoboxLayouts;
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LguiHandler.java (+3 lines)
Lines 13-18 Link Here
13
13
14
import org.eclipse.ptp.rm.lml.core.model.ILguiHandler;
14
import org.eclipse.ptp.rm.lml.core.model.ILguiHandler;
15
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
15
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
16
import org.eclipse.ptp.rm.lml.core.util.JAXBUtil;
16
import org.eclipse.ptp.rm.lml.internal.core.elements.LguiType;
17
import org.eclipse.ptp.rm.lml.internal.core.elements.LguiType;
17
18
18
/**
19
/**
Lines 40-45 Link Here
40
	 */
41
	 */
41
	protected LguiType lgui;
42
	protected LguiType lgui;
42
43
44
	protected static final JAXBUtil jaxbUtil = JAXBUtil.getInstance();
45
43
	/**
46
	/**
44
	 * @param lguiItem
47
	 * @param lguiItem
45
	 *            surrounding lml-manager needed to fire events, if this handler changed data
48
	 *            surrounding lml-manager needed to fire events, if this handler changed data
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/LguiItem.java (-152 / +77 lines)
Lines 15-21 Link Here
15
import java.io.InputStream;
15
import java.io.InputStream;
16
import java.io.InputStreamReader;
16
import java.io.InputStreamReader;
17
import java.io.OutputStream;
17
import java.io.OutputStream;
18
import java.io.StringReader;
19
import java.io.StringWriter;
18
import java.io.StringWriter;
20
import java.math.BigInteger;
19
import java.math.BigInteger;
21
import java.util.ArrayList;
20
import java.util.ArrayList;
Lines 29-47 Link Here
29
import java.util.TreeMap;
28
import java.util.TreeMap;
30
import java.util.UUID;
29
import java.util.UUID;
31
30
32
import javax.xml.bind.JAXBElement;
33
import javax.xml.bind.JAXBException;
34
import javax.xml.bind.Marshaller;
35
import javax.xml.bind.PropertyException;
36
import javax.xml.bind.Unmarshaller;
37
import javax.xml.namespace.QName;
38
39
import org.eclipse.ptp.rm.lml.core.JobStatusData;
31
import org.eclipse.ptp.rm.lml.core.JobStatusData;
40
import org.eclipse.ptp.rm.lml.core.LMLCorePlugin;
41
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
32
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
42
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
33
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
43
import org.eclipse.ptp.rm.lml.core.model.ILguiHandler;
34
import org.eclipse.ptp.rm.lml.core.model.ILguiHandler;
44
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
35
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
36
import org.eclipse.ptp.rm.lml.core.model.IPattern;
37
import org.eclipse.ptp.rm.lml.core.util.JAXBUtil;
45
import org.eclipse.ptp.rm.lml.internal.core.elements.CellType;
38
import org.eclipse.ptp.rm.lml.internal.core.elements.CellType;
46
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnType;
39
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnType;
47
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentlayoutType;
40
import org.eclipse.ptp.rm.lml.internal.core.elements.ComponentlayoutType;
Lines 75-80 Link Here
75
	 */
68
	 */
76
	private final List<ILguiListener> listeners = new LinkedList<ILguiListener>();
69
	private final List<ILguiListener> listeners = new LinkedList<ILguiListener>();
77
70
71
	private Map<String, List<IPattern>> filters = new HashMap<String, List<IPattern>>();
72
78
	/**
73
	/**
79
	 * List of encapsulated classes, which handle parts of the lml-hierarchy
74
	 * List of encapsulated classes, which handle parts of the lml-hierarchy
80
	 */
75
	 */
Lines 86-101 Link Here
86
	 */
81
	 */
87
	private final Map<String, JobStatusData> fJobMap = Collections.synchronizedMap(new TreeMap<String, JobStatusData>());
82
	private final Map<String, JobStatusData> fJobMap = Collections.synchronizedMap(new TreeMap<String, JobStatusData>());
88
83
89
	private static String lmlNamespace = "http://www.llview.de"; //$NON-NLS-1$
84
	private final JAXBUtil jaxbUtil = JAXBUtil.getInstance();
90
91
	//	private static final String LAYOUT = "layout";//$NON-NLS-1$
92
93
	// TODO Rewrite - Java Applet
94
	private final Marshaller marshaller = LMLCorePlugin.getDefault().getMarshaller();
95
96
	private final Unmarshaller unmarshaller = LMLCorePlugin.getDefault().getUnmarshaller();
97
85
98
	private RequestType request;
86
	private RequestType request;
87
88
	private String username = null;
89
90
	private boolean lockUpdate = true;
91
92
	private boolean lockPattern = false;
99
93
100
	/**
94
	/**
101
	 * Constructor with LML-model as argument
95
	 * Constructor with LML-model as argument
Lines 105-119 Link Here
105
	 */
99
	 */
106
	public LguiItem(LguiType lgui) {
100
	public LguiItem(LguiType lgui) {
107
		this.lgui = lgui;
101
		this.lgui = lgui;
108
		// TODO Give the LguiItem a name
109
		createLguiHandlers();
102
		createLguiHandlers();
110
	}
103
	}
111
104
112
	/**
105
	/**
113
	 * 
106
	 * 
114
	 */
107
	 */
115
	public LguiItem(String name) {
108
	public LguiItem(String name, String username) {
116
		this.name = name;
109
		this.name = name;
110
		this.username = username;
117
	}
111
	}
118
112
119
	/**
113
	/**
Lines 144-150 Link Here
144
				if (overview != null) {
138
				if (overview != null) {
145
					String oid = overview.getOIDByJobId(jobId);
139
					String oid = overview.getOIDByJobId(jobId);
146
					if (oid == null) {
140
					if (oid == null) {
147
						TableHandler handler = getTableHandler();
141
						final TableHandler handler = getTableHandler();
148
						if (handler != null) {
142
						if (handler != null) {
149
							final TableType table = handler.getTable(getGidFromJobStatus(status.getState()));
143
							final TableType table = handler.getTable(getGidFromJobStatus(status.getState()));
150
							if (table != null) {
144
							if (table != null) {
Lines 160-171 Link Here
160
		}
154
		}
161
	}
155
	}
162
156
157
	public String[] getColumnTitlePattern(String gid) {
158
		final List<String> titles = new ArrayList<String>();
159
		final List<IPattern> patternList = filters.get(gid);
160
		if (patternList != null) {
161
			for (final IPattern pattern : patternList) {
162
				titles.add(pattern.getColumnTitle());
163
			}
164
		}
165
		return titles.toArray(new String[titles.size()]);
166
	}
167
163
	/*
168
	/*
164
	 * (non-Javadoc)
169
	 * (non-Javadoc)
165
	 * 
170
	 * 
166
	 * @see org.eclipse.ptp.rm.lml.core.model.ILguiItem#getCurrentLayout(java.io. OutputStream)
171
	 * @see org.eclipse.ptp.rm.lml.core.model.ILguiItem#getCurrentLayout(java.io. OutputStream)
167
	 */
172
	 */
168
	public void getCurrentLayout(OutputStream output) throws JAXBException {
173
	public void getCurrentLayout(OutputStream output) {
174
		while (lockPattern) {
175
			// wait until the pattern have been set
176
177
		}
178
		lockUpdate = true;
169
		LguiType layoutLgui = null;
179
		LguiType layoutLgui = null;
170
		if (lgui == null) {
180
		if (lgui == null) {
171
			layoutLgui = firstRequest();
181
			layoutLgui = firstRequest();
Lines 173-196 Link Here
173
			layoutLgui = getLayoutAccess().getLayoutFromModel();
183
			layoutLgui = getLayoutAccess().getLayoutFromModel();
174
			layoutLgui.setRequest(request);
184
			layoutLgui.setRequest(request);
175
		}
185
		}
176
		try {
186
		jaxbUtil.marshal(layoutLgui, output);
177
			marshaller.setProperty("jaxb.schemaLocation", lmlNamespace + " lgui.xsd"); //$NON-NLS-1$ //$NON-NLS-2$
178
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
179
			final QName tagname = new QName(lmlNamespace, "lgui", "lml"); //$NON-NLS-1$ //$NON-NLS-2$
180
181
			final JAXBElement<LguiType> rootElement = new JAXBElement<LguiType>(tagname, LguiType.class, layoutLgui);
182
			/*
183
			 * Synchronize to avoid the dreaded "FWK005 parse may not be called while parsing" message
184
			 */
185
			synchronized (LguiItem.class) {
186
				marshaller.marshal(rootElement, output);
187
			}
188
			output.close(); // Must close to flush stream
189
		} catch (final PropertyException e) {
190
			LMLCorePlugin.log(e);
191
		} catch (final IOException e) {
192
			LMLCorePlugin.log(e);
193
		}
194
	}
187
	}
195
188
196
	/**
189
	/**
Lines 256-261 Link Here
256
		return (OverviewAccess) lguiHandlers.get(OverviewAccess.class);
249
		return (OverviewAccess) lguiHandlers.get(OverviewAccess.class);
257
	}
250
	}
258
251
252
	public Map<String, List<IPattern>> getPattern() {
253
		return filters;
254
	}
255
256
	public List<IPattern> getPattern(String gid) {
257
		if (filters.containsKey(gid)) {
258
			return filters.get(gid);
259
		}
260
		return new LinkedList<IPattern>();
261
	}
262
259
	public TableHandler getTableHandler() {
263
	public TableHandler getTableHandler() {
260
		if (lguiHandlers.get(TableHandler.class) == null) {
264
		if (lguiHandlers.get(TableHandler.class) == null) {
261
			return null;
265
			return null;
Lines 285-290 Link Here
285
		synchronized (fJobMap) {
289
		synchronized (fJobMap) {
286
			return fJobMap.values().toArray(new JobStatusData[0]);
290
			return fJobMap.values().toArray(new JobStatusData[0]);
287
		}
291
		}
292
	}
293
294
	public String getUsername() {
295
		if (username == null) {
296
			return new String();
297
		}
298
		return username;
288
	}
299
	}
289
300
290
	/*
301
	/*
Lines 320-374 Link Here
320
	 */
331
	 */
321
	public void notifyListeners() {
332
	public void notifyListeners() {
322
		final LguiUpdatedEvent event = new LguiUpdatedEvent(this, lgui);
333
		final LguiUpdatedEvent event = new LguiUpdatedEvent(this, lgui);
323
		for (final ILguiListener l : listeners) {
334
		for (final ILguiListener listener : listeners) {
324
			l.handleEvent(event);
335
			listener.handleEvent(event);
325
		}
336
		}
326
	}
337
	}
327
328
	// public void reloadLastLayout(IMemento memento) {
329
	// final StringBuilder layout = new StringBuilder();
330
	//
331
	// if (memento != null) {
332
	// final IMemento child = memento.getChild(LAYOUT);
333
	// layout.append(child.getID());
334
	// }
335
	// LguiType lguiType = null;
336
	// if (layout.length() > 0) {
337
	// try {
338
	// lguiType = parseLML(layout.toString());
339
	// } catch (final JAXBException e) {
340
	// LMLCorePlugin.log(e);
341
	// }
342
	// }
343
	// if (lguiType != null) {
344
	// for (final JAXBElement<?> tag : lguiType
345
	// .getObjectsAndRelationsAndInformation()) {
346
	// if (tag.getValue() instanceof ComponentlayoutType) {
347
	// lgui = lguiType;
348
	// if (listeners.isEmpty()) {
349
	// createLguiHandlers();
350
	// }
351
	// }
352
	// }
353
	// }
354
	// }
355
338
356
	public void reloadLastLayout(StringBuilder layout) {
339
	public void reloadLastLayout(StringBuilder layout) {
357
		LguiType lguiType = null;
340
		LguiType lguiType = null;
358
		if (layout.length() > 0) {
341
		if (layout.length() > 0) {
359
			try {
342
			lguiType = jaxbUtil.unmarshal(layout.toString());
360
				lguiType = parseLML(layout.toString());
361
			} catch (final JAXBException e) {
362
				LMLCorePlugin.log(e);
363
			}
364
		}
343
		}
365
		if (lguiType != null) {
344
		if (lguiType != null) {
366
			for (final JAXBElement<?> tag : lguiType.getObjectsAndRelationsAndInformation()) {
345
			for (final Object object : jaxbUtil.getObjects(lguiType)) {
367
				if (tag.getValue() instanceof ComponentlayoutType) {
346
				if (object instanceof ComponentlayoutType) {
368
					lgui = lguiType;
347
					lgui = lguiType;
369
					if (listeners.isEmpty()) {
348
					if (listeners.isEmpty()) {
370
						createLguiHandlers();
349
						createLguiHandlers();
371
					}
350
					}
351
					break;
372
				}
352
				}
373
			}
353
			}
374
		}
354
		}
Lines 423-484 Link Here
423
		} else {
403
		} else {
424
			layoutLgui = getLayoutAccess().getLayoutFromModel();
404
			layoutLgui = getLayoutAccess().getLayoutFromModel();
425
		}
405
		}
426
		try {
406
		jaxbUtil.marshal(layoutLgui, writer);
427
			marshaller.setProperty("jaxb.schemaLocation", lmlNamespace + " lgui.xsd"); //$NON-NLS-1$ //$NON-NLS-2$
428
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
429
			final QName tagname = new QName(lmlNamespace, "lgui", "lml"); //$NON-NLS-1$ //$NON-NLS-2$
430
431
			final JAXBElement<LguiType> rootElement = new JAXBElement<LguiType>(tagname, LguiType.class, layoutLgui);
432
			/*
433
			 * Synchronize to avoid the dreaded "FWK005 parse may not be called while parsing" message
434
			 */
435
			synchronized (LguiItem.class) {
436
				marshaller.marshal(rootElement, writer);
437
			}
438
		} catch (final PropertyException e) {
439
			LMLCorePlugin.log(e);
440
		} catch (final JAXBException e) {
441
			LMLCorePlugin.log(e);
442
		}
443
		return writer.getBuffer().toString();
407
		return writer.getBuffer().toString();
444
	}
408
	}
445
409
446
	// public void saveCurrentLayout(IMemento memento) {
410
	public void setPattern(Map<String, List<IPattern>> pattern) {
447
	// if (memento == null) {
411
		if (pattern != null) {
448
	// return;
412
			filters = pattern;
449
	// }
413
		}
450
	// final StringWriter writer = new StringWriter();
414
	}
451
	// LguiType layoutLgui = null;
415
452
	// if (lgui == null) {
416
	public void setPattern(String gid, List<IPattern> filterValues) {
453
	// layoutLgui = firstRequest();
417
		while (lockUpdate) {
454
	// } else {
418
			// wait until the update with the server is finished
455
	// layoutLgui = getLayoutAccess().getLayoutFromModel();
419
		}
456
	// }
420
		lockPattern = true;
457
	// try {
421
		if (filters.containsKey(gid)) {
458
	// marshaller.setProperty(
422
			filters.remove(gid);
459
	//					"jaxb.schemaLocation", lmlNamespace + " lgui.xsd"); //$NON-NLS-1$ //$NON-NLS-2$
423
		}
460
	// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
424
		filters.put(gid, filterValues);
461
	// Boolean.TRUE);
425
		lockPattern = false;
462
	//			final QName tagname = new QName(lmlNamespace, "lgui", "lml"); //$NON-NLS-1$ //$NON-NLS-2$
426
	}
463
	//
464
	// final JAXBElement<LguiType> rootElement = new JAXBElement<LguiType>(
465
	// tagname, LguiType.class, layoutLgui);
466
	// /*
467
	// * Synchronize to avoid the dreaded
468
	// * "FWK005 parse may not be called while parsing" message
469
	// */
470
	// synchronized (LguiItem.class) {
471
	// marshaller.marshal(rootElement, writer);
472
	//
473
	// }
474
	// } catch (final PropertyException e) {
475
	// LMLCorePlugin.log(e);
476
	// } catch (final JAXBException e) {
477
	// LMLCorePlugin.log(e);
478
	// }
479
	// final IMemento layoutMemento = memento.createChild(LAYOUT, writer
480
	// .getBuffer().toString());
481
	// }
482
427
483
	public void setRequest(RequestType request) {
428
	public void setRequest(RequestType request) {
484
		this.request = request;
429
		this.request = request;
Lines 506-512 Link Here
506
	 * 
451
	 * 
507
	 * @see org.eclipse.ptp.rm.lml.core.model.ILguiItem#update(java.io.InputStream)
452
	 * @see org.eclipse.ptp.rm.lml.core.model.ILguiItem#update(java.io.InputStream)
508
	 */
453
	 */
509
	public void update(InputStream stream) throws JAXBException {
454
	public void update(InputStream stream) {
510
455
511
		final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
456
		final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
512
		StringBuilder xmlStream = new StringBuilder();
457
		StringBuilder xmlStream = new StringBuilder();
Lines 527-533 Link Here
527
			}
472
			}
528
		}
473
		}
529
		if (xmlStream.length() > 0) {
474
		if (xmlStream.length() > 0) {
530
			lgui = parseLML(xmlStream.toString());
475
			lgui = jaxbUtil.unmarshal(xmlStream.toString());
531
			if (listeners.isEmpty()) {
476
			if (listeners.isEmpty()) {
532
				createLguiHandlers();
477
				createLguiHandlers();
533
			}
478
			}
Lines 538-543 Link Here
538
			}
483
			}
539
			updateJobData();
484
			updateJobData();
540
		}
485
		}
486
		lockUpdate = false;
541
	}
487
	}
542
488
543
	/*
489
	/*
Lines 685-691 Link Here
685
		layoutLgui.setVersion("1"); //$NON-NLS-1$
631
		layoutLgui.setVersion("1"); //$NON-NLS-1$
686
		layoutLgui.setLayout(true);
632
		layoutLgui.setLayout(true);
687
633
688
		// final RequestType request = objectFactory.createRequestType();
689
		final LayoutRequestType layoutReq = objectFactory.createLayoutRequestType();
634
		final LayoutRequestType layoutReq = objectFactory.createLayoutRequestType();
690
		layoutReq.setGetDefaultData(true);
635
		layoutReq.setGetDefaultData(true);
691
636
Lines 705-730 Link Here
705
			return ACTIVE_JOB_TABLE;
650
			return ACTIVE_JOB_TABLE;
706
		}
651
		}
707
		return INACTIVE_JOB_TABLE;
652
		return INACTIVE_JOB_TABLE;
708
	}
709
710
	/**
711
	 * Parsing an XML file. The method generates from an XML file an instance of LguiType.
712
	 * 
713
	 * @param stream
714
	 *            the input stream of the XML file
715
	 * @return the generated LguiType
716
	 * @throws JAXBException
717
	 */
718
	@SuppressWarnings("unchecked")
719
	private LguiType parseLML(String string) throws JAXBException {
720
		/*
721
		 * Synchronize to avoid the dreaded "FWK005 parse may not be called while parsing" message
722
		 */
723
		final JAXBElement<LguiType> doc;
724
		synchronized (LguiItem.class) {
725
			doc = (JAXBElement<LguiType>) unmarshaller.unmarshal(new StringReader(string));
726
		}
727
		return doc.getValue();
728
	}
653
	}
729
654
730
	private void setCid() {
655
	private void setCid() {
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/OIDToInformation.java (-13 / +3 lines)
Lines 15-22 Link Here
15
import java.util.HashMap;
15
import java.util.HashMap;
16
import java.util.List;
16
import java.util.List;
17
17
18
import javax.xml.bind.JAXBElement;
19
20
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
18
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
21
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
19
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
22
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
20
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
Lines 28-36 Link Here
28
 * This class provides access to information-objects within a lml-model. It can
26
 * This class provides access to information-objects within a lml-model. It can
29
 * be used for fast and simple access to information filtered by the
27
 * be used for fast and simple access to information filtered by the
30
 * information-type or the object-id.
28
 * information-type or the object-id.
31
 * 
32
 * @author karbach
33
 * 
34
 */
29
 */
35
public class OIDToInformation extends LguiHandler {
30
public class OIDToInformation extends LguiHandler {
36
31
Lines 198-215 Link Here
198
193
199
		oidtoinfo = new HashMap<String, List<InfoType>>();
194
		oidtoinfo = new HashMap<String, List<InfoType>>();
200
195
201
		final List<JAXBElement<?>> alltags = lgui.getObjectsAndRelationsAndInformation();
196
		for (final Object object : jaxbUtil.getObjects(lgui)) {
202
197
203
		for (final JAXBElement<?> jaxbtag : alltags) {// over all
198
			if (!(object instanceof InformationType)) {
204
														// information-tags
205
206
			final Object tag = jaxbtag.getValue();
207
208
			if (!(tag instanceof InformationType)) {
209
				continue;
199
				continue;
210
			}
200
			}
211
201
212
			final InformationType ainfos = (InformationType) tag;
202
			final InformationType ainfos = (InformationType) object;
213
203
214
			final List<InfoType> realinfos = ainfos.getInfo();
204
			final List<InfoType> realinfos = ainfos.getInfo();
215
205
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/OverviewAccess.java (-14 / +12 lines)
Lines 14-21 Link Here
14
import java.util.LinkedList;
14
import java.util.LinkedList;
15
import java.util.List;
15
import java.util.List;
16
16
17
import javax.xml.bind.JAXBElement;
18
19
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
17
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
20
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
18
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
21
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
19
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
Lines 63-71 Link Here
63
	 */
61
	 */
64
	public List<GobjectType> getGraphicalObjects() {
62
	public List<GobjectType> getGraphicalObjects() {
65
		final List<GobjectType> objects = new LinkedList<GobjectType>();
63
		final List<GobjectType> objects = new LinkedList<GobjectType>();
66
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
64
		for (final Object object : jaxbUtil.getObjects(lgui)) {
67
			if (tag.getValue() instanceof GobjectType) {
65
			if (object instanceof GobjectType) {
68
				objects.add((GobjectType) tag.getValue());
66
				objects.add((GobjectType) object);
69
			}
67
			}
70
		}
68
		}
71
		return objects;
69
		return objects;
Lines 87-95 Link Here
87
	 */
85
	 */
88
	public List<InformationType> getInformations() {
86
	public List<InformationType> getInformations() {
89
		final List<InformationType> informations = new LinkedList<InformationType>();
87
		final List<InformationType> informations = new LinkedList<InformationType>();
90
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
88
		for (final Object object : jaxbUtil.getObjects(lgui)) {
91
			if (tag.getValue() instanceof InformationType) {
89
			if (object instanceof InformationType) {
92
				informations.add((InformationType) tag.getValue());
90
				informations.add((InformationType) object);
93
			}
91
			}
94
		}
92
		}
95
		return informations;
93
		return informations;
Lines 102-110 Link Here
102
	 */
100
	 */
103
	public List<LayoutType> getLayouts() {
101
	public List<LayoutType> getLayouts() {
104
		final List<LayoutType> layouts = new LinkedList<LayoutType>();
102
		final List<LayoutType> layouts = new LinkedList<LayoutType>();
105
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
103
		for (final Object object : jaxbUtil.getObjects(lgui)) {
106
			if (tag.getValue() instanceof LayoutType) {
104
			if (object instanceof LayoutType) {
107
				layouts.add((LayoutType) tag.getValue());
105
				layouts.add((LayoutType) object);
108
			}
106
			}
109
		}
107
		}
110
		return layouts;
108
		return layouts;
Lines 117-125 Link Here
117
	 */
115
	 */
118
	public List<ObjectsType> getObjects() {
116
	public List<ObjectsType> getObjects() {
119
		final List<ObjectsType> objects = new LinkedList<ObjectsType>();
117
		final List<ObjectsType> objects = new LinkedList<ObjectsType>();
120
		for (final JAXBElement<?> tag : lgui.getObjectsAndRelationsAndInformation()) {
118
		for (final Object object : jaxbUtil.getObjects(lgui)) {
121
			if (tag.getValue() instanceof ObjectsType) {
119
			if (object instanceof ObjectsType) {
122
				objects.add((ObjectsType) tag.getValue());
120
				objects.add((ObjectsType) object);
123
			}
121
			}
124
		}
122
		}
125
		return objects;
123
		return objects;
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/Pattern.java (+105 lines)
Added Link Here
1
/* Copyright (c) 2011 Forschungszentrum Juelich GmbH
2
 * All rights reserved. This program and the accompanying materials
3
 * are made available under the terms of the Eclipse Public License v1.0
4
 * which accompanies this distribution and is available at
5
 * http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Contributors:
8
 * 		Claudia Knobloch, Carsten Karbach, FZ Juelich
9
 */
10
package org.eclipse.ptp.rm.lml.internal.core.model;
11
12
import org.eclipse.ptp.rm.lml.core.model.IPattern;
13
14
public class Pattern implements IPattern {
15
16
	private String columntitle;
17
18
	private String type;
19
20
	private boolean relation;
21
22
	private boolean range;
23
24
	// Relation
25
	private String valueRelation;
26
27
	private String relationOperator;
28
29
	// Range
30
	private String minValueRange;
31
32
	private String maxValueRange;
33
34
	public Pattern(String title, String type) {
35
		columntitle = title;
36
		this.type = type;
37
		if (columntitle == null) {
38
			columntitle = new String();
39
		}
40
		if (this.type == null) {
41
			this.type = new String("alpha");
42
		}
43
	}
44
45
	public String getColumnTitle() {
46
		return columntitle;
47
	}
48
49
	public String getMaxValueRange() {
50
		return maxValueRange;
51
	}
52
53
	public String getMinValueRange() {
54
		return minValueRange;
55
	}
56
57
	public String getRelationOperator() {
58
		return relationOperator;
59
	}
60
61
	public String getType() {
62
		return type;
63
	}
64
65
	public String getRelationValue() {
66
		return valueRelation;
67
	}
68
69
	public boolean isRange() {
70
		return (range && !relation);
71
	}
72
73
	public boolean isRelation() {
74
		return (relation && !range);
75
	}
76
77
	public IPattern setRange(String minValueRange, String maxValueRange) {
78
		this.range = true;
79
		this.relation = false;
80
		this.minValueRange = minValueRange;
81
		this.maxValueRange = maxValueRange;
82
		if (minValueRange == null) {
83
			this.minValueRange = new String();
84
		}
85
		if (maxValueRange == null) {
86
			this.maxValueRange = new String();
87
		}
88
		return this;
89
	}
90
91
	public IPattern setRelation(String relationOperator, String valueRelation) {
92
		this.relation = true;
93
		this.range = false;
94
		this.relationOperator = relationOperator;
95
		this.valueRelation = valueRelation;
96
		if (relationOperator == null) {
97
			this.relationOperator = new String("=");
98
		}
99
		if (valueRelation == null) {
100
			this.valueRelation = new String();
101
		}
102
		return this;
103
	}
104
105
}
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/TableColumnLayout.java (-2 / +14 lines)
Lines 38-43 Link Here
38
	 */
38
	 */
39
	private final boolean active;
39
	private final boolean active;
40
40
41
	/*
42
	 * Order of the data.
43
	 */
44
	private String order;
45
41
	/**
46
	/**
42
	 * Constructor
47
	 * Constructor
43
	 * 
48
	 * 
Lines 50-61 Link Here
50
	 * @param activity
55
	 * @param activity
51
	 *            of the column
56
	 *            of the column
52
	 */
57
	 */
53
	public TableColumnLayout(String title, Double width, String style,
58
	public TableColumnLayout(String title, Double width, String style, boolean active, String order) {
54
			boolean active) {
55
		this.title = title;
59
		this.title = title;
56
		this.width = width;
60
		this.width = width;
57
		this.style = style;
61
		this.style = style;
58
		this.active = active;
62
		this.active = active;
63
		this.order = order;
59
		if (title == null) {
64
		if (title == null) {
60
			this.title = new String();
65
			this.title = new String();
61
		}
66
		}
Lines 65-70 Link Here
65
		if (style == null) {
70
		if (style == null) {
66
			this.style = ITableColumnLayout.COLUMN_STYLE_LEFT;
71
			this.style = ITableColumnLayout.COLUMN_STYLE_LEFT;
67
		}
72
		}
73
		if (order == null) {
74
			this.order = new String("alpha");
75
		}
76
	}
77
78
	public String getOrder() {
79
		return order;
68
	}
80
	}
69
81
70
	/*
82
	/*
(-)a/rms/org.eclipse.ptp.rm.lml.core/src/org/eclipse/ptp/rm/lml/internal/core/model/TableHandler.java (-17 / +198 lines)
Lines 14-24 Link Here
14
import java.math.BigInteger;
14
import java.math.BigInteger;
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.Arrays;
16
import java.util.Arrays;
17
import java.util.HashMap;
17
import java.util.LinkedList;
18
import java.util.LinkedList;
18
import java.util.List;
19
import java.util.List;
19
20
import java.util.Map;
20
import javax.xml.bind.JAXBElement;
21
import javax.xml.namespace.QName;
22
21
23
import org.eclipse.ptp.rm.lml.core.ILMLCoreConstants;
22
import org.eclipse.ptp.rm.lml.core.ILMLCoreConstants;
24
import org.eclipse.ptp.rm.lml.core.JobStatusData;
23
import org.eclipse.ptp.rm.lml.core.JobStatusData;
Lines 27-32 Link Here
27
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
26
import org.eclipse.ptp.rm.lml.core.events.ILguiUpdatedEvent;
28
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
27
import org.eclipse.ptp.rm.lml.core.listeners.ILguiListener;
29
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
28
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
29
import org.eclipse.ptp.rm.lml.core.model.IPattern;
30
import org.eclipse.ptp.rm.lml.core.model.ITableColumnLayout;
30
import org.eclipse.ptp.rm.lml.core.model.ITableColumnLayout;
31
import org.eclipse.ptp.rm.lml.internal.core.elements.CellType;
31
import org.eclipse.ptp.rm.lml.internal.core.elements.CellType;
32
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnType;
32
import org.eclipse.ptp.rm.lml.internal.core.elements.ColumnType;
Lines 137-147 Link Here
137
				table.getColumn().add(column);
137
				table.getColumn().add(column);
138
			}
138
			}
139
		}
139
		}
140
		lgui.getObjectsAndRelationsAndInformation().add(
140
		jaxbUtil.addTable(lgui, table);
141
				new JAXBElement<TableType>(new QName(
142
						ILMLCoreConstants.TABLE_ELEMENT), TableType.class,
143
						table));
144
		return table;
141
		return table;
142
	}
143
144
	public ITableColumnLayout[] getActiveTableColumnLayout(String gid) {
145
		final ITableColumnLayout[] allColumns = getTableColumnLayout(gid);
146
		final List<ITableColumnLayout> activeColumns = new ArrayList<ITableColumnLayout>();
147
		for (final ITableColumnLayout allColumn : allColumns) {
148
			if (allColumn.isActive()) {
149
				activeColumns.add(allColumn);
150
			}
151
		}
152
		return activeColumns.toArray(new ITableColumnLayout[activeColumns.size()]);
145
	}
153
	}
146
154
147
	public String getCellValue(TableType table, RowType row, String colName) {
155
	public String getCellValue(TableType table, RowType row, String colName) {
Lines 240-248 Link Here
240
	 *            ID of the table layout
248
	 *            ID of the table layout
241
	 * @return column layout
249
	 * @return column layout
242
	 */
250
	 */
251
	/**
252
	 * Get the column layout for the table
253
	 * 
254
	 * @param gid
255
	 *            ID of the table layout
256
	 * @return column layout
257
	 */
243
	public ITableColumnLayout[] getTableColumnLayout(String gid) {
258
	public ITableColumnLayout[] getTableColumnLayout(String gid) {
244
		if (lguiItem == null && lguiItem.getLayoutAccess() == null) {
259
		if (lguiItem == null && lguiItem.getLayoutAccess() == null) {
245
			return null;
260
			return new ITableColumnLayout[0];
246
		}
261
		}
247
262
248
		final BigInteger[] cids = getCids(gid);
263
		final BigInteger[] cids = getCids(gid);
Lines 256-271 Link Here
256
			final ColumnlayoutType column = layoutColumns[i];
271
			final ColumnlayoutType column = layoutColumns[i];
257
			if (column != null) {
272
			if (column != null) {
258
				String style;
273
				String style;
274
				final String sort = getColumnSortProperty(getTable(gid), cids,
275
						i);
259
				// when there is a change
276
				// when there is a change
260
				if (column.getKey() != null
277
				if (column.getSorted() != null
261
						&& (column.getKey().equals(ILguiItem.JOB_WALL) || column
278
						&& column.getSorted().value() != null && sort != null
262
								.getKey().equals(ILguiItem.JOB_TOTAL_CORES))) {
279
						&& sort.equals("numeric")) {
263
					style = ITableColumnLayout.COLUMN_STYLE_RIGHT;
280
					style = ITableColumnLayout.COLUMN_STYLE_RIGHT;
264
				} else {
281
				} else {
265
					style = ITableColumnLayout.COLUMN_STYLE_LEFT;
282
					style = ITableColumnLayout.COLUMN_STYLE_LEFT;
266
				}
283
				}
267
				tableColumnLayouts[i] = new TableColumnLayout(column.getKey(),
284
				tableColumnLayouts[i] = new TableColumnLayout(column.getKey(),
268
						column.getWidth(), style, column.isActive());
285
						column.getWidth(), style, column.isActive(), sort);
269
			}
286
			}
270
		}
287
		}
271
		return tableColumnLayouts;
288
		return tableColumnLayouts;
Lines 286-291 Link Here
286
		}
303
		}
287
		return tableColumnNonActive.toArray(new String[tableColumnNonActive
304
		return tableColumnNonActive.toArray(new String[tableColumnNonActive
288
				.size()]);
305
				.size()]);
306
	}
307
308
	public String[] getTableColumnTitles(String gid) {
309
		if (lguiItem == null && lguiItem.getLayoutAccess() == null) {
310
			return null;
311
		}
312
		final ColumnlayoutType[] layoutColumns = lguiItem.getLayoutAccess()
313
				.getLayoutColumsToCids(getCidsActiveColumns(gid), gid);
314
		final List<String> titles = new ArrayList<String>();
315
		for (final ColumnlayoutType layoutColumn : layoutColumns) {
316
			if (layoutColumn.getKey() != null) {
317
				titles.add(layoutColumn.getKey());
318
			}
319
		}
320
321
		return titles.toArray(new String[titles.size()]);
289
	}
322
	}
290
323
291
	/**
324
	/**
Lines 346-351 Link Here
346
			tableData[i].setCells(tableDataRow);
379
			tableData[i].setCells(tableDataRow);
347
		}
380
		}
348
		return tableData;
381
		return tableData;
382
	}
383
384
	public Row[] getTableDataWithColor(String gid, boolean addColor, List<IPattern> filterTitlesValues) {
385
		final Row[] rows = getTableDataWithColor(gid, addColor);
386
		if (rows.length == 0) {
387
			return rows;
388
		}
389
		final BigInteger[] cids = getCids(gid);
390
		final TableType table = getTable(gid);
391
392
		// Convert Map filterTitlesValues into Map filterPosValues
393
		final Map<Integer, IPattern> filterPosValues = new HashMap<Integer, IPattern>();
394
		for (final IPattern pattern : filterTitlesValues) {
395
			BigInteger cid = BigInteger.valueOf(-1);
396
			for (final ColumnType column : table.getColumn()) {
397
				if (column.getName().equals(pattern.getColumnTitle())) {
398
					cid = column.getId();
399
					break;
400
				}
401
			}
402
			if (cid.equals(BigInteger.valueOf(-1))) {
403
				continue;
404
			}
405
			int position = -1;
406
			for (int i = 0; i < cids.length; i++) {
407
				if (cids[i].equals(cid)) {
408
					position = i;
409
					break;
410
				}
411
			}
412
			if (position == -1) {
413
				continue;
414
			}
415
416
			filterPosValues.put(position, pattern);
417
		}
418
419
		// Filter the rows
420
		final List<Row> filterRows = new ArrayList<Row>();
421
		for (final Row row : rows) {
422
			boolean allIncluded = true;
423
			for (final int position : filterPosValues.keySet()) {
424
425
				if (row.cells[position] == null) {
426
					continue;
427
				}
428
				final IPattern pattern = filterPosValues.get(position);
429
				final String rowValue = row.cells[position].value;
430
431
				final String type = pattern.getType();
432
433
				if (pattern.isRange()) {
434
					// Range
435
					final String minValue = pattern.getMinValueRange();
436
					final String maxValue = pattern.getMaxValueRange();
437
					if (type.equals("numeric")) {
438
						if ((Integer.valueOf(rowValue) < Integer.valueOf(minValue))
439
								|| (Integer.valueOf(maxValue) < Integer.valueOf(rowValue))) {
440
							allIncluded = false;
441
							break;
442
						}
443
					} else {
444
						if (rowValue.compareTo(minValue) < 0 || maxValue.compareTo(rowValue) < 0) {
445
							allIncluded = false;
446
							break;
447
						}
448
					}
449
				} else if (pattern.isRelation()) {
450
					// Relation
451
					final String compareValue = pattern.getRelationValue();
452
					final String compareOperator = pattern.getRelationOperator();
453
					if (type.equals("numeric")) {
454
						final int rowValueInt = Integer.valueOf(rowValue);
455
						final int compareValueInt = Integer.valueOf(compareValue);
456
						if (compareOperator.equals("=") && rowValueInt != compareValueInt) {
457
							allIncluded = false;
458
							break;
459
						} else if (compareOperator.equals("!=") && rowValueInt == compareValueInt) {
460
							allIncluded = false;
461
							break;
462
						} else if (compareOperator.equals("<") && rowValueInt >= compareValueInt) {
463
							allIncluded = false;
464
							break;
465
						} else if (compareOperator.equals("<=") && rowValueInt > compareValueInt) {
466
							allIncluded = false;
467
							break;
468
						} else if (compareOperator.equals(">") && rowValueInt <= compareValueInt) {
469
							allIncluded = false;
470
							break;
471
						} else if (compareOperator.equals(">=") && rowValueInt < compareValueInt) {
472
							allIncluded = false;
473
							break;
474
						}
475
					} else {
476
						if ((compareOperator.equals("=") && !compareValue.equals(rowValue))
477
								|| (compareOperator.equals("!=") && compareValue.equals(rowValue))) {
478
							allIncluded = false;
479
							break;
480
						} else if (type.equals("alpha")) {
481
							if ((compareOperator.equals("=~") && !rowValue.contains(compareValue))
482
									|| (compareOperator.equals("!~") && rowValue.contains(compareValue))) {
483
								allIncluded = false;
484
								break;
485
							}
486
						} else if (type.equals("date")) {
487
							if (compareOperator.equals("<") && rowValue.compareTo(compareValue) >= 0) {
488
								allIncluded = false;
489
								break;
490
							} else if (compareOperator.equals("<=") && rowValue.compareTo(compareValue) > 0) {
491
								allIncluded = false;
492
								break;
493
							} else if (compareOperator.equals(">") && rowValue.compareTo(compareValue) <= 0) {
494
								allIncluded = false;
495
								break;
496
							} else if (compareOperator.equals(">=") && rowValue.compareTo(compareValue) < 0) {
497
								allIncluded = false;
498
								break;
499
							}
500
						}
501
					}
502
				}
503
			}
504
			if (allIncluded) {
505
				filterRows.add(row);
506
			}
507
		}
508
509
		return filterRows.toArray(new Row[filterRows.size()]);
349
	}
510
	}
350
511
351
	/**
512
	/**
Lines 471-480 Link Here
471
		final PatternType pattern = new PatternType();
632
		final PatternType pattern = new PatternType();
472
		final PatternMatchType patternMatch = new PatternMatchType();
633
		final PatternMatchType patternMatch = new PatternMatchType();
473
		patternMatch.setRegexp(regexp);
634
		patternMatch.setRegexp(regexp);
474
		pattern.getIncludeAndExclude().add(
635
		jaxbUtil.addPatternInclude(pattern, patternMatch);
475
				new JAXBElement<PatternMatchType>(new QName(
476
						ILMLCoreConstants.INCLUDE_ELEMENT),
477
						PatternMatchType.class, patternMatch));
478
		column.setPattern(pattern);
636
		column.setPattern(pattern);
479
	}
637
	}
480
638
Lines 515-520 Link Here
515
		return cids;
673
		return cids;
516
	}
674
	}
517
675
676
	/**
677
	 * Get column indexes of active columns for the table layout
678
	 * 
679
	 * @param gid
680
	 *            ID of the table layout
681
	 * @return array of column indexes
682
	 */
683
	private BigInteger[] getCidsActiveColumns(String gid) {
684
		final TablelayoutType layout = lguiItem.getLayoutAccess()
685
				.getTableLayout(gid);
686
		final List<BigInteger> cids = new ArrayList<BigInteger>();
687
		for (int i = 0; i < layout.getColumn().size(); i++) {
688
			for (final ColumnlayoutType column : layout.getColumn()) {
689
				if (column.getPos() != null
690
						&& column.getPos().equals(BigInteger.valueOf(i))
691
						&& column.isActive()) {
692
					cids.add(column.getCid());
693
				}
694
			}
695
		}
696
		return cids.toArray(new BigInteger[cids.size()]);
697
	}
698
518
	private BigInteger getColumnIndex(TableType table, String colName) {
699
	private BigInteger getColumnIndex(TableType table, String colName) {
519
		if (table != null) {
700
		if (table != null) {
520
			for (final ColumnType column : table.getColumn()) {
701
			for (final ColumnType column : table.getColumn()) {
Lines 546-552 Link Here
546
				}
727
				}
547
			}
728
			}
548
		}
729
		}
549
		return null;
730
		return "alpha";
550
	}
731
	}
551
732
552
	/**
733
	/**
(-)a/rms/org.eclipse.ptp.rm.lml.da.server/.gitignore (+1 lines)
Added Link Here
1
/lml-driver.tar
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML2LML/LML_gen_nodedisplay.pm (-1 / +344 lines)
Lines 83-88 Link Here
83
	$self->_adjust_layout_bg();
83
	$self->_adjust_layout_bg();
84
84
85
85
86
    } elsif($self->{SYSTEMTYPE} eq "CRAYXT") {
87
	my($maxpcol,$maxprow,$maxpcage,$maxpslot,$maxpnode)=$self->_get_system_size_crayxt();
88
	if(!$self->_init_trees_crayxt($maxpcol,$maxprow,$maxpcage,$maxpslot,$maxpnode)) {
89
	    print "ERROR: could not init internal data structures, system type: $self->{SYSTEMTYPE}, aborting ...\n";
90
	    return(-1);
91
	}
92
	# init data tree with empty root nodes
93
	$self->_add_empty_root_elements();
94
	
95
	$self->_adjust_layout_crayxt();
96
97
98
86
    } elsif($self->{SYSTEMTYPE} eq "Cluster") {
99
    } elsif($self->{SYSTEMTYPE} eq "Cluster") {
87
100
88
	# user define scheme given
101
	# user define scheme given
Lines 165-174 Link Here
165
	$inforef=$self->{LMLFH}->{DATA}->{INFODATA}->{$key};
178
	$inforef=$self->{LMLFH}->{DATA}->{INFODATA}->{$key};
166
	next if($inforef->{status} ne 'RUNNING');
179
	next if($inforef->{status} ne 'RUNNING');
167
	if(exists($inforef->{vnodelist})) {
180
	if(exists($inforef->{vnodelist})) {
168
	    $nodelist=$self->_remap_nodes($inforef->{vnodelist});
181
	    $nodelist=$self->_remap_nodes_vnode($inforef->{vnodelist});
169
	} else {
182
	} else {
170
	    $nodelist=$self->_remap_nodes($inforef->{nodelist});
183
	    $nodelist=$self->_remap_nodes($inforef->{nodelist});
171
	}
184
	}
185
#	print "_insert_run_jobs job $key nodelist $nodelist\n";
172
	$self->insert_job_into_nodedisplay($self->{SCHEMEROOT},$self->{DATAROOT},$nodelist,$key);
186
	$self->insert_job_into_nodedisplay($self->{SCHEMEROOT},$self->{DATAROOT},$nodelist,$key);
173
	push(@idlist,$key);
187
	push(@idlist,$key);
174
	$jcount++;
188
	$jcount++;
Lines 331-336 Link Here
331
	}
345
	}
332
	$newnodelist.="," if($newnodelist);
346
	$newnodelist.="," if($newnodelist);
333
	$newnodelist.=sprintf("%s-c%02d",$newnode,$num);
347
	$newnodelist.=sprintf("%s-c%02d",$newnode,$num);
348
    }
349
    return($newnodelist);
350
}
351
352
sub _remap_nodes_vnode {
353
    my($self) = shift;
354
    my($nodelist)=shift;
355
    my($newnodelist,$spec,$node,$num,$number,$newnode,$start);
356
    if($self->{SYSTEMTYPE} eq "BG/P") {
357
	return($nodelist);
358
    }
359
    foreach $spec (split(/\),?\(/,$nodelist)) {
360
	# change form '(node,number tasks)' to (node-c<num>, ...)
361
	if($spec=~/\(?([^,]+),(\d+)\)?/) {
362
	    $node=$1;$number=$2;
363
	} elsif($spec=~/^([^,]+)$/) {
364
	    $node=$1;$number=0;	
365
	} else {
366
	    print "ERROR: _remap_nodes: unknown node in spec '$spec', skipping\n";
367
	}
368
	
369
	if(exists($self->{NODEMAPPING}->{$node})) {
370
	    $newnode=$self->{NODEMAPPING}->{$node}; 
371
	} else {
372
	    $newnode=$node;
373
	}
374
	
375
	if(!exists($self->{NODELASTTASKNUMBER}->{$node})) {
376
	    $self->{NODELASTTASKNUMBER}->{$node}=-1;
377
	}
378
	$start=$self->{NODELASTTASKNUMBER}->{$node}+1;
379
	for($num=$start;$num<$start+$number;$num++) {
380
	    $newnodelist.="," if($newnodelist);
381
	    $newnodelist.=sprintf("%s-c%02d",$newnode,$num);
382
	}
334
    }
383
    }
335
    return($newnodelist);
384
    return($newnodelist);
336
}
385
}
Lines 890-893 Link Here
890
}
939
}
891
940
892
941
942
###############################################
943
# Cray XT related
944
############################################### 
945
sub _adjust_layout_crayxt  {
946
    my($self) = shift;
947
    my($root_layout,$root_scheme,$treenode,$ltreenode,$streenode,$num,$min,$max,$lmin,$lmax);
948
    my $rc=1;
949
    my $maxlevel=6;
950
  
951
    $root_layout=$self->{LAYOUT}->{tree};
952
    $root_scheme=$self->{SCHEMEROOT};
953
954
    # COLS
955
    ######
956
    $streenode=$root_scheme->get_child({_name => "el1" });
957
    $ltreenode=$root_layout->get_child({_name => "el0" });
958
959
    # get number of rows (in el1 of scheme)
960
    if($streenode) {
961
	$min=$streenode->{ATTR}->{min};
962
	$max=$streenode->{ATTR}->{max};
963
	$num=$max-$min+1;
964
	
965
    } else {
966
	print STDERR "$0: ERROR: inconsistent scheme tree for Cray XT system (cols) ...\n";return(0);
967
    }
968
    
969
    if(!$ltreenode) {
970
	$ltreenode=$root_layout->new_child();
971
    }
972
    # set size attributes
973
    $ltreenode->{ATTR}->{rows}=1;
974
    $ltreenode->{ATTR}->{cols}=$num;
975
976
    # set some default layout attributes
977
#    $ltreenode->{ATTR}->{maxlevel} = 6              if(!exists($ltreenode->{ATTR}->{maxlevel}));
978
    $ltreenode->{ATTR}->{maxlevel} = 4              ;
979
    $ltreenode->{ATTR}->{vgap} = 5                  if(!exists($ltreenode->{ATTR}->{vgap}));
980
    $ltreenode->{ATTR}->{hgap} = 0                  if(!exists($ltreenode->{ATTR}->{hgap}));       
981
    $ltreenode->{ATTR}->{fontsize} = 10             if(!exists($ltreenode->{ATTR}->{fontsize}));   
982
    $ltreenode->{ATTR}->{border}   = 0              if(!exists($ltreenode->{ATTR}->{border}));     
983
    $ltreenode->{ATTR}->{fontfamily} = "Monospaced" if(!exists($ltreenode->{ATTR}->{fontfamily})); 
984
    $ltreenode->{ATTR}->{showtitle}  = "false"      if(!exists($ltreenode->{ATTR}->{showtitle}));  
985
    $ltreenode->{ATTR}->{background} = "#777"       if(!exists($ltreenode->{ATTR}->{background})); 
986
    $ltreenode->{ATTR}->{mouseborder}= 0            if(!exists($ltreenode->{ATTR}->{mouseborder})); 
987
    $ltreenode->{ATTR}->{transparent}= "false"      if(!exists($ltreenode->{ATTR}->{transparent}));
988
    $lmin=$min;$lmax=$max;
989
990
    # Rack
991
    ######
992
    $streenode=$streenode->get_child({_name => "el2" });
993
994
    # get number of rows (in el1 of scheme)
995
    if($streenode) {
996
	$min=$streenode->{ATTR}->{min};
997
	$max=$streenode->{ATTR}->{max};
998
	$num=$max-$min+1;
999
    } else {
1000
	print STDERR "$0: ERROR: inconsistent scheme tree for Cray XT system (rows) ...\n";return(0);
1001
    }
1002
    
1003
    $treenode=$ltreenode->get_child({_name => "el1" });
1004
    if(!$treenode) {
1005
	$treenode=$ltreenode->new_child();
1006
    } 
1007
    $ltreenode=$treenode;
1008
1009
    # set size attributes
1010
    $ltreenode->{ATTR}->{rows}=$num;
1011
    $ltreenode->{ATTR}->{cols}=1;
1012
1013
    # set some default layout attributes
1014
#    $ltreenode->{ATTR}->{maxlevel} = 5              if(!exists($ltreenode->{ATTR}->{maxlevel}));
1015
    $ltreenode->{ATTR}->{maxlevel} = 5;
1016
    $ltreenode->{ATTR}->{vgap} = 5                  if(!exists($ltreenode->{ATTR}->{vgap}));
1017
    $ltreenode->{ATTR}->{hgap} = 0                  if(!exists($ltreenode->{ATTR}->{hgap}));       
1018
#    $ltreenode->{ATTR}->{fontsize} = 10             if(!exists($ltreenode->{ATTR}->{fontsize}));   
1019
#    $ltreenode->{ATTR}->{border}   = 0              if(!exists($ltreenode->{ATTR}->{border}));     
1020
#    $ltreenode->{ATTR}->{fontfamily} = "Monospaced" if(!exists($ltreenode->{ATTR}->{fontfamily})); 
1021
    $ltreenode->{ATTR}->{showtitle}  = "true"       if(!exists($ltreenode->{ATTR}->{showtitle}));  
1022
#    $ltreenode->{ATTR}->{background} = "#777"       if(!exists($ltreenode->{ATTR}->{background})); 
1023
#    $ltreenode->{ATTR}->{mouseborder}= 0            if(!exists($ltreenode->{ATTR}->{mouseborder})); 
1024
#    $ltreenode->{ATTR}->{transparent}= "false"      if(!exists($ltreenode->{ATTR}->{transparent}));
1025
    $lmin=$min;$lmax=$max;
1026
1027
    # Cage
1028
    #######
1029
    $streenode=$streenode->get_child({_name => "el3" });
1030
1031
    # get number of cages (in el2 of scheme)
1032
    if($streenode) {
1033
	$min=$streenode->{ATTR}->{min};
1034
	$max=$streenode->{ATTR}->{max};
1035
	$num=$max-$min+1;
1036
    } else {
1037
	print STDERR "$0: ERROR: inconsistent scheme tree for BG system (racks) ...\n";return(0);
1038
    }
1039
    
1040
    $treenode=$ltreenode->get_child({_name => "el2" });
1041
    if(!$treenode) {
1042
	$treenode=$ltreenode->new_child();
1043
    } 
1044
    $ltreenode=$treenode;
1045
1046
    # set size attributes
1047
    $ltreenode->{ATTR}->{rows}=$num;    $ltreenode->{ATTR}->{cols}=1;
1048
    $ltreenode->{ATTR}->{min}=$lmin;    $ltreenode->{ATTR}->{max}=$lmax;
1049
1050
    # set some default layout attributes
1051
    $ltreenode->{ATTR}->{maxlevel} = 6             if(!exists($ltreenode->{ATTR}->{maxlevel}));
1052
    $ltreenode->{ATTR}->{showtitle}  = "true"      if(!exists($ltreenode->{ATTR}->{showtitle}));  
1053
    $lmin=$min;$lmax=$max;
1054
1055
    # blade
1056
    #######
1057
    $streenode=$streenode->get_child({_name => "el4" });
1058
1059
    # get number of slots (in el3 of scheme)
1060
    if($streenode) {
1061
	$min=$streenode->{ATTR}->{min};
1062
	$max=$streenode->{ATTR}->{max};
1063
	$num=$max-$min+1;
1064
    } else {
1065
	print STDERR "$0: ERROR: inconsistent scheme tree for BG system (midplanes) ...\n";return(0);
1066
    }
1067
    
1068
    $treenode=$ltreenode->get_child({_name => "el3" });
1069
    if(!$treenode) {
1070
	$treenode=$ltreenode->new_child();
1071
    } 
1072
    $ltreenode=$treenode;
1073
1074
    # set size attributes
1075
    $ltreenode->{ATTR}->{rows}=1;       $ltreenode->{ATTR}->{cols}=$num;
1076
    $ltreenode->{ATTR}->{min}=$lmin;    $ltreenode->{ATTR}->{max}=$lmax;
1077
1078
    # set some default layout attributes
1079
    $ltreenode->{ATTR}->{maxlevel}         = 6             if(!exists($ltreenode->{ATTR}->{maxlevel}));
1080
    $ltreenode->{ATTR}->{showtitle}        = "false"        if(!exists($ltreenode->{ATTR}->{showtitle}));  
1081
    $ltreenode->{ATTR}->{highestrowfirst}  = "true"        if(!exists($ltreenode->{ATTR}->{highestrowfirst}));  
1082
    $ltreenode->{ATTR}->{showfulltitle}    = "false"        if(!exists($ltreenode->{ATTR}->{showfulltitle}));  
1083
    $lmin=$min;$lmax=$max;
1084
1085
1086
    # Node
1087
    ######
1088
    $streenode=$streenode->get_child({_name => "el5" });
1089
1090
    # get number of midplanes (in el4 of scheme)
1091
    if($streenode) {
1092
	$min=$streenode->{ATTR}->{min};
1093
	$max=$streenode->{ATTR}->{max};
1094
	$num=$max-$min+1;
1095
    } else {
1096
	print STDERR "$0: ERROR: inconsistent scheme tree for BG system (nodeboards) ...\n";return(0);
1097
    }
1098
    
1099
    $treenode=$ltreenode->get_child({_name => "el4" });
1100
    if(!$treenode) {
1101
	$treenode=$ltreenode->new_child();
1102
    } 
1103
    $ltreenode=$treenode;
1104
1105
    # set size attributes
1106
    $ltreenode->{ATTR}->{rows}=$num;    $ltreenode->{ATTR}->{cols}=1;
1107
    $ltreenode->{ATTR}->{min}=$lmin;    $ltreenode->{ATTR}->{max}=$lmax;
1108
1109
    # set some default layout attributes
1110
    $ltreenode->{ATTR}->{maxlevel}         = $maxlevel     if(!exists($ltreenode->{ATTR}->{maxlevel}));
1111
    $ltreenode->{ATTR}->{showtitle}        = "false"        if(!exists($ltreenode->{ATTR}->{showtitle}));  
1112
    $ltreenode->{ATTR}->{fontsize}         = 8             if(!exists($ltreenode->{ATTR}->{fontsize}));   
1113
    $ltreenode->{ATTR}->{vgap}             = 0             if(!exists($ltreenode->{ATTR}->{vgap}));
1114
    $ltreenode->{ATTR}->{hgap}             = 0             if(!exists($ltreenode->{ATTR}->{hgap}));       
1115
    $ltreenode->{ATTR}->{highestrowfirst}  = "true"        if(!exists($ltreenode->{ATTR}->{highestrowfirst}));  
1116
    $ltreenode->{ATTR}->{showfulltitle}    = "false"       if(!exists($ltreenode->{ATTR}->{showfulltitle}));  
1117
    $lmin=$min;$lmax=$max;
1118
1119
    # cores
1120
    #######
1121
    $streenode=$streenode->get_child({_name => "el6" });
1122
1123
    # get number of midplanes (in el6 of scheme)
1124
    if($streenode) {
1125
	$min=$streenode->{ATTR}->{min};
1126
	$max=$streenode->{ATTR}->{max};
1127
	$num=$max-$min+1;
1128
    } else {
1129
	print STDERR "$0: ERROR: inconsistent scheme tree for BG system (cores) ...\n";return(0);
1130
    }
1131
    
1132
    $treenode=$ltreenode->get_child({_name => "el5" });
1133
    if(!$treenode) {
1134
	$treenode=$ltreenode->new_child();
1135
    } 
1136
    $ltreenode=$treenode;
1137
1138
    # set size attributes
1139
    $ltreenode->{ATTR}->{rows}=1;       $ltreenode->{ATTR}->{cols}=12;
1140
    $ltreenode->{ATTR}->{min}=$lmin;    $ltreenode->{ATTR}->{max}=$lmax;
1141
1142
    # set some default layout attributes
1143
    $ltreenode->{ATTR}->{maxlevel}         = $maxlevel     if(!exists($ltreenode->{ATTR}->{maxlevel}));
1144
    $lmin=$min;$lmax=$max;
1145
1146
1147
#    print "$0: LAYOUT: ",Dumper($root_layout);
1148
#    print "$0: SCHEME: ",Dumper($root_scheme);
1149
1150
    return($rc);
1151
}
1152
1153
1154
###############################################
1155
# Cray XT related
1156
############################################### 
1157
sub _get_system_size_crayxt {
1158
    my($self) = shift;
1159
    my($indataref) = $self->{INDATA};
1160
    my($nodename,$pcol,$prow,$pcage,$pslot,$pnode);
1161
    my($maxpcol,$maxprow,$maxpcage,$maxpslot,$maxpnode);
1162
1163
    my ($key,$ref);
1164
    
1165
    $maxpcol=    $maxprow=    $maxpcage=    $maxpslot=    $maxpnode= 0;
1166
    keys(%{$self->{LMLFH}->{DATA}->{OBJECT}}); # reset iterator
1167
    while(($key,$ref)=each(%{$self->{LMLFH}->{DATA}->{OBJECT}})) {
1168
	next if($ref->{type} ne 'node');
1169
	$nodename=$self->{LMLFH}->{DATA}->{OBJECT}->{$key}->{name};
1170
	if($nodename=~/^c(\d+)-(\d+)c(\d+)s(\d+)n(\d+)$/) {
1171
	    ($pcol,$prow,$pcage,$pslot,$pnode)=($1,$2,$3,$4,$5);
1172
	} else {
1173
	    print "_get_system_size_crayxt: node name could not be parsed: $nodename\n";
1174
	}
1175
	$maxpcol=$pcol if($pcol>$maxpcol);
1176
	$maxprow=$prow if($prow>$maxprow);
1177
	$maxpcage=$pcage if($pcage>$maxpcage);
1178
	$maxpslot=$pslot if($pslot>$maxpslot);
1179
	$maxpnode=$pnode if($pnode>$maxpnode);
1180
    }
1181
1182
    printf("_get_system_size_crayxt: Cray XT system found of size: %dx%dx%d\n",
1183
	   $maxpcol+1,$maxprow+1,$maxpcage+1,$maxpslot+1,$maxpnode+1 ) if($self->{VERBOSE});
1184
    
1185
    return($maxpcol,$maxprow,$maxpcage,$maxpslot,$maxpnode);
1186
}
1187
1188
1189
sub _init_trees_crayxt  {
1190
    my($self) = shift;
1191
    my($maxpcol,$maxprow,$maxpcage,$maxpslot,$maxpnode)=@_;
1192
    my($id,$subid,$treenode,$schemeroot,$bgsystem);
1193
1194
    $schemeroot=$self->{SCHEMEROOT};
1195
    $treenode=$schemeroot;
1196
    $bgsystem=$treenode=$treenode->new_child();
1197
    $treenode->add_attr({ tagname => 'col',
1198
			  min     => 0,
1199
			  max     => $maxpcol,
1200
			  mask    => 'c%d-' });
1201
1202
    $treenode=$treenode->new_child();
1203
    $treenode->add_attr({ tagname => 'rack',
1204
			  min     => 0,
1205
			  max     => $maxprow,
1206
			  mask    => '%01d' });
1207
1208
    $treenode=$treenode->new_child();
1209
    $treenode->add_attr({ tagname => 'cage',
1210
			  min     => 0,
1211
			  max     => $maxpcage,
1212
			  mask    => 'c%01d' });
1213
1214
    $treenode=$treenode->new_child();
1215
    $treenode->add_attr({ tagname => 'blade',
1216
			  min     => 0,
1217
			  max     => $maxpslot,
1218
			  mask    => 's%01d' });
1219
1220
    $treenode=$treenode->new_child();
1221
    $treenode->add_attr({ tagname => 'node',
1222
			  min     => 0,
1223
			  max     => $maxpnode,
1224
			  mask    => 'n%01d' });
1225
1226
    $treenode=$treenode->new_child();
1227
    $treenode->add_attr({ tagname => 'core',
1228
			  min     => 0,
1229
			  max     => 11,
1230
			  mask    => '-c%02d' });
1231
1232
    return(1);
1233
}
1234
1235
893
1;
1236
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML2LML/LML_gen_nodedisplay_insert_job.pm (-1 / +1 lines)
Lines 476-482 Link Here
476
    $rg=$schemeref->{ATTR}->{_maskregall};
476
    $rg=$schemeref->{ATTR}->{_maskregall};
477
477
478
    # ready if nodename matches to this level 
478
    # ready if nodename matches to this level 
479
#    print "get_numbers_from_name: check on level ",$schemeref->{_level}+1," $name -> $rg\n" if($debug>=2); 
479
#    print "get_numbers_from_name: check on level ",$schemeref->{_level}+1," $name -> $rg subcheck ",$name=~/^$rg/,"\n" if($debug>=2); 
480
    if($name=~/^$rg$/) {
480
    if($name=~/^$rg$/) {
481
	@list=$name=~/^$rg$/;
481
	@list=$name=~/^$rg$/;
482
	print "get_numbers_from_name: found on level ",$schemeref->{_level}+1," $name -> ",join(',',@list),"\n" if($debug>=2); 
482
	print "get_numbers_from_name: found on level ",$schemeref->{_level}+1," $name -> ",join(',',@list),"\n" if($debug>=2); 
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_color/LML_color_manager.pm (-1 / +1 lines)
Lines 515-521 Link Here
515
	    $color="red"; 
515
	    $color="red"; 
516
	}
516
	}
517
	if($self->{USEDCOLORS}[$cat]->{$color}) {
517
	if($self->{USEDCOLORS}[$cat]->{$color}) {
518
	    printf( "llview_manage_color: warning color in use .. by: %10s %-15s -> %-20s #buffer=%3d\n",
518
	    printf( "llview_manage_color: warning color $color in use by: %10s %-15s -> %-20s #buffer=%3d\n",
519
		    $self->{USEDCOLORS}[$cat]->{$color},$id,$color,$#{$self->{BUFFER}[$cat]});
519
		    $self->{USEDCOLORS}[$cat]->{$color},$id,$color,$#{$self->{BUFFER}[$cat]});
520
	}
520
	}
521
	$self->{KNOWNIDS}[$cat]->{$id}=$color;
521
	$self->{KNOWNIDS}[$cat]->{$id}=$color;
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_color/LML_color_obj.pl (+1 lines)
Lines 84-89 Link Here
84
{
84
{
85
    my ($key,$type,$color);
85
    my ($key,$type,$color);
86
    foreach $key (keys(%{$filehandler->{DATA}->{OBJECT}})) {
86
    foreach $key (keys(%{$filehandler->{DATA}->{OBJECT}})) {
87
	next if(!exists($filehandler->{DATA}->{OBJECT}->{$key}->{type}));
87
	$type=$filehandler->{DATA}->{OBJECT}->{$key}->{type};
88
	$type=$filehandler->{DATA}->{OBJECT}->{$key}->{type};
88
	$color=$colormanager->get_color($type,$key);
89
	$color=$colormanager->get_color($type,$key);
89
	if($color) {
90
	if($color) {
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_color/default.conf (-1 / +1 lines)
Lines 10-16 Link Here
10
#*******************************************************************************/ 
10
#*******************************************************************************/ 
11
# color space definitions for different types of LML objects
11
# color space definitions for different types of LML objects
12
class:          type=class,           colortype=gray,gray=1..200,buffer=2000
12
class:          type=class,           colortype=gray,gray=1..200,buffer=2000
13
job:            type=job,             colortype=hsv,H=001..297, S=76, V=75,buffer=2000
13
job:            type=job,             colortype=hsv,H=001..297, S=76, V=75,buffer=3000
14
node:           type=node,            colortype=hsv,H=297..076, S=80, V=75,buffer=5000
14
node:           type=node,            colortype=hsv,H=297..076, S=80, V=75,buffer=5000
15
partition:      type=partition,       colortype=hsv,H=010..100, S=90, V=75,buffer=200
15
partition:      type=partition,       colortype=hsv,H=010..100, S=90, V=75,buffer=200
16
partmap:        type=partmap,         colortype=hsv,H=001..299, S=40, V=75,buffer=100
16
partmap:        type=partmap,         colortype=hsv,H=001..299, S=40, V=75,buffer=100
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_combiner/LML_combine_obj.pl (+6 lines)
Lines 20-25 Link Here
20
use LML_combine_file_obj;
20
use LML_combine_file_obj;
21
use LML_combine_obj_check;
21
use LML_combine_obj_check;
22
use LML_combine_obj_bgp;
22
use LML_combine_obj_bgp;
23
use LML_combine_obj_xt;
23
24
24
25
25
my $patint="([\\+\\-\\d]+)";   # Pattern for Integer number
26
my $patint="([\\+\\-\\d]+)";   # Pattern for Integer number
Lines 89-99 Link Here
89
    }
90
    }
90
}
91
}
91
92
93
print "system_type=$system_type\n";
92
94
93
if($system_type eq "BG/P") {
95
if($system_type eq "BG/P") {
94
    &LML_combine_obj_bgp::update($filehandler->get_data_ref(),$opt_dbdir);
96
    &LML_combine_obj_bgp::update($filehandler->get_data_ref(),$opt_dbdir);
95
}
97
}
96
98
99
if($system_type eq "CRAYXT") {
100
    &LML_combine_obj_crayxt::update($filehandler->get_data_ref(),$opt_dbdir);
101
}
102
97
# check if Cluster is a PBS controlled Altix SMP Cluster
103
# check if Cluster is a PBS controlled Altix SMP Cluster
98
if($system_type eq "Cluster") {
104
if($system_type eq "Cluster") {
99
    keys(%{$filehandler->{DATA}->{OBJECT}}); # reset iterator
105
    keys(%{$filehandler->{DATA}->{OBJECT}}); # reset iterator
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_combiner/LML_combine_obj_xt.pm (+203 lines)
Added Link Here
1
#*******************************************************************************
2
#* Copyright (c) 2011 Forschungszentrum Juelich GmbH.
3
#* All rights reserved. This program and the accompanying materials
4
#* are made available under the terms of the Eclipse Public License v1.0
5
#* which accompanies this distribution, and is available at
6
#* http://www.eclipse.org/legal/epl-v10.html
7
#*
8
#* Contributors:
9
#*    Wolfgang Frings (Forschungszentrum Juelich GmbH) 
10
#*******************************************************************************/ 
11
package LML_combine_obj_crayxt;
12
use strict;
13
use Data::Dumper;
14
15
my($debug)=0;
16
17
my $patint="([\\+\\-\\d]+)";   # Pattern for Integer number
18
my $patfp ="([\\+\\-\\d.E]+)"; # Pattern for Floating Point number
19
my $patwrd="([\^\\s]+)";       # Pattern for Work (all noblank characters)
20
my $patbl ="\\s+";             # Pattern for blank space (variable length)
21
22
sub update {
23
    my($dataptr) = shift;
24
    my($dbdir) = shift;
25
26
    my $nodemapref=&get_mapping_info($dataptr);
27
28
    &update_node_info($dataptr,$nodemapref);
29
30
    my $appmapref=&get_app_mapping_info($dataptr,$nodemapref);
31
32
    &update_job_info($dataptr,$appmapref);
33
    return(1);
34
} 
35
36
# returns hash:  NID -> nodename
37
sub get_mapping_info {
38
    my($dataptr) = shift;
39
    my($id,$nid,$nodename,%nodemap);
40
41
    # scan for partition names
42
    foreach $id (keys(%{$dataptr->{OBJECT}})) {
43
	if($dataptr->{OBJECT}->{$id}->{type} eq "nodemap") {
44
	    $nid=$dataptr->{OBJECT}->{$id}->{name};
45
	    $nodename=$dataptr->{INFODATA}->{$id}->{name};
46
	    $nodemap{$nid}=$nodename;
47
	    delete($dataptr->{OBJECT}->{$id});
48
	    delete($dataptr->{INFO}->{$id});
49
	    delete($dataptr->{INFODATA}->{$id});
50
	}
51
    }
52
    return(\%nodemap);
53
}
54
55
# returns hash:  apid-> vnodelist
56
sub get_app_mapping_info {
57
    my($dataptr) = shift;
58
    my($nodemapref) = shift;
59
    my($id,$apid,$nodename,%appmap,$numtasks);
60
61
    # scan for partition names
62
    foreach $id (keys(%{$dataptr->{OBJECT}})) {
63
	if($dataptr->{OBJECT}->{$id}->{type} eq "node") {
64
	    next if(!(exists($dataptr->{INFODATA}->{$id}->{Apids})));
65
	    next if($dataptr->{INFODATA}->{$id}->{Apids} eq "-");
66
	    $apid=$dataptr->{INFODATA}->{$id}->{Apids};  # todo: more apid's possible?
67
	    $numtasks=1;
68
	    if(exists($dataptr->{INFODATA}->{$id}->{Pl})) {
69
		$numtasks=$dataptr->{INFODATA}->{$id}->{Pl};
70
	    }
71
	    $appmap{$apid}.="(".$dataptr->{OBJECT}->{$id}->{name}.",$numtasks)";
72
	}
73
    }
74
    return(\%appmap);
75
}
76
77
78
sub update_node_info {
79
    my($dataptr) = shift;
80
    my($nodemapref) = shift;
81
    my($id,$nid,$noderef);
82
    
83
    # update node info
84
    foreach $id (keys(%{$dataptr->{OBJECT}})) {
85
	if($dataptr->{OBJECT}->{$id}->{type} eq "node") {
86
	    $noderef=$dataptr->{INFODATA}->{$id};
87
	    $nid=$dataptr->{OBJECT}->{$id}->{name};
88
	    if(exists($nodemapref->{$nid})) {
89
		$dataptr->{OBJECT}->{$id}->{name}=$nodemapref->{$nid};
90
	    } else {
91
		print "update_node_info(Cray XT): warning unknown nid: '$nid'\n";
92
	    }
93
	    
94
	    # update attribute: memory
95
	    my $memfactor=1;
96
	    if(exists($noderef->{PgSz})) {
97
		if($noderef->{PgSz}=~/$patint[K]/) {
98
		    $memfactor=$1 / 1024.0; # --> MB
99
		}
100
		delete($noderef->{PgSz});
101
	    }
102
	    if(exists($noderef->{Conf})) {
103
		$noderef->{physmem}=int($memfactor*$noderef->{Conf});
104
		delete($noderef->{Conf});
105
	    }else {
106
		$noderef->{physmem}="0";
107
	    }
108
109
	    if(exists($noderef->{Placed})) {
110
		$noderef->{availmem}=$noderef->{physmem}-int($memfactor*$noderef->{Placed});
111
		$noderef->{availmem}=int($memfactor*$noderef->{Placed});
112
		delete($noderef->{Placed});
113
	    } else {
114
		$noderef->{availmem}="0";
115
	    }
116
117
	    if(exists($noderef->{State})) {
118
		$noderef->{state}="Running" if ($noderef->{State} eq "UP");
119
		$noderef->{state}="Down"    if ($noderef->{State} eq "DN");
120
		delete($noderef->{State});
121
	    } else {
122
		$noderef->{state}="Unknown";
123
	    }
124
	}
125
    }
126
127
    return(1);
128
}
129
130
131
sub update_job_info {
132
    my($dataptr) = shift;
133
    my($appmapnodemapref) = shift;
134
    my($id,$jobref,$apid,$batchid,%batchtoappid);
135
    
136
    # scan for app
137
    foreach $id (keys(%{$dataptr->{OBJECT}})) {
138
	if($dataptr->{OBJECT}->{$id}->{type} eq "app") {
139
	    $apid=$dataptr->{INFODATA}->{$id}->{apid};
140
	    $batchid=$dataptr->{INFODATA}->{$id}->{batchid};
141
	    $batchtoappid{$batchid}=$apid;
142
	    delete($dataptr->{OBJECT}->{$id});
143
	    delete($dataptr->{INFO}->{$id});
144
	    delete($dataptr->{INFODATA}->{$id});
145
	}
146
    }
147
    # update job info
148
    foreach $id (keys(%{$dataptr->{OBJECT}})) {
149
	if($dataptr->{OBJECT}->{$id}->{type} eq "job") {
150
	    $jobref=$dataptr->{INFODATA}->{$id};
151
	    
152
	    # update nodelist 
153
	    if($jobref->{state} ne "Running") {
154
		if(!exists($jobref->{nodelist})) {
155
		    $jobref->{nodelist}="-";
156
		    $jobref->{totaltasks}=0;
157
		}
158
		if(!exists($jobref->{vnodelist})) {
159
		    $jobref->{vnodelist}="-";
160
		}
161
	    }
162
	    # update totalcores
163
	    if(!exists($jobref->{totalcores})) {
164
		print "update_job_info: could not find attributes for job $id to compute totalcores\n";
165
	    }
166
167
	    if($jobref->{state} eq "Running") {
168
		$batchid=$dataptr->{OBJECT}->{$id}->{name};
169
		$batchid=~s/\..*$//gs;
170
		if(exists($batchtoappid{$batchid})) {
171
		    $apid=$batchtoappid{$batchid};
172
		} else {
173
		    print "update_job_info: could not find apid for batch job '$batchid'\n";
174
		}
175
		if(exists($appmapnodemapref->{$apid})) {
176
		    $jobref->{vnodelist}=$appmapnodemapref->{$apid};
177
		} else {
178
		    print "update_job_info: could not find nodelist for app '$apid' of batch job '$batchid'\n";
179
		}
180
	    }
181
	}
182
    }
183
    return(1);
184
}
185
186
sub update_class_info {
187
    my($dataptr) = shift;
188
    my($id,$class);
189
    my(%classes);
190
191
    # get class info
192
    foreach $id (keys(%{$dataptr->{OBJECT}})) {
193
	if($dataptr->{OBJECT}->{$id}->{type} eq "class") {
194
	    $class=$dataptr->{INFODATA}->{$id}->{name};
195
	    $classes{$class}{include}=$dataptr->{INFODATA}->{$id}->{crayxt_incl_bg};
196
	    $classes{$class}{exclude}=$dataptr->{INFODATA}->{$id}->{crayxt_excl_bg};
197
	}
198
    }
199
200
    return(1);
201
} 
202
203
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_da_driver.pl (-140 / +300 lines)
Lines 26-32 Link Here
26
my $patwrd="([\^\\s]+)";       # Pattern for Work (all noblank characters)
26
my $patwrd="([\^\\s]+)";       # Pattern for Work (all noblank characters)
27
my $patbl ="\\s+";             # Pattern for blank space (variable length)
27
my $patbl ="\\s+";             # Pattern for blank space (variable length)
28
28
29
my $version="1.12";
29
my $version="1.14";
30
 
30
 
31
my ($tstart,$tdiff,$rc);
31
my ($tstart,$tdiff,$rc);
32
32
Lines 58-91 Link Here
58
#    - return output file
58
#    - return output file
59
59
60
# option handling
60
# option handling
61
my $opt_rawfile=""; # unset
62
my $opt_verbose=0;
63
my $opt_quiet=0;
64
my $hostname = `hostname`;chomp($hostname);
61
my $hostname = `hostname`;chomp($hostname);
65
my $ppid = $$;
62
my $ppid = $$;
66
my $opt_tmpdir=sprintf("./tmp_%s_%d",$hostname,$ppid);
63
my %options = (
67
my $opt_permdir=sprintf("./perm_%s",$hostname);
64
    "rawfile"             => "",
68
my $opt_keeptmp=0;
65
    "tmpdir"              => "./tmp_".$hostname."_".$ppid,
69
my $opt_keepperm=1;
66
    "permdir"             => "./perm_".$hostname,
70
my $opt_dump=0;
67
    "keeptmp"             => 0,
71
my $opt_demo=0;
68
    "keepperm"            => 1,
69
    "verbose"             => 0,
70
    "quiet"               => 0,
71
    "nocheckrequest"      => 0,
72
    "rms"                 => "undef",
73
    "dump"                => 0,
74
    "demo"                => 0,
75
    "test"                => 0
76
);
77
my @save_ARGV=(@ARGV);
78
my @options_from_file_found;
79
72
usage($0) if( ! GetOptions( 
80
usage($0) if( ! GetOptions( 
73
			    'verbose'          => \$opt_verbose,
81
                            'verbose'          => \$options{verbose},
74
			    'quiet'            => \$opt_quiet,
82
                            'quiet'            => \$options{quiet},
75
			    'rawfile=s'        => \$opt_rawfile,
83
                            'rawfile=s'        => \$options{rawfile},
76
			    'tmpdir=s'         => \$opt_tmpdir,
84
                            'tmpdir=s'         => \$options{tmpdir},
77
			    'permdir=s'        => \$opt_permdir,
85
                            'permdir=s'        => \$options{permdir},
78
			    'keeptmp'          => \$opt_keeptmp,
86
                            'keeptmp'          => \$options{keeptmp},
79
			    'demo'             => \$opt_demo,
87
                            'rms=s'            => \$options{rms},
80
			    'dump'             => \$opt_dump
88
                            'nocheckrequest'   => \$options{nocheckrequest},
81
			    ) );
89
                            'demo'             => \$options{demo},
90
                            'test'             => \$options{test},
91
     		            'dump'             => \$options{dump}
92
                            ) );
82
my $date=`date`;
93
my $date=`date`;
83
chomp($date);
94
chomp($date);
84
95
96
my $REPORT;
97
98
&open_report();
99
100
my $options_file=".LML_da_options";
101
if (-f $options_file) {
102
    my ($line);
103
    open(IN,$options_file);
104
    while($line=<IN>) {
105
        if($line=~/$patwrd=\s*$patwrd\s*$/) {
106
	    my($opt_name,$opt_value)=($1,$2) ;
107
	    if(exists($options{$opt_name})) {
108
		$options{$opt_name}=$opt_value;
109
		push(@options_from_file_found,$opt_name);
110
	    } else {
111
		&report_if_verbose("WARNING found unknown option (%s) in option file file %s\n",$opt_name,$options_file);
112
	    }
113
        }
114
    }
115
    close(IN);
116
}
117
85
# print header
118
# print header
86
print STDERR "-"x90,"\n" if($opt_verbose);
119
&report_if_verbose("%s%s","-"x90,"\n");
87
print STDERR"  LLVIEW Data Access Workflow Manager Driver $version, starting at ($date)\n" if(!$opt_quiet); 
120
&report("%s","  LLVIEW Data Access Workflow Manager Driver $version, starting at ($date)\n");
88
print STDERR "-"x90,"\n" if($opt_verbose);
121
&report_if_verbose("  %s%s%s"," command line args: ",join(" ",@save_ARGV),"\n"); 
122
&report_if_verbose("  %s%s%s%s"," option file  args: ",join(" ",@options_from_file_found),"     (from file $options_file)","\n") if($#options_from_file_found>=0); 
123
&report_if_verbose("%s%s", "-"x90,"\n");
89
124
90
125
91
# check positional parameters 
126
# check positional parameters 
Lines 105-174 Link Here
105
    $outputfile  = "-";
140
    $outputfile  = "-";
106
}
141
}
107
142
108
my $tmpdir       = $opt_tmpdir;
143
my $tmpdir       = $options{tmpdir};
109
my $permdir       = $opt_permdir;
144
my $permdir       = $options{permdir};
110
my $rawfile      = undef;
145
my $rawfile      = undef;
111
my $removetmpdir = 0; # remove only if directory was create 
146
my $removetmpdir = 0; # remove only if directory was create 
112
147
113
# check temporary directory
148
my $workflowxml = "";
149
my $laststep    = "";
150
151
# init global vars
152
my $pwd=`pwd`;
153
chomp($pwd);
154
155
if(! $options{test}) {
156
157
# check and/or create temporary directory
114
if(! -d $tmpdir) {
158
if(! -d $tmpdir) {
115
    printf(STDERR "$0: temporary directory not found, create new directory $tmpdir ...\n") if($opt_verbose);
159
    &report_if_verbose("%s","$0: temporary directory not found, create new directory $tmpdir ...\n");
116
    if(!mkdir($tmpdir,0755)) {
160
    if(!mkdir($tmpdir,0755)) {
117
	&exit_witherror($outputfile,"$0: could not create $tmpdir ...$!\n");
161
        &exit_witherror($outputfile,"$0: could not create $tmpdir ...$!\n");
118
    } else {
162
    } else {
119
	print STDERR "$0: tmpdir created ($tmpdir)\n"  if($opt_verbose);
163
        &report_if_verbose("%s", "$0: tmpdir created ($tmpdir)\n");
120
    }
164
    }
121
    $removetmpdir=1;
165
    $removetmpdir=1;
122
}
166
}
123
167
124
# check permanent directory
168
# check permanent directory
125
if(! -d $permdir) {
169
if(! -d $permdir) {
126
    printf(STDERR "$0: permanent directory not found, create new directory $permdir ...\n") if($opt_verbose);
170
    &report_if_verbose("$0: permanent directory not found, create new directory $permdir ...\n");
127
    if(!mkdir($permdir,0755)) {
171
    if(!mkdir($permdir,0755)) {
128
	&exit_witherror($outputfile,"$0: could not create $permdir ...$!\n");
172
        &exit_witherror($outputfile,"$0: could not create $permdir ...$!\n");
129
    } else {
173
    } else {
130
	print STDERR "$0: permdir created ($permdir)\n"  if($opt_verbose);
174
        &report_if_verbose("%s", "$0: permdir created ($permdir)\n");
131
    }
175
    }
132
}
176
}
133
177
134
# check request input file
178
# check request input file
135
if ($requestfile ne "-") {
179
if ($requestfile ne "-") {
136
    if(! -f $requestfile) {
180
    if(! -f $requestfile) {
137
	&exit_witherror($outputfile,"$0: requestfile $requestfile not found, exiting ...\n");
181
        &exit_witherror($outputfile,"$0: requestfile $requestfile not found, exiting ...\n");
138
    }
182
    }
139
}
183
}
140
184
141
# check rawfile
185
# check rawfile
142
if($opt_rawfile) {
186
if($options{rawfile}) {
143
    if(! -f $opt_rawfile) {
187
    if(! -f $options{rawfile}) {
144
	&exit_witherror($outputfile,"$0: rawfile $rawfile specified but not found, exiting ...\n");
188
        &exit_witherror($outputfile,"$0: rawfile $rawfile specified but not found, exiting ...\n");
145
    }
189
    }
146
    $rawfile=$opt_rawfile;
190
    $rawfile=$options{rawfile};
147
}
191
}
148
192
193
149
# read config file
194
# read config file
150
print STDERR "$0: requestfile=$requestfile\n" if($opt_verbose);
195
&report_if_verbose("%s", "$0: requestfile=$requestfile\n");
151
$tstart=time;
196
$tstart=time;
152
197
153
my $filehandler_request = LML_file_obj->new($opt_verbose,1);
198
# debug request file
199
open(OUT,"> $options{tmpdir}/request.xml");
200
if ($requestfile eq "-") {
201
    while(<>) {
202
        print OUT $_;
203
    }
204
    $requestfile="$options{tmpdir}/request.xml";
205
} else {
206
    open(IN,$requestfile);
207
    while(<IN>) {
208
        print OUT $_;
209
    }
210
    close(IN);
211
}
212
close(OUT);
213
214
my $filehandler_request = LML_file_obj->new($options{verbose},1);
154
$filehandler_request->read_lml_fast($requestfile);
215
$filehandler_request->read_lml_fast($requestfile);
155
$tdiff=time-$tstart;
216
$tdiff=time-$tstart;
156
printf(STDERR "$0: parsing XML requestfile in %6.4f sec\n",$tdiff) if($opt_verbose);
217
&report_if_verbose("$0: parsing XML requestfile in %6.4f sec\n",$tdiff);
157
if(!$filehandler_request) {
218
if(!$filehandler_request) {
158
    &exit_witherror($outputfile,"$0: could not parse requestfile $requestfile, exiting ...\n");
219
    &exit_witherror($outputfile,"$0: could not parse requestfile $requestfile, exiting ...\n");
159
}
220
}
160
221
161
# init global vars
162
my $pwd=`pwd`;
163
chomp($pwd);
164
222
165
223
166
#########################
224
#########################
167
# create workflow
225
# create workflow
168
#########################
226
#########################
169
my $workflowxml=&create_workflow($tmpdir,$permdir);
227
$workflowxml=&create_workflow($tmpdir,$permdir);
170
my $laststep = "";
171
my $step     = "";
228
my $step     = "";
229
230
# hashes containing function references to rms specific functions
231
my $check_functions;
232
my $generate_functions;
172
233
173
234
174
#########################
235
#########################
Lines 178-243 Link Here
178
if($rawfile) {
239
if($rawfile) {
179
    $step="rawfilecp";
240
    $step="rawfilecp";
180
    if($rawfile=~/\.gz$/) {
241
    if($rawfile=~/\.gz$/) {
181
	&add_exec_step_to_workflow($workflowxml,$step, $laststep, 
242
        &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
182
				   "gunzip -c $rawfile > \$stepoutfile");
243
                                   "gunzip -c $rawfile > \$stepoutfile");
183
    } else {
244
    } else {
184
	&add_exec_step_to_workflow($workflowxml,$step, $laststep, 
245
        &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
185
				   "cp $rawfile \$stepoutfile");
246
                                   "cp $rawfile \$stepoutfile");
186
    }
247
    }
187
    $laststep=$step;
248
    $laststep=$step;
188
} else {
249
} else {
189
    # get data from resource management system (RMS)
250
    # get data from resource management system (RMS)
190
251
191
192
    # check for hints about queueing system
252
    # check for hints about queueing system
193
    my $rms="undef";
253
    my $rms="undef";
194
    my $r;
195
    my %cmds=();
254
    my %cmds=();
196
    print STDERR "$0: check_for rms ...\n"  if($opt_verbose);
255
197
    if(exists($filehandler_request->{DATA}->{REQUEST})) {
256
    if($options{rms} ne "undef") { 
198
		if(exists($filehandler_request->{DATA}->{REQUEST}->{driver})) {
257
	&report_if_verbose("$0: rms given by command line option: $options{rms} ...\n");
199
		    my $driver_ref=$filehandler_request->{DATA}->{REQUEST}->{driver};
258
	$rms=$options{rms};
200
		    if(exists($driver_ref->{attr})) {
201
				if(exists($driver_ref->{attr}->{name})) {
202
				    $rms=uc($driver_ref->{attr}->{name});
203
				    print STDERR "$0: check_for rms, got hint from request ... ($rms)\n" if($opt_verbose);
204
				}
205
		    }
206
		    
207
		    if(exists($driver_ref->{command})) {
208
				my($key);
209
				foreach $key ( keys(%{$driver_ref->{command}}) ) {
210
				    if(exists($driver_ref->{command}->{$key}->{exec})) {
211
						my $cmd_key="cmd_".$key;
212
						$cmds{$cmd_key}=$driver_ref->{command}->{$key}->{exec};
213
						print STDERR "$0: check_for rms, got hint from for cmd $cmd_key ... ($cmds{$cmd_key})\n"  if($opt_verbose);
214
				    }
215
				}
216
		    }
217
		}
218
    } 
219
    if ($rms ne "undef") {
220
    	do "rms/$rms/da_check_info_LML.pl" || &exit_witherror($outputfile,"$0: unable to locate rms\n");
221
    	&check_rms(\$rms,\%cmds,$opt_verbose) || &exit_witherror($outputfile,"$0: unable to locate rms\n");
222
    } else {
259
    } else {
223
    	foreach $r (<rms/*>) {
260
	&report_if_verbose("$0: check request for rms hint ...\n");
224
    		if (do "$r/da_check_info_LML.pl" && &check_rms(\$rms,\%cmds,$opt_verbose)) {
261
	if(exists($filehandler_request->{DATA}->{REQUEST})) {
225
    			$rms=substr($r, 4);
262
	    if(exists($filehandler_request->{DATA}->{REQUEST}->{driver})) {
226
    			last;
263
		my $driver_ref=$filehandler_request->{DATA}->{REQUEST}->{driver};
227
    		}
264
		if(!$options{nocheckrequest}) {
228
    	}
265
		    # check rms name
229
		if($rms eq "undef") {
266
		    if(exists($driver_ref->{attr})) {
230
			&exit_witherror($outputfile,"$0: could not determine rms, exiting ...\n");
267
			if(exists($driver_ref->{attr}->{name})) {
268
			    $rms=uc($driver_ref->{attr}->{name}); # upper case, except:  
269
			    $rms="GridEngine" if ($rms=~/GRIDENGINE/);
270
			    &report_if_verbose("$0: check_for rms, got hint from request ... ($rms)\n");
271
                        }
272
		    }
231
		}
273
		}
274
		
275
		if(!$options{nocheckrequest}) {
276
		    # check rms commands
277
		    if(exists($driver_ref->{command})) {
278
			my($key);
279
			foreach $key ( keys(%{$driver_ref->{command}}) ) {
280
			    if(exists($driver_ref->{command}->{$key}->{exec})) {
281
				my $cmd_key="cmd_".$key;
282
				$cmds{$cmd_key}=$driver_ref->{command}->{$key}->{exec};
283
				&report_if_verbose("$0: check_for rms, got hint from for cmd $cmd_key ... ($cmds{$cmd_key})\n");
284
			    }
285
			}
286
		    }
287
		}
288
	    }
289
	} 
232
    }
290
    }
233
291
234
    $laststep=&generate_step_rms($workflowxml, $laststep, \%cmds);
292
    if ($rms ne "undef") {
293
	if (do "rms/$rms/da_check_info_LML.pl") {
294
	    if (exists($main::check_functions->{$rms})) {
295
		if ( &{$main::check_functions->{$rms}}(\$rms,\%cmds,$options{verbose})) {
296
		    &report_if_verbose("$0: rms/$rms/da_check_info_LML.pl --> rms=$rms\n");
297
		} else {
298
		    &report_if_verbose("$0: rms/$rms/da_check_info_LML.pl unable to locate rms $rms\n");
299
		    $rms="undef";
300
		} 
301
	    } else { 
302
		&report_if_verbose("$0:  WARNING rms/$rms/da_check_info_LML.pl defines no check function\n");
303
		$rms="undef";
304
	    }
305
	} else {
306
	    &report_if_verbose("$0:  ERROR could not run rms/$rms/da_check_info_LML.pl (perhaps missing return code of script)\n");
307
	    $rms="undef";
308
	}
309
    } else {
310
        my ($r,$check_f,$generate_f,$test_rms);
311
        foreach $r (<rms/*>) {
312
	    $test_rms=$r;$test_rms=~s/(.*\/)//s;
313
	    &report_if_verbose("$0: found rms/$r/da_check_info_LML.pl running test ...\n");
314
	    if (do "$r/da_check_info_LML.pl") {
315
		if (exists($main::check_functions->{$test_rms})) {
316
		    if ( &{$main::check_functions->{$test_rms}}(\$rms,\%cmds,$options{verbose})) {
317
			$rms=$test_rms;
318
			&report_if_verbose("$0: rms/$r/da_check_info_LML.pl --> rms=$rms\n");
319
			last;
320
		    } 
321
		} else {
322
		    &report_if_verbose("$0:  WARNING rms/$r/da_check_info_LML.pl defines no check function\n");
323
		}
324
	    } else {
325
		&report_if_verbose("$0:  ERROR could not run rms/$r/da_check_info_LML.pl (perhaps missing return code of script)\n");
326
	    }
327
	}
328
    }
329
330
    if($rms eq "undef") {
331
	&exit_witherror($outputfile,"$0: could not determine rms, exiting ...\n");
332
    }
333
    
334
    if (exists($main::generate_functions->{$rms})) {
335
	$laststep=&{$main::generate_functions->{$rms}}($workflowxml, $laststep, \%cmds);
336
    }
235
337
236
    $step="addcolor";
338
    $step="addcolor";
237
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
339
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
238
			       "$^X \$instdir/LML_color/LML_color_obj.pl -colordefs \$instdir/LML_color/default.conf " .
340
                               "$^X \$instdir/LML_color/LML_color_obj.pl -colordefs \$instdir/LML_color/default.conf " .
239
			       "-dbdir \$permdir " .
341
                               "-dbdir \$permdir " .
240
			       "-o     \$stepoutfile \$stepinfile");
342
                               "-o     \$stepoutfile \$stepinfile");
241
    $laststep=$step;
343
    $laststep=$step;
242
344
243
}
345
}
Lines 249-257 Link Here
249
my $usedefaultlayout=0;
351
my $usedefaultlayout=0;
250
if(exists($filehandler_request->{DATA}->{request})) {
352
if(exists($filehandler_request->{DATA}->{request})) {
251
    if(exists($filehandler_request->{DATA}->{request}->[0]->{getDefaultData})) {
353
    if(exists($filehandler_request->{DATA}->{request}->[0]->{getDefaultData})) {
252
	if($filehandler_request->{DATA}->{request}->[0]->{getDefaultData}=~/^true$/i) {
354
        if($filehandler_request->{DATA}->{request}->[0]->{getDefaultData}=~/^true$/i) {
253
	    $usedefaultlayout=1;
355
            $usedefaultlayout=1;
254
	}
356
        }
255
    }
357
    }
256
}
358
}
257
#check if layout is given in request
359
#check if layout is given in request
Lines 259-269 Link Here
259
if(!$usedefaultlayout) {
361
if(!$usedefaultlayout) {
260
    my $key;
362
    my $key;
261
    foreach $key (keys(%{$filehandler_request->{DATA}})) {
363
    foreach $key (keys(%{$filehandler_request->{DATA}})) {
262
	$layoutfound=1 if ($key=~/LAYOUT$/);
364
        $layoutfound=1 if ($key=~/LAYOUT$/);
263
    }
365
    }
264
    $usedefaultlayout=1 if(!$layoutfound);
366
    $usedefaultlayout=1 if(!$layoutfound);
265
}
367
}
266
print STDERR "$0: layoutfound=$layoutfound usedefaultlayout=$usedefaultlayout\n" if($opt_verbose);
368
&report_if_verbose("$0: layoutfound=$layoutfound usedefaultlayout=$usedefaultlayout\n");
267
369
268
my $filehandler_layout;
370
my $filehandler_layout;
269
if($usedefaultlayout) {
371
if($usedefaultlayout) {
Lines 281-323 Link Here
281
#########################
383
#########################
282
$step="LML2LML";
384
$step="LML2LML";
283
my $demo="";
385
my $demo="";
284
$demo="-demo" if $opt_demo;
386
$demo="-demo" if $options{demo};
285
&add_exec_step_to_workflow($workflowxml,$step, $laststep, 
387
&add_exec_step_to_workflow($workflowxml,$step, $laststep, 
286
			   "$^X LML2LML/LML2LML.pl -v $demo -layout \$tmpdir/layout.xml".
388
                           "$^X LML2LML/LML2LML.pl -v $demo -layout \$tmpdir/layout.xml".
287
			   " -output \$stepoutfile \$stepinfile");
389
                           " -output \$stepoutfile \$stepinfile");
288
$laststep=$step;
390
$laststep=$step;
391
289
392
290
#########################
393
#########################
291
# Dump?
394
# Dump?
292
#########################
395
#########################
293
if($opt_dump) {
396
if($options{dump}) {
294
    print STDERR Dumper($filehandler_request->{DATA});
397
    print STDERR Dumper($filehandler_request->{DATA});
295
    print STDERR Dumper($workflowxml);
398
    print STDERR Dumper($workflowxml);
296
    print STDERR Dumper($filehandler_layout->{DATA});
399
    print STDERR Dumper($filehandler_layout->{DATA});
297
    exit(1);
400
    exit(1);
298
}
401
}
299
402
403
} #  ! $options{test}
404
300
#########################
405
#########################
301
# execute Workflow
406
# execute Workflow
302
#########################
407
#########################
303
# write workflow to tmpdir
408
if(! $options{test}) {
304
409
    my $workflow_obj = LML_da_workflow_obj->new($options{verbose},0);
305
my $workflow_obj = LML_da_workflow_obj->new($opt_verbose,0);
410
    $workflow_obj->{DATA}=$workflowxml;
306
$workflow_obj->{DATA}=$workflowxml;
411
    $workflow_obj->write_xml("$tmpdir/workflow.xml");
307
$workflow_obj->write_xml("$tmpdir/workflow.xml");
412
    my $cmd="$^X ./LML_da.pl";
308
413
    $cmd .= " -v"  if($options{verbose});
309
my $cmd="$^X ./LML_da.pl";
414
    $cmd .= " -c $tmpdir/workflow.xml";
310
$cmd .= " -v"  if($opt_verbose);
415
    $cmd .= " > $tmpdir/LML_da.log";
311
$cmd .= " -c $tmpdir/workflow.xml";
416
    $cmd .= " 2> $tmpdir/LML_da.errlog";
312
$cmd .= " > $tmpdir/LML_da.log";
417
    &report_if_verbose("$0: executing: %s ...\n",$cmd);
313
$cmd .= " 2> $tmpdir/LML_da.errlog";
418
    $tstart=time;
314
printf( STDERR  "$0: executing: %s ...\n",$cmd) if($opt_verbose);
419
    system($cmd);$rc=$?;
315
$tstart=time;
420
    $tdiff=time-$tstart;
316
system($cmd);$rc=$?;
421
    &report_if_verbose("$0: %60s -> ready, time used %10.4ss\n","",$tdiff);
317
$tdiff=time-$tstart;
422
    if($rc) {     
318
printf(STDERR "$0: %60s -> ready, time used %10.4ss\n","",$tdiff) if($opt_verbose);
423
        &exit_witherror($outputfile,"$0 failed executing: $cmd rc=$rc\n");
319
if($rc) {     
424
    }
320
    &exit_witherror($outputfile,"$0 failed executing: $cmd rc=$rc\n");
425
} else {
426
    $laststep="LML2LML";
427
    my $cmd="( cd $tmpdir/..; $^X $pwd/LML_da.pl";
428
    $cmd .= " -v"  if($options{verbose});
429
    $cmd .= " -c $tmpdir/workflow.xml";
430
    $cmd .= " > $tmpdir/LML_da.log";
431
    $cmd .= " 2> $tmpdir/LML_da.errlog )";
432
    &report_if_verbose("$0: executing: %s ...\n",$cmd);
433
    $tstart=time;
434
    system($cmd);$rc=$?;
435
    $tdiff=time-$tstart;
436
    &report_if_verbose("$0: %60s -> ready, time used %10.4ss\n","",$tdiff);
437
    if($rc) {     
438
        &exit_witherror($outputfile,"$0 failed executing: $cmd rc=$rc\n");
439
    }
321
}
440
}
322
441
323
#########################
442
#########################
Lines 330-368 Link Here
330
if($outputfile eq "-") {
449
if($outputfile eq "-") {
331
    open(IN,$stepoutfile);
450
    open(IN,$stepoutfile);
332
    while(<IN>) {
451
    while(<IN>) {
333
	print $_;
452
        print $_;
334
    }
453
    }
335
    close(IN);
454
    close(IN);
336
} else {
455
} else {
337
    open(IN,$stepoutfile);
456
    open(IN,$stepoutfile);
338
    open(OUT," > $outputfile") || die "could not open for write '$outputfile'";
457
    open(OUT," > $outputfile") || die "could not open for write '$outputfile'";
339
    while(<IN>) {
458
    while(<IN>) {
340
	print OUT $_;
459
        print OUT $_;
341
    }
460
    }
342
    close(OUT);
461
    close(OUT);
343
    close(IN);
462
    close(IN);
344
}
463
}
345
464
346
# clean up
465
# clean up
347
if(($removetmpdir) && (!$opt_keeptmp)) {
466
if(($removetmpdir) && (!$options{keeptmp})) {
348
    my $file;
467
    my $file;
349
    foreach $file (`ls $tmpdir`) {
468
    foreach $file (`ls $tmpdir`) {
350
	chomp($file);
469
        chomp($file);
351
#	print STDERR "unlink $tmpdir/$file\n";
470
#       print STDERR "unlink $tmpdir/$file\n";
352
	unlink("$tmpdir/$file");
471
        unlink("$tmpdir/$file");
353
    }
472
    }
354
    if(!rmdir($tmpdir)) {
473
    if(!rmdir($tmpdir)) {
355
	printf(STDERR "$0: could not rmdir $tmpdir ...$!, exiting ...\n");
474
        &report("$0: could not rmdir $tmpdir ...$!, exiting ...\n");
356
    } else {
475
    } else {
357
	print STDERR "$0: tmpdir removed ($tmpdir)\n"  if($opt_verbose);
476
        &report_if_verbose("$0: tmpdir removed ($tmpdir)\n");
358
    }
477
    }
359
}
478
}
360
479
361
480
362
print STDERR "-"x90,"\n" if($opt_verbose);
481
&report_if_verbose("%s%s","-"x90,"\n");
363
print STDERR"  LLVIEW Data Access Workflow Manager Driver $version, ending at   ($date)\n"  if(!$opt_quiet); 
482
&report("  LLVIEW Data Access Workflow Manager Driver $version, ending at   ($date)\n");
364
print STDERR "-"x90,"\n" if($opt_verbose);
483
&report_if_verbose("%s%s","-"x90,"\n");
365
484
485
if(! (($removetmpdir) && (!$options{keeptmp}))) {
486
    close_report("$tmpdir/report.log");
487
}
366
488
367
sub usage {
489
sub usage {
368
    die " 
490
    die " 
Lines 380-385 Link Here
380
                -permdir  <dir>          : use this directory for permanent data 
502
                -permdir  <dir>          : use this directory for permanent data 
381
                                           (e.g., databases, default: ./tmp) 
503
                                           (e.g., databases, default: ./tmp) 
382
                -keeptmp                 : keep temporary directory
504
                -keeptmp                 : keep temporary directory
505
                -test                    : use input files from temporary directory
506
                -demo                    : generate anonymous data
507
                -rms <rms>               : check only for this rms
508
                -nocheckrequest          : don't check request for hints 
383
                -verbose                 : verbose mode
509
                -verbose                 : verbose mode
384
                -quiet                   : prints no messages on stderr
510
                -quiet                   : prints no messages on stderr
385
511
Lines 391-396 Link Here
391
    my($outputfile,$errormsg)=@_;
517
    my($outputfile,$errormsg)=@_;
392
    my $xmlout="";
518
    my $xmlout="";
393
519
520
    
394
    $xmlout.="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
521
    $xmlout.="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
395
    $xmlout.="<lml:lgui xmlns:lml=\"http://www.llview.de\"\n";
522
    $xmlout.="<lml:lgui xmlns:lml=\"http://www.llview.de\"\n";
396
    $xmlout.="          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
523
    $xmlout.="          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
Lines 406-422 Link Here
406
    $xmlout.="</information>\n";
533
    $xmlout.="</information>\n";
407
534
408
    $xmlout.="</lml:lgui>\n";
535
    $xmlout.="</lml:lgui>\n";
409
    
410
    printf(STDERR "$errormsg\n");
411
536
537
    &report("$0: ERROR $errormsg\n");
538
    
412
    if($outputfile eq "-") {
539
    if($outputfile eq "-") {
413
	print $xmlout;
540
        print $xmlout;
414
    } else {
541
    } else {
415
	open(OUT," > $outputfile") || die "could not open for write '$outputfile'";
542
        open(OUT," > $outputfile") || die "could not open for write '$outputfile'";
416
	print OUT $xmlout;
543
        print OUT $xmlout;
417
	close(OUT);
544
        close(OUT);
418
    }
545
    }
419
546
547
    close_report("$tmpdir/report.log");
548
    
420
    exit(1);
549
    exit(1);
421
550
422
}
551
}
Lines 448-456 Link Here
448
    $stepref->{type}        = "execute";
577
    $stepref->{type}        = "execute";
449
    
578
    
450
    foreach $cmd (@cmds) {
579
    foreach $cmd (@cmds) {
451
	$cmdref={};
580
        $cmdref={};
452
	$cmdref->{exec}         = $cmd;
581
        $cmdref->{exec}         = $cmd;
453
	push(@{$stepref->{cmd}},$cmdref);
582
        push(@{$stepref->{cmd}},$cmdref);
454
    }
583
    }
455
    
584
    
456
    $datastructref->{step}->{$id}=$stepref;
585
    $datastructref->{step}->{$id}=$stepref;
Lines 461-467 Link Here
461
sub create_default_layout {
590
sub create_default_layout {
462
    my($filehandler_request)=@_;
591
    my($filehandler_request)=@_;
463
592
464
    my $filehandler_layout = LML_file_obj->new($opt_verbose,1);
593
    my $filehandler_layout = LML_file_obj->new($options{verbose},1);
465
    $filehandler_layout->read_lml_fast("$FindBin::RealBin/samples/layout_default.xml");
594
    $filehandler_layout->read_lml_fast("$FindBin::RealBin/samples/layout_default.xml");
466
    $filehandler_layout->check_lml();
595
    $filehandler_layout->check_lml();
467
    return($filehandler_layout);
596
    return($filehandler_layout);
Lines 471-487 Link Here
471
    my($filehandler_request)=@_;
600
    my($filehandler_request)=@_;
472
    my($key);
601
    my($key);
473
602
474
    my $filehandler_layout = LML_file_obj->new($opt_verbose,1);
603
    my $filehandler_layout = LML_file_obj->new($options{verbose},1);
475
    $filehandler_layout -> init_file_obj();
604
    $filehandler_layout -> init_file_obj();
476
    foreach $key ("TABLELAYOUT","TABLE","NODEDISPLAYLAYOUT","NODEDISPLAY","OBJECT") {
605
    foreach $key ("TABLELAYOUT","TABLE","NODEDISPLAYLAYOUT","NODEDISPLAY","OBJECT") {
477
	if (exists($filehandler_request->{DATA}->{$key})) {
606
        if (exists($filehandler_request->{DATA}->{$key})) {
478
	    $filehandler_layout->{DATA}->{$key}=dclone($filehandler_request->{DATA}->{$key});
607
            $filehandler_layout->{DATA}->{$key}=dclone($filehandler_request->{DATA}->{$key});
479
	}
608
        }
480
    }
609
    }
481
    $filehandler_layout->check_lml();
610
    $filehandler_layout->check_lml();
482
    return($filehandler_layout);
611
    return($filehandler_layout);
483
}
612
}
484
613
614
sub open_report {
615
    $REPORT="";
616
}
485
617
486
618
619
sub report {
620
    my $format = shift;
621
    # print to protocol file
622
    $REPORT.=sprintf( $format, @_ );
487
623
624
    if(!$options{quiet}) {
625
        # print to stderr
626
        printf(STDERR $format, @_);
627
    }
628
}
629
630
sub report_if_verbose {
631
    my $format = shift;
632
    # print to protocol file
633
    $REPORT.=sprintf( $format, @_ );
634
    
635
    if($options{verbose}) {
636
        # print to stderr
637
        printf(STDERR $format, @_);
638
    }
639
}
640
641
sub close_report {
642
    my($reportfile)=@_;
643
    if(open(REPORT,"> $reportfile")) {
644
        print REPORT $REPORT;
645
        close(REPORT);
646
    }
647
}
(-)a/rms/org.eclipse.ptp.rm.lml.da/LML_specs/LML_specs.pm (-1 / +2 lines)
Lines 71-77 Link Here
71
		 "comment"      => ["s","O",undef, "comment" ],
71
		 "comment"      => ["s","O",undef, "comment" ],
72
		 "totalcores"   => ["d","M",undef, "total number of machine cores requested"],
72
		 "totalcores"   => ["d","M",undef, "total number of machine cores requested"],
73
		 "totaltasks"   => ["d","M",undef, "total number of (MPI) tasks"],
73
		 "totaltasks"   => ["d","M",undef, "total number of (MPI) tasks"],
74
		 "nodelist"     => ["s","M",undef, "node on ehich a job is running" ],
74
		 "nodelist"     => ["s","M",undef, "node on which a job is running" ],
75
		 "vnodelist"    => ["s","M",undef, "virtual node list (PBS), used first" ],
75
		 "queue"        => ["s","M",undef, "queue"],
76
		 "queue"        => ["s","M",undef, "queue"],
76
		 "dependency"   => ["s","O",undef, "dependency string"],
77
		 "dependency"   => ["s","O",undef, "dependency string"],
77
		 "executable"   => ["s","O",undef, "path and name of executable"],
78
		 "executable"   => ["s","O",undef, "path and name of executable"],
(-)a/rms/org.eclipse.ptp.rm.lml.da/README.txt (+24 lines)
Lines 410-412 Link Here
410
   - persistent color management
410
   - persistent color management
411
     - color db will be stored in a file in the perm-directory
411
     - color db will be stored in a file in the perm-directory
412
   - first driver for PBSpro controlled systems
412
   - first driver for PBSpro controlled systems
413
414
1.10:
415
   - bug fixes
416
417
1.11:
418
   - bug fixes
419
420
1.12:
421
   - bug fixes
422
423
1.13:
424
   - improved reporting: option -verbose control debug output on stderr
425
     	      		 full debugging report will written $tmpdir/report.log
426
   - improved support for PBS (vnodes)
427
   - bug fixes
428
429
1.14:
430
   - Improvements for testing and demonstration purpose 
431
     - option -test: use existing workflow input in tmpdir
432
     - options specification file .LML_da_options 
433
       - will be read if exists in current directory
434
       - will overwrite command line option
435
    - incoporated support for new RMS (GridEngine, PE)
436
      (contributed by others)   
(-)a/rms/org.eclipse.ptp.rm.lml.da/lib/LML_file_obj.pm (-2 / +4 lines)
Lines 555-561 Link Here
555
sub write_lml {
555
sub write_lml {
556
    my($self) = shift;
556
    my($self) = shift;
557
    my $outfile  = shift;
557
    my $outfile  = shift;
558
    my($k,$rc,$id,$c,$key,$ref);
558
    my($k,$rc,$id,$c,$key,$ref,$t);
559
    my $tstart=time;
559
    my $tstart=time;
560
    $rc=1;
560
    $rc=1;
561
561
Lines 572-581 Link Here
572
    printf(OUT "<objects>\n");
572
    printf(OUT "<objects>\n");
573
    foreach $id (sort keys %{$self->{DATA}->{OBJECT}}) {
573
    foreach $id (sort keys %{$self->{DATA}->{OBJECT}}) {
574
	printf(OUT "<object");
574
	printf(OUT "<object");
575
	$t=0;
575
	foreach $k (sort keys %{$self->{DATA}->{OBJECT}->{$id}}) {
576
	foreach $k (sort keys %{$self->{DATA}->{OBJECT}->{$id}}) {
576
	    printf(OUT " %s=\"%s\"",$k,$self->{DATA}->{OBJECT}->{$id}->{$k});
577
	    printf(OUT " %s=\"%s\"",$k,$self->{DATA}->{OBJECT}->{$id}->{$k});$t=1;
577
	}
578
	}
578
	printf(OUT "/>\n");
579
	printf(OUT "/>\n");
580
	print "write_lml: WARNING object with id '$id' has no attributes\n" if($t==0);
579
    }
581
    }
580
    printf(OUT "</objects>\n");
582
    printf(OUT "</objects>\n");
581
583
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/GridEngine/GEHelper.pm (+405 lines)
Added Link Here
1
#!/usr/bin/perl -w
2
#*******************************************************************************
3
#* Copyright (c) 2011 University of Illinois and others.  All rights reserved.
4
#* This program and the accompanying materials are made available under the
5
#* terms of the Eclipse Public License v1.0 which accompanies this distribution,
6
#* and is available at http://www.eclipse.org/legal/epl-v10.html 
7
#* 
8
#* Contributors: 
9
#*     Jeff Overbey (Illinois/NCSA) - Design and implementation
10
#*******************************************************************************
11
12
package GEHelper;
13
14
use strict;
15
use warnings;
16
17
use POSIX qw(ceil floor);
18
19
use Exporter;
20
our @ISA= qw( Exporter );
21
our @EXPORT_OK = qw( parsexml trimtext get_jobs get_job_nodes get_nodes should_group_nodes group_nodes MAX_CORES );
22
our @EXPORT = qw( get_jobs get_job_nodes get_nodes should_group_nodes group_nodes MAX_CORES );
23
24
use constant {
25
    MAX_NODES => 64,    # If the system has more nodes than this, nodes will be
26
                        # grouped so that LML displays one node per box rather
27
                        # than one core per box
28
    MAX_CORES => 64,    # If nodes are not grouped, this is the maximum number
29
                        # of cores that will be displayed for a single node
30
};
31
32
# The return value of get_nodes() is cached here to avoid re-executing qhost
33
my %cached_nodes = ();
34
35
my $cmd_jobinfo="/usr/bin/qstat";
36
$cmd_jobinfo=$ENV{"CMD_JOBINFO"} if($ENV{"CMD_JOBINFO"});
37
38
my $cmd_nodeinfo="/usr/bin/qhost";
39
$cmd_nodeinfo=$ENV{"CMD_NODEINFO"} if($ENV{"CMD_NODEINFO"}); 
40
41
42
43
###############################################################################
44
# get_jobs - Returns a hash containing information about jobs (from qstat)
45
###############################################################################
46
#
47
# The returned hash has job numbers as its keys and dictionaries of LML
48
# attributes as its values.
49
#
50
sub get_jobs {
51
    my %qstat_xml = parsexml("$cmd_jobinfo -u '*' -s prsz -r -xml |");
52
    trimtext(\%qstat_xml);
53
54
    my %jobs = ();
55
56
    my @jobs_in_queue = @{$qstat_xml{queue_info}[0]{job_list}};
57
    my @jobs_not_in_queue = @{$qstat_xml{job_info}[0]{job_list}};
58
    for my $job (@jobs_in_queue, @jobs_not_in_queue) {
59
        # The hash referenced by $job corresponds to an XML element like this:
60
        # <job_list state="running">
61
        #     <JB_job_number>344911</JB_job_number>
62
        #     <JAT_prio>0.12923</JAT_prio>
63
        #     <JB_name>RF-38</JB_name>
64
        #     <JB_owner>tg458455</JB_owner>
65
        #     <state>r</state>
66
        #     <JAT_start_time>2011-11-29T03:21:14</JAT_start_time>
67
        #     <queue_name>normal@c327-104.ls4.tacc.utexas.edu</queue_name>
68
        #     <slots>24</slots>
69
        #     <full_job_name>RF-38</full_job_name>
70
        #     <requested_pe name="12way">24</requested_pe>
71
        #     <granted_pe name="12way">24</granted_pe>
72
        #     <hard_request name="h_rt" resource_contribution="0.000000">86400</hard_request>
73
        #     <hard_request name="mem_total" resource_contribution="0.000000">23.4G</hard_request>
74
        #     <hard_req_queue>normal</hard_req_queue>
75
        # </job_list>
76
        my $jobid                 = $job->{JB_job_number}[0]{_text};
77
        $jobs{$jobid}{step}       = $jobid;
78
        $jobs{$jobid}{name}       = $jobid; #$job->{JB_name}[0]{_text};
79
        $jobs{$jobid}{owner}      = $job->{JB_owner}[0]{_text};
80
        $jobs{$jobid}{state}      = $job->{_attrs}{state};
81
        $jobs{$jobid}{totalcores} = $job->{slots}[0]{_text};
82
        $jobs{$jobid}{queue}      = $job->{queue_name}[0]{_text};
83
        if ($job->{_attrs}{state} ne "running") {
84
            $jobs{$jobid}{queuedate} = $job->{JB_submission_time}[0]{_text};
85
        } else {
86
            $jobs{$jobid}{dispatchdate} = $job->{JAT_start_time}[0]{_text};
87
        }
88
        $jobs{$jobid}{wall}       = '-';
89
        if (defined ($job->{hard_request})) {
90
            for my $request (@{$job->{hard_request}}) {
91
                if ($request->{_attrs}{name} eq 'h_rt') {
92
                    $jobs{$jobid}{wall} = $request->{_text};
93
                }
94
            }
95
        }
96
    }
97
98
    return %jobs;
99
}
100
101
102
103
###############################################################################
104
# get_job_nodes - Returns a hash containing information about what nodes each
105
#                 job is running on (from qhost)
106
###############################################################################
107
#
108
# The returned hash has job numbers as its keys and a comma-separated list of
109
# node names as its values.  Unfortunately, there is no information about what
110
# cores a job is assigned to on nodes with multiple cores.
111
#
112
sub get_job_nodes {
113
    my %qhost_xml = parsexml("$cmd_nodeinfo -j -xml |");
114
    trimtext(\%qhost_xml);
115
116
    my %job_hosts = ();
117
    for my $host (@{$qhost_xml{host}}) {
118
        # The hash referenced by $host corresponds to an XML element like
119
        # <host name='c300-001.ls4.tacc.utexas.edu'>
120
        #   <hostvalue name='arch_string'>lx24-amd64</hostvalue>
121
        #   <hostvalue name='num_proc'>12</hostvalue>
122
        #   <hostvalue name='load_avg'>0.02</hostvalue>
123
        #   <hostvalue name='mem_total'>47.2G</hostvalue>
124
        #   <hostvalue name='mem_used'>892.5M</hostvalue>
125
        #   <hostvalue name='swap_total'>0.0</hostvalue>
126
        #   <hostvalue name='swap_used'>0.0</hostvalue>
127
        # </host>
128
        my $hostname = $host->{_attrs}{name};
129
        $hostname =~ s/\..*//;
130
        if (defined($host->{job})) {
131
            for my $jobelt (@{$host->{job}}) {
132
                # The hash referenced by $jobelt corresponds to an XML element like
133
                #  <job name='353538'>
134
                #   <jobvalue jobid='353538' name='priority'>'0.005689'</jobvalue>
135
                #   <jobvalue jobid='353538' name='qinstance_name'>grace@c300-003.ls4.tacc.utexas.edu</jobvalue>
136
                #   <jobvalue jobid='353538' name='job_name'>acc+att.2008-01</jobvalue>
137
                #   <jobvalue jobid='353538' name='job_owner'>byaa705</jobvalue>
138
                #   <jobvalue jobid='353538' name='job_state'>r</jobvalue>
139
                #   <jobvalue jobid='353538' name='start_time'>1322585173</jobvalue>
140
                #   <jobvalue jobid='353538' name='queue_name'>grace@c300-003.ls4.tacc.utexas.edu</jobvalue>
141
                #   <jobvalue jobid='353538' name='pe_master'>SLAVE</jobvalue>
142
                # </job>
143
                my $jobid = $jobelt->{_attrs}{name};
144
                if (!defined($job_hosts{$jobid})) {
145
                    $job_hosts{$jobid} = {};
146
                }
147
                $job_hosts{$jobid}->{$hostname} = 1;
148
            }
149
        }
150
    }
151
152
    for my $jobid (keys %job_hosts) {
153
        my $nodelist = '';
154
        for my $node (keys %{$job_hosts{$jobid}}) {
155
            $nodelist .= "$node,";
156
        }
157
        chop($nodelist);
158
        $job_hosts{$jobid} = $nodelist;
159
    }
160
161
    return %job_hosts;
162
}
163
164
165
166
###############################################################################
167
# get_nodes - Returns a hash containing information about nodes (from qhost)
168
###############################################################################
169
#
170
# The returned hash has node names as its keys and dictionaries of LML
171
# attributes as its values.
172
#
173
sub get_nodes {
174
    if (scalar keys %cached_nodes > 0) {
175
        return %cached_nodes;
176
    }
177
178
    my %qhost_xml = parsexml("$cmd_nodeinfo -xml |");
179
    trimtext(\%qhost_xml);
180
181
    my %nodes = ();
182
    for my $host (@{$qhost_xml{host}}) {
183
        # The hash referenced by $host corresponds to an XML element like
184
        # <host name='c300-001.ls4.tacc.utexas.edu'>
185
        #   <hostvalue name='arch_string'>lx24-amd64</hostvalue>
186
        #   <hostvalue name='num_proc'>12</hostvalue>
187
        #   <hostvalue name='load_avg'>0.02</hostvalue>
188
        #   <hostvalue name='mem_total'>47.2G</hostvalue>
189
        #   <hostvalue name='mem_used'>892.5M</hostvalue>
190
        #   <hostvalue name='swap_total'>0.0</hostvalue>
191
        #   <hostvalue name='swap_used'>0.0</hostvalue>
192
        # </host>
193
194
        my $nodeid = $host->{_attrs}{name};
195
        $nodeid =~ s/\..*//;
196
197
        my %hostvalues = ();
198
        for my $hostvalue (@{$host->{hostvalue}}) {
199
            my $key = $hostvalue->{_attrs}{name};
200
            my $value = $hostvalue->{_text};
201
            $hostvalues{$key} = $value;
202
        }
203
204
        $nodes{$nodeid}{id} = $nodeid;
205
206
        $nodes{$nodeid}{ntype} = $hostvalues{arch_string};
207
208
        if (defined($hostvalues{num_proc})) {
209
            my $ncores = $hostvalues{num_proc};
210
            if ($ncores =~ /^[0-9]+$/) {
211
                if ($ncores > MAX_CORES) {
212
                    $ncores = MAX_CORES;
213
                } else {
214
                    $nodes{$nodeid}{ncores} = $ncores;
215
                }
216
            } else {
217
                $nodes{$nodeid}{ncores} = 1;
218
            }
219
        }
220
221
        $nodes{$nodeid}{physmem} = $hostvalues{mem_total};
222
    }
223
224
    %cached_nodes = %nodes;
225
    return %nodes;
226
}
227
228
229
230
###############################################################################
231
# should_group_nodes - Returns true if nodes should be grouped in the LML
232
#                      display (for performance reasons)
233
###############################################################################
234
sub should_group_nodes {
235
    my %nodes = get_nodes();
236
    my $num_nodes = scalar keys %nodes;
237
    return $num_nodes > MAX_NODES;
238
}
239
240
241
242
###############################################################################
243
# group_nodes - Places the system's nodes into groups such that there are no
244
#               more than MAX_NODES groups.
245
###############################################################################
246
#
247
# Three values are returned:
248
# - A reference to a hash mapping node names to group names
249
# - A reference to a hash mapping node names to their 0-based indices in the group
250
# - The (maximum) number of nodes in each group
251
#
252
sub group_nodes {
253
    my %nodes = get_nodes();
254
    my @nodeids = sort(keys(%nodes));
255
    my $num_nodes = $#nodeids + 1;
256
257
    my %node_group = ();
258
    my %node_index = ();
259
    my $nodes_per_group = ceil($num_nodes / MAX_NODES);
260
    if ($num_nodes <= MAX_NODES) {
261
        %node_group = map { $_ => $_ } @nodeids;
262
        %node_index = map { $_ => 0 } @nodeids;
263
    } else {
264
        my $nodenum = 0;
265
        for my $nodeid (@nodeids) {
266
            $node_group{$nodeid} = "Group" . floor($nodenum / $nodes_per_group);
267
            $node_index{$nodeid} = $nodenum % $nodes_per_group;
268
            $nodenum++;
269
        }
270
    }
271
    return (\%node_group, \%node_index, $nodes_per_group);
272
}
273
274
275
276
###### (PRIVATE) ##############################################################
277
# parsexml - Parses the given XML file into a hash.
278
###############################################################################
279
#
280
# The hash is keyed by the names of child elements.  It also contains
281
# the keys '_attrs' and '_text'.
282
#
283
# As an example, the XML file
284
#     <?xml version='1.0'?>
285
#     <aaa xxx="1">
286
#       <bbb xxx="" yyy="  2">This is child 1</bbb>
287
#       <bbb>This is child 2
288
#         <ccc/>
289
#       </bbb>
290
#     </aaa>
291
# is parsed into the hash
292
#     { '_text' => '\n\n\n',
293
#       '_attrs' => { 'xxx' => '1' },
294
#       'bbb' => [ { '_text' => 'This is child 1',
295
#                    '_attrs' => { 'xxx' => '',
296
#                                  'yyy' => '  2' }
297
#                  },
298
#                  { '_text' => 'This is child 2\n    \n  ',
299
#                    '_attrs' => {},
300
#                    'ccc' => [ { '_text' => '',
301
#                               '_attrs' => {} }
302
#                             ]
303
#                  }
304
#                ]
305
#     };
306
#
307
# This isn't fully general (e.g., it doesn't handle CDATA,
308
# and it assumes there won't be any child elements with the
309
# names '_attrs' or '_text') but it works for our purposes.
310
#
311
# Ideally, we could use XML::Simple and avoid this, except the
312
# TACC machines only have the XML::Parser module available.
313
sub parsexml {
314
    my ($file) = @_;
315
316
    use XML::Parser;
317
318
    # When we encounter a start tag, we will push the hash
319
    # for that XML element onto the stack.
320
    my @stack = ();
321
322
    my $parser = new XML::Parser(ErrorContext => 2);
323
    $parser->setHandlers(
324
        Start => sub {
325
                my ($parser, $elt, %attrs) = @_;
326
                # When we encounter an XML start tag, create a hash
327
                # for that XML element and push it onto the stack.
328
                my %element = ( _attrs => \%attrs, _text => '' );
329
                push(@stack, \%element);
330
            },
331
        Char => sub {
332
                my ($parser, $text) = @_;
333
                # When we encounter text, append it to the _text
334
                # for the current XML element.
335
                my $topref = $stack[-1];
336
                ${$topref}{_text} .= $text;
337
            },
338
        End => sub {
339
                my ($parser, $elt) = @_;
340
                # When we encounter an XML end tag, pop that
341
                # element's hash from the stack and mark it
342
                # as a child of the parent element.
343
                if ($#stack > 0) {
344
                    my $childref = pop(@stack);
345
                    my $parentref = $stack[-1];
346
                    if (not exists ${$parentref}{$elt}) {
347
                        ${$parentref}{$elt} = [];
348
                    }
349
                    my $arrayref = @{$parentref}{$elt};
350
                    push(@{$arrayref}, $childref);
351
                }
352
            });
353
    $parser->parsefile($file);
354
    if ($#stack == -1) {
355
        return undef;
356
    } else {
357
        return %{$stack[-1]};
358
    }
359
}
360
361
362
363
###### (PRIVATE) ##############################################################
364
# trimtext - Traverses the a tree returned by parsexml, removing leading and
365
#            trailing whitespace from all '_text' values.
366
###############################################################################
367
#
368
# As an example, when trimtext is applied to the example for parsexml above,
369
# the hash becomes the following:
370
#     { '_text' => '',
371
#       '_attrs' => { 'xxx' => '1' },
372
#       'bbb' => [ { '_text' => 'This is child 1',
373
#                    '_attrs' => { 'xxx' => '',
374
#                                  'yyy' => '  2' }
375
#                  },
376
#                  { '_text' => 'This is child 2',
377
#                    '_attrs' => {},
378
#                    'ccc' => [ { '_text' => '',
379
#                               '_attrs' => {} }
380
#                             ]
381
#                  }
382
#                ]
383
#     };
384
#
385
# Note that only the '_text' values are trimmed.  The attribute values (e.g.,
386
# for 'yyy') are not trimmed.
387
#
388
sub trimtext {
389
    my ($xml) = @_;
390
    for my $key (keys %{$xml}) {
391
        my $val = $xml->{$key};
392
        if ($key eq '_text') {
393
            $xml->{_text} =~ s/^\s+//;
394
            $xml->{_text} =~ s/\s+$//;
395
        } elsif (ref($val) eq "ARRAY") {
396
            for my $elt (@{$val}) {
397
                trimtext($elt);
398
            }
399
        } elsif (ref($val) eq "HASH") {
400
            trimtext($val);
401
        }
402
    }
403
    return $xml;
404
}
405
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/GridEngine/da_check_info_LML.pl (+96 lines)
Added Link Here
1
#!/usr/bin/perl -w
2
#*******************************************************************************
3
#* Copyright (c) 2011 Forschungszentrum Juelich GmbH.
4
#* All rights reserved. This program and the accompanying materials
5
#* are made available under the terms of the Eclipse Public License v1.0
6
#* which accompanies this distribution, and is available at
7
#* http://www.eclipse.org/legal/epl-v10.html
8
#*
9
#* Contributors:
10
#*    Jeff Overbey (Illinois/NCSA) - Sun Grid Engine support
11
#*    Wolfgang Frings (Forschungszentrum Juelich GmbH) 
12
#*******************************************************************************/ 
13
use strict;
14
15
#############################
16
# rms: Sun/Oracle Grid Engine
17
#############################
18
sub check_rms_GridEngine {
19
    my($rmsref,$cmdsref)=@_;
20
    my($key,$cmd);
21
    my $rc=1;
22
23
    my %cmdname=(
24
        "job"  => "qstat",
25
        "node" => "qhost",
26
        );
27
    my %cmdpath=(
28
        "job" => "/usr/bin/qstat",
29
        "node" => "/usr/bin/qhost",
30
        );
31
   
32
    foreach $key (keys(%cmdname)) {
33
        # check for job query cmd
34
        if(exists($cmdsref->{"cmd_${key}info"})) {
35
            $cmd=$cmdsref->{"cmd_${key}info"};
36
        } else {
37
            $cmd=$cmdpath{$key};
38
        }
39
        if(! -f $cmd) {
40
            my $cmdpath=`which $cmdname{$key} 2>/dev/null`;         # last try: which 
41
            if(!$?) {
42
                chomp($cmdpath);
43
                $cmd=$cmdpath;
44
		&report_if_verbose("%s","$0: check_rms_GridEngine: found $cmdname{$key} by which ($cmd)\n");
45
            } 
46
        }
47
        if(-f $cmd) {
48
            $cmdsref->{"cmd_${key}info"}=$cmd;
49
        } else {
50
	    &report_if_verbose("%s","$0: check_rms_GridEngine: no cmd found for $cmdname{$key}\n");
51
	    $rc=0;
52
	}
53
    }
54
    
55
    if($rc==1)  { 
56
	$$rmsref="GridEngine";
57
	&report_if_verbose("%s%s%s", "$0: check_rms_GridEngine: found Grid Engine commands (",
58
			   join(",",(values(%{$cmdsref}))),
59
			   ")\n");
60
    } else {
61
	&report_if_verbose("%s","$0: check_rms_GridEngine: seems not to be a Grid Engine system\n");
62
    }
63
    
64
    return($rc);
65
}
66
67
68
sub generate_step_rms_GridEngine {
69
    my($workflowxml, $laststep, $cmdsref)=@_;
70
    my($step,$envs,$key,$ukey);
71
72
    $envs="";
73
    foreach $key (keys(%{$cmdsref})) {
74
        $ukey=uc($key);
75
        $envs.="$ukey=$cmdsref->{$key} ";
76
    }
77
    $step="getdata";
78
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
79
                               "$envs $^X rms/GridEngine/da_system_info_LML.pl               \$tmpdir/sysinfo_LML.xml",
80
                               "$envs $^X rms/GridEngine/da_nodes_info_LML.pl                \$tmpdir/nodes_LML.xml",
81
                               "$envs $^X rms/GridEngine/da_jobs_info_LML.pl                 \$tmpdir/jobs_LML.xml");
82
    $laststep=$step;
83
84
    $step="combineLML";
85
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
86
                               "$^X \$instdir/LML_combiner/LML_combine_obj.pl  -v -o \$stepoutfile ".
87
                               "\$tmpdir/sysinfo_LML.xml \$tmpdir/jobs_LML.xml \$tmpdir/nodes_LML.xml");
88
    $laststep=$step;
89
90
    return($laststep);
91
}
92
93
$main::check_functions->{GridEngine}   =\&check_rms_GridEngine;
94
$main::generate_functions->{GridEngine}=\&generate_step_rms_GridEngine;
95
96
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/GridEngine/da_jobs_info_LML.pl (+181 lines)
Added Link Here
1
#!/usr/bin/perl -w
2
#*******************************************************************************
3
#* Copyright (c) 2011 Forschungszentrum Juelich GmbH and others.
4
#* All rights reserved. This program and the accompanying materials
5
#* are made available under the terms of the Eclipse Public License v1.0
6
#* which accompanies this distribution, and is available at
7
#* http://www.eclipse.org/legal/epl-v10.html
8
#*
9
#* Contributors:
10
#*    Wolfgang Frings (Forschungszentrum Juelich GmbH)
11
#*    Jeff Overbey (Illinois/NCSA) - Grid Engine support
12
#*******************************************************************************/ 
13
use strict;
14
15
use FindBin;                # Find the directory containing this script
16
use lib "$FindBin::Bin";    # Search for modules in this script's directory
17
use GEHelper;               # Now look for our GEHelper module
18
19
my $patint="([\\+\\-\\d]+)";   # Pattern for Integer number
20
my ($line,%jobs,%jobnr,$key,$value,$count,%notmappedkeys,%notfoundkeys);
21
22
if ($#ARGV != 0) {
23
  die " Usage: $0 <filename> $#ARGV\n";
24
}
25
my $filename = $ARGV[0];
26
27
my $system_sysprio=-1;
28
my $maxtopdogs=-1;
29
30
my %mapping = map { $_ => $_ } (
31
    "name",
32
    "owner",
33
    "restart",
34
    "dependency",
35
    "totalcores",
36
    "wall",
37
    "nodelist",
38
    "vnodelist",
39
    "state",
40
    "queuedate",
41
    "queue",
42
    "dispatchdate",
43
    "step",
44
    "totaltasks",
45
    "spec",
46
    "status",
47
    "detailedstatus",
48
    "group"
49
    );
50
51
%jobs = get_jobs();
52
53
my %nodes = get_nodes();
54
my ($node_groups, $node_index, $nodes_per_group) = group_nodes();
55
my %job_nodes = get_job_nodes();
56
for my $jobid (keys %job_nodes) {
57
    my $nodelist = $job_nodes{$jobid};
58
    if (should_group_nodes()) {
59
        # Determine what groups this 
60
        my %groups = ();
61
        for my $nodeid (split(/,/, $nodelist)) {
62
            my $groupid = $node_groups->{$nodeid};
63
            my $groupidx = $node_index->{$nodeid};
64
            $groups{"($groupid,$groupidx)"} = 1;
65
        }
66
        $nodelist = join("", sort(keys(%groups)));
67
    } else {
68
        my @nodes_in_list = split(/,/, $nodelist);
69
        $nodelist = '';
70
        for my $nd (@nodes_in_list) {
71
            if (defined($nodes{$nd}{ncores}) && $nodes{$nd}{ncores} =~ /[0-9]+/) {
72
                my $ncores = $nodes{$nd}{ncores};
73
                for (my $i = 0; $i < $ncores; $i++) {
74
                    $nodelist .= "($nd,$i)";
75
                }
76
            } else {
77
                $nodelist .= "($nd,0)";
78
            }
79
        }
80
    }
81
82
    $jobs{$jobid}{nodelist} = $nodelist;
83
}
84
85
# add unknown but manatory attributes to jobs
86
for my $jobid (sort(keys(%jobs))) {
87
    $jobs{$jobid}{group}      = "unknown" if(!exists($jobs{$jobid}{group}));
88
    $jobs{$jobid}{nodelist}  = "-" if(!exists($jobs{$jobid}{nodelist}));
89
    $jobs{$jobid}{totaltasks} = $jobs{$jobid}{totalcores} if(!exists($jobs{$jobid}{totaltasks}));
90
    $jobs{$jobid}{spec}       = $jobs{$jobid}{totalcores} if(!exists($jobs{$jobid}{spec}));
91
    # check state
92
    ($jobs{$jobid}{status},$jobs{$jobid}{detailedstatus}) = &get_state($jobs{$jobid}{state}); 
93
}
94
95
open(OUT,"> $filename") || die "cannot open file $filename";
96
printf(OUT "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
97
printf(OUT "<lml:lgui xmlns:lml=\"http://www.llview.de\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
98
printf(OUT "        xsi:schemaLocation=\"http://www.llview.de lgui.xsd\"\n");
99
printf(OUT "        version=\"0.7\"\>\n");
100
printf(OUT "<objects>\n");
101
$count=0;
102
for my $jobid (sort(keys(%jobs))) {
103
    $count++;$jobnr{$jobid}=$count;
104
    printf(OUT "<object id=\"j%06d\" name=\"%s\" type=\"job\"/>\n",$count,$jobid);
105
}
106
printf(OUT "</objects>\n");
107
printf(OUT "<information>\n");
108
for my $jobid (sort(keys(%jobs))) {
109
    printf(OUT "<info oid=\"j%06d\" type=\"short\">\n",$jobnr{$jobid});
110
    foreach $key (sort(keys(%{$jobs{$jobid}}))) {
111
        if(exists($mapping{$key})) {
112
            if($mapping{$key} ne "") {
113
                $value=&modify($key,$mapping{$key},$jobs{$jobid}{$key});
114
                if($value) {
115
                    printf(OUT " <data %-20s value=\"%s\"/>\n","key=\"".$mapping{$key}."\"",$value);
116
                }
117
            } else {
118
                $notmappedkeys{$key}++;
119
            }
120
        } else {
121
            $notfoundkeys{$key}++;
122
        }
123
    }
124
    printf(OUT "</info>\n");
125
}
126
printf(OUT "</information>\n");
127
printf(OUT "</lml:lgui>\n");
128
close(OUT);
129
130
foreach $key (sort(keys(%notfoundkeys))) {
131
    printf("%-40s => \"\",\n","\"".$key."\"",$notfoundkeys{$key});
132
}
133
134
135
sub get_state {
136
    my($job_state)=@_;
137
    my($state,$detailed_state);
138
139
    $state="UNDETERMINED";$detailed_state="";
140
141
    if($job_state eq "zombie") {
142
        $state="COMPLETED";$detailed_state="JOB_OUTERR_READY";
143
    }
144
    if($job_state eq "pending") {
145
        $state="SUBMITTED";
146
        $detailed_state="";
147
    }
148
    if($job_state eq "running") {
149
        $state="RUNNING";$detailed_state="";
150
    }    
151
152
    return($state,$detailed_state);
153
}
154
155
sub modify {
156
    my($key,$mkey,$value)=@_;
157
    my $ret=$value;
158
159
    if(!$ret) {
160
        return(undef);
161
    }
162
163
    if($mkey eq "state") {
164
        $ret="Completed"   if ($value eq "zombie");
165
        $ret="Idle"        if ($value eq "pending");
166
        $ret="Running"     if ($value eq "running");
167
    }
168
169
    if(($mkey eq "wall") || ($mkey eq "wallsoft")) {
170
        if($value=~/^$patint[:]$patint[:]$patint$/) {
171
            $ret=$1*60*60+$2*60+$3;
172
        }
173
    }
174
175
    # mask & in user input
176
    if($ret=~/\&/) {
177
        $ret=~s/\&/\&amp\;/gs;
178
    } 
179
180
    return($ret);
181
}
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/GridEngine/da_nodes_info_LML.pl (+129 lines)
Added Link Here
1
#!/usr/bin/perl -w
2
#*******************************************************************************
3
#* Copyright (c) 2011 Forschungszentrum Juelich GmbH and others.
4
#* All rights reserved. This program and the accompanying materials
5
#* are made available under the terms of the Eclipse Public License v1.0
6
#* which accompanies this distribution, and is available at
7
#* http://www.eclipse.org/legal/epl-v10.html
8
#*
9
#* Contributors:
10
#*    Wolfgang Frings (Forschungszentrum Juelich GmbH)
11
#*    Jeff Overbey (Illinois/NCSA) - Grid Engine support
12
#*******************************************************************************/ 
13
use strict;
14
15
use FindBin;                # Find the directory containing this script
16
use lib "$FindBin::Bin";    # Search for modules in this script's directory
17
use GEHelper;               # Now look for our GEHelper module
18
19
my $patint="([\\+\\-\\d]+)";   # Pattern for Integer number
20
my ($line,%nodes,%nodenr,$key,$value,$count,%notmappedkeys,%notfoundkeys);
21
22
if ($#ARGV != 0) {
23
  die " Usage: $0 <filename> $#ARGV\n";
24
}
25
my $filename = $ARGV[0];
26
27
my $system_sysprio=-1;
28
my $maxtopdogs=-1;
29
30
my %mapping = map { $_ => $_ } (
31
    "availmem",
32
    "id",
33
    "ncores",
34
    "physmem",
35
    "ntype",
36
    "state"
37
    );
38
39
40
%nodes = get_nodes();
41
42
if (should_group_nodes()) {
43
    my ($node_groups, $node_index, $nodes_per_group) = group_nodes();
44
    my %groups = ();
45
    for my $nodeid (keys %nodes) {
46
        my $groupid = $node_groups->{$nodeid};
47
        if (!defined($groups{$groupid})) {
48
            $groups{$groupid}{id}     = $groupid; #$nodes{$nodeid}{id};
49
            $groups{$groupid}{ntype}  = $nodes{$nodeid}{ntype};
50
            $groups{$groupid}{ncores} = 1;
51
        } else {
52
            # $groups{$groupid}{id} .= "," . $nodes{$nodeid}{id};
53
            if ($nodes{$nodeid}{ntype} ne '-' && $nodes{$nodeid}{ntype} ne $groups{$groupid}{ntype}) {
54
                $groups{$groupid}{ntype} = "(mixed)";
55
            }
56
            $groups{$groupid}{ncores} = $nodes_per_group;
57
        }
58
    }
59
    %nodes = %groups;
60
}
61
62
# add unknown but manatory attributes to nodes
63
for my $nodeid (keys(%nodes)) {
64
    my($key,$value,$pair);
65
    if(exists($nodes{$nodeid}{status})) {
66
        foreach $pair (split(/,/,$nodes{$nodeid}{status})) {
67
            ($key,$value)=split(/=/,$pair);
68
            $nodes{$nodeid}{$key}=$value;
69
        }
70
    } 
71
72
}
73
74
open(OUT,"> $filename") || die "cannot open file $filename";
75
76
printf(OUT "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
77
printf(OUT "<lml:lgui xmlns:lml=\"http://www.llview.de\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
78
printf(OUT "        xsi:schemaLocation=\"http://www.llview.de lgui.xsd\"\n");
79
printf(OUT "        version=\"0.7\"\>\n");
80
printf(OUT "<objects>\n");
81
$count=0;
82
for my $nodeid (sort(keys(%nodes))) {
83
    $count++;$nodenr{$nodeid}=$count;
84
    printf(OUT "<object id=\"nd%06d\" name=\"%s\" type=\"node\"/>\n",$count,$nodeid);
85
}
86
printf(OUT "</objects>\n");
87
printf(OUT "<information>\n");
88
for my $nodeid (sort(keys(%nodes))) {
89
    printf(OUT "<info oid=\"nd%06d\" type=\"short\">\n",$nodenr{$nodeid});
90
    foreach $key (sort(keys(%{$nodes{$nodeid}}))) {
91
        if(exists($mapping{$key})) {
92
            if($mapping{$key} ne "") {
93
                $value=&modify($key,$mapping{$key},$nodes{$nodeid}{$key});
94
                if($value) {
95
                    printf(OUT " <data %-20s value=\"%s\"/>\n","key=\"".$mapping{$key}."\"",$value);
96
                }
97
            } else {
98
                $notmappedkeys{$key}++;
99
            }
100
        } else {
101
            $notfoundkeys{$key}++;
102
        }
103
    }
104
    printf(OUT "</info>\n");
105
}
106
printf(OUT "</information>\n");
107
printf(OUT "</lml:lgui>\n");
108
109
close(OUT);
110
111
foreach $key (sort(keys(%notfoundkeys))) {
112
    printf("%-40s => \"\",\n","\"".$key."\"",$notfoundkeys{$key});
113
}
114
115
sub modify {
116
    my($key,$mkey,$value)=@_;
117
    my $ret=$value;
118
119
    if(!$ret) {
120
        return(undef);
121
    }
122
123
    # mask & in user input
124
    if($ret=~/\&/) {
125
        $ret=~s/\&/\&amp\;/gs;
126
    } 
127
128
    return($ret);
129
}
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/GridEngine/da_system_info_LML.pl (+49 lines)
Added Link Here
1
#!/usr/bin/perl -w
2
#*******************************************************************************
3
#* Copyright (c) 2011 Forschungszentrum Juelich GmbH and others.
4
#* All rights reserved. This program and the accompanying materials
5
#* are made available under the terms of the Eclipse Public License v1.0
6
#* which accompanies this distribution, and is available at
7
#* http://www.eclipse.org/legal/epl-v10.html
8
#*
9
#* Contributors:
10
#*    Wolfgang Frings (Forschungszentrum Juelich GmbH)
11
#*    Jeff Overbey (Illinois/NCSA) - Grid Engine support
12
#*******************************************************************************/ 
13
use strict;
14
15
if ($#ARGV != 0) {
16
  die " Usage: $0 <filename> $#ARGV\n";
17
}
18
my $filename = $ARGV[0];
19
20
my $system_time = &get_current_date();
21
my $hostname = `hostname`; chomp($hostname);
22
23
open(OUT,"> $filename") || die "cannot open file $filename";
24
printf OUT <<EOF;
25
<?xml version="1.0" encoding="UTF-8"?>
26
<lml:lgui xmlns:lml="http://www.llview.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
27
        xsi:schemaLocation="http://www.llview.de/lgui.xsd"
28
        version="0.7">
29
  <objects>
30
    <object id="sys000001" name="cluster" type="system"/>
31
  </objects>
32
  <information>
33
    <info oid="sys000001" type="short">
34
      <data key="system_time"    value="$system_time"/>
35
      <data key="hostname"       value="$hostname"/>
36
      <data key="type"           value="Cluster"/>
37
    </info>
38
  </information>
39
</lml:lgui>
40
EOF
41
close(OUT);
42
43
sub get_current_date {
44
    my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$idst)=localtime(time());
45
    my($date);
46
    $year=substr($year,1,2);
47
    $date=sprintf("%02d/%02d/%02d-%02d:%02d:%02d",$mon+1,$mday,$year,$hour,$min,$sec);
48
    return($date);
49
}
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/LL/da_check_info_LML.pl (-41 / +48 lines)
Lines 11-86 Link Here
11
#*******************************************************************************/ 
11
#*******************************************************************************/ 
12
use strict;
12
use strict;
13
13
14
sub check_rms {
14
sub check_rms_LL {
15
    my($rmsref,$cmdsref,$verbose)=@_;
15
    my($rmsref,$cmdsref,$verbose)=@_;
16
    my($key,$cmd);
16
    my($key,$cmd);
17
    my $rc=0;
17
    my $rc=1;
18
18
    
19
    my %cmdname=(
19
    my %cmdname=(
20
		"job"  => "llq",
20
	"job"  => "llq",
21
		"node" => "llstatus",
21
	"node" => "llstatus",
22
	);
22
	);
23
    my %cmdpath=(
23
    my %cmdpath=(
24
		"job" => "/usr/bin/llq",
24
	"job" => "/usr/bin/llq",
25
		"node" => "/usr/bin/llstatus",
25
	"node" => "/usr/bin/llstatus",
26
	);
26
	);
27
   
27
    
28
    foreach $key (keys(%cmdname)) {
28
    foreach $key (keys(%cmdname)) {
29
	# check for job query cmd
29
	# check for job query cmd
30
		if (exists($cmdsref->{"cmd_${key}info"})) {
30
	if (exists($cmdsref->{"cmd_${key}info"})) {
31
		    $cmd=$cmdsref->{"cmd_${key}info"};
31
	    $cmd=$cmdsref->{"cmd_${key}info"};
32
		} else {
33
		    $cmd=$cmdpath{$key};
34
		}
35
		if (!-f $cmd) {
36
		    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
37
		    if (!$?) {
38
				chomp($cmdpath);
39
				$cmd=$cmdpath;
40
				print STDERR "$0: check_rms: found $cmdname{$key} by which ($cmd)\n" if ($verbose);
41
		    } else {
42
				last;
43
		    }
44
		}
45
		if (-f $cmd) {
46
		    $cmdsref->{"cmd_${key}info"}=$cmd;
47
		    $rc=1;
48
		}
49
	}
50
	
51
	if ($rc) {
52
		$$rmsref="LL";
53
	} else {
32
	} else {
54
		print STDERR "$0: check_rms: seems not to be a LL system\n" if ($verbose);
33
	    $cmd=$cmdpath{$key};
55
    }
34
	}
35
	if (!-f $cmd) {
36
	    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
37
	    if (!$?) {
38
		chomp($cmdpath);
39
		$cmd=$cmdpath;
40
		&report_if_verbose("%s","$0: check_rms_LL: found $cmdname{$key} by which ($cmd)\n");
41
	    } 
42
	}
43
	if (-f $cmd) {
44
	    $cmdsref->{"cmd_${key}info"}=$cmd;
45
	} else {
46
	    &report_if_verbose("%s","$0: check_rms_LL: no cmd found for $cmdname{$key}\n");
47
	    $rc=0;
48
	}
56
49
50
    }
51
    
52
    if ($rc==1) {
53
	$$rmsref="LL";
54
	&report_if_verbose("%s%s%s", "$0: check_rms_LL: found LL commands (",
55
			   join(",",(values(%{$cmdsref}))),
56
			   ")\n");
57
    } else {
58
	&report_if_verbose("%s","$0: check_rms_LL: seems not to be a LL system\n");
59
    }
60
    
57
    return $rc;
61
    return $rc;
58
}
62
}
59
63
60
sub generate_step_rms {
64
sub generate_step_rms_LL {
61
    my($workflowxml, $laststep, $cmdsref)=@_;
65
    my($workflowxml, $laststep, $cmdsref)=@_;
62
    my($step,$envs,$key,$ukey);
66
    my($step,$envs,$key,$ukey);
63
67
    
64
    $envs="";
68
    $envs="";
65
    foreach $key (keys(%{$cmdsref})) {
69
    foreach $key (keys(%{$cmdsref})) {
66
		$ukey=uc($key);
70
	$ukey=uc($key);
67
		$envs.="$ukey=$cmdsref->{$key} ";
71
	$envs.="$ukey=$cmdsref->{$key} ";
68
    }
72
    }
69
73
    
70
    $step="getdata";
74
    $step="getdata";
71
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
75
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
72
			       "$envs $^X rms/LL/da_system_info_LML.pl               \$tmpdir/sysinfo_LML.xml",
76
			       "$envs $^X rms/LL/da_system_info_LML.pl               \$tmpdir/sysinfo_LML.xml",
73
			       "$envs $^X rms/LL/da_nodes_info_LML.pl                \$tmpdir/nodes_LML.xml",
77
			       "$envs $^X rms/LL/da_nodes_info_LML.pl                \$tmpdir/nodes_LML.xml",
74
			       "$envs $^X rms/LL/da_jobs_info_LML.pl                 \$tmpdir/jobs_LML.xml");
78
			       "$envs $^X rms/LL/da_jobs_info_LML.pl                 \$tmpdir/jobs_LML.xml");
75
    $laststep=$step;
79
    $laststep=$step;
76
80
    
77
    $step="combineLML";
81
    $step="combineLML";
78
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
82
    &add_exec_step_to_workflow($workflowxml,$step, $laststep, 
79
			       "$^X \$instdir/LML_combiner/LML_combine_obj.pl  -v -o \$stepoutfile ".
83
			       "$^X \$instdir/LML_combiner/LML_combine_obj.pl  -v -o \$stepoutfile ".
80
			       "\$tmpdir/sysinfo_LML.xml \$tmpdir/jobs_LML.xml \$tmpdir/nodes_LML.xml");
84
			       "\$tmpdir/sysinfo_LML.xml \$tmpdir/jobs_LML.xml \$tmpdir/nodes_LML.xml");
81
    $laststep=$step;
85
    $laststep=$step;
82
86
    
83
    return($laststep);
87
    return($laststep);
84
}
88
}
85
89
86
1;
90
$main::check_functions->{LL}   =\&check_rms_LL;
91
$main::generate_functions->{LL}=\&generate_step_rms_LL;
92
93
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/OPENMPI/da_check_info_LML.pl (-46 / +53 lines)
Lines 11-20 Link Here
11
#*******************************************************************************/ 
11
#*******************************************************************************/ 
12
use strict;
12
use strict;
13
13
14
sub check_rms {
14
sub check_rms_OPENMPI {
15
    my($rmsref,$cmdsref,$verbose)=@_;
15
    my($rmsref,$cmdsref,$verbose)=@_;
16
    my($key,$infocmd,$cmd);
16
    my($key,$infocmd,$cmd);
17
    my $rc=0;
17
    my $rc=1;
18
18
19
    my %cmdname=(
19
    my %cmdname=(
20
		"job"  => "orte-ps",
20
		"job"  => "orte-ps",
Lines 32-103 Link Here
32
32
33
    # first:  check if ompi_info is given by request info
33
    # first:  check if ompi_info is given by request info
34
    if (exists($cmdsref->{"cmd_sysinfo"})) {
34
    if (exists($cmdsref->{"cmd_sysinfo"})) {
35
		if (-f $cmdsref->{"cmd_sysinfo"}) {
35
	if (-f $cmdsref->{"cmd_sysinfo"}) {
36
		    $infocmd=$cmdsref->{"cmd_sysinfo"}." --path bindir";
36
	    $infocmd=$cmdsref->{"cmd_sysinfo"}." --path bindir";
37
		}
37
	}
38
    } 
38
    }
39
39
40
    # second: check if ompi_info is given in PATH
40
    # second: check if ompi_info is given in PATH
41
    if (!$infocmd) {
41
    if (!$infocmd) {
42
		my $cmdpath=`which $cmdname{sys} 2>/dev/null`; 	
42
	my $cmdpath=`which $cmdname{sys} 2>/dev/null`; 	
43
		if(!$?) {
43
	if(!$?) {
44
		    chomp($cmdpath);
44
	    chomp($cmdpath);
45
		    $infocmd=$cmdpath." --path bindir";
45
	    $infocmd=$cmdpath." --path bindir";
46
		}
46
	}
47
    }
47
    }
48
48
    
49
    # second: check if ompi_info is given in default path
49
    # second: check if ompi_info is given in default path
50
    if (!$infocmd) {
50
    if (!$infocmd) {
51
		my $cmdpath=$cmdpath{sys}; 	
51
	my $cmdpath=$cmdpath{sys}; 	
52
		if (!-f $cmdpath) {
52
	if (!-f $cmdpath) {
53
		    $infocmd=$cmdpath." --path bindir";
53
	    $infocmd=$cmdpath." --path bindir";
54
		}
54
	}
55
    }
55
    }
56
 
56
    
57
    # return if no ompi_info found
57
    # return if no ompi_info found
58
    if (!$infocmd) {
58
    if (!$infocmd) {
59
		return($rc);
59
	return($rc);
60
    }
60
    }
61
   
61
    
62
    # get openmpi bindir
62
    # get openmpi bindir
63
    my $bindir=`$infocmd`;
63
    my $bindir=`$infocmd`;
64
    chomp($bindir);
64
    chomp($bindir);
65
    $bindir=~s/^Bindir:\s*//gs;
65
    $bindir=~s/^Bindir:\s*//gs;
66
	
66
    
67
    foreach $key (keys(%cmdname)) {
67
    foreach $key (keys(%cmdname)) {
68
		$cmdpath{$key}=$bindir."/".$cmdname{$key};
68
	$cmdpath{$key}=$bindir."/".$cmdname{$key};
69
	
69
	
70
		if (exists($cmdsref->{"cmd_${key}info"})) {
70
	if (exists($cmdsref->{"cmd_${key}info"})) {
71
		    $cmd=$cmdsref->{"cmd_${key}info"};
71
	    $cmd=$cmdsref->{"cmd_${key}info"};
72
		} else {
72
	} else {
73
		    $cmd=$cmdpath{$key};
73
	    $cmd=$cmdpath{$key};
74
		}
74
	}
75
		if (! -f $cmd) {
75
	if (! -f $cmd) {
76
		    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
76
	    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
77
		    if(!$?) {
77
	    if(!$?) {
78
				chomp($cmdpath);
78
		chomp($cmdpath);
79
				$cmd=$cmdpath;
79
		$cmd=$cmdpath;
80
				print STDERR "$0: check_rms: found $cmdname{$key} by which ($cmd)\n" if($verbose);
80
		&report_if_verbose("%s","$0: check_rms_OPENMPI: found $cmdname{$key} by which ($cmd)\n");
81
		    } else {
81
	    } 
82
				last;
82
	}
83
		    }
83
	if (-f $cmd) {
84
		}
84
	    $cmdsref->{"cmd_${key}info"}=$cmd;
85
		if (-f $cmd) {
85
	} else {
86
		    $cmdsref->{"cmd_${key}info"}=$cmd;
86
	    &report_if_verbose("%s","$0: check_rms_OPENMPI: no cmd found for $cmdname{$key}\n");
87
		    $rc=1;
87
	    $rc=0;
88
		}
88
	}
89
    }
89
    }
90
	if ($rc) {
90
    if ($rc) {
91
		$$rmsref="OPENMPI";
91
	$$rmsref="OPENMPI";
92
	&report_if_verbose("%s%s%s", "$0: check_rms_OPENMPI: found OPENMPI commands (",
93
			   join(",",(values(%{$cmdsref}))),
94
			   ")\n");
92
    } else {
95
    } else {
93
		print STDERR "$0: check_rms: seems not to be a OpenMPI system\n" if($verbose);
96
	&report_if_verbose("%s","$0: check_rms_OPENMPI: seems not to be a OPENMPI system\n");
94
    }
97
    }
95
98
    
96
    return($rc);
99
    return($rc);
97
}
100
}
98
101
99
102
100
sub generate_step_rms {
103
sub generate_step_rms_OPENMPI {
101
    my($workflowxml, $laststep, $cmdsref)=@_;
104
    my($workflowxml, $laststep, $cmdsref)=@_;
102
    my($step,$envs,$key,$ukey);
105
    my($step,$envs,$key,$ukey);
103
106
Lines 122-125 Link Here
122
    return($laststep);
125
    return($laststep);
123
}
126
}
124
127
125
1;
128
$main::check_functions->{OPENMPI}   =\&check_rms_OPENMPI;
129
$main::generate_functions->{OPENMPI}=\&generate_step_rms_OPENMPI;
130
131
132
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/OPENMPI/da_jobs_info_LML.pl (-18 / +7 lines)
Lines 73-96 Link Here
73
my $cmd="orte-ps";
73
my $cmd="orte-ps";
74
$cmd=$ENV{"CMD_JOBINFO"} if($ENV{"CMD_JOBINFO"}); 
74
$cmd=$ENV{"CMD_JOBINFO"} if($ENV{"CMD_JOBINFO"}); 
75
75
76
if(open(IN,"$cmd -n -v 2>&1 |")) {
76
if(open(IN,"$cmd -n |")) {
77
    my $firstrankpid=undef;
77
    my $firstrankpid=undef;
78
    $jobid="-";
78
    $jobid="-";
79
    while($line=<IN>) {
79
    while($line=<IN>) {
80
	chomp($line);
80
	chomp($line);
81
	if ($line=~/Gathering Information for HNP: \[\[$patint,$patint\],$patint\]:$patint/) {
81
	if($line=~/Information from $patwrd \[$patint,$patint\]$/) {
82
		my($vpid,$pid)=($1,$4);
82
	    my($call,$pid,$num)=($1,$2,$3);
83
		$jobid=$pid;
83
	    print "found job $pid\n";
84
	    $jobid=$pid;
84
	    $jobs{$jobid}{step}=$jobid;
85
	    $jobs{$jobid}{step}=$jobid;
85
		print "found job $pid with vpid $vpid\n";
86
#
87
# Disable until ompi-ps is fixed
88
#
89
#    } elsif($line=~/Information from $patwrd \[$patint,$patint\]$/) {
90
#	    my($call,$vpid,$num)=($1,$2,$3);
91
#	    print "found vpid $vpid\n";
92
#	    $jobid=$pid;
93
#	    $jobs{$jobid}{step}=$jobid;
94
	} elsif($line=~/^\s*Node Name \|/) {
86
	} elsif($line=~/^\s*Node Name \|/) {
95
	    # scan node table
87
	    # scan node table
96
	    print "line 1: $line\n";
88
	    print "line 1: $line\n";
Lines 121-128 Link Here
121
	    if($line=~/^\s*\[$patint,$patint\]\s*\|\s*$patwrd\s*\|\s*$patwrd\s*\|\s*$patwrd\s*\|/) {
113
	    if($line=~/^\s*\[$patint,$patint\]\s*\|\s*$patwrd\s*\|\s*$patwrd\s*\|\s*$patwrd\s*\|/) {
122
		my($ppid,$num,$state,$slots,$numproc)=($1,$2,$3,$4,$5);
114
		my($ppid,$num,$state,$slots,$numproc)=($1,$2,$3,$4,$5);
123
		print "found joblist $ppid,$num,$state,$slots,$numproc\n";
115
		print "found joblist $ppid,$num,$state,$slots,$numproc\n";
124
#		$jobs{$jobid}{id}              = $ppid;
116
		$jobs{$jobid}{id}              = $ppid;
125
		$jobs{$jobid}{id}              = $jobid;
126
		$jobs{$jobid}{totaltasks}      = $numproc;
117
		$jobs{$jobid}{totaltasks}      = $numproc;
127
		$jobs{$jobid}{job_state}       = $state;
118
		$jobs{$jobid}{job_state}       = $state;
128
		$line=<IN>;
119
		$line=<IN>;
Lines 174-182 Link Here
174
    $nodes{$nodeid}{id}       = $nodeid;
165
    $nodes{$nodeid}{id}       = $nodeid;
175
    $nodes{$nodeid}{arch}     = `uname -p`;
166
    $nodes{$nodeid}{arch}     = `uname -p`;
176
    $nodes{$nodeid}{state}    = "Up";
167
    $nodes{$nodeid}{state}    = "Up";
177
    if (-e '/proc/cpuinfo') {
168
    $nodes{$nodeid}{slots}    = `grep family /proc/cpuinfo | wc -l`;
178
    	$nodes{$nodeid}{slots}    = `grep family /proc/cpuinfo | wc -l`;
179
    }
180
    foreach $key (keys(%{$nodes{$nodeid}})) {
169
    foreach $key (keys(%{$nodes{$nodeid}})) {
181
	chomp($nodes{$nodeid}{$key});
170
	chomp($nodes{$nodeid}{$key});
182
    }
171
    }
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/PBS/da_check_info_LML.pl (-38 / +44 lines)
Lines 11-20 Link Here
11
#*******************************************************************************/ 
11
#*******************************************************************************/ 
12
use strict;
12
use strict;
13
13
14
sub check_rms {
14
sub check_rms_PBS {
15
    my($rmsref,$cmdsref,$verbose)=@_;
15
    my($rmsref,$cmdsref,$verbose)=@_;
16
    my($key, $cmd);
16
    my($key, $cmd);
17
    my $rc=0;
17
    my $rc=1;
18
    
18
    
19
    my %cmdname=(
19
    my %cmdname=(
20
		"job"  => "qstat",
20
		"job"  => "qstat",
Lines 25-79 Link Here
25
		"job" => "/usr/bin/qstat",
25
		"job" => "/usr/bin/qstat",
26
		"node" => "/usr/bin/pbsnodes",
26
		"node" => "/usr/bin/pbsnodes",
27
	);
27
	);
28
   
28
    
29
    foreach $key (keys(%cmdname)) {
29
    foreach $key (keys(%cmdname)) {
30
		# check for job query cmd
30
	# check for job query cmd
31
		if (exists($cmdsref->{"cmd_${key}info"})) {
31
	if (exists($cmdsref->{"cmd_${key}info"})) {
32
		    $cmd=$cmdsref->{"cmd_${key}info"};
32
	    $cmd=$cmdsref->{"cmd_${key}info"};
33
		} else {
33
	} else {
34
		    $cmd=$cmdpath{$key};
34
	    $cmd=$cmdpath{$key};
35
		}
35
	}
36
		if (! -f $cmd) {
36
	if (! -f $cmd) {
37
		    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
37
	    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
38
		    if (!$?) {
38
	    if (!$?) {
39
				chomp($cmdpath);
39
		chomp($cmdpath);
40
				$cmd=$cmdpath;
40
		$cmd=$cmdpath;
41
				print STDERR "$0: check_rms: found $cmdname{$key} by which ($cmd)\n" if($verbose);
41
		&report_if_verbose("%s","$0: check_rms_PBS: found $cmdname{$key} by which ($cmd)\n");
42
		    } else {
42
	    }
43
				last;
43
	}
44
		    }
44
	if (-f $cmd) {
45
		}
45
	    $cmdsref->{"cmd_${key}info"}=$cmd;
46
		if (-f $cmd) {
46
	} else {
47
		    $cmdsref->{"cmd_${key}info"}=$cmd;
47
	    &report_if_verbose("%s","$0: check_rms_PBS: no cmd found for $cmdname{$key}\n");
48
		    $rc=1;
48
	    $rc=0;
49
		}
49
	}
50
    }
50
    }
51
    
51
    
52
    # Ensure it is a PBSpro system
52
    # Ensure it is a PBSpro system
53
	if (exists($cmdsref->{"cmd_jobinfo"})) {
53
    if (exists($cmdsref->{"cmd_jobinfo"})) {
54
	    $cmd=$cmdsref->{"cmd_jobinfo"}." --version";
54
	$cmd=$cmdsref->{"cmd_jobinfo"}." --version";
55
	    my $cmdversion=`$cmd 2>/dev/null`; 	
55
	    my $cmdversion=`$cmd 2>/dev/null`; 	
56
	    chomp($cmdversion);
56
	chomp($cmdversion);
57
	    if ($cmdversion=~/version/) {
57
	if ($cmdversion=~/version/) {
58
			if ($cmdversion=~/PBSPro/) {
58
	    if ($cmdversion=~/PBSPro/) {
59
			    print STDERR "$0: check_rms: PBSpro found\n" if($verbose);
59
		print STDERR "$0: check_rms: PBSpro found\n" if($verbose);
60
	    	}
61
	    } else {
62
			print STDERR "$0: check_rms: could not obtain version info from command $cmd\n" if($verbose);
63
			$rc=0;
64
	    }
60
	    }
61
	} else {
62
	    &report_if_verbose("%s","$0: check_rms_PBS: could not obtain version info from command $cmd\n");
63
	    $rc=0;
64
	}
65
    }
65
    }
66
66
    
67
    if ($rc)  {
67
    if ($rc==1)  {
68
    	$$rmsref = "PBS";
68
    	$$rmsref = "PBS";
69
	&report_if_verbose("%s%s%s", "$0: check_rms_PBS: found PBS commands (",
70
			   join(",",(values(%{$cmdsref}))),
71
			   ")\n");
69
    } else {
72
    } else {
70
		print STDERR "$0: check_rms: seems not to be a pbs system\n" if($verbose);
73
	&report_if_verbose("%s","$0: check_rms_PBS: seems not to be a PBS system\n");
71
    }
74
    }
72
    
75
    
73
    return($rc);
76
    return($rc);
74
}
77
}
75
78
76
sub generate_step_rms {
79
sub generate_step_rms_PBS {
77
    my($workflowxml, $laststep, $cmdsref)=@_;
80
    my($workflowxml, $laststep, $cmdsref)=@_;
78
    my($step,$envs,$key,$ukey);
81
    my($step,$envs,$key,$ukey);
79
82
Lines 98-101 Link Here
98
    return($laststep);
101
    return($laststep);
99
}
102
}
100
103
101
1;
104
$main::check_functions->{PBS}   =\&check_rms_PBS;
105
$main::generate_functions->{PBS}=\&generate_step_rms_PBS;
106
107
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/PBS/da_jobs_info_LML.pl (-16 / +49 lines)
Lines 56-62 Link Here
56
    "Resource_List.depend"                   => "dependency",
56
    "Resource_List.depend"                   => "dependency",
57
    "Resource_List.mem"                      => "",
57
    "Resource_List.mem"                      => "",
58
    "Resource_List.nodect"                   => "",
58
    "Resource_List.nodect"                   => "",
59
    "Resource_List.nodes"                    => "totalcores",
60
    "Resource_List.pmem"                     => "",
59
    "Resource_List.pmem"                     => "",
61
    "Resource_List.walltime"                 => "wall",
60
    "Resource_List.walltime"                 => "wall",
62
    "Shell_Path_List"                        => "",
61
    "Shell_Path_List"                        => "",
Lines 71-77 Link Here
71
    "fault_tolerant"                         => "",
70
    "fault_tolerant"                         => "",
72
    "interactive"                            => "",
71
    "interactive"                            => "",
73
    "job_state"                              => "state",
72
    "job_state"                              => "state",
74
    "mtime"                                  => "",
73
    "mtime"                                  => "dispatchdate",
75
    "qtime"                                  => "queuedate",
74
    "qtime"                                  => "queuedate",
76
    "queue"                                  => "queue",
75
    "queue"                                  => "queue",
77
    "resources_used.cput"                    => "",
76
    "resources_used.cput"                    => "",
Lines 81-91 Link Here
81
    "server"                                 => "",
80
    "server"                                 => "",
82
    "session_id"                             => "",
81
    "session_id"                             => "",
83
    "start_count"                            => "",
82
    "start_count"                            => "",
84
    "start_time"                             => "dispatchdate",
83
    "start_time"                             => "",
85
    "submit_args"                            => "",
84
    "submit_args"                            => "",
86
85
87
    "step"                                   => "step",
86
    "step"                                   => "step",
88
    "totaltasks"                             => "totaltasks",
87
    "totaltasks"                             => "totaltasks",
88
    "totalcores"                             => "totalcores",
89
    "spec"                                   => "spec",
89
    "spec"                                   => "spec",
90
90
91
    "status"                                 => "status",
91
    "status"                                 => "status",
Lines 110-118 Link Here
110
    "resources_used.ncpus"                   => "",
110
    "resources_used.ncpus"                   => "",
111
    "stime"                                  => "",
111
    "stime"                                  => "",
112
    "substate"                               => "",
112
    "substate"                               => "",
113
    
113
114
# unknown attributes
114
# unknown attributes
115
    "group"                                  => "group",
115
    "group"                                  => "group",
116
    "Account_Name"                           => "",
117
    "Exit_status"                            => "",
118
    "Resource_List.Qlist"                    => "",
119
    "estimated.exec_vnode"                   => "",
120
    "estimated.start_time"                   => "",
121
    "Resource_List.nodes"                    => "",
122
    "argument_list"                          => "",
123
    "array"                                  => "",
124
    "array_indices_remaining"                => "",
125
    "array_indices_submitted"                => "",
126
    "array_state_count"                      => "",
127
    "executable"                             => "",
128
    "group_list"                             => "",
129
    "umask"                                  => "",
116
    );
130
    );
117
131
118
my $cmd="/usr/bin/qstat";
132
my $cmd="/usr/bin/qstat";
Lines 121-127 Link Here
121
open(IN,"$cmd -f |");
135
open(IN,"$cmd -f |");
122
my $jobid="-";
136
my $jobid="-";
123
my $lastkey="-";
137
my $lastkey="-";
124
125
138
126
while($line=<IN>) {
139
while($line=<IN>) {
127
    chomp($line);
140
    chomp($line);
Lines 145-155 Link Here
145
foreach $jobid (sort(keys(%jobs))) {
158
foreach $jobid (sort(keys(%jobs))) {
146
    $jobs{$jobid}{group}      = "unknown" if(!exists($jobs{$jobid}{group}));
159
    $jobs{$jobid}{group}      = "unknown" if(!exists($jobs{$jobid}{group}));
147
    $jobs{$jobid}{exec_host}  = "-" if(!exists($jobs{$jobid}{exec_host}));
160
    $jobs{$jobid}{exec_host}  = "-" if(!exists($jobs{$jobid}{exec_host}));
148
    $jobs{$jobid}{totaltasks} = $jobs{$jobid}{"Resource_List.nodes"} if(!exists($jobs{$jobid}{totaltasks}));
161
    if(!exists($jobs{$jobid}{totaltasks})) {
149
    $jobs{$jobid}{spec}       = $jobs{$jobid}{"Resource_List.nodes"} if(!exists($jobs{$jobid}{spec}));
162
	$jobs{$jobid}{totaltasks} = $jobs{$jobid}{"Resource_List.nodes"} if(exists($jobs{$jobid}{"Resource_List.nodes"}));
163
	$jobs{$jobid}{totaltasks} = $jobs{$jobid}{"Resource_List.ncpus"} if(exists($jobs{$jobid}{"Resource_List.ncpus"}));
164
    }
165
    if(!exists($jobs{$jobid}{spec})) {
166
	$jobs{$jobid}{spec}       = $jobs{$jobid}{"Resource_List.nodes"} if(!exists($jobs{$jobid}{"Resource_List.nodes"}));
167
	$jobs{$jobid}{spec}       = $jobs{$jobid}{"Resource_List.ncpus"} if(!exists($jobs{$jobid}{"Resource_List.ncpus"}));
168
	
169
    }    
150
    # check state
170
    # check state
151
    ($jobs{$jobid}{status},$jobs{$jobid}{detailedstatus}) = &get_state($jobs{$jobid}{job_state},
171
    ($jobs{$jobid}{status},$jobs{$jobid}{detailedstatus}) = &get_state($jobs{$jobid}{job_state},
152
								       $jobs{$jobid}{Hold_Types}); 
172
								       $jobs{$jobid}{Hold_Types}); 
173
    $jobs{$jobid}{"totalcores"}=$jobs{$jobid}{"totaltasks"} if(!exists($jobs{$jobid}{"totalcores"}));
153
}
174
}
154
175
155
open(OUT,"> $filename") || die "cannot open file $filename";
176
open(OUT,"> $filename") || die "cannot open file $filename";
Lines 274-296 Link Here
274
295
275
    if($mkey eq "vnodelist") {
296
    if($mkey eq "vnodelist") {
276
	if($ret ne "-") {
297
	if($ret ne "-") {
298
#	    my $save=$ret;
299
	    $ret=~s/\(//gs;$ret=~s/\)//gs;
277
	    my @nodes = split(/\+/,$ret);
300
	    my @nodes = split(/\+/,$ret);
278
	    my ($c,$nd,$num);
301
	    my ($c,$nd,$num,$rest);
279
	    for($c=0;$c<$#nodes;$c++) {
302
	    for($c=0;$c<=$#nodes;$c++) {
280
		if($nodes[$c]=~/([^\(\)\:]+)\:.*ncpus=(\d+)/s) {
303
		# get nodename
281
		    $nd=$1;$num=$2;
304
		if($nodes[$c]=~/^([^\:]+)\:(.*)$/s) {
305
		    ($nd,$rest)=($1,$2);
306
		    # get number of procs
307
		    if($rest=~/ncpus=(\d+)/) {
308
			$num=$1;
309
		    } elsif($rest=~/mpiprocs=(\d+)/) {
310
			$num=$1;
311
		    } else {
312
			# default:  1 core
313
			$num=1;
314
		    }
282
		    $nodes[$c]="$nd,$num";
315
		    $nodes[$c]="$nd,$num";
283
		} elsif($nodes[$c]=~/([^\(\)\:]+)\:.*mpiprocs=(\d+)/s) {
316
		} elsif($nodes[$c]=~/^([^\:]+)$/s) {
284
		    $nd=$1;$num=$2;
317
		    $nd=$1;
285
		    $nodes[$c]="$nd,$num";
318
		    $num=1;
286
		} elsif($nodes[$c]=~/([^\(\)\:]+)/s) {
287
		    $nd=$1;$num=1;
288
		    $nodes[$c]="$nd,$num";
319
		    $nodes[$c]="$nd,$num";
289
		} else {
320
		} else {
290
		    print STDERR "Error in job node list: $nodes[$c]\n";
321
		    print STDERR "Error in job node list: $nodes[$c]\n";
322
		    $nodes[$c]="unknown,0";
291
		}
323
		}
292
	    }
324
	    }
293
	    $ret="(".join(')(',@nodes).")";
325
	    $ret="(".join(')(',@nodes).")";
326
#	    print "$save -> $ret\n";
294
	}
327
	}
295
    }
328
    }
296
329
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/PBS/da_nodes_info_LML.pl (+8 lines)
Lines 86-91 Link Here
86
    "resv_enable"                            => "",
86
    "resv_enable"                            => "",
87
    "sharing"                                => "",
87
    "sharing"                                => "",
88
# unknown attributes
88
# unknown attributes
89
    "resources_available.Cluster"            => "",
90
    "resources_available.IB"                 => "",
91
    "resources_available.NodeInfo"           => "",
92
    "resources_available.Qlist"              => "",
93
    "resources_available.Rack"               => "",
94
    "resources_available.groupn"             => "",
95
    "resources_available.nodemem"            => "",
96
89
    );
97
    );
90
98
91
99
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/PE/da_check_info_LML.pl (-31 / +37 lines)
Lines 11-61 Link Here
11
#*******************************************************************************/ 
11
#*******************************************************************************/ 
12
use strict;
12
use strict;
13
13
14
sub check_rms {
14
sub check_rms_PE {
15
    my($rmsref,$cmdsref,$verbose)=@_;
15
    my($rmsref,$cmdsref,$verbose)=@_;
16
    my($key,$cmd);
16
    my($key,$cmd);
17
    my $rc=0;
17
    my $rc=1;
18
18
    
19
    my %cmdname=(
19
    my %cmdname=(
20
		"job"  => "poe",
20
		"job"  => "poe",
21
	);
21
	);
22
        
22
    
23
    my %cmdpath=(
23
    my %cmdpath=(
24
		"job"  => "/usr/bin/poe",
24
	"job"  => "/usr/bin/poe",
25
	);
25
	);
26
	
26
    
27
    foreach $key (keys(%cmdname)) {
27
    foreach $key (keys(%cmdname)) {
28
		if (exists($cmdsref->{"cmd_${key}info"})) {
28
	if (exists($cmdsref->{"cmd_${key}info"})) {
29
		    $cmd=$cmdsref->{"cmd_${key}info"};
29
	    $cmd=$cmdsref->{"cmd_${key}info"};
30
		} else {
30
	} else {
31
		    $cmd=$cmdpath{$key};
31
	    $cmd=$cmdpath{$key};
32
		}
32
	}
33
		if (! -f $cmd) {
33
	if (! -f $cmd) {
34
		    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
34
	    my $cmdpath=`which $cmdname{$key} 2>/dev/null`; 	# last try: which 
35
		    if(!$?) {
35
	    if(!$?) {
36
				chomp($cmdpath);
36
		chomp($cmdpath);
37
				$cmd=$cmdpath;
37
		$cmd=$cmdpath;
38
				print STDERR "$0: check_rms: found $cmdname{$key} by which ($cmd)\n" if($verbose);
38
		&report_if_verbose("%s","$0: check_rms_PE: found $cmdname{$key} by which ($cmd)\n");
39
		    } else {
39
	    }
40
				last;
40
	}
41
		    }
41
	if (-f $cmd) {
42
		}
42
	    $cmdsref->{"cmd_${key}info"}=$cmd;
43
		if (-f $cmd) {
43
	} else {
44
		    $cmdsref->{"cmd_${key}info"}=$cmd;
44
	    &report_if_verbose("%s","$0: check_rms_PE: no cmd found for $cmdname{$key}\n");
45
		    $rc=1;
45
	    $rc=0;
46
		}
46
	}
47
    }
47
    }
48
	if ($rc) {
48
    if ($rc==1) {
49
		$$rmsref="PE";
49
	$$rmsref="PE";
50
	&report_if_verbose("%s%s%s", "$0: check_rms_PE: found PE commands (",
51
			   join(",",(values(%{$cmdsref}))),
52
			   ")\n");
50
    } else {
53
    } else {
51
		print STDERR "$0: check_rms: seems not to be a OpenMPI system\n" if($verbose);
54
	&report_if_verbose("%s","$0: check_rms_PE: seems not to be a PE system\n");
52
    }
55
    }
53
56
    
54
    return($rc);
57
    return($rc);
55
}
58
}
56
59
57
60
58
sub generate_step_rms {
61
sub generate_step_rms_PE {
59
    my($workflowxml, $laststep, $cmdsref)=@_;
62
    my($workflowxml, $laststep, $cmdsref)=@_;
60
    my($step,$envs,$key,$ukey);
63
    my($step,$envs,$key,$ukey);
61
64
Lines 79-82 Link Here
79
    return($laststep);
82
    return($laststep);
80
}
83
}
81
84
82
1;
85
$main::check_functions->{PE}   =\&check_rms_PE;
86
$main::generate_functions->{PE}=\&generate_step_rms_PE;
87
88
1;
(-)a/rms/org.eclipse.ptp.rm.lml.da/rms/TORQUE/da_check_info_LML.pl (-15 / +21 lines)
Lines 11-20 Link Here
11
#*******************************************************************************/ 
11
#*******************************************************************************/ 
12
use strict;
12
use strict;
13
13
14
sub check_rms {
14
sub check_rms_TORQUE {
15
    my($rmsref,$cmdsref,$verbose)=@_;
15
    my($rmsref,$cmdsref,$verbose)=@_;
16
    my($key, $cmd);
16
    my($key, $cmd);
17
    my $rc=0;
17
    my $rc=1;
18
    
18
    
19
    my %cmdname=(
19
    my %cmdname=(
20
		"job"  => "qstat",
20
		"job"  => "qstat",
Lines 38-51 Link Here
38
		    if (!$?) {
38
		    if (!$?) {
39
				chomp($cmdpath);
39
				chomp($cmdpath);
40
				$cmd=$cmdpath;
40
				$cmd=$cmdpath;
41
				print STDERR "$0: check_rms: found $cmdname{$key} by which ($cmd)\n" if($verbose);
41
				&report_if_verbose("%s","$0: check_rms_TORQUE: found $cmdname{$key} by which ($cmd)\n");
42
		    } else {
42
		    } 
43
				last;
44
		    }
45
		}
43
		}
46
		if (-f $cmd) {
44
		if (-f $cmd) {
47
		    $cmdsref->{"cmd_${key}info"}=$cmd;
45
		    $cmdsref->{"cmd_${key}info"}=$cmd;
48
		    $rc=1;
46
		}  else {
47
		    &report_if_verbose("%s","$0: check_rms_TORQUE: no cmd found for $cmdname{$key}\n");
48
		    $rc=0;
49
		}
49
		}
50
    }
50
    }
51
    
51
    
Lines 55-79 Link Here
55
	    my $cmdversion=`$cmd 2>/dev/null`; 	
55
	    my $cmdversion=`$cmd 2>/dev/null`; 	
56
	    chomp($cmdversion);
56
	    chomp($cmdversion);
57
	    if ($cmdversion=~/version/) {
57
	    if ($cmdversion=~/version/) {
58
			if ($cmdversion=~/PBSPro/) {
58
		if ($cmdversion=~/PBSPro/) {
59
			    print STDERR "$0: check_rms: PBSpro found\n" if($verbose);
59
		    &report_if_verbose("%s","$0: check_rms_TORQUE: PBSpro found\n");
60
			    $rc=0;
60
		    $rc=0;
61
	    	}
61
	    	}
62
	    } else {
62
	    } else {
63
			print STDERR "$0: check_rms: could not obtain version info from command $cmd\n" if($verbose);
63
		&report_if_verbose("%s","$0: check_rms_TORQUE: could not obtain version info from command $cmd\n");
64
	    }
64
	    }
65
    }
65
    }
66
66
67
    if ($rc)  {
67
    if ($rc==1)  {
68
    	$$rmsref = "TORQUE";
68
    	$$rmsref = "TORQUE";
69
	&report_if_verbose("%s%s%s", "$0: check_rms_TORQUE: found TORQUE commands (",
70
			   join(",",(values(%{$cmdsref}))),
71
			   ")\n");
69
    } else {
72
    } else {
70
		print STDERR "$0: check_rms: seems not to be a torque system\n" if($verbose);
73
	&report_if_verbose("%s","$0: check_rms_TORQUE: seems not to be a TORQUE system\n");
71
    }
74
    }
72
    
75
    
73
    return($rc);
76
    return($rc);
74
}
77
}
75
78
76
sub generate_step_rms_torque {
79
sub generate_step_rms_TORQUE {
77
    my($workflowxml, $laststep, $cmdsref)=@_;
80
    my($workflowxml, $laststep, $cmdsref)=@_;
78
    my($step,$envs,$key,$ukey);
81
    my($step,$envs,$key,$ukey);
79
82
Lines 99-102 Link Here
99
102
100
}
103
}
101
104
102
1;
105
$main::check_functions->{TORQUE}   =\&check_rms_TORQUE;
106
$main::generate_functions->{TORQUE}=\&generate_step_rms_TORQUE;
107
108
1;
(-)a/rms/org.eclipse.ptp.rm.lml.monitor.core/src/org/eclipse/ptp/rm/lml/monitor/core/LMLResourceManagerMonitor.java (-27 / +101 lines)
Lines 13-19 Link Here
13
import java.io.StringReader;
13
import java.io.StringReader;
14
import java.io.StringWriter;
14
import java.io.StringWriter;
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.HashMap;
17
import java.util.LinkedList;
16
import java.util.List;
18
import java.util.List;
19
import java.util.Map;
20
import java.util.Map.Entry;
17
21
18
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IProgressMonitor;
23
import org.eclipse.core.runtime.IProgressMonitor;
Lines 41-50 Link Here
41
import org.eclipse.ptp.rm.jaxb.core.data.SimpleCommandType;
45
import org.eclipse.ptp.rm.jaxb.core.data.SimpleCommandType;
42
import org.eclipse.ptp.rm.lml.core.JobStatusData;
46
import org.eclipse.ptp.rm.lml.core.JobStatusData;
43
import org.eclipse.ptp.rm.lml.core.LMLManager;
47
import org.eclipse.ptp.rm.lml.core.LMLManager;
48
import org.eclipse.ptp.rm.lml.core.model.IPattern;
44
import org.eclipse.ptp.rm.lml.da.server.core.LMLDAServer;
49
import org.eclipse.ptp.rm.lml.da.server.core.LMLDAServer;
45
import org.eclipse.ptp.rm.lml.internal.core.elements.CommandType;
50
import org.eclipse.ptp.rm.lml.internal.core.elements.CommandType;
46
import org.eclipse.ptp.rm.lml.internal.core.elements.DriverType;
51
import org.eclipse.ptp.rm.lml.internal.core.elements.DriverType;
47
import org.eclipse.ptp.rm.lml.internal.core.elements.RequestType;
52
import org.eclipse.ptp.rm.lml.internal.core.elements.RequestType;
53
import org.eclipse.ptp.rm.lml.internal.core.model.Pattern;
48
import org.eclipse.ptp.rm.lml.monitor.LMLMonitorCorePlugin;
54
import org.eclipse.ptp.rm.lml.monitor.LMLMonitorCorePlugin;
49
import org.eclipse.ptp.rm.lml.monitor.core.messages.Messages;
55
import org.eclipse.ptp.rm.lml.monitor.core.messages.Messages;
50
import org.eclipse.ptp.rmsystem.AbstractResourceManagerConfiguration;
56
import org.eclipse.ptp.rmsystem.AbstractResourceManagerConfiguration;
Lines 166-171 Link Here
166
172
167
	private static final String LAYOUT = "layout";//$NON-NLS-1$
173
	private static final String LAYOUT = "layout";//$NON-NLS-1$
168
	private static final String LAYOUT_STRING = "layoutString";//$NON-NLS-1$
174
	private static final String LAYOUT_STRING = "layoutString";//$NON-NLS-1$
175
	private static final String PATTERN_GID_ATTR = "gid";//$NON-NLS-1$
176
	private static final String FILTER_TITLE_ATTR = "columnTitle";//$NON-NLS-1$
177
	private static final String FILTER_TYPE_ATTR = "type";//$NON-NLS-1$
178
	private static final String FILTER_RANGE_ATTR = "range";//$NON-NLS-1$
179
	private static final String FILTER_RELATION_ATTR = "relation";//$NON-NLS-1$
180
	private static final String FILTER_MAX_VALUE_RANGE_ATTR = "maxValueRange";//$NON-NLS-1$
181
	private static final String FILTER_MIN_VALUE_RANGE_ATTR = "minValueRange";//$NON-NLS-1$
182
	private static final String FILTER_RELATION_OPERATOR_ATTR = "relationOperartor";//$NON-NLS-1$
183
	private static final String FILTER_RELATION_VALUE_ATTR = "relationValue";//$NON-NLS-1$
169
	private static final String JOB_ID_ATTR = "job_id";//$NON-NLS-1$
184
	private static final String JOB_ID_ATTR = "job_id";//$NON-NLS-1$
170
	private static final String RM_ID_ATTR = "rm_id";//$NON-NLS-1$
185
	private static final String RM_ID_ATTR = "rm_id";//$NON-NLS-1$
171
	private static final String STDOUT_REMOTE_FILE_ATTR = "stdout_remote_path";//$NON-NLS-1$
186
	private static final String STDOUT_REMOTE_FILE_ATTR = "stdout_remote_path";//$NON-NLS-1$
Lines 243-249 Link Here
243
		return null;
258
		return null;
244
	}
259
	}
245
260
246
	private JobStatusData[] reload(IMemento memento) {
261
	private JobStatusData[] reloadJobs(IMemento memento) {
247
		final List<JobStatusData> jobs = new ArrayList<JobStatusData>();
262
		final List<JobStatusData> jobs = new ArrayList<JobStatusData>();
248
		if (memento != null) {
263
		if (memento != null) {
249
			final IMemento[] children = memento.getChildren(JOB_ID_ATTR);
264
			final IMemento[] children = memento.getChildren(JOB_ID_ATTR);
Lines 257-263 Link Here
257
		return jobs.toArray(new JobStatusData[jobs.size()]);
272
		return jobs.toArray(new JobStatusData[jobs.size()]);
258
	}
273
	}
259
274
260
	private void save(JobStatusData job, XMLMemento memento) {
275
	private Map<String, List<IPattern>> reloadPattern(IMemento memento) {
276
		final Map<String, List<IPattern>> pattern = new HashMap<String, List<IPattern>>();
277
		if (memento != null) {
278
			final IMemento[] childrenPattern = memento.getChildren(PATTERN_GID_ATTR);
279
			for (final IMemento childPattern : childrenPattern) {
280
				final List<IPattern> filters = new LinkedList<IPattern>();
281
				final IMemento[] childrenFilter = childPattern.getChildren(FILTER_TITLE_ATTR);
282
				for (final IMemento childFilter : childrenFilter) {
283
					final IPattern filter = new Pattern(childFilter.getID(), childFilter.getString(FILTER_TYPE_ATTR));
284
					if (childFilter.getBoolean(FILTER_RANGE_ATTR)) {
285
						filter.setRange(childFilter.getString(FILTER_MIN_VALUE_RANGE_ATTR),
286
								childFilter.getString(FILTER_MAX_VALUE_RANGE_ATTR));
287
					} else if (childFilter.getBoolean(FILTER_RELATION_ATTR)) {
288
						filter.setRelation(childFilter.getString(FILTER_RELATION_OPERATOR_ATTR),
289
								childFilter.getString(FILTER_RELATION_VALUE_ATTR));
290
					}
291
					filters.add(filter);
292
				}
293
294
				if (filters.size() > 0) {
295
					pattern.put(childPattern.getID(), filters);
296
				}
297
			}
298
		}
299
		return pattern;
300
	}
301
302
	private void saveJob(JobStatusData job, XMLMemento memento) {
261
		final IMemento jobMemento = memento.createChild(JOB_ID_ATTR, job.getJobId());
303
		final IMemento jobMemento = memento.createChild(JOB_ID_ATTR, job.getJobId());
262
		jobMemento.putString(RM_ID_ATTR, job.getRmId());
304
		jobMemento.putString(RM_ID_ATTR, job.getRmId());
263
		jobMemento.putString(STATE_ATTR, job.getState());
305
		jobMemento.putString(STATE_ATTR, job.getState());
Lines 269-274 Link Here
269
		jobMemento.putString(OWNER_ATTR, job.getOwner());
311
		jobMemento.putString(OWNER_ATTR, job.getOwner());
270
		jobMemento.putString(OID_ATTR, job.getOid());
312
		jobMemento.putString(OID_ATTR, job.getOid());
271
313
314
	}
315
316
	private void savePattern(String key, List<IPattern> value, IMemento memento) {
317
		final IMemento patternMemento = memento.createChild(PATTERN_GID_ATTR, key);
318
		for (final IPattern filterValue : value) {
319
			final IMemento filterMemento = patternMemento.createChild(FILTER_TITLE_ATTR, filterValue.getColumnTitle());
320
			filterMemento.putString(FILTER_TYPE_ATTR, filterValue.getType());
321
			filterMemento.putBoolean(FILTER_RANGE_ATTR, filterValue.isRange());
322
			filterMemento.putBoolean(FILTER_RELATION_ATTR, filterValue.isRelation());
323
			if (filterValue.isRange()) {
324
				filterMemento.putString(FILTER_MIN_VALUE_RANGE_ATTR, filterValue.getMinValueRange());
325
				filterMemento.putString(FILTER_MAX_VALUE_RANGE_ATTR, filterValue.getMaxValueRange());
326
			} else if (filterValue.isRelation()) {
327
				filterMemento.putString(FILTER_RELATION_OPERATOR_ATTR, filterValue.getRelationOperator());
328
				filterMemento.putString(FILTER_RELATION_VALUE_ATTR, filterValue.getRelationValue());
329
			}
330
		}
272
	}
331
	}
273
332
274
	@Override
333
	@Override
Lines 301-306 Link Here
301
		if (memento != null) {
360
		if (memento != null) {
302
			final String layout = fLMLManager.getCurrentLayout(getResourceManager().getUniqueName());
361
			final String layout = fLMLManager.getCurrentLayout(getResourceManager().getUniqueName());
303
			final JobStatusData[] jobs = fLMLManager.getUserJobs(getResourceManager().getUniqueName());
362
			final JobStatusData[] jobs = fLMLManager.getUserJobs(getResourceManager().getUniqueName());
363
			final Map<String, List<IPattern>> patternMap = fLMLManager.getCurrentPattern(getResourceManager().getUniqueName());
304
364
305
			if (layout != null) {
365
			if (layout != null) {
306
				final IMemento layoutMemento = memento.createChild(LAYOUT);
366
				final IMemento layoutMemento = memento.createChild(LAYOUT);
Lines 310-317 Link Here
310
			if (jobs != null && jobs.length > 0) {
370
			if (jobs != null && jobs.length > 0) {
311
				for (final JobStatusData status : jobs) {
371
				for (final JobStatusData status : jobs) {
312
					if (!status.isRemoved()) {
372
					if (!status.isRemoved()) {
313
						save(status, memento);
373
						saveJob(status, memento);
314
					}
374
					}
375
				}
376
			}
377
378
			if (patternMap != null && patternMap.keySet().size() > 0) {
379
				for (final Entry<String, List<IPattern>> pattern : patternMap.entrySet()) {
380
					savePattern(pattern.getKey(), pattern.getValue(), memento);
315
				}
381
				}
316
			}
382
			}
317
		}
383
		}
Lines 354-395 Link Here
354
420
355
		final StringBuilder layout = new StringBuilder();
421
		final StringBuilder layout = new StringBuilder();
356
		JobStatusData[] jobs = null;
422
		JobStatusData[] jobs = null;
423
		Map<String, List<IPattern>> pattern = null;
357
424
358
		if (memento != null) {
425
		if (memento != null) {
359
			final IMemento child = memento.getChild(LAYOUT);
426
			final IMemento childLayout = memento.getChild(LAYOUT);
360
			if (child != null) {
427
			if (childLayout != null) {
361
				final String childString = child.getString(LAYOUT_STRING);
428
				final String childLayoutString = childLayout.getString(LAYOUT_STRING);
362
				layout.append(childString);
429
				layout.append(childLayoutString);
363
			}
430
			}
364
431
365
			jobs = reload(memento);
432
			pattern = reloadPattern(memento);
433
			jobs = reloadJobs(memento);
366
		}
434
		}
367
		/*
368
		 * Initialize LML classes
369
		 */
370
		fLMLManager.openLgui(getResourceManager().getUniqueName(), getMonitorConfigurationRequestType(), layout, jobs);
371
		/*
372
		 * Open connection and launch periodic job
373
		 */
374
		final IRemoteConnection conn = getRemoteConnection(monitor);
435
		final IRemoteConnection conn = getRemoteConnection(monitor);
375
		if (conn != null) {
436
		if (conn == null) {
376
			if (!conn.isOpen()) {
437
			throw new CoreException(new Status(IStatus.ERROR, LMLMonitorCorePlugin.getUniqueIdentifier(),
377
				try {
438
					Messages.LMLResourceManagerMonitor_unableToOpenConnection));
378
					conn.open(monitor);
439
		}
379
				} catch (final RemoteConnectionException e) {
440
380
					throw new CoreException(new Status(IStatus.ERROR, LMLMonitorCorePlugin.getUniqueIdentifier(), e.getMessage()));
441
		if (!conn.isOpen()) {
381
				}
442
			try {
443
				conn.open(monitor);
444
			} catch (final RemoteConnectionException e) {
445
				throw new CoreException(new Status(IStatus.ERROR, LMLMonitorCorePlugin.getUniqueIdentifier(), e.getMessage()));
382
			}
446
			}
383
			if (!conn.isOpen()) {
447
			if (!conn.isOpen()) {
384
				throw new CoreException(new Status(IStatus.ERROR, LMLMonitorCorePlugin.getUniqueIdentifier(),
448
				throw new CoreException(new Status(IStatus.ERROR, LMLMonitorCorePlugin.getUniqueIdentifier(),
385
						Messages.LMLResourceManagerMonitor_unableToOpenConnection));
449
						Messages.LMLResourceManagerMonitor_unableToOpenConnection));
386
			}
450
			}
387
			synchronized (this) {
451
		}
388
				if (fMonitorJob == null) {
452
389
					fMonitorJob = new MonitorJob(Messages.LMLResourceManagerMonitor_LMLMonitorJob, conn);
453
		/*
390
				}
454
		 * Initialize LML classes
391
				fMonitorJob.schedule();
455
		 */
456
		fLMLManager.openLgui(getResourceManager().getUniqueName(), conn.getUsername(), getMonitorConfigurationRequestType(),
457
				layout, jobs, pattern);
458
459
		/*
460
		 * Start monitoring job
461
		 */
462
		synchronized (this) {
463
			if (fMonitorJob == null) {
464
				fMonitorJob = new MonitorJob(Messages.LMLResourceManagerMonitor_LMLMonitorJob, conn);
392
			}
465
			}
466
			fMonitorJob.schedule();
393
		}
467
		}
394
468
395
		/*
469
		/*
(-)a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/ILMLUIConstants.java (+1 lines)
Lines 32-35 Link Here
32
	public static final String VIEW_TABLE_2 = "joblistwait"; //$NON-NLS-1$
32
	public static final String VIEW_TABLE_2 = "joblistwait"; //$NON-NLS-1$
33
33
34
	public static final int INTERNAL_ERROR = 150;
34
	public static final int INTERNAL_ERROR = 150;
35
	public static final String COLUMN_STATUS = "status";//$NON-NLS-1$
35
}
36
}
(-)a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/providers/FilterDataRow.java (+300 lines)
Added Link Here
1
package org.eclipse.ptp.rm.lml.ui.providers;
2
3
import org.eclipse.swt.widgets.Button;
4
import org.eclipse.swt.widgets.Combo;
5
import org.eclipse.swt.widgets.Text;
6
7
/**
8
 * This class contains all the information about a row in the FilterDialog.
9
 * 
10
 * For every active column (with exception) in a table one object of this class
11
 * should be generated.
12
 */
13
public class FilterDataRow {
14
15
	// Type of the data displayed in the column
16
	private String type;
17
18
	// To activate the filter function for this row
19
	private final Button checkbox;
20
21
	// To active a relation; only for the types numeric and date
22
	private Button radioButoonRelation;
23
24
	// To active a range; only for the types numeric and date
25
	private Button radioButtonRange;
26
27
	// The value for comparison, only for type alpha
28
	private Text valueAlpha;
29
30
	// The operator how to compare a value of the input with an given value; only for the type numeric and date
31
	private Combo relationComboNumericDate;
32
33
	// The value for comparison; only for the type numeric
34
	private Text valueNumeric;
35
36
	// The value for comparison; only for the type date
37
	private Button valueDate;
38
39
	// The minimal value in a range; only for the type numeric
40
	private Text minValueNumeric;
41
42
	// The maximal value in a range; only for the type numeric
43
	private Text maxValueNumeric;
44
45
	// The minimal value in a range; only for the type date
46
	private Button minValueDate;
47
48
	// The maximal value in a range; only for the type date
49
	private Button maxValueDate;
50
51
	// The value for comparison; only for the type alpha
52
	private Combo relationComboAlpha;
53
54
	/**
55
	 * Constructor.
56
	 * 
57
	 * @param type
58
	 * @param checkbox
59
	 */
60
	public FilterDataRow(String type, Button checkbox) {
61
		this.type = type;
62
		this.checkbox = checkbox;
63
		if (type == null) {
64
			this.type = "alpha";
65
		}
66
	}
67
68
	/**
69
	 * Adding a input button for the maximal value (date).
70
	 * 
71
	 * @param value
72
	 */
73
	public void addMaxValueDate(Button value) {
74
		maxValueDate = value;
75
	}
76
77
	/**
78
	 * Adding a input text for the maximal value (numeric).
79
	 * 
80
	 * @param value
81
	 */
82
	public void addMaxValueNumeric(Text value) {
83
		maxValueNumeric = value;
84
	}
85
86
	/**
87
	 * Adding a input button for the minimal value (date).
88
	 * 
89
	 * @param value
90
	 */
91
	public void addMinValueDate(Button value) {
92
		minValueDate = value;
93
	}
94
95
	/**
96
	 * Adding a input text for the minimal value (numeric).
97
	 * 
98
	 * @param value
99
	 */
100
	public void addMinValueNumeric(Text value) {
101
		minValueNumeric = value;
102
	}
103
104
	/**
105
	 * Adding a radio button for range.
106
	 * 
107
	 * @param button
108
	 */
109
	public void addRadioRange(Button button) {
110
		radioButtonRange = button;
111
	}
112
113
	/**
114
	 * Adding a radio button for relation.
115
	 * 
116
	 * @param button
117
	 */
118
	public void addRadioRelation(Button button) {
119
		radioButoonRelation = button;
120
	}
121
122
	/**
123
	 * Adding a combo box which includes all possible relation operators for alpha.
124
	 * 
125
	 * @param relation
126
	 */
127
	public void addRelationComboAlpha(Combo relation) {
128
		relationComboAlpha = relation;
129
	}
130
131
	/**
132
	 * Adding a combo box which includes all possible relation operators for numeric and date.
133
	 * 
134
	 * @param relation
135
	 */
136
	public void addRelationComboNumericDate(Combo relation) {
137
		relationComboNumericDate = relation;
138
	}
139
140
	/**
141
	 * Adding a input text for the comparison value (alpha).
142
	 * 
143
	 * @param value
144
	 */
145
	public void addRelationValueAlpha(Text value) {
146
		valueAlpha = value;
147
	}
148
149
	/**
150
	 * Adding a input button for the comparison value (date).
151
	 * 
152
	 * @param value
153
	 */
154
	public void addRelationValueDate(Button value) {
155
		valueDate = value;
156
	}
157
158
	/**
159
	 * Adding a input text for comparison value (numeric).
160
	 * 
161
	 * @param value
162
	 */
163
	public void addRelationValueNumeric(Text value) {
164
		valueNumeric = value;
165
	}
166
167
	public Button getCheckbox() {
168
		return checkbox;
169
	}
170
171
	/**
172
	 * Getting the button with the maximal value (date).
173
	 * 
174
	 * @return button
175
	 */
176
	public Button getMaxValueButtonDate() {
177
		return maxValueDate;
178
	}
179
180
	/**
181
	 * Getting the text with the maximal value (numeric).
182
	 * 
183
	 * @return text
184
	 */
185
	public Text getMaxValueTextNumeric() {
186
		return maxValueNumeric;
187
	}
188
189
	/**
190
	 * Getting the button with the minimal value (date).
191
	 * 
192
	 * @return button
193
	 */
194
	public Button getMinValueButtonDate() {
195
		return minValueDate;
196
	}
197
198
	/**
199
	 * Getting the text with the minimal value (numeric).
200
	 * 
201
	 * @return text
202
	 */
203
	public Text getMinValueTextNumeric() {
204
		return minValueNumeric;
205
	}
206
207
	/**
208
	 * Getting the button for range.
209
	 * 
210
	 * @return button for range
211
	 */
212
	public Button getRadioButtonRange() {
213
		return radioButtonRange;
214
	}
215
216
	/**
217
	 * Getting the button for relation.
218
	 * 
219
	 * @return button for relation.
220
	 */
221
	public Button getRadioButtonRelation() {
222
		return radioButoonRelation;
223
	}
224
225
	/**
226
	 * Getting the combo box including all comparison operators (alpha).
227
	 * 
228
	 * @return combo box
229
	 */
230
	public Combo getRelationComboAlpha() {
231
		return relationComboAlpha;
232
	}
233
234
	/**
235
	 * Getting the combo box including all comparison operators (numeric and date).
236
	 * 
237
	 * @return combo box
238
	 */
239
	public Combo getRelationComboNumericDate() {
240
		return relationComboNumericDate;
241
	}
242
243
	/**
244
	 * Getting the button with the comparison value (date).
245
	 * 
246
	 * @return button
247
	 */
248
	public Button getRelationValueButtonDate() {
249
		return valueDate;
250
	}
251
252
	/**
253
	 * Getting the text with the comparison value (alpha).
254
	 * 
255
	 * @return text
256
	 */
257
	public Text getRelationValueTextAlpha() {
258
		return valueAlpha;
259
	}
260
261
	/**
262
	 * Getting the text with the comparison value (numeric).
263
	 * 
264
	 * @return
265
	 */
266
	public Text getRelationValueTextNumeric() {
267
		return valueNumeric;
268
	}
269
270
	/**
271
	 * Getting the title of the row
272
	 * 
273
	 * @return title
274
	 */
275
	public String getTitle() {
276
		return checkbox.getText();
277
	}
278
279
	/**
280
	 * Getting the sort type of the row.
281
	 * 
282
	 * @return type
283
	 */
284
	public String getType() {
285
		return type;
286
	}
287
288
	/**
289
	 * Checks if the checkbox is set.
290
	 * 
291
	 * @return
292
	 */
293
	public boolean isCheckboxSet() {
294
		return checkbox.getSelection();
295
	}
296
297
	public void setCheckbox(boolean value) {
298
		checkbox.setSelection(value);
299
	}
300
}
(-)a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/providers/FilterDialog.java (+613 lines)
Added Link Here
1
package org.eclipse.ptp.rm.lml.ui.providers;
2
3
import java.text.DecimalFormat;
4
import java.text.NumberFormat;
5
import java.util.LinkedList;
6
import java.util.List;
7
8
import org.eclipse.core.runtime.IStatus;
9
import org.eclipse.core.runtime.Status;
10
import org.eclipse.jface.dialogs.Dialog;
11
import org.eclipse.jface.dialogs.ErrorDialog;
12
import org.eclipse.jface.dialogs.IDialogConstants;
13
import org.eclipse.jface.layout.GridDataFactory;
14
import org.eclipse.ptp.rm.lml.core.LMLManager;
15
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
16
import org.eclipse.ptp.rm.lml.core.model.IPattern;
17
import org.eclipse.ptp.rm.lml.core.model.ITableColumnLayout;
18
import org.eclipse.ptp.rm.lml.internal.core.model.Pattern;
19
import org.eclipse.ptp.rm.lml.ui.ILMLUIConstants;
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.custom.ScrolledComposite;
22
import org.eclipse.swt.events.SelectionAdapter;
23
import org.eclipse.swt.events.SelectionEvent;
24
import org.eclipse.swt.events.SelectionListener;
25
import org.eclipse.swt.events.VerifyEvent;
26
import org.eclipse.swt.events.VerifyListener;
27
import org.eclipse.swt.layout.GridData;
28
import org.eclipse.swt.layout.GridLayout;
29
import org.eclipse.swt.widgets.Button;
30
import org.eclipse.swt.widgets.Combo;
31
import org.eclipse.swt.widgets.Composite;
32
import org.eclipse.swt.widgets.Control;
33
import org.eclipse.swt.widgets.DateTime;
34
import org.eclipse.swt.widgets.Label;
35
import org.eclipse.swt.widgets.Shell;
36
import org.eclipse.swt.widgets.Text;
37
38
public class FilterDialog extends Dialog {
39
40
	public class SelectDateAdpater extends SelectionAdapter {
41
42
		private final Button button;
43
44
		private String date;
45
46
		private Button comparisonButton = null;
47
48
		public SelectDateAdpater(Button button) {
49
			super();
50
			this.button = button;
51
			if (button.getText() == null) {
52
				date = new String();
53
			} else {
54
				date = button.getText();
55
			}
56
		}
57
58
		public SelectDateAdpater(Button button, Button comparisonButton) {
59
			super();
60
			this.button = button;
61
			this.comparisonButton = comparisonButton;
62
			date = comparisonButton.getText();
63
		}
64
65
		@Override
66
		public void widgetSelected(SelectionEvent e) {
67
			final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
68
			dialog.setLayout(new GridLayout(5, false));
69
70
			if (button.getText().length() == 0 && comparisonButton != null && comparisonButton.getText().length() > 0) {
71
				date = comparisonButton.getText();
72
			}
73
74
			final DateTime calendar = new DateTime(dialog, SWT.CALENDAR | SWT.BORDER);
75
			final DateTime time = new DateTime(dialog, SWT.TIME);
76
77
			calendar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1));
78
			time.setLayoutData(new GridData());
79
80
			final Button ok = new Button(dialog, SWT.PUSH);
81
			ok.setText("OK");
82
			ok.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
83
			ok.addSelectionListener(new SelectionAdapter() {
84
				@Override
85
				public void widgetSelected(SelectionEvent e) {
86
					final NumberFormat formatter = new DecimalFormat("00");
87
					button.setText(calendar.getYear() + "-" + formatter.format(calendar.getMonth() + 1) + "-"
88
							+ formatter.format(calendar.getDay()) + " " + formatter.format(time.getHours()) + ":"
89
							+ formatter.format(time.getMinutes()) + ":" + formatter.format(time.getSeconds()));
90
					date = button.getText();
91
					dialog.close();
92
				}
93
			});
94
95
			final Button delete = new Button(dialog, SWT.PUSH);
96
			delete.setText("Delete");
97
			delete.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
98
			delete.addSelectionListener(new SelectionAdapter() {
99
				@Override
100
				public void widgetSelected(SelectionEvent e) {
101
					button.setText("");
102
					date = new String();
103
					dialog.close();
104
				}
105
			});
106
107
			final Button cancel = new Button(dialog, SWT.PUSH);
108
			cancel.setText("Cancel");
109
			cancel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
110
			cancel.addSelectionListener(new SelectionAdapter() {
111
				@Override
112
				public void widgetSelected(SelectionEvent e) {
113
					dialog.close();
114
				}
115
			});
116
117
			if (!date.isEmpty()) {
118
				calendar.setDate(Integer.valueOf(date.substring(0, 4)), Integer.valueOf(date.substring(5, 7)) - 1,
119
						Integer.valueOf(date.substring(8, 10)));
120
				time.setTime(Integer.valueOf(date.substring(11, 13)), Integer.valueOf(date.substring(14, 16)),
121
						Integer.valueOf(date.substring(17)));
122
			}
123
124
			dialog.setDefaultButton(ok);
125
			dialog.pack();
126
			dialog.open();
127
		}
128
129
	}
130
131
	private FilterDataRow[] filterData;
132
133
	private final ILguiItem lguiItem;
134
	private final String gid;
135
136
	private final Shell shell;
137
138
	private final List<IPattern> filterOld;
139
140
	public FilterDialog(Shell parentShell, String gid) {
141
		super(parentShell);
142
		lguiItem = LMLManager.getInstance().getSelectedLguiItem();
143
		this.gid = gid;
144
		filterOld = lguiItem.getPattern(gid);
145
		setShellStyle(SWT.RESIZE | SWT.APPLICATION_MODAL);
146
		this.shell = parentShell;
147
	}
148
149
	private boolean includeStatus(ITableColumnLayout[] columnLayouts) {
150
		for (final ITableColumnLayout columnLayout : columnLayouts) {
151
			if (columnLayout.getTitle().equals(ILMLUIConstants.COLUMN_STATUS)) {
152
				return true;
153
			}
154
		}
155
		return false;
156
	}
157
158
	@Override
159
	protected void buttonPressed(int buttonId) {
160
161
		if (buttonId == IDialogConstants.CANCEL_ID) {
162
			// Cancel Button
163
			LMLManager.getInstance().filterLgui(gid, filterOld);
164
			lguiItem.setPattern(gid, filterOld);
165
			close();
166
			return;
167
		}
168
169
		boolean error = false;
170
		for (final FilterDataRow row : filterData) {
171
172
			if (!row.isCheckboxSet()) {
173
				continue;
174
			}
175
			if (row.getType().equals("alpha")) {
176
				if (row.getRelationValueTextAlpha().getText().equals("")) {
177
					error = true;
178
					break;
179
				}
180
			} else {
181
				if (row.getRadioButtonRelation().getSelection()) {
182
					if (row.getType().equals("numeric")) {
183
						if (row.getRelationValueTextNumeric().getText().equals("")) {
184
							error = true;
185
							break;
186
						}
187
					} else if (row.getType().equals("date")) {
188
						if (row.getRelationValueButtonDate().getText().equals("")) {
189
							error = true;
190
							break;
191
						}
192
					}
193
				} else if (row.getRadioButtonRange().getSelection()) {
194
					if (row.getType().equals("numeric")) {
195
						if (row.getMinValueTextNumeric().getText().equals("")
196
								|| row.getMaxValueTextNumeric().equals("")
197
								|| (Integer.parseInt(row.getMinValueTextNumeric().getText()) >= Integer.parseInt(row
198
										.getMaxValueTextNumeric().getText()))) {
199
							error = true;
200
							break;
201
						}
202
					} else if (row.getType().equals("date")) {
203
						if (row.getMinValueButtonDate().getText().equals("") || row.getMaxValueButtonDate().equals("")
204
								|| (row.getMinValueButtonDate().getText().compareTo(row.getMaxValueButtonDate().getText()) >= 0)) {
205
							error = true;
206
							break;
207
						}
208
					}
209
				}
210
			}
211
		}
212
213
		if (error) {
214
			final Status status = new Status(
215
					IStatus.ERROR,
216
					"Missing/wrong arguments",
217
					0,
218
					"- there is/are one/more requested value(s) missing\n- or the minimal value of a range is bigger than the maximal value.",
219
					null);
220
			final ErrorDialog dialog = new ErrorDialog(
221
					shell,
222
					"Missing/wrong arguments",
223
					"An error occured!",
224
					status, IStatus.ERROR);
225
			dialog.open();
226
			return;
227
		}
228
229
		final List<IPattern> filterValues = new LinkedList<IPattern>();
230
		// Apply and Okay Button
231
		for (final FilterDataRow row : filterData) {
232
			boolean complete = false;
233
			if (!row.isCheckboxSet()) {
234
				continue;
235
			}
236
			final IPattern pattern = new Pattern(row.getTitle(), row.getType());
237
			if (row.getType().equals("alpha")) {
238
				pattern.setRelation(row.getRelationComboAlpha().getText(), row.getRelationValueTextAlpha().getText());
239
				complete = true;
240
			} else {
241
				if (row.getRadioButtonRelation().getSelection()) {
242
					if (row.getType().equals("numeric")) {
243
						pattern.setRelation(row.getRelationComboNumericDate().getText(), row.getRelationValueTextNumeric()
244
								.getText());
245
						complete = true;
246
					} else if (row.getType().equals("date")) {
247
						pattern.setRelation(row.getRelationComboNumericDate().getText(), row.getRelationValueButtonDate().getText());
248
						complete = true;
249
					}
250
				} else if (row.getRadioButtonRange().getSelection()) {
251
					if (row.getType().equals("numeric")) {
252
						pattern.setRange(row.getMinValueTextNumeric().getText(), row.getMaxValueTextNumeric().getText());
253
						complete = true;
254
					} else if (row.getType().equals("date")) {
255
						pattern.setRange(row.getMinValueButtonDate().getText(), row.getMaxValueButtonDate().getText());
256
						complete = true;
257
					}
258
				}
259
			}
260
			if (complete) {
261
				filterValues.add(pattern);
262
			}
263
		}
264
265
		lguiItem.setPattern(gid, filterValues);
266
		LMLManager.getInstance().filterLgui(gid, filterValues);
267
268
		if (buttonId == IDialogConstants.OK_ID) {
269
			// Okay Button
270
			close();
271
		}
272
273
	}
274
275
	@Override
276
	protected void configureShell(Shell shell) {
277
		super.configureShell(shell);
278
		shell.setText("Filters");
279
280
	}
281
282
	@Override
283
	protected void createButtonsForButtonBar(Composite parent) {
284
		createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
285
		createButton(parent, 5, "Apply", false);
286
		createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
287
	}
288
289
	@Override
290
	protected Control createDialogArea(Composite parent) {
291
292
		final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
293
		GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, SWT.DEFAULT).grab(true, true)
294
				.applyTo(scrolledComposite);
295
		final Composite composite = new Composite(scrolledComposite, SWT.NONE);
296
		boolean error = false;
297
		if (lguiItem == null || lguiItem.getTableHandler() == null) {
298
			error = true;
299
		}
300
		ITableColumnLayout[] columnLayouts = new ITableColumnLayout[0];
301
		if (!error) {
302
			columnLayouts = lguiItem.getTableHandler().getActiveTableColumnLayout(gid);
303
		}
304
		if (columnLayouts.length == 0) {
305
			error = true;
306
		}
307
		if (error) {
308
			final Label errorLabel = new Label(composite, SWT.NONE);
309
			errorLabel.setText("An error occured!");
310
			filterData = new FilterDataRow[0];
311
			return composite;
312
		}
313
314
		int length = columnLayouts.length;
315
		if (gid.equals(ILMLUIConstants.VIEW_TABLE_1)
316
				&& includeStatus(columnLayouts)) {
317
			length = length - 1;
318
		}
319
320
		filterData = new FilterDataRow[length];
321
322
		final VerifyListener numericListener = new VerifyListener() {
323
324
			public void verifyText(VerifyEvent e) {
325
				final String s = ((Text) e.widget).getText() + e.text;
326
				e.doit = s.matches("0|([1-9][0-9]*)");
327
			}
328
		};
329
330
		final VerifyListener alphaListener = new VerifyListener() {
331
332
			public void verifyText(VerifyEvent e) {
333
				final String s = ((Text) e.widget).getText() + e.text;
334
				e.doit = s.matches(".+");
335
			}
336
		};
337
338
		composite.setLayout(new GridLayout(2, false));
339
340
		int dif = 0;
341
		for (int i = 0; i < columnLayouts.length; i++) {
342
			if (gid.equals(ILMLUIConstants.VIEW_TABLE_1) && columnLayouts[i].getTitle().equals(ILMLUIConstants.COLUMN_STATUS)) {
343
				dif = 1;
344
				continue;
345
			}
346
347
			final String type = columnLayouts[i].getOrder();
348
349
			final Button checkbox = new Button(composite, SWT.CHECK);
350
351
			checkbox.setText(columnLayouts[i].getTitle());
352
			checkbox.setLayoutData(new GridData());
353
354
			final FilterDataRow row = new FilterDataRow(type, checkbox);
355
356
			if (type == "alpha") {
357
				// Input in text elements with choosing a relation operator before
358
				final Composite compositeText = new Composite(composite, SWT.NONE);
359
				compositeText.setLayout(new GridLayout(2, false));
360
				final Combo relationCombo = new Combo(compositeText, SWT.READ_ONLY);
361
				relationCombo.setItems(new String[] { "=", "!=", "=~", "!~" });
362
				relationCombo.select(0);
363
				relationCombo.setLayoutData(new GridData());
364
				relationCombo.setEnabled(false);
365
				row.addRelationComboAlpha(relationCombo);
366
367
				final Text relationValue = new Text(compositeText, SWT.LEAD | SWT.SINGLE);
368
				relationValue.setEnabled(false);
369
				relationValue.addVerifyListener(alphaListener);
370
				relationValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
371
				row.addRelationValueAlpha(relationValue);
372
373
				compositeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
374
			} else {
375
				// Choose between 2 different kinds of input
376
				final Composite compositeRadio = new Composite(composite, SWT.NONE);
377
				compositeRadio.setLayout(new GridLayout(2, false));
378
				// 1. A relation to one number
379
				final Button radioButtonRelation = new Button(compositeRadio, SWT.RADIO);
380
				radioButtonRelation.setLayoutData(new GridData());
381
				radioButtonRelation.setSelection(true);
382
				radioButtonRelation.setEnabled(false);
383
384
				row.addRadioRelation(radioButtonRelation);
385
386
				final Composite compositeRelation = new Composite(compositeRadio, SWT.NONE);
387
				compositeRelation.setLayout(new GridLayout(2, false));
388
				final Combo relations = new Combo(compositeRelation, SWT.READ_ONLY);
389
				relations.setItems(new String[] { "=", "<", "<=", ">", ">=",
390
						"!=" });
391
				relations.select(0);
392
393
				relations.setEnabled(false);
394
				relations.setLayoutData(new GridData(GridData.FILL));
395
				row.addRelationComboNumericDate(relations);
396
397
				if (type == "numeric") {
398
					final Text relationValueText = new Text(compositeRelation, SWT.SINGLE | SWT.TRAIL);
399
					relationValueText.addVerifyListener(numericListener);
400
					relationValueText.setEnabled(false);
401
					relationValueText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
402
					row.addRelationValueNumeric(relationValueText);
403
				} else {
404
					final Button relationValueButton = new Button(compositeRelation, SWT.NONE);
405
					relationValueButton.setEnabled(false);
406
					relationValueButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
407
					relationValueButton.addSelectionListener(new SelectDateAdpater(relationValueButton));
408
					row.addRelationValueDate(relationValueButton);
409
				}
410
411
				radioButtonRelation.addSelectionListener(new SelectionListener() {
412
413
					public void widgetDefaultSelected(SelectionEvent e) {
414
					}
415
416
					public void widgetSelected(SelectionEvent e) {
417
						final boolean selected = radioButtonRelation.getSelection();
418
						if (row.getRelationComboNumericDate() != null) {
419
							row.getRelationComboNumericDate().setEnabled(selected);
420
						}
421
						if (row.getRelationValueTextNumeric() != null) {
422
							row.getRelationValueTextNumeric().setEnabled(selected);
423
						}
424
						if (row.getRelationValueButtonDate() != null) {
425
							row.getRelationValueButtonDate().setEnabled(selected);
426
						}
427
					}
428
				});
429
430
				compositeRelation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
431
432
				// 2. A range between two numbers
433
				final Button radioButtonRange = new Button(compositeRadio, SWT.RADIO);
434
				radioButtonRange.setEnabled(false);
435
				radioButtonRange.setLayoutData(new GridData());
436
437
				row.addRadioRange(radioButtonRange);
438
439
				final Composite compositeRange = new Composite(compositeRadio, SWT.NONE);
440
				compositeRange.setLayout(new GridLayout(3, false));
441
				if (type == "numeric") {
442
					final Text textValueMin = new Text(compositeRange, SWT.SINGLE | SWT.TRAIL);
443
					textValueMin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
444
					textValueMin.setEnabled(false);
445
					textValueMin.addVerifyListener(numericListener);
446
447
					// TODO replace with another combo box
448
					final Label labelMinus = new Label(compositeRange, SWT.NONE);
449
					labelMinus.setText(" - ");
450
					labelMinus.setLayoutData(new GridData(GridData.FILL));
451
452
					final Text textValueMax = new Text(compositeRange, SWT.SINGLE | SWT.TRAIL);
453
					textValueMax.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
454
					textValueMax.setEnabled(false);
455
					textValueMax.addVerifyListener(numericListener);
456
457
					row.addMinValueNumeric(textValueMin);
458
					row.addMaxValueNumeric(textValueMax);
459
				} else {
460
					final Button buttonValueMin = new Button(compositeRange, SWT.NONE);
461
					buttonValueMin.setEnabled(false);
462
					buttonValueMin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
463
464
					final Label labelMinus = new Label(compositeRange, SWT.NONE);
465
					labelMinus.setText(" - ");
466
					labelMinus.setLayoutData(new GridData(GridData.FILL));
467
468
					final Button buttonValueMax = new Button(compositeRange, SWT.NONE);
469
					buttonValueMax.setEnabled(false);
470
					buttonValueMax.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
471
472
					buttonValueMin.addSelectionListener(new SelectDateAdpater(buttonValueMin, buttonValueMax));
473
					buttonValueMax.addSelectionListener(new SelectDateAdpater(buttonValueMax, buttonValueMin));
474
475
					row.addMinValueDate(buttonValueMin);
476
					row.addMaxValueDate(buttonValueMax);
477
				}
478
479
				radioButtonRange.addSelectionListener(new SelectionListener() {
480
481
					public void widgetDefaultSelected(SelectionEvent e) {
482
					}
483
484
					public void widgetSelected(SelectionEvent e) {
485
						final boolean selected = radioButtonRange.getSelection();
486
						if (row.getMinValueTextNumeric() != null
487
								&& row.getMaxValueTextNumeric() != null) {
488
							row.getMinValueTextNumeric().setEnabled(selected);
489
							row.getMaxValueTextNumeric().setEnabled(selected);
490
						}
491
						if (row.getMinValueButtonDate() != null
492
								&& row.getMaxValueButtonDate() != null) {
493
							row.getMinValueButtonDate().setEnabled(selected);
494
							row.getMaxValueButtonDate().setEnabled(selected);
495
						}
496
					}
497
				});
498
499
				compositeRange.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
500
501
				compositeRadio.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
502
			}
503
504
			checkbox.addSelectionListener(new SelectionListener() {
505
506
				public void widgetDefaultSelected(SelectionEvent e) {
507
				}
508
509
				public void widgetSelected(SelectionEvent e) {
510
					final boolean selected = checkbox.getSelection();
511
					if (row.getRelationValueTextAlpha() != null) {
512
						row.getRelationValueTextAlpha().setEnabled(selected);
513
					}
514
					if (row.getRelationComboAlpha() != null) {
515
						row.getRelationComboAlpha().setEnabled(selected);
516
					}
517
					if (row.getRadioButtonRelation() != null && row.getRadioButtonRange() != null) {
518
						row.getRadioButtonRelation().setEnabled(selected);
519
						row.getRadioButtonRange().setEnabled(checkbox.getSelection());
520
						if (row.getRadioButtonRelation().getSelection()) {
521
							if (row.getRelationComboNumericDate() != null) {
522
								row.getRelationComboNumericDate().setEnabled(selected);
523
							}
524
							if (row.getRelationValueTextNumeric() != null) {
525
								row.getRelationValueTextNumeric().setEnabled(selected);
526
							}
527
							if (row.getRelationValueButtonDate() != null) {
528
								row.getRelationValueButtonDate().setEnabled(
529
										selected);
530
							}
531
						} else {
532
							if (row.getMinValueTextNumeric() != null && row.getMaxValueTextNumeric() != null) {
533
								row.getMinValueTextNumeric().setEnabled(selected);
534
								row.getMaxValueTextNumeric().setEnabled(selected);
535
							}
536
							if (row.getMinValueButtonDate() != null && row.getMaxValueButtonDate() != null) {
537
								row.getMinValueButtonDate().setEnabled(selected);
538
								row.getMaxValueButtonDate().setEnabled(selected);
539
							}
540
						}
541
					}
542
				}
543
			});
544
545
			final List<IPattern> oldFilters = lguiItem.getPattern(gid);
546
			if (oldFilters.size() > 0) {
547
				for (final IPattern filter : oldFilters) {
548
					if (!filter.getColumnTitle().equals(row.getTitle())) {
549
						continue;
550
					}
551
					row.getCheckbox().setSelection(true);
552
					if (filter.getType().equals("alpha")) {
553
						row.getRelationValueTextAlpha().setText(filter.getRelationValue());
554
						row.getRelationValueTextAlpha().setEnabled(true);
555
						final String[] items = row.getRelationComboAlpha().getItems();
556
						row.getRelationComboAlpha().setEnabled(true);
557
						for (int j = 0; j < items.length; j++) {
558
							if (filter.getRelationOperator().equals(items[j])) {
559
								row.getRelationComboAlpha().select(j);
560
							}
561
						}
562
					} else {
563
						row.getRadioButtonRange().setEnabled(true);
564
						row.getRadioButtonRelation().setEnabled(true);
565
						if (filter.isRange()) {
566
							row.getRadioButtonRange().setSelection(true);
567
							row.getRadioButtonRelation().setSelection(false);
568
							if (filter.getType().equals("numeric")) {
569
								row.getMinValueTextNumeric().setText(filter.getMinValueRange());
570
								row.getMaxValueTextNumeric().setText(filter.getMaxValueRange());
571
								row.getMinValueTextNumeric().setEnabled(true);
572
								row.getMaxValueTextNumeric().setEnabled(true);
573
							} else {
574
								row.getMinValueButtonDate().setText(filter.getMinValueRange());
575
								row.getMaxValueButtonDate().setText(filter.getMaxValueRange());
576
								row.getMinValueButtonDate().setEnabled(true);
577
								row.getMaxValueButtonDate().setEnabled(true);
578
							}
579
						} else if (filter.isRelation()) {
580
							row.getRadioButtonRelation().setSelection(true);
581
							row.getRelationComboNumericDate().setEnabled(true);
582
							final String[] items = row.getRelationComboNumericDate().getItems();
583
							for (int j = 0; j < items.length; j++) {
584
								if (filter.getRelationOperator().equals(items[j])) {
585
									row.getRelationComboNumericDate().select(j);
586
								}
587
							}
588
							if (filter.getType().equals("numeric")) {
589
								row.getRelationValueTextNumeric().setText(filter.getRelationValue());
590
								row.getRelationValueTextNumeric().setEnabled(true);
591
							} else {
592
								row.getRelationValueButtonDate().setText(filter.getRelationValue());
593
								row.getRelationValueButtonDate().setEnabled(true);
594
							}
595
						}
596
					}
597
				}
598
			}
599
600
			filterData[i - dif] = row;
601
		}
602
603
		scrolledComposite.setContent(composite);
604
605
		scrolledComposite.setExpandHorizontal(true);
606
		scrolledComposite.setExpandVertical(true);
607
608
		scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
609
		scrolledComposite.setSize(100, 400);
610
611
		return scrolledComposite;
612
	}
613
}
(-)a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/views/NodesView.java (+6 lines)
Lines 18-23 Link Here
18
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
18
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
19
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
19
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
20
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
20
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
21
import org.eclipse.ptp.rm.lml.core.events.ITableFilterEvent;
21
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
22
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
22
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
23
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
23
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
24
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
Lines 80-85 Link Here
80
			}
81
			}
81
		}
82
		}
82
83
84
		public void handleEvent(ITableFilterEvent event) {
85
			// TODO Auto-generated method stub
86
87
		}
88
83
		public void handleEvent(ITableSortedEvent e) {
89
		public void handleEvent(ITableSortedEvent e) {
84
		}
90
		}
85
91
(-)a/rms/org.eclipse.ptp.rm.lml.ui/src/org/eclipse/ptp/rm/lml/ui/views/TableView.java (-10 / +146 lines)
Lines 12-23 Link Here
12
package org.eclipse.ptp.rm.lml.ui.views;
12
package org.eclipse.ptp.rm.lml.ui.views;
13
13
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.LinkedList;
15
import java.util.List;
16
import java.util.List;
16
17
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.core.runtime.Status;
21
import org.eclipse.jface.action.Action;
22
import org.eclipse.jface.action.ActionContributionItem;
23
import org.eclipse.jface.action.IAction;
24
import org.eclipse.jface.action.IMenuManager;
20
import org.eclipse.jface.action.MenuManager;
25
import org.eclipse.jface.action.MenuManager;
26
import org.eclipse.jface.action.Separator;
21
import org.eclipse.jface.layout.TreeColumnLayout;
27
import org.eclipse.jface.layout.TreeColumnLayout;
22
import org.eclipse.jface.util.SafeRunnable;
28
import org.eclipse.jface.util.SafeRunnable;
23
import org.eclipse.jface.viewers.CellLabelProvider;
29
import org.eclipse.jface.viewers.CellLabelProvider;
Lines 35-53 Link Here
35
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
41
import org.eclipse.ptp.rm.lml.core.events.ILguiRemovedEvent;
36
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
42
import org.eclipse.ptp.rm.lml.core.events.IMarkObjectEvent;
37
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
43
import org.eclipse.ptp.rm.lml.core.events.ISelectObjectEvent;
44
import org.eclipse.ptp.rm.lml.core.events.ITableFilterEvent;
38
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
45
import org.eclipse.ptp.rm.lml.core.events.ITableSortedEvent;
39
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
46
import org.eclipse.ptp.rm.lml.core.events.IUnmarkObjectEvent;
40
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
47
import org.eclipse.ptp.rm.lml.core.events.IUnselectedObjectEvent;
41
import org.eclipse.ptp.rm.lml.core.events.IViewUpdateEvent;
48
import org.eclipse.ptp.rm.lml.core.events.IViewUpdateEvent;
42
import org.eclipse.ptp.rm.lml.core.listeners.ILMLListener;
49
import org.eclipse.ptp.rm.lml.core.listeners.ILMLListener;
43
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
50
import org.eclipse.ptp.rm.lml.core.model.ILguiItem;
51
import org.eclipse.ptp.rm.lml.core.model.IPattern;
44
import org.eclipse.ptp.rm.lml.core.model.ITableColumnLayout;
52
import org.eclipse.ptp.rm.lml.core.model.ITableColumnLayout;
45
import org.eclipse.ptp.rm.lml.internal.core.model.Cell;
53
import org.eclipse.ptp.rm.lml.internal.core.model.Cell;
46
import org.eclipse.ptp.rm.lml.internal.core.model.LMLColor;
54
import org.eclipse.ptp.rm.lml.internal.core.model.LMLColor;
55
import org.eclipse.ptp.rm.lml.internal.core.model.Pattern;
47
import org.eclipse.ptp.rm.lml.internal.core.model.Row;
56
import org.eclipse.ptp.rm.lml.internal.core.model.Row;
48
import org.eclipse.ptp.rm.lml.ui.UIUtils;
57
import org.eclipse.ptp.rm.lml.ui.UIUtils;
49
import org.eclipse.ptp.rm.lml.ui.messages.Messages;
58
import org.eclipse.ptp.rm.lml.ui.messages.Messages;
50
import org.eclipse.ptp.rm.lml.ui.providers.EventForwarder;
59
import org.eclipse.ptp.rm.lml.ui.providers.EventForwarder;
60
import org.eclipse.ptp.rm.lml.ui.providers.FilterDialog;
51
import org.eclipse.swt.SWT;
61
import org.eclipse.swt.SWT;
52
import org.eclipse.swt.events.ControlAdapter;
62
import org.eclipse.swt.events.ControlAdapter;
53
import org.eclipse.swt.events.ControlEvent;
63
import org.eclipse.swt.events.ControlEvent;
Lines 67-72 Link Here
67
import org.eclipse.swt.widgets.Listener;
77
import org.eclipse.swt.widgets.Listener;
68
import org.eclipse.swt.widgets.Menu;
78
import org.eclipse.swt.widgets.Menu;
69
import org.eclipse.swt.widgets.MenuItem;
79
import org.eclipse.swt.widgets.MenuItem;
80
import org.eclipse.swt.widgets.Shell;
70
import org.eclipse.swt.widgets.Tree;
81
import org.eclipse.swt.widgets.Tree;
71
import org.eclipse.swt.widgets.TreeColumn;
82
import org.eclipse.swt.widgets.TreeColumn;
72
import org.eclipse.swt.widgets.TreeItem;
83
import org.eclipse.swt.widgets.TreeItem;
Lines 198-203 Link Here
198
209
199
		}
210
		}
200
211
212
		public void handleEvent(final ITableFilterEvent event) {
213
			if (event.getGid().equals(gid)) {
214
				UIUtils.safeRunSyncInUIThread(new SafeRunnable() {
215
					public void run() throws Exception {
216
						if (composite != null && fLguiItem != null && viewCreated) {
217
							if (componentAdded) {
218
								fLguiItem.getObjectStatus().removeComponent(eventForwarder);
219
								componentAdded = false;
220
							}
221
							saveColumnLayout();
222
							disposeTable();
223
							viewCreated = false;
224
						}
225
						if (composite != null && !viewCreated) {
226
							fLguiItem = lmlManager.getSelectedLguiItem();
227
							if (fLguiItem != null) {
228
								createTable();
229
								viewCreated = true;
230
								if (fLguiItem.getObjectStatus() != null) {
231
									fLguiItem.getObjectStatus().addComponent(eventForwarder);
232
									componentAdded = true;
233
								}
234
							}
235
						}
236
					}
237
				});
238
			}
239
		}
240
201
		/*
241
		/*
202
		 * (non-Javadoc)
242
		 * (non-Javadoc)
203
		 * 
243
		 * 
Lines 210-216 Link Here
210
							&& tree.getSortColumn() != null) {
250
							&& tree.getSortColumn() != null) {
211
						fLguiItem.getTableHandler().sort(gid, SWT.UP, getSortIndex(), tree.getSortDirection());
251
						fLguiItem.getTableHandler().sort(gid, SWT.UP, getSortIndex(), tree.getSortDirection());
212
					}
252
					}
213
					setViewerInput();
253
					if (fLguiItem.getPattern(gid).size() > 0) {
254
						setViewerInput(fLguiItem.getPattern(gid));
255
					} else {
256
						setViewerInput();
257
					}
214
				}
258
				}
215
			});
259
			});
216
260
Lines 276-282 Link Here
276
							fLguiItem.getTableHandler().getSortProperties(gid);
320
							fLguiItem.getTableHandler().getSortProperties(gid);
277
							fLguiItem.getTableHandler().sort(gid, SWT.UP, getSortIndex(), tree.getSortDirection());
321
							fLguiItem.getTableHandler().sort(gid, SWT.UP, getSortIndex(), tree.getSortDirection());
278
						}
322
						}
279
						setViewerInput();
323
						if (fLguiItem.getPattern(gid).size() > 0) {
324
							setViewerInput(fLguiItem.getPattern(gid));
325
						} else {
326
							setViewerInput();
327
						}
280
						if (fLguiItem != null && fLguiItem.getTableHandler() != null) {
328
						if (fLguiItem != null && fLguiItem.getTableHandler() != null) {
281
							fLguiItem.getObjectStatus().addComponent(eventForwarder);
329
							fLguiItem.getObjectStatus().addComponent(eventForwarder);
282
							componentAdded = true;
330
							componentAdded = true;
Lines 300-309 Link Here
300
	private String gid = null;
348
	private String gid = null;
301
	private final ILMLListener lmlListener = new LMLTableListListener();
349
	private final ILMLListener lmlListener = new LMLTableListListener();
302
	private final LMLManager lmlManager = LMLManager.getInstance();
350
	private final LMLManager lmlManager = LMLManager.getInstance();
351
	private IMenuManager viewMenuManager;
352
	private ActionContributionItem filterActionItem;
353
	private ActionContributionItem filterOwnJobsActionItem;
303
	private TreeItem selectedItem = null;
354
	private TreeItem selectedItem = null;
304
	private String selectedOid = null;
355
	private String selectedOid = null;
305
	private boolean componentAdded = false;
356
	private boolean componentAdded = false;
306
	private boolean viewCreated = false;
357
	private boolean viewCreated = false;
358
	private IViewSite viewSite = null;
307
359
308
	private boolean isMouseDown = false;
360
	private boolean isMouseDown = false;
309
	private final EventForwarder eventForwarder = new EventForwarder();
361
	private final EventForwarder eventForwarder = new EventForwarder();
Lines 383-389 Link Here
383
		 */
435
		 */
384
		fLguiItem = lmlManager.getSelectedLguiItem();
436
		fLguiItem = lmlManager.getSelectedLguiItem();
385
437
438
		// ViewMenuManager
439
		viewMenuManager = getViewSite().getActionBars().getMenuManager();
440
		final IAction filterOwnJobsAction = new Action("Show only my jobs", IAction.AS_CHECK_BOX) {
441
442
			@Override
443
			public void run() {
444
				final List<IPattern> filterValues = new LinkedList<IPattern>();
445
				if (isChecked()) {
446
					filterValues.add((new Pattern("owner", "alpha")).setRelation("=", fLguiItem.getUsername()));
447
				}
448
				// TODO After decision about new structure of LML and server side
449
				fLguiItem.setPattern(gid, filterValues);
450
				setViewerInput(filterValues);
451
			}
452
453
		};
454
		final IAction filterAction = new Action("Filters...") {
455
456
			@Override
457
			public void run() {
458
				final FilterDialog dialog = new FilterDialog(new Shell(
459
						viewSite.getShell()), gid);
460
				dialog.open();
461
			}
462
		};
463
464
		filterOwnJobsActionItem = new ActionContributionItem(filterOwnJobsAction);
465
		filterActionItem = new ActionContributionItem(filterAction);
466
		viewMenuManager.add(filterOwnJobsActionItem);
467
		viewMenuManager.add(new Separator());
468
		viewMenuManager.add(filterActionItem);
469
		filterOwnJobsActionItem.getAction().setEnabled(false);
470
		filterActionItem.getAction().setEnabled(false);
471
386
		createTable();
472
		createTable();
473
387
		tree.addDisposeListener(new DisposeListener() {
474
		tree.addDisposeListener(new DisposeListener() {
388
			public void widgetDisposed(DisposeEvent e) {
475
			public void widgetDisposed(DisposeEvent e) {
389
				if (fLguiItem != null) {
476
				if (fLguiItem != null) {
Lines 406-411 Link Here
406
			e.printStackTrace();
493
			e.printStackTrace();
407
		}
494
		}
408
		lmlManager.addListener(lmlListener, this.getClass().getName());
495
		lmlManager.addListener(lmlListener, this.getClass().getName());
496
		viewSite = site;
409
	}
497
	}
410
498
411
	/**
499
	/**
Lines 416-422 Link Here
416
			@Override
504
			@Override
417
			public IStatus runInUIThread(IProgressMonitor monitor) {
505
			public IStatus runInUIThread(IProgressMonitor monitor) {
418
				if (viewer != null) {
506
				if (viewer != null) {
419
					setViewerInput();
507
					if (fLguiItem.getPattern(gid).size() > 0) {
508
						setViewerInput(fLguiItem.getPattern(gid));
509
					} else {
510
						setViewerInput();
511
					}
420
					viewer.refresh();
512
					viewer.refresh();
421
				}
513
				}
422
				return Status.OK_STATUS;
514
				return Status.OK_STATUS;
Lines 440-451 Link Here
440
		}
532
		}
441
533
442
		final ITableColumnLayout[] tableColumnLayouts = fLguiItem.getTableHandler().getTableColumnLayout(gid);
534
		final ITableColumnLayout[] tableColumnLayouts = fLguiItem.getTableHandler().getTableColumnLayout(gid);
443
		if (tableColumnLayouts == null) {
535
		if (tableColumnLayouts.length == 0) {
444
			return;
536
			return;
445
		}
537
		}
446
538
447
		treeColumns = new TreeColumn[tableColumnLayouts.length];
539
		treeColumns = new TreeColumn[tableColumnLayouts.length];
448
		savedColumnWidths = new int[tableColumnLayouts.length + 1];
540
		savedColumnWidths = new int[tableColumnLayouts.length + 1];
541
542
		final String[] columnTitlesPattern = fLguiItem.getColumnTitlePattern(gid);
449
543
450
		// first column with color rectangle
544
		// first column with color rectangle
451
		TreeViewerColumn treeViewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
545
		TreeViewerColumn treeViewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
Lines 514-520 Link Here
514
			});
608
			});
515
			treeColumn = treeViewerColumn.getColumn();
609
			treeColumn = treeViewerColumn.getColumn();
516
			treeColumn.setMoveable(true);
610
			treeColumn.setMoveable(true);
517
			treeColumn.setText(tableColumnLayouts[i].getTitle());
611
			boolean isFiltered = false;
612
			for (final String title : columnTitlesPattern) {
613
				if (title.equals(tableColumnLayouts[i].getTitle())) {
614
					isFiltered = true;
615
				}
616
			}
617
			if (isFiltered) {
618
				treeColumn.setText(tableColumnLayouts[i].getTitle() + " #");
619
			} else {
620
				treeColumn.setText(tableColumnLayouts[i].getTitle());
621
			}
622
518
			treeColumn.setAlignment(getColumnAlignment(tableColumnLayouts[i].getStyle()));
623
			treeColumn.setAlignment(getColumnAlignment(tableColumnLayouts[i].getStyle()));
519
624
520
			if (tableColumnLayouts[i].isActive()) {
625
			if (tableColumnLayouts[i].isActive()) {
Lines 674-684 Link Here
674
					tree.setSortColumn(getSortColumn((Integer) sortProperties[0]));
779
					tree.setSortColumn(getSortColumn((Integer) sortProperties[0]));
675
					fLguiItem.getTableHandler().sort(gid, SWT.UP, getSortIndex(), tree.getSortDirection());
780
					fLguiItem.getTableHandler().sort(gid, SWT.UP, getSortIndex(), tree.getSortDirection());
676
				}
781
				}
677
			}
678
		}
679
782
680
		// Insert the input
783
				filterOwnJobsActionItem.getAction().setEnabled(true);
681
		setViewerInput();
784
				filterActionItem.getAction().setEnabled(true);
785
			}
786
787
			// Insert the input
788
			if (fLguiItem.getPattern(gid).size() > 0) {
789
				setViewerInput(fLguiItem.getPattern(gid));
790
			} else {
791
				setViewerInput();
792
			}
793
794
		}
682
		composite.layout();
795
		composite.layout();
683
	}
796
	}
684
797
Lines 691-696 Link Here
691
	private void disposeTable() {
804
	private void disposeTable() {
692
		tree.setSortColumn(null);
805
		tree.setSortColumn(null);
693
		tree.setSortDirection(0);
806
		tree.setSortDirection(0);
807
808
		filterOwnJobsActionItem.getAction().setEnabled(false);
809
		filterActionItem.getAction().setEnabled(false);
810
694
		/*
811
		/*
695
		 * Remove columns
812
		 * Remove columns
696
		 */
813
		 */
Lines 710-716 Link Here
710
		for (final MenuItem item : headerMenu.getItems()) {
827
		for (final MenuItem item : headerMenu.getItems()) {
711
			item.dispose();
828
			item.dispose();
712
		}
829
		}
713
		getViewSite().getActionBars().getMenuManager().removeAll();
714
	}
830
	}
715
831
716
	private int getColumnAlignment(String alignment) {
832
	private int getColumnAlignment(String alignment) {
Lines 861-864 Link Here
861
			}
977
			}
862
		}
978
		}
863
	}
979
	}
980
981
	/**
982
	 * 
983
	 */
984
	private void setViewerInput(List<IPattern> filterValues) {
985
		/*
986
		 * Don't change input if mouse is down as this causes a SIGSEGV in SWT!
987
		 */
988
		if (!isMouseDown) {
989
			Row[] input = new Row[0];
990
			if (fLguiItem != null && fLguiItem.getTableHandler() != null) {
991
				input = fLguiItem.getTableHandler()
992
						.getTableDataWithColor(gid, gid.equals(ILguiItem.ACTIVE_JOB_TABLE), filterValues);
993
			}
994
			if (!composite.isDisposed()) {
995
				viewer.setInput(input);
996
				viewer.setChildCount(input, input.length);
997
			}
998
		}
999
	}
864
}
1000
}
(-)a/rms/org.eclipse.ptp.rm.slurm.proxy/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-SymbolicName: org.eclipse.ptp.rm.slurm.proxy
2
Bundle-SymbolicName: org.eclipse.ptp.rm.slurm.proxy
3
Bundle-ManifestVersion: 2
3
Bundle-ManifestVersion: 2
4
Bundle-Name: %pluginName
4
Bundle-Name: %pluginName
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %pluginProvider
6
Bundle-Vendor: %pluginProvider
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Require-Bundle: org.eclipse.ptp.utils,org.eclipse.ptp.proxy
8
Require-Bundle: org.eclipse.ptp.utils,org.eclipse.ptp.proxy
(-)a/tools/sci/org.eclipse.ptp.sci/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-7 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.ptp.sci
4
Bundle-SymbolicName: org.eclipse.ptp.sci
5
Bundle-Version: 5.0.4.qualifier
5
Bundle-Version: 5.0.5.qualifier
6
Bundle-Vendor: %pluginProvider
6
Bundle-Vendor: %pluginProvider
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin

Return to bug 368356