org.jvnet.hk2.annotations.Inject.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.jvnet.hk2.annotations.Inject.<init>()方法的一些代码示例,展示了Inject.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inject.<init>()方法的具体详情如下:
包路径:org.jvnet.hk2.annotations.Inject
类名称:Inject
方法名:<init>

Inject.<init>介绍

暂无

代码示例

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

public LocalServerPoolFactory(@Inject TemplateRepository templateRepository,
               @Inject Domain domain,
               @Inject ServerContext environment) {
  this.templateRepository = templateRepository;
  this.domain = domain;
  this.environment = environment;
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

public GroupsAccessImpl(@Inject Injector injector, @Inject IAAS groupMgt) {
  this.injector = injector;
  this.groupMgt = groupMgt;
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

public VirtualClusters(@Inject IAAS iaas, @Inject Domain domain) {
  this.iaas = iaas;
  this.domain = domain;
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

public VirtualMachineLifecycle(@Inject TemplateRepository templateRepository, @Inject Domain domain) {
  this.templateRepository = templateRepository;
  this.domain = domain;
}

代码示例来源:origin: org.glassfish.hk2/auto-depends

@Inject(name=Constants.EXECUTOR_INHABITANT_ACTIVATOR, optional=true)
public void setExecutorService(Executor es) {
 wm = new WorkManager(es);
}

代码示例来源:origin: org.glassfish.security/securitycommon

/**
 *
 * @author venu
 * TODO: need to change this class, it needs to be similar to SecurityServicesUtil
 */
@Service
public class Util {
  
  @Inject
  static Habitat defaultHabitat;

  public static Habitat getDefaultHabitat() {
    return defaultHabitat;
  }
}

代码示例来源:origin: org.glassfish.admin/config-api

@Service
  public static final class DefaultResolver implements CrudResolver {
    
    @Inject(name="type", optional=true)
    CrudResolver defaultResolver=null;

    @Override
    public <T extends ConfigBeanProxy> T resolve(AdminCommandContext context, Class<T> type) {
      if (defaultResolver!=null) {
        return defaultResolver.resolve(context, type);
      }
      return null;
    }
  }
}

代码示例来源:origin: com.sun.enterprise/auto-depends

@Inject(name=Constants.EXECUTOR_INHABITANT_ACTIVATOR, optional=true)
public void setExecutorService(Executor es) {
 wm = new WorkManager(es);
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

/**
 * Provides environmental methods for the virtualization feature.
 * @author Jerome Dochez
 */
@Service
public class VirtualizationEnvImpl implements VirtualizationEnv {

  @Inject
  Domain domain;

  @Override
  public boolean isPaasEnabled() {
    Virtualizations virtualizations = domain.getExtensionByType(Virtualizations.class);
    return (virtualizations!=null && virtualizations.getVirtualizations().size()>0);
  }
}

代码示例来源:origin: org.glassfish.common/internal-api

/**
 * So far, the admin container does not require much configuration but we
 * could imagine that it will eventually support configuring wether or not
 * to start the AminGUI.
 *
 * @author Jerome Dochez
 */
@Service
public class AdminInfo implements ContainerBuilder<EmbeddedAdminContainer> {
  
  @Inject
  EmbeddedAdminContainer ctr;

  public EmbeddedAdminContainer create(Server server) {
    return ctr;
  }
}

代码示例来源:origin: org.glassfish.deployment/dol

/**
 * Archivist that reads persitence.xml for ejb jars and appclient while running on server side
 */
@Service
public class ServerSidePersistenceArchivist extends PersistenceArchivist {
  @Inject
  private ProcessEnvironment env;

  @Override
  public boolean supportsModuleType(XModuleType moduleType) {
    // Reads persitence.xml for ejb jars
    return XModuleType.EJB == moduleType ||
        // Or App client modules if running inside server
        (XModuleType.CAR == moduleType && env.getProcessType().isServer());
  }

  @Override
  protected String getPuRoot(ReadableArchive archive) {
    //PU root for ejb jars and acc (while on server) is the current exploded archive on server side  
    return "";
  }

}

代码示例来源:origin: org.glassfish.common/glassfish-naming

implements ClientNamingConfigurator, PostConstruct {
@Inject
private Habitat defaultHabitat;

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

public TemplateRepositoryImpl(@Inject Services services, @Inject Virtualizations virts) {
  location = new File(virts.getTemplatesLocation());
  this.services = services;
  for (Virtualization virt : virts.getVirtualizations()) {
    for (Template template : virt.getTemplates()) {
      templates.add(new TemplateInstanceImpl(services, template));
    }
  }
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-api

@Service
public class VirtResolver implements CrudResolver {
  @Param
  String virtualization;
  @Inject
  Virtualizations virtualizations;
  @Override
  @SuppressWarnings("unchecked")
  public <T extends ConfigBeanProxy> T resolve(AdminCommandContext context, Class<T> type)  {
    return (T) virtualizations.byName(virtualization);
  }
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

/**
 * Start a stopped virtual machine.
 * @author Jerome Dochez
 */
@Service(name="start-vm")
@Scoped(PerLookup.class)
public class StartVirtualMachine extends VirtualMachineMgt implements AdminCommand {
  @Inject
  VirtualMachineLifecycle vmLifecycle;

  @Override
  void doWork(VirtualMachine vm) throws VirtException {
    vmLifecycle.start(vm);
  }
}

代码示例来源:origin: org.glassfish.admin/config-api

/**
 * Resolver based on type + name.
 *
 * @author Jerome Dochez
 */
@Service
public class TypeAndNameResolver implements CrudResolver {

  @Param(primary = true)
  String name;

  @Inject
  Habitat habitat;

  final protected static LocalStringManagerImpl localStrings = new LocalStringManagerImpl(GenericCrudCommand.class);

  @Override
  public <T extends ConfigBeanProxy> T resolve(AdminCommandContext context, Class<T> type) {
    T proxy = habitat.getComponent(type, name);
    if (proxy==null) {
      String msg = localStrings.getLocalString(TypeAndNameResolver.class,
          "TypeAndNameResolver.target_object_not_found",
          "Cannot find a {0} with a name {1}", type.getSimpleName(), name);
      throw new RuntimeException(msg);
    }
    return proxy;
  }
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-api

@Service
public class ServerPoolResolver implements CrudResolver {
  @Param(name="serverPool")
  String group;
  @Param(optional = true)
  String virtualization;
  @Inject
  Virtualizations virts;
  @Override
  public <T extends ConfigBeanProxy> T resolve(AdminCommandContext context, Class<T> type)  {
    Virtualization virt = virtualization==null?virts.getVirtualizations().get(0):virts.byName(virtualization);
    ServerPoolConfig config = virt.serverPoolByName(group);
    if (config!=null) {
      return (T) config;
    }
    context.getActionReport().failure(context.getLogger(), "Cannot find a serverPool by the name of " + group);
    return null;
  }
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-api

@Service
  class TemplateResolver implements CrudResolver {

    @Param
    String template;

    @Param
    String virtualization;

    @Inject
    Virtualizations virts;

    @Override
    public <T extends ConfigBeanProxy> T resolve(AdminCommandContext context, Class<T> type) {
      Virtualization virt = virts.byName(virtualization);
      if (virt==null) {
        Logger.getLogger(LogDomains.CONFIG_LOGGER).log(Level.SEVERE, "Cannot find a virtualization setting named " + virtualization);
        return null;
      }
      Template thisTemplate = virt.templateByName(template);
      return (T) thisTemplate;

    }
  }
}

代码示例来源:origin: org.glassfish.admin/config-api

@Service
  @Scoped(PerLookup.class)
  public class CrDecorator implements CreationDecorator<SecureAdminInternalUser> {

    @Param(optional=false, primary=true)
    private String username;
    
    @Param(optional=false)
    private String passwordAlias;
    
    @Inject
    private SecureAdminHelper helper;
    
    @Override
    public void decorate(AdminCommandContext context, SecureAdminInternalUser instance) throws TransactionFailure, PropertyVetoException {
      
      try {
        helper.validateInternalUsernameAndPasswordAlias(
            username, passwordAlias);
      } catch (Exception ex) {
        throw new TransactionFailure("create", ex);
      }
      instance.setUsername(username);
      instance.setPasswordAlias(passwordAlias);
    }
    
  }
}

代码示例来源:origin: org.glassfish.deployment/deployment-admin

public String sniffername = null;
@Inject
SnifferManager snifferManager;

相关文章