/** * Get container name. * * @return container name, or <code>*</code> if container name is not defined **/ public String getContainerName() { return getProperty(CONTAINER, ANY); }
/** * Gets the cluster schema name. * * @return Cluster Schema name */ public String getClusterSchema() { return getProperty(CLUSTER_SCHEMA); }
/** * Gets the space and container schema name. * * @return Space and container schema name */ public String getSchema() { return getProperty(SCHEMA_NAME); }
/** * @return the member name - containerName:spaceName */ public String getMemberName() { return getProperty(MEMBER_NAME); }
/** * Gets Space name. * * @return Space name **/ public String getSpaceName() { return getProperty(SPACE); }
/** * Gets URL. * * @return entire SpaceFinder URL **/ public String getURL() { return getProperty(URL_NAME); }
/** * Returns SpaceFinder protocol. * * @return SpaceFinder protocol. */ public String getProtocol() { return getProperty(PROTOCOL_NAME); }
/** * Gets URL host. * * @return URL host, or <code>*</code> if hostname is not defined **/ public String getHost() { final String host = getProperty(HOST_NAME); return host.equals(ANY) ? null : host; }
public LBProxyHolder(String memberName, SpaceURL spaceURL, IRemoteSpace remoteSpace) { _memberName = memberName; _memberUrl = spaceURL; _remoteSpace = remoteSpace; _findTimeout = Long.parseLong(spaceURL.getProperty(SpaceURL.TIMEOUT, "0")); }
public void refreshUrlString() { final String oldUrl = getProperty(URL_NAME); final int suffixPos = oldUrl.indexOf('?'); final String suffix = suffixPos < 0 ? "" : oldUrl.substring(suffixPos); String newUrl = getProperty(PROTOCOL_NAME) + "//" + getProperty(HOST_NAME) + "/" + getContainerName() + "/" + getProperty(SPACE) + suffix; super.setProperty(URL_NAME, newUrl); }
public long getLookupIntervalTimeout() { return Long.parseLong(getProperty(INTERVAL_TIMEOUT, Long.toString(DEFAULT_INTERVAL_TIMEOUT))); }
private Object removeProperty(String key) { final String keyLower = key.toLowerCase(); Object result = super.remove(keyLower); if (result != null) { if (AVAILABLE_URL_ATTRIBUTES.contains(keyLower)) { super.setProperty(URL_NAME, SpaceUrlUtils.deletePropertyFromUrl(getProperty(URL_NAME), key)); if (LOOKUP_ATTRIBUTES.containsKey(keyLower)) getGenericLookupAttributes().remove(keyLower); } } return result; }
@Override public String toString() { if (_logger.isLoggable(Level.FINE)) { StringBuilder sb = new StringBuilder(); if (!super.isEmpty()) sb.append("\n\t space url attributes:"); for (Enumeration keys = super.keys(); keys.hasMoreElements(); ) { String propKey = (String) keys.nextElement(); //String propValue = super.getProperty(propKey); Object propValue = super.get(propKey); sb.append("\n\t\t Key [ ").append(propKey).append(" ] Value [ ").append(propValue).append(" ]"); } sb.append("\n"); _logger.log(Level.FINE, sb.toString()); return sb.toString(); } else { return getProperty(URL_NAME); } }
/** * Set SpaceURL properties for desired space proxy. * * @param spaceProxy Space proxy. **/ public void setPropertiesForSpaceProxy(IJSpace spaceProxy) { /** set FIFO mode i.e: fifo */ String fifoMode = getProperty(FIFO_MODE, "false"); if (fifoMode.equalsIgnoreCase("true")) spaceProxy.setFifo(true); /** is optimistic locking enabled/disabled i.e: versioned*/ String versioned = getProperty(VERSIONED); if (versioned != null) { boolean isVersioned = Boolean.valueOf(versioned); spaceProxy.setOptimisticLocking(isVersioned); } }
private void updateHostName(String value) { getCustomProperties().setProperty(XPathProperties.CONTAINER_JNDI_URL, value); String url = getProperty(URL_NAME); int lastSearchIndex = url.indexOf('?'); if (lastSearchIndex == -1) lastSearchIndex = url.length() - 1; //use here length of "java:" as fromIndex in order to reach //host url delimeter if exists int hostURLDelimeterIndex = url.lastIndexOf(":"); //if hist url delimeter exists ":" if (hostURLDelimeterIndex > 0 && hostURLDelimeterIndex < lastSearchIndex) { int lastHostURLIndex = url.indexOf("/", hostURLDelimeterIndex); int firstHostURLIndex = url.substring(0, lastHostURLIndex - 1).lastIndexOf("/"); if (firstHostURLIndex > 0 && lastHostURLIndex > firstHostURLIndex) { String oldValue = url.substring(firstHostURLIndex + 1, lastHostURLIndex); url = url.replaceFirst(oldValue, value); super.setProperty(URL_NAME, url); } } }
/** * The method validates the space URL parameter names * * @param spaceURL the space URL */ private static void validateURL(SpaceURL spaceURL) throws SpaceURLValidationException { Enumeration names = spaceURL.propertyNames(); while (names.hasMoreElements()) { String property = names.nextElement().toString(); if (_logger.isLoggable(Level.FINE)) _logger.fine("Validating Space URL property: " + property + " = " + spaceURL.getProperty(property)); if (!urlElements.contains(property.toLowerCase())) throw new SpaceURLValidationException("Invalid space url property - '" + property + "'"); } } }
public SpaceUrlBuilder(GigaSpace space) { SpaceURL finderURL = space.getSpace().getFinderURL(); this.locators = finderURL.getProperty("locators"); this.groups = finderURL.getProperty("groups"); this.versioned = Boolean.toString(space.getSpace().isOptimisticLockingEnabled()); this.spaceName = finderURL.getSpaceName(); }
private SpaceURL convertReplicationGroupUrl(String memberLookupName) { final int position = _groupMembersNames.indexOf(memberLookupName); if (position == -1) return null; SpaceURL spaceUrl = _groupMembersUrls.get(position).clone(); if (JSpaceUtilities.isEmpty(spaceUrl.getProperty(SpaceURL.TIMEOUT))) spaceUrl.setProperty(SpaceURL.TIMEOUT, String.valueOf(_finderTimeout)); spaceUrl.setLookupAttribute(SpaceURL.STATE, new State().setReplicable(Boolean.TRUE)); return spaceUrl; } }
public TransactionManager getDistributedTransactionManager() throws JMSException { if (dtm == null) { try { LookupRequest request = LookupRequest.TransactionManager() .setLocators(getSpaceURL().getProperty(SpaceURL.LOCATORS)) .setGroups(getSpaceURL().getProperty(SpaceURL.GROUPS)) .setTimeout(10 * 1000); dtm = (TransactionManager) LookupFinder.find(request); if (_logger.isLoggable(Level.FINE)) _logger.fine("Created Distributed Transaction Manager: " + dtm.toString()); } catch (FinderException fe) { if (_logger.isLoggable(Level.SEVERE)) _logger.log(Level.SEVERE, "Failed to create Exception Distributed Transaction Manager.", fe); JMSException e = new JMSException("FinderException: " + fe.toString()); e.setLinkedException(fe); throw e; } } return dtm; }
private RemoteSpaceProxyLocator createProxyLocator(SpaceProxyImpl spaceProxy) { SpaceURL spaceUrl = spaceProxy.getFinderURL(); if (spaceUrl == null) spaceUrl = spaceProxy.getURL(); if (spaceUrl.isJiniProtocol()) { spaceUrl = spaceUrl.clone(); spaceUrl.remove(SpaceURL.USE_LOCAL_CACHE); } else { String url = SpaceUrlUtils.buildJiniUrl(spaceUrl.getContainerName(), spaceUrl.getSpaceName(), spaceUrl.getProperty(SpaceURL.GROUPS), null /*locators*/); try { spaceUrl = SpaceURLParser.parseURL(url); } catch (MalformedURLException e) { throw new ProxyInternalSpaceException(e); } } return new RemoteSpaceProxyLocator(spaceProxy.getName(), spaceUrl, quiesceTokenProvider); }