public static synchronized void instanceDelete(String uri) { BaseUtil.out("SuiteManager.instanceDelete uri=" + uri); if (uri == null) { BaseUtil.out("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! URI == NULL "); BaseUtil.out("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! URI == NULL "); return; } SuiteNodesNotifier suiteNotifier = SuiteManager.getServerSuiteProject(uri).getLookup().lookup(SuiteNodesNotifier.class); Properties props = ServerUtil.removeInstanceProperties(uri); // // Delete InstancePreferencies // String instancePath = SuiteUtil.extractInstancePath(uri); if (instancePath != null) { DirectoryPreferences registry = new DirectoryPreferences(Paths.get(instancePath)); registry.remove(); Project suite = getServerSuiteProject(uri); if (suite != null) { suite.getLookup().lookup(DistributeModulesManager.class).remove(instancePath); } // DistributeModulesManager m = getInstance(uri); } suiteNotifier.instancesChanged(); // Can invoke this method too }
protected static void saveInstanceProperties(Properties props) { BaseUtil.out("--- 1 SuiteManager : saveInstanceProperties()"); String uri = props.getProperty(BaseConstants.URL_PROP); String projDir = props.getProperty(BaseConstants.SERVER_LOCATION_PROP); if (uri == null) { BaseUtil.out("--- 2 SuiteManager : saveInstanceProperties() uri == null"); return; } BaseUtil.out("--- 3 SuiteManager : saveInstanceProperties() uri = " + uri); InstancePreferences prefs = getNbInstanceProperties(projDir, uri); props.forEach( (k, v) -> { BaseUtil.out( "--- 4 SuiteManager : saveInstanceProperties() key = " + k + "; value = " + v); prefs.setProperty((String) k, (String) v); }); }
public BaseDeployProgressObject destroy( BaseTargetModuleID module, FileObject projDir, boolean completeImmediately) { command = "destroy"; this.setTargetModuleID(module); setCompleteImmediately(completeImmediately); setMode(getManager().getCurrentDeploymentMode()); BaseUtil.out("command = 'destroy'"); fireRunning(CommandType.UNDEPLOY, getManager().getDefaultTarget().getName()); RP.post(this, 0, Thread.NORM_PRIORITY); return this; }
public static InstancePreferences getNbInstanceProperties(String instanceDir, String uri) { BaseUtil.out("**** 1 SuiteRegistry.getNbInstancePreferences instanceDir=" + instanceDir); BaseUtil.out("**** 2 SuiteRegistry.getNbInstancePreferences uri=" + uri); Project suite = SuiteManager.getServerSuiteProject(uri); FileObject fo = FileUtil.toFileObject(new File(instanceDir)); if (fo == null) { return null; } BaseUtil.out("**** 3 SuiteRegistry.getNbInstancePreferences fo.getPath()=" + fo.getPath()); // FileObject suite = SuiteManager.getServerSuiteProject(serverInstance) String uid = SuiteUtil.getSuiteUID(suite.getProjectDirectory()); BaseUtil.out("**** 4 SuiteRegistry.getNbInstancePreferences UID" + uid); if (uid == null) { return null; } BaseUtil.out("**** 5 NbSuitePreferences.getNbInstancePreferences UID" + uid); return NbSuitePreferences.newInstance(instanceDir, uid).getProperties(); }
protected static void updateInstanceRegistry(Properties props) { Path dirpath = Paths.get("d:\\Netbeans_810_Plugins\\TestApps\\AMEmbServer04"); NbDirectoryPreferences ppp = new NbDirectoryPreferences(dirpath, "uid-025c0287-3243-4a16-837e-94be30ecfc19"); int l = ppp.childrenNames().length; BaseUtil.out( "--- 0000001 SuiteManager : updateInstanceRegistry I test NbDirectoryPreferences lengt=" + l); BaseUtil.out("--- 1 SuiteManager : updateInstanceRegistry(Properties)"); String serverLocation = props.getProperty(BaseConstants.SERVER_LOCATION_PROP); BaseUtil.out( "--- 2 SuiteManager : updateInstanceRegistry(Properties) serverLocation = " + serverLocation); InstancePreferences prefs = getInstanceProperties(serverLocation); props.forEach( (k, v) -> { BaseUtil.out( "--- 2 SuiteManager : updateInstanceRegistry(Properties) key = " + k + "; value = " + v); prefs.setProperty((String) k, (String) v); }); String shutdownPort = props.getProperty(BaseConstants.SHUTDOWN_PORT_PROP); if (shutdownPort == null) { // Cannot be shutdownPort = String.valueOf(Integer.MAX_VALUE); prefs.setProperty(BaseConstants.SHUTDOWN_PORT_PROP, shutdownPort); } }
@Override public void run() { String command = this.command; // BaseUtil.out("BaseDeployProgressObject run command=" + command ); if (!isCompleteImmediately()) { // // actual execution // // BaseUtil.out("BaseDeployProgressObject run 1 command" + command ); executeServerCommand(); } CommandType commandType = CommandType.DISTRIBUTE; switch (command) { case "deploy": onDeploy(); commandType = CommandType.DISTRIBUTE; break; case "undeploy": onUndeploy(); commandType = CommandType.UNDEPLOY; break; case "redeploy": onRedeploy(); commandType = CommandType.REDEPLOY; break; case "start": commandType = CommandType.START; break; case "stop": commandType = CommandType.STOP; break; } try { fireCompleted(commandType, getManager().getDefaultTarget().getName()); } catch (Throwable ex) { BaseUtil.out("BaseDeploProgressObject run() EXCEPTION " + ex.getMessage()); LOG.log(Level.INFO, ex.getMessage()); } }