-
-
Save cfalzone/bbc2638003a0ad5650e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.aquent.osgi; | |
import java.util.Calendar; | |
import java.util.GregorianCalendar; | |
import java.util.List; | |
import javax.xml.datatype.DatatypeFactory; | |
import javax.xml.datatype.XMLGregorianCalendar; | |
import com.aquent.AquentUtil; | |
import com.aquent.ws.JobPostingServiceClient; | |
import com.aquent.ws.PostedJobs; | |
import com.aquent.ws.PostedJobsResponse; | |
import com.dotcms.repackage.org.osgi.framework.BundleContext; | |
import com.dotmarketing.util.Logger; | |
import org.springframework.context.support.ClassPathXmlApplicationContext; | |
public class AquentActivator extends ExtendedBundleActivator { | |
private static ClassPathXmlApplicationContext springContext = null; | |
@Override | |
public void start ( BundleContext ctx ) throws Exception { | |
// Initializing services | |
initializeServices(ctx); | |
// Get the spring Context | |
springContext = new ClassPathXmlApplicationContext("spring/ApplicationContext.xml"); | |
// Test job importer | |
Calendar cal = Calendar.getInstance(); | |
cal.add(Calendar.HOUR_OF_DAY, -1); | |
List<PostedJobs> results = null; | |
JobPostingServiceClient jobsService = (JobPostingServiceClient) springContext.getBean("JobPostingServiceClient"); | |
GregorianCalendar gc = new GregorianCalendar(); | |
gc.setTimeInMillis(cal.getTimeInMillis()); | |
XMLGregorianCalendar calHours = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc); | |
PostedJobsResponse jobsResponse = jobsService.getAllPostedJobs("*****", calHours).getPostedJobs(); | |
results = jobsResponse.getPostedJob(); | |
Logger.info(this, "Got Jobs: "+results.size()); | |
} | |
@Override | |
public void stop ( BundleContext ctx ) throws Exception { | |
// Unregister all the bundle services | |
unregisterServices( ctx ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment