Java Code Examples for javax.inject.Inject

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project ODE-X, under directory /server/src/main/java/org/apache/ode/server/cdi/.

Source file: RuntimeHandler.java

  18 
vote

public AnnotatedType<Cluster> getClusterType(AnnotatedType<Cluster> type){
  AnnotatedTypeImpl<Cluster> at=new AnnotatedTypeImpl<Cluster>(type);
final class Inject extends AnnotationLiteral<javax.inject.Inject> implements javax.inject.Inject {
  }
  for (  AnnotatedField<?> field : at.getFields()) {
    if (field.isAnnotationPresent(ClusterId.class)) {
      field.getAnnotations().add(new Inject());
    }
 else     if (field.isAnnotationPresent(NodeId.class)) {
      field.getAnnotations().add(new Inject());
    }
  }
  return at;
}
 

Example 2

From project accesointeligente, under directory /src/org/accesointeligente/client/.

Source file: PlaceHistory.java

  15 
vote

@Inject public PlaceHistory(EventBus eventBus,PlaceManager placeManager){
  this.eventBus=eventBus;
  this.placeManager=placeManager;
  history=new ArrayList<PlaceRequest>();
  eventBus.addHandler(NavigationEvent.getType(),this);
}
 

Example 3

From project action-core, under directory /src/main/java/com/ning/metrics/action/binder/modules/.

Source file: FileSystemAccessProvider.java

  15 
vote

@Inject public FileSystemAccessProvider(final ActionCoreConfig actionCoreConfig) throws IOException {
  final Configuration hadoopConfig=new Configuration();
  final String hfsHost=actionCoreConfig.getNamenodeUrl();
  if (hfsHost.isEmpty()) {
    hadoopConfig.set("fs.default.name","file:///");
  }
 else {
    hadoopConfig.set("fs.default.name",hfsHost);
  }
  hadoopConfig.setInt("dfs.socket.timeout",actionCoreConfig.getHadoopSocketTimeOut());
  hadoopConfig.setBoolean("fs.automatic.close",false);
  hadoopConfig.setLong("dfs.block.size",actionCoreConfig.getHadoopBlockSize());
  hadoopConfig.set("hadoop.job.ugi",actionCoreConfig.getHadoopUgi());
  hadoopConfig.setStrings("io.serializations",HadoopThriftWritableSerialization.class.getName(),HadoopThriftEnvelopeSerialization.class.getName(),HadoopSmileOutputStreamSerialization.class.getName(),"org.apache.hadoop.io.serializer.WritableSerialization",actionCoreConfig.getSerializations());
  fileSystemAccess=new FileSystemAccess(hadoopConfig);
}
 

Example 4

From project aerogear-controller, under directory /src/main/java/org/jboss/aerogear/controller/router/.

Source file: DefaultRouter.java

  15 
vote

@Inject public DefaultRouter(RoutingModule routes,BeanManager beanManager,ViewResolver viewResolver,ControllerFactory controllerFactory,SecurityProvider securityProvider){
  this.routes=routes.build();
  this.beanManager=beanManager;
  this.viewResolver=viewResolver;
  this.controllerFactory=controllerFactory;
  this.securityProvider=securityProvider;
  errorViewResolver=new ErrorViewResolver(viewResolver);
}
 

Example 5

From project aether-core, under directory /aether-connector-wagon/src/main/java/org/eclipse/aether/connector/wagon/.

Source file: WagonRepositoryConnectorFactory.java

  15 
vote

@Inject WagonRepositoryConnectorFactory(FileProcessor fileProcessor,WagonProvider wagonProvider,WagonConfigurator wagonConfigurator,LoggerFactory loggerFactory){
  setFileProcessor(fileProcessor);
  setWagonProvider(wagonProvider);
  setWagonConfigurator(wagonConfigurator);
  setLoggerFactory(loggerFactory);
}
 

Example 6

From project airlift, under directory /event/src/main/java/io/airlift/event/client/.

Source file: JsonEventSerializer.java

  15 
vote

@Inject public JsonEventSerializer(Set<EventTypeMetadata<?>> eventTypes){
  checkNotNull(eventTypes,"eventTypes is null");
  ImmutableMap.Builder<Class<?>,JsonSerializer<?>> map=ImmutableMap.builder();
  for (  EventTypeMetadata<?> eventType : eventTypes) {
    map.put(eventType.getEventClass(),createEventJsonSerializer(eventType));
  }
  this.serializers=map.build();
}
 

Example 7

From project android-rackspacecloud, under directory /extensions/httpnio/src/main/java/org/jclouds/http/httpnio/config/.

Source file: NioTransformingHttpCommandExecutorServiceModule.java

  15 
vote

@SuppressWarnings("unused") @Inject Factory(Closer closer,@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,@Named(Constants.PROPERTY_MAX_CONNECTION_REUSE) int maxConnectionReuse,@Named(Constants.PROPERTY_MAX_SESSION_FAILURES) int maxSessionFailures,Provider<Semaphore> allConnections,Provider<BlockingQueue<HttpCommandRendezvous<?>>> commandQueue,Provider<BlockingQueue<NHttpConnection>> available,Provider<AsyncNHttpClientHandler> clientHandler,Provider<DefaultConnectingIOReactor> ioReactor,HttpParams params){
  this.closer=closer;
  this.executor=executor;
  this.maxConnectionReuse=maxConnectionReuse;
  this.maxSessionFailures=maxSessionFailures;
  this.allConnections=allConnections;
  this.commandQueue=commandQueue;
  this.available=available;
  this.clientHandler=clientHandler;
  this.ioReactor=ioReactor;
  this.params=params;
}
 

Example 8

From project ardverk-dht, under directory /components/core/src/main/java/org/ardverk/dht/.

Source file: ArdverkDHT.java

  15 
vote

@Inject public ArdverkDHT(RouteTable routeTable,Datastore datastore,FutureManager futureManager,PingManager pingManager,BootstrapManager bootstrapManager,QuickenManager quickenManager,StoreManager storeManager,DiscoveryManager discoveryManager,MessageDispatcher messageDispatcher){
  super(routeTable,datastore,futureManager);
  this.messageDispatcher=messageDispatcher;
  this.pingManager=pingManager;
  this.bootstrapManager=bootstrapManager;
  this.quickenManager=quickenManager;
  this.storeManager=storeManager;
  this.discoveryManager=discoveryManager;
  BindableUtils.bind(routeTable,new RouteTable.ContactPinger(){
    @Override public DHTFuture<PingEntity> ping(    Contact contact,    PingConfig config){
      return ArdverkDHT.this.ping(contact,config);
    }
  }
);
  BindableUtils.bind(datastore,this);
}
 

Example 9

From project Arecibo, under directory /collector/src/main/java/com/ning/arecibo/collector/resources/.

Source file: HostDataResource.java

  15 
vote

@Inject public HostDataResource(final TimelineDAO dao,final SampleCoder sampleCoder,final CollectorConfig config,final TimelineEventHandler processor){
  this.dao=dao;
  this.sampleCoder=sampleCoder;
  this.config=config;
  this.processor=processor;
}
 

Example 10

From project arquillian-container-osgi, under directory /testenricher-osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/.

Source file: OSGiTestEnricher.java

  15 
vote

public void enrich(Object testCase){
  BundleContext bundleContext=getBundleContext();
  if (bundleContext == null) {
    log.fine("System bundle context not available");
    return;
  }
  Class<? extends Object> testClass=testCase.getClass();
  for (  Field field : testClass.getDeclaredFields()) {
    if (field.isAnnotationPresent(Inject.class)) {
      if (field.getType().isAssignableFrom(BundleContext.class)) {
        injectBundleContext(testCase,field);
      }
 else       if (field.getType().isAssignableFrom(Bundle.class)) {
        injectBundle(testCase,field);
      }
 else       if (field.getType().isAssignableFrom(PackageAdmin.class)) {
        injectPackageAdmin(testCase,field);
      }
 else       if (field.getType().isAssignableFrom(StartLevel.class)) {
        injectStartLevel(testCase,field);
      }
    }
  }
  for (  Method method : testClass.getDeclaredMethods()) {
    if (method.isAnnotationPresent(Deployment.class)) {
      Deployment andep=method.getAnnotation(Deployment.class);
      if (andep.managed() && andep.testable() && method.isAnnotationPresent(StartLevelAware.class)) {
        int bundleStartLevel=method.getAnnotation(StartLevelAware.class).startLevel();
        StartLevel startLevel=getStartLevel();
        Bundle bundle=getBundle(testCase);
        log.fine("Setting bundle start level of " + bundle + " to: "+ bundleStartLevel);
        startLevel.setBundleStartLevel(bundle,bundleStartLevel);
      }
    }
  }
}
 

Example 11

From project arquillian_deprecated, under directory /containers/openejb-embedded-3.1/src/main/java/org/jboss/arquillian/container/openejb/embedded_3_1/.

Source file: OpenEJBTestEnricher.java

  15 
vote

/** 
 * {@inheritDoc}
 * @see org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher#enrich(org.jboss.arquillian.spi.Context,java.lang.Object)
 */
@Override public void enrich(Object testCase){
  super.enrich(testCase);
  final Class<? extends Annotation> inject=(Class<? extends Annotation>)Inject.class;
  List<Field> fieldsWithInject=this.getFieldsWithAnnotation(testCase.getClass(),inject);
  for (  final Field field : fieldsWithInject) {
    if (!field.isAccessible()) {
      AccessController.doPrivileged(new PrivilegedAction<Void>(){
        public Void run(){
          field.setAccessible(true);
          return null;
        }
      }
);
    }
    try {
      final Object resolvedVaue;
      final ArquillianContext arquillianContext=this.getArquillianContext();
      final Class<?> type=field.getType();
      if (field.isAnnotationPresent(Properties.class)) {
        final Properties properties=field.getAnnotation(Properties.class);
        resolvedVaue=arquillianContext.get(type,properties);
      }
 else       if (field.isAnnotationPresent(Property.class)) {
        final Property property=field.getAnnotation(Property.class);
        final Properties properties=new PropertiesImpl(new Property[]{property});
        resolvedVaue=arquillianContext.get(type,properties);
      }
 else {
        resolvedVaue=arquillianContext.get(type);
      }
      field.set(testCase,resolvedVaue);
    }
 catch (    final IllegalAccessException e) {
      throw new RuntimeException("Could not inject into " + field.getName() + " of test case: "+ testCase,e);
    }
  }
}
 

Example 12

From project camelpe, under directory /impl/src/main/java/net/camelpe/extension/.

Source file: CdiCamelContextConfiguration.java

  15 
vote

@Inject public void registerClassResolver(final @CamelContextInjectable Instance<ClassResolver> classResolvers) throws AmbiguousResolutionException {
  for (  final ClassResolver match : classResolvers) {
    if (this.classResolver != null) {
      throw new AmbiguousResolutionException("More than one implementation of [" + ClassResolver.class.getName() + "] found: ["+ this.classResolver+ "] and ["+ match+ "]");
    }
    this.classResolver=match;
  }
}
 

Example 13

From project capedwarf-green, under directory /server-api/src/main/java/org/jboss/capedwarf/server/api/admin/impl/.

Source file: BasicAdminManager.java

  15 
vote

@Inject public void setPropertes(@Resource("admin.properties") Properties props){
  users=new HashMap<String,Set<String>>();
  roles=new HashMap<String,Set<String>>();
  for (  String key : props.stringPropertyNames()) {
    String[] split=props.getProperty(key).split(",");
    users.put(key,new HashSet<String>(Arrays.asList(split)));
    for (    String role : split) {
      Set<String> set=roles.get(role);
      if (set == null) {
        set=new TreeSet<String>();
        roles.put(role,set);
      }
      set.add(key);
    }
  }
}
 

Example 14

From project chromattic, under directory /dataobject/src/main/java/org/chromattic/dataobject/runtime/.

Source file: ChromatticTransformer.java

  15 
vote

private boolean isInjected(FieldNode fieldNode){
  for (  AnnotationNode annotationNode : (List<AnnotationNode>)fieldNode.getAnnotations()) {
    if (annotationNode.getClassNode().equals(new ClassNode(Inject.class))) {
      return true;
    }
  }
  return false;
}
 

Example 15

From project cloud-management, under directory /src/main/java/com/proofpoint/cloudmanagement/service/.

Source file: InstanceResource.java

  15 
vote

@Inject public InstanceResource(Map<String,InstanceConnector> instanceConnectorMap,DnsManager dnsManager,TagManager tagManager){
  checkNotNull(instanceConnectorMap);
  checkNotNull(tagManager);
  checkNotNull(dnsManager);
  this.instanceConnectorMap=instanceConnectorMap;
  this.tagManager=tagManager;
  this.dnsManager=dnsManager;
}
 

Example 16

From project cometd, under directory /cometd-java/cometd-java-annotations/src/test/java/org/cometd/annotation/.

Source file: ClientAnnotationProcessorTest.java

  15 
vote

@Test public void testInjectables() throws Exception {
class I {
  }
class II extends I {
  }
@Service class S {
    @Inject private I i;
  }
  I i=new II();
  S s=new S();
  processor=new ClientAnnotationProcessor(bayeuxClient,i);
  boolean processed=processor.process(s);
  assertTrue(processed);
  assertSame(i,s.i);
}
 

Example 17

From project console_1, under directory /gwt/src/main/java/org/switchyard/console/client/model/.

Source file: SwitchYardStoreImpl.java

  15 
vote

/** 
 * Create a new SwitchYardStoreImpl.
 * @param dispatcher the injected dispatcher.
 * @param factory the injected bean factory.
 * @param bootstrap the injected bootstrap context.
 */
@Inject public SwitchYardStoreImpl(DispatchAsync dispatcher,BeanFactory factory,ApplicationProperties bootstrap){
  this._dispatcher=dispatcher;
  this._factory=factory;
  this._bootstrap=bootstrap;
  this._isStandalone=bootstrap.getProperty(ApplicationProperties.STANDALONE).equals("true");
}
 

Example 18

From project Core_2, under directory /dev-plugins/src/main/java/org/jboss/forge/dev/mvn/.

Source file: MavenPlugin.java

  15 
vote

@Inject public MavenPlugin(final Shell shell,final Project project,final ProjectFactory factory,final ResourceFactory resources){
  this.shell=shell;
  this.project=project;
  this.factory=factory;
  this.resources=resources;
}
 

Example 19

From project datavalve, under directory /samples/cdidemo/src/main/java/org/fluttercode/datavalve/samples/cdidemo/.

Source file: PersonSearchProvider.java

  15 
vote

@Inject public PersonSearchProvider(Session session){
  log.debug("Creating {}",PersonSearchProvider.class);
  setSession(session);
  init(Person.class,"p");
  getOrderKeyMap().put("id","p.id");
  getOrderKeyMap().put("name","p.lastName,p.firstName");
  getOrderKeyMap().put("phone","p.phone");
  addParameterResolver(new ExpressionParameterResolver());
  addRestriction("p.firstName like #{searchCriteria.firstNameWildcard}");
  addRestriction("upper(p.lastName) like #{searchCriteria.lastNameWildcard}");
  addRestriction("p.phone like #{searchCriteria.phoneWildcard}");
}
 

Example 20

From project e4-rendering, under directory /com.toedter.e4.demo.contacts.javafx/src/com/toedter/e4/demo/contacts/javafx/views/.

Source file: DetailsView.java

  15 
vote

@Inject public void setSelection(@Optional final Contact contact){
  if (contact != null) {
    writableValue.setValue(contact);
    String jpegString=contact.getJpegString();
    byte[] imageBytes=Base64.decode(jpegString.getBytes());
    ByteArrayInputStream is=new ByteArrayInputStream(imageBytes);
    imageView.setImage(new Image(is));
  }
}
 

Example 21

From project eclipse.platform.runtime, under directory /bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/.

Source file: InjectorImpl.java

  15 
vote

/** 
 * Make the processor visit all declared fields on the given class.
 */
private boolean processFields(Object userObject,PrimaryObjectSupplier objectSupplier,PrimaryObjectSupplier tempSupplier,Class<?> objectsClass,boolean track,List<Requestor> requestors){
  boolean injectedStatic=false;
  Field[] fields=objectsClass.getDeclaredFields();
  for (int i=0; i < fields.length; i++) {
    Field field=fields[i];
    if (Modifier.isStatic(field.getModifiers())) {
      if (hasInjectedStatic(objectsClass))       continue;
      injectedStatic=true;
    }
    if (!field.isAnnotationPresent(Inject.class))     continue;
    requestors.add(new FieldRequestor(field,this,objectSupplier,tempSupplier,userObject,track));
  }
  return injectedStatic;
}
 

Example 22

From project event-collector, under directory /event-collector/src/main/java/com/proofpoint/event/collector/.

Source file: EventTapWriter.java

  15 
vote

@Inject public EventTapWriter(@ServiceType("eventTap") ServiceSelector selector,@EventTap HttpClient httpClient,JsonCodec<List<Event>> eventCodec,@EventTap ScheduledExecutorService executorService,EventTapConfig config){
  Preconditions.checkNotNull(selector,"selector is null");
  Preconditions.checkNotNull(httpClient,"httpClient is null");
  Preconditions.checkNotNull(eventCodec,"eventCodec is null");
  Preconditions.checkNotNull(executorService,"executorService is null");
  Preconditions.checkNotNull(config,"config is null");
  this.selector=selector;
  this.httpClient=httpClient;
  this.eventsCodec=eventCodec;
  this.executorService=executorService;
  this.flowRefreshDuration=config.getEventTapRefreshDuration();
  refreshFlows();
  batchProcessor=new BatchProcessor<Event>("event-tap",this,config.getMaxBatchSize(),config.getQueueSize());
}
 

Example 23

From project faces_1, under directory /impl/src/main/java/org/jboss/seam/faces/view/config/.

Source file: ViewConfigStoreImpl.java

  15 
vote

/** 
 * setup the bean with the configuration from the extension <p/> It would be better if the extension could do this, but the extension cannot resolve the bean until after all lifecycle events have been processed
 */
@Inject public void setup(ViewConfigExtension extension){
  for (  Entry<String,Set<Annotation>> e : extension.getData().entrySet()) {
    for (    Annotation i : e.getValue()) {
      addAnnotationData(e.getKey(),i);
    }
  }
}
 

Example 24

From project flatpack-java, under directory /core/src/main/java/com/getperka/flatpack/codexes/.

Source file: DateCodex.java

  15 
vote

@Inject @SuppressWarnings("unchecked") void inject(TypeLiteral<D> dateType){
  try {
    this.constructor=(Constructor<D>)dateType.getRawType().getConstructor(long.class);
  }
 catch (  NoSuchMethodException e) {
    throw new RuntimeException("Should not use DateCodex with a " + dateType);
  }
}
 

Example 25

From project framework, under directory /impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/.

Source file: ParameterImpl.java

  15 
vote

@Inject public ParameterImpl(InjectionPoint ip){
  if (ip.getAnnotated().isAnnotationPresent(Name.class)) {
    this.key=ip.getAnnotated().getAnnotation(Name.class).value();
  }
 else {
    this.key=ip.getMember().getName();
  }
  this.type=Reflections.getGenericTypeArgument(ip.getMember(),0);
  this.viewScoped=ip.getAnnotated().isAnnotationPresent(ViewScoped.class);
  this.requestScoped=ip.getAnnotated().isAnnotationPresent(RequestScoped.class);
  this.sessionScoped=ip.getAnnotated().isAnnotationPresent(SessionScoped.class);
}
 

Example 26

From project greenhouse, under directory /src/main/java/com/springsource/greenhouse/events/load/.

Source file: NFJSLoader.java

  15 
vote

@Inject public NFJSLoader(EventLoaderRepository loaderRepository){
  this.loaderRepository=loaderRepository;
  this.restTemplate=new RestTemplate();
  this.timeSlotIdMap=new HashMap<Long,Long>();
  this.leaderIdMap=new HashMap<Long,Long>();
  this.topicSlotMap=new HashMap<Long,Long>();
}
 

Example 27

From project guartz, under directory /src/main/java/org/nnsoft/guice/guartz/.

Source file: JobSchedulerBuilder.java

  15 
vote

/** 
 * Add the produced  {@code Job} to the given {@code Scheduler}, and associate the related  {@code Trigger} with it.Users <b>MUST NOT</b> use this method!
 * @param scheduler The given {@code Scheduler}
 * @throws Exception If any error occurs
 */
@Inject public void schedule(Scheduler scheduler) throws Exception {
  if (cronExpression == null && trigger == null) {
    throw new ProvisionException(format("Impossible to schedule Job '%s' without cron expression",jobClass.getName()));
  }
  if (cronExpression != null && trigger != null) {
    throw new ProvisionException(format("Impossible to schedule Job '%s' with cron expression " + "and an associated Trigger at the same time",jobClass.getName()));
  }
  JobKey jobKey=jobKey(DEFAULT.equals(jobName) ? jobClass.getName() : jobName,jobGroup);
  TriggerKey triggerKey=triggerKey(DEFAULT.equals(triggerName) ? jobClass.getCanonicalName() : triggerName,triggerGroup);
  if (updateExistingTrigger && scheduler.checkExists(triggerKey)) {
    scheduler.unscheduleJob(triggerKey);
  }
  scheduler.scheduleJob(newJob(jobClass).withIdentity(jobKey).requestRecovery(requestRecovery).storeDurably(storeDurably).build(),(trigger == null) ? newTrigger().withIdentity(triggerKey).withSchedule(cronSchedule(cronExpression).inTimeZone(timeZone)).withPriority(priority).build() : trigger);
}
 

Example 28

From project guice-automatic-injection, under directory /core/src/main/java/de/devsurf/injection/guice/serviceloader/.

Source file: ServiceLoaderModule.java

  15 
vote

@Inject public void init(Set<ScannerFeature> features){
  for (  ScannerFeature feature : features) {
    if (feature instanceof ServiceLoaderFeature) {
      enabled=true;
    }
  }
}
 

Example 29

From project guice-jit-providers, under directory /core/test/com/googlecode/guice/.

Source file: Jsr330Test.java

  15 
vote

public void testGuicifyWithDependencies(){
  Provider<String> jsr330Provider=new Provider<String>(){
    @Inject double d;
    int i;
    @Inject void injectMe(    int i){
      this.i=i;
    }
    public String get(){
      return d + "-" + i;
    }
  }
;
  final com.google.inject.Provider<String> guicified=Providers.guicify(jsr330Provider);
  assertTrue(guicified instanceof HasDependencies);
  Set<Dependency<?>> actual=((HasDependencies)guicified).getDependencies();
  validateDependencies(actual,jsr330Provider.getClass());
  Injector injector=Guice.createInjector(new AbstractModule(){
    @Override protected void configure(){
      bind(String.class).toProvider(guicified);
      bind(int.class).toInstance(1);
      bind(double.class).toInstance(2.0d);
    }
  }
);
  Binding<String> binding=injector.getBinding(String.class);
  assertEquals("2.0-1",binding.getProvider().get());
  validateDependencies(actual,jsr330Provider.getClass());
}
 

Example 30

From project incubator-deltaspike, under directory /deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/.

Source file: TransactionStrategyHelper.java

  15 
vote

/** 
 * Scan the given class and return all the injected EntityManager fields. <p>Attention: we do only pick up EntityManagers which use &#064;Inject!</p>
 */
private void collectEntityManagerQualifiersOnClass(Set<Class<? extends Annotation>> emQualifiers,Class target){
  Field[] fields=target.getDeclaredFields();
  for (  Field field : fields) {
    if (EntityManager.class.equals(field.getType())) {
      if (field.getAnnotation(Inject.class) != null) {
        boolean qualifierFound=false;
        Class<? extends Annotation> qualifier=getFirstQualifierAnnotation(field.getAnnotations());
        if (qualifier != null) {
          emQualifiers.add(qualifier);
          qualifierFound=true;
        }
        if (!qualifierFound) {
          emQualifiers.add(Default.class);
        }
      }
    }
  }
  Class superClass=target.getSuperclass();
  if (!Object.class.equals(superClass)) {
    collectEntityManagerQualifiersOnClass(emQualifiers,superClass);
  }
}
 

Example 31

From project international, under directory /impl/src/main/java/org/jboss/seam/international/locale/.

Source file: AvailableLocales.java

  15 
vote

@Inject public void init(Instance<LocaleConfiguration> configuration){
  locales=new ArrayList<Locale>();
  if (!configuration.isAmbiguous() && !configuration.isUnsatisfied()) {
    Set<String> keys=configuration.get().getSupportedLocaleKeys();
    log.trace("Found " + keys.size() + " locales in configuration");
    for (    String localeKey : keys) {
      try {
        Locale lc=LocaleUtils.toLocale(localeKey);
        locales.add(lc);
      }
 catch (      IllegalArgumentException e) {
        log.error("AvailableLocales: Supported Locale key of " + localeKey + " was not formatted correctly",e);
      }
    }
  }
  Collections.sort(locales,new Comparator<Locale>(){
    public int compare(    final Locale a,    final Locale b){
      return a.toString().compareTo(b.toString());
    }
  }
);
  locales=Collections.unmodifiableList(locales);
}
 

Example 32

From project jclouds-abiquo, under directory /core/src/main/java/org/jclouds/abiquo/compute/functions/.

Source file: VirtualMachineToNodeMetadata.java

  15 
vote

@Inject public VirtualMachineToNodeMetadata(final VirtualMachineTemplateToImage virtualMachineTemplateToImage,final VirtualMachineTemplateToHardware virtualMachineTemplateToHardware,final VirtualMachineStateToNodeState virtualMachineStateToNodeState,final DatacenterToLocation datacenterToLocation){
  this.virtualMachineTemplateToImage=checkNotNull(virtualMachineTemplateToImage,"virtualMachineTemplateToImage");
  this.virtualMachineTemplateToHardware=checkNotNull(virtualMachineTemplateToHardware,"virtualMachineTemplateToHardware");
  this.virtualMachineStateToNodeState=checkNotNull(virtualMachineStateToNodeState,"virtualMachineStateToNodeState");
  this.datacenterToLocation=checkNotNull(datacenterToLocation,"datacenterToLocation");
}
 

Example 33

From project jclouds-chef, under directory /core/src/main/java/org/jclouds/chef/filters/.

Source file: SignedHeaderAuth.java

  15 
vote

@Inject public SignedHeaderAuth(SignatureWire signatureWire,@Identity String userId,PrivateKey privateKey,@TimeStamp Provider<String> timeStampProvider,Crypto crypto,HttpUtils utils){
  this.signatureWire=signatureWire;
  this.userId=userId;
  this.privateKey=privateKey;
  this.timeStampProvider=timeStampProvider;
  this.crypto=crypto;
  this.emptyStringHash=hashBody(Payloads.newStringPayload(""));
  this.utils=utils;
}
 

Example 34

From project jclouds-examples, under directory /minecraft-compute/src/main/java/org/jclouds/examples/minecraft/.

Source file: MinecraftController.java

  15 
vote

@Inject MinecraftController(Closer closer,NodeManager nodeManager,Provider<InitScript> daemonFactory,@Named("minecraft.port") int port,@Named("minecraft.group") String group,@Named("minecraft.mx") int maxHeap){
  this.closer=closer;
  this.nodeManager=nodeManager;
  this.daemonFactory=daemonFactory;
  this.port=port;
  this.group=group;
  this.maxHeap=maxHeap;
}
 

Example 35

From project jclouds-ovh-compute, under directory /src/main/java/org/jclouds/ovh/compute/functions/.

Source file: InstanceStructToNodeMetadata.java

  15 
vote

@Inject InstanceStructToNodeMetadata(FindHardwareForServer findHardwareForServer,FindLocationForServer findLocationForServer,FindImageForServer findImageForServer,GroupNamingConvention.Factory namingConvention){
  this.nodeNamingConvention=checkNotNull(namingConvention,"namingConvention").createWithoutPrefix();
  this.findHardwareForServer=checkNotNull(findHardwareForServer,"findHardwareForServer");
  this.findLocationForServer=checkNotNull(findLocationForServer,"findLocationForServer");
  this.findImageForServer=checkNotNull(findImageForServer,"findImageForServer");
}
 

Example 36

From project jsf-test, under directory /jsf-mockito/src/main/java/org/jboss/test/faces/mockito/runner/.

Source file: FacesMockitoRunner.java

  15 
vote

/** 
 * Process injections.
 * @param target the target test instance
 */
private void processInjections(Object target){
  for (Class<?> clazz=target.getClass(); clazz != Object.class; clazz=clazz.getSuperclass()) {
    for (    Field field : clazz.getDeclaredFields()) {
      if (field.getAnnotation(Inject.class) != null) {
        Object injection=getInjection(field.getType());
        if (injection != null) {
          inject(field,target,injection);
        }
      }
    }
  }
}
 

Example 37

From project juzu, under directory /core/src/main/java/juzu/impl/fs/spi/classloader/.

Source file: ClassLoaderFileSystem.java

  15 
vote

public ClassLoaderFileSystem(ClassLoader classLoader) throws IOException {
  URLCache cache=new URLCache();
  cache.add(classLoader);
  cache.add(Inject.class);
  this.cache=cache;
  this.classLoader=classLoader;
}
 

Example 38

From project lime-mvc, under directory /src/org/zdevra/guice/mvc/parameters/.

Source file: InjectorParam.java

  15 
vote

private boolean isInjectAnnotated(Method method){
  Annotation inject=method.getAnnotation(Inject.class);
  if (inject != null) {
    return true;
  }
  return false;
}
 

Example 39

From project maven3-support, under directory /maven3-plugin/src/main/java/org/hudsonci/maven/plugin/builder/internal/.

Source file: MavenBuilderServiceImpl.java

  15 
vote

@Inject public MavenBuilderServiceImpl(final SecurityService security,final DescriptorService descriptors,final ProjectService projects,final BuildService builds){
  this.security=checkNotNull(security);
  this.descriptors=checkNotNull(descriptors);
  this.projects=checkNotNull(projects);
  this.builds=checkNotNull(builds);
}
 

Example 40

From project MEditor, under directory /editor-common/editor-common-client/src/main/java/cz/mzk/editor/client/gwtrpcds/.

Source file: InputTreeGwtRPCDS.java

  15 
vote

/** 
 * Instantiates a new input tree gwt rpcds.
 * @param dispatcher the dispatcher
 */
@Inject public InputTreeGwtRPCDS(DispatchAsync dispatcher,LangConstants lang){
  this.dispatcher=dispatcher;
  DataSourceField field;
  field=new DataSourceTextField(Constants.ATTR_ID,"id");
  field.setPrimaryKey(true);
  field.setRequired(true);
  field.setHidden(true);
  addField(field);
  field=new DataSourceTextField(Constants.ATTR_PARENT,"parent");
  field.setForeignKey(Constants.ATTR_ID);
  field.setHidden(true);
  addField(field);
  field=new DataSourceTextField(Constants.ATTR_NAME,lang.name());
  field.setRequired(true);
  field.setHidden(true);
  addField(field);
  field=new DataSourceTextField(Constants.ATTR_BARCODE,"ID");
  field.setAttribute("width","60%");
  field.setRequired(true);
  addField(field);
  field=new DataSourceTextField(Constants.ATTR_INGEST_INFO,"ingestInfo");
  field.setHidden(true);
  field.setRequired(true);
  addField(field);
}
 

Example 41

From project monitor-event-tap, under directory /src/main/java/com/proofpoint/event/monitor/.

Source file: AmazonEmailAlerter.java

  15 
vote

@Inject public AmazonEmailAlerter(AmazonConfig config,AmazonSimpleEmailService emailService){
  Preconditions.checkNotNull(config,"config is null");
  Preconditions.checkNotNull(emailService,"emailService is null");
  fromAddress=config.getFromAddress();
  toAddress=config.getToAddress();
  this.emailService=emailService;
}
 

Example 42

From project myfaces-extcdi, under directory /jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/.

Source file: EditableWindowContextManagerProxy.java

  15 
vote

/** 
 * Workaround for a producer-method which produces a session-scoped instance. Workaround for Weld 1.x
 * @param windowContextConfig current windowContextConfig
 * @param conversationConfig current conversationConfig
 * @param beanManager current beanManager
 */
@Inject public EditableWindowContextManagerProxy(WindowContextConfig windowContextConfig,ConversationConfig conversationConfig,BeanManager beanManager){
  WindowContextManagerFactory windowContextManagerFactory=CodiUtils.getContextualReferenceByClass(beanManager,WindowContextManagerFactory.class,true);
  if (windowContextManagerFactory != null) {
    this.editableWindowContextManager=windowContextManagerFactory.createWindowContextManager(windowContextConfig,conversationConfig);
  }
 else {
    this.editableWindowContextManager=new DefaultWindowContextManager(windowContextConfig,conversationConfig,ProjectStageProducer.getInstance().getProjectStage(),beanManager);
  }
}
 

Example 43

From project nexus-p2-repository-plugin, under directory /src/main/java/org/sonatype/nexus/plugins/p2/repository/internal/.

Source file: DefaultP2MetadataGenerator.java

  15 
vote

@Inject public DefaultP2MetadataGenerator(final RepositoryRegistry repositories,final MimeUtil mimeUtil,final ArtifactRepository artifactRepository,final MetadataRepository metadataRepository,final Publisher publisher){
  this.repositories=repositories;
  this.mimeUtil=mimeUtil;
  this.artifactRepository=artifactRepository;
  this.metadataRepository=metadataRepository;
  this.publisher=publisher;
  configurations=new HashMap<String,P2MetadataGeneratorConfiguration>();
}
 

Example 44

From project openwebbeans, under directory /samples/guess/src/main/java/org/apache/webbeans/sample/guess/.

Source file: JSFNumberGuess.java

  15 
vote

@Inject public JSFNumberGuess(@NextNumber Integer number,@Highest Integer maxNumber){
  this.no=number;
  this.smallRange=1;
  this.maxRange=maxNumber;
  this.remainder=10;
}