@Test public void testMeetsGeneralRequirements() { ProvisionRequest request = createProvisionRequest(); assertTrue(instantiatorResource.meetsGeneralRequirements(request)); }
boolean meetsGeneralRequirements(final ProvisionRequest provisionRequest) { ServiceElement sElem = provisionRequest.getServiceElement(); String[] machineCluster = sElem.getCluster(); if (machineCluster != null && machineCluster.length > 0) { logger.debug("ServiceBean [{}] has a cluster requirement", LoggingUtil.getLoggingName(sElem)); boolean found = false; for (String aMachineCluster : machineCluster) { if (aMachineCluster.equals(resourceCapability.getAddress()) || aMachineCluster.equalsIgnoreCase(resourceCapability.getHostName())) found = true; } if (!found) { StringBuilder builder = new StringBuilder(); for (String m : machineCluster) { if (builder.length()>0) builder.append(", "); builder.append(m); } String failureReason = String.format("%s not found in cluster requirement [%s] for [%s]", getName(), builder.toString(), LoggingUtil.getLoggingName(sElem)); provisionRequest.addFailureReason(failureReason); logger.debug(failureReason); return false; } } return true; }
InstantiatorResource { boolean meetsGeneralRequirements(final ProvisionRequest provisionRequest) { ServiceElement sElem = provisionRequest.getServiceElement(); String[] machineCluster = sElem.getCluster(); if (machineCluster != null && machineCluster.length > 0) { logger.debug("ServiceBean [{}] has a cluster requirement", LoggingUtil.getLoggingName(sElem)); boolean found = false; for (String aMachineCluster : machineCluster) { if (aMachineCluster.equals(resourceCapability.getAddress()) || aMachineCluster.equalsIgnoreCase(resourceCapability.getHostName())) found = true; } if (!found) { StringBuilder builder = new StringBuilder(); for (String m : machineCluster) { if (builder.length()>0) builder.append(", "); builder.append(m); } String failureReason = String.format("%s not found in cluster requirement [%s] for [%s]", getName(), builder.toString(), LoggingUtil.getLoggingName(sElem)); provisionRequest.addFailureReason(failureReason); logger.debug(failureReason); return false; } } return true; } }
InstantiatorResource { boolean meetsGeneralRequirements(final ProvisionRequest provisionRequest) { ServiceElement sElem = provisionRequest.getServiceElement(); String[] machineCluster = sElem.getCluster(); if (machineCluster != null && machineCluster.length > 0) { logger.debug("ServiceBean [{}] has a cluster requirement", LoggingUtil.getLoggingName(sElem)); boolean found = false; for (String aMachineCluster : machineCluster) { if (aMachineCluster.equals(resourceCapability.getAddress()) || aMachineCluster.equalsIgnoreCase(resourceCapability.getHostName())) found = true; } if (!found) { StringBuilder builder = new StringBuilder(); for (String m : machineCluster) { if (builder.length()>0) builder.append(", "); builder.append(m); } String failureReason = String.format("%s not found in cluster requirement [%s] for [%s]", getName(), builder.toString(), LoggingUtil.getLoggingName(sElem)); provisionRequest.addFailureReason(failureReason); logger.debug(failureReason); return false; } } return true; } InstantiatorResource(MarshalledObject<ServiceBeanInstantiator> wrappedServiceBeanInstantiator,
                                ServiceBeanInstantiator instantiator,
                                String instantiatorName,
                                Uuid instantiatorUuid,
                                MarshalledObject<?> handback,
                                ResourceCapability resourceCapability,
                                int serviceLimit); }
InstantiatorResource { boolean meetsGeneralRequirements(final ProvisionRequest provisionRequest) { ServiceElement sElem = provisionRequest.getServiceElement(); String[] machineCluster = sElem.getCluster(); if (machineCluster != null && machineCluster.length > 0) { logger.debug("ServiceBean [{}] has a cluster requirement", LoggingUtil.getLoggingName(sElem)); boolean found = false; for (String aMachineCluster : machineCluster) { if (aMachineCluster.equals(resourceCapability.getAddress()) || aMachineCluster.equalsIgnoreCase(resourceCapability.getHostName())) found = true; } if (!found) { StringBuilder builder = new StringBuilder(); for (String m : machineCluster) { if (builder.length()>0) builder.append(", "); builder.append(m); } String failureReason = String.format("%s not found in cluster requirement [%s] for [%s]", getName(), builder.toString(), LoggingUtil.getLoggingName(sElem)); provisionRequest.addFailureReason(failureReason); logger.debug(failureReason); return false; } } return true; } InstantiatorResource(MarshalledObject<ServiceBeanInstantiator> wrappedServiceBeanInstantiator,
                                ServiceBeanInstantiator instantiator,
                                String instantiatorName,
                                Uuid instantiatorUuid,
                                MarshalledObject<?> handback,
                                ResourceCapability resourceCapability,
                                int serviceLimit); void addDeployedService(DeployedService newDeployedService); String getName(); Uuid getInstantiatorUuid(); int getServiceElementCount(ServiceElement sElem); int getServiceElementCount(); ServiceBeanInstantiator getInstantiator(); int getServiceCount(); MarshalledObject<?> getHandback(); ResourceCapability getResourceCapability(); int getServiceLimit(); void incrementProvisionCounter(ServiceElement sElem); synchronized void decrementProvisionCounter(ServiceElement sElem); int getInProcessCounter(); int getInProcessCounter(ServiceElement sElem); String getHostAddress(); void addUninstantiable(ServiceElement serviceElement); boolean isUninstantiable(ServiceElement serviceElement); void removeUninstantiable(ServiceElement serviceElement); void setDynamicEnabledOn(); boolean getDynamicEnabled(); boolean canProvision(final ProvisionRequest provisionRequest); @Override boolean equals(Object o); @Override int hashCode(); }
InstantiatorResource { boolean meetsGeneralRequirements(final ProvisionRequest provisionRequest) { ServiceElement sElem = provisionRequest.getServiceElement(); String[] machineCluster = sElem.getCluster(); if (machineCluster != null && machineCluster.length > 0) { logger.debug("ServiceBean [{}] has a cluster requirement", LoggingUtil.getLoggingName(sElem)); boolean found = false; for (String aMachineCluster : machineCluster) { if (aMachineCluster.equals(resourceCapability.getAddress()) || aMachineCluster.equalsIgnoreCase(resourceCapability.getHostName())) found = true; } if (!found) { StringBuilder builder = new StringBuilder(); for (String m : machineCluster) { if (builder.length()>0) builder.append(", "); builder.append(m); } String failureReason = String.format("%s not found in cluster requirement [%s] for [%s]", getName(), builder.toString(), LoggingUtil.getLoggingName(sElem)); provisionRequest.addFailureReason(failureReason); logger.debug(failureReason); return false; } } return true; } InstantiatorResource(MarshalledObject<ServiceBeanInstantiator> wrappedServiceBeanInstantiator,
                                ServiceBeanInstantiator instantiator,
                                String instantiatorName,
                                Uuid instantiatorUuid,
                                MarshalledObject<?> handback,
                                ResourceCapability resourceCapability,
                                int serviceLimit); void addDeployedService(DeployedService newDeployedService); String getName(); Uuid getInstantiatorUuid(); int getServiceElementCount(ServiceElement sElem); int getServiceElementCount(); ServiceBeanInstantiator getInstantiator(); int getServiceCount(); MarshalledObject<?> getHandback(); ResourceCapability getResourceCapability(); int getServiceLimit(); void incrementProvisionCounter(ServiceElement sElem); synchronized void decrementProvisionCounter(ServiceElement sElem); int getInProcessCounter(); int getInProcessCounter(ServiceElement sElem); String getHostAddress(); void addUninstantiable(ServiceElement serviceElement); boolean isUninstantiable(ServiceElement serviceElement); void removeUninstantiable(ServiceElement serviceElement); void setDynamicEnabledOn(); boolean getDynamicEnabled(); boolean canProvision(final ProvisionRequest provisionRequest); @Override boolean equals(Object o); @Override int hashCode();  }