Search in sources :

Example 96 with Activate

use of org.osgi.service.component.annotations.Activate in project karaf by apache.

the class RestService method activate.

@Activate
public void activate() throws Exception {
    JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
    bean.setAddress("/booking");
    bean.setBus(BusFactory.getDefaultBus());
    bean.setProvider(new JacksonJsonProvider());
    bean.setServiceBean(new BookingServiceRest());
    server = bean.create();
}
Also used : JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) Activate(org.osgi.service.component.annotations.Activate)

Example 97 with Activate

use of org.osgi.service.component.annotations.Activate in project karaf by apache.

the class ConsoleClient method start.

@Activate
public void start() throws Exception {
    Booking booking = new Booking();
    booking.setId(1L);
    booking.setFlight("AF520");
    booking.setCustomer("John Doe");
    bookingService.add(booking);
    booking = new Booking();
    booking.setId(2L);
    booking.setFlight("AF59");
    booking.setCustomer("Alan Parker");
    bookingService.add(booking);
    running = true;
    Thread thread = new Thread(() -> {
        while (running) {
            try {
                Thread.sleep(5000);
                for (Booking booking1 : bookingService.list()) {
                    System.out.println();
                    System.out.println("-----------");
                    System.out.println(booking1.getId() + " - " + booking1.getFlight() + " - " + booking1.getCustomer());
                }
            } catch (Exception e) {
            // nothing to do
            }
        }
    });
    thread.start();
}
Also used : Booking(org.apache.karaf.examples.scr.api.Booking) Activate(org.osgi.service.component.annotations.Activate)

Example 98 with Activate

use of org.osgi.service.component.annotations.Activate in project liferay-blade-samples by liferay.

the class AddTestData method addTestData.

@Activate
public void addTestData() {
    Foo foo = FooLocalServiceUtil.createFoo(0);
    foo.setField1("createFooEntryField1");
    foo.setField2(true);
    foo.setField3(1);
    foo.setField4(new Date());
    foo.setField5("createFooEntryField5");
    foo.isNew();
    Foo fooEntry = FooLocalServiceUtil.addFoo(foo);
    if (!fooEntry.getField2()) {
        _log.error("Test Failed");
    }
    FooLocalServiceUtil.deleteFoo(fooEntry);
}
Also used : Foo(com.liferay.blade.basic.model.Foo) Date(java.util.Date) Activate(org.osgi.service.component.annotations.Activate)

Example 99 with Activate

use of org.osgi.service.component.annotations.Activate in project liferay-blade-samples by liferay.

the class QuxPersistenceImpl method activate.

/**
 * Initializes the qux persistence.
 */
@Activate
public void activate() {
    QuxModelImpl.setEntityCacheEnabled(entityCacheEnabled);
    QuxModelImpl.setFinderCacheEnabled(finderCacheEnabled);
    _finderPathWithPaginationFindAll = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
    _finderPathWithoutPaginationFindAll = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
    _finderPathCountAll = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
    _finderPathWithPaginationFindByUuid = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid", new String[] { String.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() });
    _finderPathWithoutPaginationFindByUuid = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid", new String[] { String.class.getName() }, QuxModelImpl.UUID_COLUMN_BITMASK);
    _finderPathCountByUuid = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid", new String[] { String.class.getName() });
    _finderPathFetchByUUID_G = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G", new String[] { String.class.getName(), Long.class.getName() }, QuxModelImpl.UUID_COLUMN_BITMASK | QuxModelImpl.GROUPID_COLUMN_BITMASK);
    _finderPathCountByUUID_G = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G", new String[] { String.class.getName(), Long.class.getName() });
    _finderPathWithPaginationFindByUuid_C = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid_C", new String[] { String.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() });
    _finderPathWithoutPaginationFindByUuid_C = new FinderPath(entityCacheEnabled, finderCacheEnabled, QuxImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C", new String[] { String.class.getName(), Long.class.getName() }, QuxModelImpl.UUID_COLUMN_BITMASK | QuxModelImpl.COMPANYID_COLUMN_BITMASK);
    _finderPathCountByUuid_C = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C", new String[] { String.class.getName(), Long.class.getName() });
}
Also used : FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) QuxImpl(com.liferay.blade.workflow.asset.model.impl.QuxImpl) Activate(org.osgi.service.component.annotations.Activate)

Example 100 with Activate

use of org.osgi.service.component.annotations.Activate in project liferay-blade-samples by liferay.

the class BazPersistenceImpl method activate.

/**
 * Initializes the baz persistence.
 */
@Activate
public void activate() {
    BazModelImpl.setEntityCacheEnabled(entityCacheEnabled);
    BazModelImpl.setFinderCacheEnabled(finderCacheEnabled);
    _finderPathWithPaginationFindAll = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
    _finderPathWithoutPaginationFindAll = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
    _finderPathCountAll = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
    _finderPathWithPaginationFindByUuid = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid", new String[] { String.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() });
    _finderPathWithoutPaginationFindByUuid = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid", new String[] { String.class.getName() }, BazModelImpl.UUID_COLUMN_BITMASK);
    _finderPathCountByUuid = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid", new String[] { String.class.getName() });
    _finderPathFetchByUUID_G = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G", new String[] { String.class.getName(), Long.class.getName() }, BazModelImpl.UUID_COLUMN_BITMASK | BazModelImpl.GROUPID_COLUMN_BITMASK);
    _finderPathCountByUUID_G = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G", new String[] { String.class.getName(), Long.class.getName() });
    _finderPathWithPaginationFindByUuid_C = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid_C", new String[] { String.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() });
    _finderPathWithoutPaginationFindByUuid_C = new FinderPath(entityCacheEnabled, finderCacheEnabled, BazImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C", new String[] { String.class.getName(), Long.class.getName() }, BazModelImpl.UUID_COLUMN_BITMASK | BazModelImpl.COMPANYID_COLUMN_BITMASK);
    _finderPathCountByUuid_C = new FinderPath(entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C", new String[] { String.class.getName(), Long.class.getName() });
}
Also used : BazImpl(com.liferay.blade.workflow.basic.model.impl.BazImpl) FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)100 BundleContext (org.osgi.framework.BundleContext)13 File (java.io.File)8 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)7 IOException (java.io.IOException)6 Hashtable (java.util.Hashtable)6 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)5 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)4 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)3 ServiceReference (org.osgi.framework.ServiceReference)3 PromiseFactory (org.osgi.util.promise.PromiseFactory)3 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)3 JsonObject (com.google.gson.JsonObject)2 Date (java.util.Date)2 Dictionary (java.util.Dictionary)2 ObjectName (javax.management.ObjectName)2 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)2 WhiteboardExecutor (org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor)2 LoginException (org.apache.sling.api.resource.LoginException)2