Refine search
private ServerEnvironment createStandaloneServerEnvironment() { Properties props = new Properties(); File home = new File("target/jbossas"); delete(home); home.mkdir(); delay(10); props.put(ServerEnvironment.HOME_DIR, home.getAbsolutePath()); File standalone = new File(home, "standalone"); standalone.mkdir(); props.put(ServerEnvironment.SERVER_BASE_DIR, standalone.getAbsolutePath()); File configuration = new File(standalone, "configuration"); configuration.mkdir(); props.put(ServerEnvironment.SERVER_CONFIG_DIR, configuration.getAbsolutePath()); File xml = new File(configuration, "standalone.xml"); try { xml.createNewFile(); } catch (IOException e) { throw new RuntimeException(e); } props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml"); ProductConfig pc = new ProductConfig("Test", Version.AS_VERSION, "main"); return new ServerEnvironment(null, props, new HashMap<String, String>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), pc, false); }
public String getPrettyProductName() { final String result; if(productName != null) { result = ProductConfig.getPrettyVersionString(productName, productVersion, releaseVersion); } else { result = ProductConfig.getPrettyVersionString(null, releaseVersion, releaseCodeName); } return result; }
public static void registerRootResource(Resource rootResource, ProductConfig cfg) { ModelNode model = rootResource.getModel(); model.get(ModelDescriptionConstants.MANAGEMENT_MAJOR_VERSION).set(Version.MANAGEMENT_MAJOR_VERSION); model.get(ModelDescriptionConstants.MANAGEMENT_MINOR_VERSION).set(Version.MANAGEMENT_MINOR_VERSION); model.get(ModelDescriptionConstants.MANAGEMENT_MICRO_VERSION).set(Version.MANAGEMENT_MICRO_VERSION); model.get(ModelDescriptionConstants.RELEASE_VERSION).set(Version.AS_VERSION); model.get(ModelDescriptionConstants.RELEASE_CODENAME).set(Version.AS_RELEASE_CODENAME); if (cfg != null) { if (cfg.getProductVersion() != null) { model.get(ModelDescriptionConstants.PRODUCT_VERSION).set(cfg.getProductVersion()); } if (cfg.getProductName() != null) { model.get(ModelDescriptionConstants.PRODUCT_NAME).set(cfg.getProductName()); } } } }
public static ProductConfig fromFilesystemSlot(ModuleLoader loader, String home, Map<?, ?> providedProperties) { return new ProductConfig(loader, getProductConfProperties(home), providedProperties); }
private static boolean handleHelpOrVersion(String arg, String jbossHome) { if (CommandLineConstants.HELP.equals(arg) || CommandLineConstants.SHORT_HELP.equals(arg) || CommandLineConstants.OLD_HELP.equals(arg)) { usage(); return true; } else if (CommandLineConstants.VERSION.equals(arg) || CommandLineConstants.SHORT_VERSION.equals(arg) || CommandLineConstants.OLD_VERSION.equals(arg) || CommandLineConstants.OLD_SHORT_VERSION.equals(arg)) { System.out.println(ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), jbossHome, null).getPrettyVersionString()); return true; } return false; }
if (CommandLineConstants.VERSION.equals(arg) || CommandLineConstants.SHORT_VERSION.equals(arg) || CommandLineConstants.OLD_VERSION.equals(arg) || CommandLineConstants.OLD_SHORT_VERSION.equals(arg)) { productConfig = new ProductConfig(Module.getBootModuleLoader(), SecurityActions.getSystemProperty(ServerEnvironment.HOME_DIR), null); System.out.println(productConfig.getPrettyVersionString()); return null; } else if (CommandLineConstants.HELP.equals(arg) || CommandLineConstants.SHORT_HELP.equals(arg) || CommandLineConstants.OLD_HELP.equals(arg)) { productConfig = new ProductConfig(Module.getBootModuleLoader(), SecurityActions.getSystemProperty(ServerEnvironment.HOME_DIR), systemProperties); return new ServerEnvironment(hostControllerName, systemProperties, systemEnvironment, serverConfig, initialServerConfig, launchType, runningMode, productConfig);
final String resultingVersion = productConfig.getProductVersion() + "-Release1"; Patch releasePatch = PatchBuilder.create() .setPatchId(releasePatchID) productConfig = new ProductConfig(productConfig.getProductName(), productConfig.getProductVersion() + "-Release1", productConfig.getConsoleSlot()); .setDescription(randomString()) .oneOffPatchIdentity(productConfig.getProductName(), resultingVersion) .getParent() .oneOffPatchElement(oneOffLayerPatchID, BASE, false)
final ProductConfig config = serverEnvironment.getProductConfig(); final String prettyVersion = config.getPrettyVersionString(); ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion); if (System.getSecurityManager() != null) { final BootstrapListener bootstrapListener = new BootstrapListener(container, startTime, serviceTarget, futureContainer, prettyVersion, serverEnvironment.getServerTempDir()); bootstrapListener.getStabilityMonitor().addController(myController); if(serverEnvironment.useGit()) { GitContentRepository.addService(serviceTarget, serverEnvironment.getGitRepository(), serverEnvironment.getServerContentDir(), serverEnvironment.getServerTempDir()); } else {
if (CommandLineConstants.VERSION.equals(arg) || CommandLineConstants.SHORT_VERSION.equals(arg) || CommandLineConstants.OLD_VERSION.equals(arg) || CommandLineConstants.OLD_SHORT_VERSION.equals(arg)) { productConfig = ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.HOME_DIR, null), null); STDOUT.println(productConfig.getPrettyVersionString()); return new ServerEnvironmentWrapper (ServerEnvironmentWrapper.ServerEnvironmentStatus.NORMAL); } else if (CommandLineConstants.HELP.equals(arg) || CommandLineConstants.SHORT_HELP.equals(arg) || CommandLineConstants.OLD_HELP.equals(arg)) { productConfig = ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.HOME_DIR, null), systemProperties); return new ServerEnvironmentWrapper(new ServerEnvironment(hostControllerName, systemProperties, systemEnvironment, serverConfig, configInteractionPolicy, launchType, runningMode, productConfig, startTime, startSuspended, gitRepository, gitBranch, gitAuthConfiguration));
ProductConfig config = new ProductConfig("Vodka"); config.alcohol = 0.38; config.size = 0.7; config.price = 17.99; Product p = new Product(config);
@Override public synchronized void stop(final StopContext context) { //Moved to AbstractControllerService.stop() //processState.setStopping(); CurrentServiceContainer.setServiceContainer(null); String prettyVersion = configuration.getServerEnvironment().getProductConfig().getPrettyVersionString(); ServerLogger.AS_ROOT_LOGGER.serverStopped(prettyVersion, Integer.valueOf((int) (context.getElapsedTime() / 1000000L))); BootstrapListener.deleteStartupMarker(configuration.getServerEnvironment().getServerTempDir()); }
deploymentInfo.setServerName(serverEnvironmentInjectedValue.getValue().getProductConfig().getPrettyVersionString()); if (undertowService.getValue().isStatisticsEnabled()) { deploymentInfo.setMetricsCollector(new UndertowMetricsCollector());
private static boolean handleHelpOrVersion(String arg, String jbossHome) { if (CommandLineConstants.HELP.equals(arg) || CommandLineConstants.SHORT_HELP.equals(arg) || CommandLineConstants.OLD_HELP.equals(arg)) { usage(); return true; } else if (CommandLineConstants.VERSION.equals(arg) || CommandLineConstants.SHORT_VERSION.equals(arg) || CommandLineConstants.OLD_VERSION.equals(arg) || CommandLineConstants.OLD_SHORT_VERSION.equals(arg)) { System.out.println(new ProductConfig(Module.getBootModuleLoader(), jbossHome, null).getPrettyVersionString()); return true; } return false; }
final ServerEnvironment serverEnvironment = configuration.getServerEnvironment(); String prettyVersion = serverEnvironment.getProductConfig().getPrettyVersionString(); AS_ROOT_LOGGER.serverStarting(prettyVersion); if (CONFIG_LOGGER.isDebugEnabled()) { ContentRepository.Factory.addService(serviceTarget, serverEnvironment.getServerContentDir()); } else { RemoteFileRepositoryService.addService(serviceTarget, serverEnvironment.getServerContentDir());
final HttpManagementService service = new HttpManagementService(consoleMode, environment.getProductConfig().getConsoleSlot()); ServiceBuilder<HttpManagement> builder = serviceTarget.addService(HttpManagementService.SERVICE_NAME, service) .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector())
@Override public AsyncFuture<ServiceContainer> run(final List<ServiceActivator> runServices) { final Bootstrap bootstrap = Bootstrap.Factory.newInstance(); final ProductConfig productConfig = ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), home, properties); final ServerEnvironment providedEnvironment = new ServerEnvironment(hostControllerName, properties, WildFlySecurityManager.getSystemEnvironmentPrivileged(), null, null, ServerEnvironment.LaunchType.DOMAIN, RunningMode.NORMAL, productConfig, Module.getStartTime(), suspend, null, null, null);
public String getProductName() { if (serverEnvironment.getProductConfig() != null && serverEnvironment.getProductConfig().getProductName() != null) { return serverEnvironment.getProductConfig().getProductName(); } return null; } };
ManagedAuditLogger createAuditLogger() { return new ManagedAuditLoggerImpl(getProductConfig().resolveVersion(), true); } }
@Test public void installedLayer() throws Exception { String layerName = randomString(); installLayers(layerName); TestUtils.tree(env.getInstalledImage().getJbossHome()); InstalledIdentity installedIdentity = loadInstalledIdentity(); Identity identity = installedIdentity.getIdentity(); assertEquals(productConfig.getProductName(), identity.getName()); assertEquals(productConfig.resolveVersion(), identity.getVersion()); List<Layer> layers = installedIdentity.getLayers(); assertEquals(2, layers.size()); Layer layer = layers.get(0); assertEquals(layerName, layer.getName()); assertEquals(BASE, layers.get(1).getName()); // base layer is always appended PatchableTarget.TargetInfo targetInfo = layer.loadTargetInfo(); assertEquals(BASE, targetInfo.getCumulativePatchID()); assertTrue(targetInfo.getPatchIDs().isEmpty()); DirectoryStructure directoryStructure = targetInfo.getDirectoryStructure(); assertEquals(newFile(env.getModuleRoot(), "system", "layers", layerName), directoryStructure.getModuleRoot()); assertNull(directoryStructure.getBundleRepositoryRoot()); }
private void prepareCP3(final InstalledIdentity installedIdentity) throws IOException, Exception { final String cp3ID = "CP3"; final File cp3Dir = mkdir(tempDir, cp3ID); cp3StandaloneModified = ContentModificationUtils.modifyMisc(cp3Dir, cp3ID, "updated by cp3", standaloneSh, "bin", standaloneSh.getName()); cp3BaseModuleModified = ContentModificationUtils.modifyModule(cp3Dir, baseCP3ID, moduleName, cp2BaseModuleModified.getItem().getContentHash(), "cp3 content"); // cp3BaseModule2Added = ContentModificationUtils.addModule(cp3Dir, baseCP3ID, moduleName + "2"); the patchgen tool // would generate an update instead final File absentModuleXml = IoUtils.newFile(installedIdentity.getLayer("base").loadTargetInfo() .getDirectoryStructure().getModulePatchDirectory(baseCP2ID), "org", "jboss", "test2", "main", "module.xml"); cp3BaseModule2Added = ContentModificationUtils.modifyModule(cp3Dir, baseCP3ID, moduleName + "2", HashUtils.hashFile(absentModuleXml), "cp3 content"); final ContentModification cp3AddedByCP1RemovedByCP3Removed = ContentModificationUtils.removeMisc(addedByCP1RemovedByCP3, "bin", addedByCP1RemovedByCP3.getName()); cp3 = PatchBuilder.create() .setPatchId(cp3ID) .setDescription(randomString()) .upgradeIdentity(installedIdentity.getIdentity().getName(), productConfig.getProductVersion() + "_CP2", productConfig.getProductVersion() + "_CP3") .getParent() .upgradeElement(baseCP3ID, BASE, false) .addContentModification(cp3BaseModuleModified) .addContentModification(cp3BaseModule2Added) .getParent() .addContentModification(cp3StandaloneModified) .addContentModification(cp3AddedByCP1RemovedByCP3Removed) .build(); createPatchXMLFile(cp3Dir, cp3); cp3Zip = createZippedPatchFile(cp3Dir, cp3ID); }