Class SystemIgnoreHelper
java.lang.Object
com.perforce.p4java.impl.mapbased.rpc.func.client.SystemIgnoreHelper
Client-side guard, refuses to write (on sync) or send (on submit) files whose
local path is protected, via two layers:
- Always-on —
P4TRUSTandP4TICKETSare blocked unconditionally, even when the adjustable map is cleared with$none. - Adjustable map — the per-server
P4_<PORT>_SYSTEMIGNOREvariable, a;-separated list. When unset/empty the built-in defaults apply ($defaults):.p4config,p4config.txt,.p4enviro,p4enviro.txt, and the resolvedP4CONFIG/P4ENVIROfiles.
Each entry is a literal path/filename or a token ($defaults, $none,
$P4CONFIG, $P4ENVIRO, $home/~ — also a leading prefix), and may
be prefixed with ! or - to unblock; entries evaluate in order, last match wins.
The value is read only from the environment (with a JVM system-property fallback for
tests), never from a P4CONFIG file — a planted .p4config must not influence the
map. The port-var name uppercases P4PORT and replaces every non-alphanumeric character with
_, e.g. ssl:perforce.example.com:1666 → P4_SSL_PERFORCE_EXAMPLE_COM_1666_SYSTEMIGNORE.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the P4CONFIG environment variable (holds the config-file name).static final StringName of the P4ENVIRO environment variable (holds the enviro-file path).static final StringPrefix for the per-server system-ignore environment variable.static final StringSuffix for the per-server system-ignore environment variable. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildSystemIgnoreEnvVarName(RpcConnection rpcConnection) Returns theP4_<PORT>_SYSTEMIGNOREenvironment-variable name for the given connection.static booleanisProtected(String path, RpcServer server, RpcConnection rpcConnection) Returns true if the given local path is protected and must not be written or sent.static StringresolveP4ConfigFile(RpcServer server) Walks up from the client root to find the P4CONFIG file.static StringResolves the P4ENVIRO file path: the value of the P4ENVIRO environment variable, or the platform default (~/.p4enviro) when unset.static StringsanitizePortForEnvVar(String portStr) Changes the port string to upper case and replaces every character that is not a letter or digit with an underscore.
-
Field Details
-
P4CONFIG_ENV_VAR
Name of the P4CONFIG environment variable (holds the config-file name).- See Also:
-
P4ENVIRO_ENV_VAR
Name of the P4ENVIRO environment variable (holds the enviro-file path).- See Also:
-
SYSTEMIGNORE_ENV_PREFIX
Prefix for the per-server system-ignore environment variable.- See Also:
-
SYSTEMIGNORE_ENV_SUFFIX
Suffix for the per-server system-ignore environment variable.- See Also:
-
-
Method Details
-
isProtected
public static boolean isProtected(@Nonnull String path, @Nonnull RpcServer server, @Nullable RpcConnection rpcConnection) Returns true if the given local path is protected and must not be written or sent.- Parameters:
path- absolute local path to checkserver- connected RPC serverrpcConnection- active RPC connection; may be null to skip the per-server environment-variable lookup (the built-in defaults still apply)- Returns:
- true if the write/send should be blocked
-
buildSystemIgnoreEnvVarName
Returns theP4_<PORT>_SYSTEMIGNOREenvironment-variable name for the given connection. For example, localhost:1666 becomes P4_LOCALHOST_1666_SYSTEMIGNORE. -
sanitizePortForEnvVar
Changes the port string to upper case and replaces every character that is not a letter or digit with an underscore. For example ssl:perforce.example.com:1666 becomes SSL_PERFORCE_EXAMPLE_COM_1666. -
resolveP4ConfigFile
Walks up from the client root to find the P4CONFIG file. Returns null if the P4CONFIG environment variable is not set, the client root is unavailable, or no matching file is found in the directory tree. -
resolveP4EnviroFile
Resolves the P4ENVIRO file path: the value of the P4ENVIRO environment variable, or the platform default (~/.p4enviro) when unset. Never returns null.
-