Package jadex.bridge
Class ResourceIdentifier
- java.lang.Object
-
- jadex.bridge.ResourceIdentifier
-
- All Implemented Interfaces:
IResourceIdentifier
public class ResourceIdentifier extends java.lang.Object implements IResourceIdentifier
Default implementation for resource identification. Contains only a local identifier and a global identifier that can be used to find the resource.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ENABLE_HASHES
protected IGlobalResourceIdentifier
gid
The global identifier.protected static java.util.Set<java.lang.String>
IGNORED
The ignored directories for determining resource project name.protected static java.util.Set<java.lang.String>
JADEX_PROJECTS
The jadex project names.protected ILocalResourceIdentifier
lid
The local identifier.
-
Constructor Summary
Constructors Constructor Description ResourceIdentifier()
Create a resource identifier.ResourceIdentifier(ILocalResourceIdentifier lid, IGlobalResourceIdentifier gid)
Create a resource identifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Test if equals.IGlobalResourceIdentifier
getGlobalIdentifier()
Get the global identifier.ILocalResourceIdentifier
getLocalIdentifier()
Get the local identifier.int
hashCode()
Get the hashcode.static boolean
isHashGid(IResourceIdentifier rid)
Test if the global id is non-null and a hash id.static boolean
isJadexRid(IResourceIdentifier rid)
Test if a rid refers to one of the jadex platform modules, i.e.static boolean
isLocal(IResourceIdentifier rid, IComponentIdentifier root)
Test if a rid is local to this platform.static IResourceIdentifier
ridFromProperties(Properties rid, IComponentIdentifier root)
Create a rid from properties.static Properties
ridToProperties(IResourceIdentifier rid, IComponentIdentifier root)
Create properties from rid.void
setGlobalIdentifier(IGlobalResourceIdentifier gid)
Set the global identifier.void
setLocalIdentifier(ILocalResourceIdentifier lid)
Set the local identifier.java.lang.String
toString()
Get a string representation of this object.
-
-
-
Field Detail
-
ENABLE_HASHES
public static final boolean ENABLE_HASHES
- See Also:
- Constant Field Values
-
IGNORED
protected static final java.util.Set<java.lang.String> IGNORED
The ignored directories for determining resource project name.
-
JADEX_PROJECTS
protected static final java.util.Set<java.lang.String> JADEX_PROJECTS
The jadex project names.
-
lid
protected ILocalResourceIdentifier lid
The local identifier.
-
gid
protected IGlobalResourceIdentifier gid
The global identifier.
-
-
Constructor Detail
-
ResourceIdentifier
public ResourceIdentifier()
Create a resource identifier.
-
ResourceIdentifier
public ResourceIdentifier(ILocalResourceIdentifier lid, IGlobalResourceIdentifier gid)
Create a resource identifier.- Parameters:
lid
- The local identifier.gid
- The global idenfifier.
-
-
Method Detail
-
getLocalIdentifier
public ILocalResourceIdentifier getLocalIdentifier()
Get the local identifier. The local identifier consists of the platform component identifier and the URL of the resource.- Specified by:
getLocalIdentifier
in interfaceIResourceIdentifier
- Returns:
- The local identifier.
-
getGlobalIdentifier
public IGlobalResourceIdentifier getGlobalIdentifier()
Get the global identifier.- Specified by:
getGlobalIdentifier
in interfaceIResourceIdentifier
- Returns:
- The global identifier.
-
setLocalIdentifier
public void setLocalIdentifier(ILocalResourceIdentifier lid)
Set the local identifier.- Parameters:
lid
- The lid to set.
-
setGlobalIdentifier
public void setGlobalIdentifier(IGlobalResourceIdentifier gid)
Set the global identifier.- Parameters:
gid
- The gid to set.
-
hashCode
public int hashCode()
Get the hashcode.- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if equals. They are equal when a) global ids are equal b) or global ids are null and local ids are equal.- Overrides:
equals
in classjava.lang.Object
-
isHashGid
public static boolean isHashGid(IResourceIdentifier rid)
Test if the global id is non-null and a hash id.
-
ridToProperties
public static Properties ridToProperties(IResourceIdentifier rid, IComponentIdentifier root)
Create properties from rid.- Parameters:
The
- resource identifier.- Returns:
- rid The resource identifier properties.
-
ridFromProperties
public static IResourceIdentifier ridFromProperties(Properties rid, IComponentIdentifier root)
Create a rid from properties.- Parameters:
rid
- The resource identifier properties.- Returns:
- The resource identifier.
-
isLocal
public static boolean isLocal(IResourceIdentifier rid, IComponentIdentifier root)
Test if a rid is local to this platform. Test is performed by MAC address. Root cid is only used as fallback.
-
isJadexRid
public static boolean isJadexRid(IResourceIdentifier rid)
Test if a rid refers to one of the jadex platform modules, i.e. is not application-specific.
-
toString
public java.lang.String toString()
Get a string representation of this object.- Overrides:
toString
in classjava.lang.Object
-
-