sdedic commented on code in PR #7700:
URL: https://github.com/apache/netbeans/pull/7700#discussion_r1734721128


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/MetricsItem.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.cloud.oracle.developer;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.netbeans.modules.cloud.oracle.adm.URLProvider;
+import org.netbeans.modules.cloud.oracle.items.OCID;
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author Dusan Petrovic
+ */
+public class MetricsItem extends OCIItem implements URLProvider {
+    
+    private static final String DEFAULT_AGGREGATION_FUNCTION = "mean()";
+    private static final String DEFAULT_INTERVAL = "1m";
+    private static final String BASE_URL = 
"https://cloud.oracle.com/monitoring/explore";;
+    private static final String DEFAULT_ADVANCED_MODE = "false";
+    private static final String DEFAULT_AGGREGATE_METRICS = "false";
+
+    final String namespace;
+    final String region;
+
+    public MetricsItem(String compartmentId, String name, String namespace, 
String region) {
+        super(OCID.of(null, "MetricsNamespace/Metrics"), compartmentId, name);
+        this.namespace = namespace;
+        this.region = region;
+    }
+    
+    public String getNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public URL getURL() {
+        StringBuilder sb = new StringBuilder(BASE_URL);
+        sb.append("?");
+        
sb.append("panelConfigs[0][advanced]=").append(DEFAULT_ADVANCED_MODE).append("&");

Review Comment:
   rfc1738 says that `[]()` are considered unsafe in URLs. Not sure if they're 
still unsafe nowadays.



##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/DependencyUtils.java:
##########
@@ -64,4 +56,39 @@ public static void addDependency(Project project, String 
groupId, String artifac
         }
     }
     
+    public static void addAnnotationProcessor(Project project, String groupId, 
String artifactId) {
+        Project projectToModify = getProjectToModify(project, "lib");
+        
+        if (projectToModify != null) {
+            ArtifactSpec spec = ArtifactSpec.make(groupId, artifactId);
+            Dependency dep = Dependency.make(spec, Scopes.PROCESS);
+            DependencyChange change = 
DependencyChange.builder(DependencyChange.Kind.ADD)
+                    .dependency(dep)
+                    .create();
+
+            try {
+                ModificationResult mod = ProjectDependencies
+                        .modifyDependencies(projectToModify, new 
DependencyChangeRequest(Collections.singletonList(change)));
+                mod.commit();
+            } catch (IOException | DependencyChangeException | 
ProjectOperationException ex) {
+                throw new IllegalStateException(ex);

Review Comment:
   I am not sure with the handling here. IOException and 
ProjectOperationException are generic failures (no chance to handle, IMHO), but 
`DependencyChangeException` indicates that perhaps the dependency is already 
there or other 'recoverable' failure (?)



##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/resources/metrics.svg:
##########


Review Comment:
   Is this the correct icon ?



##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/AddNewAssetCommand.java:
##########
@@ -117,8 +124,10 @@ public CompletableFuture<Object> runCommand(String 
command, List<Object> argumen
                     item.thenAccept(i -> {
                         CloudAssets.getDefault().addItem(i);
                         String[] art = DEP_MAP.get(i.getKey().getPath());
+                        String[] processor = 
ANNOTATION_PROCESSOR_MAP.get(i.getKey().getPath());

Review Comment:
   Could be the result of `.get()` ever `null` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to