/** * Returns the namespace of the Force.com store to which this {@code ForceServiceConnector} * is getting a connection. * <p> * A namespace uniquely identifies a Force.com store on the Force.com service. This {@code ForceServiceConnector} * will retrieve the namespace by getting a Force.com connection with its {@code ForceConnectorConfig} state. * * @return the unique Force.com store namespace; {@code null} is no such namespace exists * @throws ConnectionException if the {@code ForceConnectorConfig} state cannot be found * or otherwise constructed * @throws ConnectionException if this {@code ForceServiceConnector} cannot get a connection * to the Force.com service with its {@code ForceConnectorConfig} state * @throws ConnectionException if the namespace cannot be retrieved over the Force.com connection */ public String getNamespace() throws ConnectionException { if (metadataConnection == null) { initMetadataConnection(); } if (!config.isNamespaceInitialized()) { DescribeMetadataResult result = metadataConnection.describeMetadata(DESCRIBE_METADATA_VERSION); String organizationNamespace = result.getOrganizationNamespace(); config.setNamespace(organizationNamespace != null && organizationNamespace.length() > 0 ? organizationNamespace : null); } return config.getNamespace(); }
/** * Returns the namespace of the Force.com store to which this {@code ForceServiceConnector} * is getting a connection. * <p> * A namespace uniquely identifies a Force.com store on the Force.com service. This {@code ForceServiceConnector} * will retrieve the namespace by getting a Force.com connection with its {@code ForceConnectorConfig} state. * * @return the unique Force.com store namespace; {@code null} is no such namespace exists * @throws ConnectionException if the {@code ForceConnectorConfig} state cannot be found * or otherwise constructed * @throws ConnectionException if this {@code ForceServiceConnector} cannot get a connection * to the Force.com service with its {@code ForceConnectorConfig} state * @throws ConnectionException if the namespace cannot be retrieved over the Force.com connection */ public String getNamespace() throws ConnectionException { if (metadataConnection == null) { initMetadataConnection(); } if (!config.isNamespaceInitialized()) { DescribeMetadataResult result = metadataConnection.describeMetadata(DESCRIBE_METADATA_VERSION); String organizationNamespace = result.getOrganizationNamespace(); config.setNamespace(organizationNamespace != null && organizationNamespace.length() > 0 ? organizationNamespace : null); } return config.getNamespace(); }