Skip to content

Commit a279157

Browse files
committed
Commented-out implementation of [native image] sufix for SVM processes
1 parent d4351a7 commit a279157

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

visualvm/graalvm/src/org/graalvm/visualvm/graalvm/Installer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
import org.graalvm.visualvm.application.jvm.JvmFactory;
2828
import org.graalvm.visualvm.application.type.ApplicationTypeFactory;
29+
//import org.graalvm.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
30+
//import org.graalvm.visualvm.graalvm.application.descriptor.NativeImageApplicationDescriptorProvider;
2931
import org.graalvm.visualvm.graalvm.application.type.GraalVMApplicationTypeFactory;
3032
import org.graalvm.visualvm.graalvm.svm.SVMJvmProvider;
3133
import org.openide.modules.ModuleInstall;
@@ -35,6 +37,10 @@ public class Installer extends ModuleInstall {
3537
@Override
3638
public void restored() {
3739
ApplicationTypeFactory.getDefault().registerProvider(new GraalVMApplicationTypeFactory());
40+
41+
// NOTE: adds [native image] suffix to native-image processes
42+
// DataSourceDescriptorFactory.getDefault().registerProvider(new NativeImageApplicationDescriptorProvider());
43+
3844
JvmFactory.getDefault().registerProvider(new SVMJvmProvider());
3945
}
4046

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package org.graalvm.visualvm.graalvm.application.descriptor;
26+
27+
import org.graalvm.visualvm.application.Application;
28+
import org.graalvm.visualvm.application.ApplicationDescriptor;
29+
30+
/**
31+
*
32+
* @author Jiri Sedlacek
33+
*/
34+
class NativeImageApplicationDescriptor extends ApplicationDescriptor {
35+
36+
protected NativeImageApplicationDescriptor(Application application) {
37+
super(application);
38+
}
39+
40+
public String getName() {
41+
return super.getName() + " [native image]";
42+
}
43+
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package org.graalvm.visualvm.graalvm.application.descriptor;
26+
27+
import java.util.Properties;
28+
import org.graalvm.visualvm.application.Application;
29+
import org.graalvm.visualvm.application.jvm.Jvm;
30+
import org.graalvm.visualvm.application.jvm.JvmFactory;
31+
import org.graalvm.visualvm.core.datasource.DataSource;
32+
import org.graalvm.visualvm.core.datasource.descriptor.DataSourceDescriptor;
33+
import org.graalvm.visualvm.core.model.AbstractModelProvider;
34+
35+
/**
36+
*
37+
* @author Jiri Sedlacek
38+
*/
39+
public class NativeImageApplicationDescriptorProvider extends
40+
AbstractModelProvider<DataSourceDescriptor, DataSource> {
41+
42+
public DataSourceDescriptor createModelFor(DataSource ds) {
43+
if (ds instanceof Application) {
44+
Jvm jvm = JvmFactory.getJVMFor((Application)ds);
45+
if (jvm.isGetSystemPropertiesSupported()) {
46+
Properties prop = jvm.getSystemProperties();
47+
if ("Substrate VM".equals(prop.getProperty("java.vm.name"))) // NOI18N
48+
return new NativeImageApplicationDescriptor((Application)ds);
49+
}
50+
}
51+
return null;
52+
}
53+
54+
public int priority() {
55+
return 10;
56+
}
57+
}

0 commit comments

Comments
 (0)