/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/**
* A cluster defines a homogeneous set of server instances that share the same
* applications, resources, and configuration.
*/
@SuppressWarnings("unused")
public interface Cluster extends ConfigBeanProxy, Injectable, PropertyBag, Named, SystemPropertyBag, ReferenceContainer, RefContainer, Payload {
/**
* Sets the cluster name
* @param value cluster name
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* points to a named config. All server instances in the cluster
* will share this config.
*
* @return a named config name
*/
/**
* Sets the value of the configRef property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
@I18n("generic.config")
/**
* Gets the value of the gmsEnabled property.
*
* When "gms-enabled" is set to "true", the GMS services will be
* started as a lifecycle module in each the application server in the
* cluster.
*
* @return true | false as a string, null means false
*/
/**
* Sets the value of the gmsEnabled property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the broadcast property.
*
* When "broadcast" is set to default of "udpmulticast" and GmsMulticastPort
* GMSMulticastAddress are not set, then their values are generated.
* When "broadcast" is set to implied unicast using udp or tcp protocol,
* then the VIRUTAL_MUTLICAST_URI_LIST is generated
* for virtual broadcast over unicast mode.
*
* @return true | false as a string, null means false
*/
/**
* Sets the value of the broadcast property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the gmsMulticastPort property.
*
* This is the communication port GMS uses to listen for group events.
* This should be a valid port number.
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the gmsMulticastPort property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the gmsMulticastAddress property.
*
* This is the address (only multicast supported) at which GMS will
* listen for group events. Must be unique for each cluster.
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the gmsMulticastAddress property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the gmsBindInterfaceAddress property.
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the gmsBindInterfaceAddress property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the heartbeatEnabled property.
*
* When "heartbeat-enabled" is set to "true", the GMS services will be
* started as a lifecycle module in each the application server in the
* cluster.When "heartbeat-enabled" is set to "false", GMS will not be
* started and its services will be unavailable. Clusters should function
* albeit with reduced functionality.
*
* @return true | false as a string, null means false
*/
/**
* Sets the value of the heartbeatEnabled property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the heartbeatPort property.
*
* This is the communication port GMS uses to listen for group events.
* This should be a valid port number.
*
* @return possible object is
* {@link String }
*/
//@Min(value=2048)
//@Max(value=49151)
/**
* Sets the value of the heartbeatPort property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the heartbeatAddress property.
*
* This is the address (only multicast supported) at which GMS will
* listen for group events.
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the heartbeatAddress property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the serverRef property.
*
* List of servers in the cluster
*
* @return list of configured {@link ServerRef }
*/
/**
* Gets the value of the systemProperty property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the systemProperty property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getSystemProperty().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link SystemProperty }
*/
/**
* Properties as per {@link org.jvnet.hk2.config.types.PropertyBag}
*/
})
/**
* Returns the cluster configuration reference
* @return the config-ref attribute
*/
// four trivial methods that ReferenceContainer's need to implement
boolean isCluster();
boolean isServer();
boolean isDas();
boolean isInstance();
class Duck {
return cluster.getConfigRef();
}
// the instance's domain.xml only has its own server
// element and not other server elements in the cluster
}
}
return instances;
}
return ref;
}
}
return null;
}
return appRef;
}
}
return null;
}
return ref;
}
}
return null;
}
}
}
}, cluster);
}
}
public static void createResourceRef(Cluster cluster, final String enabled, final String refName) throws TransactionFailure {
return newResourceRef;
}
}, cluster);
}
}
/**
* Decorates the newly CRUD created cluster configuration instance.
* tasks :
* - ensures that it references an existing configuration
* - creates a new config from the default-config if no config-ref
* was provided.
* - check for deprecated parameters.
*
* @param context administration command context
* @param instance newly created configuration element
* @throws TransactionFailure
* @throws PropertyVetoException
*/
public void decorate(AdminCommandContext context, final Cluster instance) throws TransactionFailure, PropertyVetoException {
//check if cluster software is installed else fail , see issue 12023
"Cluster software is not installed"));
}
"${GMS-BIND-INTERFACE-ADDRESS-%s}",
instanceName));
}
"Cluster.no_default_config_found",
"No default config found, using config {0} as the default config for the cluster {1}",
}
} else {
// cluster using specified config
if (specifiedConfig == null) {
}
}
boolean needToAddGmsListenerPort = false;
if (gmsListenerPort == null) {
needToAddGmsListenerPort = true;
// do not add gmsListenerPort until know whether it needs to be fixed or symbolic.
// for non-multicast with generate or list of ip addresses, port needs to be a fixed value
// all members of cluster. for non-multicast with list of uri, the GMS_LISTENER_PORT is
// set to symbolic system environment variable that is set different for each instance of cluster.
}
// handle generation of udp multicast and non-multicast mode for DAS managed cluster.
// inspect cluster attribute broadcast and cluster property GMS_DISCOVERY_URI_LIST.
// override default broadcast protocol of udp multicast when GMS_DISCOVERY_URI_LIST has been set.
broadcastProtocol = "tcp";
}
}
// only generate these values when they are not set AND broadcastProtocol is set to enable UDP multicast.
// Note: that this is the default for DAS controlled clusters.
}
}
if (needToAddGmsListenerPort) {
}
} else {
// cover case that broadcast is set to non-multicast and no
// cluster property GMS_DISCOVERY_URI_LIST exists.
// create the property and set to "generate".
// gms-adapter will handle generation of the list when needed
if (discoveryUriListProp == null) {
}
// TODO: implement UDP unicast.
// Only tcp mode is supported now.
// So either "udpunicast" or "tcp" for broadcast mode is treated the same.
// generate a random port since user did not provide one.
// better fix in future would be to walk existing clusters and pick an unused port.
// hardcode all instances to use same default port.
// generate mode does not support multiple instances on one machine.
if (needToAddGmsListenerPort) {
}
}
} else {
// lookup server-config and set environment property value
// GMS_LISTENER_PORT-clusterName to fixed value.
} else {
}
}
}
if (needToAddGmsListenerPort) {
}
}
}
if (resource.getObjectType().equals("system-all") || resource.getObjectType().equals("system-instance")) {
if (resource instanceof BindableResource) {
}
}
throw new TransactionFailure("Cannot add un-named resources to the new server instance");
}
}
}
if (application.getObjectType().equals("system-all") || application.getObjectType().equals("system-instance")) {
}
}
haagentport!=null ||
haadminpassword!=null ||
devicesize!=null ||
haproperty!=null ||
) {
}
}
final int MIN_GMS_MULTICAST_PORT = 2048;
final int MAX_GMS_MULTICAST_PORT = 32000; // be pessimistic for generation of random port and assume
// ephemeral port range between 32k to 64k.
return Integer.valueOf(Math.round((float)(Math.random() * portInterval)) + MIN_GMS_MULTICAST_PORT).toString();
}
final int MAX_GMS_MULTICAST_ADDRESS_SUBRANGE = 255;
.append('.')
return heartbeatAddressBfr.toString();
}
}
// for backward compatibility, ignored.
//check if the cluster contains instances throw error that cluster
//cannot be deleted
//issue 12172
}
"Cluster.hasInstances",
"Cluster {0} contains server instances {1} and must not contain any instances"
);
throw new TransactionFailure(msg);
}
// remove GMS_LISTENER_PORT-clusterName prop from server config
}
// check if the config is null or still in use by some other
// ReferenceContainer or is not <cluster-name>-config -- if so just return...
if(config == null || domain.getReferenceContainersOf(config).size() > 1 || !instanceConfig.equals(child.getName() + "-config"))
return;
try {
}
catch(Exception e) {
// no big deal - just ignore
}
try {
if (t != null) {
}
} catch (TransactionFailure ex) {
"Unable to remove config {0}", instanceConfig);
throw ex;
}
}
}
}