/*
* 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.
*/
/**
*
* Java EE Application Server Configuration
*
* Each Application Server instance is a Java EE compliant container. One
*
* User applications cannot be deployed to an Administration Server instance
*/
@SuppressWarnings("unused")
public interface Server extends ConfigBeanProxy, Injectable, PropertyBag, Named, SystemPropertyBag, ReferenceContainer, RefContainer, Payload {
/**
* Gets the value of the configRef property.
*
* Points to a named config. Needed for stand-alone servers. If server
* instance is part of a cluster, then it points to the cluster config
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the configRef property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the nodeAgentRef property.
*
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the nodeAgentRef property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Sets the value of the node property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* Gets the value of the node property.
*
*
* @return possible object is
* {@link String }
*/
/**
* Gets the value of the lbWeight property.
*
* Each server instance in a cluster has a weight, which may be used to
* represent the relative processing capacity of that instance. Default
* weight is 100 for every instance. Weighted load balancing policies will
* use this weight while load balancing requests within the cluster.
* It is the responsibility of the administrator to set the relative weights
* correctly, keeping in mind deployed hardware capacity
*
* @return possible object is
* {@link String }
*/
/**
* Sets the value of the lbWeight property.
*
* @param value allowed object is
* {@link String }
* @throws PropertyVetoException if a listener vetoes the change
*/
/**
* 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 }
*/
@ToDo(priority = ToDo.Priority.IMPORTANT, details = "Provide PropertyDesc for legal system properties")
@Param(name = InstanceRegisterInstanceCommandParameters.ParameterNames.PARAM_SYSTEMPROPERTIES, optional = true)
/**
Properties as per {@link PropertyBag}
*/
@PropertiesDesc(props = {})
/**
* Returns the cluster instance this instance is referenced in or null
* if there is no cluster referencing this server instance.
*
* @return the cluster owning this instance or null if this is a standalone
* instance
*/
// four trivial methods that ReferenceContainer's need to implement
boolean isCluster();
boolean isServer();
boolean isDas();
boolean isClusteredDas();
boolean isInstance();
int getAdminPort();
boolean isRunning();
class Duck {
return false;
}
return true;
}
}
}
boolean isClusteredDas = false;
}
return isClusteredDas;
}
return cluster;
}
}
}
}
return null;
}
}
return server.getConfigRef();
}
return appRef;
}
}
return null;
}
return ref;
}
}
return null;
}
}
}
}, server);
}
}
public static void createResourceRef(Server server, final String enabled, final String refName) throws TransactionFailure {
return newResourceRef;
}
}, server);
}
try {
return null;
return config;
}
}
}
catch (Exception e) {
// drop through...
}
return null;
}
try {
return helper.getAdminPort();
}
catch (Exception e) {
// drop through...
}
return -1;
}
try {
return helper.getAdminHost();
}
catch (Exception e) {
// drop through...
}
return null;
}
/** this is NOT a reliable test. It just checks if ANYTHING has setup shop
* on the host and port.
* I wanted to run RemoteAdminCommand but that is (inexplicably) in
* @param server
* @return
*/
try {
}
catch (Exception e) {
// drop through...
}
return false;
}
}
boolean checkPorts = true;
public void decorate(AdminCommandContext context, final Server instance) throws TransactionFailure, PropertyVetoException {
"noTransaction", "Internal Error - Cannot obtain transaction object"));
}
/*
if (node == null) {
instance.setNode("localhost"); //remove?
}
else { */
}
/* 16034: see if instance creation is turned off on node */
if (! theNode.instanceCreationAllowed()) {
"instanceCreationNotAllowed",
"Instance creation is disabled on node {0}.",
node));
}
}
}
// cluster instance using cluster config
if (clusterName != null) {
"Server.cannotSpecifyBothConfigAndCluster",
"A configuration name and cluster name cannot both be specified."));
}
boolean clusterExists = false;
clusterExists = true;
break;
}
}
}
if (ourCluster == null) {
}
/*
* We are only setting this when the discovery uri list
* is set to "generate." Otherwise the user must set this
* properly to match the discovery uri list.
*/
if (ourCluster != null &&
"generate".equals(
/*
* Currently all the instances will use the same port
* calculated differently.
*/
if (dasGmsPortProp != null) {
}
}
try {
}
catch (Exception e) {
// no big deal - just ignore
}
} else {
//check whether all instances in cluster had lb-enabled set to false
boolean allLBEnabled = false;
}
//if there are existing instances in cluster
//and they all have lb-enabled to false, set it
//false for new instance as well
} else {
//check if system property exists and use that
if(lbEnabledDefault != null){
}
}
}
}
}
}
// instance using specified config
if (specifiedConfig == null) {
}
try {
}
catch (Exception e) {
// no big deal - just ignore
}
}
//stand-alone instance using default-config if config not specified
if (defaultConfig == null) {
"Cluster.noDefaultConfig",
"Can''t find the default config (an element named \"default-config\") "
+ "in domain.xml. You may specify the name of an existing config element next time.");
throw new TransactionFailure(msg);
}
}
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")) {
// todo : what about virtual-servers ?
}
}
if (checkPorts) {
}
}
}
private void checkAdminPort(final Server instance, final Config config, LocalStringManagerImpl localStrings) throws TransactionFailure {
if (n != null) {
// Don't use the getAdminPort duck type method directly on the instance being created
if (instanceAdminPort == dasAdminPort) {
"Server.cannotHaveSameAdminPortAsDAS",
"Cannot create an instance on the same host as DAS with the same admin port as DAS: {0}.", instanceAdminPort + ""));
}
}
}
}
}
}
if (clusterName != null) {
Properties p = new Properties();
}
cp.systemProperties = p;
}
}
}
private void addClusterRefs(Cluster cluster, Server instance) throws TransactionFailure, PropertyVetoException {
}
}
}
}
}
}
}
//TODO - add support for node?
public void decorate(AdminCommandContext context, Servers parent, final Server child) throws PropertyVetoException, TransactionFailure {
/* setup supplemental */
}
if (isStandAlone) { // remove config <instance>-config
// bnevins June 2010
// don't delete the config is someone else holds a reference to it!
return;
}
// bnevins September 30, 2010
// don't delete the config if it wasn't auto-generated.
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;
}
}
else { // remove server-ref from cluster
if (t != null) {
try {
break;
}
}
}
}
catch (TransactionFailure ex) {
throw ex;
}
}
}
}
}
}