Java Code Examples for javax.annotation.PostConstruct

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 james, under directory /protocols-library/src/test/java/org/apache/james/protocols/lib/mock/.

Source file: MockProtocolHandlerLoader.java

  33 
vote

private void postConstruct(Object resource) throws IllegalAccessException, InvocationTargetException {
  Method[] methods=resource.getClass().getMethods();
  for (  Method method : methods) {
    PostConstruct postConstructAnnotation=method.getAnnotation(PostConstruct.class);
    if (postConstructAnnotation != null) {
      Object[] args={};
      method.invoke(resource,args);
    }
  }
}
 

Example 2

From project managed-bean, under directory /metadata-jbmeta/src/main/java/org/jboss/managed/bean/metadata/jbmeta/annotation/processor/.

Source file: PostConstructProcessor.java

  32 
vote

@Override public void process(ManagedBeanMetaDataImpl managedBean,Method method){
  PostConstruct postConstruct=method.getAnnotation(PostConstruct.class);
  if (postConstruct == null) {
    return;
  }
  if (!method.getDeclaringClass().getName().equals(managedBean.getManagedBeanClass())) {
    return;
  }
  InterceptorMetadata<?> interceptorMetaData=new DefaultMetadataCachingReader().getTargetClassInterceptorMetadata(method.getDeclaringClass());
  managedBean.setPostConstructMethod(interceptorMetaData);
}
 

Example 3

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

Source file: AnnotationProcessor.java

  31 
vote

protected boolean processPostConstruct(Object bean){
  if (bean == null)   return false;
  List<Method> postConstructs=new ArrayList<>();
  for (Class<?> c=bean.getClass(); c != null; c=c.getSuperclass()) {
    boolean foundInClass=false;
    Method[] methods=c.getDeclaredMethods();
    for (    Method method : methods) {
      PostConstruct postConstruct=method.getAnnotation(PostConstruct.class);
      if (postConstruct != null) {
        if (foundInClass)         throw new RuntimeException("Invalid @PostConstruct method " + method + ": another method with the same annotation exists");
        foundInClass=true;
        if (method.getReturnType() != Void.TYPE)         throw new RuntimeException("Invalid @PostConstruct method " + method + ": it must have void return type");
        if (method.getParameterTypes().length > 0)         throw new RuntimeException("Invalid @PostConstruct method " + method + ": it must have no parameters");
        if (Modifier.isStatic(method.getModifiers()))         throw new RuntimeException("Invalid @PostConstruct method " + method + ": it must not be static");
        postConstructs.add(method);
      }
    }
  }
  Collections.reverse(postConstructs);
  boolean result=false;
  for (  Method method : postConstructs) {
    invokeMethod(bean,method);
    result=true;
  }
  return result;
}
 

Example 4

From project agorava-core, under directory /agorava-core-impl-cdi/src/main/java/org/agorava/core/cdi/.

Source file: JsonMapperJackson.java

  29 
vote

@PostConstruct protected void init(){
  objectMapper.enable(WRITE_ENUMS_USING_TO_STRING).setSerializationInclusion(Inclusion.NON_NULL);
  objectMapper.enable(READ_ENUMS_USING_TO_STRING);
  for (  Module module : moduleInstances) {
    registerModule(module);
  }
}
 

Example 5

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

Source file: LifeCycleManager.java

  29 
vote

private void startInstance(Object obj) throws IllegalAccessException, InvocationTargetException {
  log.debug("Starting %s",obj.getClass().getName());
  LifeCycleMethods methods=methodsMap.get(obj.getClass());
  for (  Method postConstruct : methods.methodsFor(PostConstruct.class)) {
    log.debug("\t%s()",postConstruct.getName());
    postConstruct.invoke(obj);
  }
}
 

Example 6

From project android-rackspacecloud, under directory /extensions/ssh/jsch/src/main/java/org/jclouds/ssh/jsch/.

Source file: JschSshClient.java

  29 
vote

@PostConstruct public void connect(){
  disconnect();
  JSch jsch=new JSch();
  session=null;
  try {
    session=jsch.getSession(username,host.getHostAddress(),port);
    if (timeout != 0)     session.setTimeout(timeout);
    logger.debug("%s@%s:%d: Session created.",username,host.getHostAddress(),port);
    if (password != null) {
      session.setPassword(password);
    }
 else {
      jsch.addIdentity(username,privateKey,null,emptyPassPhrase);
    }
  }
 catch (  JSchException e) {
    throw new SshException(String.format("%s@%s:%d: Error creating session.",username,host.getHostAddress(),port),e);
  }
  java.util.Properties config=new java.util.Properties();
  config.put("StrictHostKeyChecking","no");
  session.setConfig(config);
  try {
    session.connect();
  }
 catch (  JSchException e) {
    throw new SshException(String.format("%s@%s:%d: Error connecting to session.",username,host.getHostAddress(),port),e);
  }
  logger.debug("%s@%s:%d: Session connected.",username,host.getHostAddress(),port);
}
 

Example 7

From project arquillian-extension-spring, under directory /arquillian-service-integration-spring-2.5-int-tests/src/test/java/org/jboss/arquillian/spring/testsuite/beans/repository/impl/.

Source file: DefaultEmployeeRepository.java

  29 
vote

/** 
 * <p>Initializes the bean.</p>
 */
@PostConstruct private void init(){
  Employee employee;
  employee=new Employee();
  employee.setName("John Smith");
  employees.add(employee);
  employee=new Employee();
  employee.setName("Marty Smith");
  employees.add(employee);
}
 

Example 8

From project arquillian-showcase, under directory /cdi/src/main/java/com/acme/cdi/event/.

Source file: PrintSpool.java

  29 
vote

@PostConstruct public void initialize(){
  System.out.println("Initializing print spool");
  documents=new HashMap<JobSize,List<Document>>();
  for (  JobSize s : JobSize.values()) {
    documents.put(s,new ArrayList<Document>());
  }
}
 

Example 9

From project bam, under directory /integration/jbossas/src/main/java/org/overlord/bam/collector/jbossas7/.

Source file: JBossAS7CollectorContext.java

  29 
vote

/** 
 * This method initializes the collector context.
 */
@PostConstruct public void init(){
  try {
    InitialContext ctx=new InitialContext();
    _transactionManager=(TransactionManager)ctx.lookup(TRANSACTION_MANAGER);
  }
 catch (  Exception e) {
    LOG.log(Level.SEVERE,java.util.PropertyResourceBundle.getBundle("bam-jbossas.Messages").getString("BAM-JBOSSAS-1"),e);
  }
}
 

Example 10

From project blacktie, under directory /blacktie-admin-services/src/main/java/org/jboss/narayana/blacktie/administration/.

Source file: QueueReaperBean.java

  29 
vote

@PostConstruct public void start() throws Exception {
  log.info("QueueReaper Started");
  prop=new Properties();
  XMLParser.loadProperties("btconfig.xsd","btconfig.xml",prop);
  this.interval=Integer.parseInt(prop.getProperty("QueueReaperInterval","30")) * 1000;
  for (  Timer timer : timerService.getTimers()) {
    if (timer.getInfo().equals("queue reaper")) {
      log.info("QeueueReaper cancel a timer");
      timer.cancel();
    }
  }
  timerService.createTimer(interval,"queue reaper");
  log.info("QueueReaper create timer with " + interval + "ms");
}
 

Example 11

From project c24-spring, under directory /c24-spring-batch/src/main/java/biz/c24/io/spring/batch/reader/.

Source file: C24ItemReader.java

  29 
vote

/** 
 * Asserts that we have been properly configured
 */
@PostConstruct public void validateConfiguration(){
  Assert.notNull(elementType,"Element type must be set, either explicitly or by setting the model");
  Assert.notNull(source,"Source must be set");
  if (elementStopPattern != null) {
    Assert.notNull(elementStartPattern,"elementStopPattern can only be used if an elementStartPattern is also set");
  }
}
 

Example 12

From project camelpe, under directory /examples/loan-broker-jboss7/src/main/java/net/camelpe/examples/jboss7/loanbroker/queue/.

Source file: JBoss7CamelContextConfiguration.java

  29 
vote

@PostConstruct public void createQueues() throws Exception {
  this.log.info("Creating queues ...");
  final MBeanServer mbeanServer=ManagementFactory.getPlatformMBeanServer();
  this.log.info("Found PlatformMBeanServer [{}]",mbeanServer);
  this.log.info("JMX Domains: {}",Arrays.toString(mbeanServer.getDomains()));
  for (  final JmsResources.QueueDefinition queueDef : JmsResources.loanBrokerQueues()) {
    mbeanServer.invoke(new ObjectName("org.hornetq:module=JMS,type=Server"),"createQueue",new Object[]{queueDef.getName(),queueDef.getBinding()},new String[]{"java.lang.String","java.lang.String"});
    this.log.info("Created queue [{}]",queueDef);
  }
}
 

Example 13

From project capedwarf-blue, under directory /admin/src/main/java/org/jboss/capedwarf/admin/.

Source file: DatastoreViewer.java

  29 
vote

@PostConstruct private void loadEntities(){
  rows.clear();
  SortedSet<String> propertyNameSet=new TreeSet<String>();
  for (  Entity entity : getDatastore().prepare(new Query(getSelectedEntityKind())).asIterable()) {
    propertyNameSet.addAll(entity.getProperties().keySet());
    rows.add(new Row(entity));
  }
  properties.clear();
  properties.addAll(propertyNameSet);
}
 

Example 14

From project Carolina-Digital-Repository, under directory /services/src/main/java/edu/unc/lib/dl/cdr/services/rest/.

Source file: CatchupConductorRestController.java

  29 
vote

@PostConstruct public void init(){
  serviceNameLookup=new HashMap<String,String>();
  for (  ObjectEnhancementService service : catchUpService.getServices()) {
    serviceNameLookup.put(service.getClass().getName(),service.getName());
  }
}
 

Example 15

From project cdi-arq-workshop, under directory /arquillian-showcase/cdi/src/main/java/com/acme/cdi/event/.

Source file: PrintSpool.java

  29 
vote

@PostConstruct public void initialize(){
  System.out.println("Initializing print spool");
  documents=new HashMap<JobSize,List<Document>>();
  for (  JobSize s : JobSize.values()) {
    documents.put(s,new ArrayList<Document>());
  }
}
 

Example 16

From project cloudify, under directory /restful/src/main/java/org/cloudifysource/rest/controllers/.

Source file: ServiceController.java

  29 
vote

/** 
 * Initializing the cloud configuration. Executed by Spring after the object is instantiated and the dependencies injected.
 */
@PostConstruct public void init(){
  logger.info("Initializing service controller cloud configuration");
  this.cloud=readCloud();
  if (cloud != null) {
    if (this.cloud.getTemplates().isEmpty()) {
      throw new IllegalArgumentException("No templates defined in cloud configuration!");
    }
    this.defaultTemplateName=this.cloud.getTemplates().keySet().iterator().next();
    logger.info("Setting default template name to: " + defaultTemplateName + ". This template will be used for services that do not specify an explicit template");
    this.managementTemplate=this.cloud.getTemplates().get(this.cloud.getConfiguration().getManagementMachineTemplate());
  }
 else {
    logger.info("Service Controller is running in local cloud mode");
  }
  try {
    if (StringUtils.isBlank(temporaryFolder)) {
      temporaryFolder=getTempFolderPath();
    }
  }
 catch (  final IOException e) {
    logger.log(Level.SEVERE,"ServiceController failed to locate temp directory",e);
    throw new IllegalStateException("ServiceController failed to locate temp directory",e);
  }
  startLifecycleLogsCleanupTask();
}
 

Example 17

From project common_1, under directory /src/main/java/org/powertac/common/.

Source file: XMLMessageConverter.java

  29 
vote

@SuppressWarnings("rawtypes") @PostConstruct public void afterPropertiesSet(){
  xstream=new XStream();
  try {
    List<Class> classes=findMyTypes("org.powertac.common");
    for (    Class clazz : classes) {
      log.info("processing class " + clazz.getName());
      xstream.processAnnotations(clazz);
    }
  }
 catch (  IOException e) {
    log.error("failed to process annotation",e);
  }
catch (  ClassNotFoundException e) {
    log.error("failed to process annotation",e);
  }
  for (  Class commandClazz : commandClasses) {
    xstream.processAnnotations(commandClazz);
  }
  xstream.autodetectAnnotations(true);
  xstream.aliasSystemAttribute(null,"class");
}
 

Example 18

From project cron, under directory /examples/swing_memory_grapher/src/main/java/org/jboss/seam/cron/examples/swinggrapher/.

Source file: SwingGrapherForm.java

  29 
vote

/** 
 * Initialise the chart visuals.
 */
@PostConstruct public void initChart(){
  log.info("Initializing");
  final JFreeChart chart=ChartFactory.createLineChart3D("Free Memory","Time","Bytes",catDataSet,PlotOrientation.VERTICAL,true,true,true);
  final ChartPanel chartPanel=new ChartPanel(chart);
  setContentPane(chartPanel);
}
 

Example 19

From project ddd-cqrs-sample, under directory /src/main/java/pl/com/bottega/erp/sales/webui/.

Source file: AddSampleProductsOnStartup.java

  29 
vote

@PostConstruct public void addSampleProductsToRepo(){
  TransactionStatus tx=transactionManager.getTransaction(new DefaultTransactionDefinition());
  for (int i=1; i < 21; i++) {
    em.persist(product(String.format("Electronic Gizmo %02d",i),0.99));
    em.persist(product(String.format("Cell Phone with 32GB flash memory %02d",i),299.99));
    em.persist(food(String.format("Software Engineering Audiobook %02d",i),17.50));
    em.persist(drug(String.format("PC Game including Zombies Part %02d",i),39.89));
    em.persist(product(String.format("Tablet with Keyboard %02d",i),459.99));
  }
  em.persist(new Client());
  transactionManager.commit(tx);
}
 

Example 20

From project demoiselle-contrib, under directory /demoiselle-fuselage/src/main/java/br/gov/frameworkdemoiselle/fuselage/filter/.

Source file: PublicResources.java

  29 
vote

@PostConstruct protected void init(){
  List<String> urls=config.getUrlsEquals();
  List<SecurityResource> resources;
  try {
    resources=bc.findResourceByName("public_url");
  }
 catch (  RuntimeException e) {
    resources=new ArrayList<SecurityResource>();
    logger.warn("RuntimeException retrieving public_url resources");
  }
  for (  SecurityResource resource : resources)   urls.add(resource.getValue());
  resourceMap.put("public_url",urls);
  urls=config.getUrlsStartswith();
  try {
    resources=bc.findResourceByName("public_url_startswith");
  }
 catch (  RuntimeException e) {
    resources=new ArrayList<SecurityResource>();
    logger.warn("RuntimeException retrieving public_url_startswith resources");
  }
  for (  SecurityResource resource : resources)   urls.add(resource.getValue());
  resourceMap.put("public_url_startswith",urls);
}
 

Example 21

From project demonstrator-backend, under directory /demonstrator-backend-ejb/src/main/java/org/marssa/demonstrator/beans/.

Source file: DAQBean.java

  29 
vote

@PostConstruct private void init() throws ConfigurationError, NoConnection, UnknownHostException, JAXBException, FileNotFoundException {
  logger.info("Initializing DAQ Bean");
  JAXBContext context=JAXBContext.newInstance(new Class[]{Settings.class});
  Unmarshaller unmarshaller=context.createUnmarshaller();
  InputStream is=this.getClass().getClassLoader().getResourceAsStream("configuration/settings.xml");
  Settings settings=(Settings)unmarshaller.unmarshal(is);
  for (  DAQType daq : settings.getDaqs().getDaq()) {
    AddressType addressElement=daq.getSocket();
    MString address;
    if (addressElement.getHost().getIp() == null || addressElement.getHost().getIp().isEmpty()) {
      String hostname=addressElement.getHost().getHostname();
      address=new MString(Inet4Address.getByName(hostname).getAddress().toString());
    }
 else {
      address=new MString(addressElement.getHost().getIp());
    }
    logger.info("Found configuration for {} connected to {}, port {}",new Object[]{daq.getDAQname(),address,addressElement.getPort()});
    LabJack lj;
switch (daq.getType()) {
case LAB_JACK_U_3:
      lj=LabJackU3.getInstance(address,new MInteger(daq.getSocket().getPort()));
    break;
case LAB_JACK_UE_9:
  lj=LabJackUE9.getInstance(address,new MInteger(daq.getSocket().getPort()));
break;
default :
throw new ConfigurationError("Unknown DAQ type: " + daq.getType());
}
daqs.put(address.toString() + ":" + addressElement.getPort(),lj);
}
logger.info("Initialized DAQ Bean");
}
 

Example 22

From project dev-examples, under directory /input-demo/src/main/java/org/richfaces/demo/.

Source file: CountriesBean.java

  29 
vote

@PostConstruct public void initialize(){
  try {
    JAXBContext countryContext=JAXBContext.newInstance(Countries.class);
    Unmarshaller unmarshaller=countryContext.createUnmarshaller();
    ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
    URL dataUrl=classLoader.getResource("org/richfaces/demo/countries.xml");
    countries=((Countries)unmarshaller.unmarshal(dataUrl)).getCountries();
  }
 catch (  JAXBException e) {
    throw new FacesException(e.getMessage(),e);
  }
}
 

Example 23

From project doorkeeper, under directory /core/src/main/java/net/dataforte/doorkeeper/account/provider/jdbc/.

Source file: JdbcAccountProvider.java

  29 
vote

@PostConstruct public void init(){
  try {
    if (jndi != null) {
      dataSource=JNDIUtils.lookup(jndi,DataSource.class);
    }
  }
 catch (  NamingException e) {
    throw new IllegalStateException("Could not retrieve DataSource from JNDI " + jndi,e);
  }
}
 

Example 24

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.addons.generic/src/com/toedter/e4/ui/workbench/addons/generic/minmax/.

Source file: GenericMinMaxAddon.java

  29 
vote

@PostConstruct void hookListeners(){
  System.out.println("GenericMinMaxAddon.hookListeners()");
  System.out.println("EventBroker: " + eventBroker);
  eventBroker.subscribe(UIEvents.UIElement.TOPIC_WIDGET,widgetListener);
  eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS,tagListener);
}
 

Example 25

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

Source file: InjectorImpl.java

  29 
vote

public void inject(Object object,PrimaryObjectSupplier objectSupplier,PrimaryObjectSupplier tempSupplier){
  ArrayList<Requestor> requestors=new ArrayList<Requestor>();
  processClassHierarchy(object,objectSupplier,tempSupplier,true,true,requestors);
  boolean haveLink=false;
  for (  Requestor requestor : requestors) {
    if (requestor.shouldTrack())     haveLink=true;
  }
  if (!haveLink)   requestors.add(new ClassRequestor(object.getClass(),this,objectSupplier,tempSupplier,object,true));
  resolveRequestorArgs(requestors,objectSupplier,tempSupplier,false,true,true);
  for (  Requestor requestor : requestors) {
    if (requestor.isResolved())     requestor.execute();
  }
  rememberInjectedObject(object,objectSupplier);
  processAnnotated(PostConstruct.class,object,object.getClass(),objectSupplier,tempSupplier,new ArrayList<Class<?>>(5));
  for (  Requestor requestor : requestors) {
    requestor.clearTempSupplier();
  }
}
 

Example 26

From project edg-examples, under directory /carmart-single/src/main/java/com/redhat/datagrid/carmart/session/.

Source file: PopulateCache.java

  29 
vote

@PostConstruct public void startup(){
  BasicCache<String,Object> cars=provider.getCacheContainer().getCache(CarManager.CACHE_NAME);
  List<String> carNumbers=new ArrayList<String>();
  try {
    Car c=new Car("Ford Focus",1.6,CarType.COMBI,"white","FML 23-25",Country.CZECH_REPUBLIC);
    carNumbers.add(c.getNumberPlate());
    cars.put(CarManager.encode(c.getNumberPlate()),c);
    c=new Car("BMW X3",2.0,CarType.SEDAN,"gray","1P3 2632",Country.CZECH_REPUBLIC);
    carNumbers.add(c.getNumberPlate());
    cars.put(CarManager.encode(c.getNumberPlate()),c);
    c=new Car("Ford Mondeo",2.2,CarType.COMBI,"blue","1B2 1111",Country.USA);
    carNumbers.add(c.getNumberPlate());
    cars.put(CarManager.encode(c.getNumberPlate()),c);
    c=new Car("Mazda MX-5",1.8,CarType.CABRIO,"red","6T4 2526",Country.USA);
    carNumbers.add(c.getNumberPlate());
    cars.put(CarManager.encode(c.getNumberPlate()),c);
    c=new Car("VW Golf",1.6,CarType.HATCHBACK,"yellow","2B2 4946",Country.GERMANY);
    carNumbers.add(c.getNumberPlate());
    cars.put(CarManager.encode(c.getNumberPlate()),c);
    cars.put(CarManager.CAR_NUMBERS_KEY,carNumbers);
  }
 catch (  Exception e) {
    log.warning("An exception occured while populating the database!");
  }
  log.info("Successfully imported data!");
}
 

Example 27

From project ehour, under directory /eHour-service/src/main/java/net/rrm/ehour/config/.

Source file: TranslationDiscovery.java

  29 
vote

@PostConstruct public void scanTranslations(){
  String absoluteTranslationsPath=EhourHomeUtil.getTranslationsDir(eHourHome,translationsDir);
  File transDir=new File(absoluteTranslationsPath);
  LOG.info("Looking for translations in " + transDir.getAbsolutePath());
  if (transDir.exists()) {
    translations=scanTranslations(transDir);
  }
 else {
    LOG.fatal("Translations dir " + transDir + " does not exist");
    translations=null;
  }
}
 

Example 28

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

Source file: BatchProcessor.java

  29 
vote

@PostConstruct public void start(){
  Future<?> future=executor.submit(new Runnable(){
    @Override public void run(){
      while (!Thread.interrupted()) {
        final List<T> entries=new ArrayList<T>(maxBatchSize);
        try {
          T first=queue.take();
          entries.add(first);
          queue.drainTo(entries,maxBatchSize - 1);
          handler.processBatch(entries);
        }
 catch (        InterruptedException e) {
          Thread.currentThread().interrupt();
        }
      }
    }
  }
);
  this.future.set(future);
}
 

Example 29

From project faces, under directory /Proyectos/showcase/src/main/java/org/primefaces/examples/touch/.

Source file: WeatherController.java

  29 
vote

@PostConstruct public void init(){
  cities=new LinkedHashMap<String,String>();
  cities.put("Istanbul","TUXX0014");
  cities.put("Barcelona","SPXX0015");
  cities.put("London","UKXX0085");
  cities.put("New York","USNY0996");
  cities.put("Paris","FRXX2071");
  cities.put("Rome","ITXX0067");
}
 

Example 30

From project faces_1, under directory /examples/viewconfig/src/main/java/org/jboss/seam/faces/examples/viewconfig/model/.

Source file: ItemDao.java

  29 
vote

@PostConstruct void initializeList(){
  itemMap=new HashMap<Integer,Item>();
  itemMap.put(1,new Item(1,"Sock","demo"));
  itemMap.put(2,new Item(2,"Pants","demo"));
  itemMap.put(3,new Item(3,"Shirt","admin"));
  itemMap.put(4,new Item(4,"Shoe","admin"));
  index=5;
}
 

Example 31

From project floodlight, under directory /src/main/java/net/floodlightcontroller/counter/.

Source file: CounterStore.java

  29 
vote

/** 
 * Post construction init method to kick off the health check and random (test) counter threads
 */
@PostConstruct public void startUp(){
  this.heartbeatCounter=this.createCounter("CounterStore heartbeat",CounterValue.CounterType.LONG);
  this.randomCounter=this.createCounter("CounterStore random",CounterValue.CounterType.LONG);
  Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable(){
    public void run(){
      heartbeatCounter.increment();
      randomCounter.increment(new Date(),(long)(Math.random() * 100));
    }
  }
,100,100,TimeUnit.MILLISECONDS);
}
 

Example 32

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

Source file: EntityManagerFactoryProducer.java

  29 
vote

@PostConstruct public void loadPersistenceUnits(){
  ClassLoader contextClassLoader=Thread.currentThread().getContextClassLoader();
  for (  String persistenceUnit : loadPersistenceUnitFromClassloader(contextClassLoader)) {
    try {
      create(persistenceUnit);
    }
 catch (    Throwable t) {
      throw new DemoiselleException(t);
    }
    logger.debug(bundle.getString("persistence-unit-name-found",persistenceUnit));
  }
}
 

Example 33

From project geronimo-xbean, under directory /xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/.

Source file: XBeanNamespaceHandler.java

  29 
vote

private static void findAnnotations(String key,Class<?> beanClass,Properties methods){
  for (  Method m : beanClass.getMethods()) {
    if (m.isAnnotationPresent(PostConstruct.class)) {
      methods.put(key + ".initMethod",m.getName());
    }
    if (m.isAnnotationPresent(PreDestroy.class)) {
      methods.put(key + ".destroyMethod",m.getName());
    }
  }
}
 

Example 34

From project GNDMS, under directory /gorfx/src/de/zib/gndms/GORFX/service/.

Source file: TaskFlowServiceImpl.java

  29 
vote

@PostConstruct public void init(){
  facetsNames.add("order");
  facetsNames.add("quote");
  facetsNames.add("task");
  facetsNames.add("result");
  facetsNames.add("status");
  facetsNames.add("errors");
  uriFactory=new UriFactory(baseUrl);
  taskClient.setServiceURL(localBaseUrl);
}
 

Example 35

From project guj.com.br, under directory /src/br/com/caelum/guj/.

Source file: Agregators.java

  29 
vote

@PostConstruct public void init(){
  Config.loadConfigs();
  this.forumAgregator=new Agregator("forum.refresh.interval","forum.items","forum.url");
  this.newsAgregator=new Agregator("news.refresh.interval","news.items","news.url");
  this.infoqAgregator=new Agregator("infoq.refresh.interval","infoq.items","infoq.url");
  JobsAgregator.start();
}
 

Example 36

From project HBase-Lattice, under directory /hbl/src/main/java/com/inadco/hbl/client/.

Source file: HblAdmin.java

  29 
vote

@PostConstruct public void init() throws IOException {
  Validate.notNull(cubeModel);
  Deque<Closeable> closeables=new ArrayDeque<Closeable>();
  try {
    InputStream cubeIs=cubeModel.getInputStream();
    closeables.addFirst(cubeIs);
    cubeModelYamlStr=IOUtil.fromStream(cubeIs,"utf-8");
    cube=YamlModelParser.parseYamlModel(cubeModelYamlStr);
  }
  finally {
    IOUtil.closeAll(closeables);
  }
}
 

Example 37

From project human-task-poc-proposal, under directory /human-task-core-cdi-experiment/src/main/java/org/jboss/human/interactions/internals/lifecycle/.

Source file: MVELLifeCycleManager.java

  29 
vote

@PostConstruct public void initMVELOperations(){
  Map<String,Object> vars=new HashMap<String,Object>();
  InputStream is=null;
  is=getClass().getResourceAsStream("/operations-dsl.mvel");
  if (is == null) {
    throw new RuntimeException("Unable To initialise TaskService, could not find Operations DSL");
  }
  Reader reader=new InputStreamReader(is);
  try {
    operations=(Map<Operation,List<OperationCommand>>)eval(toString(reader),vars);
  }
 catch (  IOException e) {
    throw new RuntimeException("Unable To initialise TaskService, could not load Operations DSL");
  }
}
 

Example 38

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

Source file: AvailableDateTimeZones.java

  29 
vote

@SuppressWarnings("unchecked") @PostConstruct public void init(){
  dateTimeZones=new ArrayList<ForwardingDateTimeZone>();
  final Set timeZoneIds=DateTimeZone.getAvailableIDs();
  for (  Object object : timeZoneIds) {
    String id=(String)object;
    if (id.matches(TIMEZONE_ID_PREFIXES)) {
      final DateTimeZone dtz=DateTimeZone.forID(id);
      dateTimeZones.add(new ForwardingDateTimeZone(id){
        @Override protected DateTimeZone delegate(){
          return dtz;
        }
      }
);
    }
  }
  Collections.sort(dateTimeZones,new Comparator<ForwardingDateTimeZone>(){
    public int compare(    final ForwardingDateTimeZone a,    final ForwardingDateTimeZone b){
      return a.getID().compareTo(b.getID());
    }
  }
);
  dateTimeZones=Collections.unmodifiableList(dateTimeZones);
}
 

Example 39

From project jahspotify, under directory /services/src/main/java/jahspotify/services/history/.

Source file: HistoryCollector.java

  29 
vote

@PostConstruct private void initialize(){
  _mediaPlayer.addMediaPlayerListener(new AbstractMediaPlayerListener(){
    @Override public void paused(    final QueueTrack currentTrack){
      _trackPlayTime=_trackPlayTime + ((System.currentTimeMillis() - _trackTimePointer) / 1000);
    }
    @Override public void stopped(    final QueueTrack currentTrack){
      _trackPlayTime=_trackPlayTime + ((System.currentTimeMillis() - _trackTimePointer) / 1000);
    }
    @Override public void resume(    final QueueTrack currentTrack){
      _trackTimePointer=System.currentTimeMillis();
    }
    @Override public void trackStart(    final QueueTrack queueTrack){
      _trackStartTime=System.currentTimeMillis();
      _trackTimePointer=_trackStartTime;
      _trackPlayTime=0;
    }
    @Override public void trackEnd(    final QueueTrack queueTrack,    final boolean forcedEnd){
      _trackPlayTime=_trackPlayTime + ((System.currentTimeMillis() - _trackTimePointer) / 1000);
      _historicalStorage.addHistory(new TrackHistory(queueTrack.getQueue(),queueTrack.getTrackUri(),queueTrack.getSource(),queueTrack.getId(),!forcedEnd,(int)_trackPlayTime,_trackStartTime));
      _trackPlayTime=0;
      _trackTimePointer=0;
    }
  }
);
}
 

Example 40

From project java-maven-tests, under directory /src/spring-jms-demo/src/main/java/com/alexshabanov/springjmsdemo/service/.

Source file: JmsProducer.java

  29 
vote

/** 
 * Generates JMS messages
 */
@PostConstruct public void generateMessages() throws JMSException {
  for (int i=0; i < 100; i++) {
    final int index=i;
    final String text="Message number is " + i + ".";
    template.send(new MessageCreator(){
      public Message createMessage(      Session session) throws JMSException {
        TextMessage message=session.createTextMessage(text);
        message.setIntProperty(MESSAGE_COUNT,index);
        logger.info("Sending message: " + text);
        return message;
      }
    }
);
  }
}
 

Example 41

From project jax-rs-hateoas, under directory /demo/demo-domain/src/main/java/com/jayway/demo/library/domain/internal/.

Source file: BookRepositoryInMemory.java

  29 
vote

@PostConstruct public void init(){
  newBook("J.R.R. Tolkien","Lord of the Rings");
  newBook("Cormac McCarthy","The Road");
  newBook("George R.R. Martin","The Game of Thrones");
  newBook("George R.R. Martin","A Clash of Kings");
}
 

Example 42

From project jbosgi, under directory /testsuite/example/src/test/java/org/jboss/test/osgi/example/cdi/impl/.

Source file: ComplexManagedBean.java

  29 
vote

@PostConstruct public void start(){
  ServiceTracker tracker=new ServiceTracker(context,PaymentProvider.class.getName(),null){
    @Override public Object addingService(    ServiceReference reference){
      PaymentProvider service=(PaymentProvider)super.addingService(reference);
      providers.add(service);
      return service;
    }
    @Override public void removedService(    ServiceReference reference,    Object service){
      providers.remove(service);
      super.removedService(reference,service);
    }
  }
;
  tracker.open();
}
 

Example 43

From project jboss-as-quickstart, under directory /cluster-ha-singleton/service/src/main/java/org/jboss/as/quickstarts/cluster/hasingleton/service/ejb/.

Source file: Init.java

  29 
vote

/** 
 * Create the Service and wait until it is started.<br/> Will log a message if the service will not start in 10sec.
 */
@PostConstruct protected void startup(){
  LOGGER.info("StartupSingleton will be initialized!");
  HATimerService service=new HATimerService();
  SingletonService<String> singleton=new SingletonService<String>(service,HATimerService.SINGLETON_SERVICE_NAME);
  ServiceController<String> controller=singleton.build(CurrentServiceContainer.getServiceContainer()).addDependency(ServerEnvironmentService.SERVICE_NAME,ServerEnvironment.class,service.env).install();
  controller.setMode(ServiceController.Mode.ACTIVE);
  try {
    wait(controller,EnumSet.of(ServiceController.State.DOWN,ServiceController.State.STARTING),ServiceController.State.UP);
    LOGGER.info("StartupSingleton has started the Service");
  }
 catch (  IllegalStateException e) {
    LOGGER.warn("Singleton Service {} not started, are you sure to start in a cluster (HA) environment?",HATimerService.SINGLETON_SERVICE_NAME);
  }
}
 

Example 44

From project jboss-ejb3-singleton, under directory /testsuite/src/test/java/org/jboss/ejb3/singleton/integration/test/dependson/somejar/.

Source file: SingletonBeanB.java

  29 
vote

@PostConstruct public void onConstruct() throws Exception {
  Context ctx=new InitialContext();
  Echo otherSingleton=(Echo)ctx.lookup(SingletonBeanA.JNDI_NAME);
  String msg="Msg from onConstruct";
  String returnMsg=otherSingleton.echo(msg);
  if (!msg.equals(returnMsg)) {
    throw new RuntimeException("Unexpected return value from " + otherSingleton);
  }
}
 

Example 45

From project jboss-ejb3-tutorial, under directory /callbacks/src/org/jboss/tutorial/callback/bean/.

Source file: LifecycleInterceptor.java

  29 
vote

@PostConstruct public void postConstruct(InvocationContext ctx){
  try {
    System.out.println("LifecycleInterceptor postConstruct");
    ctx.proceed();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
 

Example 46

From project jboss-ejb3-tx2, under directory /antediluvian/src/test/java/org/jboss/ejb3/test/tx/common/.

Source file: StatefulContainer.java

  29 
vote

public BeanContext<T> createBean() throws Exception {
  try {
    ClassAdvisor advisor=getAdvisor();
    InterceptorFactoryRef interceptorFactoryRef=(InterceptorFactoryRef)advisor.resolveAnnotation(InterceptorFactoryRef.class);
    if (interceptorFactoryRef == null)     throw new IllegalStateException("No InterceptorFactory specified on " + advisor.getName());
    InterceptorFactory interceptorFactory=interceptorFactoryRef.value().newInstance();
    List<Object> ejb3Interceptors=new ArrayList<Object>();
    for (    Class<?> interceptorClass : getInterceptorRegistry().getInterceptorClasses()) {
      Object interceptor=interceptorFactory.create(advisor,interceptorClass);
      ejb3Interceptors.add(interceptor);
    }
    Constructor<T> constructor=advisor.getClazz().getConstructor();
    int idx=advisor.getConstructorIndex(constructor);
    Object initargs[]=null;
    T targetObject=getBeanClass().cast(advisor.invokeNew(initargs,idx));
    StatefulBeanContext<T> component=new StatefulBeanContext<T>(StatefulContainer.this,targetObject,ejb3Interceptors);
    try {
      Method method=getBeanClass().getMethod("setSessionContext",SessionContext.class);
      SessionContext sessionContext=component.getSessionContext();
      method.invoke(targetObject,sessionContext);
    }
 catch (    NoSuchMethodException e) {
      log.debug("no method found setSessionContext");
    }
    Interceptor interceptors[]=createLifecycleInterceptors(component,PostConstruct.class);
    ConstructionInvocation invocation=new ConstructionInvocation(interceptors,constructor,initargs);
    invocation.setAdvisor(advisor);
    invocation.setTargetObject(targetObject);
    invocation.invokeNext();
    return component;
  }
 catch (  Error e) {
    throw e;
  }
catch (  Throwable t) {
    throw new RuntimeException(t);
  }
}
 

Example 47

From project jbossportletbridge, under directory /testsuites/common/src/main/java/org/jboss/portletbridge/test/scopes/.

Source file: UserList.java

  29 
vote

@PostConstruct public void create(){
  users=new ArrayList<String>();
  users.add("Gary");
  users.add("Matt");
  users.add("Simon");
  users.add("Donna");
  users.add("Lisa");
  users.add("Emma");
}
 

Example 48

From project JMaNGOS, under directory /Commons/src/main/java/org/jmangos/commons/threadpool/.

Source file: CommonThreadPoolManager.java

  29 
vote

/** 
 * @see org.jmangos.commons.service.Service#start()
 */
@PostConstruct @Override public void start(){
  final int scheduledPoolSize=ThreadPoolConfig.GENERAL_POOL;
  this.scheduledPool=new ScheduledThreadPoolExecutor(scheduledPoolSize);
  this.scheduledPool.prestartAllCoreThreads();
  final int instantPoolSize=ThreadPoolConfig.GENERAL_POOL;
  this.instantPool=new ThreadPoolExecutor(instantPoolSize,instantPoolSize,0,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(100000));
  this.instantPool.prestartAllCoreThreads();
}
 

Example 49

From project jms, under directory /examples/jms-statuswatcher/src/main/java/org/jboss/seam/jms/example/statuswatcher/session/.

Source file: ReceivingClient.java

  29 
vote

@PostConstruct public void initialize(){
  log.debug("Creating new ReceivingClient.");
  this.pendingStatuses=new ArrayList<Integer>();
  this.receivedStatuses=new LinkedList<Status>();
  topicBuilder.sessionMode(Session.AUTO_ACKNOWLEDGE).connectionFactory(connectionFactory).destination(statusInfoTopic).listen(new ReceivingClientListener(this));
}
 

Example 50

From project junit-rules, under directory /src/main/java/junit/rules/jpa/hibernate/.

Source file: DerbyHibernateTestCase.java

  29 
vote

/** 
 * @param object an object to which we will apply EJB 3.0 style @PersistenceContext and @PostConstruct handling
 */
public final void injectAndPostConstruct(final Object object){
  final Class<? extends Object> clazz=object.getClass();
  for (  final Field field : clazz.getDeclaredFields()) {
    if (field.isAnnotationPresent(PersistenceContext.class)) {
      final Class<?> type=field.getType();
      if (type.equals(EntityManager.class)) {
        set(field).of(object).to(entityManager);
      }
 else {
        logger.warn("Found field \"{}\" annotated with @PersistenceContext " + "but is of type {}",field.getName(),type.getName());
      }
    }
  }
  for (  final Method method : clazz.getDeclaredMethods()) {
    if (method.isAnnotationPresent(PostConstruct.class)) {
      final int nParameters=method.getParameterTypes().length;
      if (nParameters == 0) {
        invoke(method).on(object);
      }
 else {
        logger.warn("Found method \"{}\" annotated @PostConstruct " + "but don't know how to invoke with {} parameters",method.getName(),nParameters);
      }
    }
  }
}
 

Example 51

From project juzu, under directory /core/src/main/java/juzu/impl/inject/spi/guice/.

Source file: PostConstructInjectionListener.java

  29 
vote

public void afterInjection(Object injectee){
  for (  Method method : injectee.getClass().getMethods()) {
    if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()) && method.getAnnotation(PostConstruct.class) != null) {
      try {
        method.invoke(injectee);
      }
 catch (      IllegalAccessException e) {
        throw new UnsupportedOperationException("handle me gracefully",e);
      }
catch (      InvocationTargetException e) {
        throw new UnsupportedOperationException("handle me gracefully",e);
      }
    }
  }
}
 

Example 52

From project laboratory, under directory /auction5/src/main/java/br/gov/serpro/auction5/view/.

Source file: AuctionMB.java

  29 
vote

@PostConstruct public void init(){
  try {
    reloadCategories();
    if (!listCategories.isEmpty()) {
      category=(Category)listCategories.get(0);
      listAuctions=auctionBC.listOpenAuctionsByCategory(category);
    }
  }
 catch (  ApplicationRuntimeException e) {
    throw e;
  }
}
 

Example 53

From project lightfish, under directory /lightfish/src/main/java/org/lightfish/business/configuration/boundary/.

Source file: Configurator.java

  29 
vote

@PostConstruct public void initialize(){
  this.configuration=new HashMap<>();
  this.configuration.put("location","localhost:4848");
  this.configuration.put("jdbcPoolNames","SamplePool");
  this.configuration.put("interval","2");
  this.configuration.put("username","");
  this.configuration.put("password","");
}
 

Example 54

From project Lily, under directory /cr/indexer/worker/src/main/java/org/lilyproject/indexer/worker/.

Source file: IndexerWorker.java

  29 
vote

@PostConstruct public void init(){
  connectionManager=new MultiThreadedHttpConnectionManager();
  connectionManager.getParams().setDefaultMaxConnectionsPerHost(5);
  connectionManager.getParams().setMaxTotalConnections(50);
  httpClient=new HttpClient(connectionManager);
  eventWorkerThread=new Thread(new EventWorker(),"IndexerWorkerEventWorker");
  eventWorkerThread.start();
synchronized (indexUpdatersLock) {
    Collection<IndexDefinition> indexes=indexerModel.getIndexes(listener);
    for (    IndexDefinition index : indexes) {
      if (shouldRunIndexUpdater(index)) {
        addIndexUpdater(index);
      }
    }
  }
}
 

Example 55

From project liquibase, under directory /liquibase-core/src/main/java/liquibase/integration/cdi/.

Source file: CDILiquibase.java

  29 
vote

@PostConstruct public void onStartup() throws LiquibaseException {
  log.info("Booting Liquibase " + LiquibaseUtil.getBuildVersion());
  String hostName;
  try {
    hostName=NetUtil.getLocalHost().getHostName();
  }
 catch (  Exception e) {
    log.warning("Cannot find hostname: " + e.getMessage());
    log.debug("",e);
    return;
  }
  String shouldRunProperty=System.getProperty(Liquibase.SHOULD_RUN_SYSTEM_PROPERTY);
  if (shouldRunProperty != null && !Boolean.valueOf(shouldRunProperty)) {
    log.info("Liquibase did not run on " + hostName + " because '"+ Liquibase.SHOULD_RUN_SYSTEM_PROPERTY+ "' system property was set to false");
    return;
  }
  initialized=true;
  performUpdate();
}
 

Example 56

From project lorsource, under directory /src/main/java/ru/org/linux/section/.

Source file: SectionService.java

  29 
vote

/** 
 * ????????????? ?????? ?????? ?? ??. ????? ?????????? ????????????? ????? ????? ???????? ????.
 */
@PostConstruct private void initializeSectionList(){
  Builder<Section> sectionListBuilder=ImmutableList.builder();
  List<Section> sections=sectionDao.getAllSections();
  sectionListBuilder.addAll(sections);
  sectionList=sectionListBuilder.build();
}
 

Example 57

From project MailJimp, under directory /mailjimp-core/src/main/java/mailjimp/service/impl/.

Source file: MailJimpJsonService.java

  29 
vote

@PostConstruct public void init(){
  checkConfig();
  log.info("Creating MailChimp integration client.");
  String url=buildServerURL();
  log.info("Server URL is: {}",url);
  client=Client.create();
  resource=client.resource(url);
  SerializationConfig s=m.getSerializationConfig();
  s.setSerializationInclusion(Inclusion.NON_NULL);
  s.withDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
  m.setSerializationConfig(s);
  DeserializationConfig d=m.getDeserializationConfig();
  d.withDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
  m.setDeserializationConfig(d);
  m.setDateFormat(new SimpleDateFormat("yyyy-MM-MM HH:mm:ss"));
}
 

Example 58

From project Media-Markup, under directory /web-spring-mvc/src/main/java/com/company/annotation/audio/web/controller/.

Source file: UploadBean.java

  29 
vote

@PostConstruct public void autoUploadOnPostConstruct(){
  if (this.autoUploadFileList != null) {
    for (    String filePath : autoUploadFileList) {
      logger.info("Attempting to automatically upload file:" + filePath);
      InputStream inputStream=null;
      try {
        inputStream=new FileInputStream(filePath);
        uploadFile("auto-" + System.currentTimeMillis(),inputStream);
      }
 catch (      FileNotFoundException e) {
        logger.warn("Couldn't upload file.",e);
      }
catch (      IOException e) {
        logger.warn("Couldn't upload file.",e);
      }
 finally {
        if (inputStream != null) {
          try {
            inputStream.close();
          }
 catch (          IOException e) {
          }
        }
      }
    }
  }
 else {
    logger.info("No files provided for the automatic upload feature.");
  }
}
 

Example 59

From project mob, under directory /com.netappsid.mob/src/com/netappsid/mob/ejb3/internal/.

Source file: EJB3BundleUnit.java

  29 
vote

public <T>T create(Class<T> toCreate) throws Exception {
  T newInstance=toCreate.newInstance();
  inject(newInstance);
  Method[] methods=toCreate.getMethods();
  for (  Method method : methods) {
    if (method.isAnnotationPresent(PostConstruct.class)) {
      method.invoke(newInstance);
      break;
    }
  }
  return newInstance;
}
 

Example 60

From project moji, under directory /src/main/java/fm/last/moji/spring/.

Source file: SpringMojiBean.java

  29 
vote

/** 
 * Automatically called by Spring after the properties have been set.
 */
@PostConstruct public void initialise(){
  if (StringUtils.isBlank(addressesCsv)) {
    throw new IllegalStateException("addressesCsv not set");
  }
  if (StringUtils.isBlank(domain)) {
    throw new IllegalStateException("domain not set");
  }
  NetworkingConfiguration netConfig=createNetworkConfiguration();
  Set<InetSocketAddress> addresses=InetSocketAddressFactory.newAddresses(addressesCsv);
  createTrackerPool(netConfig,addresses);
  DefaultMojiFactory factory=new DefaultMojiFactory(poolingTrackerFactory,domain);
  moji=factory.getInstance();
}
 

Example 61

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

Source file: CloudWatchUpdater.java

  29 
vote

@PostConstruct public synchronized void start(){
  if (future == null) {
    future=executorService.scheduleAtFixedRate(new Runnable(){
      @Override public void run(){
        try {
          updateCloudWatch();
        }
 catch (        Exception e) {
          log.error(e,"CloudWatch update failed");
        }
      }
    }
,(long)updateTime.toMillis(),(long)updateTime.toMillis(),TimeUnit.MILLISECONDS);
  }
}
 

Example 62

From project myfaces-extcdi, under directory /alternative-modules/alternative-configuration-modules/core-alternative-configuration-module/src/main/java/org/apache/myfaces/extensions/cdi/core/alternative/config/.

Source file: AlternativeCodiCoreConfig.java

  29 
vote

/** 
 * Logs the activation of the config
 */
@PostConstruct protected void init(){
  Class configClass=AlternativeCodiCoreConfig.class;
  String moduleVersion=detectModuleVersion(configClass);
  StringBuilder info=new StringBuilder("[Started] MyFaces CODI (Extensions CDI) alternative config ");
  info.append(configClass.getName());
  info.append(" is active (");
  info.append(moduleVersion);
  info.append(")");
  info.append(System.getProperty("line.separator"));
  Logger logger=Logger.getLogger(configClass.getName());
  if (logger.isLoggable(Level.INFO)) {
    logger.info(info.toString());
  }
}
 

Example 63

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

Source file: BuildSystem.java

  29 
vote

@PostConstruct public void init(){
  log.fine("Initializing BuildSystem");
  repository.registerFileExtension("build",BUILDPLAN_MIMETYPE);
  repository.registerFileExtension(BUILDPLAN_NAMESPACE,BUILDPLAN_MIMETYPE);
  repository.registerCommandInfo(BUILDPLAN_MIMETYPE,BuildExecutor.BUILD_CMD,true,buildProvider);
  repository.registerCommandInfo(BUILDPLAN_MIMETYPE,DumpSources.DUMPSRC_CMD,true,dumpProvider);
  try {
    JAXBContext jc=JAXBContext.newInstance("org.apache.ode.runtime.build.xml");
    repository.registerHandler(BUILDPLAN_MIMETYPE,new JAXBDataContentHandler(jc){
      @Override public QName getDefaultQName(      DataSource dataSource){
        QName defaultName=null;
        try {
          InputStream is=dataSource.getInputStream();
          XMLStreamReader reader=XMLInputFactory.newInstance().createXMLStreamReader(is);
          reader.nextTag();
          String tns=reader.getAttributeValue(null,"targetNamespace");
          String name=reader.getAttributeValue(null,"name");
          reader.close();
          if (tns != null && name != null) {
            defaultName=new QName(tns,name);
          }
          return defaultName;
        }
 catch (        Exception e) {
          return null;
        }
      }
    }
);
  }
 catch (  JAXBException je) {
    log.log(Level.SEVERE,"",je);
  }
  log.fine("BuildSystem Initialized");
}