本文整理匯總了Java中org.bubblecloud.ilves.Ilves類的典型用法代碼示例。如果您正苦於以下問題:Java Ilves類的具體用法?Java Ilves怎麽用?Java Ilves使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Ilves類屬於org.bubblecloud.ilves包,在下文中一共展示了Ilves類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.bubblecloud.ilves.Ilves; //導入依賴的package包/類
/**
* Main method for Ilves seed project.
*
* @param args the commandline arguments
* @throws Exception if exception occurs in jetty startup.
*/
public static void main(final String[] args) throws Exception {
// Configure logging.
DOMConfigurator.configure("log4j.xml");
// Construct jetty server.
final Server server = Ilves.configure(PROPERTIES_FILE_PREFIX, LOCALIZATION_BUNDLE_PREFIX, PERSISTENCE_UNIT);
// Initialize modules
Ilves.initializeModule(AuditModule.class);
Ilves.initializeModule(CustomerModule.class);
Ilves.initializeModule(ContentModule.class);
Ilves.initializeModule(ReviewModule.class);
Ilves.initializeModule(TranslationModule.class);
Ilves.setDefaultPage("dashboard");
// Start server.
server.start();
final TranslationSynchronizer translationSynchronizer = new TranslationSynchronizer(
DefaultSiteUI.getEntityManagerFactory().createEntityManager());
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
translationSynchronizer.shutdown();
} catch (final Throwable t) {
LOGGER.error("Error in synchronizer shutdown.", t);
}
}
});
// Wait for exit of the Jetty server.
server.join();
}
示例2: testApi
import org.bubblecloud.ilves.Ilves; //導入依賴的package包/類
@Test
@Ignore
public void testApi() throws Exception {
// Construct jetty server.
final Server server = Ilves.configure(PROPERTIES_FILE_PREFIX, LOCALIZATION_BUNDLE_PREFIX, PERSISTENCE_UNIT);
// Initialize modules
Ilves.initializeModule(AuditModule.class);
Ilves.initializeModule(CustomerModule.class);
Ilves.initializeModule(ContentModule.class);
Ilves.addApi(SecurityApi.class, SecurityApiImpl.class);
Ilves.addApi(ApiMock.class, ApiMockImpl.class);
// Start server.
server.start();
final EntityManager entityManager = DefaultSiteUI.getEntityManagerFactory().createEntityManager();
final Company company = CompanyDao.getCompany(entityManager, "*");
company.setSelfRegistration(true);
entityManager.getTransaction().begin();
entityManager.persist(company);
entityManager.getTransaction().commit();
final JsonRpcHttpClient apiMockClient = new JsonRpcHttpClient(
new URL("http://localhost:8080/api/apimock"));
final ApiMock apiMock = ProxyUtil.createClientProxy(
getClass().getClassLoader(),
ApiMock.class, apiMockClient);
final SecurityApi security = ProxyUtil.createClientProxy(
getClass().getClassLoader(),
SecurityApi.class,
new JsonRpcHttpClient(
new URL("http://localhost:8080/api/securityapi")));
Assert.assertTrue(security.selfRegisterUser("test", "user", "[email protected]", "+123", "password"));
final RequestAccessTokenResult result = security.requestAccessToken("[email protected]", "password");
final Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "Bearer " + new String(result.getAccessToken()));
apiMockClient.setHeaders(headers);
Assert.assertEquals("[user]:test", apiMock.testMethod("test"));
server.stop();
}
示例3: main
import org.bubblecloud.ilves.Ilves; //導入依賴的package包/類
/**
* Main method for tutorial site.
*
* @param args the commandline arguments
* @throws Exception if exception occurs in jetty startup.
*/
public static void main(final String[] args) throws Exception {
// Configure logging.
DOMConfigurator.configure("log4j.xml");
// Construct jetty server.
final Server server = Ilves.configure(PROPERTIES_FILE_PREFIX, LOCALIZATION_BUNDLE_PREFIX, PERSISTENCE_UNIT);
// Initialize modules
Ilves.initializeModule(AuditModule.class);
Ilves.initializeModule(CustomerModule.class);
Ilves.initializeModule(ContentModule.class);
// Get default site descriptor.
final SiteDescriptor siteDescriptor = DefaultSiteUI.getContentProvider().getSiteDescriptor();
HootFields.initialize();
final String dashboardPage = "dashboard";
// Describe custom view.
final ViewDescriptor commentView = new ViewDescriptor(dashboardPage, DefaultValoView.class);
commentView.setViewerRoles("administrator");
siteDescriptor.getViewDescriptors().add(commentView);
// Place example viewlet to content slot in the view.
commentView.setViewletClass(Slot.CONTENT, EntryFlowViewlet.class);
// Add custom view to navigation.
final NavigationVersion navigationVersion = siteDescriptor.getNavigationVersion();
navigationVersion.setDefaultPageName(dashboardPage);
navigationVersion.addRootPage(0, dashboardPage);
Ilves.setDefaultPage("dashboard");
// Start server.
server.start();
final HootSynchronizer translationSynchronizer = new HootSynchronizer(
DefaultSiteUI.getEntityManagerFactory().createEntityManager());
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
translationSynchronizer.shutdown();
} catch (final Throwable t) {
LOGGER.error("Error in synchronizer shutdown.", t);
}
}
});
// Join this main thread to the Jetty server thread.
server.join();
}