class DeploymentIdGenerator {

    public static String extractUuid( final String deploymentId ) throws Exception {
        //deployments created by the kie-wb typically has the from "kie#uuid#XXXX", where could XXXX be a string added
        // by the wildfly server and that we can't manage. For example for the driver deployments.

        if ( deploymentId != null && isKieGenerated( deploymentId ) ) {
            Matcher matcher = KIE_ID.matcher( deploymentId );
            if ( matcher.find() ) {
                String[] parts = matcher.group().split( SEPARATOR );
                if ( parts.length > 1 ) {
                    return parts[1];
                }
            }
        }
        throw new Exception( "Unknown deployment identifier." + deploymentId );
    }

}