Added support for container repostory and run in compute instance
diff --git a/enterprise/cloud.oracle/external/binaries-list b/enterprise/cloud.oracle/external/binaries-list
index 194a2c6..cc48847 100644
--- a/enterprise/cloud.oracle/external/binaries-list
+++ b/enterprise/cloud.oracle/external/binaries-list
@@ -32,6 +32,7 @@
3088420C75219556F803B55D8B71B96D29D1FC80 com.oracle.oci.sdk:oci-java-sdk-objectstorage-extensions:3.25.3
A7D98B96CEA17F78E4BB9270B4A60FEBFACF6C78 com.oracle.oci.sdk:oci-java-sdk-core:3.25.3
2236737DDF39CA3A3BABDB58B41F50C47E861EA7 com.oracle.oci.sdk:oci-java-sdk-containerengine:3.25.3
+923F38FE7186DFCBF921F9B3626832FFFFB8F6E9 com.oracle.oci.sdk:oci-java-sdk-artifacts:3.25.3
E5F6CAE5CA7ECAAC1EC2827A9E2D65AE2869CADA org.apache.httpcomponents:httpclient:4.5.13
853B96D3AFBB7BF8CC303FE27EE96836A10C1834 org.apache.httpcomponents:httpcore:4.4.13
diff --git a/enterprise/cloud.oracle/external/oci-java-sdk-3.25.3-license.txt b/enterprise/cloud.oracle/external/oci-java-sdk-3.25.3-license.txt
index 77fab27..10b6404 100644
--- a/enterprise/cloud.oracle/external/oci-java-sdk-3.25.3-license.txt
+++ b/enterprise/cloud.oracle/external/oci-java-sdk-3.25.3-license.txt
@@ -3,7 +3,7 @@
Origin: https://github.com/oracle/oci-java-sdk
Version: 3.25.3
License: UPL-Apache-2.0
-Files: oci-java-sdk-circuitbreaker-3.25.3.jar, oci-java-sdk-common-3.25.3.jar, oci-java-sdk-database-3.25.3.jar, oci-java-sdk-identity-3.25.3.jar, oci-java-sdk-workrequests-3.25.3.jar, oci-java-sdk-adm-3.25.3.jar, oci-java-sdk-devops-3.25.3.jar, oci-java-sdk-addons-apache-configurator-jersey-3.25.3.jar, oci-java-sdk-common-httpclient-3.25.3.jar, oci-java-sdk-common-httpclient-jersey-3.25.3.jar oci-java-sdk-keymanagement-3.25.3.jar oci-java-sdk-vault-3.25.3.jar oci-java-sdk-containerengine-3.25.3.jar oci-java-sdk-core-3.25.3.jar oci-java-sdk-objectstorage-3.25.3.jar oci-java-sdk-objectstorage-extensions-3.25.3.jar oci-java-sdk-objectstorage-generated-3.25.3.jar
+Files: oci-java-sdk-circuitbreaker-3.25.3.jar, oci-java-sdk-common-3.25.3.jar, oci-java-sdk-database-3.25.3.jar, oci-java-sdk-identity-3.25.3.jar, oci-java-sdk-workrequests-3.25.3.jar, oci-java-sdk-adm-3.25.3.jar, oci-java-sdk-devops-3.25.3.jar, oci-java-sdk-addons-apache-configurator-jersey-3.25.3.jar, oci-java-sdk-common-httpclient-3.25.3.jar, oci-java-sdk-common-httpclient-jersey-3.25.3.jar oci-java-sdk-keymanagement-3.25.3.jar oci-java-sdk-vault-3.25.3.jar oci-java-sdk-containerengine-3.25.3.jar oci-java-sdk-core-3.25.3.jar oci-java-sdk-objectstorage-3.25.3.jar oci-java-sdk-objectstorage-extensions-3.25.3.jar oci-java-sdk-objectstorage-generated-3.25.3.jar, oci-java-sdk-artifacts-3.25.3.jar
Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
diff --git a/enterprise/cloud.oracle/nbproject/project.properties b/enterprise/cloud.oracle/nbproject/project.properties
index 3f1ec9a..7463cc5 100644
--- a/enterprise/cloud.oracle/nbproject/project.properties
+++ b/enterprise/cloud.oracle/nbproject/project.properties
@@ -33,6 +33,7 @@
release.external/oci-java-sdk-objectstorage-extensions-3.25.3.jar=modules/ext/oci-java-sdk-objectstorage-extensions-3.25.3.jar
release.external/oci-java-sdk-core-3.25.3.jar=modules/ext/oci-java-sdk-core-3.25.3.jar
release.external/oci-java-sdk-containerengine-3.25.3.jar=modules/ext/oci-java-sdk-containerengine-3.25.3.jar
+release.external/oci-java-sdk-artifacts-3.25.3.jar=modules/ext/oci-java-sdk-artifacts-3.25.3.jar
release.external/httpclient-4.5.13.jar=modules/ext/httpclient-4.5.13.jar
release.external/httpcore-4.4.13.jar=modules/ext/httpcore-4.4.13.jar
release.external/javassist-3.25.0-GA.jar=modules/ext/javassist-3.25.0-GA.jar
diff --git a/enterprise/cloud.oracle/nbproject/project.xml b/enterprise/cloud.oracle/nbproject/project.xml
index 73205d6..797fc5d 100644
--- a/enterprise/cloud.oracle/nbproject/project.xml
+++ b/enterprise/cloud.oracle/nbproject/project.xml
@@ -308,6 +308,10 @@
<binary-origin>external/oci-java-sdk-containerengine-3.25.3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
+ <runtime-relative-path>ext/oci-java-sdk-artifacts-3.25.3.jar</runtime-relative-path>
+ <binary-origin>external/oci-java-sdk-artifacts-3.25.3.jar</binary-origin>
+ </class-path-extension>
+ <class-path-extension>
<runtime-relative-path>ext/httpclient-4.5.13.jar</runtime-relative-path>
<binary-origin>external/httpclient-4.5.13.jar</binary-origin>
</class-path-extension>
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/OCINode.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/OCINode.java
index 1e058c7..bfc515d 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/OCINode.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/OCINode.java
@@ -114,6 +114,11 @@
if (factory != null) {
factory.refreshKeys();
}
+ update(item);
+ }
+
+ public void update(OCIItem item) {
+
}
@Override
@@ -124,11 +129,8 @@
private final class RefreshListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if ("referenceName".equals(evt.getPropertyName())) {
- fireDisplayNameChange("", getDisplayName());
- } else {
- refresh();
- }
+ refresh();
+ fireDisplayNameChange("", getDisplayName());
}
}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/AddADBAction.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/AddADBAction.java
index 224db73..5e8d6f8 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/AddADBAction.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/AddADBAction.java
@@ -34,6 +34,7 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.concurrent.CompletableFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@@ -48,7 +49,6 @@
import org.netbeans.modules.cloud.oracle.items.OCID;
import org.netbeans.modules.cloud.oracle.items.OCIItem;
import org.netbeans.modules.cloud.oracle.items.TenancyItem;
-import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.ComposedInput.Callback;
@@ -56,8 +56,8 @@
import org.openide.NotifyDescriptor.QuickPick.Item;
import org.openide.awt.ActionID;
import org.openide.awt.ActionRegistration;
-import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
/**
*
@@ -67,8 +67,8 @@
category = "Tools",
id = "org.netbeans.modules.cloud.oracle.actions.AddADBAction"
)
-@ActionRegistration(
- displayName = "#AddADB",
+@ActionRegistration(
+ displayName = "#AddADB",
asynchronous = true
)
@@ -87,23 +87,26 @@
"SelectProfile_Description={0} (region: {1})"
})
public class AddADBAction implements ActionListener {
+
private static final Logger LOGGER = Logger.getLogger(AddADBAction.class.getName());
-
+
private static final String DB = "db"; //NOI18N
private static final String USERNAME = "username"; //NOI18N
private static final String PASSWORD = "password"; //NOI18N
private static final int NUMBER_OF_INPUTS = 4;
+ private static final RequestProcessor RP = new RequestProcessor(AddADBAction.class);
@Override
public void actionPerformed(ActionEvent e) {
addADB();
}
-
- public DatabaseItem addADB() {
- Map<String, Object> result = new HashMap<> ();
-
+
+ public CompletableFuture<DatabaseItem> addADB() {
+ Map<String, Object> result = new HashMap<>();
+ CompletableFuture future = new CompletableFuture();
+
NotifyDescriptor.ComposedInput ci = new NotifyDescriptor.ComposedInput(Bundle.AddADB(), NUMBER_OF_INPUTS, new Callback() {
- Map<Integer, Map> values = new HashMap<> ();
+ Map<Integer, Map> values = new HashMap<>();
@Override
public NotifyDescriptor createInput(NotifyDescriptor.ComposedInput input, int number) {
@@ -111,7 +114,7 @@
ProgressHandle h = ProgressHandle.createHandle(Bundle.MSG_CollectingProfiles());
h.start();
h.progress(Bundle.MSG_CollectingProfiles_Text());
-
+
Map<OCIProfile, Tenancy> profiles = new LinkedHashMap<>();
Map<String, TenancyItem> tenancyItems = new LinkedHashMap<>();
try {
@@ -153,9 +156,9 @@
NotifyDescriptor prev = input.getInputs()[number - 2];
OCIItem prevItem = null;
if (prev instanceof NotifyDescriptor.QuickPick) {
- for (QuickPick.Item item : ((QuickPick)prev).getItems()) {
+ for (QuickPick.Item item : ((QuickPick) prev).getItems()) {
if (item.isSelected()) {
- prevItem = (OCIItem)values.get(number - 1).get(item.getLabel());
+ prevItem = (OCIItem) values.get(number - 1).get(item.getLabel());
break;
}
}
@@ -197,35 +200,40 @@
return null;
}
}
-
+
});
- if (DialogDescriptor.OK_OPTION == DialogDisplayer.getDefault().notify(ci)) {
- try {
- DatabaseItem selectedDatabase = (DatabaseItem) result.get(DB);
- DownloadWalletAction action = new DownloadWalletAction(selectedDatabase);
- WalletInfo info = new WalletInfo(
- DownloadWalletDialog.getWalletsDir().getAbsolutePath(),
- AbstractPasswordPanel.generatePassword(),
- (String) result.get(USERNAME),
- ((String) result.get(PASSWORD)).toCharArray(),
- selectedDatabase);
- action.addConnection(info);
- return selectedDatabase;
- } catch (IOException ex) {
- Exceptions.printStackTrace(ex);
+ DialogDisplayer.getDefault().notifyFuture(ci).handle((r, exception) -> {
+ if (exception == null) {
+ try {
+ DatabaseItem selectedDatabase = (DatabaseItem) result.get(DB);
+ DownloadWalletAction action = new DownloadWalletAction(selectedDatabase);
+ WalletInfo info = new WalletInfo(
+ DownloadWalletDialog.getWalletsDir().getAbsolutePath(),
+ AbstractPasswordPanel.generatePassword(),
+ (String) result.get(USERNAME),
+ ((String) result.get(PASSWORD)).toCharArray(),
+ selectedDatabase);
+ action.addConnection(info);
+ future.complete(selectedDatabase);
+ } catch (IOException ex) {
+ future.completeExceptionally(exception);
+ }
+ } else {
+ future.completeExceptionally(exception);
}
- }
- return null;
+ return null;
+ });
+ return future;
}
-
+
private <T extends OCIItem> NotifyDescriptor.QuickPick createQuickPick(Map<String, T> ociItems, String title) {
-
+
List<Item> items = ociItems.entrySet().stream()
.map(entry -> new Item(entry.getKey(), entry.getValue().getDescription()))
.collect(Collectors.toList());
return new NotifyDescriptor.QuickPick(title, title, items, false);
}
-
+
private Map<String, OCIItem> getFlatCompartment(TenancyItem tenancy) {
Map<OCID, FlatCompartmentItem> compartments = new HashMap<>();
OCISessionInitiator session = OCIManager.getDefault().getActiveSession();
@@ -254,7 +262,7 @@
nextPageToken = response.getOpcNextPage();
} while (nextPageToken != null);
Map<String, OCIItem> pickItems = computeFlatNames(compartments);
- pickItems.put(tenancy.getName()+" (root)", tenancy); // NOI18N
+ pickItems.put(tenancy.getName() + " (root)", tenancy); // NOI18N
return pickItems;
}
@@ -267,6 +275,7 @@
}
private abstract class FlatCompartmentItem extends CompartmentItem {
+
private final OCID parentId;
private String flatName;
@@ -283,9 +292,13 @@
if (flatName == null) {
String parentFlatName = "";
FlatCompartmentItem parentComp = getItem(parentId);
- if (parentComp != null) parentFlatName = parentComp.getName();
+ if (parentComp != null) {
+ parentFlatName = parentComp.getName();
+ }
flatName = super.getName();
- if (!parentFlatName.isEmpty()) flatName = parentFlatName + "/" + flatName; // NOI18N
+ if (!parentFlatName.isEmpty()) {
+ flatName = parentFlatName + "/" + flatName; // NOI18N
+ }
}
return flatName;
}
@@ -294,7 +307,7 @@
}
private Map<String, OCIItem> getDbs(OCIItem parent) {
- Map<String, OCIItem> items = new HashMap<> ();
+ Map<String, OCIItem> items = new HashMap<>();
try {
if (parent instanceof CompartmentItem) {
DatabaseNode.getDatabases().apply((CompartmentItem) parent).forEach((db) -> items.put(db.getName(), db));
@@ -304,5 +317,5 @@
}
return items;
}
-
+
}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddNewAssetCommand.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddNewAssetCommand.java
index 722fbad..dcfa8e5 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddNewAssetCommand.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddNewAssetCommand.java
@@ -83,27 +83,33 @@
.executeMultistep(new ItemTypeStep(), Lookups.fixed(nsProvider))
.thenAccept(values -> {
Project project = values.getValueForStep(ProjectStep.class);
- OCIItem item;
- if ("Databases".equals(values.getValueForStep(ItemTypeStep.class))) {
- item = values.getValueForStep(DatabaseConnectionStep.class);
- if (item == null) {
+ CompletableFuture<? extends OCIItem> item;
+ if ("Databases".equals(values.getValueForStep(ItemTypeStep.class))) {
+ DatabaseItem i = values.getValueForStep(DatabaseConnectionStep.class);
+ if (i == null) {
item = new AddADBAction().addADB();
+ } else {
+ item = CompletableFuture.completedFuture(i);
}
} else {
- item = values.getValueForStep(SuggestedStep.class);
+ OCIItem i = values.getValueForStep(SuggestedStep.class);
+ if (i == null) {
+ future.cancel(true);
+ return;
+ } else {
+ item = CompletableFuture.completedFuture(i);
+ }
}
- if (item == null) {
- future.cancel(true);
- return;
- }
- CloudAssets.getDefault().addItem(item);
- String[] art = DEP_MAP.get(item.getKey().getPath());
- try {
- DependencyUtils.addDependency(project, art[0], art[1]);
- future.complete(null);
- } catch (IllegalStateException e) {
- future.completeExceptionally(e);
- }
+ item.thenAccept(i -> {
+ CloudAssets.getDefault().addItem(i);
+ String[] art = DEP_MAP.get(i.getKey().getPath());
+ try {
+ DependencyUtils.addDependency(project, art[0], art[1]);
+ future.complete(null);
+ } catch (IllegalStateException e) {
+ future.completeExceptionally(e);
+ }
+ });
});
return future;
}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddSuggestedItemAction.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddSuggestedItemAction.java
index 80bf066..9b33a57 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddSuggestedItemAction.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddSuggestedItemAction.java
@@ -32,6 +32,7 @@
import org.openide.awt.ActionRegistration;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
import org.openide.util.lookup.Lookups;
/**
@@ -55,7 +56,6 @@
"CollectingProfiles=Searching for OCI Profiles",
"CollectingItems=Loading OCI contents",})
public class AddSuggestedItemAction implements ActionListener {
-
private static final Logger LOG = Logger.getLogger(AddADBAction.class.getName());
private final SuggestedItem context;
@@ -70,10 +70,13 @@
Steps.getDefault().executeMultistep(new DatabaseConnectionStep(), Lookup.EMPTY)
.thenAccept(values -> {
DatabaseItem db = values.getValueForStep(DatabaseConnectionStep.class);
- if (db == null) {
- db = new AddADBAction().addADB();
+ if (db != null) {
+ CloudAssets.getDefault().addItem(db);
+ } else {
+ new AddADBAction().addADB().thenAccept(i -> {
+ CloudAssets.getDefault().addItem(i);
+ });
}
- CloudAssets.getDefault().addItem(db);
});
return;
}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/CloudAssets.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/CloudAssets.java
index 34b502b..96ba371 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/CloudAssets.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/CloudAssets.java
@@ -55,6 +55,7 @@
import org.netbeans.modules.cloud.oracle.compute.ClusterItem;
import org.netbeans.modules.cloud.oracle.compute.ComputeInstanceItem;
import org.netbeans.modules.cloud.oracle.database.DatabaseItem;
+import org.netbeans.modules.cloud.oracle.developer.ContainerRepositoryItem;
import org.netbeans.modules.cloud.oracle.items.OCID;
import org.netbeans.modules.cloud.oracle.items.OCIItem;
import org.netbeans.modules.cloud.oracle.vault.VaultItem;
@@ -340,6 +341,9 @@
case "Vault": //NOI18N
loaded.add(gson.fromJson(element, VaultItem.class));
break;
+ case "ContainerRepository": //NOI18N
+ loaded.add(gson.fromJson(element, ContainerRepositoryItem.class));
+ break;
}
}
reader.endArray();
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/Steps.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/Steps.java
index 88b2ec4..866a423 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/Steps.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/Steps.java
@@ -28,7 +28,6 @@
import java.util.logging.Logger;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.modules.cloud.oracle.items.OCIItem;
-import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.Lookup;
@@ -38,8 +37,9 @@
import org.openide.util.lookup.ProxyLookup;
/**
- * An implementation of the {@link Step} interface used for multiple commands or actions.
- *
+ * An implementation of the {@link Step} interface used for multiple commands or
+ * actions.
+ *
* @author Jan Horvath
*/
@NbBundle.Messages({
@@ -49,6 +49,7 @@
"LoadingItems=Loading items for the next step"
})
public final class Steps {
+
private static final Logger LOG = Logger.getLogger(Steps.class.getName());
private static final RequestProcessor RP = new RequestProcessor("Steps"); //NOI18N
private static Steps instance = null;
@@ -81,34 +82,40 @@
});
return future;
}
-
+
/**
- * Provider class that supplies the next {@link Step} for navigation from the current {@link Step}.
- *
+ * Provider class that supplies the next {@link Step} for navigation from
+ * the current {@link Step}.
+ *
*/
public static class NextStepProvider {
+
private final Map<Class<? extends AbstractStep>, Function<AbstractStep, AbstractStep>> steps;
-
+
/**
- * Private constructor to initialize the NextStepProvider with a map of steps.
+ * Private constructor to initialize the NextStepProvider with a map of
+ * steps.
*
- * @param steps a map associating classes with their corresponding {@link Step} instances
+ * @param steps a map associating classes with their corresponding
+ * {@link Step} instances
*/
private NextStepProvider(Map<Class<? extends AbstractStep>, Function<AbstractStep, AbstractStep>> steps) {
this.steps = steps;
}
-
+
/**
* Retrieves the next {@link Step} for the specified {@link Step}.
*
- * @param currentStep the current step for which the next step is to be retrieved
- * @return the {@link Step} associated with the specified class, or null if no step is found
+ * @param currentStep the current step for which the next step is to be
+ * retrieved
+ * @return the {@link Step} associated with the specified class, or null
+ * if no step is found
*/
public AbstractStep nextStepFor(AbstractStep currentStep) {
Function<AbstractStep, AbstractStep> nextStep = steps.get(currentStep.getClass());
return nextStep != null ? nextStep.apply(currentStep) : null;
}
-
+
/**
* Creates a new Builder for constructing a NextStepProvider.
*
@@ -117,19 +124,20 @@
public static Builder builder() {
return new Builder();
}
-
+
/**
* Builder class for constructing a NextStepProvider.
*/
public static class Builder {
- private final Map<Class<? extends AbstractStep>, Function<AbstractStep, AbstractStep>> steps = new HashMap<> ();
+
+ private final Map<Class<? extends AbstractStep>, Function<AbstractStep, AbstractStep>> steps = new HashMap<>();
/**
* Private constructor for the Builder.
*/
private Builder() {
}
-
+
/**
* Associates a {@link Step} function with a class in the builder.
*
@@ -141,7 +149,7 @@
steps.put(clazz, stepFunction);
return this;
}
-
+
/**
* Builds and returns a NextStepProvider with the configured steps.
*
@@ -152,17 +160,18 @@
}
}
}
-
+
/**
* Provides values for steps in the multi step dialog.
- *
+ *
*/
public interface Values {
-
+
/**
* Returns a value for a given {@link Step}.
+ *
* @param step
- * @return
+ * @return
*/
public <T> T getValueForStep(Class<? extends AbstractStep<T>> step);
}
@@ -229,7 +238,7 @@
}
return steps.getLast().createInput();
}
-
+
private void prepare(AbstractStep step) {
ProgressHandle h = ProgressHandle.createHandle(Bundle.LoadingItems());
h.start();
@@ -240,7 +249,7 @@
h.finish();
}
}
-
+
private AbstractStep getNextFor(AbstractStep step) {
Steps.NextStepProvider nsProvider = lookup.lookup(Steps.NextStepProvider.class);
if (nsProvider != null) {
@@ -249,7 +258,7 @@
prepare(ns);
return ns;
}
- }
+ }
return null;
}
};
@@ -258,14 +267,15 @@
public Values getResult() {
return values;
}
-
+
private static class MultistepValues implements Values {
+
private final List<AbstractStep> steps;
public MultistepValues(List<AbstractStep> steps) {
this.steps = steps;
}
-
+
@Override
public <T> T getValueForStep(Class<? extends AbstractStep<T>> forStep) {
for (AbstractStep step : steps) {
@@ -279,7 +289,7 @@
}
public static <T extends OCIItem> NotifyDescriptor.QuickPick createQuickPick(Map<String, T> ociItems, String title) {
- List<NotifyDescriptor.QuickPick.Item> items = new ArrayList<> ();
+ List<NotifyDescriptor.QuickPick.Item> items = new ArrayList<>();
for (Map.Entry<String, T> entry : ociItems.entrySet()) {
String description = entry.getValue().getDescription();
if (description == null || description.isBlank()) {
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceItem.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceItem.java
index 64f98f0..2f2cfab 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceItem.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceItem.java
@@ -26,13 +26,48 @@
* @author Jan Horvath
*/
public final class ComputeInstanceItem extends OCIItem {
-
- public ComputeInstanceItem(OCID id, String compartmentId, String name) {
+ private String publicIp = null;
+ private String processorDescription;
+ private String username;
+ private String imageId;
+
+ public ComputeInstanceItem(OCID id, String compartmentId, String name, String processorDescription, String imageId, String publicIp, String username) {
super(id, compartmentId, name);
+ this.processorDescription = processorDescription;
+ this.publicIp = publicIp;
+ this.username = username;
+ this.imageId = imageId;
}
public ComputeInstanceItem() {
super();
}
+
+ public String getPublicIp() {
+ if (publicIp == null) {
+ return "-"; //NOI18N
+ }
+ return publicIp;
+ }
+
+ public String getProcessorDescription() {
+ return processorDescription;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getImageId() {
+ return imageId;
+ }
+
+ void setPublicId(String publicIp) {
+ this.publicIp = publicIp;
+ }
}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceNode.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceNode.java
index 784e90a..2780fd1 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceNode.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/compute/ComputeInstanceNode.java
@@ -19,11 +19,22 @@
package org.netbeans.modules.cloud.oracle.compute;
import com.oracle.bmc.core.ComputeClient;
+import com.oracle.bmc.core.VirtualNetworkClient;
import com.oracle.bmc.core.model.Instance;
+import com.oracle.bmc.core.model.Vnic;
+import com.oracle.bmc.core.model.VnicAttachment;
+import com.oracle.bmc.core.requests.GetImageRequest;
+import com.oracle.bmc.core.requests.GetVnicRequest;
import com.oracle.bmc.core.requests.ListInstancesRequest;
+import com.oracle.bmc.core.requests.ListVnicAttachmentsRequest;
+import com.oracle.bmc.core.responses.GetImageResponse;
+import com.oracle.bmc.core.responses.GetVnicResponse;
+import com.oracle.bmc.core.responses.ListVnicAttachmentsResponse;
+import java.util.List;
import java.util.stream.Collectors;
import org.netbeans.modules.cloud.oracle.ChildrenProvider;
import org.netbeans.modules.cloud.oracle.NodeProvider;
+import org.netbeans.modules.cloud.oracle.OCIManager;
import org.netbeans.modules.cloud.oracle.OCINode;
import org.netbeans.modules.cloud.oracle.compartment.CompartmentItem;
import org.netbeans.modules.cloud.oracle.items.OCID;
@@ -35,7 +46,7 @@
* @author Jan Horvath
*/
@NbBundle.Messages({
- "CoputeInstanceDesc=Compute Instance: {0}"
+ "CoputeInstanceDesc=Compute Instance: {0}\nPublic IP: {1}\nUsername: {2}\nProcessor: {3}"
})
public class ComputeInstanceNode extends OCINode {
private static final String COMPUTE_INSTANCE_ICON = "org/netbeans/modules/cloud/oracle/resources/computeinstance.svg"; // NOI18N
@@ -45,13 +56,69 @@
setName(instance.getName());
setDisplayName(instance.getName());
setIconBaseWithExtension(COMPUTE_INSTANCE_ICON);
- setShortDescription(Bundle.CoputeInstanceDesc(instance.getName()));
+ setShortDescription(Bundle.CoputeInstanceDesc(
+ instance.getName(),
+ instance.getPublicIp(),
+ instance.getUsername(),
+ instance.getProcessorDescription()
+ ));
}
public static NodeProvider<ComputeInstanceItem> createNode() {
- return ComputeInstanceNode::new;
+ return (instance) -> {
+ update(instance);
+ return new ComputeInstanceNode(instance);
+ };
}
+
+
+ static public void update(ComputeInstanceItem instance) {
+ ComputeClient computeClient = ComputeClient.builder()
+ .build(OCIManager.getDefault().getActiveProfile().getAuthenticationProvider());
+ if (instance.getImageId() != null) {
+ GetImageRequest request = GetImageRequest.builder()
+ .imageId(instance.getImageId()).build();
+ GetImageResponse response = computeClient.getImage(request);
+ String os = response.getImage().getOperatingSystem();
+ if (os.contains("Oracle")) { //NOI18N
+ instance.setUsername("opc"); //NOI18N
+ } else if (os.contains("Ubuntu")) { //NOI18N
+ instance.setUsername("ubuntu"); //NOI18N
+ } else if (os.contains("CentOS")) { //NOI18N
+ instance.setUsername("centos"); //NOI18N
+ } else if (os.contains("Debian")) { //NOI18N
+ instance.setUsername("debian"); //NOI18N
+ } else if (os.contains("Windows")) { //NOI18N
+ instance.setUsername("Administrator"); //NOI18N
+ } else {
+ instance.setUsername("opc"); //NOI18N
+ }
+ }
+
+ VirtualNetworkClient virtualNetworkClient = VirtualNetworkClient.builder()
+ .build(OCIManager.getDefault().getActiveProfile().getAuthenticationProvider());
+ ListVnicAttachmentsRequest listVnicAttachmentsRequest = ListVnicAttachmentsRequest.builder()
+ .compartmentId(instance.getCompartmentId())
+ .instanceId(instance.getKey().getValue())
+ .build();
+
+ ListVnicAttachmentsResponse listVnicAttachmentsResponse = computeClient.listVnicAttachments(listVnicAttachmentsRequest);
+ List<VnicAttachment> vnicAttachments = listVnicAttachmentsResponse.getItems();
+
+ for (VnicAttachment vnicAttachment : vnicAttachments) {
+ GetVnicRequest getVnicRequest = GetVnicRequest.builder()
+ .vnicId(vnicAttachment.getVnicId())
+ .build();
+ GetVnicResponse getVnicResponse = virtualNetworkClient.getVnic(getVnicRequest);
+ Vnic vnic = getVnicResponse.getVnic();
+
+ if (vnic.getPublicIp() != null) {
+ instance.setPublicId(vnic.getPublicIp());
+ }
+ }
+ }
+
/**
* Retrieves list of Vaults belonging to a given Compartment.
*
@@ -60,7 +127,7 @@
*/
public static ChildrenProvider.SessionAware<CompartmentItem, ComputeInstanceItem> getComputeInstances() {
return (compartmentId, session) -> {
- ComputeClient client = session.newClient(ComputeClient.class);
+ final ComputeClient client = session.newClient(ComputeClient.class);
ListInstancesRequest listInstancesRequest = ListInstancesRequest.builder()
.compartmentId(compartmentId.getKey().getValue())
@@ -75,7 +142,11 @@
.map(d -> new ComputeInstanceItem(
OCID.of(d.getId(), "ComputeInstance"), //NOI18N
compartmentId.getKey().getValue(),
- d.getDisplayName()
+ d.getDisplayName(),
+ d.getShapeConfig().getProcessorDescription(),
+ d.getImageId(),
+ null,
+ null
))
.collect(Collectors.toList());
};
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerRepositoryItem.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerRepositoryItem.java
new file mode 100644
index 0000000..75b1655
--- /dev/null
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerRepositoryItem.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cloud.oracle.developer;
+
+import org.netbeans.modules.cloud.oracle.items.OCID;
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+public final class ContainerRepositoryItem extends OCIItem {
+
+ private Boolean isPublic;
+ private Integer imageCount;
+ private String regionCode;
+ private String namespace;
+
+ public ContainerRepositoryItem(OCID id, String compartmentId, String name, String regionCode, String namespace, Boolean isPublic, Integer imageCount) {
+ super(id, compartmentId, name);
+ this.regionCode = regionCode;
+ this.namespace = namespace;
+ this.isPublic = isPublic;
+ this.imageCount = imageCount;
+ }
+
+ public ContainerRepositoryItem() {
+ super();
+ }
+
+ public Boolean getIsPublic() {
+ return isPublic;
+ }
+
+ public Integer getImageCount() {
+ return imageCount;
+ }
+
+ public void setImageCount(Integer imageCount) {
+ this.imageCount = imageCount;
+ }
+
+ public String getRegionCode() {
+ return regionCode;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public String getUrl() {
+ return String.format("%s.ocir.io/%s/%s", getRegionCode(), getNamespace(), getName());
+ }
+
+}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerRepositoryNode.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerRepositoryNode.java
new file mode 100644
index 0000000..5b58f1f
--- /dev/null
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerRepositoryNode.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cloud.oracle.developer;
+
+import com.oracle.bmc.artifacts.ArtifactsClient;
+import com.oracle.bmc.artifacts.model.ContainerRepository;
+import com.oracle.bmc.artifacts.requests.GetContainerRepositoryRequest;
+import com.oracle.bmc.artifacts.requests.ListContainerRepositoriesRequest;
+import com.oracle.bmc.artifacts.responses.GetContainerRepositoryResponse;
+import java.util.stream.Collectors;
+import org.netbeans.modules.cloud.oracle.ChildrenProvider;
+import org.netbeans.modules.cloud.oracle.NodeProvider;
+import org.netbeans.modules.cloud.oracle.OCIManager;
+import org.netbeans.modules.cloud.oracle.OCINode;
+import org.netbeans.modules.cloud.oracle.compartment.CompartmentItem;
+import org.netbeans.modules.cloud.oracle.items.OCID;
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "ContainerRepositoryDesc=Container Repository: {0}\nURL: {1}"
+})
+public class ContainerRepositoryNode extends OCINode {
+ private static final String CONTAINER_REPOSITORY_ICON = "org/netbeans/modules/cloud/oracle/resources/containerrepository.svg"; // NOI18N
+
+ public ContainerRepositoryNode(ContainerRepositoryItem instance) {
+ super(instance);
+ setName(instance.getName());
+ setDisplayName(instance.getName());
+ setIconBaseWithExtension(CONTAINER_REPOSITORY_ICON);
+ setShortDescription(Bundle.ContainerRepositoryDesc(instance.getName(), instance.getUrl()));
+ }
+
+ public static NodeProvider<ContainerRepositoryItem> createNode() {
+ return ContainerRepositoryNode::new;
+ }
+
+ @Override
+ public void update(OCIItem item) {
+ ContainerRepositoryItem orig = (ContainerRepositoryItem) item;
+ ArtifactsClient client = OCIManager.getDefault().getActiveProfile().newClient(ArtifactsClient.class);
+ GetContainerRepositoryRequest listContainerRepositoriesRequest = GetContainerRepositoryRequest.builder()
+ .repositoryId(item.getKey().getValue())
+ .build();
+
+ GetContainerRepositoryResponse response = client.getContainerRepository(listContainerRepositoriesRequest);
+ ContainerRepository cr = response.getContainerRepository();
+ orig.setImageCount(cr.getImageCount());
+
+ }
+
+ /**
+ * Retrieves list of Vaults belonging to a given Compartment.
+ *
+ * @return Returns {@code ChildrenProvider} which fetches List of
+ * {@code BucketItem} for given {@code CompartmentItem}
+ */
+ public static ChildrenProvider.SessionAware<CompartmentItem, ContainerRepositoryItem> getContainerRepositories() {
+ return (compartmentId, session) -> {
+ ArtifactsClient client = session.newClient(ArtifactsClient.class);
+
+ ListContainerRepositoriesRequest listContainerRepositoriesRequest = ListContainerRepositoriesRequest.builder()
+ .compartmentId(compartmentId.getKey().getValue())
+ .build();
+
+ return client.listContainerRepositories(listContainerRepositoriesRequest)
+ .getContainerRepositoryCollection()
+ .getItems()
+ .stream()
+ .map(d -> new ContainerRepositoryItem(
+ OCID.of(d.getId(), "ContainerRepository"), //NOI18N
+ compartmentId.getKey().getValue(),
+ d.getDisplayName(),
+ session.getRegion().getRegionCode(),
+ d.getNamespace(),
+ d.getIsPublic(),
+ d.getImageCount()
+ ))
+ .collect(Collectors.toList());
+ };
+ }
+
+}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagItem.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagItem.java
new file mode 100644
index 0000000..72c5171
--- /dev/null
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagItem.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cloud.oracle.developer;
+
+import org.netbeans.modules.cloud.oracle.items.OCID;
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+public final class ContainerTagItem extends OCIItem {
+
+ private String digest;
+ private String version;
+ private String regionCode;
+ private String namespace;
+ private String repositoryName;
+
+ public ContainerTagItem(OCID id, String compartmentId, String repositoryName, String regionCode, String namespace, String version, String digest) {
+ super(id, compartmentId, version != null ? version : digest);
+ this.regionCode = regionCode;
+ this.version = version;
+ this.digest = digest;
+ this.repositoryName = repositoryName;
+ this.namespace = namespace;
+ }
+
+ public ContainerTagItem() {
+ super();
+ }
+
+ public String getUrl() {
+ if (version != null) {
+ return String.format("%s.ocir.io/%s/%s:%s", regionCode, namespace, repositoryName, version);
+ }
+ return String.format("%s.ocir.io/%s/%s@%s", regionCode, namespace, repositoryName, digest);
+ }
+
+ public String getDigest() {
+ return digest;
+ }
+
+ public String getVersion() {
+ if (version == null) {
+ return "";
+ }
+ return version;
+ }
+
+}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagNode.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagNode.java
new file mode 100644
index 0000000..5869f53
--- /dev/null
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagNode.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cloud.oracle.developer;
+
+import com.oracle.bmc.artifacts.ArtifactsClient;
+import com.oracle.bmc.artifacts.requests.ListContainerImagesRequest;
+import java.util.stream.Collectors;
+import org.netbeans.modules.cloud.oracle.ChildrenProvider;
+import org.netbeans.modules.cloud.oracle.NodeProvider;
+import org.netbeans.modules.cloud.oracle.OCINode;
+import org.netbeans.modules.cloud.oracle.items.OCID;
+import org.openide.nodes.Children;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "ContainerTagDesc=Pull URL: {0}\nVersion: {1}\nDigest: {2}"
+})
+public class ContainerTagNode extends OCINode {
+ private static final String CONTAINER_TAG_ICON = "org/netbeans/modules/cloud/oracle/resources/containertag.svg"; // NOI18N
+
+ public ContainerTagNode(ContainerTagItem tag) {
+ super(tag, Children.LEAF);
+ setName(tag.getName());
+ setDisplayName(tag.getName());
+ setIconBaseWithExtension(CONTAINER_TAG_ICON);
+ setShortDescription(Bundle.ContainerTagDesc(tag.getUrl(), tag.getVersion(), tag.getDigest()));
+ }
+
+ public static NodeProvider<ContainerTagItem> createNode() {
+ return ContainerTagNode::new;
+ }
+
+ /**
+ * Retrieves list of Vaults belonging to a given Compartment.
+ *
+ * @return Returns {@code ChildrenProvider} which fetches List of
+ * {@code BucketItem} for given {@code CompartmentItem}
+ */
+ public static ChildrenProvider.SessionAware<ContainerRepositoryItem, ContainerTagItem> getContainerTags() {
+ return (containerRepository, session) -> {
+ ArtifactsClient client = session.newClient(ArtifactsClient.class);
+
+ ListContainerImagesRequest listContainerImagesRequest = ListContainerImagesRequest.builder()
+ .compartmentId(containerRepository.getCompartmentId())
+ .repositoryId(containerRepository.getKey().getValue())
+ .build();
+
+ return client.listContainerImages(listContainerImagesRequest)
+ .getContainerImageCollection()
+ .getItems()
+ .stream()
+ .map(d -> new ContainerTagItem(
+ OCID.of(d.getId(), "ContainerTag"), //NOI18N
+ containerRepository.getCompartmentId(),
+ containerRepository.getName(),
+ containerRepository.getRegionCode(),
+ containerRepository.getNamespace(),
+ d.getVersion(),
+ d.getDigest().trim()
+ ))
+ .collect(Collectors.toList());
+ };
+ }
+
+}
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/items/OCIItem.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/items/OCIItem.java
index 863a80b..69243f2 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/items/OCIItem.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/items/OCIItem.java
@@ -121,6 +121,10 @@
public void removeChangeListener(PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(listener);
}
+
+ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
public int maxInProject() {
return 1;
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/containerrepository.svg b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/containerrepository.svg
new file mode 100644
index 0000000..98403a2
--- /dev/null
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/containerrepository.svg
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ version="1.1"
+ id="Vector_Icons"
+ x="0px"
+ y="0px"
+ width="16px"
+ height="16px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="suggest.svg"
+ inkscape:version="1.3.2 (091e20e, 2023-11-25)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"><defs
+ id="defs17027" /><sodipodi:namedview
+ id="namedview17025"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ showgrid="false"
+ inkscape:zoom="29.651788"
+ inkscape:cx="7.8241487"
+ inkscape:cy="5.0924416"
+ inkscape:window-width="1576"
+ inkscape:window-height="1049"
+ inkscape:window-x="202"
+ inkscape:window-y="49"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Vector_Icons"
+ inkscape:showpageshadow="2"
+ inkscape:deskcolor="#d1d1d1" />
+<style
+ type="text/css"
+ id="style17020">
+ .st0{fill:#FFFFFF;}
+ .st1{opacity:0.25;}
+ .st2{fill:#FAFAFA;}
+ .st3{opacity:0.33;}
+ .st4{fill:none;stroke:#474747;stroke-miterlimit:10;}
+ .st5{opacity:0.42;}
+ .st6{fill:#CAE3FF;}
+ .st7{opacity:0.2;}
+ .st8{opacity:0.03;}
+ .st9{opacity:0.1;}
+ .st10{opacity:0.15;}
+ .st11{opacity:0.45;}
+ .st12{fill:#FFE1B0;}
+ .st13{fill:#B3DBFF;}
+ .st14{fill:#FBDC7C;}
+ .st15{fill:#FFDB43;}
+ .st16{fill:#E79B00;}
+ .st17{fill:#3883CE;}
+ .st18{fill:none;stroke:#003399;stroke-width:1.375;stroke-miterlimit:10;}
+ .st19{fill:#E8513D;}
+ .st20{fill:#1E1E1E;}
+ .st21{fill:#FFC36D;}
+ .st22{fill:#9FCBFF;}
+ .st23{fill:#E9F7FF;}
+ .st24{fill:#62707C;}
+ .st25{fill:#7A8896;}
+ .st26{fill:#57BFFF;}
+ .st27{fill:#E69D35;}
+ .st28{fill:#9CFF73;}
+ .st29{fill:#4891CC;}
+ .st30{fill:#474747;}
+ .st31{fill:#CCA05E;}
+ .st32{opacity:0.67;}
+ .st33{opacity:0.3;}
+ .st34{fill:#EAEAEA;}
+ .st35{fill:#FFE945;}
+ .st36{fill:#FFCF8C;}
+ .st37{fill:#FF5252;}
+ .st38{opacity:0.12;}
+ .st39{fill:#45A5F4;}
+ .st40{fill:url(#SVGID_1_);}
+ .st41{fill:url(#SVGID_2_);}
+ .st42{opacity:0.05;}
+ .st43{fill:#3D81F5;}
+ .st44{fill:#CECECE;}
+ .st45{fill:#B5B5B5;}
+ .st46{opacity:0.4;}
+ .st47{fill:#595959;}
+ .st48{fill:#80FF80;}
+ .st49{fill:#C8FF80;}
+ .st50{fill:#FFEE80;}
+ .st51{fill:#FFA680;}
+ .st52{fill:#FF8080;}
+ .st53{fill:none;}
+ .st54{fill:#007AFF;}
+ .st55{fill:#EFFF78;}
+ .st56{fill:#FFDA00;}
+ .st57{fill:#3EADFF;}
+ .st58{opacity:0.67;fill:#FFFFFF;}
+ .st59{fill:#2E92FF;}
+ .st60{fill:#3AEA00;}
+ .st61{fill:#303030;}
+</style>
+
+<path
+ style="font-size:16.4841px;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue';fill:#9d9d9d;stroke-width:0;paint-order:stroke fill markers"
+ d="m 6.7331828,12.527608 v 1.829735 H 8.5629179 V 12.527608 Z M 4.0462744,6.2636495 H 5.447423 q 0,-0.5769436 0.1318728,-1.0714666 Q 5.7111686,4.6976599 5.9913983,4.3350097 6.2881121,3.9723595 6.7166987,3.7580662 7.1452853,3.5437729 7.7387129,3.5437729 q 0.8901414,0 1.4011485,0.5110071 Q 9.6673526,4.5657871 9.7332891,5.4724126 9.7662573,6.0823243 9.5849321,6.510911 9.403607,6.9394976 9.0904091,7.3021478 8.7936953,7.6483139 8.4310451,7.9779959 8.084879,8.2911938 7.755197,8.6703281 7.4419991,9.0494624 7.2112217,9.5439854 6.9969284,10.022024 6.9639602,10.714357 v 0.774752 h 1.4011485 v -0.64288 q 0,-0.428586 0.1153887,-0.758268 Q 8.6123702,9.7417946 8.8101794,9.4615649 9.0244727,9.1648511 9.2717342,8.9175896 9.5354798,8.653844 9.7992255,8.4065825 10.062971,8.1428369 10.310233,7.8626072 q 0.263745,-0.2802297 0.461554,-0.6099117 0.19781,-0.329682 0.313198,-0.7253004 0.131873,-0.4121026 0.131873,-0.9231097 0,-0.7912368 -0.263746,-1.4011485 Q 10.705851,3.5932252 10.244296,3.1811227 9.7827414,2.7525361 9.1398614,2.5382428 8.5134656,2.3074654 7.7387129,2.3074654 q -0.8571732,0 -1.5495054,0.2967138 Q 5.4968753,2.900893 5.0188364,3.4448683 4.5407974,3.9723595 4.2770518,4.6976599 4.0297903,5.4229603 4.0462744,6.2636495 Z"
+ id="text1"
+ transform="scale(1.0383436,0.96307233)"
+ aria-label="?" /></svg>
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/containertag.svg b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/containertag.svg
new file mode 100644
index 0000000..98403a2
--- /dev/null
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/containertag.svg
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ version="1.1"
+ id="Vector_Icons"
+ x="0px"
+ y="0px"
+ width="16px"
+ height="16px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="suggest.svg"
+ inkscape:version="1.3.2 (091e20e, 2023-11-25)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg"><defs
+ id="defs17027" /><sodipodi:namedview
+ id="namedview17025"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ showgrid="false"
+ inkscape:zoom="29.651788"
+ inkscape:cx="7.8241487"
+ inkscape:cy="5.0924416"
+ inkscape:window-width="1576"
+ inkscape:window-height="1049"
+ inkscape:window-x="202"
+ inkscape:window-y="49"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Vector_Icons"
+ inkscape:showpageshadow="2"
+ inkscape:deskcolor="#d1d1d1" />
+<style
+ type="text/css"
+ id="style17020">
+ .st0{fill:#FFFFFF;}
+ .st1{opacity:0.25;}
+ .st2{fill:#FAFAFA;}
+ .st3{opacity:0.33;}
+ .st4{fill:none;stroke:#474747;stroke-miterlimit:10;}
+ .st5{opacity:0.42;}
+ .st6{fill:#CAE3FF;}
+ .st7{opacity:0.2;}
+ .st8{opacity:0.03;}
+ .st9{opacity:0.1;}
+ .st10{opacity:0.15;}
+ .st11{opacity:0.45;}
+ .st12{fill:#FFE1B0;}
+ .st13{fill:#B3DBFF;}
+ .st14{fill:#FBDC7C;}
+ .st15{fill:#FFDB43;}
+ .st16{fill:#E79B00;}
+ .st17{fill:#3883CE;}
+ .st18{fill:none;stroke:#003399;stroke-width:1.375;stroke-miterlimit:10;}
+ .st19{fill:#E8513D;}
+ .st20{fill:#1E1E1E;}
+ .st21{fill:#FFC36D;}
+ .st22{fill:#9FCBFF;}
+ .st23{fill:#E9F7FF;}
+ .st24{fill:#62707C;}
+ .st25{fill:#7A8896;}
+ .st26{fill:#57BFFF;}
+ .st27{fill:#E69D35;}
+ .st28{fill:#9CFF73;}
+ .st29{fill:#4891CC;}
+ .st30{fill:#474747;}
+ .st31{fill:#CCA05E;}
+ .st32{opacity:0.67;}
+ .st33{opacity:0.3;}
+ .st34{fill:#EAEAEA;}
+ .st35{fill:#FFE945;}
+ .st36{fill:#FFCF8C;}
+ .st37{fill:#FF5252;}
+ .st38{opacity:0.12;}
+ .st39{fill:#45A5F4;}
+ .st40{fill:url(#SVGID_1_);}
+ .st41{fill:url(#SVGID_2_);}
+ .st42{opacity:0.05;}
+ .st43{fill:#3D81F5;}
+ .st44{fill:#CECECE;}
+ .st45{fill:#B5B5B5;}
+ .st46{opacity:0.4;}
+ .st47{fill:#595959;}
+ .st48{fill:#80FF80;}
+ .st49{fill:#C8FF80;}
+ .st50{fill:#FFEE80;}
+ .st51{fill:#FFA680;}
+ .st52{fill:#FF8080;}
+ .st53{fill:none;}
+ .st54{fill:#007AFF;}
+ .st55{fill:#EFFF78;}
+ .st56{fill:#FFDA00;}
+ .st57{fill:#3EADFF;}
+ .st58{opacity:0.67;fill:#FFFFFF;}
+ .st59{fill:#2E92FF;}
+ .st60{fill:#3AEA00;}
+ .st61{fill:#303030;}
+</style>
+
+<path
+ style="font-size:16.4841px;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue';fill:#9d9d9d;stroke-width:0;paint-order:stroke fill markers"
+ d="m 6.7331828,12.527608 v 1.829735 H 8.5629179 V 12.527608 Z M 4.0462744,6.2636495 H 5.447423 q 0,-0.5769436 0.1318728,-1.0714666 Q 5.7111686,4.6976599 5.9913983,4.3350097 6.2881121,3.9723595 6.7166987,3.7580662 7.1452853,3.5437729 7.7387129,3.5437729 q 0.8901414,0 1.4011485,0.5110071 Q 9.6673526,4.5657871 9.7332891,5.4724126 9.7662573,6.0823243 9.5849321,6.510911 9.403607,6.9394976 9.0904091,7.3021478 8.7936953,7.6483139 8.4310451,7.9779959 8.084879,8.2911938 7.755197,8.6703281 7.4419991,9.0494624 7.2112217,9.5439854 6.9969284,10.022024 6.9639602,10.714357 v 0.774752 h 1.4011485 v -0.64288 q 0,-0.428586 0.1153887,-0.758268 Q 8.6123702,9.7417946 8.8101794,9.4615649 9.0244727,9.1648511 9.2717342,8.9175896 9.5354798,8.653844 9.7992255,8.4065825 10.062971,8.1428369 10.310233,7.8626072 q 0.263745,-0.2802297 0.461554,-0.6099117 0.19781,-0.329682 0.313198,-0.7253004 0.131873,-0.4121026 0.131873,-0.9231097 0,-0.7912368 -0.263746,-1.4011485 Q 10.705851,3.5932252 10.244296,3.1811227 9.7827414,2.7525361 9.1398614,2.5382428 8.5134656,2.3074654 7.7387129,2.3074654 q -0.8571732,0 -1.5495054,0.2967138 Q 5.4968753,2.900893 5.0188364,3.4448683 4.5407974,3.9723595 4.2770518,4.6976599 4.0297903,5.4229603 4.0462744,6.2636495 Z"
+ id="text1"
+ transform="scale(1.0383436,0.96307233)"
+ aria-label="?" /></svg>
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/layer.xml b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/layer.xml
index b40972c..5314e88 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/layer.xml
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/layer.xml
@@ -79,6 +79,9 @@
<file name="org-netbeans-modules-cloud-oracle-compute-ComputeInstanceNode-getComputeInstances.instance">
<attr methodvalue="org.netbeans.modules.cloud.oracle.compute.ComputeInstanceNode.getComputeInstances" name="instanceCreate"/>
</file>
+ <file name="org-netbeans-modules-cloud-oracle-developer-ContainerRepositoryNode-getContainerRepositories.instance">
+ <attr methodvalue="org.netbeans.modules.cloud.oracle.developer.ContainerRepositoryNode.getContainerRepositories" name="instanceCreate"/>
+ </file>
<file name="org-netbeans-modules-cloud-oracle-compute-ClusterNode-getClusters.instance">
<attr methodvalue="org.netbeans.modules.cloud.oracle.compute.ClusterNode.getClusters" name="instanceCreate"/>
</file>
@@ -202,6 +205,23 @@
</file>
</folder>
</folder>
+ <folder name="ContainerRepository">
+ <folder name="Nodes">
+ <file name="org-netbeans-modules-cloud-oracle-developer-ContainerRepositoryNode-getContainerRepositories-createNode.instance">
+ <attr methodvalue="org.netbeans.modules.cloud.oracle.developer.ContainerRepositoryNode.createNode" name="instanceCreate"/>
+ </file>
+ <file name="org-netbeans-modules-cloud-oracle-developer-ContainerTagNode-getContainerTags.instance">
+ <attr methodvalue="org.netbeans.modules.cloud.oracle.developer.ContainerTagNode.getContainerTags" name="instanceCreate"/>
+ </file>
+ </folder>
+ </folder>
+ <folder name="ContainerTag">
+ <folder name="Nodes">
+ <file name="org-netbeans-modules-cloud-oracle-cdeveloper-ContainerTagNode-createNode.instance">
+ <attr methodvalue="org.netbeans.modules.cloud.oracle.developer.ContainerTagNode.createNode" name="instanceCreate"/>
+ </file>
+ </folder>
+ </folder>
<folder name="Cluster">
<folder name="Nodes">
<file name="org-netbeans-modules-cloud-oracle-compute-ClusterNode-createNode.instance">
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/ItemTypeStep.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/ItemTypeStep.java
index 7321728..2e4235a 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/ItemTypeStep.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/ItemTypeStep.java
@@ -24,7 +24,6 @@
import java.util.Map;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.modules.cloud.oracle.assets.AbstractStep;
-import org.netbeans.modules.cloud.oracle.assets.Steps;
import org.netbeans.modules.cloud.oracle.assets.Steps.Values;
import org.openide.NotifyDescriptor;
import org.openide.util.NbBundle;
@@ -35,15 +34,16 @@
* @author Jan Horvath
*/
@NbBundle.Messages({
- "SelectResourceType=Select Resource Type"
+ "SelectResourceType=Select Resource Type",
})
public class ItemTypeStep extends AbstractStep<String> {
private static final Map<String, String> TYPES = new HashMap() {
{
- put("Databases", Bundle.Databases()); //NOI18N
- put("Bucket", Bundle.Bucket()); //NOI18N
- put("Vault", Bundle.Vault()); //NOI18N
+ put(Bundle.Databases(), "Databases"); //NOI18N
+ put(Bundle.Bucket(), "Bucket"); //NOI18N
+ put(Bundle.Vault(), "Vault"); //NOI18N
+ put(Bundle.ContainerRepository(), "ContainerRepository"); //NOI18N
}
};
private String selected;
@@ -56,7 +56,7 @@
public NotifyDescriptor createInput() {
List<NotifyDescriptor.QuickPick.Item> items = new ArrayList<>(TYPES.size());
for (Map.Entry<String, String> itemType : TYPES.entrySet()) {
- items.add(new NotifyDescriptor.QuickPick.Item(itemType.getKey(), itemType.getValue()));
+ items.add(new NotifyDescriptor.QuickPick.Item(itemType.getKey(), ""));
}
return new NotifyDescriptor.QuickPick(Bundle.SelectResourceType(), Bundle.SelectResourceType(), items, false);
}
@@ -67,8 +67,8 @@
}
@Override
- public void setValue(String selected) {
- this.selected = selected;
+ public void setValue(String selectedName) {
+ this.selected = TYPES.get(selectedName);
}
@Override
diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/SuggestedStep.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/SuggestedStep.java
index 5d8a291..52a673c 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/SuggestedStep.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/steps/SuggestedStep.java
@@ -35,6 +35,7 @@
import org.netbeans.modules.cloud.oracle.compute.ClusterNode;
import org.netbeans.modules.cloud.oracle.compute.ComputeInstanceNode;
import org.netbeans.modules.cloud.oracle.database.DatabaseNode;
+import org.netbeans.modules.cloud.oracle.developer.ContainerRepositoryNode;
import org.netbeans.modules.cloud.oracle.items.OCIItem;
import org.netbeans.modules.cloud.oracle.vault.VaultNode;
import org.openide.NotifyDescriptor;
@@ -52,6 +53,7 @@
"Cluster=Oracle Container Engine",
"Compute=Compute Instance",
"SelectItem=Select {0}",
+ "ContainerRepository=Container Repository",
})
public class SuggestedStep extends AbstractStep<OCIItem> {
private static final Logger LOG = Logger.getLogger(SuggestedStep.class.getName());
@@ -86,6 +88,8 @@
return Bundle.Cluster();
case "ComputeInstance":
return Bundle.Compute();
+ case "ContainerRepository":
+ return Bundle.ContainerRepository();
}
throw new MissingResourceException("Missing OCI type", null, suggestedType);
}
@@ -133,6 +137,8 @@
return ClusterNode.getClusters().apply(parent);
case "ComputeInstance": //NOI18N
return ComputeInstanceNode.getComputeInstances().apply(parent);
+ case "ContainerRepository": //NOI18N
+ return ContainerRepositoryNode.getContainerRepositories().apply(parent);
default:
return Collections.emptyList();
}
diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspAssetsDecorationProvider.java b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspAssetsDecorationProvider.java
index 5764422..9e2160d 100644
--- a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspAssetsDecorationProvider.java
+++ b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspAssetsDecorationProvider.java
@@ -18,20 +18,19 @@
*/
package org.netbeans.modules.nbcode.integration;
-import java.io.IOException;
-import java.util.List;
-import java.util.logging.Level;
+import java.util.Optional;
import java.util.logging.Logger;
import org.netbeans.modules.cloud.oracle.assets.CloudAssets;
import org.netbeans.modules.cloud.oracle.bucket.BucketItem;
+import org.netbeans.modules.cloud.oracle.compute.ComputeInstanceItem;
import org.netbeans.modules.cloud.oracle.database.DatabaseItem;
+import org.netbeans.modules.cloud.oracle.developer.ContainerRepositoryItem;
+import org.netbeans.modules.cloud.oracle.developer.ContainerTagItem;
import org.netbeans.modules.cloud.oracle.items.OCIItem;
-import static org.netbeans.modules.java.lsp.server.explorer.DefaultDecorationsImpl.COOKIES_EXT;
import org.netbeans.modules.java.lsp.server.explorer.NodeLookupContextValues;
import org.netbeans.modules.java.lsp.server.explorer.api.TreeDataListener;
import org.netbeans.modules.java.lsp.server.explorer.api.TreeDataProvider;
import org.netbeans.modules.java.lsp.server.explorer.api.TreeItemData;
-import org.openide.filesystems.FileObject;
import org.openide.nodes.Node;
import org.openide.util.lookup.ServiceProvider;
@@ -46,21 +45,10 @@
public static final String CTXVALUE_CAP_REFERENCE_NAME = "cap:refName"; // NOI18N
public static final String CTXVALUE_PREFIX_REFERENCE_NAME = "cloudAssetsReferenceName:"; // NOI18N
-
- void readFiles(FileObject parent, List<String> lines) {
- if (parent == null) {
- return;
- }
- for (FileObject f : parent.getChildren()) {
- if (f.isData() && COOKIES_EXT.equals(f.getExt())) {
- try {
- f.asLines().stream().filter(s -> !s.trim().isEmpty() && !s.startsWith("#")).forEach(lines::add); // NOI18N
- } catch (IOException ex) {
- LOG.log(Level.WARNING, "Unable to read lookup items from {0}", f);
- }
- }
- }
- }
+ public static final String CTXVALUE_PREFIX_PUBLIC_IP = "publicIp:"; // NOI18N
+ public static final String CTXVALUE_PREFIX_IMAGE_URL = "imageUrl:"; // NOI18N
+ public static final String CTXVALUE_PREFIX_IMAGE_COUNT = "imageCount:"; // NOI18N
+ public static final String CTXVALUE_PREFIX_REPOSITORY_PUBLIC = "repositoryPublic:"; // NOI18N
@Override
public synchronized TreeDataProvider createProvider(String treeId) {
@@ -74,17 +62,40 @@
@Override
public TreeItemData createDecorations(Node n, boolean expanded) {
TreeItemData d = new TreeItemData();
- String refName = null;
+ String refName;
boolean set = false;
OCIItem item = n.getLookup().lookup(OCIItem.class);
- if (item != null) {
- refName = CloudAssets.getDefault().getReferenceName(item);
+ if (item == null) {
+ return null;
}
+ refName = CloudAssets.getDefault().getReferenceName(item);
if (refName != null) {
d.addContextValues(CTXVALUE_PREFIX_REFERENCE_NAME + refName);
set = true;
}
+ if (item instanceof ComputeInstanceItem) {
+ String publicIp = ((ComputeInstanceItem) item).getPublicIp();
+ if (publicIp != null) {
+ d.addContextValues(CTXVALUE_PREFIX_PUBLIC_IP + publicIp);
+ set = true;
+ }
+ }
+ if (item instanceof ContainerRepositoryItem) {
+ ContainerRepositoryItem repo = (ContainerRepositoryItem) item;
+ d.addContextValues(CTXVALUE_PREFIX_IMAGE_COUNT + repo.getImageCount());
+ d.addContextValues(CTXVALUE_PREFIX_REPOSITORY_PUBLIC + repo.getIsPublic());
+ set = true;
+ }
+ if (item instanceof ContainerTagItem) {
+ String imageUrl = ((ContainerTagItem) item).getUrl();
+ Optional<OCIItem> instance = CloudAssets.getDefault().getAssignedItems().stream().filter(i -> i.getClass().equals(ComputeInstanceItem.class)).findFirst();
+ if (instance.isPresent()) {
+ d.addContextValues(CTXVALUE_PREFIX_PUBLIC_IP + ((ComputeInstanceItem) instance.get()).getPublicIp());
+ }
+ d.addContextValues(CTXVALUE_PREFIX_IMAGE_URL + imageUrl);
+ set = true;
+ }
if (item instanceof BucketItem
|| item instanceof DatabaseItem) {
d.addContextValues(CTXVALUE_CAP_REFERENCE_NAME);
diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspOcidDecorationProvider.java b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspOcidDecorationProvider.java
new file mode 100644
index 0000000..fe144e0
--- /dev/null
+++ b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspOcidDecorationProvider.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.nbcode.integration;
+
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+import org.netbeans.modules.java.lsp.server.explorer.NodeLookupContextValues;
+import org.netbeans.modules.java.lsp.server.explorer.api.TreeDataListener;
+import org.netbeans.modules.java.lsp.server.explorer.api.TreeDataProvider;
+import org.netbeans.modules.java.lsp.server.explorer.api.TreeItemData;
+import org.openide.nodes.Node;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@ServiceProvider(service = TreeDataProvider.Factory.class, path = "Explorers/_all")
+public class LspOcidDecorationProvider implements TreeDataProvider.Factory {
+ public static final String CTXVALUE_PREFIX_OCID = "ocid:"; // NOI18N
+
+ @Override
+ public synchronized TreeDataProvider createProvider(String treeId) {
+ return new ProviderImpl(null);
+ }
+
+ static class ProviderImpl implements TreeDataProvider {
+ public ProviderImpl(NodeLookupContextValues lookupValues) {
+ }
+
+ @Override
+ public TreeItemData createDecorations(Node n, boolean expanded) {
+ TreeItemData d = new TreeItemData();
+
+ OCIItem item = n.getLookup().lookup(OCIItem.class);
+ if (item == null) {
+ return null;
+ }
+
+ d.addContextValues(CTXVALUE_PREFIX_OCID + item.getKey().getValue());
+ return d;
+ }
+
+ @Override
+ public void addTreeItemDataListener(TreeDataListener l) {
+ }
+
+ @Override
+ public void removeTreeItemDataListener(TreeDataListener l) {
+ }
+
+ @Override
+ public void nodeReleased(Node n) {
+ }
+
+ }
+}
diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/cloud-cookies.contextValues b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/cloud-cookies.contextValues
index bf496b1..2f6a716 100644
--- a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/cloud-cookies.contextValues
+++ b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/cloud-cookies.contextValues
@@ -25,4 +25,5 @@
org.netbeans.modules.cloud.oracle.compute.ClusterItem
org.netbeans.modules.cloud.oracle.compute.ComputeInstanceItem
org.netbeans.modules.cloud.oracle.bucket.BucketItem
-org.netbeans.modules.cloud.oracle.vault.VaultItem
\ No newline at end of file
+org.netbeans.modules.cloud.oracle.vault.VaultItem
+org.netbeans.modules.cloud.oracle.developer.ContainerRepositoryItem
\ No newline at end of file
diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/OCIDCommand.java b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/OCIDCommand.java
deleted file mode 100644
index 7cf88de..0000000
--- a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/OCIDCommand.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.nbcode.integration.commands;
-
-import com.google.gson.JsonPrimitive;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.netbeans.modules.cloud.oracle.items.OCIItem;
-import org.netbeans.modules.java.lsp.server.explorer.TreeNodeRegistry;
-import org.netbeans.modules.java.lsp.server.explorer.TreeViewProvider;
-import org.netbeans.spi.lsp.CommandProvider;
-import org.openide.nodes.Node;
-import org.openide.util.Lookup;
-import org.openide.util.lookup.ServiceProvider;
-
-/**
- *
- * @author Tomas Hurka
- */
-@ServiceProvider(service = CommandProvider.class)
-public class OCIDCommand implements CommandProvider {
-
- private static final Logger LOG = Logger.getLogger(OCIDCommand.class.getName());
-
- private static final String COMMAND_CLOUD_OCID_GET = "nbls.cloud.ocid.get"; // NOI18N
-
- public OCIDCommand() {
- }
-
- @Override
- public Set<String> getCommands() {
- return Collections.singleton(COMMAND_CLOUD_OCID_GET);
- }
-
- @Override
- public CompletableFuture<Object> runCommand(String command, List<Object> arguments) {
- if (arguments.size() < 1) {
- throw new IllegalArgumentException("Expected nodeid"); // NOI18N
- }
- TreeNodeRegistry r = Lookup.getDefault().lookup(TreeNodeRegistry.class);
- if (r == null) {
- return CompletableFuture.completedFuture(null);
- }
- int nodeId = ((JsonPrimitive) arguments.get(0)).getAsInt();
- LOG.log(Level.FINE, "Running OCID command with context: {0}", nodeId); // NOI18N
-
- TreeViewProvider nodeProvider = r.providerOf(nodeId);
- Node node = null;
- if (nodeProvider != null) {
- node = nodeProvider.findNode(nodeId);
- }
- if (node == null) {
- return CompletableFuture.completedFuture(null);
- }
- OCIItem item = node.getLookup().lookup(OCIItem.class);
- if (item != null) {
- return CompletableFuture.completedFuture(item.getKey().getValue());
- }
- return CompletableFuture.completedFuture(null);
- }
-}
diff --git a/java/java.lsp.server/vscode/package.json b/java/java.lsp.server/vscode/package.json
index f82349e..b5e49a8 100644
--- a/java/java.lsp.server/vscode/package.json
+++ b/java/java.lsp.server/vscode/package.json
@@ -474,6 +474,24 @@
"title": "Copy OCID"
},
{
+ "command": "nbls.cloud.publicIp.copy",
+ "title": "Copy the public IP address"
+ },
+ {
+ "command": "nbls.cloud.imageUrl.copy",
+ "title": "Copy pull command"
+ },
+ {
+ "command": "nbls.cloud.computeInstance.ssh",
+ "title": "Start SSH session",
+ "icon": "$(terminal)"
+ },
+ {
+ "command": "nbls.cloud.container.docker",
+ "title": "Run in Compute Instance",
+ "icon": "$(play)"
+ },
+ {
"command": "nbls.workspace.compile",
"title": "Compile Workspace",
"category": "Java"
@@ -774,6 +792,22 @@
"when": "false"
},
{
+ "command": "nbls.cloud.publicIp.copy",
+ "when": "false"
+ },
+ {
+ "command": "nbls.cloud.imageUrl.copy",
+ "when": "false"
+ },
+ {
+ "command": "nbls.cloud.computeInstance.ssh",
+ "when": "false"
+ },
+ {
+ "command": "nbls.cloud.container.docker",
+ "when": "false"
+ },
+ {
"command": "nbls:Database:netbeans.db.explorer.action.Connect",
"when": "false"
},
@@ -989,10 +1023,30 @@
},
{
"command": "nbls.cloud.ocid.copy",
- "when": "viewItem =~ /class:oracle.items.OCIItem/ && viewItem =~ /^(?!.*Suggested).*/",
+ "when": "viewItem =~ /ocid:.*/",
"group": "oci@1000"
},
{
+ "command": "nbls.cloud.publicIp.copy",
+ "when": "viewItem =~ /publicIp:.*/ && viewItem =~ /^(?!.*imageUrl:).*/",
+ "group": "oci@1000"
+ },
+ {
+ "command": "nbls.cloud.imageUrl.copy",
+ "when": "viewItem =~ /imageUrl:.*/",
+ "group": "oci@1000"
+ },
+ {
+ "command": "nbls.cloud.computeInstance.ssh",
+ "when": "viewItem =~ /publicIp:.*/ && viewItem =~ /^(?!.*imageUrl:).*/",
+ "group": "inline@10"
+ },
+ {
+ "command": "nbls.cloud.container.docker",
+ "when": "viewItem =~ /publicIp:.*/ && viewItem =~ /imageUrl:.*/",
+ "group": "inline@10"
+ },
+ {
"command": "nbls:Tools:org.netbeans.modules.cloud.oracle.actions.AddRepository",
"when": "viewItem =~ /class:oracle.devops.DevopsProjectItem/",
"group": "inline@12"
@@ -1004,7 +1058,7 @@
},
{
"command": "nbls:Tools:org.netbeans.modules.cloud.oracle.actions.AddToProject",
- "when": "viewItem =~ /(ComputeInstanceItem|ClusterItem|BucketItem|DatabaseItem|VaultItem)/ && view != cloud.assets",
+ "when": "viewItem =~ /(ComputeInstanceItem|ClusterItem|BucketItem|DatabaseItem|VaultItem|ContainerRepositoryItem)/ && view != cloud.assets",
"group": "inline@14"
},
{
@@ -1024,7 +1078,7 @@
},
{
"command": "nbls:Tools:org.netbeans.modules.cloud.oracle.actions.CloudRefresh",
- "when": "viewItem =~ /class:oracle/ && view != cloud.assets",
+ "when": "viewItem =~ /class:oracle/",
"group": "inline@13"
},
{
@@ -1122,6 +1176,14 @@
"codeicon": "server-environment"
},
{
+ "uriExpression": "nbres:/org/netbeans/modules/cloud/oracle/resources/containerrepository.svg",
+ "codeicon": "briefcase"
+ },
+ {
+ "uriExpression": "nbres:/org/netbeans/modules/cloud/oracle/resources/containertag.svg",
+ "codeicon": "tag"
+ },
+ {
"uriExpression": "nbres:/org/netbeans/modules/cloud/oracle/resources/cluster.svg",
"codeicon": "compass"
},
diff --git a/java/java.lsp.server/vscode/src/extension.ts b/java/java.lsp.server/vscode/src/extension.ts
index 1852cfa..ad8d47a 100644
--- a/java/java.lsp.server/vscode/src/extension.ts
+++ b/java/java.lsp.server/vscode/src/extension.ts
@@ -818,11 +818,42 @@
context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.cloud.ocid.copy',
async (node) => {
- const ocid : string = await commands.executeCommand(COMMAND_PREFIX + '.cloud.ocid.get', node.id);
+ const ocid = getValueAfterPrefix(node.contextValue, 'ocid:');
vscode.env.clipboard.writeText(ocid);
}
));
+ context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.cloud.publicIp.copy',
+ async (node) => {
+ const publicIp = getValueAfterPrefix(node.contextValue, 'publicIp:');
+ vscode.env.clipboard.writeText(publicIp);
+ }
+ ));
+
+ context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.cloud.imageUrl.copy',
+ async (node) => {
+ const imageUrl = getValueAfterPrefix(node.contextValue, 'imageUrl:');
+ vscode.env.clipboard.writeText("docker pull " + imageUrl);
+ }
+ ));
+
+ context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.cloud.computeInstance.ssh',
+ async (node) => {
+ const publicIp = getValueAfterPrefix(node.contextValue, 'publicIp:');
+ //TODO: For the first invocation for a given OCID, show instructions on how to set up SSH for a Compute Instance.
+ openSSHSession("opc", publicIp, node.label);
+ }
+ ));
+
+ context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.cloud.container.docker',
+ async (node) => {
+ const publicIp = getValueAfterPrefix(node.contextValue, 'publicIp:');
+ const imageUrl = getValueAfterPrefix(node.contextValue, 'imageUrl:');
+ //TODO: For the first invocation for a given OCID, show instructions on how to set up a Compute Instance.
+ runDockerSSH("opc", publicIp, imageUrl);
+ }
+ ));
+
const archiveFileProvider = <vscode.TextDocumentContentProvider> {
provideTextDocumentContent: async (uri: vscode.Uri, token: vscode.CancellationToken): Promise<string> => {
return await commands.executeCommand('nbls.get.archive.file.content', uri.toString());
@@ -898,6 +929,26 @@
}
}
+function openSSHSession(username: string, host: string, name?: string) {
+ let sessionName;
+ if (name === undefined) {
+ sessionName =`${username}@${host}`;
+ } else {
+ sessionName = name;
+ }
+
+ const terminal = vscode.window.createTerminal(`SSH: ${username}@${host}`);
+ terminal.sendText(`ssh ${username}@${host}`);
+ terminal.show();
+}
+
+function runDockerSSH(username: string, host: string, dockerImage: string) {
+ const sshCommand = `ssh ${username}@${host} "docker pull ${dockerImage} && docker run -p 8080:8080 -it ${dockerImage}"`;
+
+ const terminal = vscode.window.createTerminal('Remote Docker');
+ terminal.sendText(sshCommand);
+ terminal.show();
+}
function killNbProcess(notifyKill : boolean, log : vscode.OutputChannel, specProcess?: ChildProcess) : Promise<void> {
const p = nbProcess;
@@ -1314,7 +1365,21 @@
}
async decorateTreeItem(vis : Visualizer, item : vscode.TreeItem) : Promise<vscode.TreeItem> {
- item.description = getValueAfterPrefix(item.contextValue, "cloudAssetsReferenceName:");
+ const refName = getValueAfterPrefix(item.contextValue, "cloudAssetsReferenceName:");
+ if (refName !== undefined && refName !== null && refName.length > 0) {
+ item.description = refName;
+ return item;
+ }
+ const imageCount = getValueAfterPrefix(item.contextValue, "imageCount:");
+ const repositoryPublic: Boolean = "true" === getValueAfterPrefix(item.contextValue, "repositoryPublic:");
+ if (imageCount !== undefined && imageCount !== null && imageCount.length > 0) {
+ if (repositoryPublic) {
+ item.description = imageCount + " (public)";
+ } else {
+ item.description = imageCount + " (private)";
+ }
+ return item;
+ }
return item;
}