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

x33g5p2x  于2022-01-30 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(123)

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

Scoped.<init>介绍

暂无

代码示例

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

/**
 * {@link Scope} local to each invocation.
 *
 * <p>
 * Components in this scope will create new instances every time someone asks for it. 
 *
 * @author Kohsuke Kawaguchi
 */
@Scoped(Singleton.class)
public class PerLookup extends Scope {
  @Override
  public ScopeInstance current() {
    return new ScopeInstance(new HashMap());
  }
}

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

/**
 * Singleton scope.
 *
 * @author Kohsuke Kawaguchi
 */
@Scoped(Singleton.class)
public class Singleton extends Scope {
  /**
   * @deprecated
   *  Singleton instances are not stored in a single map.
   */
  @Override
  public ScopeInstance current() {
    throw new UnsupportedOperationException();
  }
}

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

/**
 * Stop a running virtual machine
 * @author Jerome Dochez
 */
@Service(name="stop-vm")
@Scoped(PerLookup.class)
public class StopVirtualMachine extends VirtualMachineMgt implements AdminCommand {

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

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

/**
 * suspend a running virtual machine.
 * @author Jerome Dochez
 */
@Service(name="suspend-vm")
@Scoped(PerLookup.class)
public class SuspendVirtualMachine extends VirtualMachineMgt implements AdminCommand {
  @Override
  void doWork(VirtualMachine vm) throws VirtException {
    vm.suspend();
  }
}

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

@Service
@Scoped(Singleton.class)
public class DummyCallFlowAgentImpl
  implements CallFlowAgent {

  public boolean isEnabled() {return false;}

  public void entityManagerMethodStart(EntityManagerMethod val) {}

  public void entityManagerMethodEnd() {}

  public void entityManagerQueryStart(EntityManagerQueryMethod val) {}

  public void entityManagerQueryEnd() {}
}

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

/**
 * resume a suspended virtual machine
 * @author Jerome Dochez
 */
@Service(name="resume-vm")
@Scoped(PerLookup.class)
public class ResumeVirtualMachine extends VirtualMachineMgt implements AdminCommand {
  @Override
  void doWork(VirtualMachine vm) throws VirtException {
    vm.resume();
  }
}

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

/**
 * Scans for annotations relevant to persistence units that indicate an app
 * client depends on at least one persistence unit.
 *
 * @author tjquinn
 */
@Service(name="car")
@Scoped(Singleton.class)
public class AppClientPersistenceDependencyAnnotationScanner extends AbstractAnnotationScanner {

  protected void init(java.util.Set<String> annotationsSet) {
    annotationsSet.add("Ljavax/persistence/PersistenceUnit");
    annotationsSet.add("Ljavax/persistence/PersistenceUnits");
  }
  
}

代码示例来源:origin: org.glassfish.main.elasticity/elastic-api

/**
 * @author Mahesh.Kannan@Oracle.Com
 */
@Service(name="sum")
@Scoped(PerLookup.class)
public class Sum
  implements MetricFunction<Number, Double>{

  private double sum;

  public void accept(Collection<Number> collection) {
    for (Number value : collection) {
      sum += value.doubleValue();
    }
  }

  public Double value() {
    return sum;
  }

  public void reset() {
    sum = 0;
  }
}

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

/**
 * a template index based on the template service type role
 * @author Jerome Dochez
 */
@Service(name="ServiceType")
@Scoped(PerLookup.class)
public class ServiceType extends ValueBasedTemplateIndex {

  public enum Type { JavaEE, Database, MQ, LB, DNS }

  private Type value;

  public ServiceType() {
  }

  public ServiceType(String typeValue) {
    this.value = Type.valueOf(typeValue);
  }

  protected Type getValue() {
    return value;
  }

  @Override
  public void load(TemplateIndex persistence) {
    value = Type.valueOf(persistence.getValue());
  }
}

代码示例来源:origin: org.glassfish.main.elasticity/elastic-api

@Scoped(PerLookup.class)
public class CountFalse
  implements MetricFunction<Boolean, Integer>{

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

/**
 * Defines virtualization types for templates.
 * @author Jerome Dochez
 */
@Service(name="VirtualizationType")
@Scoped(PerLookup.class)
public class VirtualizationType extends ValueBasedTemplateIndex {

  public enum Type {libvirt, OVM, virtualbox, Native, OVM30}

  Type value;

  public VirtualizationType() {
  }

  public VirtualizationType(String typeValue) {
    value = Type.valueOf(typeValue);
  }

  @Override
  public Type getValue() {
    return value;
  }

  @Override
  public void load(TemplateIndex persistence) {
    value = Type.valueOf(persistence.getValue());
  }
}

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

/**
 * AppClientArchivist that does not warn if both the GlassFish and the
 * legacy Sun runtime descriptors are present.
 * <p>
 * The ACC uses a MultiReadableArchive to essentially merge the contents of
 * the generated app client JAR with the developer's original app client JAR.
 * The generated file contains a generated GlassFish runtime descriptor.
 * If the developer's app client contains a legacy sun-application-client.xml
 * descriptor, then the normal archivist logic would detect that both the
 * GlassFish DD and the developer's legacy sun-application-client.xml were
 * present in the merged contents and it would log a warning.
 * <p>
 * We prevent such warnings by overriding the method which reads the runtime
 * deployment descriptor.
 * 
 * @author Tim Quinn
 */
@Service
@Scoped(PerLookup.class)
public class ACCAppClientArchivist extends AppClientArchivist {

  @Override
  public void readRuntimeDeploymentDescriptor(ReadableArchive archive, ApplicationClientDescriptor descriptor) throws IOException, SAXParseException {
    super.readRuntimeDeploymentDescriptor(archive, descriptor, false);
  }
}

代码示例来源: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

@Service
  @Scoped(PerLookup.class)
  class DeleteDecorator implements DeletionDecorator<LbConfigs, LbConfig> {
    @Inject
    private Domain domain;

    @Override
    public void decorate(AdminCommandContext context, LbConfigs parent, LbConfig child)
        throws PropertyVetoException, TransactionFailure {
      Logger logger = LogDomains.getLogger(LbConfig.class, LogDomains.ADMIN_LOGGER);
      LocalStringManagerImpl localStrings = new LocalStringManagerImpl(LbConfig.class);

      String lbConfigName = child.getName();
      LbConfig lbConfig = domain.getLbConfigs().getLbConfig(lbConfigName);

      //Ensure there are no refs 
      if ( (lbConfig.getClusterRefOrServerRef().size() != 0 ) ) {
        String msg = localStrings.getLocalString("LbConfigNotEmpty", lbConfigName);
        throw new TransactionFailure(msg);
      }
      logger.info(localStrings.getLocalString("http_lb_admin.LbConfigDeleted", lbConfigName));
    }
  }
}

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

/**
 * List existing virtual machines
 * @author Jerome Dochez
 */
@Service(name="list-vms")
@Scoped(PerLookup.class)
public class ListVirtualMachines implements AdminCommand {

  @Inject
  IAAS gm;

  @Override
  public void execute(AdminCommandContext context) {
    //To change body of implemented methods use File | Settings | File Templates.
    try {
      for (ServerPool group : gm) {
        context.getActionReport().setMessage("For Group : " + group.getName());
        for (VirtualMachine vm : group.getVMs()) {
          context.getActionReport().getTopMessagePart().addChild().setMessage(
              "Virtual Machine: " + vm.getName() + " is "  + vm.getInfo().getState());
        }
      }
    } catch(VirtException e) {
      context.getActionReport().failure(Logger.getAnonymousLogger(), "Exception while listing machines ", e);
    }
  }
}

代码示例来源: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.admin/config-api

@Scoped(PerLookup.class)
public static class CrDecorator implements CreationDecorator<SecureAdminPrincipal> {

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

/**
 *
 * @author Jerome Dochez
 */
@Service(name="list-applications")
@I18n("list.applications")
@Scoped(PerLookup.class)
@CommandLock(CommandLock.LockType.NONE)
@ExecuteOn(value={RuntimeType.DAS})
@TargetType(value={CommandTarget.DOMAIN, CommandTarget.DAS, CommandTarget.STANDALONE_INSTANCE, CommandTarget.CLUSTER})
public class ListApplicationsCommand extends ListComponentsCommand {

  public void execute(AdminCommandContext context) {
    super.execute(context);
  }
}

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

@Service(name="_is-sniffer-user-visible")
@org.glassfish.api.admin.ExecuteOn(value={RuntimeType.DAS})
@Scoped(PerLookup.class)
@CommandLock(CommandLock.LockType.NONE)
public class IsSnifferUserVisibleCommand implements AdminCommand {

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

@Service(name="_get-targets")
@ExecuteOn(value={RuntimeType.DAS})
@Scoped(PerLookup.class)
@CommandLock(CommandLock.LockType.NONE)
public class GetTargetsCommand implements AdminCommand {

相关文章

微信公众号

最新文章

更多