public void lookupAllInjectors() { String[] expected = { SimpleConnectorInjector.class.getName(), EjbContainerAvailabilityInjector.class.getName(), WebContainerAvailabilityInjector.class.getName(), GenericContainerInjector.class.getName(), GenericConfigInjector.class.getName() }; List<String> expectedInjectors = Arrays.asList(expected); List<ServiceHandle<ConfigInjector>> inhabitants = habitat.getAllServiceHandles(ConfigInjector.class); Set<String> inhabitantNames = new HashSet<String>(); for (ServiceHandle<?> inh : inhabitants) { inhabitantNames.add(inh.getActiveDescriptor().getImplementation()); } assert(inhabitants.size() == expected.length); assert(inhabitantNames.containsAll(expectedInjectors)); }
public void lookupInjectorByFilter() { ActiveDescriptor desc = habitat.getBestDescriptor( new InjectionTargetFilter(EjbContainerAvailability.class.getName())); assert(desc != null && desc.getImplementation().equals(EjbContainerAvailabilityInjector.class.getName())); }
public void lookupInjectorByName() { ServiceHandle inhabitant1 = habitat.getServiceHandle(ConfigInjector.class, "simple-connector"); ServiceHandle inhabitant2 = habitat.getServiceHandle(ConfigInjector.class, "ejb-container-availability"); assert(inhabitant1 != null && inhabitant2 != null && inhabitant1.getActiveDescriptor().getImplementation().equals(SimpleConnectorInjector.class.getName()) && inhabitant2.getActiveDescriptor().getImplementation().equals(EjbContainerAvailabilityInjector.class.getName())); }
ServiceLocator locator) { if(description==null) throw new ConfigurationException("%s doesn't have any metadata",injector.getImplementation()); throw new ConfigurationException("%s doesn't have the mandatory '%s' metadata", injector.getImplementation(), ConfigMetadata.TARGET); if(key==null ^ indexTypeName==null) throw new ConfigurationException("%s has inconsistent '%s=%s' and '%s=%s' metadata",
@Override public String getImplementation() { return descriptor.getImplementation(); }
@Override public String getImplementation() { return descriptor.getImplementation(); }
@Override public String getImplementation() { return descriptor.getImplementation(); }
@Override public String getImplementation() { return descriptor.getImplementation(); }
public String toString() { String descName = (descriptor == null) ? "null" : descriptor.getImplementation() ; return "InstanceLifecycleEventImpl(" + eventType + "," + descName + "," + System.identityHashCode(this) + ")"; } }
@Override public String toString() { return "ContextualInput(" + descriptor.getImplementation() + "," + root + "," + System.identityHashCode(this) + ")"; }
@Override public String toString() { return "ContextualInput(" + descriptor.getImplementation() + "," + root + "," + System.identityHashCode(this) + ")"; }
@Override public String toString() { return "ContextualInput(" + descriptor.getImplementation() + "," + root + "," + System.identityHashCode(this) + ")"; }
@Override public String toString() { return "ContextualInput(" + descriptor.getImplementation() + "," + root + "," + System.identityHashCode(this) + ")"; }
private void doPreDestruction(ActiveDescriptor<?> descriptor) { if (logger.isLoggable(level)) { logger.log(level, "Releasing service {0}", descriptor.getImplementation()); } }
private void doPreProduction(ActiveDescriptor<?> descriptor) { if (startTimes != null) { startTimes.put(descriptor.getImplementation(), System.currentTimeMillis()); } if ((getController().getCurrentRunLevel() > InitRunLevel.VAL) && logger.isLoggable(level)) { logger.log(level, "Running service " + descriptor.getImplementation()); } }
private static String oneLineDescriptor(ActiveDescriptor<?> descriptor) { if (descriptor == null) return "null-descriptor"; return descriptor.getImplementation() + ((descriptor.getName() != null) ? "/" + descriptor.getName() : "") + "(" + descriptor.getServiceId() + "," + descriptor.getLocatorId() + "," + System.identityHashCode(descriptor) + ")"; }
/** * Given a command name, return the name of the class that implements that * command in the server. */ private static String getCommandClass(String cmdName) { ServiceLocator h = getManHabitat(); String cname = "org.glassfish.api.admin.AdminCommand"; ActiveDescriptor<?> ad = h.getBestDescriptor( BuilderHelper.createNameAndContractFilter(cname, cmdName)); if (ad == null) return null; return ad.getImplementation(); }
public void lookupInjectorByFilter() { ActiveDescriptor desc = habitat.getBestDescriptor( new InjectionTargetFilter(EjbContainerAvailability.class.getName())); assert(desc != null && desc.getImplementation().equals(EjbContainerAvailabilityInjector.class.getName())); }
/** * Given a command name, return the name of the class that implements * that command in the server. */ private static String getCommandClass(String cmdName) { ServiceLocator h = getManHabitat(); String cname = "org.glassfish.api.admin.AdminCommand"; for (ActiveDescriptor<?> ad : h.getDescriptors(BuilderHelper.createContractFilter(cname))) { if (ad.getName() != null && ad.getName().equals(cmdName)) { return ad.getImplementation(); } } return null; }
public void lookupInjectorByName() { ServiceHandle inhabitant1 = habitat.getServiceHandle(ConfigInjector.class, "simple-connector"); ServiceHandle inhabitant2 = habitat.getServiceHandle(ConfigInjector.class, "ejb-container-availability"); assert(inhabitant1 != null && inhabitant2 != null && inhabitant1.getActiveDescriptor().getImplementation().equals(SimpleConnectorInjector.class.getName()) && inhabitant2.getActiveDescriptor().getImplementation().equals(EjbContainerAvailabilityInjector.class.getName())); }