/*
* 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.
*/
/**
* Startup service to upgrade cluster/gms elements in domain.xml
* @author Bhakti Mehta
*
*/
public void postConstruct() {
try {
//This will upgrade all the cluster elements in the domain.xml
// this will upgrade all the group-management-service elements in domain.xml
} catch (Exception e) {
"Failure while upgrading cluster data from V2 to V3: " + e);
throw new RuntimeException(e);
}
}
}
}
private void upgradeGroupManagementServiceElements()
throws TransactionFailure {
}
}
//set gms-enabled (default is true incase it may not appear in upgraded
//domain.xml)
}
//set gms-multicast-address the value obtained from heartbeat-address
try {
} catch (Throwable t) {
// catch RuntimeException hk2 ValidationException. Some values from v2 may not be valid in v3.
}
}
// ensure this propery is set to a valid value. Either it was missing or v2 value was invalid in v3 constraints.
// generate a valid gms multicast address. Either heartbeataddress was missing OR had an invalid value from v2 domain.xml
}
//set gms-multicast-port the value of heartbeat-port.
try {
} catch (Throwable t) {
// catch RuntimeException hk2 ValidationException. There are definitely values in v2 that are not valid in v3 for this field.
// There were bugs filed that this port was randomly generated with an IANA allocated port. So v3.1 min and max are more restrictive than v2 were.
}
}
// ensure this property is set to a valid value. Either the value was missing or had a value in v2 that is considered invalid in tighter constrained v3.1.
// generate a valid gms multicastport. Either heartbeatport was not set or was set to a value that is now invalid in v3.1.
// port range in v2 was quite large and outside the IANA recommended range being followed by v3.1.
}
//gms-bind-interface is an attribute of cluster in 3.1
} else {
"${GMS-BIND-INTERFACE-ADDRESS-%s}",
}
}
return cluster;
}
}
try {
// catch RuntimeException hk2 ValidationException. if v2 value is not valid for v3, just rely on v3 default
}
} // else null for server-config
try {
// catch RuntimeException hk2 ValidationException. if v2 value is not valid for v3, just rely on v3 default
}
} // else null for server-config
try {
// catch RuntimeException hk2 ValidationException. if v2 value is not valid for v3, just rely on v3 default
}
} // else null for server config
try {
// catch RuntimeException hk2 ValidationException. if v2 value is not valid for v3, just rely on v3 default
}
} // else null for server-config
try {
// catch RuntimeException hk2 ValidationException. if v2 value is not valid for v3, just rely on v3 default
}
} //else v3.1 default value for VerifyFailureConnectTimeoutInMillis is sufficient.
// remove v2.1 attributes that are no longer needed. No info to transfer to v3.1 gms config.
}
}
return config;
}
}
// copied from config-api com.sun.enterprise.config.serverbeans.Cluster.java in order to generate a valid v3.1 value for this required properties.
final int MIN_GMS_MULTICAST_PORT = 2048;
final int MAX_GMS_MULTICAST_PORT = 32000;
return Integer.valueOf(Math.round((float)(Math.random() * portInterval)) + MIN_GMS_MULTICAST_PORT).toString();
}
// copied from config-api com.sun.enterprise.config.serverbeans.Cluster.java in order to generate a valid v3.1 value for this required properties.
final int MAX_GMS_MULTICAST_ADDRESS_SUBRANGE = 255;
.append('.')
return heartbeatAddressBfr.toString();
}
}