Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.ServerRef


        Object newVal;
        for (PropertyChangeEvent event : events) {
            oldVal = event.getOldValue();
            newVal = event.getNewValue();
            if (oldVal instanceof ServerRef && newVal == null) {
                ServerRef instance = (ServerRef) oldVal;
                deleteInstance(instance.getRef());
            } else if (newVal instanceof ServerRef && oldVal == null) {
                ServerRef instance = (ServerRef) newVal;
                addInstance(instance.getRef());
            }
        }
        return null;
    }
View Full Code Here


    }

    private void addServerToLBConfig(final LbConfigs lbconfigs, final String configName, final String serverName) {
        LbConfig lbConfig = lbconfigs.getLbConfig(configName);

        ServerRef sRef = lbConfig.getRefByRef(ServerRef.class, serverName);
        if (sRef != null) {
            String msg = localStrings.getLocalString("LBServerRefExists",
                   "LB config already contains a server-ref for target {0}", target);
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setMessage(msg);
            return;
        }

        Server server = domain.getServerNamed(serverName);
        boolean isStandAlone = server.getCluster() == null && server.isInstance();
        if (!isStandAlone) {
            String msg = localStrings.getLocalString("NotStandAloneInstance",
                    "[{0}] is not a stand alone instance. Only stand alone instance can be added to a load balancer.",
                    serverName);
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setMessage(msg);
            return;
        }

        try {
            ConfigSupport.apply(new SingleConfigCode<LbConfig>() {
                @Override
                public Object run(LbConfig param) throws PropertyVetoException, TransactionFailure {
                    ServerRef ref = param.createChild(ServerRef.class);
                    ref.setRef(serverName);
                    param.getClusterRefOrServerRef().add(ref);
                    return Boolean.TRUE;
                }
            }, lbConfig);
        } catch (TransactionFailure ex) {
View Full Code Here

                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);
                    instance.getClusterRefOrServerRef().add(sRef);
                } else {
                    String msg = localStrings.getLocalString("InvalidTarget", target);
                    throw new TransactionFailure(msg);
                }
View Full Code Here

        Object newVal;
        for (PropertyChangeEvent event : events) {
            oldVal = event.getOldValue();
            newVal = event.getNewValue();
            if (oldVal instanceof ServerRef && newVal == null) {
                ServerRef instance = (ServerRef) oldVal;
                deleteInstance(instance.getRef());
            } else if (newVal instanceof ServerRef && oldVal == null) {
                ServerRef instance = (ServerRef) newVal;
                addInstance(instance.getRef());
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.ServerRef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.