Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding compartment id to all oci items, adding new item types #7371

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions enterprise/cloud.oracle/external/binaries-list
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ E46F0CE2219BBCDA94B87D4CB4EF4166DAF6C925 com.oracle.oci.sdk:oci-java-sdk-identit
A8B7EBCA334E8145469A8FE0365C02A2727218EE com.oracle.oci.sdk:oci-java-sdk-common-httpclient:3.25.3
AECECCD95E5ED92C73E455B7BA4AC714229041EE com.oracle.oci.sdk:oci-java-sdk-common-httpclient-jersey:3.25.3
0CEE99CE7AA783353D19C56AC9F1AD72485DDBE8 com.oracle.oci.sdk:oci-java-sdk-addons-apache-configurator-jersey:3.25.3
7084E5AE185230ACB52943C4AA0D0B8B890686A4 com.oracle.oci.sdk:oci-java-sdk-objectstorage:3.25.3
D9918C04C60741D1BBEFBCC82E9D3B8BE690D412 com.oracle.oci.sdk:oci-java-sdk-objectstorage-generated:3.25.3
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

E5F6CAE5CA7ECAAC1EC2827A9E2D65AE2869CADA org.apache.httpcomponents:httpclient:4.5.13
853B96D3AFBB7BF8CC303FE27EE96836A10C1834 org.apache.httpcomponents:httpcore:4.4.13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description: Oracle Cloud Infrastructure SDK for Java
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
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

Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.

Expand Down
7 changes: 6 additions & 1 deletion enterprise/cloud.oracle/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ release.external/oci-java-sdk-adm-3.25.3.jar=modules/ext/oci-java-sdk-adm-3.25.3
release.external/oci-java-sdk-common-httpclient-3.25.3.jar=modules/ext/oci-java-sdk-common-httpclient-3.25.3.jar
release.external/oci-java-sdk-common-httpclient-jersey-3.25.3.jar=modules/ext/oci-java-sdk-common-httpclient-jersey-3.25.3.jar
release.external/oci-java-sdk-addons-apache-configurator-jersey-3.25.3.jar=modules/ext/oci-java-sdk-addons-apache-configurator-jersey-3.25.3.jar
release.external/oci-java-sdk-objectstorage-3.25.3.jar=modules/ext/oci-java-sdk-objectstorage-3.25.3.jar
release.external/oci-java-sdk-objectstorage-generated-3.25.3.jar=modules/ext/oci-java-sdk-objectstorage-generated-3.25.3.jar
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/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
release.external/resilience4j-circuitbreaker-1.7.1.jar=modules/ext/resilience4j-circuitbreaker-1.7.1.jar
release.external/resilience4j-core-1.7.1.jar=modules/ext/resilience4j-core-1.7.1.jar
release.external/vavr-0.10.2.jar=modules/ext/vavr-0.10.2.jar
release.external/vavr-match-0.10.2.jar=modules/ext/vavr-match-0.10.2.jar
javac.source=1.8
javac.source=11
javac.compilerargs=-Xlint -Xlint:-serial
spec.version.base.fatal.warning=false
20 changes: 20 additions & 0 deletions enterprise/cloud.oracle/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,26 @@
<runtime-relative-path>ext/oci-java-sdk-addons-apache-configurator-jersey-3.25.3.jar</runtime-relative-path>
<binary-origin>external/oci-java-sdk-addons-apache-configurator-jersey-3.25.3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/oci-java-sdk-objectstorage-3.25.3.jar</runtime-relative-path>
<binary-origin>external/oci-java-sdk-objectstorage-3.25.3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/oci-java-sdk-objectstorage-generated-3.25.3.jar</runtime-relative-path>
<binary-origin>external/oci-java-sdk-objectstorage-generated-3.25.3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/oci-java-sdk-objectstorage-extensions-3.25.3.jar</runtime-relative-path>
<binary-origin>external/oci-java-sdk-objectstorage-extensions-3.25.3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/oci-java-sdk-core-3.25.3.jar</runtime-relative-path>
<binary-origin>external/oci-java-sdk-core-3.25.3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/oci-java-sdk-containerengine-3.25.3.jar</runtime-relative-path>
<binary-origin>external/oci-java-sdk-containerengine-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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public NotifyDescriptor createInput(NotifyDescriptor.ComposedInput input, int nu
AbstractPasswordPanel.generatePassword(),
(String) result.get(USERNAME),
((String) result.get(PASSWORD)).toCharArray(),
selectedDatabase.getKey().getValue());
selectedDatabase.getKey().getValue(),
selectedDatabase.getCompartmentId());
action.addConnection(info);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
Expand Down Expand Up @@ -269,9 +270,9 @@ private abstract class FlatCompartmentItem extends CompartmentItem {
private String flatName;

private FlatCompartmentItem(Compartment ociComp) {
super(OCID.of(ociComp.getId(), "Compartment"), ociComp.getName()); // NOI18N
super(OCID.of(ociComp.getId(), "Compartment"), ociComp.getCompartmentId(), ociComp.getName()); // NOI18N
setDescription(ociComp.getDescription());
parentId = OCID.of(ociComp.getCompartmentId(), "Compartment"); // NOI18N
parentId = OCID.of(ociComp.getCompartmentId(), "Compartment"); // NOI18N
}

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ private void addDbConnectionToVault(Result item) {
put("Username", context.getUser()); //NOI18N
put("Password", item.password); //NOI18N
put("OCID", (String) context.getConnectionProperties().get("OCID")); //NOI18N
put("CompartmentOCID", (String) context.getConnectionProperties().get("CompartmentOCID")); //NOI18N
put("wallet_Password", UUID.randomUUID().toString()); //NOI18N
}
};
Expand Down Expand Up @@ -953,7 +954,7 @@ private static abstract class FlatCompartmentItem extends CompartmentItem {
private String flatName;

private FlatCompartmentItem(Compartment ociComp) {
super(OCID.of(ociComp.getId(), "Compartment"), ociComp.getName()); // NOI18N
super(OCID.of(ociComp.getId(), "Compartment"), ociComp.getCompartmentId(), ociComp.getName()); // NOI18N
setDescription(ociComp.getDescription());
parentId = OCID.of(ociComp.getCompartmentId(), "Compartment"); // NOI18N
}
Expand Down Expand Up @@ -991,6 +992,7 @@ protected static Map<String, DevopsProjectItem> getDevopsProjects(String compart
}
return projects.stream()
.map(p -> new DevopsProjectItem(OCID.of(p.getId(), "DevopsProject"), // NOI18N
compartmentId,
p.getName()))
.collect(Collectors.toMap(DevopsProjectItem::getName, Function.identity()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ void addConnection(DownloadWalletDialog.WalletInfo p) {
}
Properties props = new Properties();
props.put("OCID", p.getOcid()); //NOI18N
props.put("CompartmentOCID", p.getOcid()); //NOI18N
String dbUrl = MessageFormat.format(URL_TEMPLATE, connectionName, BaseUtilities.escapeParameters(new String[] { walletPath.toString() }));
DatabaseConnection dbConn = DatabaseConnection.create(
drivers[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static Optional<WalletInfo> showDialog(OCIItem db) {
String dbUser = dlgPanel.dbUserField.getText();
char[] dbPasswd = dlgPanel.dbPasswordField.getPassword();
NbPreferences.forModule(DownloadWalletAction.class).put(LAST_USED_DIR, path); //NOI18N
return Optional.of(new WalletInfo(path, generatePassword(), dbUser, dbPasswd, db.getKey().getValue()));
return Optional.of(new WalletInfo(path, generatePassword(), dbUser, dbPasswd, db.getKey().getValue(), db.getCompartmentId()));
}
} else {
try {
Expand All @@ -111,7 +111,7 @@ static Optional<WalletInfo> showDialog(OCIItem db) {
return Optional.empty();
}
char[] password = inp.getInputText().toCharArray();
return Optional.of(new WalletInfo(walletsDir.getAbsolutePath(), generatePassword(), username, password, db.getKey().getValue()));
return Optional.of(new WalletInfo(walletsDir.getAbsolutePath(), generatePassword(), username, password, db.getKey().getValue(), db.getCompartmentId()));
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
Expand Down Expand Up @@ -302,18 +302,20 @@ public void changedUpdate(DocumentEvent e) {
}

static class WalletInfo {
private String path;
private char[] walletPassword;
private String dbUser;
private final String path;
private final char[] walletPassword;
private final String dbUser;
private char[] dbPassword;
private String ocid;
private final String ocid;
private final String comaprtmentId;

public WalletInfo(String path, char[] walletPassword, String dbUser, char[] dbPassword, String ocid) {
public WalletInfo(String path, char[] walletPassword, String dbUser, char[] dbPassword, String ocid, String comaprtmentOcid) {
this.path = path;
this.walletPassword = walletPassword;
this.dbUser = dbUser;
this.dbPassword = dbPassword;
this.ocid = ocid;
this.comaprtmentId = comaprtmentOcid;
}

public String getPath() {
Expand All @@ -335,6 +337,10 @@ public char[] getDbPassword() {
public String getOcid() {
return ocid;
}

public String getComaprtmentId() {
return comaprtmentId;
}
}

// Variables declaration - do not modify//GEN-BEGIN:variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,13 @@ public class KnowledgeBaseItem extends OCIItem implements URLProvider{
private static Map<OCID, Collection<Reference<KnowledgeBaseItem>>> itemInstances = new HashMap<>();

protected final Date timeUpdated;
protected final String compartmentId;

public KnowledgeBaseItem(OCID id, String compartmentId, String displayName, Date timeUpdated) {
super(id, displayName);
super(id, compartmentId, displayName);
this.timeUpdated = timeUpdated;
this.compartmentId = compartmentId;
registerItem();
}

public String getCompartmentId() {
return compartmentId;
}

void registerItem() {
synchronized (KnowledgeBaseItem.class) {
itemInstances.computeIfAbsent(getKey(), x -> new ArrayList<>()).add(new WeakReference<>(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.netbeans.modules.cloud.oracle.adm;

import com.oracle.bmc.adm.ApplicationDependencyManagementClient;
import com.oracle.bmc.adm.model.KnowledgeBase;
import com.oracle.bmc.adm.model.KnowledgeBaseSummary;
import com.oracle.bmc.adm.requests.ListKnowledgeBasesRequest;
import com.oracle.bmc.adm.responses.ListKnowledgeBasesResponse;
Expand Down Expand Up @@ -83,10 +84,13 @@ public static ChildrenProvider.SessionAware<CompartmentItem, KnowledgeBaseItem>
= session.newClient(ApplicationDependencyManagementClient.class)) {

ListKnowledgeBasesRequest request = ListKnowledgeBasesRequest.builder()
.compartmentId(compartment.getKey().getValue()).build();
.compartmentId(compartment.getKey().getValue())
.lifecycleState(KnowledgeBase.LifecycleState.Active)
.build();
ListKnowledgeBasesResponse response = client.listKnowledgeBases(request);
List<KnowledgeBaseSummary> projects = response.getKnowledgeBaseCollection().getItems();
return projects.stream().map(p -> new KnowledgeBaseItem(
return projects.stream()
.map(p -> new KnowledgeBaseItem(
OCID.of(p.getId(), "KnowledgeBase"), // NOI18N
p.getCompartmentId(),
p.getDisplayName(), p.getTimeUpdated())).collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ public CompletableFuture<KnowledgeBaseItem> findKnowledgeBase(String knowledgeBa
* + presented in the IDE UI.
*/
static class KnowledgeBaseItemProxy extends KnowledgeBaseItem {
public KnowledgeBaseItemProxy(OCID id, String compartmentId, String displayName, Date timeUpdated) {
super(id, compartmentId, displayName, timeUpdated);
public KnowledgeBaseItemProxy(OCID id, String compartmenId, String displayName, Date timeUpdated) {
super(id, compartmenId, displayName, timeUpdated);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ public AuditResult vulnerabilityAudit(Project project, AuditOptions auditOptions
auditOptions.setAuditName(projectDisplayName);
}
try {
return doFindVulnerability(project, kbItem.compartmentId, kbItem.getKey().getValue(),
return doFindVulnerability(project, kbItem.getCompartmentId(), kbItem.getKey().getValue(),
projectDisplayName, auditOptions, progressHandle, remoteCall);
} finally {
if (remoteCall.get()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.assets;

import org.netbeans.modules.cloud.oracle.items.OCID;
import org.netbeans.modules.cloud.oracle.items.OCIItem;

/**
*
* @author Jan Horvath
*/
public final class SuggestedItem extends OCIItem {

private final String path;

public SuggestedItem(String path, String name) {
super(OCID.of("", "Suggested"), null, name); //NOI18N
this.path = path;
}

public String getPath() {
return path;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.assets;

import org.netbeans.modules.cloud.oracle.NodeProvider;
import org.netbeans.modules.cloud.oracle.OCINode;
import org.netbeans.modules.cloud.oracle.items.OCIItem;

/**
*
* @author Jan Horvath
*/
public class SuggestedNode extends OCINode {

private static final String SUGGEST_ICON = "org/netbeans/modules/cloud/oracle/resources/suggest.svg"; // NOI18N

public SuggestedNode(OCIItem item) {
super(item);
setName(item.getName());
setDisplayName(item.getName());
setIconBaseWithExtension(SUGGEST_ICON);
setShortDescription(item.getDescription());
}

public static NodeProvider<OCIItem> createNode() {
return SuggestedNode::new;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.bucket;

import org.netbeans.modules.cloud.oracle.items.OCID;
import org.netbeans.modules.cloud.oracle.items.OCIItem;

/**
*
* @author Jan Horvath
*/
public final class BucketItem extends OCIItem {

private String namespace;

public BucketItem(OCID id, String compartmentId, String name, String namespace) {
super(id, compartmentId, name);
this.namespace = namespace;
}

public BucketItem() {
super();
}

public String getNamespace() {
return namespace;
}

@Override
public int maxInProject() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: the base class impl returns 0; is there a difference between "infinite" value and 0 ?

return Integer.MAX_VALUE;
}

}
Loading
Loading