List of usage examples for java.text MessageFormat format
public static String format(String pattern, Object... arguments)
From source file:com.microsoft.tfs.core.config.RegistryUtils.java
/** * Gets the current user's registry key for settings for this version of * Visual Studio (in {@link RootKey#HKEY_CURRENT_USER}). * <p>// w w w . j ava2s.c o m * Throws {@link RuntimeException} if called from a non-Windows platform. * * @return the {@link RegistryKey} or <code>null</code> if it did not exist * and could not be created */ public static RegistryKey openOrCreateRootUserRegistryKey() { if (!Platform.isCurrentPlatform(Platform.WINDOWS)) { throw new RuntimeException(Messages.getString("RegistryUtils.RegistryFeaturesNotAvailable")); //$NON-NLS-1$ } RegistryKey key = new RegistryKey(RootKey.HKEY_CURRENT_USER, VISUAL_STUDIO_KEY_ROOT_PATH); if (!key.exists()) { try { key.create(); } catch (final RegistryException e) { log.error( MessageFormat.format(Messages.getString("RegistryUtils.CouldNotCreateRegistryKeyFormat"), //$NON-NLS-1$ key), e); key = null; } } return key; }
From source file:edu.usu.sdl.openstorefront.service.manager.ReportManager.java
public static void init() { ServiceProxy serviceProxy = ServiceProxy.getProxy(); //Restart any pending or working reports List<Report> allReports = getInprogessReports(); if (!allReports.isEmpty()) { log.log(Level.INFO, MessageFormat.format( "Resuming pending and working reports. (Running in the Background) Reports to run: {0}", allReports.size()));/*from w ww .j a v a 2s .c o m*/ for (Report report : allReports) { TaskRequest taskRequest = new TaskRequest(); taskRequest.setAllowMultiple(true); taskRequest.setName(TaskRequest.TASKNAME_REPORT); taskRequest.setDetails("Report: " + report.getReportType() + " Report id: " + report.getReportId() + " for user: " + SecurityUtil.getCurrentUserName()); taskRequest.getTaskData().put(TaskRequest.DATAKEY_REPORT_ID, report.getReportId()); serviceProxy.getAsyncProxy(serviceProxy.getReportService(), taskRequest).generateReport(report); } } }
From source file:com.alibaba.otter.shared.arbitrate.impl.manage.helper.ManagePathUtils.java
/** * channel path (??config?)/*from w w w. j av a 2 s.c o m*/ */ public static String getChannelByChannelId(Long channelId) { // ?channelId path return MessageFormat.format(ArbitrateConstants.NODE_CHANNEL_FORMAT, String.valueOf(channelId)); }
From source file:com.asakusafw.runtime.stage.launcher.Util.java
static boolean delete(File file) { if (file.exists() == false) { return true; } else if (file.isDirectory()) { boolean deleteChildren = true; for (File child : list(file)) { deleteChildren &= delete(child); }//from w w w .ja va 2s . c o m if (deleteChildren == false) { return false; } } if (file.delete()) { return true; } else { LOG.warn(MessageFormat.format("Failed to delete a file: {0}", file)); return false; } }
From source file:com.quatico.base.aem.test.api.AemMatchers.java
public static Matcher<Node> nodeExistsAt(String path) { return new TypeSafeMatcher<Node>() { @Override//from ww w .j av a 2s . c o m protected boolean matchesSafely(Node actual) { try { return actual != null && StringUtils.isNotBlank(actual.getProperty(ResourceProperty.PRIMARY_TYPE).getString()) && path.equals(actual.getPath()); } catch (RepositoryException ex) { return false; } } @Override public void describeTo(Description description) { description.appendText( MessageFormat.format("Node with non-null jcr:primaryType at {0} should exist.", path)); } }; }
From source file:com.microsoft.tfs.core.clients.sharepoint.WSSUtils.java
public static boolean isWSSConfigured(final TFSTeamProjectCollection connection, final ProjectInfo projectInfo) { Check.notNull(connection, "connection"); //$NON-NLS-1$ Check.notNull(projectInfo, "projectInfo"); //$NON-NLS-1$ final ProjectCollectionEntity projectCollectionEntity = connection.getTeamProjectCollectionEntity(false); if (projectCollectionEntity == null) { log.warn("Could not load team project collection catalog entity"); //$NON-NLS-1$ return false; }/*from w ww. j a v a 2 s. c o m*/ final TeamProjectEntity teamProject = projectCollectionEntity .getTeamProject(new GUID(projectInfo.getGUID())); if (teamProject == null) { log.warn(MessageFormat.format("Could not team project catalog entity for team project {0}", //$NON-NLS-1$ projectInfo.getName())); return false; } final ProjectPortalEntity projectPortal = teamProject.getProjectPortal(); if (projectPortal != null && projectPortal.getResourceSubType().equals("WssSite")) //$NON-NLS-1$ { return true; } return false; }
From source file:cz.afrosoft.whattoeat.core.gui.I18n.java
/** * Get localized text for specified key and fill specified parameters to it. * * @param key (NotBlank) Key of text. * @param params (NotNull) Parameters to fill into message. * @return (NotNull) Localized text with filled parameters. * @throws java.util.MissingResourceException If key is not found in loaded resource bundle. * @see MessageFormat#format(String, Object...). *///from w ww . j a va 2 s . com public static String getText(final String key, final Object... params) { Validate.notBlank(key); Validate.notNull(params); return MessageFormat.format(getText(key), params); }
From source file:fr.inria.atlanmod.neoemf.util.NeoEMFURI.java
public static URI createNeoEMFURI(URI uri) { if (FILE_SCHEME.equals(uri.scheme())) { return createNeoEMFURI(FileUtils.getFile(uri.toFileString())); } else if (NEOEMF_SCHEME.equals(uri.scheme())) { return new NeoEMFURI(uri.hashCode(), uri); } else if (NEOEMF_MAP_SCHEME.equals(uri.scheme())) { return new NeoEMFURI(uri.hashCode(), uri); } else if (NEOEMF_HBASE_SCHEME.equals(uri.scheme())) { return new NeoEMFURI(uri.hashCode(), uri); } else {/*from w ww. j av a 2 s . c o m*/ throw new IllegalArgumentException(MessageFormat.format("Unsupported URI type {0}", uri.toString())); } }
From source file:com.asakusafw.thundergate.runtime.cache.mapreduce.PatchStrategy.java
/** * Returns whether or not the table join is enabled for the target cache. * @param tableName the table name/*from w ww. ja v a2 s.c o m*/ * @param cache the target cache. * @return {@code true} if the table join is enabled, otherwise {@code false} */ public static boolean isTableJoin(String tableName, CacheStorage cache) { long limit = cache.getConfiguration().getLong(KEY_TABLE_JOIN_LIMIT, DEFAULT_TABLE_JOIN_LIMIT); if (limit <= 0) { LOG.info(MessageFormat.format("cache table join is disabled: {0}", tableName)); return false; } LOG.info(MessageFormat.format("computing patch content size: {0}", tableName)); try { long total = 0; for (FileStatus stat : TemporaryStorage.listStatus(cache.getConfiguration(), cache.getPatchContents("*"))) { total += stat.getLen(); } LOG.info(MessageFormat.format("patch content size: {1}bytes (table-join-limit={2}, {0})", tableName, total, limit)); return total <= limit; } catch (IOException e) { LOG.warn(MessageFormat.format("failed to compute patch size: {0}", tableName), e); return false; } }
From source file:com.microsoft.tfs.client.eclipse.filemodification.TFSFileModificationStatusReporter.java
public void reportStatus(final TFSRepository repository, final TFSFileModificationStatusData[] statusData, final IStatus status) { log.error(MessageFormat.format("Could not pend edit: {0}", status.getMessage()), status.getException()); //$NON-NLS-1$ }