List of usage examples for java.util EnumSet allOf
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType)
From source file:org.kuali.kfs.module.tem.service.impl.AccountingDistributionServiceImpl.java
/** * @see org.kuali.kfs.module.tem.service.AccountingDistributionService#createDistributions(org.kuali.kfs.module.tem.document.TravelDocument) *//* www . j a v a 2 s . c o m*/ @Override public List<AccountingDistribution> createDistributions(TravelDocument travelDocument) { List<AccountingDistribution> documentDistribution = new ArrayList<AccountingDistribution>(); Map<String, AccountingDistribution> distributionMap = new HashMap<String, AccountingDistribution>(); for (ExpenseType expense : EnumSet.allOf(ExpenseType.class)) { Map<String, AccountingDistribution> newDistributionMap = getTravelExpenseService() .getExpenseServiceByType(expense).getAccountingDistribution(travelDocument); addMergeDistributionMap(distributionMap, newDistributionMap); } subtractMergeDistributionMap(distributionMap, accountingLinesToDistributionMap(travelDocument)); for (String distribution : distributionMap.keySet()) { if (!distributionMap.get(distribution).getSubTotal().equals(KualiDecimal.ZERO)) { // don't include distributions of 0.00 documentDistribution.add(distributionMap.get(distribution)); } } Collections.sort(documentDistribution, new AccountingDistributionComparator()); return documentDistribution; }
From source file:org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerOnTimelineStore.java
@Override public Map<ContainerId, ContainerReport> getContainers(ApplicationAttemptId appAttemptId) throws YarnException, IOException { ApplicationReportExt app = getApplication(appAttemptId.getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app);/*from www .j a va2 s . co m*/ TimelineEntities entities = timelineDataManager.getEntities(ContainerMetricsConstants.ENTITY_TYPE, new NameValuePair(ContainerMetricsConstants.PARENT_PRIMARIY_FILTER, appAttemptId.toString()), null, null, null, null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ContainerId, ContainerReport> containers = new LinkedHashMap<ContainerId, ContainerReport>(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { ContainerReport container = convertToContainerReport(entity, serverHttpAddress, app.appReport.getUser()); containers.put(container.getContainerId(), container); } } return containers; }
From source file:org.apache.hadoop.mapred.TestMRTimelineEventHandling.java
@SuppressWarnings("deprecation") @Test//from w w w .j a va 2s . c om public void testMRNewTimelineServiceEventHandling() throws Exception { LOG.info("testMRNewTimelineServiceEventHandling start."); String testDir = new File("target", getClass().getSimpleName() + "-test_dir").getAbsolutePath(); String storageDir = testDir + File.separator + "timeline_service_data"; Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); // enable new timeline service conf.setFloat(YarnConfiguration.TIMELINE_SERVICE_VERSION, 2.0f); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_WRITER_CLASS, FileSystemTimelineWriterImpl.class, TimelineWriter.class); conf.setBoolean(MRJobConfig.MAPREDUCE_JOB_EMIT_TIMELINE_DATA, true); // set the file system root directory conf.set(FileSystemTimelineWriterImpl.TIMELINE_SERVICE_STORAGE_DIR_ROOT, storageDir); // enable aux-service based timeline collectors conf.set(YarnConfiguration.NM_AUX_SERVICES, TIMELINE_AUX_SERVICE_NAME); conf.set(YarnConfiguration.NM_AUX_SERVICES + "." + TIMELINE_AUX_SERVICE_NAME + ".class", PerNodeTimelineCollectorsAuxService.class.getName()); conf.setBoolean(YarnConfiguration.SYSTEM_METRICS_PUBLISHER_ENABLED, true); MiniMRYarnCluster cluster = null; try { cluster = new MiniMRYarnCluster(TestMRTimelineEventHandling.class.getSimpleName(), 1, true); cluster.init(conf); cluster.start(); LOG.info("A MiniMRYarnCluster get start."); Path inDir = new Path(testDir, "input"); Path outDir = new Path(testDir, "output"); LOG.info("Run 1st job which should be successful."); JobConf successConf = new JobConf(conf); successConf.set("dummy_conf1", UtilsForTests.createConfigValue(51 * 1024)); successConf.set("dummy_conf2", UtilsForTests.createConfigValue(51 * 1024)); successConf.set("huge_dummy_conf1", UtilsForTests.createConfigValue(101 * 1024)); successConf.set("huge_dummy_conf2", UtilsForTests.createConfigValue(101 * 1024)); RunningJob job = UtilsForTests.runJobSucceed(successConf, inDir, outDir); Assert.assertEquals(JobStatus.SUCCEEDED, job.getJobStatus().getState().getValue()); YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(new Configuration(cluster.getConfig())); yarnClient.start(); EnumSet<YarnApplicationState> appStates = EnumSet.allOf(YarnApplicationState.class); ApplicationId firstAppId = null; List<ApplicationReport> apps = yarnClient.getApplications(appStates); Assert.assertEquals(apps.size(), 1); ApplicationReport appReport = apps.get(0); firstAppId = appReport.getApplicationId(); UtilsForTests.waitForAppFinished(job, cluster); checkNewTimelineEvent(firstAppId, appReport, storageDir); LOG.info("Run 2nd job which should be failed."); job = UtilsForTests.runJobFail(new JobConf(conf), inDir, outDir); Assert.assertEquals(JobStatus.FAILED, job.getJobStatus().getState().getValue()); apps = yarnClient.getApplications(appStates); Assert.assertEquals(apps.size(), 2); appReport = apps.get(0).getApplicationId().equals(firstAppId) ? apps.get(0) : apps.get(1); checkNewTimelineEvent(firstAppId, appReport, storageDir); } finally { if (cluster != null) { cluster.stop(); } // Cleanup test file File testDirFolder = new File(testDir); if (testDirFolder.isDirectory()) { FileUtils.deleteDirectory(testDirFolder); } } }
From source file:sx.blah.discord.SpoofBot.java
public SpoofBot(IDiscordClient other, String token, long channelID) throws Exception { this.other = other; client = new ClientBuilder().withToken(token).login(); client.getDispatcher().registerListener(new IListener<ReadyEvent>() { @Override//from w ww . j a v a 2 s . c om public void handle(ReadyEvent event) { try { channel = client.getChannelByID(channelID); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Spoofing failed!"); } timer = 1; lastTime = System.currentTimeMillis() - timer; new Thread(() -> { while (true) { if (lastTime <= System.currentTimeMillis() - timer) { //Time for the next spoof timer = getRandTimer(); lastTime = System.currentTimeMillis(); synchronized (client) { if (!enqueued.isEmpty()) { Spoofs toSpoof = enqueued.pop(); if (toSpoof.getDependent() == null || toSpoof.getDependent().equals(lastSpoof)) { //Handle each spoof switch (toSpoof) { case MESSAGE: channel.toggleTypingStatus(); try { lastSpoofData = channel.sendMessage( (rng.nextInt(10) == 9 ? other.getOurUser().mention() + " " : "") + getRandMessage()); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } break; case MESSAGE_EDIT: try { ((IMessage) lastSpoofData).edit(getRandMessage()); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } break; case TYPING_TOGGLE: channel.toggleTypingStatus(); break; case GAME: client.changePresence(StatusType.ONLINE, ActivityType.PLAYING, rng.nextBoolean() ? getRandString() : null); break; case PRESENCE: break; case MESSAGE_DELETE: try { ((IMessage) lastSpoofData).delete(); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } break; case INVITE: IInvite invite = null; try { invite = client.getGuilds().get(0).getChannels() .get(rng.nextInt( client.getGuilds().get(0).getChannels().size())) .createInvite(18000, 1, false, false); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } if (invite.getCode() != null) { try { channel.sendMessage("https://discord.gg/" + invite.getCode()); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } } lastSpoofData = invite; break; case CHANNEL_CREATE_AND_DELETE: try { final IChannel newChannel = channel.getGuild() .createChannel(getRandString()); final long deletionTimer = getRandTimer() + System.currentTimeMillis(); new Thread(() -> { while (deletionTimer > System.currentTimeMillis()) { } try { newChannel.delete(); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } }).start(); } catch (DiscordException | MissingPermissionsException | RateLimitException e) { e.printStackTrace(); } break; case CHANNEL_EDIT: try { channel.changeName(getRandString()); channel.changeTopic(getRandSentence()); } catch (DiscordException | MissingPermissionsException | RateLimitException e) { e.printStackTrace(); } break; case ROLE_CREATE_EDIT_AND_DELETE: try { final IRole role = channel.getGuild().createRole(); role.changeColor(new Color(rng.nextInt(255), rng.nextInt(255), rng.nextInt(255))); role.changeName(getRandString()); role.changePermissions(EnumSet.allOf(Permissions.class)); final long deletionTimer = getRandTimer() + System.currentTimeMillis(); new Thread(() -> { while (deletionTimer > System.currentTimeMillis()) { } try { role.delete(); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } }).start(); } catch (MissingPermissionsException | RateLimitException | DiscordException e) { e.printStackTrace(); } break; } lastSpoof = toSpoof; } else { //Dependent missing? Not a problem, we'll just do the dependent instead enqueued.addFirst(toSpoof); enqueued.addFirst(toSpoof.getDependent()); timer = 0; } } else { //No spoofs queued, better randomize them for (int i = 0; i < 10; i++) enqueued.add( Spoofs.values()[rng.nextInt(EnumSet.allOf(Spoofs.class).size())]); } } } } }).start(); } }); }
From source file:net.ripe.rpki.validator.commands.TopDownWalkerTest.java
static X509ResourceCertificate createManifestEECertificate() { X509ResourceCertificateBuilder builder = new X509ResourceCertificateBuilder(); builder.withCa(false).withSubjectDN(ROOT_CERTIFICATE_NAME).withIssuerDN(ROOT_CERTIFICATE_NAME) .withSerial(BigInteger.ONE); builder.withPublicKey(ROOT_KEY_PAIR.getPublic()); builder.withSigningKeyPair(ROOT_KEY_PAIR); builder.withInheritedResourceTypes(EnumSet.allOf(IpResourceType.class)); builder.withValidityPeriod(new ValidityPeriod(THIS_UPDATE_TIME, NEXT_UPDATE_TIME)); return builder.build(); }
From source file:com.baasbox.configuration.PropertiesConfigurationHelper.java
/*** * Returns an Enumerator value by its key * The Enumerator must implement the IProperties interface * @param en/* w w w.ja v a2 s .c o m*/ * @param iKey * @return the enumerator value * @throws ConfigurationException * @throws Exception if the en Class is not an Enumerator that implements the IProperties interface */ public static Object findByKey(Class en, String iKey) throws ConfigurationException { EnumSet values = EnumSet.allOf(en); for (Object v : values) { try { if (((String) en.getMethod("getKey").invoke(v)).equalsIgnoreCase(iKey)) return v; } catch (Exception e) { throw new ConfigurationException( "Is it " + en.getCanonicalName() + " an Enum that implements the IProperties interface?", e); } } return null; }
From source file:net.sf.nmedit.nomad.core.NomadLoader.java
private void initLookAndFeel(String lafClassName, String themeClassName, String defaultLafOnPlatform) { EnumSet<Platform.OS> defaultLafPlatforms = EnumSet.noneOf(Platform.OS.class); {/* w w w .jav a2 s . co m*/ // remove whitespace + lowercase defaultLafOnPlatform = defaultLafOnPlatform.replaceAll("\\s", "").toLowerCase(); // split comma separated list String[] dlop = defaultLafOnPlatform.split(","); // check items for (String s : dlop) { if (s.equals("all")) { // on all platforms defaultLafPlatforms.addAll(EnumSet.allOf(Platform.OS.class)); break; } else if (s.equals("mac")) { defaultLafPlatforms.add(Platform.OS.MacOSFlavor); } else if (s.equals("unix")) { defaultLafPlatforms.add(Platform.OS.UnixFlavor); } else if (s.equals("windows")) { defaultLafPlatforms.add(Platform.OS.WindowsFlavor); } } } // jgoodies specific properties PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE); //UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, Boolean.FALSE); Options.setPopupDropShadowEnabled(false); Options.setUseNarrowButtons(true); //UIManager.put(Options.PLASTIC_MENU_FONT_KEY, new FontUIResource("Verdana", Font.PLAIN, 9)); //PlasticLookAndFeel.setFontPolicy(FontPolicies.getDefaultWindowsPolicy()); /* UIManager.put("MenuItem.margin", new InsetsUIResource(2,2,1,2)); UIManager.put("Menu.margin", new InsetsUIResource(1,2,1,2)); */ // set the metal theme if (defaultLafPlatforms.contains(Platform.flavor())) { // use default LAF on current platform try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set look and feel theme", e); } if (Platform.isFlavor(Platform.OS.MacOSFlavor)) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } } else { // use LAF setting MetalTheme theme = null; if (themeClassName != null) { try { theme = (MetalTheme) Class.forName(themeClassName).newInstance(); UIManager.put("Plastic.theme", themeClassName); if (theme instanceof PlasticTheme) { PlasticLookAndFeel.setPlasticTheme((PlasticTheme) theme); // PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle()); } else if (theme instanceof MetalTheme) { MetalLookAndFeel.setCurrentTheme(theme); } } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set look and feel theme", e); } } // set the look and feel if (lafClassName != null) { try { LookAndFeel LAF = (LookAndFeel) Class.forName(lafClassName).newInstance(); // it is very important to set the classloader UIManager.getDefaults().put("ClassLoader", getClass().getClassLoader()); UIManager.setLookAndFeel(LAF); } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set custom look and feel", e); } } } }
From source file:org.photovault.imginfo.indexer.IndexFileTask.java
/** Create the needed preview instances for a photo. The method cretes both a thumbnail (small, low quality, max 200x200 images) as well as preview that can be used for displaying if the volume with original is offline (high quality, max 1280x1280 JPEG image without cropping) //w w w. j a v a 2 s . c o m @param img the loaded image that is used as a basis for preview @param p The photo @param f DAO factory used for database access */ private void createPreviewInstances(PhotovaultImage img, PhotoInfo p, DAOFactory f) throws CommandException { ImageDescriptorBase thumbImage = p.getPreferredImage(EnumSet.allOf(ImageOperations.class), EnumSet.allOf(ImageOperations.class), 0, 0, 200, 200); // Preview image with no cropping, longer side 1280 pixels int origWidth = p.getOriginal().getWidth(); int origHeight = p.getOriginal().getHeight(); int copyMinWidth = Math.min(origWidth, 1280); int copyMinHeight = 0; if (origHeight > origWidth) { copyMinHeight = Math.min(origHeight, 1280); copyMinWidth = 0; } EnumSet<ImageOperations> previewOps = EnumSet.of(ImageOperations.RAW_CONVERSION, ImageOperations.COLOR_MAP); ImageDescriptorBase previewImage = p.getPreferredImage(previewOps, previewOps, copyMinWidth, copyMinHeight, 1280, 1280); Volume vol = f.getVolumeDAO().getDefaultVolume(); if (previewImage == null) { CreateCopyImageCommand cmd = new CreateCopyImageCommand(img, p, vol, 1280, 1280); cmd.setLowQualityAllowed(false); cmd.setOperationsToApply(previewOps); cmdHandler.executeCommand(cmd); } if (thumbImage == null) { CreateCopyImageCommand cmd = new CreateCopyImageCommand(img, p, vol, 200, 200); cmd.setLowQualityAllowed(true); cmdHandler.executeCommand(cmd); } }
From source file:org.tdmx.server.runtime.ServerContainer.java
public void runUntilStopped() { // Create a basic jetty server object without declaring the port. Since we are configuring connectors // directly we'll be setting ports on those connectors. Server server = new Server(); TrustingSslContextFactory sslExt = new TrustingSslContextFactory(); // we trust all client certs, with security in servlet "filters" // sslContextFactory.setCertAlias("server"); sslExt.setRenegotiationAllowed(isRenegotiationAllowed()); // we don't NEED client auth if we want to co-host a Restfull API on this server. sslExt.setWantClientAuth(true);/*from w w w . j a va 2 s. c om*/ sslExt.setIncludeCipherSuites(getHttpsCiphers()); sslExt.setIncludeProtocols(getHttpsProtocols()); sslExt.setKeyStoreType("jks"); sslExt.setKeyStorePath(getKeyStoreFile()); sslExt.setKeyStorePassword(getKeyStorePassword()); // TODO check if needed // sslContextFactory.setKeyManagerPassword("changeme"); // HTTPS Configuration // A new HttpConfiguration object is needed for the next connector and you can pass the old one as an // argument to effectively clone the contents. On this HttpConfiguration object we add a // SecureRequestCustomizer which is how a new connector is able to resolve the https connection before // handing control over to the Jetty Server. HttpConfiguration httpsConfigExt = new HttpConfiguration(); httpsConfigExt.setSecureScheme(HTTPS); httpsConfigExt.setSecurePort(getHttpsPort()); httpsConfigExt.setOutputBufferSize(32768); httpsConfigExt.addCustomizer(new SecureRequestCustomizer()); // HTTPS connector // We create a second ServerConnector, passing in the http configuration we just made along with the // previously created ssl context factory. Next we set the port and a longer idle timeout. ServerConnector httpsExt = new ServerConnector(server, new SslConnectionFactory(sslExt, HTTP_1_1), new HttpConnectionFactory(httpsConfigExt)); httpsExt.setPort(getHttpsPort()); httpsExt.setHost(getServerAddress()); httpsExt.setIdleTimeout(getConnectionIdleTimeoutSec() * MILLIS_IN_ONE_SECOND); TrustingSslContextFactory sslInt = new TrustingSslContextFactory(); // we trust all client certs, with security in servlet "filters" // sslContextFactory.setCertAlias("server"); sslInt.setRenegotiationAllowed(isRenegotiationAllowed()); // we don't want client auth on internal apis sslInt.setWantClientAuth(false); sslInt.setIncludeCipherSuites(getHttpsCiphers()); sslInt.setIncludeProtocols(getHttpsProtocols()); sslInt.setKeyStoreType("jks"); sslInt.setKeyStorePath(getKeyStoreFile()); sslInt.setKeyStorePassword(getKeyStorePassword()); // HTTPS Configuration // A new HttpConfiguration object is needed for the next connector and you can pass the old one as an // argument to effectively clone the contents. On this HttpConfiguration object we add a // SecureRequestCustomizer which is how a new connector is able to resolve the https connection before // handing control over to the Jetty Server. HttpConfiguration httpsConfigInt = new HttpConfiguration(); httpsConfigInt.setSecureScheme(HTTPS); httpsConfigInt.setSecurePort(getHttpsPort() + 1); httpsConfigInt.setOutputBufferSize(32768); httpsConfigInt.addCustomizer(new SecureRequestCustomizer()); // HTTPS connector ServerConnector httpsInt = new ServerConnector(server, new SslConnectionFactory(sslInt, HTTP_1_1), new HttpConnectionFactory(httpsConfigInt)); httpsInt.setPort(getHttpsPort() + 1); httpsInt.setHost(getServerAddress()); httpsInt.setIdleTimeout(getConnectionIdleTimeoutSec() * MILLIS_IN_ONE_SECOND); // Here you see the server having multiple connectors registered with it, now requests can flow into the server // from both http and https urls to their respective ports and be processed accordingly by jetty. A simple // handler is also registered with the server so the example has something to pass requests off to. // Set the connectors server.setConnectors(new Connector[] { httpsExt, httpsInt }); // The following section adds some handlers, deployers and webapp providers. // See: http://www.eclipse.org/jetty/documentation/current/advanced-embedding.html for details. // Setup handlers HandlerCollection handlers = new HandlerCollection(); ContextHandlerCollection contexts = new ContextHandlerCollection(); RequestLogHandler requestLogHandler = new RequestLogHandler(); HSTSHandler hstsHandler = new HSTSHandler(); NotFoundHandler notfoundHandler = new NotFoundHandler(); handlers.setHandlers(new Handler[] { hstsHandler, contexts, requestLogHandler, notfoundHandler }); StatisticsHandler stats = new StatisticsHandler(); stats.setHandler(handlers); server.setHandler(stats); NCSARequestLog requestLog = new AsyncNCSARequestLog(); requestLog.setFilename("jetty-yyyy_mm_dd.log"); requestLog.setExtended(true); requestLog.setRetainDays(7); requestLogHandler.setRequestLog(requestLog); ServletContextHandler wsContext = new ServletContextHandler( ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS); wsContext.setContextPath("/api"); // Setup Spring context wsContext.addEventListener(new org.springframework.web.context.ContextLoaderListener()); wsContext.setInitParameter("parentContextKey", "applicationContext"); wsContext.setInitParameter("locatorFactorySelector", "classpath*:beanRefContext.xml"); wsContext.setInitParameter("contextConfigLocation", "classpath:/ws-context.xml"); // Add filters FilterHolder sf = new FilterHolder(); sf.setFilter(new SessionProhibitionFilter()); wsContext.addFilter(sf, "/*", EnumSet.allOf(DispatcherType.class)); FilterHolder cf = new FilterHolder(); cf.setFilter(new RequireClientCertificateFilter()); wsContext.addFilter(cf, "/*", EnumSet.allOf(DispatcherType.class)); FilterHolder fh = new FilterHolder(); fh.setFilter(getAgentAuthorizationFilter()); wsContext.addFilter(fh, "/v1.0/sp/mds/*", EnumSet.of(DispatcherType.REQUEST)); wsContext.addFilter(fh, "/v1.0/sp/mos/*", EnumSet.of(DispatcherType.REQUEST)); wsContext.addFilter(fh, "/v1.0/sp/zas/*", EnumSet.of(DispatcherType.REQUEST)); // the MRS endpoint is not filtered by any authorization filter because // each ServiceProvider is automatically "authorized" but only to operate // sending data which is signed to be relevant to that service provider, so service // layer checking takes place. // Add servlets ServletHolder sh = new ServletHolder(CXFServlet.class); sh.setInitOrder(1); wsContext.addServlet(sh, "/*"); ServletContextHandler rsContext = new ServletContextHandler( ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS); rsContext.setContextPath("/rs"); // Setup Spring context rsContext.addEventListener(new org.springframework.web.context.ContextLoaderListener()); rsContext.setInitParameter("parentContextKey", "applicationContext"); rsContext.setInitParameter("locatorFactorySelector", "classpath*:beanRefContext.xml"); rsContext.setInitParameter("contextConfigLocation", "classpath:/rs-context.xml"); // Add filters /* * FilterHolder rsfh = new FilterHolder(); rsfh.setFilter(getAgentAuthorizationFilter()); * rsContext.addFilter(rsfh, "/sas/*", EnumSet.of(DispatcherType.REQUEST)); */ // Add servlets ServletHolder rsSh = new ServletHolder(CXFServlet.class); rsSh.setInitOrder(1); rsContext.addServlet(rsSh, "/*"); contexts.addHandler(wsContext); contexts.addHandler(rsContext); try { // start jobs actionOnManageables(true); // Start the server server.start(); Thread monitor = new MonitorThread(server, getStopPort(), getStopCommand(), getStopAddress()); monitor.start(); // Wait for the server to be stopped by the MonitorThread. server.join(); } catch (InterruptedException ie) { log.warn("Container running thread interrupted.", ie); } catch (Exception e) { log.error("Starting failed.", e); } // Exiting here will terminate the application. }
From source file:nl.mvdr.umvc3replayanalyser.ocr.TesseractOCREngine.java
/** * Matches the given string to a character's name. * // w w w.j a v a 2 s.c o m * @param text * text to be matched, should be a Marvel character name, non-null * @return the character to whose name the given text is closest * @throws OCRException * in case the matching character cannot be uniquely determined */ private Umvc3Character matchToCharacterName(String text) throws OCRException { return matchToCharacterName(text, EnumSet.allOf(Umvc3Character.class)); }