@Override public String toString() { String result = StringUtil.isEmpty(address) ? ITCPAcceptor.DEFAULT_ADDRESS : address; if (port != NO_PORT) { result = result + PORT_SEPARATOR + port; } return result; } }
@Override protected void doBeforeActivate() throws Exception { super.doBeforeActivate(); if (StringUtil.isEmpty(name)) { throw new IllegalStateException("No name"); //$NON-NLS-1$ } }
public CDOViewProviderDescriptor(IConfigurationElement element) { super(element.getAttribute("regex"), Integer.parseInt(element.getAttribute("priority"))); //$NON-NLS-1$ //$NON-NLS-2$ this.element = element; if (StringUtil.isEmpty(element.getAttribute("class"))) //$NON-NLS-1$ { throw new IllegalArgumentException(MessageFormat.format( Messages.getString("CDOViewProviderRegistryImpl.4"), element)); //$NON-NLS-1$ } if (StringUtil.isEmpty(element.getAttribute("regex"))) //$NON-NLS-1$ { throw new IllegalArgumentException(MessageFormat.format( Messages.getString("CDOViewProviderRegistryImpl.6"), element)); //$NON-NLS-1$ } }
public CDOViewProviderDescriptor(IConfigurationElement element) { super(element.getAttribute("regex"), Integer.parseInt(element.getAttribute("priority"))); //$NON-NLS-1$ //$NON-NLS-2$ this.element = element; if (StringUtil.isEmpty(element.getAttribute("class"))) //$NON-NLS-1$ { throw new IllegalArgumentException(MessageFormat.format( Messages.getString("CDOViewProviderRegistryImpl.4"), element)); //$NON-NLS-1$ } if (StringUtil.isEmpty(element.getAttribute("regex"))) //$NON-NLS-1$ { throw new IllegalArgumentException(MessageFormat.format( Messages.getString("CDOViewProviderRegistryImpl.6"), element)); //$NON-NLS-1$ } }
protected IConnector getConnector(IManagedContainer container, String description) { int pos = description.indexOf(SCHEME_SEPARATOR); if (pos == -1) { throw new IllegalArgumentException("Malformed URI, could not find scheme separator :// in " + description); } String factoryType = description.substring(0, pos); if (StringUtil.isEmpty(factoryType)) { throw new IllegalArgumentException("Factory type not defined in " + description); } String connectorDescription = description.substring(pos + SCHEME_SEPARATOR.length()); if (StringUtil.isEmpty(connectorDescription)) { throw new IllegalArgumentException("Connector description not defined in " + description); } pos = connectorDescription.indexOf('?'); if (pos != -1) { connectorDescription = connectorDescription.substring(0, pos); } return Net4jUtil.getConnector(container, factoryType, connectorDescription); } }
/** * @since 4.0 */ public static Map<String, String> getParameters(String query) { Map<String, String> result = new HashMap<String, String>(); StringTokenizer tokenizer = new StringTokenizer(query, "&"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { String parameter = tokenizer.nextToken(); if (!StringUtil.isEmpty(parameter)) { int pos = parameter.indexOf('='); if (pos == -1) { String key = parameter.trim(); result.put(key, ""); //$NON-NLS-1$ } else { String key = parameter.substring(0, pos).trim(); String value = parameter.substring(pos + 1); result.put(key, value); } } } return result; } }
/** * @since 4.0 */ public static Map<String, String> getParameters(String query) { Map<String, String> result = new HashMap<String, String>(); StringTokenizer tokenizer = new StringTokenizer(query, "&"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { String parameter = tokenizer.nextToken(); if (!StringUtil.isEmpty(parameter)) { int pos = parameter.indexOf('='); if (pos == -1) { String key = parameter.trim(); result.put(key, ""); //$NON-NLS-1$ } else { String key = parameter.substring(0, pos).trim(); String value = parameter.substring(pos + 1); result.put(key, value); } } } return result; } }
public ConnectorData(String description) { if (!StringUtil.isEmpty(description)) { try { URL url = parse(description); userID = url.getUserInfo(); host = url.getHost(); port = url.getPort(); } catch (MalformedURLException ex) { throw new ProductCreationException(ex); } } }
public IStore createStore(String repositoryName, Map<String, String> repositoryProperties, Element storeConfig) { Map<String, String> properties = RepositoryConfigurator.getProperties(storeConfig, 1); String uri = properties.get("uri"); if (StringUtil.isEmpty(uri)) { throw new IllegalArgumentException("Property 'uri' missing"); } MongoURI mongoURI = new MongoURI(uri); String dbName = properties.get("db"); if (StringUtil.isEmpty(dbName)) { dbName = repositoryName; } String drop = properties.get("drop"); if (Boolean.toString(true).equals(drop)) { dropDatabase(mongoURI, dbName); } return CDOMongoDBUtil.createStore(uri, dbName); }
public CDOSession create(String description) { try { URI uri = new URI(description); String query = uri.getQuery(); if (StringUtil.isEmpty(query)) { throw new IllegalArgumentException(MessageFormat.format(Messages.getString("CDOSessionFactory.1"), description)); //$NON-NLS-1$ } Map<String, String> parameters = CDOURIUtil.getParameters(query); return createSession(uri, parameters); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
public CDOSession create(String description) { try { URI uri = new URI(description); String query = uri.getQuery(); if (StringUtil.isEmpty(query)) { throw new IllegalArgumentException(MessageFormat.format(Messages.getString("CDOSessionFactory.1"), description)); //$NON-NLS-1$ } Map<String, String> result = CDOURIUtil.getParameters(query); String repositoryName = result.get("repositoryName"); //$NON-NLS-1$ if (repositoryName == null) { throw new IllegalArgumentException("Repository name is missing: " + description); } boolean automaticPackageRegistry = TRUE.equals(result.get("automaticPackageRegistry")); //$NON-NLS-1$ return createSession(repositoryName, automaticPackageRegistry); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
public CDOServerBrowser.ContainerBased create(String description) throws ProductCreationException { CDOServerBrowser.ContainerBased browser = new CDOServerBrowser.ContainerBased(container); try { if (!StringUtil.isEmpty(description)) { browser.setPort(Integer.valueOf(description)); } } catch (Exception ex) { OM.LOG.warn(ex); } return browser; } }
/** * @since 3.0 */ public Store(String type, Set<CDOID.ObjectType> objectIDTypes, Set<ChangeFormat> supportedChangeFormats, Set<RevisionTemporality> supportedRevisionTemporalities, Set<RevisionParallelism> supportedRevisionParallelisms) { checkArg(!StringUtil.isEmpty(type), "Empty type"); //$NON-NLS-1$ this.type = type; this.objectIDTypes = objectIDTypes; checkArg(supportedChangeFormats != null && !supportedChangeFormats.isEmpty(), "Empty supportedChangeFormats"); //$NON-NLS-1$ this.supportedChangeFormats = supportedChangeFormats; checkArg(supportedRevisionTemporalities != null && !supportedRevisionTemporalities.isEmpty(), "Empty supportedRevisionTemporalities"); //$NON-NLS-1$ this.supportedRevisionTemporalities = supportedRevisionTemporalities; checkArg(supportedRevisionParallelisms != null && !supportedRevisionParallelisms.isEmpty(), "Empty supportedRevisionParallelisms"); //$NON-NLS-1$ this.supportedRevisionParallelisms = supportedRevisionParallelisms; }
protected boolean showCommitInfo(PrintStream out, CDOCommitInfo commitInfo, CDOServerBrowser browser, String param, boolean auditing) { String timeStamp = String.valueOf(commitInfo.getTimeStamp()); boolean selected = timeStamp.equals(param); String formatted = CDOCommonUtil.formatTimeStamp(commitInfo.getTimeStamp()).replaceAll(" ", " "); String label = formatted; if (!selected && auditing) { label = browser.href(formatted, getName(), "time", timeStamp); } out.print("<tr>\r\n"); out.print("<td valign=\"top\">\r\n"); out.print(label); out.print("</td>\r\n"); CDOBranch branch = commitInfo.getBranch(); out.print("<td valign=\"top\">\r\n"); out.print(branch.getName() + "[" + branch.getID() + "]"); out.print("</td>\r\n"); String userID = commitInfo.getUserID(); out.print("<td valign=\"top\">\r\n"); out.print(StringUtil.isEmpty(userID) ? " " : browser.escape(userID)); out.print("</td>\r\n"); String comment = commitInfo.getComment(); out.print("<td valign=\"top\">\r\n"); out.print(StringUtil.isEmpty(comment) ? " " : browser.escape(comment)); out.print("</td>\r\n"); out.print("</tr>\r\n"); return selected; }
public CDOWorkspaceImpl(String localRepositoryName, IStore local, IDGenerationLocation idGenerationLocation, CDOIDGenerator idGenerator, InternalCDOWorkspaceBase base, CDOSessionConfigurationFactory remote, String branchPath, long timeStamp) { init(localRepositoryName, local, idGenerationLocation, idGenerator, base, remote); this.branchPath = StringUtil.isEmpty(branchPath) ? CDOBranch.MAIN_BRANCH_NAME : branchPath; this.timeStamp = timeStamp; fixed = timeStamp != CDOBranchPoint.UNSPECIFIED_DATE; checkout(); saveProperties(); }
/** * @return never <code>null</code> */ public synchronized CDOID getResourceNodeID(String path) { if (StringUtil.isEmpty(path)) { throw new IllegalArgumentException(Messages.getString("CDOViewImpl.1")); //$NON-NLS-1$ } CDOID folderID = null; if (CDOURIUtil.SEGMENT_SEPARATOR.equals(path)) { folderID = getResourceNodeIDChecked(null, null); } else { List<String> names = CDOURIUtil.analyzePath(path); for (String name : names) { folderID = getResourceNodeIDChecked(folderID, name); } } return folderID; }
if (StringUtil.isEmpty(path))
private DBObject[] marshallPackages(InternalCDOPackageInfo[] packageInfos) { DBObject[] result = new DBObject[packageInfos.length]; for (int i = 0; i < packageInfos.length; i++) { InternalCDOPackageInfo packageInfo = packageInfos[i]; DBObject doc = new BasicDBObject(); doc.put(PACKAGES_URI, packageInfo.getPackageURI()); String parent = packageInfo.getParentURI(); if (!StringUtil.isEmpty(parent)) { doc.put(PACKAGES_PARENT, parent); } for (EClassifier classifier : packageInfo.getEPackage().getEClassifiers()) { int classifierID = store.getClasses().mapNewClassifier(classifier); doc.put(CLASSIFIER_PREFIX + classifierID, classifier.getName()); } result[i] = doc; } return result; }
@Override protected void doBeforeActivate() throws Exception { super.doBeforeActivate(); checkState(store, "store"); //$NON-NLS-1$ checkState(!StringUtil.isEmpty(name), "name is empty"); //$NON-NLS-1$ checkState(packageRegistry, "packageRegistry"); //$NON-NLS-1$ checkState(sessionManager, "sessionManager"); //$NON-NLS-1$ checkState(branchManager, "branchManager"); //$NON-NLS-1$ checkState(revisionManager, "revisionManager"); //$NON-NLS-1$ checkState(queryManager, "queryManager"); //$NON-NLS-1$ checkState(commitInfoManager, "commitInfoManager"); //$NON-NLS-1$ checkState(commitManager, "commitManager"); //$NON-NLS-1$ checkState(getLockingManager(), "lockingManager"); //$NON-NLS-1$ packageRegistry.setReplacingDescriptors(true); packageRegistry.setPackageProcessor(this); packageRegistry.setPackageLoader(this); branchManager.setRepository(this); branchManager.setBranchLoader(this); revisionManager.setRevisionLoader(this); sessionManager.setRepository(this); queryManager.setRepository(this); commitInfoManager.setRepository(this); commitInfoManager.setCommitInfoLoader(this); commitManager.setRepository(this); getLockingManager().setRepository(this); store.setRepository(this); }