private Properties transformProps(List<Property> domainProps) { Properties props = new Properties(); for (Property domainProp : domainProps) { props.setProperty(domainProp.getName(), domainProp.getValue()); } return props; } }
private void createProperty(Property p) throws PropertyVetoException { for (int i = 0; i < parser.getAttributeCount(); i++) { String attr = parser.getAttributeLocalName(i); String val = parser.getAttributeValue(i); if (attr.equals("name")) { p.setName(val); } if (attr.equals("value")) { p.setValue(val); } } }
private void populateAuthRealmElement(AuthRealm newAuthRealm) throws PropertyVetoException, TransactionFailure { newAuthRealm.setName(authRealmName); newAuthRealm.setClassname(className); if (properties != null) { for (Object propname: properties.keySet()) { Property newprop = newAuthRealm.createChild(Property.class); newprop.setName((String) propname); String propValue = properties.getProperty((String) propname); newprop.setValue(propValue); newAuthRealm.getProperty().add(newprop); } } }
final ActionReport report = context.getActionReport(); if (fileProp.getName().equals("file")) keyFile = fileProp.getValue(); report.setMessage( localStrings.getLocalString("list.file.user.keyfilenotfound", "There is no physical file associated with this file realm {0} ", authRealmName)); if (!exists) { report.setMessage( localStrings.getLocalString("file.realm.keyfilenonexistent", "The specified physical file {0} associated with the file realm {1} does not exist.", new Object[]{keyFile, authRealmName})); CreateFileUser.refreshRealm(config.getName(), authRealmName); fr = (FileRealm) realmsManager.getFromLoadedRealms(config.getName(),authRealmName); if (fr == null) { throw new NoSuchRealmException(authRealmName); Properties extraProperties = new Properties(); extraProperties.put("users", userList); report.setExtraProperties(extraProperties); report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
final ActionReport report = context.getActionReport(); Server targetServer = domain.getServerNamed(target); if (targetServer != null) { config = domain.getConfigNamed(targetServer.getConfigRef()); com.sun.enterprise.config.serverbeans.Cluster cluster = domain.getClusterNamed(target); final SecurityService securityService = config.getSecurityService(); if (fileProp.getName().equals("file")) keyFile = fileProp.getValue(); localStrings.getLocalString("list.file.user.keyfilenotfound", "There is no physical file associated with this file realm {0} ", authRealmName)); CreateFileUser.refreshRealm(config.getName(), authRealmName); fr = (FileRealm) realmsManager.getFromLoadedRealms(config.getName(),authRealmName); if (fr == null) { throw new NoSuchRealmException(authRealmName); Properties extraProperties = new Properties(); extraProperties.put("users", userList);
public void decorate(AdminCommandContext context, final LbConfig instance) throws TransactionFailure, PropertyVetoException { Logger logger = LogDomains.getLogger(LbConfig.class, LogDomains.ADMIN_LOGGER); LocalStringManagerImpl localStrings = new LocalStringManagerImpl(LbConfig.class); String msg = localStrings.getLocalString("RequiredTargetOrConfig", "Neither LB config name nor target specified"); throw new TransactionFailure(msg); String msg = localStrings.getLocalString("LbConfigExists", config_name); throw new TransactionFailure(msg); if (domain.getClusterNamed(target) != null) { ClusterRef cRef = instance.createChild(ClusterRef.class); cRef.setRef(target); instance.getClusterRefOrServerRef().add(cRef); } else if (domain.isServer(target)) { ServerRef sRef = instance.createChild(ServerRef.class); sRef.setRef(target); for (Object propname: properties.keySet()) { Property newprop = instance.createChild(Property.class); newprop.setName((String) propname); newprop.setValue(properties.getProperty((String) propname)); instance.getProperty().add(newprop);
@Override public boolean contains(Object o) { if (!(o instanceof Property)) { return false; } Property prop = Property.class.cast(o); String value = delegate.getProperties().getProperty(prop.getName()); return value != null && value.equals(prop.getValue()); }
@Override public boolean add(Property e) { Property prop = Property.class.cast(e); Object old = delegate.getProperties().setProperty(prop.getName(), prop.getValue()); return old != null; }
private JdbcResource createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure { JdbcResource jdbcResource = param.createChild(JdbcResource.class); jdbcResource.setJndiName(jndiName); if (description != null) { jdbcResource.setDescription(description); } jdbcResource.setPoolName(poolName); jdbcResource.setEnabled(enabled); if (properties != null) { for ( Map.Entry e : properties.entrySet()) { Property prop = jdbcResource.createChild(Property.class); prop.setName((String)e.getKey()); prop.setValue((String)e.getValue()); jdbcResource.getProperty().add(prop); } } return jdbcResource; }
Configurations configs = externalService.createChild(Configurations.class); for (Map.Entry e : configuration.entrySet()) { Configuration config = configs.createChild(Configuration.class); config.setName((String) e.getKey()); for (Map.Entry e : configuration.entrySet()) { Property prop = externalService.createChild(Property.class); prop.setName((String) e.getKey()); prop.setValue((String) e.getValue()); externalService.getProperty().add(prop); for (Map.Entry e : properties.entrySet()) { Property prop = externalService.createChild(Property.class); prop.setName((String) e.getKey()); prop.setValue((String) e.getValue()); externalService.getProperty().add(prop); Services services = domain.getExtensionByType(Services.class); for (org.glassfish.paas.orchestrator.config.Service service : services.getServices()) { if (service instanceof ExternalService) {
final ActionReport report = context.getActionReport(); !fileRealmClassName.equals( "com.sun.enterprise.security.auth.realm.file.FileRealm")) { report.setMessage( localStrings.getLocalString( "delete.file.user.realmnotsupported", "Configured file realm {0} is not supported.", fileRealmClassName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); return; if (fileProp.getName().equals("file")) keyFile = fileProp.getValue(); report.setMessage( localStrings.getLocalString("delete.file.user.keyfilenotfound", "There is no physical file associated with this file realm {0} ", authRealmName)); if (!exists) { report.setMessage( localStrings.getLocalString("file.realm.keyfilenonexistent", "The specified physical file {0} associated with the file realm {1} does not exist.", new Object[]{kFile, authRealmName}));
final ActionReport report = context.getActionReport(); Config tmp = null; try { Server targetServer = domain.getServerNamed(target); if (targetServer != null) { config = domain.getConfigNamed(targetServer.getConfigRef()); com.sun.enterprise.config.serverbeans.Cluster cluster = domain.getClusterNamed(target); if (cluster != null) { config = domain.getConfigNamed(cluster.getConfigRef()); final SecurityService securityService = config.getSecurityService(); report.setMessage(localStrings.getLocalString( "create.file.user.filerealmnotfound", "File realm {0} does not exist", authRealmName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); return; if (fileProp.getName().equals("file")) keyFile = fileProp.getValue(); report.setMessage( localStrings.getLocalString("create.file.user.keyfilenotfound", "There is no physical file associated with this file realm {0} ", authRealmName));
config = habitat.<Config>getAllServices(Config.class).iterator().next(); logger.log(Level.WARNING,ConfigApiLoggerInfo.noDefaultConfigFound, new Object[]{config.getName(), instance.getName()}); needToAddGmsListenerPort = true; gmsListenerPort = instance.createChild(Property.class); gmsListenerPort.setName("GMS_LISTENER_PORT"); gmsListenerPort.setValue(String.format("${GMS_LISTENER_PORT-%s}", instanceName)); String broadcastProtocol = instance.getBroadcast(); Property discoveryUriListProp = instance.getProperty("GMS_DISCOVERY_URI_LIST"); String discoveryUriList = discoveryUriListProp != null ? discoveryUriListProp.getValue() : null; if (discoveryUriList != null && DEFAULT_BROADCAST.equals(broadcastProtocol)) { discoveryUriListProp.setName("GMS_DISCOVERY_URI_LIST"); discoveryUriListProp.setValue(GENERATE); instance.getProperty().add(discoveryUriListProp); String TCPPORT = gmsListenerPort.getValue(); if (GENERATE.equals(discoveryUriListProp.getValue())) { gmsListenerPort.setValue(TCPPORT); if (needToAddGmsListenerPort) { instance.getProperty().add(gmsListenerPort); gmsListenerPortSysProp.setValue(TCPPORT); writeableConfig.getSystemProperty().add(gmsListenerPortSysProp);
final ActionReport report = context.getActionReport(); Property domainProp = domain.getProperty("administrative.domain.name"); String domainName = domainProp.getValue(); if(!spb.containsProperty(propName)) { report.setActionExitCode(ActionReport.ExitCode.FAILURE); String msg = localStrings.getLocalString("no.such.property", "System Property named {0} does not exist at the given target {1}", propName, target); report.setMessage(msg); return; Config config = domain.getConfigNamed(target); if (config != null) { doms.add(Dom.unwrap(config)); String configName = config.getName(); String msg = localStrings.getLocalString("cant.delete.referenced.property", "System Property {0} is referenced by {1} in the configuration. Please remove the references first.", propName, Arrays.toString(refs.toArray())); report.setMessage(msg); String msg = localStrings.getLocalString("delete.sysprops.ok",
throw new TransactionFailure(localStrings.getLocalString( "noTransaction", "Internal Error - Cannot obtain transaction object")); Node theNode = domain.getNodeNamed(node); if (theNode == null) { throw new TransactionFailure(localStrings.getLocalString( "noSuchNode", "Node {0} does not exist.", node)); ourCluster.getProperty("GMS_DISCOVERY_URI_LIST").getValue())) { serverConf.getSystemProperty(propName); if (dasGmsPortProp != null) { SystemProperty gmsListenerPortProp = File configConfigDir = new File(env.getConfigDirPath(), specifiedConfig.getName()); File docroot = new File(configConfigDir, "docroot"); if (!docroot.exists() && !docroot.mkdirs()) { instance.setConfigRef(configName); final CopyConfig command = (CopyConfig) runner .getCommand("copy-config", context.getActionReport(), context.getLogger()); ActionReport report = context.getActionReport(); report.setMessage(message);
ServerPool targetGroup = iaas.byName(group); if (targetGroup==null) { context.getActionReport().failure(RuntimeContext.logger, "Cannot find serverPool " + group); return; return; Cluster clusterConfig = domain.getClusterNamed(cluster); VirtualMachineConfig vmConfig = clusterConfig.getExtensionsByTypeAndName(VirtualMachineConfig.class, vm.getName()); for (Property property : vmConfig.getProperty()) { vm.setProperty(VirtualMachine.PropertyName.valueOf(property.getName()), property.getValue()); context.getActionReport().failure(RuntimeContext.logger, e.getMessage()); return; context.getActionReport().setActionExitCode(ActionReport.ExitCode.SUCCESS);
ConfigBeanProxy lcProxy = transaction.enroll(lc); property = lcProxy.createChild(Property.class); property.setName(propertyName); property.setValue(String.valueOf((new Date()).getTime())); ((LbConfig)lcProxy).getProperty().add(property); } else { ConfigBeanProxy propertyProxy = transaction.enroll(property); ((Property)propertyProxy).setValue(String.valueOf( (new Date()).getTime())); LogDomains.ADMIN_LOGGER); LocalStringManagerImpl localStrings = new LocalStringManagerImpl(LbConfig.class); String msg = localStrings.getLocalString( "UnableToSetPropertyInLbconfig", "Unable to set property {0} in lbconfig with name {1}",
public void postConstruct() { for (Config config : configs.getConfig()) { SecurityService service = config.getSecurityService(); if (service != null) { upgradeJACCProvider(service); SecurityService service = config.getSecurityService(); List<AuthRealm> authRealms = service.getAuthRealm(); Property digestAlgoProp = authRealm.getProperty(PARAM_DIGEST_ALGORITHM); if (digestAlgoProp != null) { String digestAlgo = digestAlgoProp.getValue(); if (digestAlgo == null || digestAlgo.isEmpty()) { digestAlgoProp.setValue("MD5"); _logger.log(Level.WARNING, localStrings.getLocalString("enterprise.security.upgrade.warning", "Upgrade from v2 EE to v3.1 requires manual steps." + "Please refer to the v3.1 Upgrade Guide for details.")); AdminService service = config.getAdminService(); for( JmxConnector jmxConnector : service.getJmxConnector()){ Ssl sslElement = jmxConnector.getSsl();